31 kchipCollections_ = consumes<ESLocalRawDataCollection>(ps.
getParameter<
InputTag>(
"ESKChipCollections"));
33 doLumiAnalysis_ = ps.
getParameter<
bool>(
"DoLumiAnalysis");
36 for (
int i=0;
i<2; ++
i)
37 for (
int j=0;
j<2; ++
j)
38 for (
int k=0;
k<40; ++
k)
39 for (
int m=0;
m<40; ++
m) {
40 fed_[
i][
j][
k][
m] = -1;
41 kchip_[
i][
j][
k][
m] = -1;
42 fiber_[
i][
j][
k][
m] = -1;
45 int nLines_,
z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
47 file.open(lookup_.fullPath().c_str());
48 if( file.is_open() ) {
52 for (
int i=0;
i<nLines_; ++
i) {
53 file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
56 fed_[z-1][ip-1][ix-1][iy-1] = fed;
57 kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
58 fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
62 cout<<
"ESIntegrityTask : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
73 if (doLumiAnalysis_) {
74 for (
int i=0;
i<2; ++
i) {
75 for (
int j=0;
j<2; ++
j) {
76 if (meDIErrors_[
i][
j]) {
87 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
89 if (doLumiAnalysis_) {
90 for (
int i=0;
i<2; ++
i) {
91 for (
int j=0;
j<2; ++
j) {
92 if (meDIErrors_[
i][
j]) {
93 dqmStore->softReset(meDIErrors_[
i][j]);
102 if (doLumiAnalysis_) calculateDIFraction();
111 sprintf(histo,
"ES FEDs used for data taking");
112 meFED_ = iBooker.
book1D(histo, histo, 56, 519.5, 575.5);
114 meFED_->setAxisTitle(
"Num of Events", 2);
116 sprintf(histo,
"ES Gain used for data taking");
117 meGain_ = iBooker.
book1D(histo, histo, 2, -0.5, 1.5);
119 meGain_->setAxisTitle(
"Num of Events", 2);
121 sprintf(histo,
"ES DCC Error codes");
122 meDCCErr_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 6, -0.5, 5.5);
124 meDCCErr_->setAxisTitle(
"ES DCC Error code", 2);
126 sprintf(histo,
"ES SLink CRC Errors");
127 meSLinkCRCErr_ = iBooker.
book1D(histo, histo, 56, 519.5, 575.5);
129 meSLinkCRCErr_->setAxisTitle(
"Num of Events", 2);
131 sprintf(histo,
"ES DCC CRC Errors");
132 meDCCCRCErr_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
134 meDCCCRCErr_->setAxisTitle(
"ES OptoRX", 2);
136 sprintf(histo,
"ES OptoRX used for data taking");
137 meOptoRX_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
139 meOptoRX_->setAxisTitle(
"ES OptoRX", 2);
141 sprintf(histo,
"ES OptoRX BC mismatch");
142 meOptoBC_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
144 meOptoBC_->setAxisTitle(
"ES OptoRX", 2);
146 sprintf(histo,
"ES Fiber Bad Status");
147 meFiberBadStatus_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
149 meFiberBadStatus_->setAxisTitle(
"Fiber Number", 2);
151 sprintf(histo,
"ES Fiber Error Code");
152 meFiberErrCode_ = iBooker.
book1D(histo, histo, 17, -0.5, 16.5);
155 sprintf(histo,
"ES Fiber Off");
157 meFiberOff_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
159 meFiberOff_->setAxisTitle(
"Fiber Number", 2);
161 sprintf(histo,
"ES Warning Event Dropped");
162 meEVDR_ = iBooker.
book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
164 meEVDR_->setAxisTitle(
"Fiber Number", 2);
166 sprintf(histo,
"ES KChip Flag 1 Error codes");
167 meKF1_ = iBooker.
book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
169 meKF1_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
171 sprintf(histo,
"ES KChip Flag 2 Error codes");
172 meKF2_ = iBooker.
book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
174 meKF2_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
176 sprintf(histo,
"ES KChip BC mismatch with OptoRX");
177 meKBC_ = iBooker.
book1D(histo, histo, 1550, -0.5, 1549.5);
179 meKBC_->setAxisTitle(
"Num of BC mismatch", 2);
181 sprintf(histo,
"ES KChip EC mismatch with OptoRX");
182 meKEC_ = iBooker.
book1D(histo, histo, 1550, -0.5, 1549.5);
184 meKEC_->setAxisTitle(
"Num of EC mismatch", 2);
186 for (
int i=0;
i<2; ++
i)
187 for (
int j=0;
j<2; ++
j) {
188 int iz = (
i==0)? 1:-1;
189 sprintf(histo,
"ES Integrity Errors Z %d P %d", iz,
j+1);
190 meDIErrors_[
i][
j] = iBooker.
book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
192 meDIErrors_[
i][
j]->setAxisTitle(
"Si Y", 2);
195 if (doLumiAnalysis_) {
196 sprintf(histo,
"ES Good Channel Fraction");
197 meDIFraction_ = iBooker.
book2D(histo, histo, 3, 1.0, 3.0, 3, 1.0, 3.0);
204 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
216 meDCCErr_->Fill(575, 2, 1);
217 meDCCCRCErr_->Fill(575, 2, 1);
218 meOptoRX_->Fill(575, 2, 1);
219 meOptoBC_->Fill(575, 2, 1);
220 meFiberBadStatus_->Fill(575, 36, 1);
221 meFiberOff_->Fill(575, 36, 1);
222 meEVDR_->Fill(575, 36, 1);
225 Double_t nDIErr[56][36];
226 for (
int i=0;
i<56; ++
i)
227 for (
int j=0;
j<36; ++
j)
231 vector<int> fiberStatus;
237 meFED_->Fill(dcc.
fedId());
243 meSLinkCRCErr_->Fill(dcc.
fedId());
244 for (
int j=0;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
248 meOptoRX_->Fill(dcc.
fedId(), 0);
252 meOptoRX_->Fill(dcc.
fedId(), 1);
256 meOptoRX_->Fill(dcc.
fedId(), 2);
261 meDCCCRCErr_->Fill(dcc.
fedId(), 0);
262 for (
int j=0;
j<12; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
265 meDCCCRCErr_->Fill(dcc.
fedId(), 1);
266 for (
int j=12;
j<24; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
269 meDCCCRCErr_->Fill(dcc.
fedId(), 2);
270 for (
int j=24;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
275 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
276 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12) {
277 meFiberBadStatus_->Fill(dcc.
fedId(),
i+1, 1);
278 meFiberErrCode_->Fill(fiberStatus[
i]);
279 nDIErr[dcc.
fedId()-520][
i]++;
281 if (fiberStatus[
i]==7)
282 meFiberOff_->Fill(dcc.
fedId(),
i+1, 1);
283 if (fiberStatus[
i]==6) {
284 meFiberErrCode_->Fill(fiberStatus[
i]);
285 meEVDR_->Fill(dcc.
fedId(), i+1, 1);
295 meGain_->Fill(
gain_);
298 LogWarning(
"ESIntegrityTask") <<
"dccCollections not available";
302 if ( e.
getByToken(kchipCollections_, kchips) ) {
314 LogWarning(
"ESIntegrityTask") <<
"kchipCollections not available";
318 for (
int iz=0; iz<2; ++iz)
319 for (
int ip=0; ip<2; ++ip)
320 for (
int ix=0; ix<40; ++ix)
321 for (
int iy=0; iy<40; ++iy) {
323 if (fed_[iz][ip][ix][iy] == -1)
continue;
325 if (nDIErr[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] > 0)
326 meDIErrors_[iz][ip]->Fill(ix+1, iy+1, 1);
336 float nValidChannels=0;
337 float nGlobalErrors=0;
339 for (
int i=0;
i<2; ++
i) {
340 for (
int j=0;
j<2; ++
j) {
341 float nValidChannelsES=0;
342 float nGlobalErrorsES = 0;
343 float reportSummaryES = -1;
344 if (!meDIErrors_[
i][
j])
continue;
345 for (
int x=0;
x<40; ++
x) {
346 for (
int y=0;
y<40; ++
y) {
347 float val = meDIErrors_[
i][
j]->getBinContent(
x+1,
y+1);
348 if (fed_[
i][j][
x][
y] == -1)
continue;
349 if (ievt_ != 0) nGlobalErrors += val/ievt_;
351 if (ievt_ != 0) nGlobalErrorsES += val/ievt_;
355 if (nValidChannelsES != 0) reportSummaryES = 1 - nGlobalErrorsES/nValidChannelsES;
356 meDIFraction_->setBinContent(
i+1, j+1, reportSummaryES);
360 if (nValidChannels != 0) reportSummary = 1.0 - nGlobalErrors/nValidChannels;
361 meDIFraction_->setBinContent(3,3, reportSummary);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< ESDCCHeaderBlock >::const_iterator const_iterator
void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &c) override
Begin Lumi.
void disableSoftReset(MonitorElement *me)
void endRun(const edm::Run &r, const edm::EventSetup &c) override
EndRun.
void calculateDIFraction(void)
Calculate Data Integrity Fraction.
MonitorElement * book1D(Args &&...args)
void endLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &c) override
End Lumi.
void setCurrentFolder(const std::string &fullpath)
MonitorElement * book2D(Args &&...args)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
ESIntegrityTask(const edm::ParameterSet &ps)
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.