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 |
pam-fi |
1.2 |
|
42 |
|
|
// Print the names of the actions placed before the cuts |
43 |
|
|
unsigned int iAction = 0; |
44 |
|
|
if (_actions.size() > 0) { |
45 |
|
|
while (_actionsPositions[iAction] == -1) { |
46 |
|
|
cout << " " << setw(nameWidth) << _actions[iAction]->GetName() << ":" << " ACTION\n"; |
47 |
|
|
iAction++; |
48 |
|
|
if (iAction == _actions.size()) |
49 |
|
|
break; |
50 |
|
|
} |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
for (unsigned int iCut = 0; iCut < GetSize(); iCut++) { |
54 |
|
|
cout << " " << setw(nameWidth) << GetCut(iCut)->GetName() << ":"; |
55 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(iCut)->GetNGood(); |
56 |
|
|
cout << " " << setw(nDigitsEvents) << GetCut(iCut)->GetNEv(); |
57 |
|
|
cout << " " << (float) GetCut(iCut)->GetNGood() / (float) GetCut(iCut)->GetNEv(); |
58 |
|
|
cout << " " << (float) GetCut(iCut)->GetNGood() / (float) GetNEv(); |
59 |
pam-fi |
1.1 |
cout << "\n"; |
60 |
|
|
|
61 |
pam-fi |
1.2 |
if (iAction < _actions.size()) { |
62 |
|
|
while (_actionsPositions[iAction] == (int) iCut) { |
63 |
|
|
cout << " " << setw(nameWidth) << _actions[iAction]->GetName() << ": ACTION\n"; |
64 |
|
|
iAction++; |
65 |
|
|
if (iAction == _actions.size()) |
66 |
|
|
break; |
67 |
|
|
} |
68 |
|
|
} |
69 |
pam-fi |
1.1 |
} |
70 |
|
|
cout << endl; |
71 |
|
|
|
72 |
|
|
// Reset the output format |
73 |
|
|
cout.precision(oldPrec); |
74 |
|
|
cout << resetiosflags(ios::floatfield); |
75 |
|
|
|
76 |
|
|
SmartCollection::Finalize(); |
77 |
|
|
|
78 |
|
|
} |