| 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 |
pam-fi |
1.3 |
for (unsigned int i = 0; i < _actions.size(); i++) { |
| 33 |
|
|
if (strlen(GetAction(i)->GetName()) > nameWidth) |
| 34 |
|
|
nameWidth = strlen(GetAction(i)->GetName()); |
| 35 |
|
|
} |
| 36 |
pam-fi |
1.1 |
cout << "\n- Collection: " << GetName() << "\n"; |
| 37 |
pam-fi |
1.3 |
cout << " Selected/Analized events (eff.): " << GetNGood() << "/" << GetNEv() << " (" |
| 38 |
|
|
<< (float) GetNGood() / (float) GetNEv() << ")\n"; |
| 39 |
pam-fi |
1.1 |
cout << " " << setw(nameWidth + 1) << "--Single cuts--"; |
| 40 |
|
|
cout << " " << setw(nDigitsEvents) << "sel."; |
| 41 |
|
|
cout << " " << setw(nDigitsEvents) << "tot."; |
| 42 |
|
|
cout << " " << setw(newPrec + 2) << "eff."; |
| 43 |
|
|
cout << " " << setw(newPrec + 2) << "prog. eff.\n"; |
| 44 |
pam-fi |
1.2 |
|
| 45 |
|
|
// Print the names of the actions placed before the cuts |
| 46 |
|
|
unsigned int iAction = 0; |
| 47 |
|
|
if (_actions.size() > 0) { |
| 48 |
|
|
while (_actionsPositions[iAction] == -1) { |
| 49 |
|
|
cout << " " << setw(nameWidth) << _actions[iAction]->GetName() << ":" << " ACTION\n"; |
| 50 |
|
|
iAction++; |
| 51 |
|
|
if (iAction == _actions.size()) |
| 52 |
|
|
break; |
| 53 |
|
|
} |
| 54 |
|
|
} |
| 55 |
|
|
|
| 56 |
|
|
for (unsigned int iCut = 0; iCut < GetSize(); iCut++) { |
| 57 |
|
|
cout << " " << setw(nameWidth) << GetCut(iCut)->GetName() << ":"; |
| 58 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(iCut)->GetNGood(); |
| 59 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(iCut)->GetNEv(); |
| 60 |
|
|
cout << " " << (float) GetCut(iCut)->GetNGood() / (float) GetCut(iCut)->GetNEv(); |
| 61 |
|
|
cout << " " << (float) GetCut(iCut)->GetNGood() / (float) GetNEv(); |
| 62 |
pam-fi |
1.1 |
cout << "\n"; |
| 63 |
|
|
|
| 64 |
pam-fi |
1.2 |
if (iAction < _actions.size()) { |
| 65 |
|
|
while (_actionsPositions[iAction] == (int) iCut) { |
| 66 |
|
|
cout << " " << setw(nameWidth) << _actions[iAction]->GetName() << ": ACTION\n"; |
| 67 |
|
|
iAction++; |
| 68 |
|
|
if (iAction == _actions.size()) |
| 69 |
|
|
break; |
| 70 |
|
|
} |
| 71 |
|
|
} |
| 72 |
pam-fi |
1.1 |
} |
| 73 |
|
|
cout << endl; |
| 74 |
|
|
|
| 75 |
|
|
// Reset the output format |
| 76 |
|
|
cout.precision(oldPrec); |
| 77 |
|
|
cout << resetiosflags(ios::floatfield); |
| 78 |
|
|
|
| 79 |
|
|
SmartCollection::Finalize(); |
| 80 |
|
|
|
| 81 |
|
|
} |