30 kchipCollections_ = consumes<ESLocalRawDataCollection>(ps.
getParameter<
InputTag>(
"ESKChipCollections"));
32 doLumiAnalysis_ = ps.
getParameter<
bool>(
"DoLumiAnalysis");
35 for (
int i = 0;
i < 2; ++
i)
36 for (
int j = 0;
j < 2; ++
j)
37 for (
int k = 0;
k < 40; ++
k)
38 for (
int m = 0;
m < 40; ++
m) {
39 fed_[
i][
j][
k][
m] = -1;
40 kchip_[
i][
j][
k][
m] = -1;
41 fiber_[
i][
j][
k][
m] = -1;
44 int nLines_, z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
46 file.open(lookup_.fullPath().c_str());
50 for (
int i = 0;
i < nLines_; ++
i) {
51 file >> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
53 z = (iz == -1) ? 2 : iz;
54 fed_[z - 1][ip - 1][ix - 1][iy - 1] = fed;
55 kchip_[z - 1][ip - 1][ix - 1][iy - 1] = kchip;
56 fiber_[z - 1][ip - 1][ix - 1][iy - 1] = (fiber - 1) + (optorx - 1) * 12;
59 cout <<
"ESIntegrityTask : Look up table file can not be found in " << lookup_.fullPath().c_str() << endl;
71 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
73 if (doLumiAnalysis_) {
74 for (
int i = 0;
i < 2; ++
i) {
75 for (
int j = 0;
j < 2; ++
j) {
76 if (meDIErrors_[
i][
j]) {
77 meDIErrors_[
i][
j]->Reset();
87 calculateDIFraction();
93 iBooker.setCurrentFolder(prefixME_ +
"/ESIntegrityTask");
95 sprintf(
histo,
"ES FEDs used for data taking");
96 meFED_ = iBooker.book1D(
histo,
histo, 56, 519.5, 575.5);
97 meFED_->setAxisTitle(
"ES FED", 1);
98 meFED_->setAxisTitle(
"Num of Events", 2);
100 sprintf(
histo,
"ES Gain used for data taking");
101 meGain_ = iBooker.book1D(
histo,
histo, 2, -0.5, 1.5);
102 meGain_->setAxisTitle(
"ES Gain", 1);
103 meGain_->setAxisTitle(
"Num of Events", 2);
105 sprintf(
histo,
"ES DCC Error codes");
106 meDCCErr_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 6, -0.5, 5.5);
107 meDCCErr_->setAxisTitle(
"ES FED", 1);
108 meDCCErr_->setAxisTitle(
"ES DCC Error code", 2);
110 sprintf(
histo,
"ES SLink CRC Errors");
111 meSLinkCRCErr_ = iBooker.book1D(
histo,
histo, 56, 519.5, 575.5);
112 meSLinkCRCErr_->setAxisTitle(
"ES FED", 1);
113 meSLinkCRCErr_->setAxisTitle(
"Num of Events", 2);
115 sprintf(
histo,
"ES DCC CRC Errors");
116 meDCCCRCErr_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
117 meDCCCRCErr_->setAxisTitle(
"ES FED", 1);
118 meDCCCRCErr_->setAxisTitle(
"ES OptoRX", 2);
120 sprintf(
histo,
"ES OptoRX used for data taking");
121 meOptoRX_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
122 meOptoRX_->setAxisTitle(
"ES FED", 1);
123 meOptoRX_->setAxisTitle(
"ES OptoRX", 2);
125 sprintf(
histo,
"ES OptoRX BC mismatch");
126 meOptoBC_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
127 meOptoBC_->setAxisTitle(
"ES FED", 1);
128 meOptoBC_->setAxisTitle(
"ES OptoRX", 2);
130 sprintf(
histo,
"ES Fiber Bad Status");
131 meFiberBadStatus_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
132 meFiberBadStatus_->setAxisTitle(
"ES FED", 1);
133 meFiberBadStatus_->setAxisTitle(
"Fiber Number", 2);
135 sprintf(
histo,
"ES Fiber Error Code");
136 meFiberErrCode_ = iBooker.book1D(
histo,
histo, 17, -0.5, 16.5);
137 meFiberErrCode_->setAxisTitle(
"Fiber Error Code", 1);
139 sprintf(
histo,
"ES Fiber Off");
141 meFiberOff_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
142 meFiberOff_->setAxisTitle(
"ES FED", 1);
143 meFiberOff_->setAxisTitle(
"Fiber Number", 2);
145 sprintf(
histo,
"ES Warning Event Dropped");
146 meEVDR_ = iBooker.book2D(
histo,
histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
147 meEVDR_->setAxisTitle(
"ES FED", 1);
148 meEVDR_->setAxisTitle(
"Fiber Number", 2);
150 sprintf(
histo,
"ES KChip Flag 1 Error codes");
151 meKF1_ = iBooker.book2D(
histo,
histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
152 meKF1_->setAxisTitle(
"ES KChip", 1);
153 meKF1_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
155 sprintf(
histo,
"ES KChip Flag 2 Error codes");
156 meKF2_ = iBooker.book2D(
histo,
histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
157 meKF2_->setAxisTitle(
"ES KChip", 1);
158 meKF2_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
160 sprintf(
histo,
"ES KChip BC mismatch with OptoRX");
161 meKBC_ = iBooker.book1D(
histo,
histo, 1550, -0.5, 1549.5);
162 meKBC_->setAxisTitle(
"ES KChip", 1);
163 meKBC_->setAxisTitle(
"Num of BC mismatch", 2);
165 sprintf(
histo,
"ES KChip EC mismatch with OptoRX");
166 meKEC_ = iBooker.book1D(
histo,
histo, 1550, -0.5, 1549.5);
167 meKEC_->setAxisTitle(
"ES KChip", 1);
168 meKEC_->setAxisTitle(
"Num of EC mismatch", 2);
170 for (
int i = 0;
i < 2; ++
i)
171 for (
int j = 0;
j < 2; ++
j) {
172 int iz = (
i == 0) ? 1 : -1;
173 sprintf(
histo,
"ES Integrity Errors Z %d P %d", iz,
j + 1);
174 meDIErrors_[
i][
j] = iBooker.book2D(
histo,
histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
175 meDIErrors_[
i][
j]->setAxisTitle(
"Si X", 1);
176 meDIErrors_[
i][
j]->setAxisTitle(
"Si Y", 2);
179 if (doLumiAnalysis_) {
180 sprintf(
histo,
"ES Good Channel Fraction");
182 meDIFraction_ = iBooker.book2D(
histo,
histo, 3, 1.0, 3.0, 3, 1.0, 3.0);
195 meDCCErr_->Fill(575, 2, 1);
196 meDCCCRCErr_->Fill(575, 2, 1);
197 meOptoRX_->Fill(575, 2, 1);
198 meOptoBC_->Fill(575, 2, 1);
199 meFiberBadStatus_->Fill(575, 36, 1);
200 meFiberOff_->Fill(575, 36, 1);
201 meEVDR_->Fill(575, 36, 1);
204 Double_t nDIErr[56][36];
205 for (
int i = 0;
i < 56; ++
i)
206 for (
int j = 0;
j < 36; ++
j)
210 vector<int> fiberStatus;
211 if (
e.getByToken(dccCollections_, dccs)) {
215 meFED_->Fill(dcc.
fedId());
221 meSLinkCRCErr_->Fill(dcc.
fedId());
222 for (
int j = 0;
j < 36; ++
j)
223 nDIErr[dcc.
fedId() - 520][
j]++;
227 meOptoRX_->Fill(dcc.
fedId(), 0);
229 meOptoBC_->Fill(dcc.
fedId(), 0);
232 meOptoRX_->Fill(dcc.
fedId(), 1);
234 meOptoBC_->Fill(dcc.
fedId(), 1);
237 meOptoRX_->Fill(dcc.
fedId(), 2);
239 meOptoBC_->Fill(dcc.
fedId(), 2);
243 meDCCCRCErr_->Fill(dcc.
fedId(), 0);
244 for (
int j = 0;
j < 12; ++
j)
245 nDIErr[dcc.
fedId() - 520][
j]++;
248 meDCCCRCErr_->Fill(dcc.
fedId(), 1);
249 for (
int j = 12;
j < 24; ++
j)
250 nDIErr[dcc.
fedId() - 520][
j]++;
253 meDCCCRCErr_->Fill(dcc.
fedId(), 2);
254 for (
int j = 24;
j < 36; ++
j)
255 nDIErr[dcc.
fedId() - 520][
j]++;
260 for (
unsigned int i = 0;
i < fiberStatus.size(); ++
i) {
261 if (fiberStatus[
i] == 4 || fiberStatus[
i] == 8 || fiberStatus[
i] == 10 || fiberStatus[
i] == 11 ||
262 fiberStatus[
i] == 12) {
263 meFiberBadStatus_->Fill(dcc.
fedId(),
i + 1, 1);
264 meFiberErrCode_->Fill(fiberStatus[
i]);
265 nDIErr[dcc.
fedId() - 520][
i]++;
267 if (fiberStatus[
i] == 7)
268 meFiberOff_->Fill(dcc.
fedId(),
i + 1, 1);
269 if (fiberStatus[
i] == 6) {
270 meFiberErrCode_->Fill(fiberStatus[
i]);
271 meEVDR_->Fill(dcc.
fedId(),
i + 1, 1);
281 meGain_->Fill(
gain_);
284 LogWarning(
"ESIntegrityTask") <<
"dccCollections not available";
288 if (
e.getByToken(kchipCollections_, kchips)) {
295 meKBC_->Fill(kchip.
id());
297 meKEC_->Fill(kchip.
id());
300 LogWarning(
"ESIntegrityTask") <<
"kchipCollections not available";
304 for (
int iz = 0; iz < 2; ++iz)
305 for (
int ip = 0; ip < 2; ++ip)
306 for (
int ix = 0; ix < 40; ++ix)
307 for (
int iy = 0; iy < 40; ++iy) {
308 if (fed_[iz][ip][ix][iy] == -1)
311 if (nDIErr[fed_[iz][ip][ix][iy] - 520][fiber_[iz][ip][ix][iy]] > 0)
312 meDIErrors_[iz][ip]->Fill(ix + 1, iy + 1, 1);
319 float nValidChannels = 0;
320 float nGlobalErrors = 0;
322 for (
int i = 0;
i < 2; ++
i) {
323 for (
int j = 0;
j < 2; ++
j) {
324 float nValidChannelsES = 0;
325 float nGlobalErrorsES = 0;
326 float reportSummaryES = -1;
327 if (!meDIErrors_[
i][
j])
329 for (
int x = 0; x < 40; ++x) {
330 for (
int y = 0; y < 40; ++y) {
331 float val = meDIErrors_[
i][
j]->getBinContent(x + 1, y + 1);
332 if (fed_[
i][
j][x][y] == -1)
335 nGlobalErrors +=
val / ievt_;
338 nGlobalErrorsES +=
val / ievt_;
342 if (nValidChannelsES != 0)
343 reportSummaryES = 1 - nGlobalErrorsES / nValidChannelsES;
344 meDIFraction_->setBinContent(
i + 1,
j + 1, reportSummaryES);
347 float reportSummary = -1.0;
348 if (nValidChannels != 0)
349 reportSummary = 1.0 - nGlobalErrors / nValidChannels;
350 meDIFraction_->setBinContent(3, 3, reportSummary);