38 kchipCollections_ = consumes<ESLocalRawDataCollection>(ps.
getParameter<
InputTag>(
"ESKChipCollections"));
40 doLumiAnalysis_ = ps.
getParameter<
bool>(
"DoLumiAnalysis");
43 for (
int i=0;
i<2; ++
i)
44 for (
int j=0;
j<2; ++
j)
45 for (
int k=0;
k<40; ++
k)
46 for (
int m=0;
m<40; ++
m) {
47 fed_[
i][
j][
k][
m] = -1;
48 kchip_[
i][
j][
k][
m] = -1;
49 fiber_[
i][
j][
k][
m] = -1;
52 int nLines_,
z, iz, ip, ix, iy, fed, kchip, pace, bundle, fiber, optorx;
54 file.open(lookup_.fullPath().c_str());
55 if( file.is_open() ) {
59 for (
int i=0;
i<nLines_; ++
i) {
60 file>> iz >> ip >> ix >> iy >> fed >> kchip >> pace >> bundle >> fiber >> optorx;
63 fed_[z-1][ip-1][ix-1][iy-1] = fed;
64 kchip_[z-1][ip-1][ix-1][iy-1] = kchip;
65 fiber_[z-1][ip-1][ix-1][iy-1] = (fiber-1)+(optorx-1)*12;
69 cout<<
"ESIntegrityTask : Look up table file can not be found in "<<lookup_.fullPath().c_str()<<endl;
82 dqmStore_->setCurrentFolder(prefixME_ +
"/ESIntegrityTask");
83 dqmStore_->rmdir(prefixME_ +
"/ESIntegrityTask");
90 if ( ! init_ ) this->
setup();
91 if ( ! mergeRuns_ ) this->
reset();
97 if (doLumiAnalysis_) {
98 for (
int i=0;
i<2; ++
i) {
99 for (
int j=0;
j<2; ++
j) {
100 if (meDIErrors_[
i][
j]) {
101 dqmStore_->disableSoftReset(meDIErrors_[
i][j]);
110 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
112 if (doLumiAnalysis_) {
113 for (
int i=0;
i<2; ++
i) {
114 for (
int j=0;
j<2; ++
j) {
115 if (meDIErrors_[
i][
j]) {
116 dqmStore_->softReset(meDIErrors_[
i][j]);
125 if (doLumiAnalysis_) calculateDIFraction();
150 dqmStore_->setCurrentFolder(prefixME_ +
"/ESIntegrityTask");
152 sprintf(histo,
"ES FEDs used for data taking");
153 meFED_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
154 meFED_->setAxisTitle(
"ES FED", 1);
155 meFED_->setAxisTitle(
"Num of Events", 2);
157 sprintf(histo,
"ES Gain used for data taking");
158 meGain_ = dqmStore_->book1D(histo, histo, 2, -0.5, 1.5);
159 meGain_->setAxisTitle(
"ES Gain", 1);
160 meGain_->setAxisTitle(
"Num of Events", 2);
162 sprintf(histo,
"ES DCC Error codes");
163 meDCCErr_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 6, -0.5, 5.5);
164 meDCCErr_->setAxisTitle(
"ES FED", 1);
165 meDCCErr_->setAxisTitle(
"ES DCC Error code", 2);
167 sprintf(histo,
"ES SLink CRC Errors");
168 meSLinkCRCErr_ = dqmStore_->book1D(histo, histo, 56, 519.5, 575.5);
169 meSLinkCRCErr_->setAxisTitle(
"ES FED", 1);
170 meSLinkCRCErr_->setAxisTitle(
"Num of Events", 2);
172 sprintf(histo,
"ES DCC CRC Errors");
173 meDCCCRCErr_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
174 meDCCCRCErr_->setAxisTitle(
"ES FED", 1);
175 meDCCCRCErr_->setAxisTitle(
"ES OptoRX", 2);
177 sprintf(histo,
"ES OptoRX used for data taking");
178 meOptoRX_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
179 meOptoRX_->setAxisTitle(
"ES FED", 1);
180 meOptoRX_->setAxisTitle(
"ES OptoRX", 2);
182 sprintf(histo,
"ES OptoRX BC mismatch");
183 meOptoBC_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 3, -0.5, 2.5);
184 meOptoBC_->setAxisTitle(
"ES FED", 1);
185 meOptoBC_->setAxisTitle(
"ES OptoRX", 2);
187 sprintf(histo,
"ES Fiber Bad Status");
188 meFiberBadStatus_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
189 meFiberBadStatus_->setAxisTitle(
"ES FED", 1);
190 meFiberBadStatus_->setAxisTitle(
"Fiber Number", 2);
192 sprintf(histo,
"ES Fiber Error Code");
193 meFiberErrCode_ = dqmStore_->book1D(histo, histo, 17, -0.5, 16.5);
194 meFiberErrCode_->setAxisTitle(
"Fiber Error Code", 1);
196 sprintf(histo,
"ES Fiber Off");
198 meFiberOff_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
199 meFiberOff_->setAxisTitle(
"ES FED", 1);
200 meFiberOff_->setAxisTitle(
"Fiber Number", 2);
202 sprintf(histo,
"ES Warning Event Dropped");
203 meEVDR_ = dqmStore_->book2D(histo, histo, 56, 519.5, 575.5, 36, 0.5, 36.5);
204 meEVDR_->setAxisTitle(
"ES FED", 1);
205 meEVDR_->setAxisTitle(
"Fiber Number", 2);
207 sprintf(histo,
"ES KChip Flag 1 Error codes");
208 meKF1_ = dqmStore_->book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
209 meKF1_->setAxisTitle(
"ES KChip", 1);
210 meKF1_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
212 sprintf(histo,
"ES KChip Flag 2 Error codes");
213 meKF2_ = dqmStore_->book2D(histo, histo, 1550, -0.5, 1549.5, 16, -0.5, 15.5);
214 meKF2_->setAxisTitle(
"ES KChip", 1);
215 meKF2_->setAxisTitle(
"ES KChip F1 Error Code ", 2);
217 sprintf(histo,
"ES KChip BC mismatch with OptoRX");
218 meKBC_ = dqmStore_->book1D(histo, histo, 1550, -0.5, 1549.5);
219 meKBC_->setAxisTitle(
"ES KChip", 1);
220 meKBC_->setAxisTitle(
"Num of BC mismatch", 2);
222 sprintf(histo,
"ES KChip EC mismatch with OptoRX");
223 meKEC_ = dqmStore_->book1D(histo, histo, 1550, -0.5, 1549.5);
224 meKEC_->setAxisTitle(
"ES KChip", 1);
225 meKEC_->setAxisTitle(
"Num of EC mismatch", 2);
227 for (
int i=0;
i<2; ++
i)
228 for (
int j=0;
j<2; ++
j) {
229 int iz = (
i==0)? 1:-1;
230 sprintf(histo,
"ES Integrity Errors Z %d P %d", iz,
j+1);
231 meDIErrors_[
i][
j] = dqmStore_->book2D(histo, histo, 40, 0.5, 40.5, 40, 0.5, 40.5);
232 meDIErrors_[
i][
j]->setAxisTitle(
"Si X", 1);
233 meDIErrors_[
i][
j]->setAxisTitle(
"Si Y", 2);
236 if (doLumiAnalysis_) {
237 sprintf(histo,
"ES Good Channel Fraction");
238 meDIFraction_ = dqmStore_->book2D(histo, histo, 3, 1.0, 3.0, 3, 1.0, 3.0);
239 meDIFraction_->setLumiFlag();
248 if ( ! init_ )
return;
260 LogInfo(
"ESIntegrityTask") <<
"analyzed " << ievt_ <<
" events";
262 if ( enableCleanup_ ) this->
cleanup();
268 if ( ! init_ ) this->
setup();
276 meDCCErr_->Fill(575, 2, 1);
277 meDCCCRCErr_->Fill(575, 2, 1);
278 meOptoRX_->Fill(575, 2, 1);
279 meOptoBC_->Fill(575, 2, 1);
280 meFiberBadStatus_->Fill(575, 36, 1);
281 meFiberOff_->Fill(575, 36, 1);
282 meEVDR_->Fill(575, 36, 1);
285 Double_t nDIErr[56][36];
286 for (
int i=0;
i<56; ++
i)
287 for (
int j=0;
j<36; ++
j)
291 vector<int> fiberStatus;
297 meFED_->Fill(dcc.
fedId());
303 meSLinkCRCErr_->Fill(dcc.
fedId());
304 for (
int j=0;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
308 meOptoRX_->Fill(dcc.
fedId(), 0);
312 meOptoRX_->Fill(dcc.
fedId(), 1);
316 meOptoRX_->Fill(dcc.
fedId(), 2);
321 meDCCCRCErr_->Fill(dcc.
fedId(), 0);
322 for (
int j=0;
j<12; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
325 meDCCCRCErr_->Fill(dcc.
fedId(), 1);
326 for (
int j=12;
j<24; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
329 meDCCCRCErr_->Fill(dcc.
fedId(), 2);
330 for (
int j=24;
j<36; ++
j) nDIErr[dcc.
fedId()-520][
j]++;
335 for (
unsigned int i=0;
i<fiberStatus.size(); ++
i) {
336 if (fiberStatus[
i]==4 || fiberStatus[
i]==8 || fiberStatus[
i]==10 || fiberStatus[
i]==11 || fiberStatus[
i]==12) {
337 meFiberBadStatus_->Fill(dcc.
fedId(),
i+1, 1);
338 meFiberErrCode_->Fill(fiberStatus[
i]);
339 nDIErr[dcc.
fedId()-520][
i]++;
341 if (fiberStatus[
i]==7)
342 meFiberOff_->Fill(dcc.
fedId(),
i+1, 1);
343 if (fiberStatus[
i]==6) {
344 meFiberErrCode_->Fill(fiberStatus[
i]);
345 meEVDR_->Fill(dcc.
fedId(), i+1, 1);
355 meGain_->Fill(
gain_);
358 LogWarning(
"ESIntegrityTask") <<
"dccCollections not available";
362 if ( e.
getByToken(kchipCollections_, kchips) ) {
374 LogWarning(
"ESIntegrityTask") <<
"kchipCollections not available";
378 for (
int iz=0; iz<2; ++iz)
379 for (
int ip=0; ip<2; ++ip)
380 for (
int ix=0; ix<40; ++ix)
381 for (
int iy=0; iy<40; ++iy) {
383 if (fed_[iz][ip][ix][iy] == -1)
continue;
385 if (nDIErr[fed_[iz][ip][ix][iy]-520][fiber_[iz][ip][ix][iy]] > 0)
386 meDIErrors_[iz][ip]->Fill(ix+1, iy+1, 1);
396 float nValidChannels=0;
397 float nGlobalErrors=0;
399 for (
int i=0;
i<2; ++
i) {
400 for (
int j=0;
j<2; ++
j) {
401 float nValidChannelsES=0;
402 float nGlobalErrorsES = 0;
403 float reportSummaryES = -1;
404 if (!meDIErrors_[
i][
j])
continue;
405 for (
int x=0;
x<40; ++
x) {
406 for (
int y=0;
y<40; ++
y) {
407 float val = meDIErrors_[
i][
j]->getBinContent(
x+1,
y+1);
408 if (fed_[
i][j][
x][
y] == -1)
continue;
409 if (ievt_ != 0) nGlobalErrors += val/ievt_;
411 if (ievt_ != 0) nGlobalErrorsES += val/ievt_;
415 if (nValidChannelsES != 0) reportSummaryES = 1 - nGlobalErrorsES/nValidChannelsES;
416 meDIFraction_->setBinContent(
i+1, j+1, reportSummaryES);
419 float reportSummary = -1.0;
420 if (nValidChannels != 0) reportSummary = 1.0 - nGlobalErrors/nValidChannels;
421 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
std::vector< ESDCCHeaderBlock >::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.
DEFINE_FWK_MODULE(CaloMETProducer)
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="")