////////////////////////////////////////////////////////// // This class has been automatically generated on // Wed Jan 4 14:26:20 2017 by ROOT version 5.34/34 // from TTree TrackEff_MissingProton_4pi/TrackEff_MissingProton_4pi // found on file: /cache/halld/RunPeriod-2016-02/recon/ver03/tree_trackeff/merged/tree_trackeff_011366.root ////////////////////////////////////////////////////////// #ifndef Selector_TrackEff_h #define Selector_TrackEff_h #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "particleType.h" using namespace std; class Selector_TrackEff : public TSelector { public: //CONSTRUCTOR Selector_TrackEff(TTree* locTree = NULL) : fChain(0), dMinTrackMatchFOM(5.73303E-7), dSetupFlag(false), dNum2DPBins(400), dNum2DThetaBins(360), dNum2DPhiBins(360), dNum2DDeltaPBins(2000), dNum2DDeltaPOverPBins(1000), dNum2DDeltaThetaBins(800), dNum2DDeltaPhiBins(1000), dNumMatchFOMBins(500), dNum2DMatchFOMBins(250), dNum2DMissingBeamEBins(500), dNum2DMissingPtBins(500), dNum2DMissingPxyBins(500), dNum2DMissingPSigmaBins(1000), dNum2DMissingPSigmaOverPBins(1000), dNum2DMissingThetaSigmaBins(500), dNum2DMissingPhiSigmaBins(600), dMinP(0.0), dMaxP(9.0), dMinTheta(0.0), dMaxTheta(180.0), dMinPhi(-180.0), dMaxPhi(180.0), dMinDeltaP(-10.0), dMaxDeltaP(10.0), dMinDeltaPOverP(-1.0), dMaxDeltaPOverP(1.0), dMinDeltaTheta(-40.0), dMaxDeltaTheta(40.0), dMinDeltaPhi(-50.0), dMaxDeltaPhi(50.0), dMinMissingBeamE(-0.5), dMaxMissingBeamE(0.5), dMaxMissingPt(1.0), dMinMissingPxy(-0.5), dMaxMissingPxy(0.5), dMaxMissingPSigma(0.1), dMaxMissingPSigmaOverP(0.1), dMaxMissingThetaSigma(12.0), dMaxMissingPhiSigma(12.0) {} //Tree TTree* fChain; //!pointer to the analyzed TTree or TChain double dMinTrackMatchFOM; bool dSetupFlag; //Binning unsigned int dNum2DPBins, dNum2DThetaBins, dNum2DPhiBins, dNum2DDeltaPBins, dNum2DDeltaPOverPBins, dNum2DDeltaThetaBins, dNum2DDeltaPhiBins; unsigned int dNumMatchFOMBins, dNum2DMatchFOMBins, dNum2DMissingBeamEBins, dNum2DMissingPtBins, dNum2DMissingPxyBins; unsigned int dNum2DMissingPSigmaBins, dNum2DMissingPSigmaOverPBins, dNum2DMissingThetaSigmaBins, dNum2DMissingPhiSigmaBins; double dMinP, dMaxP, dMinTheta, dMaxTheta, dMinPhi, dMaxPhi, dMinDeltaP, dMaxDeltaP, dMinDeltaPOverP, dMaxDeltaPOverP, dMinDeltaTheta, dMaxDeltaTheta; double dMinDeltaPhi, dMaxDeltaPhi, dMinMissingBeamE, dMaxMissingBeamE, dMaxMissingPt, dMinMissingPxy, dMaxMissingPxy; double dMaxMissingPSigma, dMaxMissingPSigmaOverP, dMaxMissingThetaSigma, dMaxMissingPhiSigma; //Other Control int dRunNumber; int dComboCounter; bool dTrackFoundFlag; bool dFinalizeFlag; //Channel info Particle_t dMissingPID; bool dIs4PiFlag; bool dIs3PiFlag; double dBeamBunchPeriod; //RF beam bunches //min/max #peaks range pair dBeamBunchRange_RFSignal; //e.g. 0, 0 pair dBeamBunchRange_RFSideband; //e.g. 1, 1 for +/-1 (or 2, 4 for +/-(2 -> 4)) double dRFSidebandWeight; //binning: vertex-z double dMinVertexZ; double dMaxVertexZ; double dVertexZBinSize; int dNumVertexZBins; //binning: mass int dNumMassBins; int dNum2DMassBins; double dMinMissingMass; double dMaxMissingMass; //binning: energy int dNumBeamEnergyBins; int dNum2DBeamEnergyBins; double dMinBeamEnergy; double dMaxBeamEnergy; int dNumFitBeamEnergyBins; double dFitBeamEnergyBinSize; //Output TFile* dOutputFile; TProofOutputFile* dProofFile; // Beam Hists TH1I* dHist_BeamRFDeltaT; TH1D* dHist_BeamEnergy; TH1D* dHist_BeamEnergy_Found; TH1D* dHist_BeamEnergy_Missing; // Missing p4 TH2D* dHist_TotalMissingEnergyVsBeamEnergy; TH2D* dHist_TotalMissingPtVsBeamEnergy; TH2D* dHist_TotalMissingPyVsPx; // Mass hists TH1D* dHist_MissingMass; TH2D* dHist_MissingMassVsBeamEnergy; TH2D* dHist_MissingMassVsBeamEnergy_Found; TH2D* dHist_MissingMassVsBeamEnergy_Missing; TH2D* dHist_ReconMissingMassSquaredVsBeamEnergy; // Matching hists TH1I* dHist_MatchingFOM; TH2I* dHist_MatchingFOMVsDeltaPOverP; TH2I* dHist_MatchingFOMVsDeltaPOverP_LogY; TH2I* dHist_MatchingFOMVsDeltaTheta; TH2I* dHist_MatchingFOMVsDeltaTheta_LogY; TH2I* dHist_MatchingFOMVsDeltaPhi; TH2I* dHist_MatchingFOMVsDeltaPhi_LogY; // Resolution hists // keys: beam energy bin map dHistMap_Resolution_DeltaPVsP; map dHistMap_Resolution_DeltaPVsTheta; map dHistMap_Resolution_DeltaPVsPhi; map dHistMap_Resolution_DeltaPOverPVsP; map dHistMap_Resolution_DeltaPOverPVsTheta; map dHistMap_Resolution_DeltaPOverPVsPhi; map dHistMap_Resolution_DeltaThetaVsP; map dHistMap_Resolution_DeltaThetaVsTheta; map dHistMap_Resolution_DeltaThetaVsPhi; map dHistMap_Resolution_DeltaPhiVsP; map dHistMap_Resolution_DeltaPhiVsTheta; map dHistMap_Resolution_DeltaPhiVsPhi; // Missing mass uncertainty hists // keys: beam energy bin map dHistMap_MissingPSigmaVsP; map dHistMap_MissingPSigmaVsTheta; map dHistMap_MissingPSigmaVsPhi; map dHistMap_MissingPSigmaOverPVsP; map dHistMap_MissingPSigmaOverPVsTheta; map dHistMap_MissingPSigmaOverPVsPhi; map dHistMap_MissingThetaSigmaVsP; map dHistMap_MissingThetaSigmaVsTheta; map dHistMap_MissingThetaSigmaVsPhi; map dHistMap_MissingPhiSigmaVsP; map dHistMap_MissingPhiSigmaVsTheta; map dHistMap_MissingPhiSigmaVsPhi; // Efficiency hists // keys: signal peak flag, beam energy bin //vector: vertex-z bins map > > dHistMap_TrackFound_PVsTheta; map > > dHistMap_TrackMissing_PVsTheta; map > > dHistMap_TrackFound_PhiVsTheta; map > > dHistMap_TrackMissing_PhiVsTheta; // Resolution cuts //string is e.g. DeltaPOverPVsP //int is beam energy bin map > dResolutionFuncMap_Means; map > dResolutionFuncMap_Sigmas; // Mass cuts //bool is true/false for found/missing map dMassFuncMap_Means; map dMassFuncMap_Sigmas; // Setup void Setup(void); void Set_BeamBunchPeriod(void); void Setup_Branches(TTree *tree); void Setup_Histograms(void); void Setup_Cuts(void); // Create histograms double* Generate_LogYBinning(int& locNumBins); void Create_MassHists(void); void Create_MatchingHists(void); void Create_ResolutionHists(void); void Create_MissingP3SigmaHists(void); void Create_EfficiencyHists(bool locSignalPeakFlag); // Read in cuts void Setup_ResolutionCuts(void); void Setup_MassCuts(void); // Select bins and cut double Get_RFWeight(void); bool Select_MassBin(bool locTrackFoundFlag); int Select_BeamEnergyBin(void); bool Cut_DeltaPOverP(size_t locEBin, double locP, double locTheta, double locPhi, double locDeltaPOverP); bool Cut_DeltaTheta(size_t locEBin, double locP, double locTheta, double locPhi, double locDeltaTheta); bool Cut_DeltaPhi(size_t locEBin, double locP, double locTheta, double locPhi, double locDeltaPhi); // Fill histograms void Fill_MatchingHists(void); Int_t Fill_ResolutionHists(double locRFWeight, int locBeamEnergyBin); //returns index of best track match (-1 if fails cut) void Fill_MissingP3SigmaHists(double locRFWeight, int locBeamEnergyBin); void Fill_MassHists(double locRFWeight, Int_t locBestTrackMatchIndex); //index = -1 means track not found void Fill_EffHists(double locRFWeight, bool locTrackFoundFlag, bool locSignalPeakFlag, int locBeamEnergyBin); // Finalize void Finalize(void); // Declaration of leaf types ULong64_t EventNumber; Float_t BeamEnergy; Float_t BeamRFDeltaT; Float_t ComboVertexZ; UChar_t NumExtraTracks; Float_t MissingMassSquared; Float_t KinFitChiSq; UInt_t KinFitNDF; TVector3 *MissingP3; Float_t MissingP3_CovPxPx; Float_t MissingP3_CovPxPy; Float_t MissingP3_CovPxPz; Float_t MissingP3_CovPyPy; Float_t MissingP3_CovPyPz; Float_t MissingP3_CovPzPz; UInt_t NumUnusedWireBased; UInt_t NumUnusedTimeBased; Float_t ReconMatchFOM_WireBased[100]; //[NumUnusedWireBased] Float_t ReconTrackingFOM_WireBased[100]; //[NumUnusedWireBased] TClonesArray *ReconP3_WireBased; Float_t ReconMatchFOM[100]; //[NumUnusedTimeBased] Float_t ReconTrackingFOM[100]; //[NumUnusedTimeBased] TClonesArray *ReconP3; Float_t MeasuredMissingE[100]; //[NumUnusedTimeBased] UInt_t TrackCDCRings[100]; //[NumUnusedTimeBased] UInt_t TrackFDCPlanes[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPxPx[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPxPy[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPxPz[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPyPy[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPyPz[100]; //[NumUnusedTimeBased] Float_t ReconP3_CovPzPz[100]; //[NumUnusedTimeBased] // List of branches TBranch *b_EventNumber; //! TBranch *b_BeamEnergy; //! TBranch *b_BeamRFDeltaT; //! TBranch *b_ComboVertexZ; //! TBranch *b_NumExtraTracks; //! TBranch *b_MissingMassSquared; //! TBranch *b_KinFitChiSq; //! TBranch *b_KinFitNDF; //! TBranch *b_MissingP3; //! TBranch *b_MissingP3_CovPxPx; //! TBranch *b_MissingP3_CovPxPy; //! TBranch *b_MissingP3_CovPxPz; //! TBranch *b_MissingP3_CovPyPy; //! TBranch *b_MissingP3_CovPyPz; //! TBranch *b_MissingP3_CovPzPz; //! TBranch *b_NumUnusedWireBased; //! TBranch *b_NumUnusedTimeBased; //! TBranch *b_ReconMatchFOM_WireBased; //! TBranch *b_ReconTrackingFOM_WireBased; //! TBranch *b_ReconP3_WireBased; //! TBranch *b_ReconMatchFOM; //! TBranch *b_ReconTrackingFOM; //! TBranch *b_ReconP3; //! TBranch *b_MeasuredMissingE; //! TBranch *b_TrackCDCRings; //! TBranch *b_TrackFDCPlanes; //! TBranch *b_ReconP3_CovPxPx; //! TBranch *b_ReconP3_CovPxPy; //! TBranch *b_ReconP3_CovPxPz; //! TBranch *b_ReconP3_CovPyPy; //! TBranch *b_ReconP3_CovPyPz; //! TBranch *b_ReconP3_CovPzPz; //! virtual ~Selector_TrackEff() { } virtual Int_t Version() const { return 2; } virtual void Begin(TTree *tree); virtual void SlaveBegin(TTree *tree); virtual void Init(TTree *tree); virtual Bool_t Notify(); virtual Bool_t Process(Long64_t entry); virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; } virtual void SetOption(const char *option) { fOption = option; } virtual void SetObject(TObject *obj) { fObject = obj; } virtual void SetInputList(TList *input) { fInput = input; } virtual TList *GetOutputList() const { return fOutput; } virtual void SlaveTerminate(); virtual void Terminate(); ClassDef(Selector_TrackEff,0); }; #endif #ifdef Selector_TrackEff_cxx void Selector_TrackEff::Setup_Branches(TTree *tree) { // The Init() function is called when the selector needs to initialize // a new tree or chain. Typically here the branch addresses and branch // pointers of the tree will be set. // It is normally not necessary to make changes to the generated // code, but the routine can be extended by the user if needed. // Init() will be called many times when running on PROOF // (once per file to be processed). // Set object pointer MissingP3 = 0; ReconP3_WireBased = 0; ReconP3 = 0; // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fChain->SetMakeClass(1); fChain->SetBranchAddress("EventNumber", &EventNumber, &b_EventNumber); fChain->SetBranchAddress("BeamEnergy", &BeamEnergy, &b_BeamEnergy); fChain->SetBranchAddress("BeamRFDeltaT", &BeamRFDeltaT, &b_BeamRFDeltaT); fChain->SetBranchAddress("ComboVertexZ", &ComboVertexZ, &b_ComboVertexZ); fChain->SetBranchAddress("NumExtraTracks", &NumExtraTracks, &b_NumExtraTracks); fChain->SetBranchAddress("MissingMassSquared", &MissingMassSquared, &b_MissingMassSquared); fChain->SetBranchAddress("KinFitChiSq", &KinFitChiSq, &b_KinFitChiSq); fChain->SetBranchAddress("KinFitNDF", &KinFitNDF, &b_KinFitNDF); fChain->SetBranchAddress("MissingP3", &MissingP3, &b_MissingP3); fChain->SetBranchAddress("MissingP3_CovPxPx", &MissingP3_CovPxPx, &b_MissingP3_CovPxPx); fChain->SetBranchAddress("MissingP3_CovPxPy", &MissingP3_CovPxPy, &b_MissingP3_CovPxPy); fChain->SetBranchAddress("MissingP3_CovPxPz", &MissingP3_CovPxPz, &b_MissingP3_CovPxPz); fChain->SetBranchAddress("MissingP3_CovPyPy", &MissingP3_CovPyPy, &b_MissingP3_CovPyPy); fChain->SetBranchAddress("MissingP3_CovPyPz", &MissingP3_CovPyPz, &b_MissingP3_CovPyPz); fChain->SetBranchAddress("MissingP3_CovPzPz", &MissingP3_CovPzPz, &b_MissingP3_CovPzPz); fChain->SetBranchAddress("NumUnusedWireBased", &NumUnusedWireBased, &b_NumUnusedWireBased); fChain->SetBranchAddress("NumUnusedTimeBased", &NumUnusedTimeBased, &b_NumUnusedTimeBased); fChain->SetBranchAddress("ReconMatchFOM_WireBased", &ReconMatchFOM_WireBased, &b_ReconMatchFOM_WireBased); fChain->SetBranchAddress("ReconTrackingFOM_WireBased", &ReconTrackingFOM_WireBased, &b_ReconTrackingFOM_WireBased); fChain->SetBranchAddress("ReconP3_WireBased", &ReconP3_WireBased, &b_ReconP3_WireBased); fChain->SetBranchAddress("ReconMatchFOM", ReconMatchFOM, &b_ReconMatchFOM); fChain->SetBranchAddress("ReconTrackingFOM", ReconTrackingFOM, &b_ReconTrackingFOM); fChain->SetBranchAddress("ReconP3", &ReconP3, &b_ReconP3); fChain->SetBranchAddress("MeasuredMissingE", MeasuredMissingE, &b_MeasuredMissingE); fChain->SetBranchAddress("TrackCDCRings", TrackCDCRings, &b_TrackCDCRings); fChain->SetBranchAddress("TrackFDCPlanes", TrackFDCPlanes, &b_TrackFDCPlanes); fChain->SetBranchAddress("ReconP3_CovPxPx", ReconP3_CovPxPx, &b_ReconP3_CovPxPx); fChain->SetBranchAddress("ReconP3_CovPxPy", ReconP3_CovPxPy, &b_ReconP3_CovPxPy); fChain->SetBranchAddress("ReconP3_CovPxPz", ReconP3_CovPxPz, &b_ReconP3_CovPxPz); fChain->SetBranchAddress("ReconP3_CovPyPy", ReconP3_CovPyPy, &b_ReconP3_CovPyPy); fChain->SetBranchAddress("ReconP3_CovPyPz", ReconP3_CovPyPz, &b_ReconP3_CovPyPz); fChain->SetBranchAddress("ReconP3_CovPzPz", ReconP3_CovPzPz, &b_ReconP3_CovPzPz); } Bool_t Selector_TrackEff::Notify() { // The Notify() function is called when a new file is opened. This // can be either for a new TTree in a TChain or when when a new TTree // is started when using PROOF. It is normally not necessary to make changes // to the generated code, but the routine can be extended by the // user if needed. The return value is currently not used. return kTRUE; } #endif // #ifdef Selector_TrackEff_cxx