46 TTracksCatCounters(
int nCounters) : NCounters(nCounters), counters() { counters.resize(NCounters, T(0)); };
51 counters.push_back(T(0));
55 NCounters += nCounters;
56 counters.resize(NCounters, T(0));
62 cout <<
" TTracksCatCounters: Error. Addition of counters of different sizes: " << NCounters <<
" " << a.
NCounters << endl;
78 template <
typename T2>
83 cout <<
" TTracksCatCounters: Error. Addition of counters of different sizes: " << NCounters <<
" " << a.
NCounters << endl;
92 template <
typename T2>
97 b.
counters[iC] =
static_cast<T2
>(Div(counters[iC], a));
102 friend std::fstream &operator<<(std::fstream &strm, const TTracksCatCounters<T> &a)
104 strm << a.
NCounters <<
" " << a.counters.size() <<
" ";
105 for (
unsigned int iV = 0; iV < a.counters.size(); iV++)
106 strm << a.counters[iV] <<
" ";
111 friend std::ostream &operator<<(std::ostream &strm, const TTracksCatCounters<T> &a)
113 strm << a.NCounters <<
" " << a.counters.size() <<
" ";
114 for (
unsigned int iV = 0; iV < a.counters.size(); iV++)
115 strm << a.counters[iV] <<
" ";
127 for (
int iV = 0; iV < tmp; iV++) {
136 double Div(
double a,
double b) {
return (b > 0) ? a / b : -1.; };
141 : ratio_ghosts(0), ratio_clones(0), ghosts(0), clones(0), nEvents(0){
146 virtual void AddCounter(
string shortname,
string name);
150 void Inc(
bool isReco,
string name);
154 vector<string> names;
155 map<string, int> indices;
170 indices[shortname] = names.size();
171 names.push_back(name);
173 ratio_reco.AddCounter();
180 ratio_reco = reco / mc;
181 if (mc.counters[indices[
"total"]] > 0) {
182 ratio_clones = clones / double(mc.counters[indices[
"total"]]);
186 if (reco.counters[indices[
"total"]] + ghosts > 0) {
187 ratio_ghosts = ghosts / double(reco.counters[indices[
"total"]] + ghosts);
206 const int index = indices[name];
208 mc.counters[index]++;
210 reco.counters[index]++;
217 std::ios_base::fmtflags coutFlags = cout.flags();
219 cout.setf(ios::fixed);
220 cout.setf(ios::showpoint);
222 cout <<
"Track category : " 229 cout << names[iC] <<
" : " << ratio_reco.counters[iC] <<
" | " << mc.counters[iC] << endl;
232 cout <<
"Clone probability : " << ratio_clones <<
" | " << clones << endl;
233 cout <<
"Ghost probability : " << ratio_ghosts <<
" | " << ghosts << endl;
236 cout.flags(coutFlags);
TTracksCatCounters(int nCounters)
TTracksCatCounters< double > operator/(TTracksCatCounters< T2 > &a)
counters used for efficiency calculation
TTracksCatCounters< T2 > operator/(double a)
friend std::fstream & operator>>(std::fstream &strm, TTracksCatCounters< T > &a)
void Inc(bool isReco, string name)
TTracksCatCounters & operator+=(TTracksCatCounters &a)
TTracksCatCounters operator+(TTracksCatCounters &a)
void AddCounters(int nCounters)
TTracksCatCounters< int > mc
TTracksCatCounters< int > reco
TEfficiencies & operator+=(TEfficiencies &a)
virtual void AddCounter(string shortname, string name)