CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/QCDAnalysis/UEAnalysis/root/UEAnalysisOnRootple.h

Go to the documentation of this file.
00001 
00002 // This class has been automatically generated on
00003 // Tue Sep 11 11:54:39 2007 by ROOT version 5.14/00b
00004 // from TTree UEAnalysisTree/UE Analysis Tree 
00005 // found on file: MB_Pt05/UnderlyingEvent_RootFile_Result.root
00007 
00008 #ifndef UEAnalysisOnRootple_h
00009 #define UEAnalysisOnRootple_h
00010 
00011 #include <TROOT.h>
00012 #include <TChain.h>
00013 #include <TFile.h>
00014 #include <TH1F.h>
00015 #include <TProfile.h>
00016 #include <TH2D.h>
00017 #include <iostream>
00018 #include <fstream>
00019 
00020 //
00021 #include <TClonesArray.h>
00022 #include <TObjString.h>
00023 //
00024 
00025 class UEAnalysisOnRootple {
00026 public :
00027 
00028   // declare file handle here
00029   TFile *f;
00030 
00031   TTree          *fChain;   
00032   Int_t           fCurrent; 
00033   
00034   // Declaration of leave types
00035   Int_t           EventKind;
00036   Int_t           NumberMCParticles;
00037   Float_t         MomentumMC[1000];   //[NumberMCParticles]
00038   Float_t         TransverseMomentumMC[1000];   //[NumberMCParticles]
00039   Float_t         EtaMC[1000];   //[NumberMCParticles]
00040   Float_t         PhiMC[1000];   //[NumberMCParticles]
00041   Int_t           NumberTracks;
00042   Float_t         MomentumTK[1000];   //[NumberTracks]
00043   Float_t         TrasverseMomentumTK[1000];   //[NumberTracks]
00044   Float_t         EtaTK[1000];   //[NumberTracks]
00045   Float_t         PhiTK[1000];   //[NumberTracks]
00046   Int_t           NumberInclusiveJet;
00047   Float_t         MomentumIJ[1000];   //[NumberInclusiveJet]
00048   Float_t         TrasverseMomentumIJ[1000];   //[NumberInclusiveJet]
00049   Float_t         EtaIJ[1000];   //[NumberInclusiveJet]
00050   Float_t         PhiIJ[1000];   //[NumberInclusiveJet]
00051   Int_t           NumberChargedJet;
00052   Float_t         MomentumCJ[1000];   //[NumberChargedJet]
00053   Float_t         TrasverseMomentumCJ[1000];   //[NumberChargedJet]
00054   Float_t         EtaCJ[1000];   //[NumberChargedJet]
00055   Float_t         PhiCJ[1000];   //[NumberChargedJet]
00056   Int_t           NumberTracksJet;
00057   Float_t         MomentumTJ[1000];   //[NumberTracksJet]
00058   Float_t         TrasverseMomentumTJ[1000];   //[NumberTracksJet]
00059   Float_t         EtaTJ[1000];   //[NumberTracksJet]
00060   Float_t         PhiTJ[1000];   //[NumberTracksJet]
00061   Int_t           NumberCaloJet;
00062   Float_t         MomentumEHJ[1000];   //[NumberCaloJet]
00063   Float_t         TrasverseMomentumEHJ[1000];   //[NumberCaloJet]
00064   Float_t         EtaEHJ[1000];   //[NumberCaloJet]
00065   Float_t         PhiEHJ[1000];   //[NumberCaloJet]
00066 
00067   //
00068   TClonesArray    *acceptedTriggers;
00069   //
00070 
00071   // List of branches
00072   TBranch        *b_EventKind;   
00073   TBranch        *b_NumberMCParticles;   
00074   TBranch        *b_MomentumMC;   
00075   TBranch        *b_TransverseMomentumMC;   
00076   TBranch        *b_EtaMC;   
00077   TBranch        *b_PhiMC;   
00078   TBranch        *b_NumberTracks;   
00079   TBranch        *b_MomentumTK;   
00080   TBranch        *b_TrasverseMomentumTK;   
00081   TBranch        *b_EtaTK;   
00082   TBranch        *b_PhiTK;   
00083   TBranch        *b_NumberInclusiveJet;   
00084   TBranch        *b_MomentumIJ;   
00085   TBranch        *b_TrasverseMomentumIJ;   
00086   TBranch        *b_EtaIJ;   
00087   TBranch        *b_PhiIJ;   
00088   TBranch        *b_NumberChargedJet;   
00089   TBranch        *b_MomentumCJ;   
00090   TBranch        *b_TrasverseMomentumCJ;   
00091   TBranch        *b_EtaCJ;   
00092   TBranch        *b_PhiCJ;   
00093   TBranch        *b_NumberTracksJet;   
00094   TBranch        *b_MomentumTJ;   
00095   TBranch        *b_TrasverseMomentumTJ;   
00096   TBranch        *b_EtaTJ;   
00097   TBranch        *b_PhiTJ;   
00098   TBranch        *b_NumberCaloJet;   
00099   TBranch        *b_MomentumEHJ;   
00100   TBranch        *b_TrasverseMomentumEHJ;   
00101   TBranch        *b_EtaEHJ;   
00102   TBranch        *b_PhiEHJ;   
00103 
00104   //
00105   TBranch        *b_acceptedTriggers; 
00106   //
00107 
00108 
00109   //Charged Jet caharacterization
00110   TH1F* dr_chgcalo;
00111   TH1F* dr_chginc;
00112   TH1F* dr_chgmcreco;
00113   TH1F* dr_caloinc;
00114   TH1F* numb_cal;
00115   TH1F* pT_cal;
00116   TH1F* eta_cal;
00117   TH1F* eta_cal_res;
00118   TH1F* phi_cal;
00119   TH1F* phi_cal_res;
00120   TH1F* numb_chgmc;
00121   TH1F* pT_chgmc;
00122   TH1F* eta_chgmc;
00123   TH1F* eta_chgmc_res;
00124   TH1F* phi_chgmc;
00125   TH1F* phi_chgmc_res;
00126   TH1F* numb_chgreco;
00127   TH1F* pT_chgreco;
00128   TH1F* eta_chgreco;
00129   TH1F* eta_chgreco_res;
00130   TH1F* phi_chgreco;
00131   TH1F* phi_chgreco_res;
00132   TH1F* numb_inc;
00133   TH1F* pT_inc;
00134   TH1F* eta_inc;
00135   TH1F* phi_inc;
00136   TProfile* calib_chgcalo;
00137   TProfile* calib_chginc;
00138   TProfile* calib_chgmcreco;
00139   TProfile* calib_caloinc;
00140   TProfile* calib_chgcalo_eta;
00141   TProfile* calib_chginc_eta;
00142   TProfile* calib_chgmcreco_eta;
00143   TProfile* calib_caloinc_eta;
00144   TProfile* calib_chgcalo_phi;
00145   TProfile* calib_chginc_phi;
00146   TProfile* calib_chgmcreco_phi;
00147   TProfile* calib_caloinc_phi;
00148 
00149   //Underlying Event analysis
00150   TH1F*       fHistPtDistMC;
00151   TH1F*       fHistEtaDistMC;
00152   TH1F*       fHistPhiDistMC;
00153 
00154   TProfile*   pdN_vs_etaMC;
00155   TProfile*   pdN_vs_ptMC;
00156 
00157   TProfile*   pdN_vs_dphiMC;
00158   TProfile*   pdPt_vs_dphiMC;
00159 
00160   // add histo on fluctuation in UE
00161   TH2D*   h2d_dN_vs_ptJTransMC;
00162 
00163 
00164   TProfile*   pdN_vs_ptJTransMC;
00165   TProfile*   pdN_vs_ptJTransMaxMC;
00166   TProfile*   pdN_vs_ptJTransMinMC;
00167   TProfile*   pdPt_vs_ptJTransMC;
00168   TProfile*   pdPt_vs_ptJTransMaxMC;
00169   TProfile*   pdPt_vs_ptJTransMinMC;
00170   TProfile*   pdN_vs_ptJTowardMC;
00171   TProfile*   pdN_vs_ptJAwayMC;
00172   TProfile*   pdPt_vs_ptJTowardMC;
00173   TProfile*   pdPt_vs_ptJAwayMC;
00174 
00175   TH1F*       temp1MC;
00176   TH1F*       temp2MC;
00177   TH1F*       temp3MC;
00178   TH1F*       temp4MC;
00179 
00180   TH1F*       fHistPtDistRECO;
00181   TH1F*       fHistEtaDistRECO;
00182   TH1F*       fHistPhiDistRECO;
00183 
00184   TProfile*   pdN_vs_etaRECO;
00185   TProfile*   pdN_vs_ptRECO;
00186 
00187   TProfile*   pdN_vs_dphiRECO;
00188   TProfile*   pdPt_vs_dphiRECO;
00189 
00190   TProfile*   pdN_vs_ptJTransRECO;
00191   TProfile*   pdN_vs_ptJTransMaxRECO;
00192   TProfile*   pdN_vs_ptJTransMinRECO;
00193   TProfile*   pdPt_vs_ptJTransRECO;
00194   TProfile*   pdPt_vs_ptJTransMaxRECO;
00195   TProfile*   pdPt_vs_ptJTransMinRECO;
00196   TProfile*   pdN_vs_ptJTowardRECO;
00197   TProfile*   pdN_vs_ptJAwayRECO;
00198   TProfile*   pdPt_vs_ptJTowardRECO;
00199   TProfile*   pdPt_vs_ptJAwayRECO;
00200 
00201   TProfile*   pdN_vs_ptCJTransRECO;
00202   TProfile*   pdN_vs_ptCJTransMaxRECO;
00203   TProfile*   pdN_vs_ptCJTransMinRECO;
00204   TProfile*   pdPt_vs_ptCJTransRECO;
00205   TProfile*   pdPt_vs_ptCJTransMaxRECO;
00206   TProfile*   pdPt_vs_ptCJTransMinRECO;
00207   TProfile*   pdN_vs_ptCJTowardRECO;
00208   TProfile*   pdN_vs_ptCJAwayRECO;
00209   TProfile*   pdPt_vs_ptCJTowardRECO;
00210   TProfile*   pdPt_vs_ptCJAwayRECO;
00211 
00212   TH1F*       temp1RECO;
00213   TH1F*       temp2RECO;
00214   TH1F*       temp3RECO;
00215   TH1F*       temp4RECO;
00216 
00217   TH1D* fNumbMPIMC;
00218   TH1D* fdEtaLeadingPairMC;
00219   TH1D* fdPhiLeadingPairMC;
00220   TH1D* fptRatioLeadingPairMC;
00221   TProfile* pPtRatio_vs_PtJleadMC;
00222   TProfile* pPtRatio_vs_EtaJleadMC;
00223   TProfile* pPtRatio_vs_PhiJleadMC;
00224 
00225   TH1D* fNumbMPIRECO;
00226   TH1D* fdEtaLeadingPairRECO;
00227   TH1D* fdPhiLeadingPairRECO;
00228   TH1D* fptRatioLeadingPairRECO;
00229   TProfile* pPtRatio_vs_PtJleadRECO;
00230   TProfile* pPtRatio_vs_EtaJleadRECO;
00231   TProfile* pPtRatio_vs_PhiJleadRECO;
00232 
00233 
00234   
00235   Float_t etaRegion;
00236   Float_t piG;
00237   Float_t rangePhi;
00238   Float_t ptThreshold;
00239   
00240   UEAnalysisOnRootple();
00241   virtual ~UEAnalysisOnRootple();
00242   virtual Int_t    Cut(Long64_t entry);
00243   virtual Int_t    GetEntry(Long64_t entry);
00244   virtual Long64_t LoadTree(Long64_t entry);
00245   virtual void     MultiAnalysis(char* filelist,char* outname,Float_t weight[13],Float_t eta,Float_t triggerPt,std::string type,std::string trigger,std::string tkpt,Float_t ptCut);
00246   virtual void     Init(TTree *tree);
00247   virtual void     BeginJob(char* outname);
00248   virtual void     EndJob();
00249   virtual void     Loop(Float_t we,Float_t triggerPt,std::string type,std::string trigger,std::string tkpt);
00250   virtual Bool_t   Notify();
00251   virtual void     Show(Long64_t entry = -1);
00252   virtual void     UEAnalysisMC(Float_t weight,std::string tkpt);
00253   virtual void     UEAnalysisRECO(Float_t weight,std::string tkpt);
00254   virtual void     JetCalibAnalysis(Float_t weight,std::string tkpt);
00255   virtual void     MPIAnalysisMC(Float_t weight,std::string tkpt);
00256   virtual void     MPIAnalysisRECO(Float_t weight,std::string tkpt);
00257   Float_t CalibrationPt(Float_t ptReco,std::string tkpt);
00258   Float_t CorrectionPtTrans(Float_t ptReco,std::string tkpt);
00259   Float_t CorrectionPtToward(Float_t ptReco,std::string tkpt);
00260   Float_t CorrectionPtAway(Float_t ptReco,std::string tkpt);
00261   Float_t CorrectionNTrans(Float_t ptReco,std::string tkpt);
00262   Float_t CorrectionNToward(Float_t ptReco,std::string tkpt);
00263   Float_t CorrectionNAway(Float_t ptReco,std::string tkpt);
00264 
00265   TFile* hFile;
00266 
00267 };
00268 
00269 #endif
00270 
00271 #ifdef UEAnalysisOnRootple_cxx
00272 
00273 UEAnalysisOnRootple::UEAnalysisOnRootple()
00274 {
00275   std::cout << "UEAnalysisOnRootple constructor " <<std::endl;
00276 }
00277 
00278 UEAnalysisOnRootple::~UEAnalysisOnRootple()
00279 {
00280    if (!fChain) return;
00281    delete fChain->GetCurrentFile();
00282 }
00283 
00284 Int_t UEAnalysisOnRootple::GetEntry(Long64_t entry)
00285 {
00286 // Read contents of entry.
00287    if (!fChain) return 0;
00288    return fChain->GetEntry(entry);
00289 }
00290 Long64_t UEAnalysisOnRootple::LoadTree(Long64_t entry)
00291 {
00292 // Set the environment to read one entry
00293    if (!fChain) return -5;
00294    Long64_t centry = fChain->LoadTree(entry);
00295    if (centry < 0) return centry;
00296    if (!fChain->InheritsFrom(TChain::Class()))  return centry;
00297    TChain *chain = (TChain*)fChain;
00298    if (chain->GetTreeNumber() != fCurrent) {
00299       fCurrent = chain->GetTreeNumber();
00300       Notify();
00301    }
00302    return centry;
00303 }
00304 
00305 void UEAnalysisOnRootple::Init(TTree *tree)
00306 {
00307    // The Init() function is called when the selector needs to initialize
00308    // a new tree or chain. Typically here the branch addresses and branch
00309    // pointers of the tree will be set.
00310    // It is normaly not necessary to make changes to the generated
00311    // code, but the routine can be extended by the user if needed.
00312    // Init() will be called many times when running on PROOF
00313    // (once per file to be processed).
00314 
00315   // allocate space for file handle here
00316   f = new TFile;
00317 
00318    // Set branch addresses and branch pointers
00319    if (!tree) return;
00320    fChain = tree;
00321    fCurrent = -1;
00322    fChain->SetMakeClass(1);
00323 
00324    //
00325    acceptedTriggers = 0;
00326    fChain->SetBranchAddress("acceptedTriggers", &acceptedTriggers, &b_acceptedTriggers);
00327    //
00328 
00329    fChain->SetBranchAddress("EventKind", &EventKind, &b_EventKind);
00330    fChain->SetBranchAddress("NumberMCParticles", &NumberMCParticles, &b_NumberMCParticles);
00331    fChain->SetBranchAddress("MomentumMC", MomentumMC, &b_MomentumMC);
00332    fChain->SetBranchAddress("TransverseMomentumMC", TransverseMomentumMC, &b_TransverseMomentumMC);
00333    fChain->SetBranchAddress("EtaMC", EtaMC, &b_EtaMC);
00334    fChain->SetBranchAddress("PhiMC", PhiMC, &b_PhiMC);
00335    fChain->SetBranchAddress("NumberTracks", &NumberTracks, &b_NumberTracks);
00336    fChain->SetBranchAddress("MomentumTK", MomentumTK, &b_MomentumTK);
00337    fChain->SetBranchAddress("TrasverseMomentumTK", TrasverseMomentumTK, &b_TrasverseMomentumTK);
00338    fChain->SetBranchAddress("EtaTK", EtaTK, &b_EtaTK);
00339    fChain->SetBranchAddress("PhiTK", PhiTK, &b_PhiTK);
00340    fChain->SetBranchAddress("NumberInclusiveJet", &NumberInclusiveJet, &b_NumberInclusiveJet);
00341    fChain->SetBranchAddress("MomentumIJ", MomentumIJ, &b_MomentumIJ);
00342    fChain->SetBranchAddress("TrasverseMomentumIJ", TrasverseMomentumIJ, &b_TrasverseMomentumIJ);
00343    fChain->SetBranchAddress("EtaIJ", EtaIJ, &b_EtaIJ);
00344    fChain->SetBranchAddress("PhiIJ", PhiIJ, &b_PhiIJ);
00345    fChain->SetBranchAddress("NumberChargedJet", &NumberChargedJet, &b_NumberChargedJet);
00346    fChain->SetBranchAddress("MomentumCJ", MomentumCJ, &b_MomentumCJ);
00347    fChain->SetBranchAddress("TrasverseMomentumCJ", TrasverseMomentumCJ, &b_TrasverseMomentumCJ);
00348    fChain->SetBranchAddress("EtaCJ", EtaCJ, &b_EtaCJ);
00349    fChain->SetBranchAddress("PhiCJ", PhiCJ, &b_PhiCJ);
00350    fChain->SetBranchAddress("NumberTracksJet", &NumberTracksJet, &b_NumberTracksJet);
00351    fChain->SetBranchAddress("MomentumTJ", MomentumTJ, &b_MomentumTJ);
00352    fChain->SetBranchAddress("TrasverseMomentumTJ", TrasverseMomentumTJ, &b_TrasverseMomentumTJ);
00353    fChain->SetBranchAddress("EtaTJ", EtaTJ, &b_EtaTJ);
00354    fChain->SetBranchAddress("PhiTJ", PhiTJ, &b_PhiTJ);
00355    fChain->SetBranchAddress("NumberCaloJet", &NumberCaloJet, &b_NumberCaloJet);
00356    fChain->SetBranchAddress("MomentumEHJ", MomentumEHJ, &b_MomentumEHJ);
00357    fChain->SetBranchAddress("TrasverseMomentumEHJ", TrasverseMomentumEHJ, &b_TrasverseMomentumEHJ);
00358    fChain->SetBranchAddress("EtaEHJ", EtaEHJ, &b_EtaEHJ);
00359    fChain->SetBranchAddress("PhiEHJ", PhiEHJ, &b_PhiEHJ);
00360    Notify();
00361 }
00362 
00363 Bool_t UEAnalysisOnRootple::Notify()
00364 {
00365    // The Notify() function is called when a new file is opened. This
00366    // can be either for a new TTree in a TChain or when when a new TTree
00367    // is started when using PROOF. It is normaly not necessary to make changes
00368    // to the generated code, but the routine can be extended by the
00369    // user if needed. The return value is currently not used.
00370 
00371    return kTRUE;
00372 }
00373 
00374 void UEAnalysisOnRootple::Show(Long64_t entry)
00375 {
00376 // Print contents of entry.
00377 // If entry is not specified, print current entry
00378    if (!fChain) return;
00379    fChain->Show(entry);
00380 }
00381 
00382 Int_t UEAnalysisOnRootple::Cut(Long64_t entry)
00383 {
00384 // This function may be called from Loop.
00385 // returns  1 if entry is accepted.
00386 // returns -1 otherwise.
00387    return 1;
00388 }
00389 #endif