-
Notifications
You must be signed in to change notification settings - Fork 2
/
OHltRateCounter.h
167 lines (139 loc) · 3.61 KB
/
OHltRateCounter.h
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
//////////////////////////////////////////////////////////
//
// Class to store and process rate counts
//
//////////////////////////////////////////////////////////
#ifndef OHltRateCounter_h
#define OHltRateCounter_h
#include <vector>
#include <libconfig.h++>
#include <TMath.h>
class OHltRateCounter
{
public:
OHltRateCounter(double size, double l1size);
virtual ~OHltRateCounter() {}
bool isNewRunLS(int Run, int LumiBlock);
void addRunLS(int Run, int LumiBlock, double AvgInstDelLumi);
void incrRunLSCount(int Run, int LumiBlock, int iTrig, int incr=1);
void incrRunLSTotCount(int Run, int LumiBlock, int incr=1);
void updateRunLSRefPrescale(
int Run,
int LumiBlock,
int iTrig,
int refprescale);
void updateRunLSRefL1Prescale(
int Run,
int LumiBlock,
int iL1Trig,
int refl1prescale);
int getIDofRunLSCounter(int Run, int LumiBlock);
// Helper functions
static inline double eff(int a, int b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), effi = af/bf;
return effi;
}
static inline double effErr(int a, int b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), r = af/bf;
double unc = sqrt(af + (r*r*bf))/bf;
return unc;
}
static inline double effErrb(int a, int b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), r = af/bf;
double unc = sqrt(af - (r*r*bf))/bf;
return unc;
}
static inline double eff(double a, double b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), effi = af/bf;
return effi;
}
static inline double effErr(double a, double b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), r = af/bf;
double unc = sqrt(af + (r*r*bf))/bf;
return unc;
}
static inline double effErrb(double a, double b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b), r = af/bf;
double unc = sqrt(af - (r*r*bf))/bf;
return unc;
}
static inline double errRate2(double a, double b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b);
double unc = af/(bf*bf);
//double unc = sqrt(af + (r*r*bf) )/bf;
return unc;
}
static inline double errRate2(int a, int b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b);
double unc = af/(bf*bf);
//double unc = sqrt(af + (r*r*bf) )/bf;
return unc;
}
static inline double errRate2(int a, double b)
{
if (b==0.)
{
return -1.;
}
double af = double(a), bf = double(b);
double unc = af/(bf*bf);
//double unc = sqrt(af + (r*r*bf) )/bf;
return unc;
}
// Data
std::vector<double> iCount;
std::vector<double> iL1Count;
std::vector<double> sPureCount;
std::vector<double> pureCount;
std::vector< std::vector<double> > overlapCount;
std::vector<double> prescaleCount;
std::vector<double> prescaleCountL1;
std::vector< std::vector<int> > perLumiSectionCount;
std::vector<int> perLumiSectionTotCount;
std::vector< std::vector<int> > perLumiSectionRefPrescale;
std::vector< std::vector<int> > perLumiSectionRefL1Prescale;
std::vector<int> runID;
std::vector<int> lumiSection;
std::vector<double> perLumiSectionLumi;
};
#endif