-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOHltRateCounter.cpp
More file actions
114 lines (102 loc) · 2.51 KB
/
OHltRateCounter.cpp
File metadata and controls
114 lines (102 loc) · 2.51 KB
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
#include "OHltRateCounter.h"
using namespace std;
using namespace libconfig;
OHltRateCounter::OHltRateCounter(double size, double l1size)
{
vector<double> itmp;
for (unsigned int i=0; i<size; i++)
{
iCount.push_back(0);
sPureCount.push_back(0);
pureCount.push_back(0);
prescaleCount.push_back(0);
itmp.push_back(0);
}
for (unsigned int j=0; j<size; j++)
{
overlapCount.push_back(itmp);
}
for (unsigned int k=0; k<l1size; k++)
{
prescaleCountL1.push_back(0);
iL1Count.push_back(0);
}
}
bool OHltRateCounter::isNewRunLS(int Run, int LumiBlock)
{
for (unsigned int i=0; i<runID.size(); i++)
{
if (Run==runID[i] && LumiBlock==lumiSection[i])
return false;
}
return true;
}
void OHltRateCounter::addRunLS(int Run, int LumiBlock, double AvgInstDelLumi)
{
runID.push_back(Run);
lumiSection.push_back(LumiBlock);
perLumiSectionLumi.push_back(AvgInstDelLumi);
vector< int> vtmp;
vector< int> vtmpl1;
for (unsigned int i=0; i<iCount.size(); i++)
{
vtmp.push_back(0);
}
perLumiSectionCount.push_back(vtmp);
perLumiSectionTotCount.push_back(0);
perLumiSectionRefPrescale.push_back(vtmp);
for (unsigned int i=0; i<iL1Count.size(); i++)
{
vtmpl1.push_back(0);
}
perLumiSectionRefL1Prescale.push_back(vtmpl1);
}
int OHltRateCounter::getIDofRunLSCounter(int Run, int LumiBlock)
{
for (unsigned int i=0; i<runID.size(); i++)
{
if (Run==runID[i] && LumiBlock==lumiSection[i])
return i;
}
return -999;
}
void OHltRateCounter::incrRunLSCount(int Run, int LumiBlock, int iTrig, int incr)
{
int id = getIDofRunLSCounter(Run, LumiBlock);
if (id>-1)
{
perLumiSectionCount[id][iTrig] = perLumiSectionCount[id][iTrig] + incr;
}
}
void OHltRateCounter::incrRunLSTotCount(int Run, int LumiBlock, int incr)
{
int id = getIDofRunLSCounter(Run, LumiBlock);
if (id>-1)
{
perLumiSectionTotCount[id] = perLumiSectionTotCount[id] + incr;
}
}
void OHltRateCounter::updateRunLSRefPrescale(
int Run,
int LumiBlock,
int iTrig,
int refprescale)
{
int id = getIDofRunLSCounter(Run, LumiBlock);
if (id>-1)
{
perLumiSectionRefPrescale[id][iTrig] = refprescale;
}
}
void OHltRateCounter::updateRunLSRefL1Prescale(
int Run,
int LumiBlock,
int iL1Trig,
int refl1prescale)
{
int id = getIDofRunLSCounter(Run, LumiBlock);
if (id>-1)
{
perLumiSectionRefL1Prescale[id][iL1Trig] = refl1prescale;
}
}