//################################################################ //# Macros for summary of Background\Signal study //# author: Anastasia Karavdina //# date: May, 2012 //# //# to compile it add in "# install #" part of CMakeLists.txt lines: //# add_executable(sum_bkg_tree_read sumBkgStudiesTreeRead_exe.C) //# target_link_libraries(sum_bkg_tree_read ${ROOT_LIBRARIES}) //# //# to run it (and see options): //# ${PANDAROOT}/build/bin/./sum_bkg_tree_read --help //################################################################ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // //lmd track // #include // #include // #include // #include // #include // #include // // needed for geane backtracking // #include // #include // #include // #include // #include // #include // #include // #include #include using namespace std; int main(int __argc,char *__argv[]) { TString storePath="/data/FAIRsorf/pandaroot/trunk/macro/lmd/tmpOutputBkg"; std::string pathStr=""; // decode arguments if( __argc>1 && ( strcmp( __argv[1], "-help" ) == 0 || strcmp( __argv[1], "--help" ) == 0 ) ){ std::cout << "This is summary Background study script with parameter\n" <<"-path path to the file(s)" <<"Have fun! \n" << std::endl; return 0; } while ((optind < (__argc-1) ) && (__argv[optind][0]=='-')) { bool found=false; std::string sw = __argv[optind]; if (sw=="-path"){ optind++; pathStr = __argv[optind]; found=true; } if (!found){ std::cout<< "Unknown switch: " << __argv[optind] <> storePath; //void sumBkgStudies_MCmatch_withSignal(TString storePath= "/data/FAIRsorf/pandaroot/trunk/macro/lmd/tmpHIMster/results/15GeV") //{ // ---- Load libraries ------------------------------------------------- gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C"); gSystem->Load("libLmdTrk"); // gROOT->LoadMacro("line3Dfit.C"); // ------------------------------------------------------------------------ // ----- Timer -------------------------------------------------------- TStopwatch timer; timer.Start(); // ------------------------------------------------------------------------ TString in=storePath+"/sumAll.root"; // TString in=storePath+"/compMC_and_REC_withSignal0.root"; cout<Get("tAll"); TTree *tSig_sum = (TTree *)f->Get("tSig"); TTree *tBkg_sum = (TTree *)f->Get("tBkg"); TNtuple *nmcall_sum = ( TNtuple *)f->Get("nmcall"); // TH1F *hMCpdg_sum_f = (TH1F*)f->Get("hMCpdg"); // TH1F *hMCpdgSUM_sum_f = (TH1F*)f->Get("hMCpdgSUM"); // TH1F *hThetaRecAP_sum_f = (TH1F*)f->Get("hThetaRecAP"); // TH2 *hMCtrkNhits_sum_f = (TH2I*)f->Get("hMCtrkNhits"); // TH2 *hMCtrkPhits_sum_f = (TH2D*)f->Get("hMCtrkPhits"); // TNtuple *nrecbkg = (TNtuple*)f->Get("nrecbkg"); // TNtuple *nrecsig = (TNtuple*)f->Get("nrecsig"); int totBkg = tBkg_sum->GetEntries(); int totSig = tSig_sum->GetEntries(); //try to find upper limit for sumID and ID int maxsumid=5e3; Long64_t nmore=1; while(nmore>0){ maxsumid*=1.1; TString condLim = "sumid>"; condLim+=maxsumid; nmore = tBkg_sum->GetEntries(condLim.Data()); } cout<<"(max SUMid<"<0){ maxid*=1.1; TString condLim2 = "abs(id)>"; condLim2+=maxid; nmoreid = tBkg_sum->GetEntries(condLim2.Data()); } cout<<"(max id<"<GetEntries(cond.Data()); // cout<<" =========== isumid = "<1){ glnumCh++; cout<GetEntries(cond2.Data()); // cout<<"nbkg_ch2 = "<0){ switch (iid){ case 2212: cout<<"$p$"; break; case -2212: cout<<"$\\bar{p}$"; break; case 3122: cout<<"$\\Lambda$"; break; case -3122: cout<<"$\\bar{\\Lambda}$"; break; case 2112: cout<<"$n$"; break; case -2112: cout<<"$\\bar{n}$"; break; case 321: cout<<"$K^{+}$"; break; case -321: cout<<"$K^{-}$"; break; case 211: cout<<"$\\pi^{+}$"; break; case -211: cout<<"$\\pi^{-}$"; break; case 11: cout<<"$e^{-}$"; break; case -11: cout<<"$e^{+}$"; break; case 13: cout<<"$\\mu^{-}$"; break; case -13: cout<<"$\\mu^{+}$"; break; case 15: cout<<"$\\tau^{-}$"; break; case -15: cout<<"$\\tau^{+}$"; break; case 22: cout<<"$\\gamma$"; break; case 111: cout<<"$\\pi^{0}$"; break; default: cout<GetEntries(cond2.Data()); // if(nbkg_ch2<1) continue; // if(nbkg_ch2>0){ // switch (iid){ // case 2212: // cout<<"$p$"; // break; // case -2212: // cout<<"$\\bar{p}$"; // break; // case 3122: // cout<<"$\\Lambda$"; // break; // case -3122: // cout<<"$\\bar{\\Lambda}$"; // break; // case 2112: // cout<<"$n$"; // break; // case -2112: // cout<<"$\\bar{n}$"; // break; // case 321: // cout<<"$K^{+}$"; // break; // case -321: // cout<<"$K^{-}$"; // break; // case 211: // cout<<"$pi^{+}$"; // break; // case -211: // cout<<"$pi^{-}$"; // break; // case 11: // cout<<"$e^{-}$"; // break; // case -11: // cout<<"$e^{+}$"; // break; // case 13: // cout<<"$\\mu^{-}$"; // break; // case -13: // cout<<"$\\mu^{+}$"; // break; // case 15: // cout<<"$\\tau^{-}$"; // break; // case -15: // cout<<"$\\tau^{+}$"; // break; // case 22: // cout<<"$\\gamma$"; // break; // case 111: // cout<<"$\\pi^{0}$"; // break; // default: // cout<GetEntries(cond3.Data()); if(nbkg_ch3<1) continue; if(nbkg_ch3>0){ switch (iid){ case 2212: cout<<"$p$"; break; case -2212: cout<<"$\\bar{p}$"; break; case 3122: cout<<"$\\Lambda$"; break; case -3122: cout<<"$\\bar{\\Lambda}$"; break; case 2112: cout<<"$n$"; break; case -2112: cout<<"$\\bar{n}$"; break; case 321: cout<<"$K^{+}$"; break; case -321: cout<<"$K^{-}$"; break; case 211: cout<<"$\\pi^{+}$"; break; case -211: cout<<"$\\pi^{-}$"; break; case 11: cout<<"$e^{-}$"; break; case -11: cout<<"$e^{+}$"; break; case 13: cout<<"$\\mu^{-}$"; break; case -13: cout<<"$\\mu^{+}$"; break; case 15: cout<<"$\\tau^{-}$"; break; case -15: cout<<"$\\tau^{+}$"; break; case 22: cout<<"$\\gamma$"; break; case 111: cout<<"$\\pi^{0}$"; break; default: cout<