| 1 |
pam-fi |
1.1 |
/* |
| 2 |
|
|
* VerboseCollection.cpp |
| 3 |
|
|
* |
| 4 |
|
|
* Created on: 16-mag-2009 |
| 5 |
|
|
* Author: Nicola Mori |
| 6 |
|
|
*/ |
| 7 |
|
|
|
| 8 |
|
|
/*! @file VerboseCollection.cpp The VerboseCollection class implementation file */ |
| 9 |
|
|
|
| 10 |
|
|
#include "VerboseCollection.h" |
| 11 |
|
|
#include <cmath> |
| 12 |
|
|
|
| 13 |
|
|
void VerboseCollection::Finalize() { |
| 14 |
|
|
|
| 15 |
|
|
// Prepare the output format |
| 16 |
|
|
streamsize oldPrec = cout.precision(); |
| 17 |
|
|
streamsize newPrec = 4; |
| 18 |
|
|
cout.precision(newPrec); |
| 19 |
|
|
cout.setf(ios::fixed, ios::floatfield); |
| 20 |
|
|
unsigned int nDigitsEvents = 0; |
| 21 |
|
|
double nEvents = (double) GetNEv(); |
| 22 |
|
|
while (nEvents >= 1.) { |
| 23 |
|
|
nEvents /= 10.; |
| 24 |
|
|
nDigitsEvents++; |
| 25 |
|
|
} |
| 26 |
|
|
unsigned int nameWidth = 0; |
| 27 |
|
|
|
| 28 |
|
|
for (unsigned int i = 0; i < _cuts.size(); i++) { |
| 29 |
|
|
if (strlen(GetCut(i)->GetName()) > nameWidth) |
| 30 |
|
|
nameWidth = strlen(GetCut(i)->GetName()); |
| 31 |
|
|
} |
| 32 |
|
|
|
| 33 |
|
|
cout << "\n- Collection: " << GetName() << "\n"; |
| 34 |
|
|
cout << " Selected/Analized events (eff.): " << GetNGood() << "/" << GetNEv() << " (" << (float) GetNGood() |
| 35 |
|
|
/ (float) GetNEv() << ")\n"; |
| 36 |
|
|
cout << " " << setw(nameWidth + 1) << "--Single cuts--"; |
| 37 |
|
|
cout << " " << setw(nDigitsEvents) << "sel."; |
| 38 |
|
|
cout << " " << setw(nDigitsEvents) << "tot."; |
| 39 |
|
|
cout << " " << setw(newPrec + 2) << "eff."; |
| 40 |
|
|
cout << " " << setw(newPrec + 2) << "prog. eff.\n"; |
| 41 |
|
|
for (unsigned int i = 0; i < GetSize(); i++) { |
| 42 |
|
|
cout << " " << setw(nameWidth) << GetCut(i)->GetName() << ":"; |
| 43 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(i)->GetNGood(); |
| 44 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(i)->GetNEv(); |
| 45 |
|
|
cout << " " << (float) GetCut(i)->GetNGood() / (float) GetCut(i)->GetNEv(); |
| 46 |
|
|
cout << " " << (float) GetCut(i)->GetNGood() / (float) GetNEv(); |
| 47 |
|
|
cout << "\n"; |
| 48 |
|
|
|
| 49 |
|
|
} |
| 50 |
|
|
cout << endl; |
| 51 |
|
|
|
| 52 |
|
|
// Reset the output format |
| 53 |
|
|
cout.precision(oldPrec); |
| 54 |
|
|
cout << resetiosflags(ios::floatfield); |
| 55 |
|
|
|
| 56 |
|
|
SmartCollection::Finalize(); |
| 57 |
|
|
|
| 58 |
|
|
} |