#define TSelector_Ntuple_Zee_cxx #include "TSelector_Ntuple_Zee.h" #include #include #include TLorentzVector zboson, el1,el2; void TSelector_Ntuple_Zee::Begin(TTree * /*tree*/) { TString options(GetOption()); cout<< "option" << options << endl; if( options.Index('t')>0 && options.Index('t') < options.Index(":")) { options.Replace(options.Index("t"), 1 , ""); cout<< "doTrack, remaining option " << options << endl; } if(options.Index('v') >0 && options.Index('v') < options.Index(":") ) { options.Replace(options.Index("v"), 1 , ""); cout<< "verbose, remaining option " << options << endl; m_verbose=true; } cout<< "remaining option " << options << endl; if( options.Index(':') !=kNPOS) { options.Replace(0, 1,""); OutputFileName=TString(options(0, options.Index(":"))); options.Replace(0, options.Index(":")+1, ""); } m_repeat=10; //OPtions.Atoi(); cout<< "repeat: " << m_repeat << endl; } void TSelector_Ntuple_Zee::SlaveBegin(TTree * /*tree*/) { TString options(GetOption()); cout<< "option" << options << endl; if( options.Index('t')>0 && options.Index('t') < options.Index(":")) { options.Replace(options.Index("t"), 1 , ""); cout<< "doTrack, remaining option " << options << endl; } if(options.Index('v') >0 && options.Index('v') < options.Index(":") ) { options.Replace(options.Index("v"), 1 , ""); cout<< "verbose, remaining option " << options << endl; m_verbose=true; } cout<< "remaining option " << options << endl; if( options.Index(':') !=kNPOS) { options.Replace(0, 1,""); OutputFileName=TString(options(0, options.Index(":"))); options.Replace(0, options.Index(":")+1, ""); } m_repeat=10; //options.Atoi(); cout<< "repeat: " << m_repeat << endl; ElectronContainer = new TObjArray(); ElectronContainer->SetOwner(); TString option = GetOption(); h_Zmass = new TH1F("Zmass","",30,0,150); h_El_N = new TH1F("El_N","",10,0,10); h_El_pt = new TH1F("El_pt","",30,0,150); fOutput->Add(h_Zmass); fOutput->Add(h_El_N); fOutput->Add(h_El_pt); } Bool_t TSelector_Ntuple_Zee::Process(Long64_t entry) { //static TLorentzVector zboson, *elec, *el1,*el2; // entry is the entry number in the current TTree Long64_t chain_entry = fChain->GetChainEntryNumber(entry); if ( chain_entry%100000==0) cout << chain_entry<GetEntry(entry); if(El_N < 2) return kTRUE; b_El_p_T->GetEntry(entry); b_El_IsEM->GetEntry(entry); Bool_t bPhi = kFALSE; Bool_t bEta = kFALSE; Bool_t bE = kFALSE; for(int repeat=0; repeatFill(El_N); for( Int_t i = 0; i < El_N; ++i ) { double pt = ( * El_p_T )[ i ]; h_El_pt->Fill(0.001*pt); if (!( (*El_IsEM)[i] & 933875)==0) continue; if (!( pt < 25000)==0) continue; elcounter++; if (elcounter > 2) break; if (!bEta) {b_El_eta->GetEntry(entry); bEta=kTRUE;} if (!bPhi) {b_El_phi->GetEntry(entry); bPhi=kTRUE;} if (!bE) {b_El_E->GetEntry(entry); bE=kTRUE;} if (elcounter == 1)el1.SetPtEtaPhiE(pt,(( * El_eta )[ i ]), (( * El_phi )[ i ]), (( * El_E )[ i ]) ) ; else el2.SetPtEtaPhiE(pt,(( * El_eta )[ i ]), (( * El_phi )[ i ]), (( * El_E )[ i ]) ) ; } if( elcounter==2 ) { if (m_verbose) cout <<"found pair"<Fill( zboson.M()/1000. ); } //ElectronContainer->Clear(); } return kTRUE; } void TSelector_Ntuple_Zee::SlaveTerminate() { } void TSelector_Ntuple_Zee::Terminate() { newFile = new TFile("junk1.root","RECREATE"); GetOutputList()->Write(); newFile->Close(); }