Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:18:05

0001 //////////////////////////////////////////////////////////
0002 // This class has been automatically generated on
0003 // Sat Nov 23 01:L:33 2024 by ROOT version 6.26/06
0004 // from TTree tree/sPHENIX info.
0005 // found on file: ana439_Electron_2GeV_00150.root
0006 //////////////////////////////////////////////////////////
0007 
0008 #ifndef InttSeedTrackPerformance_h
0009 #define InttSeedTrackPerformance_h
0010 
0011 #include <TROOT.h>
0012 #include <TChain.h>
0013 #include <TFile.h>
0014 
0015 #include <TMath.h>
0016 #include "Fit/Fitter.h"
0017 #include <Math/Functor.h>
0018 
0019 #include <TH1.h>
0020 #include <TH2.h>
0021 #include <TH3.h>
0022 #include <TF1.h>
0023 #include <TProfile.h>
0024 #include <TProfile2D.h>
0025 
0026 #include "TArc.h"
0027 
0028 #include "SPHTracKuma.h"
0029 #include "JYInttSeedTracking.h"
0030 
0031 // Header file for the classes stored in the TTree if any.
0032 #include <vector>
0033 
0034 // struct hitStruct{
0035 //  Double_t r;
0036 //    Double_t z;
0037 //  Double_t phi;
0038 //    Double_t eta;
0039 //    Double_t pt;
0040 //    Double_t energy;
0041 // };
0042 
0043 class InttSeedTrackPerformance {
0044 public :
0045    TTree          *fChain;   //!pointer to the analyzed TTree or TChain
0046    Int_t           fCurrent; //!current Tree number in a TChain
0047 
0048 // Fixed size dimensions of array or collections stored in the TTree if any.
0049 
0050     // Declaration of leaf types
0051     Int_t           trk_NClus;
0052     std::vector<int>     *trk_system;
0053     std::vector<int>     *trk_layer;
0054     std::vector<int>     *trk_adc;
0055     std::vector<double>  *trk_X;
0056     std::vector<double>  *trk_Y;
0057     std::vector<double>  *trk_Z;
0058     std::vector<int>     *trk_size;
0059     std::vector<int>     *trk_phi_size;
0060     std::vector<int>     *trk_Z_size;
0061 
0062     Int_t           nTowers;
0063     std::vector<int>     *tower_system;
0064     std::vector<double>  *tower_X;
0065     std::vector<double>  *tower_Y;
0066     std::vector<double>  *tower_Z;
0067     std::vector<double>  *tower_Eta;
0068     std::vector<double>  *tower_Phi;
0069     std::vector<double>  *tower_Eta_test;
0070     std::vector<double>  *tower_Phi_test;
0071     std::vector<double>  *tower_Eta_bin;
0072     std::vector<double>  *tower_Phi_bin;
0073     std::vector<double>  *tower_edep;
0074 
0075     Int_t           nCaloClus;
0076     std::vector<int>     *caloClus_system;
0077     std::vector<double>  *caloClus_X;
0078     std::vector<double>  *caloClus_Y;
0079     std::vector<double>  *caloClus_Z;
0080     std::vector<double>  *caloClus_R;
0081     std::vector<double>  *caloClus_Phi;
0082     std::vector<double>  *caloClus_edep;
0083 
0084     Int_t           NTruthVtx;
0085     Float_t         TruthPV_trig_x;
0086     Float_t         TruthPV_trig_y;
0087     Float_t         TruthPV_trig_z;
0088     Int_t           NPrimaryG4P;
0089     std::vector<float>   *PrimaryG4P_Pt;
0090     std::vector<float>   *PrimaryG4P_Eta;
0091     std::vector<float>   *PrimaryG4P_Phi;
0092     std::vector<float>   *PrimaryG4P_E;
0093     std::vector<int>     *PrimaryG4P_PID;
0094     std::vector<bool>    *PrimaryG4P_isChargeHadron;
0095 
0096     // List of branches
0097     TBranch        *b_trk_NClus;   //!
0098     TBranch        *b_trk_system;   //!
0099     TBranch        *b_trk_layer;   //!
0100     TBranch        *b_trk_adc;   //!
0101     TBranch        *b_trk_X;   //!
0102     TBranch        *b_trk_Y;   //!
0103     TBranch        *b_trk_Z;   //!
0104     TBranch        *b_trk_size;   //!
0105     TBranch        *b_trk_phi_size;   //!
0106     TBranch        *b_trk_Z_size;   //!
0107 
0108     TBranch        *b_nTowers;   //!
0109     TBranch        *b_tower_system;   //!
0110     TBranch        *b_tower_X;   //!
0111     TBranch        *b_tower_Y;   //!
0112     TBranch        *b_tower_Z;   //!
0113     TBranch        *b_tower_Eta;   //!
0114     TBranch        *b_tower_Phi;   //!
0115     TBranch        *b_tower_Eta_test;   //!
0116     TBranch        *b_tower_Phi_test;   //!
0117     TBranch        *b_tower_Eta_bin;   //!
0118     TBranch        *b_tower_Phi_bin;   //!
0119     TBranch        *b_tower_edep;   //!
0120 
0121     TBranch        *b_nCaloClus;   //!
0122     TBranch        *b_caloClus_system;   //!
0123     TBranch        *b_caloClus_X;   //!
0124     TBranch        *b_caloClus_Y;   //!
0125     TBranch        *b_caloClus_Z;   //!
0126     TBranch        *b_caloClus_R;   //!
0127     TBranch        *b_caloClus_Phi;   //!
0128     TBranch        *b_caloClus_edep;   //!
0129 
0130     TBranch        *b_NTruthVtx;   //!
0131     TBranch        *b_TruthPV_trig_x;   //!
0132     TBranch        *b_TruthPV_trig_y;   //!
0133     TBranch        *b_TruthPV_trig_z;   //!
0134 
0135     TBranch        *b_NPrimaryG4P;   //!
0136     TBranch        *b_PrimaryG4P_Pt;   //!
0137     TBranch        *b_PrimaryG4P_Eta;   //!
0138     TBranch        *b_PrimaryG4P_Phi;   //!
0139     TBranch        *b_PrimaryG4P_E;   //!
0140     TBranch        *b_PrimaryG4P_PID;   //!
0141     TBranch        *b_PrimaryG4P_isChargeHadron;   //!
0142 
0143     InttSeedTrackPerformance(TTree *tree=0, std::string fInputName="", std::string fOutputName="", Int_t runNum=0);
0144     virtual ~InttSeedTrackPerformance();
0145     virtual Int_t    GetEntry(Long64_t entry);
0146     virtual Long64_t LoadTree(Long64_t entry);
0147     virtual void     Init(TTree *tree);
0148     virtual void     Loop(Int_t runNum);
0149 
0150     // Kuma Members ======
0151     std::string fDir = "";
0152 
0153     std::string fInput = "";
0154     std::string fOutput = "";
0155     TFile *oFile;
0156 
0157     Int_t qaEvent = 1;
0158     Int_t pubEvNum = 0;
0159 
0160     bool m_bDecayEvent = false;
0161 
0162     std::vector<Int_t> m_vTargetEvents;
0163 
0164     std::vector<tracKuma> m_tracks;
0165 
0166     std::vector<hitStruct> m_TruthParticle;
0167 
0168     std::vector<hitStruct> m_fMvtxHits;
0169     std::vector<hitStruct> m_sMvtxHits;
0170     std::vector<hitStruct> m_tMvtxHits;
0171 
0172     std::vector<hitStruct> m_iInttHits;
0173     std::vector<hitStruct> m_oInttHits;
0174 
0175     std::vector<hitStruct> m_TpcHits;
0176 
0177     std::vector<hitStruct> m_emcalHits;
0178     std::vector<hitStruct> m_iHCalHits;
0179     std::vector<hitStruct> m_oHCalHits;
0180 
0181     std::vector<std::vector<hitStruct>> m_vTruthParticle;
0182 
0183     std::vector<std::vector<hitStruct>> m_viInttHits;
0184     std::vector<std::vector<hitStruct>> m_voInttHits;
0185 
0186     std::vector<std::vector<hitStruct>> m_vTpcHits;
0187 
0188     std::vector<std::vector<hitStruct>> m_vemcalHits;
0189     std::vector<std::vector<hitStruct>> m_viHCalHits;
0190     std::vector<std::vector<hitStruct>> m_voHCalHits;
0191 
0192     TH2D* m_HINTTHitMap;
0193     TH2D* m_HGlobalHitMap;
0194 
0195     TProfile2D* m_HECalPhiVsE;
0196     TProfile2D* m_HIHCalPhiVsE;
0197     TProfile2D* m_HOHCalPhiVsE;
0198 
0199     TH1D* m_HMatchCalEVsHighestCalE;
0200 
0201     TH2D* m_HdPhiInttdPhiECal;
0202     TH2D* m_HTruthPtVsdPhiInttdPhiECal;
0203     
0204     TH2D* m_HTruthPtVsdPhiIIntt;
0205     TH2D* m_HTruthPtVsdPhiOIntt;
0206 
0207     TH3D* m_HTruthPtVsSagittaPt_rough;
0208     TH3D* m_HTruthPtVsSagittaPt_VtxIntt;
0209     TH3D* m_HTruthPtVsSagittaPt_InttEmcal;
0210     TH3D* m_HTruthPtVsSagittaPt_VtxInttEmcal;
0211     TH3D* m_HTruthPtVsSagittaPt_MvtxInttEmcal;
0212     TH3D* m_HTruthPtVsSagittaPt_VtxMvtxInttEmcal;
0213 
0214 
0215     TH3D* m_HTruthPtVsFitFuncPt_IInttOInttEmcal;
0216 
0217     TH3D* m_HTruthPtVsFitFuncPt_VtxIInttEmcal;
0218     TH3D* m_HTruthPtVsFitFuncPt_VtxOInttEmcal;
0219     TH3D* m_HTruthPtVsFitFuncPt_VtxInttEmcal;
0220 
0221     TH3D* m_HTruthPtVsFitFuncPt_MvtxIInttEmcal;
0222     TH3D* m_HTruthPtVsFitFuncPt_MvtxOInttEmcal;
0223     TH3D* m_HTruthPtVsFitFuncPt_MvtxInttEmcal;
0224 
0225     TH2D* m_HTruthPVsRecoP_InttEmcal;
0226     TH2D* m_HTruthPVsRecoP_MvtxInttEmcal;
0227     TH2D* m_HTruthPVsRecoP_FitFunc;
0228 
0229 
0230     TH2D* m_HTruthPVsEOverP_InttEmcal;
0231     TH2D* m_HTruthPVsEOverP_MvtxInttEmcal;
0232     TH2D* m_HTruthPVsEOverP_FitFunc;
0233 
0234     TH2D* m_HTruthPVsTheta_InttEmcal;
0235     TH2D* m_HTruthPVsTheta_MvtxInttEmcal;
0236 
0237     TH2D* m_HTruthPVsPhi_InttEmcal;
0238     TH2D* m_HTruthPVsPhi_MvtxInttEmcal;
0239 
0240     TH2D* m_dVtxXY_InttEmcal;
0241     TH2D* m_dVtxXY_MvtxInttEmcal;
0242 
0243     TH1D* m_dVtxR_InttEmcal;
0244     TH1D* m_dVtxR_MvtxInttEmcal;
0245 
0246     TH1D* m_dVtxZ_InttEmcal;
0247     TH1D* m_dVtxZ_MvtxInttEmcal;
0248 
0249 
0250     TH3D* m_HDE;
0251 
0252     TH3D* m_HDPhiVsDStraightVsTruPt;
0253 
0254     TH2D* m_HDPhiDStraight_VtxIIntt;
0255     TH1D* m_HDPhiDStraight1D_VtxIIntt;
0256     TH2D* m_HDPhiDStraight_IInttOIntt;
0257     TH1D* m_HDPhiDStraight1D_IInttOIntt;
0258     TH2D* m_HDPhiDStraight_OInttEmcal;
0259     TH1D* m_HDPhiDStraight1D_OInttEmcal;
0260 
0261     TH2D* m_HTruthPtVsDdPhiddStraight_IInttOInttEmcal;
0262 
0263     TH3D* m_HDLVsTruthPtVsEta_VtxIIntt;
0264     TH1D* m_HDL1D_VtxIIntt;
0265     TH3D* m_HDLVsTruthPtVsEta_IInttOIntt;
0266     TH1D* m_HDL1D_IInttOIntt;
0267     TH3D* m_HDLVsTruthPtVsEta_OInttEmcal;
0268     TH1D* m_HDL1D_OInttEmcal;
0269 
0270     TH3D* m_HDPhiVsTruthPtVsEta_IInttOInttEmcal;
0271 
0272     TH3D* m_HDPhiVsTruthPtVsEta_VtxIIntt;
0273     TH3D* m_HDPhiVsTruthPtVsEta_IInttOIntt;
0274     TH3D* m_HDPhiVsTruthPtVsEta_OInttEmcal;
0275 
0276     TH3D* m_HDPhiVsTruthPtVsEta_VtxIInttEmcal;
0277     TH3D* m_HDPhiVsTruthPtVsEta_VtxOInttEmcal;
0278     TH3D* m_HDPhiVsTruthPtVsEta_VtxInttEmcal;
0279     
0280     TH3D* m_HDPhiVsTruthPtVsEta_MvtxIInttEmcal;
0281     TH3D* m_HDPhiVsTruthPtVsEta_MvtxOInttEmcal;
0282     TH3D* m_HDPhiVsTruthPtVsEta_MvtxInttEmcal;
0283     TProfile* m_HDPhiVsTruthPtProf_IInttOInttEmcal;
0284 
0285     TProfile* m_HDPhiVsTruthPtProf_VtxIIntt;
0286     TProfile* m_HDPhiVsTruthPtProf_IInttOIntt;
0287     TProfile* m_HDPhiVsTruthPtProf_OInttEmcal;
0288 
0289     TProfile* m_HDPhiVsTruthPtProf_VtxIInttEmcal;
0290     TProfile* m_HDPhiVsTruthPtProf_VtxOInttEmcal;
0291     TProfile* m_HDPhiVsTruthPtProf_VtxInttEmcal;
0292 
0293     TProfile* m_HDPhiVsTruthPtProf_MvtxIInttEmcal;
0294     TProfile* m_HDPhiVsTruthPtProf_MvtxOInttEmcal;
0295     TProfile* m_HDPhiVsTruthPtProf_MvtxInttEmcal; 
0296     TH1D* m_HPtEfficiency;
0297     TH1D* m_HTruTrackNum;
0298 
0299     // == member functions == 
0300     void HistInit();
0301 
0302     void CheckPrimP(std::vector<hitStruct >& m_TruthParticle);
0303 
0304     void ReadInttHitting(std::vector<hitStruct >& vFMvtxHits,\
0305     std::vector<hitStruct >& vSMvtxHits, std::vector<hitStruct >& vTMvtxHits,\
0306     std::vector<hitStruct >& vIInttHits, std::vector<hitStruct >& vOInttHits,\
0307     std::vector<hitStruct >& vTpcHits);
0308 
0309     void ReadCalHitting(std::vector<hitStruct >& vEmcalHits,\
0310     std::vector<hitStruct >& vIHCalHits, std::vector<hitStruct >& vOHcalHits);
0311 
0312     void ReadCalCluHitting(std::vector<hitStruct >& vEmcalHits,\
0313     std::vector<hitStruct >& vIHCalHits, std::vector<hitStruct >& vOHcalHits);
0314 
0315 
0316     // Track Performance QA functions =======================================                                       
0317     Int_t TruRecoMatching(hitStruct truthP, std::vector<tracKuma> vRecoTrk, std::vector<Int_t> vMatchiedRecoTrkId);
0318     
0319     void TrackQA(std::vector<hitStruct> vTruthPs, std::vector<hitStruct> vEmcalHits);
0320     
0321     Int_t TruRecoMatching(hitStruct truthP);
0322 
0323     void DeltaPtPerform(hitStruct truthP, tracKuma trk);
0324     void TrackOtherPropertiesWTruth(hitStruct truthP, tracKuma trk,\
0325     Double_t sagittaR, Double_t centerX, Double_t centerY, Double_t recoPt,\
0326     TH2D* hTruthPVsTheta, TH2D* hTruthPVsPhi, TH2D* hTruthPVsRecoP, TH2D* hTruthPVsEOverP,\
0327     TH2D* hDVtxXY, TH1D* hDVtxR, TH1D* hDVtxZ);
0328 
0329     void CaloEnergyQA(Int_t CalId, std::vector<hitStruct > calHits);
0330     bool ParticleDecayCheck(tracKuma trk, std::vector<hitStruct > vEmcalHits);
0331 
0332     void EstimateMagneticShift(hitStruct truthP, tracKuma trk);
0333     // Track Performance QA functions =======================================
0334 
0335 
0336     void DrawEventDisplay(Int_t eventId, std::vector<tracKuma > trks);
0337     void EventJudge(Int_t eventNum, Double_t targetVal, Double_t minLim, Double_t maxLim, bool bIn);
0338     void ShowEventInfo();
0339     void ShowTrackInfo(tracKuma trk, Double_t dPt, Double_t centerX, Double_t centerY, Double_t sagittaR);
0340 
0341     void ResetValuesForEvent();
0342     void AllResetValuesForEvent();
0343     void PartResetValuesForEvent();
0344 
0345     void WrightHists();
0346 
0347     void ChecKuma(std::string checkNo);
0348     // Kuma Members ======
0349     
0350 };
0351 
0352 
0353 
0354 #endif
0355