CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EELedTask.cc
Go to the documentation of this file.
1 /*
2  * \file EELedTask.cc
3  *
4  * $Date: 2012/05/15 11:12:27 $
5  * $Revision: 1.73 $
6  * \author G. Della Ricca
7  *
8 */
9 
10 #include <iostream>
11 #include <sstream>
12 #include <vector>
13 
16 
18 
20 
22 
30 
33 
35 
37 
38  init_ = false;
39 
41 
42  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
43 
44  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
45 
46  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
47 
48  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
49  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
50  EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
51  EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection");
52 
53  // vector of enabled wavelengths (Default to all 2)
54  ledWavelengths_.reserve(2);
55  for ( unsigned int i = 1; i <= 2; i++ ) ledWavelengths_.push_back(i);
56  ledWavelengths_ = ps.getUntrackedParameter<std::vector<int> >("ledWavelengths", ledWavelengths_);
57 
58  for (int i = 0; i < 18; i++) {
59  meShapeMapL1_[i] = 0;
60  meAmplMapL1_[i] = 0;
61  meTimeMapL1_[i] = 0;
62  meAmplPNMapL1_[i] = 0;
63  mePnAmplMapG01L1_[i] = 0;
64  mePnPedMapG01L1_[i] = 0;
65  mePnAmplMapG16L1_[i] = 0;
66  mePnPedMapG16L1_[i] = 0;
67 
68  meShapeMapL2_[i] = 0;
69  meAmplMapL2_[i] = 0;
70  meTimeMapL2_[i] = 0;
71  meAmplPNMapL2_[i] = 0;
72  mePnAmplMapG01L2_[i] = 0;
73  mePnPedMapG01L2_[i] = 0;
74  mePnAmplMapG16L2_[i] = 0;
75  mePnPedMapG16L2_[i] = 0;
76  }
77 
78 }
79 
81 
82 }
83 
85 
86  ievt_ = 0;
87 
88  if ( dqmStore_ ) {
89  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
90  dqmStore_->rmdir(prefixME_ + "/EELedTask");
91  }
92 
93 }
94 
96 
97  Numbers::initGeometry(c, false);
98 
99  if ( ! mergeRuns_ ) this->reset();
100 
101 }
102 
104 
105  for (int i = 0; i < 18; i++) {
106  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
107  if ( meShapeMapL1_[i] ) meShapeMapL1_[i]->Reset();
108  if ( meAmplMapL1_[i] ) meAmplMapL1_[i]->Reset();
109  if ( meTimeMapL1_[i] ) meTimeMapL1_[i]->Reset();
110  if ( meAmplPNMapL1_[i] ) meAmplPNMapL1_[i]->Reset();
111  }
112 
113  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
114  if ( meShapeMapL2_[i] ) meShapeMapL2_[i]->Reset();
115  if ( meAmplMapL2_[i] ) meAmplMapL2_[i]->Reset();
116  if ( meTimeMapL2_[i] ) meTimeMapL2_[i]->Reset();
117  if ( meAmplPNMapL2_[i] ) meAmplPNMapL2_[i]->Reset();
118  }
119 
120  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
123 
126  }
127 
128  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
131 
134  }
135  }
136 
137 }
138 
139 void EELedTask::reset(void) {
140 
141 }
142 
143 void EELedTask::setup(void){
144 
145  init_ = true;
146 
147  std::string name;
148  std::stringstream LedN, LN;
149 
150  if ( dqmStore_ ) {
151  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
152 
153  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
154 
155  LedN.str("");
156  LedN << "Led" << 1;
157  LN.str("");
158  LN << "L" << 1;
159 
160  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str());
161  for (int i = 0; i < 18; i++) {
162  name = "EELDT shape " + Numbers::sEE(i+1) + " " + LN.str();
163  meShapeMapL1_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
164  meShapeMapL1_[i]->setAxisTitle("channel", 1);
165  meShapeMapL1_[i]->setAxisTitle("sample", 2);
166  meShapeMapL1_[i]->setAxisTitle("amplitude", 3);
167  dqmStore_->tag(meShapeMapL1_[i], i+1);
168 
169  name = "EELDT amplitude " + Numbers::sEE(i+1) + " " + LN.str();
170  meAmplMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
171  meAmplMapL1_[i]->setAxisTitle("ix", 1);
172  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL1_[i]->setAxisTitle("101-ix", 1);
173  meAmplMapL1_[i]->setAxisTitle("iy", 2);
174  dqmStore_->tag(meAmplMapL1_[i], i+1);
175 
176  name = "EELDT timing " + Numbers::sEE(i+1) + " " + LN.str();
177  meTimeMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
178  meTimeMapL1_[i]->setAxisTitle("ix", 1);
179  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL1_[i]->setAxisTitle("101-ix", 1);
180  meTimeMapL1_[i]->setAxisTitle("iy", 2);
181  dqmStore_->tag(meTimeMapL1_[i], i+1);
182 
183  name = "EELDT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
184  meAmplPNMapL1_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
185  meAmplPNMapL1_[i]->setAxisTitle("ix", 1);
186  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL1_[i]->setAxisTitle("101-ix", 1);
187  meAmplPNMapL1_[i]->setAxisTitle("iy", 2);
188  dqmStore_->tag(meAmplPNMapL1_[i], i+1);
189  }
190 
191  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN");
192 
193  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain01");
194  for (int i = 0; i < 18; i++) {
195  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str();
196  mePnAmplMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
197  mePnAmplMapG01L1_[i]->setAxisTitle("channel", 1);
198  mePnAmplMapG01L1_[i]->setAxisTitle("amplitude", 2);
200 
201  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str();
202  mePnPedMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
203  mePnPedMapG01L1_[i]->setAxisTitle("channel", 1);
204  mePnPedMapG01L1_[i]->setAxisTitle("pedestal", 2);
205  dqmStore_->tag(mePnPedMapG01L1_[i], i+1);
206  }
207 
208  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain16");
209 
210  for (int i = 0; i < 18; i++) {
211  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
212  mePnAmplMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
213  mePnAmplMapG16L1_[i]->setAxisTitle("channel", 1);
214  mePnAmplMapG16L1_[i]->setAxisTitle("amplitude", 2);
216 
217  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
218  mePnPedMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
219  mePnPedMapG16L1_[i]->setAxisTitle("channel", 1);
220  mePnPedMapG16L1_[i]->setAxisTitle("pedestal", 2);
221  dqmStore_->tag(mePnPedMapG16L1_[i], i+1);
222  }
223 
224  }
225 
226  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
227 
228  LedN.str("");
229  LedN << "Led" << 2;
230  LN.str("");
231  LN << "L" << 2;
232 
233  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str());
234  for (int i = 0; i < 18; i++) {
235  name = "EELDT shape " + Numbers::sEE(i+1) + " " + LN.str();
236  meShapeMapL2_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
237  meShapeMapL2_[i]->setAxisTitle("channel", 1);
238  meShapeMapL2_[i]->setAxisTitle("sample", 2);
239  meShapeMapL2_[i]->setAxisTitle("amplitude", 3);
240  dqmStore_->tag(meShapeMapL2_[i], i+1);
241 
242  name = "EELDT amplitude " + Numbers::sEE(i+1) + " " + LN.str();
243  meAmplMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
244  meAmplMapL2_[i]->setAxisTitle("ix", 1);
245  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL2_[i]->setAxisTitle("101-ix", 1);
246  meAmplMapL2_[i]->setAxisTitle("iy", 2);
247  dqmStore_->tag(meAmplMapL2_[i], i+1);
248 
249  name = "EELDT timing " + Numbers::sEE(i+1) + " " + LN.str();
250  meTimeMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
251  meTimeMapL2_[i]->setAxisTitle("ix", 1);
252  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL2_[i]->setAxisTitle("101-ix", 1);
253  meTimeMapL2_[i]->setAxisTitle("iy", 2);
254  dqmStore_->tag(meTimeMapL2_[i], i+1);
255 
256  name = "EELDT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
257  meAmplPNMapL2_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
258  meAmplPNMapL2_[i]->setAxisTitle("ix", 1);
259  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL2_[i]->setAxisTitle("101-ix", 1);
260  meAmplPNMapL2_[i]->setAxisTitle("iy", 2);
261  dqmStore_->tag(meAmplPNMapL2_[i], i+1);
262  }
263 
264  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN");
265 
266  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain01");
267  for (int i = 0; i < 18; i++) {
268  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str();
269  mePnAmplMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
270  mePnAmplMapG01L2_[i]->setAxisTitle("channel", 1);
271  mePnAmplMapG01L2_[i]->setAxisTitle("amplitude", 2);
273 
274  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str();
275  mePnPedMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
276  mePnPedMapG01L2_[i]->setAxisTitle("channel", 1);
277  mePnPedMapG01L2_[i]->setAxisTitle("pedestal", 2);
278  dqmStore_->tag(mePnPedMapG01L2_[i], i+1);
279  }
280 
281  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain16");
282 
283  for (int i = 0; i < 18; i++) {
284  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
285  mePnAmplMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
286  mePnAmplMapG16L2_[i]->setAxisTitle("channel", 1);
287  mePnAmplMapG16L2_[i]->setAxisTitle("amplitude", 2);
289 
290  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
291  mePnPedMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
292  mePnPedMapG16L2_[i]->setAxisTitle("channel", 1);
293  mePnPedMapG16L2_[i]->setAxisTitle("pedestal", 2);
294  dqmStore_->tag(mePnPedMapG16L2_[i], i+1);
295  }
296 
297  }
298 
299  }
300 
301 }
302 
304 
305  if ( ! init_ ) return;
306 
307  if ( dqmStore_ ) {
308  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
309 
310  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
311 
312  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
313  for (int i = 0; i < 18; i++) {
315  meShapeMapL1_[i] = 0;
317  meAmplMapL1_[i] = 0;
319  meTimeMapL1_[i] = 0;
321  meAmplPNMapL1_[i] = 0;
322  }
323 
324  }
325 
326  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
327 
328  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
329  for (int i = 0; i < 18; i++) {
331  meShapeMapL2_[i] = 0;
333  meAmplMapL2_[i] = 0;
335  meTimeMapL2_[i] = 0;
337  meAmplPNMapL2_[i] = 0;
338  }
339 
340  }
341 
342  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
343 
344  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
345 
346  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
347  for (int i = 0; i < 18; i++) {
349  mePnAmplMapG01L1_[i] = 0;
351  mePnPedMapG01L1_[i] = 0;
352  }
353 
354  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
355  for (int i = 0; i < 18; i++) {
357  mePnAmplMapG16L1_[i] = 0;
359  mePnPedMapG16L1_[i] = 0;
360  }
361 
362  }
363 
364  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
365 
366  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
367 
368  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
369  for (int i = 0; i < 18; i++) {
371  mePnAmplMapG01L2_[i] = 0;
373  mePnPedMapG01L2_[i] = 0;
374  }
375 
376  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
377  for (int i = 0; i < 18; i++) {
379  mePnAmplMapG16L2_[i] = 0;
381  mePnPedMapG16L2_[i] = 0;
382  }
383 
384  }
385 
386  }
387 
388  init_ = false;
389 
390 }
391 
392 void EELedTask::endJob(void){
393 
394  edm::LogInfo("EELedTask") << "analyzed " << ievt_ << " events";
395 
396  if ( enableCleanup_ ) this->cleanup();
397 
398 }
399 
401 
402  bool enable = false;
403  int runType[18];
404  for (int i=0; i<18; i++) runType[i] = -1;
405  unsigned rtHalf[18];
406  for (int i=0; i<18; i++) rtHalf[i] = -1;
407  int waveLength[18];
408  for (int i=0; i<18; i++) waveLength[i] = -1;
409 
411 
412  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
413 
414  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
415 
416  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
417 
418  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
419 
420  runType[ism-1] = dcchItr->getRunType();
421  rtHalf[ism-1] = dcchItr->getRtHalf();
422  waveLength[ism-1] = dcchItr->getEventSettings().wavelength;
423 
424  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LED_STD ||
425  dcchItr->getRunType() == EcalDCCHeaderBlock::LED_GAP ) enable = true;
426 
427  }
428 
429  } else {
430 
431  edm::LogWarning("EELedTask") << EcalRawDataCollection_ << " not available";
432 
433  }
434 
435  if ( ! enable ) return;
436 
437  if ( ! init_ ) this->setup();
438 
439  ievt_++;
440 
441  bool numPN[80];
442  float adcPN[80];
443  for ( int i = 0; i < 80; i++ ) {
444  numPN[i] = false;
445  adcPN[i] = 0.;
446  }
447 
448  std::vector<int> PNs;
449  PNs.reserve(12);
450 
452 
453  if ( e.getByLabel(EEDigiCollection_, digis) ) {
454 
455  int maxpos[10];
456  for(int i(0); i < 10; i++)
457  maxpos[i] = 0;
458  int nReadouts(0);
459 
460  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
461 
462  EEDetId id = digiItr->id();
463 
464  int ism = Numbers::iSM( id );
465 
466  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
467  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
468 
469  if ( rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
470 
471  nReadouts++;
472 
473  EEDataFrame dataframe = (*digiItr);
474 
475  int iMax(-1);
476  float max(0.);
477  float min(4096.);
478  for (int i = 0; i < 10; i++) {
479  int adc = dataframe.sample(i).adc();
480  if(adc > max){
481  max = adc;
482  iMax = i;
483  }
484  if(adc < min)
485  min = adc;
486  }
487  if(iMax >= 0 && max - min > 20.)
488  maxpos[iMax] += 1;
489 
490  }
491 
492  int threshold(nReadouts / 2);
493  enable = false;
494  for(int i(0); i < 10; i++){
495  if(maxpos[i] > threshold){
496  enable = true;
497  break;
498  }
499  }
500 
501  if(!enable) return;
502 
503  int need = digis->size();
504  LogDebug("EELedTask") << "event " << ievt_ << " digi collection size " << need;
505 
506  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
507 
508  EEDetId id = digiItr->id();
509 
510  int ix = id.ix();
511  int iy = id.iy();
512 
513  int ism = Numbers::iSM( id );
514 
515  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
516  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
517 
518  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
519  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
520 
521  int ic = Numbers::icEE(ism, ix, iy);
522 
523  EEDataFrame dataframe = (*digiItr);
524 
525  for (int i = 0; i < 10; i++) {
526 
527  int adc = dataframe.sample(i).adc();
528 
529  MonitorElement* meShapeMap = 0;
530 
531  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
532 
533  if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1_[ism-1];
534  if ( waveLength[ism-1] == 2 ) meShapeMap = meShapeMapL2_[ism-1];
535 
536  } else {
537 
538  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
539 
540  }
541 
542  float xval = float(adc);
543 
544  if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
545 
546  }
547 
548  NumbersPn::getPNs( ism, ix, iy, PNs );
549 
550  for (unsigned int i=0; i<PNs.size(); i++) {
551  int ipn = PNs[i];
552  if ( ipn >= 0 && ipn < 80 ) numPN[ipn] = true;
553  }
554 
555  }
556 
557  } else {
558 
559  edm::LogWarning("EELedTask") << EEDigiCollection_ << " not available";
560 
561  }
562 
564 
565  if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
566 
567  int nep = pns->size();
568  LogDebug("EELedTask") << "event " << ievt_ << " pns collection size " << nep;
569 
570  for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
571 
572  if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
573 
574  int ism = Numbers::iSM( pnItr->id() );
575 
576  int num = pnItr->id().iPnId();
577 
578  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
579  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
580 
581  int ipn = NumbersPn::ipnEE( ism, num );
582 
583  if ( ipn >= 0 && ipn < 80 && numPN[ipn] == false ) continue;
584 
585  float xvalped = 0.;
586 
587  for (int i = 0; i < 4; i++) {
588 
589  int adc = pnItr->sample(i).adc();
590 
591  MonitorElement* mePNPed = 0;
592 
593  if ( pnItr->sample(i).gainId() == 0 ) {
594  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG01L1_[ism-1];
595  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG01L2_[ism-1];
596  }
597  if ( pnItr->sample(i).gainId() == 1 ) {
598  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG16L1_[ism-1];
599  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG16L2_[ism-1];
600  }
601 
602  float xval = float(adc);
603 
604  if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
605 
606  xvalped = xvalped + xval;
607 
608  }
609 
610  xvalped = xvalped / 4;
611 
612  float xvalmax = 0.;
613 
614  MonitorElement* mePN = 0;
615 
616  for (int i = 0; i < 50; i++) {
617 
618  int adc = pnItr->sample(i).adc();
619 
620  float xval = float(adc);
621 
622  if ( xval >= xvalmax ) xvalmax = xval;
623 
624  }
625 
626  xvalmax = xvalmax - xvalped;
627 
628  if ( pnItr->sample(0).gainId() == 0 ) {
629  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG01L1_[ism-1];
630  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG01L2_[ism-1];
631  }
632  if ( pnItr->sample(0).gainId() == 1 ) {
633  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG16L1_[ism-1];
634  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG16L2_[ism-1];
635  }
636 
637  if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
638 
639  if ( ipn >= 0 && ipn < 80 ) adcPN[ipn] = xvalmax;
640 
641  }
642 
643  } else {
644 
645  edm::LogWarning("EELedTask") << EcalPnDiodeDigiCollection_ << " not available";
646 
647  }
648 
650 
652 
653  int neh = hits->size();
654  LogDebug("EELedTask") << "event " << ievt_ << " hits collection size " << neh;
655 
656  for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
657 
658  EEDetId id = hitItr->id();
659 
660  int ix = id.ix();
661  int iy = id.iy();
662 
663  int ism = Numbers::iSM( id );
664 
665  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
666 
667  float xix = ix - 0.5;
668  float xiy = iy - 0.5;
669 
670  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
671  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
672 
673  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
674  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
675 
676  MonitorElement* meAmplMap = 0;
677  MonitorElement* meTimeMap = 0;
678  MonitorElement* meAmplPNMap = 0;
679 
680  // Temporary measure to remove broken LED boxes for L1
681  if(waveLength[ism - 1] == 0){
682  if(ism == 14){
683  EcalElectronicsId eid(Numbers::getElectronicsMapping()->getElectronicsId(id));
684  int tower(eid.towerId());
685  if(tower == 1 || tower == 2 || tower == 3 || tower == 4 || tower == 5 || tower == 6 || tower == 9 || tower == 15) continue;
686  }
687  else if(ism == 15){
688  EcalElectronicsId eid(Numbers::getElectronicsMapping()->getElectronicsId(id));
689  int tower(eid.towerId());
690  if(tower == 3 || tower == 4 || tower == 10 || tower == 11 || tower == 12 || tower == 18 || tower == 19 || tower == 25) continue;
691  }
692  }
693 
694  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
695 
696  if ( waveLength[ism-1] == 0 ) {
697  meAmplMap = meAmplMapL1_[ism-1];
698  meTimeMap = meTimeMapL1_[ism-1];
699  meAmplPNMap = meAmplPNMapL1_[ism-1];
700  }
701  if ( waveLength[ism-1] == 2 ) {
702  meAmplMap = meAmplMapL2_[ism-1];
703  meTimeMap = meTimeMapL2_[ism-1];
704  meAmplPNMap = meAmplPNMapL2_[ism-1];
705  }
706 
707  } else {
708 
709  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
710 
711  }
712 
713  float xval = hitItr->amplitude();
714  if ( xval <= 0. ) xval = 0.0;
715  float yval = hitItr->jitter() + 6.0;
716  if ( yval <= 0. ) yval = 0.0;
717  float zval = hitItr->pedestal();
718  if ( zval <= 0. ) zval = 0.0;
719 
720  if ( meAmplMap ) meAmplMap->Fill(xix, xiy, xval);
721 
722  if ( xval > 16. ) {
723  if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval);
724  }
725 
726  float wval = 0.;
727 
728  NumbersPn::getPNs( ism, ix, iy, PNs );
729 
730  if ( PNs.size() > 0 ) {
731  int ipn = PNs[0];
732  if ( ipn >= 0 && ipn < 80 ) {
733  if ( adcPN[ipn] != 0. ) wval = xval / adcPN[ipn];
734  }
735  }
736 
737  if ( meAmplPNMap ) meAmplPNMap->Fill(xix, xiy, wval);
738 
739  }
740 
741  } else {
742 
743  edm::LogWarning("EELedTask") << EcalUncalibratedRecHitCollection_ << " not available";
744 
745  }
746 
747 }
748 
#define LogDebug(id)
int adc(sample_type sample)
get the ADC sample (12 bits)
Some &quot;id&quot; conversions.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
static int ipnEE(const int ism, const int ipnid)
Definition: NumbersPn.cc:21
int ix() const
Definition: EEDetId.h:71
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
MonitorElement * mePnPedMapG01L2_[18]
Definition: EELedTask.h:88
static unsigned icEE(const unsigned ism, const unsigned ix, const unsigned iy)
Definition: Numbers.cc:739
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
Some &quot;id&quot; conversions.
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
Definition: EELedTask.cc:95
edm::InputTag EcalUncalibratedRecHitCollection_
Definition: EELedTask.h:71
std::vector< T >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:30
MonitorElement * meAmplPNMapL2_[18]
Definition: EELedTask.h:86
MonitorElement * mePnAmplMapG01L2_[18]
Definition: EELedTask.h:87
int towerId() const
get the tower id
#define min(a, b)
Definition: mlp_lapack.h:161
MonitorElement * meAmplPNMapL1_[18]
Definition: EELedTask.h:77
static int ix0EE(const unsigned ism)
Definition: Numbers.cc:773
static const EcalElectronicsMapping * getElectronicsMapping()
Definition: Numbers.cc:919
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
void beginJob(void)
BeginJob.
Definition: EELedTask.cc:84
bool mergeRuns_
Definition: EELedTask.h:66
static int iy0EE(const unsigned ism)
Definition: Numbers.cc:812
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
Definition: EELedTask.cc:103
void Fill(long long x)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
MonitorElement * mePnPedMapG01L1_[18]
Definition: EELedTask.h:79
MonitorElement * meTimeMapL1_[18]
Definition: EELedTask.h:76
const T & max(const T &a, const T &b)
std::vector< int > ledWavelengths_
Definition: EELedTask.h:72
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Definition: EELedTask.cc:400
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
void setup(void)
Setup.
Definition: EELedTask.cc:143
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * meAmplMapL1_[18]
Definition: EELedTask.h:75
MonitorElement * meShapeMapL1_[18]
Definition: EELedTask.h:74
MonitorElement * mePnAmplMapG16L1_[18]
Definition: EELedTask.h:80
void cleanup(void)
Cleanup.
Definition: EELedTask.cc:303
MonitorElement * meTimeMapL2_[18]
Definition: EELedTask.h:85
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
std::string prefixME_
Definition: EELedTask.h:62
MonitorElement * meShapeMapL2_[18]
Definition: EELedTask.h:83
long long int num
Definition: procUtils.cc:71
edm::InputTag EEDigiCollection_
Definition: EELedTask.h:69
void endJob(void)
EndJob.
Definition: EELedTask.cc:392
MonitorElement * mePnPedMapG16L2_[18]
Definition: EELedTask.h:90
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
MonitorElement * meAmplMapL2_[18]
Definition: EELedTask.h:84
bool init_
Definition: EELedTask.h:92
MonitorElement * mePnAmplMapG01L1_[18]
Definition: EELedTask.h:78
static void getPNs(const int ism, const int ix, const int iy, std::vector< int > &PNsInLM)
Definition: NumbersPn.cc:51
static unsigned RtHalf(const EBDetId &id)
Definition: Numbers.cc:608
bool enableCleanup_
Definition: EELedTask.h:64
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
DQMStore * dqmStore_
Definition: EELedTask.h:60
EELedTask(const edm::ParameterSet &ps)
Constructor.
Definition: EELedTask.cc:36
void reset(void)
Reset.
Definition: EELedTask.cc:139
edm::InputTag EcalPnDiodeDigiCollection_
Definition: EELedTask.h:70
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
virtual ~EELedTask()
Destructor.
Definition: EELedTask.cc:80
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
edm::InputTag EcalRawDataCollection_
Definition: EELedTask.h:68
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
int adc() const
get the ADC sample (12 bits)
MonitorElement * mePnPedMapG16L1_[18]
Definition: EELedTask.h:81
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175
MonitorElement * mePnAmplMapG16L2_[18]
Definition: EELedTask.h:89
int ievt_
Definition: EELedTask.h:58