41 doLumiAnalysis_ = ps.
getParameter<
bool>(
"DoLumiAnalysis");
44 for (
int i=0;
i<2; ++
i)
45 for (
int j=0;
j<2; ++
j)
46 for (
int k=0;
k<40; ++
k)
47 for (
int m=0;
m<40; ++
m) {
48 fed_[
i][
j][
k][
m] = -1;
49 kchip_[
i][
j][
k][
m] = -1;
50 fiber_[
i][
j][
k][
m] = -1;
53 int nLines_,
z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
55 file.open(lookup_.fullPath().c_str());
56 if( file.is_open() ) {
60 for (
int i=0;
i<nLines_; ++
i) {
61 file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
64 fed_[z-1][ip-1][ix-1][iy-1] = fed;
65 kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
66 fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
70 cout<<
"ESIntegrityTask : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
83 dqmStore_->setCurrentFolder(prefixME_ +
"/ESIntegrityTask");
84 dqmStore_->rmdir(prefixME_ +
"/ESIntegrityTask");
91 if ( ! init_ ) this->
setup();
92 if ( ! mergeRuns_ ) this->
reset();
98 if (doLumiAnalysis_) {
99 for (
int i=0;
i<2; ++
i) {
100 for (
int j=0;
j<2; ++
j) {
101 if (meDIErrors_[
i][
j]) {
102 dqmStore_->disableSoftReset(meDIErrors_[
i][j]);
111 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
113 if (doLumiAnalysis_) {
114 for (
int i=0;
i<2; ++
i) {
115 for (
int j=0;
j<2; ++
j) {
116 if (meDIErrors_[
i][
j]) {
117 dqmStore_->softReset(meDIErrors_[
i][j]);
126 if (doLumiAnalysis_) calculateDIFraction();
151 dqmStore_->setCurrentFolder(prefixME_ +
"/ESIntegrityTask");
153 sprintf(histo,
"ES FEDs used for data taking");
154 meFED_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
155 meFED_->setAxisTitle(
"ES FED", 1);
156 meFED_->setAxisTitle(
"Num of Events", 2);
158 sprintf(histo,
"ES Gain used for data taking");
159 meGain_ = dqmStore_->book1D(histo, histo, 2, -0.5, 1.5);
160 meGain_->setAxisTitle(
"ES Gain", 1);
161 meGain_->setAxisTitle(
"Num of Events", 2);
163 sprintf(histo,
"ES DCC Error codes");
164 meDCCErr_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 6, -0.5, 5.5);
165 meDCCErr_->setAxisTitle(
"ES FED", 1);
166 meDCCErr_->setAxisTitle(
"ES DCC Error code", 2);
168 sprintf(histo,
"ES SLink CRC Errors");
169 meSLinkCRCErr_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
170 meSLinkCRCErr_->setAxisTitle(
"ES FED", 1);
171 meSLinkCRCErr_->setAxisTitle(
"Num of Events", 2);
173 sprintf(histo,
"ES DCC CRC Errors");
174 meDCCCRCErr_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
175 meDCCCRCErr_->setAxisTitle(
"ES FED", 1);
176 meDCCCRCErr_->setAxisTitle(
"ES OptoRX", 2);
178 sprintf(histo,
"ES OptoRX used for data taking");
179 meOptoRX_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
180 meOptoRX_->setAxisTitle(
"ES FED", 1);
181 meOptoRX_->setAxisTitle(
"ES OptoRX", 2);
183 sprintf(histo,
"ES OptoRX BC mismatch");
184 meOptoBC_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
185 meOptoBC_->setAxisTitle(
"ES FED", 1);
186 meOptoBC_->setAxisTitle(
"ES OptoRX", 2);
188 sprintf(histo,
"ES Fiber Bad Status");
189 meFiberBadStatus_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
190 meFiberBadStatus_->setAxisTitle(
"ES FED", 1);
191 meFiberBadStatus_->setAxisTitle(
"Fiber Number", 2);
193 sprintf(histo,
"ES Fiber Error Code");
194 meFiberErrCode_ = dqmStore_->book1D(histo, histo, 17, -0.5, 16.5);
195 meFiberErrCode_->setAxisTitle(
"Fiber Error Code", 1);
197 sprintf(histo,
"ES Fiber Off");
199 meFiberOff_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
200 meFiberOff_->setAxisTitle(
"ES FED", 1);
201 meFiberOff_->setAxisTitle(
"Fiber Number", 2);
203 sprintf(histo,
"ES Warning Event Dropped");
204 meEVDR_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
205 meEVDR_->setAxisTitle(
"ES FED", 1);
206 meEVDR_->setAxisTitle(
"Fiber Number", 2);
208 sprintf(histo,
"ES KChip Flag 1 Error codes");
209 meKF1_ = dqmStore_->book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
210 meKF1_->setAxisTitle(
"ES KChip", 1);
211 meKF1_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
213 sprintf(histo,
"ES KChip Flag 2 Error codes");
214 meKF2_ = dqmStore_->book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
215 meKF2_->setAxisTitle(
"ES KChip", 1);
216 meKF2_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
218 sprintf(histo,
"ES KChip BC mismatch with OptoRX");
219 meKBC_ = dqmStore_->book1D(histo, histo, 1550, -0.5, 1549.5);
220 meKBC_->setAxisTitle(
"ES KChip", 1);
221 meKBC_->setAxisTitle(
"Num of BC mismatch", 2);
223 sprintf(histo,
"ES KChip EC mismatch with OptoRX");
224 meKEC_ = dqmStore_->book1D(histo, histo, 1550, -0.5, 1549.5);
225 meKEC_->setAxisTitle(
"ES KChip", 1);
226 meKEC_->setAxisTitle(
"Num of EC mismatch", 2);
228 for (
int i=0;
i<2; ++
i)
229 for (
int j=0;
j<2; ++
j) {
230 int iz = (
i==0)? 1:-1;
231 sprintf(histo,
"ES Integrity Errors Z %d P %d", iz,
j+1);
232 meDIErrors_[
i][
j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
233 meDIErrors_[
i][
j]->setAxisTitle(
"Si X", 1);
234 meDIErrors_[
i][
j]->setAxisTitle(
"Si Y", 2);
237 if (doLumiAnalysis_) {
238 sprintf(histo,
"ES Good Channel Fraction");
239 meDIFraction_ = dqmStore_->book2D(histo, histo, 3, 1.0, 3.0, 3, 1.0, 3.0);
240 meDIFraction_->setLumiFlag();
249 if ( ! init_ )
return;
261 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
263 if ( enableCleanup_ ) this->
cleanup();
269 if ( ! init_ ) this->
setup();
277 meDCCErr_->Fill(575, 2, 1);
278 meDCCCRCErr_->Fill(575, 2, 1);
279 meOptoRX_->Fill(575, 2, 1);
280 meOptoBC_->Fill(575, 2, 1);
281 meFiberBadStatus_->Fill(575, 36, 1);
282 meFiberOff_->Fill(575, 36, 1);
283 meEVDR_->Fill(575, 36, 1);
286 Double_t nDIErr[56][36];
287 for (
int i=0;
i<56; ++
i)
288 for (
int j=0;
j<36; ++
j)
292 vector<int> fiberStatus;
298 meFED_->Fill(dcc.
fedId());
304 meSLinkCRCErr_->Fill(dcc.
fedId());
305 for (
int j=0;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
309 meOptoRX_->Fill(dcc.
fedId(), 0);
313 meOptoRX_->Fill(dcc.
fedId(), 1);
317 meOptoRX_->Fill(dcc.
fedId(), 2);
322 meDCCCRCErr_->Fill(dcc.
fedId(), 0);
323 for (
int j=0;
j<12; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
326 meDCCCRCErr_->Fill(dcc.
fedId(), 1);
327 for (
int j=12;
j<24; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
330 meDCCCRCErr_->Fill(dcc.
fedId(), 2);
331 for (
int j=24;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
336 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
337 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12) {
338 meFiberBadStatus_->Fill(dcc.
fedId(),
i+1, 1);
339 meFiberErrCode_->Fill(fiberStatus[
i]);
340 nDIErr[dcc.
fedId()-520][
i]++;
342 if (fiberStatus[
i]==7)
343 meFiberOff_->Fill(dcc.
fedId(),
i+1, 1);
344 if (fiberStatus[
i]==6) {
345 meFiberErrCode_->Fill(fiberStatus[
i]);
346 meEVDR_->Fill(dcc.
fedId(), i+1, 1);
356 meGain_->Fill(
gain_);
359 LogWarning(
"ESIntegrityTask") << dccCollections_ <<
" not available";
363 if ( e.
getByLabel(kchipCollections_, kchips) ) {
375 LogWarning(
"ESIntegrityTask") << kchipCollections_ <<
" not available";
379 for (
int iz=0; iz<2; ++iz)
380 for (
int ip=0; ip<2; ++ip)
381 for (
int ix=0; ix<40; ++ix)
382 for (
int iy=0; iy<40; ++iy) {
384 if (fed_[iz][ip][ix][iy] == -1)
continue;
386 if (nDIErr[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] > 0)
387 meDIErrors_[iz][ip]->Fill(ix+1, iy+1, 1);
397 float nValidChannels=0;
398 float nGlobalErrors=0;
400 for (
int i=0;
i<2; ++
i) {
401 for (
int j=0;
j<2; ++
j) {
402 float nValidChannelsES=0;
403 float nGlobalErrorsES = 0;
404 float reportSummaryES = -1;
405 if (!meDIErrors_[
i][
j])
continue;
406 for (
int x=0;
x<40; ++
x) {
407 for (
int y=0;
y<40; ++
y) {
408 float val = meDIErrors_[
i][
j]->getBinContent(
x+1,
y+1);
409 if (fed_[
i][j][
x][
y] == -1)
continue;
410 if (ievt_ != 0) nGlobalErrors += val/ievt_;
412 if (ievt_ != 0) nGlobalErrorsES += val/ievt_;
416 if (nValidChannelsES != 0) reportSummaryES = 1 - nGlobalErrorsES/nValidChannelsES;
417 meDIFraction_->setBinContent(
i+1, j+1, reportSummaryES);
420 float reportSummary = -1.0;
421 if (nValidChannels != 0) reportSummary = 1.0 - nGlobalErrors/nValidChannels;
422 meDIFraction_->setBinContent(3,3, reportSummary);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
std::vector< T >::const_iterator const_iterator
static void cleanup(const Factory::MakerMap::value_type &v)
virtual ~ESIntegrityTask()
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void cleanup(void)
Cleanup.
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
void endLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &c)
End Lumi.
void beginLuminosityBlock(const edm::LuminosityBlock &lumi, const edm::EventSetup &c)
Begin Lumi.
void calculateDIFraction(void)
Calculate Data Integrity Fraction.
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
ESIntegrityTask(const edm::ParameterSet &ps)
void beginJob(void)
BeginJob.
void reset(double vett[256])
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")