////////////////////////////////////////////////////////// // This class has been automatically generated on // Tue Dec 15 20:29:13 2009 by ROOT version 5.22/00d // from TChain PATtemplate/track_tree/ ////////////////////////////////////////////////////////// #ifndef macro_PhiAnalysis_h #define macro_PhiAnalysis_h #include #include #include #include #include #include using namespace std; const Int_t kMaxK_comp_dEdx = 1; class macro_PhiAnalysis { public : TTree *fChain; //!pointer to the analyzed TTree or TChain Int_t fCurrent; //!current Tree number in a TChain // Declaration of leaf types Int_t evNumber; Int_t runNumber; Int_t numberOfTrack; vector *pt; vector *ptError; vector *p; vector *px; vector *py; vector *pz; vector *eta; vector *etaError; vector *phi; vector *phiError; vector *dxy_PV; vector *dxy_0; vector *dxyError; vector *dz; vector *d0; vector *d0Error; vector *normalizedChi2; vector *dEdx1; vector *chi2; vector *ndof; vector *charge; vector *numberOfvalidHits; vector *numberOfLostHits; vector *beamSpot_x; vector *referencePoint_x; vector *innerPosition_x; vector *outerPosition_x; vector *beamSpot_y; vector *referencePoint_y; vector *innerPosition_y; vector *outerPosition_y; vector *beamSpot_z; vector *referencePoint_z; vector *innerPosition_z; vector *outerPosition_z; vector *K_comp_dEdx_; vector *highPurity_track; // List of branches TBranch *b_evNumber; //! TBranch *b_runNumber; //! TBranch *b_numberOfTrack; //! TBranch *b_pt; //! TBranch *b_ptError; //! TBranch *b_p; //! TBranch *b_px; //! TBranch *b_py; //! TBranch *b_pz; //! TBranch *b_eta; //! TBranch *b_etaError; //! TBranch *b_phi; //! TBranch *b_phiError; //! TBranch *b_dxy_PV; //! TBranch *b_dxy_0; //! TBranch *b_dxyError; //! TBranch *b_dz; //! TBranch *b_d0; //! TBranch *b_d0Error; //! TBranch *b_normalizedChi2; //! TBranch *b_dEdx1; //! TBranch *b_chi2; //! TBranch *b_ndof; //! TBranch *b_charge; //! TBranch *b_numberOfvalidHits; //! TBranch *b_numberOfLostHits; //! TBranch *b_beamSpot_x; //! TBranch *b_referencePoint_x; //! TBranch *b_innerPosition_x; //! TBranch *b_outerPosition_x; //! TBranch *b_beamSpot_y; //! TBranch *b_referencePoint_y; //! TBranch *b_innerPosition_y; //! TBranch *b_outerPosition_y; //! TBranch *b_beamSpot_z; //! TBranch *b_referencePoint_z; //! TBranch *b_innerPosition_z; //! TBranch *b_outerPosition_z; //! TBranch *b_K_comp_dEdx_; //! TBranch *b_highPurity_track; //! macro_PhiAnalysis(TTree *tree, Int_t iRun, TString fNameOut); virtual Int_t RejectTrack( Int_t i) ; virtual void FillSequentialHisto( Int_t i ) ; virtual bool SideBand( Double_t mass ) ; virtual bool SignalRegion( Double_t mass ) ; virtual bool GoodTrack( Int_t i ) ; virtual bool Looper(Int_t i, Int_t j, TLorentzVector *pi, TLorentzVector *pj) ; virtual Double_t GetHelicity( TLorentzVector *p1, TLorentzVector *p2 ) ; virtual ~macro_PhiAnalysis(); virtual Int_t Cut(Long64_t entry); virtual Int_t GetEntry(Long64_t entry); virtual Long64_t LoadTree(Long64_t entry); virtual void Init(TTree *tree); virtual void Loop(); virtual Bool_t Notify(); virtual void Show(Long64_t entry = -1); TFile *outputRootFile; }; #endif #ifdef macro_PhiAnalysis_cxx macro_PhiAnalysis::macro_PhiAnalysis(TTree *tree, Int_t iRun, TString fNameOut) { if (tree == 0) { TChain * chain = new TChain("PATtemplate/track_tree",""); if(iRun==1 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124009_ntuple.root/PATtemplate/track_tree"); if(iRun==2 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124020_ntuple.root/PATtemplate/track_tree"); if(iRun==3 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124022_ntuple.root/PATtemplate/track_tree"); if(iRun==4 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124023_ntuple.root/PATtemplate/track_tree"); if(iRun==5 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124024_ntuple.root/PATtemplate/track_tree"); if(iRun==6 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124027_ntuple.root/PATtemplate/track_tree"); if(iRun==7 || iRun<0) chain->Add("../RootFiles/PhiAnalysis_MinimumBias-PromptReco_v2-RECO_124030_ntuple.root/PATtemplate/track_tree"); tree = chain; std::cout << "trees loaded" << std::endl; } outputRootFile = new TFile(fNameOut,"RECREATE"); Init(tree); } macro_PhiAnalysis::~macro_PhiAnalysis() { if (!fChain) return; delete fChain->GetCurrentFile(); outputRootFile->Write(); outputRootFile->Close(); } inline Double_t macro_PhiAnalysis::GetHelicity( TLorentzVector *p1 , TLorentzVector *p2 ) { TLorentzVector pPhi = (*p1)+(*p2) ; TVector3 boost = -pPhi.BoostVector() ; TLorentzVector pPhiRf = pPhi ; TLorentzVector pKRf = *p1 ; pPhiRf.Boost(boost) ; pKRf.Boost(boost) ; Double_t angle = pKRf.Angle( pPhi.Vect() ) ; return cos(angle) ; } Int_t macro_PhiAnalysis::GetEntry(Long64_t entry) { // Read contents of entry. if (!fChain) return 0; return fChain->GetEntry(entry); } Long64_t macro_PhiAnalysis::LoadTree(Long64_t entry) { // Set the environment to read one entry if (!fChain) return -5; Long64_t centry = fChain->LoadTree(entry); if (centry < 0) return centry; if (!fChain->InheritsFrom(TChain::Class())) return centry; TChain *chain = (TChain*)fChain; if (chain->GetTreeNumber() != fCurrent) { fCurrent = chain->GetTreeNumber(); Notify(); } return centry; } void macro_PhiAnalysis::Init(TTree *tree) { // Set object pointer pt = 0; ptError = 0; p = 0; px = 0; py = 0; pz = 0; eta = 0; etaError = 0; phi = 0; phiError = 0; dxy_PV = 0; dxy_0 = 0; dxyError = 0; dz = 0; d0 = 0; d0Error = 0; normalizedChi2 = 0; dEdx1 = 0; chi2 = 0; ndof = 0; charge = 0; numberOfvalidHits = 0; numberOfLostHits = 0; beamSpot_x = 0; referencePoint_x = 0; innerPosition_x = 0; outerPosition_x = 0; beamSpot_y = 0; referencePoint_y = 0; innerPosition_y = 0; outerPosition_y = 0; beamSpot_z = 0; referencePoint_z = 0; innerPosition_z = 0; outerPosition_z = 0; K_comp_dEdx_ = 0; highPurity_track = 0; // Set branch addresses and branch pointers if (!tree) return; fChain = tree; fCurrent = -1; fChain->SetMakeClass(1); fChain->SetBranchAddress("evNumber", &evNumber, &b_evNumber); fChain->SetBranchAddress("runNumber", &runNumber, &b_runNumber); fChain->SetBranchAddress("numberOfTrack", &numberOfTrack, &b_numberOfTrack); fChain->SetBranchAddress("pt", &pt, &b_pt); fChain->SetBranchAddress("ptError", &ptError, &b_ptError); fChain->SetBranchAddress("p", &p, &b_p); fChain->SetBranchAddress("px", &px, &b_px); fChain->SetBranchAddress("py", &py, &b_py); fChain->SetBranchAddress("pz", &pz, &b_pz); fChain->SetBranchAddress("eta", &eta, &b_eta); fChain->SetBranchAddress("etaError", &etaError, &b_etaError); fChain->SetBranchAddress("phi", &phi, &b_phi); fChain->SetBranchAddress("phiError", &phiError, &b_phiError); fChain->SetBranchAddress("dxy_PV", &dxy_PV, &b_dxy_PV); fChain->SetBranchAddress("dxy_0", &dxy_0, &b_dxy_0); fChain->SetBranchAddress("dxyError", &dxyError, &b_dxyError); fChain->SetBranchAddress("dz", &dz, &b_dz); fChain->SetBranchAddress("d0", &d0, &b_d0); fChain->SetBranchAddress("d0Error", &d0Error, &b_d0Error); fChain->SetBranchAddress("normalizedChi2", &normalizedChi2, &b_normalizedChi2); fChain->SetBranchAddress("dEdx1", &dEdx1, &b_dEdx1); fChain->SetBranchAddress("chi2", &chi2, &b_chi2); fChain->SetBranchAddress("ndof", &ndof, &b_ndof); fChain->SetBranchAddress("charge", &charge, &b_charge); fChain->SetBranchAddress("numberOfvalidHits", &numberOfvalidHits, &b_numberOfvalidHits); fChain->SetBranchAddress("numberOfLostHits", &numberOfLostHits, &b_numberOfLostHits); fChain->SetBranchAddress("beamSpot_x", &beamSpot_x, &b_beamSpot_x); fChain->SetBranchAddress("referencePoint_x", &referencePoint_x, &b_referencePoint_x); fChain->SetBranchAddress("innerPosition_x", &innerPosition_x, &b_innerPosition_x); fChain->SetBranchAddress("outerPosition_x", &outerPosition_x, &b_outerPosition_x); fChain->SetBranchAddress("beamSpot_y", &beamSpot_y, &b_beamSpot_y); fChain->SetBranchAddress("referencePoint_y", &referencePoint_y, &b_referencePoint_y); fChain->SetBranchAddress("innerPosition_y", &innerPosition_y, &b_innerPosition_y); fChain->SetBranchAddress("outerPosition_y", &outerPosition_y, &b_outerPosition_y); fChain->SetBranchAddress("beamSpot_z", &beamSpot_z, &b_beamSpot_z); fChain->SetBranchAddress("referencePoint_z", &referencePoint_z, &b_referencePoint_z); fChain->SetBranchAddress("innerPosition_z", &innerPosition_z, &b_innerPosition_z); fChain->SetBranchAddress("outerPosition_z", &outerPosition_z, &b_outerPosition_z); fChain->SetBranchAddress("K_comp_dEdx_", &K_comp_dEdx_, &b_K_comp_dEdx_); fChain->SetBranchAddress("highPurity_track", &highPurity_track, &b_highPurity_track); Notify(); } Bool_t macro_PhiAnalysis::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; } void macro_PhiAnalysis::Show(Long64_t entry) { // Print contents of entry. // If entry is not specified, print current entry if (!fChain) return; fChain->Show(entry); } Int_t macro_PhiAnalysis::Cut(Long64_t entry) { // This function may be called from Loop. // returns 1 if entry is accepted. // returns -1 otherwise. return 1; } #endif // #ifdef macro_PhiAnalysis_cxx