// macro for analys bkg channels in DPM // takes TrkQA from LMD files and calculates cross-section for each channel. // Attention! Should take into account only primary final state! // author: a.karavdina // date: 21 January 2014 #include "TString.h" #include "TFile.h" #include "TTree.h" #include "TBranch.h" #include "TChain.h" #include "TClonesArray.h" #include "/panda/pandaroot/lmd/LmdQA/PndLmdTrackQ.h" #include #include using namespace std; bool myfunction_ch (pair,int> i,pair,int> j) { return (i.second>j.second); } bool myfunction_el (int i,int j) { return (i,int> > fchparts; int ch_parts=0; for (Int_t j=0; j chparts; int el_parts = 0; tTrkRec.GetEntry(j); const int nTrksQ = qtrk->GetEntriesFast();//Number of trks/ev if(nTrksQ<1) continue; for(int iq=0;iqAt(iq); int issec = trkcur->GetSecondary(); if(issec>=0) continue;//primaries only int PDGcode = trkcur->GetPDGcode(); chparts.push_back(PDGcode); el_parts++; }// end loop over all trks in event ///---------------------------------------------------------------------------------------------- /// b)range elements in the list------------------------------------------------------------ std::sort (chparts.begin(), chparts.end(), myfunction_el); // Int_t nvals = sizeof(chparts)/sizeof(chparts[0]); //doesn't work =( // Int_t nvals =el_parts; // for(int itt=0; itt::iterator isch = chparts.begin()+1; isch != chparts.end(); ++isch){ //loop over particles sub-channel // int next_el = (*isch); // if(prev_el>next_el){ // chparts[nc-1] =next_el; // chparts[nc] =prev_el; // } // prev_el = next_el; // nc++; // }// end loop over particles sub-channel // }// end repeat ranging ///---------------------------------------------------------------------------------------------- ///c) save channel if new, increase counter if old ------------------------------------- for(std::vector,int> >::iterator itl = fchparts.begin(); itl != fchparts.end(); ++itl){ //loop over already saved sub-channels if(chparts==(*itl).first){ (*itl).second++; nxtch = false; } }//end loop over already saved sub-channels if(nxtch){ fchparts.push_back(std::make_pair(chparts,1)); ch_parts++; } }//end loop over all events ///---------------------------------------------------------------------------------------------- ///d) range elements in channels vector according to number of events: hights first ---- // Int_t nvalsch = sizeof(fchparts)/sizeof(fchparts[0].second); Int_t nvalsch = ch_parts; cout<<"There are "<,int> prev_el = fchparts[0]; // int nc=1; // int ncitl=0; // for(std::vector,int> >::iterator itl = fchparts.begin(); itl != fchparts.end(); ++itl){ //loop over saved sub-channels // ncitl++; // for(std::vector,int> >::iterator itl2 = fchparts.begin(); itl2 != (fchparts.end()-ncitl); ++itl2){ //second loop over saved sub-channels // pair,int> prev_el = (*itl); // pair,int> next_el = (*(itl2+1)); std::next(mylist.begin(),5) // if(prev_el.second,int> >::iterator itl = fchparts.begin(); itl != fchparts.end(); ++itl){ //loop over saved sub-channels vector subch = (*itl).first; tot_sum_ck +=((*itl).second*cs_tot)*1e3/simevents; for(std::vector::iterator isch = subch.begin(); isch != subch.end(); ++isch){ //loop over particles sub-channel switch ((*isch)){//assign human readable values to PDG code case 11: cout << " e^{-} "; break; case -11: cout << " e^{+} "; break; case 13: cout << " mu^{-} "; break; case -13: cout << " mu^{+} "; break; case 22: cout << " gamma "; break; case 111: cout << " pi^{0} "; break; case 130: cout << " K^{0}_{L} "; break; case -211: cout << " pi^{-} "; break; case 211: cout << " pi^{+} "; break; case 311: cout << " K^{0}"; break; case 310: cout << " K^{0}_{S} "; break; case 321: cout << " K^{+} "; break; case -321: cout << " K^{-} "; break; case -2112: cout << " bar{n} "; break; case 2112: cout << " n"; break; case 2212: cout << " p "; break; case -2212: cout << " bar{p} "; break; case 3112: cout << " Sigma^{-} "; break; case 3122: cout << " Lambda "; break; case -3122: cout << " bar{Lambda} "; break; case 3212: cout << " Sigma^{0} "; break; case 3222: cout << " Sigma^{+} "; break; default: cout<<" "<<(*isch); } } if(((*itl).second*cs_tot)*1e3/simevents<1e-1){ cout<<" ("<<((*itl).second*cs_tot)*1e6/simevents<<" nb): "; } else{ if(((*itl).second*cs_tot)*1e3/simevents>1e3){ cout<<" ("<<((*itl).second*cs_tot)/simevents<<" mb): "; } else{ cout<<" ("<<((*itl).second*cs_tot)*1e3/simevents<<" mub): "; } } cout<<" "<