///////////////////////////////////////////////////////////////////////// // MU (HMULeptons) - MU Emu 1-1correlation // based on RICH (HMatchURich) and Meta (HMatchUTof, HMtchUShower) IPUs // lepton trigger emulated // now also momentum determination included // // load the library > .L mu-muEmu_momcorr.cc+ // call the function > mu-muEmu_corr() ///////////////////////////////////////////////////////////////////////// #ifndef __CINT__ #include #include #include "TFile.h" #include "TH1.h" #include "TH2.h" #include "TCanvas.h" #include "hmatchurich.h" #include "hmatchushower.h" #include "hmatchutof.h" #include "hmuleptons.h" #include "hmuEmuleptons.h" #include "hlinearcategory.h" #include "htree.h" #include "hrecevent.h" #include "heventheader.h" #include "hevent.h" #include "haddef.h" #include "hgeantdef.h" #include "hcategory.h" #include "hdetector.h" #include "hgeomvector.h" #include "hades.h" #endif void process_filename(TString &inputFile, TString &outputFile, TString suffix, TString outputpath="") { TString file="", inputpath=""; if (!inputFile.EndsWith(".root") && !inputFile.EndsWith(".hld")){ inputFile+=".root"; } cout << "File input: " << inputFile << endl; // now, Do bad thing with string Char_t buffer[1000], *c; strncpy(buffer,(const Char_t *)inputFile,999); c=strrchr(buffer,'/'); if(c){ *c=0; file=c+1; inputpath=buffer; }else{ file=inputFile; inputpath=""; } strncpy(buffer,(const Char_t *)file,999); c=strrchr(buffer,'.'); if(c){ *c=0; file=buffer; } if(outputpath=="") outputpath=inputpath; if(!outputpath.EndsWith("/")) outputpath+="/"; outputFile = outputpath+file+suffix+".root"; cout << "File output: " << outputFile << endl; } Int_t numberNonFoundLeptons(TString inputFile, Int_t nEvents=0, Bool_t verbose=false,Bool_t debug=false) { // gROOT->Reset(); TString outFile=""; process_filename(inputFile,outFile,"_NrNotFound"); // TFile *hfile = new TFile((Text_t *)outFile.Data(),"RECREATE","Test",2); TFile *f = new TFile(inputFile); if(!f) {cout << "File not opened! " <Get("T"); if(!T) {cout << "No tree in file!" << endl; exit(1);} HEventHeader* fEventHead = (HEventHeader*)f->Get("EventHeader"); TBranch* evt = T->GetBranch("EventHeader."); if(evt) evt->SetAddress(&fEventHead); f->cd("dirTrigger"); // HMULeptons* ptlHMULeptons = new HMULeptons(); // HLinearCategory* catlHMULeptons = (HLinearCategory*) gDirectory->Get("HMULeptons"); // TBranch* brlHMULeptons = T->GetBranch("HMULeptons"); // if(brlHMULeptons) brlHMULeptons->SetAddress(&catlHMULeptons); // TIterator *iterHMULeptons = catlHMULeptons->MakeIterator(); HMUEMULeptons* ptlHMUEMULeptons = new HMUEMULeptons(); HLinearCategory* catlHMUEMULeptons = (HLinearCategory*) gDirectory->Get("HMUEMULeptons"); TBranch* brlHMUEMULeptons = T->GetBranch("HMUEMULeptons."); if(brlHMUEMULeptons) brlHMUEMULeptons->SetAddress(&catlHMUEMULeptons); TIterator *iterHMUEMULeptons = catlHMUEMULeptons->MakeIterator(); f->cd(); // ******* preparations for event loop ****** Stat_t ientries; // how many events ientries = T->GetEntries(); // how many events if (nEvents>0 && nEventsGetEntry(i); if (i % 10000 == 0) cout << "Event " << i << " seq num " <<(fEventHead)->getEventSeqNumber() << endl; if (debug ) { cout<<"Entry = "<GetEntry(i); // iterHMULeptons->Reset(); // iterHMUEMULeptons->Reset(); // catlHMULeptons->Clear(); catlHMUEMULeptons->Clear(); } // eventloop cout<<"######################" << endl; cout<<"counterNotFoundLeptons = "<cd(); // hnci->Write(); // hnci_2->Write(); // hnca->Write(); // hnca_2->Write(); // hmuhits->Write(); // hshcx->Write(); // hshcy->Write(); // hshcp->Write(); // diff->Write(); // hfile->Close(); #ifndef __CINT Int_t main(Int_t argc, Char_t** argv) { TROOT app("numberNonFoundLeptons","compiled numberNonFoundLeptons macro"); gROOT->SetBatch(kTRUE); Bool_t verbose=false, debug=false; Int_t cur_arg=1; while(cur_arg