#include "RootBenchmark/gpp_Ntuple_Zee.h" #include #include #include #include #include #include #include #include #include #include #include using namespace std; void run( int EvtMax, TChain* fChain, int m_repeat, bool m_verbose, TString OutputFileName){ cout << "verbose:"<< m_verbose << endl; TH1F h_Zmass("Zmass","",30,0,150); TH1F h_El_pT("El_tight_pt","",30,0,150); TH1F h_El_N("El_N","",10,0,10); TObjArray OutputList; OutputList.Add((TObject*)&h_Zmass); OutputList.Add((TObject*)&h_El_pT); OutputList.Add((TObject*)&h_El_N); TObjArray ElectronContainer; Int_t El_N; vector *El_E; vector *El_p_T; vector *El_phi; vector *El_eta; vector *El_charge; vector *El_IsEM; vector *El_author; TBranch *b_El_N; TBranch *b_El_E; TBranch *b_El_p_T; TBranch *b_El_phi; TBranch *b_El_eta; TBranch *b_El_charge; TBranch *b_El_IsEM; TBranch *b_El_author; El_E = 0; El_p_T = 0; El_phi = 0; El_eta = 0; El_charge = 0; El_IsEM = 0; El_author = 0; fChain->SetBranchAddress("El_N", &El_N, &b_El_N); fChain->SetBranchAddress("El_E", &El_E, &b_El_E); fChain->SetBranchAddress("El_p_T", &El_p_T, &b_El_p_T); fChain->SetBranchAddress("El_phi", &El_phi, &b_El_phi); fChain->SetBranchAddress("El_eta", &El_eta, &b_El_eta); fChain->SetBranchAddress("El_charge", &El_charge, &b_El_charge); fChain->SetBranchAddress("El_IsEM", &El_IsEM, &b_El_IsEM); fChain->SetBranchAddress("El_author", &El_author, &b_El_author); fChain->GetEntry(0) ; for(int entry=0; entryGetEntry(entry); b_El_E->GetEntry(entry); b_El_p_T->GetEntry(entry); b_El_phi->GetEntry(entry); b_El_eta->GetEntry(entry); b_El_charge->GetEntry(entry); b_El_IsEM->GetEntry(entry); b_El_author->GetEntry(entry); for(int repeat=0; repeatSetPtEtaPhiE((( * El_p_T )[ i ]),(( * El_eta )[ i ]), (( * El_phi )[ i ]), (( * El_E )[ i ]) ) ; ElectronContainer.Add( elec); elcounter++; } if( elcounter==2 ) { if(m_verbose) cout << "found 2 good elec" << endl; TLorentzVector * el1=(TLorentzVector *) ElectronContainer.At(0);; TLorentzVector * el2=(TLorentzVector *) ElectronContainer.At(1);; TLorentzVector zboson = *el1 + *el2 ; h_Zmass.Fill( zboson.M()/1000. ); } TIter itr(&ElectronContainer); TLorentzVector * ptr=0; while (ptr=(TLorentzVector *) itr.Next()){ delete ptr; } } } TFile f(OutputFileName, "recreate"); f.cd(); OutputList.Write(); f.Close(); }