//#include "Performance.h" //#include "L1Algo.h" //#include "L1AlgoInter.h" //#include "L1Branch.h" // contain L1Track //#include "CbmL1MCTrack.h" #include "CbmL1Counters.h" #include #include struct TL1PerfEfficiencies: public TL1Efficiencies { TL1PerfEfficiencies():TL1Efficiencies(), ratio_killed(), ratio_clone(), ratio_length(), ratio_fakes(), killed(), clone(), reco_length(), reco_fakes() { // add total efficiency AddCounter("long_fast_prim" ,"LongRPrim efficiency"); AddCounter("fast_prim" ,"RefPrim efficiency"); AddCounter("fast_sec" ,"RefSec efficiency"); AddCounter("fast" ,"Refset efficiency"); AddCounter("total" ,"Allset efficiency"); AddCounter("slow_prim" ,"ExtraPrim efficiency"); AddCounter("slow_sec" ,"ExtraSec efficiency"); AddCounter("slow" ,"Extra efficiency"); AddCounter("d0" ,"D0 efficiency"); } virtual ~TL1PerfEfficiencies(){}; virtual void AddCounter(string shortname, string name){ TL1Efficiencies::AddCounter(shortname, name); ratio_killed.AddCounter(); ratio_clone.AddCounter(); ratio_length.AddCounter(); ratio_fakes.AddCounter(); killed.AddCounter(); clone.AddCounter(); reco_length.AddCounter(); reco_fakes.AddCounter(); } TL1PerfEfficiencies& operator+=(TL1PerfEfficiencies& a){ TL1Efficiencies::operator+=(a); killed += a.killed; clone += a.clone; reco_length += a.reco_length; reco_fakes += a.reco_fakes; return *this; } void CalcEff(){ TL1Efficiencies::CalcEff(); ratio_killed = killed/mc; ratio_clone = clone/mc; TL1TracksCatCounters allReco = reco + clone; ratio_length = reco_length/allReco; ratio_fakes = reco_fakes/allReco; } void Inc(bool isReco, bool isKilled, double _ratio_length, double _ratio_fakes, int _nclones, string name){ TL1Efficiencies::Inc(isReco, name); const int index = indices[name]; if (isKilled) killed.counters[index]++; reco_length.counters[index] += _ratio_length; reco_fakes.counters[index] += _ratio_fakes; clone.counters[index] += _nclones; } void PrintEff(){ L1_assert(nEvents != 0); std::cout.setf(ios::fixed); std::cout.setf(ios::showpoint); std::cout.precision(3); std::cout << "Track category : " << " Eff " <<" / "<< "Killed" <<" / "<< "Length" <<" / "<< "Fakes " <<" / "<< "Clones" <<" / "<< "All Reco" <<" | "<< "All MC" << std::endl; int NCounters = mc.NCounters; for (int iC = 0; iC < NCounters; iC++){ if (( names[iC] != "D0 efficiency") || (mc.counters[iC] != 0)) std::cout << names[iC] << " : " << ratio_reco.counters[iC] << " / " << ratio_killed.counters[iC] // tracks with aren't reco because other tracks takes their hit(-s) << " / " << ratio_length.counters[iC] // nRecoMCHits/nMCHits << " / " << ratio_fakes.counters[iC] // nFakeHits/nRecoAllHits << " / " << ratio_clone.counters[iC] // nCloneTracks/nMCTracks << " / " << setw(8) << reco.counters[iC]/double(nEvents) << " | " << setw(8) << mc.counters[iC]/double(nEvents) << std::endl; } std::cout << "Ghost probability : " << ratio_ghosts <<" | "<< ghosts << std::endl; } TL1TracksCatCounters ratio_killed; TL1TracksCatCounters ratio_clone; TL1TracksCatCounters ratio_length; TL1TracksCatCounters ratio_fakes; TL1TracksCatCounters killed; TL1TracksCatCounters clone; TL1TracksCatCounters reco_length; TL1TracksCatCounters reco_fakes; };