#ifndef CbmKFPartEfficiencies_H #define CbmKFPartEfficiencies_H #include "TNamed.h" #include "CbmL1Counters.h" class CbmKFPartEfficiencies: public TNamed { public: CbmKFPartEfficiencies(): names(), indices(), ratio_reco(), mc(), reco(), ratio_ghost(), ratio_bg(), ratio_clone(), ghost(), bg(), clone() { // add total efficiency // AddCounter("piPlus" ,"PiPlus efficiency"); // AddCounter("piMinus" ,"PiMinus efficiency"); int mPartPDG[nParticles] = {310,3122,3312,-3312,3334, 3224,3114, 3000, 421,411,-411}; TString mPartName[nParticles] = {"ks","lambda","ksi-","ksi+","omega-", "sigma*+","sigma*-", "Hdb", "D0","D+","D-"}; TString mPartTitle[nParticles] = {"KShort ", "Lambda ", "Ksi- ", "Ksi+ ", "Omega- ", "Sigma*+", "Sigma*-", "Hdb ", "D0 ", "D+ ", "D- "}; for(int iP=0; iP allReco = reco + ghost + bg; ratio_ghost = ghost/allReco; ratio_bg = bg/allReco; ratio_clone = clone/allReco; }; void Inc(bool isReco, int nClones, TString name) { const int index = indices[name]; mc.counters[index]++; if (isReco) reco.counters[index]++; if(nClones > 0) clone.counters[index] += nClones; }; void IncReco(bool isGhost, bool isBg, TString name){ const int index = indices[name]; if (isGhost) ghost. counters[index]++; if (isBg) bg.counters[index]++; }; void PrintEff(){ std::cout.setf(ios::fixed); std::cout.setf(ios::showpoint); std::cout.precision(3); std::cout << "Particle : " << " Eff " <<" / "<< " Ghost " <<" / "<< "BackGr " <<" / "<< "N Ghost" <<" / "<< "N BackGr" <<" / "<< "N Reco " <<" / "<< "N Clone " <<" | "<< " N MC " << std::endl; int NCounters = mc.NCounters; for (int iC = 0; iC < NCounters; iC++){ std::cout << names[iC] << " : " << setw(6) << ratio_reco.counters[iC] << " / " << setw(6) << ratio_ghost.counters[iC] // particles w\o MCParticle << " / " << setw(6) << ratio_bg.counters[iC] // particles with incorrect MCParticle << " / " << setw(6) << ghost.counters[iC] << " / " << setw(7) << bg.counters[iC] << " / " << setw(6) << reco.counters[iC] << " / " << setw(7) << clone.counters[iC] << " | " << setw(6) << mc.counters[iC] << std::endl; } }; friend std::fstream & operator<<(std::fstream &strm, CbmKFPartEfficiencies &a) { strm << a.ratio_reco; strm << a.mc; strm << a.reco; strm << a.ratio_ghost; strm << a.ratio_bg; strm << a.ratio_clone; strm << a.ghost; strm << a.bg; strm << a.clone; return strm; } friend std::fstream & operator>>(std::fstream &strm, CbmKFPartEfficiencies &a){ strm >> a.ratio_reco; strm >> a.mc; strm >> a.reco; strm >> a.ratio_ghost; strm >> a.ratio_bg; strm >> a.ratio_clone; strm >> a.ghost; strm >> a.bg; strm >> a.clone; return strm; } void AddFromFile(TString fileName) { std::fstream file(fileName.Data(),fstream::in); file >> *this; } static const int nParticles = 11; int partPDG[nParticles]; TString partName[nParticles]; TString partTitle[nParticles]; ClassDef(CbmKFPartEfficiencies,1); private: vector names; // names counters indexed by index of counter map indices; // indices of counters indexed by a counter shortname TL1TracksCatCounters ratio_reco; TL1TracksCatCounters mc; TL1TracksCatCounters reco; TL1TracksCatCounters ratio_ghost; TL1TracksCatCounters ratio_bg; TL1TracksCatCounters ratio_clone; TL1TracksCatCounters ghost; TL1TracksCatCounters bg; // background TL1TracksCatCounters clone; // background }; #endif