-
Notifications
You must be signed in to change notification settings - Fork 2
/
OHltEffPrinter.cpp
105 lines (93 loc) · 3.09 KB
/
OHltEffPrinter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <iostream>
#include <iomanip>
#include <fstream>
#include <TMath.h>
#include <TH1.h>
#include <TH2.h>
#include <TFile.h>
#include <TString.h>
#include "OHltEffPrinter.h"
#include "OHltTree.h"
using namespace std;
void OHltEffPrinter::SetupAll(
vector<double> tEff,
vector<double> tEffErr,
vector<double> tspureEff,
vector<double> tspureEffErr,
vector<double> tpureEff,
vector<double> tpureEffErr,
vector< vector<double> >tcoMa,
double tDenEff)
{
Eff = tEff;
EffErr = tEffErr;
spureEff = tspureEff;
spureEffErr = tspureEffErr;
pureEff = tpureEff;
pureEffErr = tpureEffErr;
coMa = tcoMa;
DenEff = tDenEff;
}
/* ********************************************** */
// Print out eff as ascii
/* ********************************************** */
void OHltEffPrinter::printEffASCII(OHltConfig *cfg, OHltMenu *menu)
{
cout.setf(ios::floatfield, ios::fixed);
cout<<setprecision(3);
cout << "\n";
cout << "Trigger Effs : " << "\n";
cout
<< " Name Prescale Indiv. Pure Cumulative\n";
cout
<< "----------------------------------------------------------------------------------------------------------\n";
double cumulEff = 0.;
double cumulEffErr = 0.;
for (unsigned int i=0; i<menu->GetTriggerSize(); i++)
{
TString tempTrigSeeds;
TString tempTrigSeedPrescales;
std::map<TString, std::vector<TString> > mapL1seeds =
menu->GetL1SeedsOfHLTPathMap(); // mapping to all seeds
TString stmp;
vector<int> itmp;
typedef map< TString, vector<TString> > mymap;
for (mymap::const_iterator it = mapL1seeds.begin(); it
!= mapL1seeds.end(); ++it)
{
if (it->first.CompareTo(menu->GetTriggerName(i)) == 0)
{
for (unsigned int j=0; j<it->second.size(); j++)
{
itmp.push_back(menu->GetL1Prescale((it->second)[j]));
}
}
}
tempTrigSeeds = menu->GetSeedCondition(menu->GetTriggerName(i));
for (unsigned int j=0; j<itmp.size(); j++)
{
tempTrigSeedPrescales += itmp[j];
if (j<(itmp.size()-1))
{
tempTrigSeedPrescales = tempTrigSeedPrescales + ", ";
}
}
if (itmp.size()>2)
{
tempTrigSeedPrescales = "-";
}
cumulEff += spureEff[i];
// cumulEffErr += pow(spureEffErr[i],2.);
cumulEffErr = sqrt(cumulEff*(1-cumulEff)/DenEff);
cout<<setw(50)<<menu->GetTriggerName(i)<<" (" <<setw(4)
<<menu->GetPrescale(i)<<"*" <<tempTrigSeedPrescales<<setw(5)<<") "
<<setw(8)<<Eff[i]<<" +- " <<setw(7)<<EffErr[i]<<" " <<setw(8)
<<spureEff[i]<<" " <<setw(8)<<cumulEff <<endl;
}
cumulEffErr = sqrt(cumulEffErr);
cout << "\n";
cout << setw(60) << "TOTAL EFF : " << setw(5) << cumulEff << " +- "
<< cumulEffErr <<" For "<< DenEff <<" events"<<"\n";
cout
<< "----------------------------------------------------------------------------------------------\n";
}