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: 2010/08/08 08:46:09 $
5  * $Revision: 1.65 $
6  * \author G. Della Ricca
7  *
8 */
9 
10 #include <iostream>
11 #include <sstream>
12 #include <vector>
13 
16 
18 
20 
27 
30 
32 
34 
35  init_ = false;
36 
38 
39  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
40 
41  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
42 
43  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
44 
45  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
46  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
47  EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
48  EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection");
49 
50  // vector of enabled wavelengths (Default to all 2)
51  ledWavelengths_.reserve(2);
52  for ( unsigned int i = 1; i <= 2; i++ ) ledWavelengths_.push_back(i);
53  ledWavelengths_ = ps.getUntrackedParameter<std::vector<int> >("ledWavelengths", ledWavelengths_);
54 
55  for (int i = 0; i < 18; i++) {
56  meShapeMapL1_[i] = 0;
57  meAmplMapL1_[i] = 0;
58  meTimeMapL1_[i] = 0;
59  meAmplPNMapL1_[i] = 0;
60  mePnAmplMapG01L1_[i] = 0;
61  mePnPedMapG01L1_[i] = 0;
62  mePnAmplMapG16L1_[i] = 0;
63  mePnPedMapG16L1_[i] = 0;
64 
65  meShapeMapL2_[i] = 0;
66  meAmplMapL2_[i] = 0;
67  meTimeMapL2_[i] = 0;
68  meAmplPNMapL2_[i] = 0;
69  mePnAmplMapG01L2_[i] = 0;
70  mePnPedMapG01L2_[i] = 0;
71  mePnAmplMapG16L2_[i] = 0;
72  mePnPedMapG16L2_[i] = 0;
73  }
74 
75 }
76 
78 
79 }
80 
82 
83  ievt_ = 0;
84 
85  if ( dqmStore_ ) {
86  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
87  dqmStore_->rmdir(prefixME_ + "/EELedTask");
88  }
89 
90 }
91 
93 
94  Numbers::initGeometry(c, false);
95 
96  if ( ! mergeRuns_ ) this->reset();
97 
98 }
99 
101 
102  for (int i = 0; i < 18; i++) {
103  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
104  if ( meShapeMapL1_[i] ) meShapeMapL1_[i]->Reset();
105  if ( meAmplMapL1_[i] ) meAmplMapL1_[i]->Reset();
106  if ( meTimeMapL1_[i] ) meTimeMapL1_[i]->Reset();
107  if ( meAmplPNMapL1_[i] ) meAmplPNMapL1_[i]->Reset();
108  }
109 
110  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
111  if ( meShapeMapL2_[i] ) meShapeMapL2_[i]->Reset();
112  if ( meAmplMapL2_[i] ) meAmplMapL2_[i]->Reset();
113  if ( meTimeMapL2_[i] ) meTimeMapL2_[i]->Reset();
114  if ( meAmplPNMapL2_[i] ) meAmplPNMapL2_[i]->Reset();
115  }
116 
117  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
120 
123  }
124 
125  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
128 
131  }
132  }
133 
134 }
135 
136 void EELedTask::reset(void) {
137 
138 }
139 
140 void EELedTask::setup(void){
141 
142  init_ = true;
143 
144  std::string name;
145  std::stringstream LedN, LN;
146 
147  if ( dqmStore_ ) {
148  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
149 
150  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
151 
152  LedN.str("");
153  LedN << "Led" << 1;
154  LN.str("");
155  LN << "L" << 1;
156 
157  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str());
158  for (int i = 0; i < 18; i++) {
159  name = "EELDT shape " + Numbers::sEE(i+1) + " " + LN.str();
160  meShapeMapL1_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
161  meShapeMapL1_[i]->setAxisTitle("channel", 1);
162  meShapeMapL1_[i]->setAxisTitle("sample", 2);
163  meShapeMapL1_[i]->setAxisTitle("amplitude", 3);
164  dqmStore_->tag(meShapeMapL1_[i], i+1);
165 
166  name = "EELDT amplitude " + Numbers::sEE(i+1) + " " + LN.str();
167  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");
168  meAmplMapL1_[i]->setAxisTitle("ix", 1);
169  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL1_[i]->setAxisTitle("101-ix", 1);
170  meAmplMapL1_[i]->setAxisTitle("iy", 2);
171  dqmStore_->tag(meAmplMapL1_[i], i+1);
172 
173  name = "EELDT timing " + Numbers::sEE(i+1) + " " + LN.str();
174  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");
175  meTimeMapL1_[i]->setAxisTitle("ix", 1);
176  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL1_[i]->setAxisTitle("101-ix", 1);
177  meTimeMapL1_[i]->setAxisTitle("iy", 2);
178  dqmStore_->tag(meTimeMapL1_[i], i+1);
179 
180  name = "EELDT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
181  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");
182  meAmplPNMapL1_[i]->setAxisTitle("ix", 1);
183  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL1_[i]->setAxisTitle("101-ix", 1);
184  meAmplPNMapL1_[i]->setAxisTitle("iy", 2);
185  dqmStore_->tag(meAmplPNMapL1_[i], i+1);
186  }
187 
188  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN");
189 
190  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain01");
191  for (int i = 0; i < 18; i++) {
192  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str();
193  mePnAmplMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
194  mePnAmplMapG01L1_[i]->setAxisTitle("channel", 1);
195  mePnAmplMapG01L1_[i]->setAxisTitle("amplitude", 2);
197 
198  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str();
199  mePnPedMapG01L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
200  mePnPedMapG01L1_[i]->setAxisTitle("channel", 1);
201  mePnPedMapG01L1_[i]->setAxisTitle("pedestal", 2);
202  dqmStore_->tag(mePnPedMapG01L1_[i], i+1);
203  }
204 
205  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain16");
206 
207  for (int i = 0; i < 18; i++) {
208  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
209  mePnAmplMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
210  mePnAmplMapG16L1_[i]->setAxisTitle("channel", 1);
211  mePnAmplMapG16L1_[i]->setAxisTitle("amplitude", 2);
213 
214  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
215  mePnPedMapG16L1_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
216  mePnPedMapG16L1_[i]->setAxisTitle("channel", 1);
217  mePnPedMapG16L1_[i]->setAxisTitle("pedestal", 2);
218  dqmStore_->tag(mePnPedMapG16L1_[i], i+1);
219  }
220 
221  }
222 
223  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
224 
225  LedN.str("");
226  LedN << "Led" << 2;
227  LN.str("");
228  LN << "L" << 2;
229 
230  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str());
231  for (int i = 0; i < 18; i++) {
232  name = "EELDT shape " + Numbers::sEE(i+1) + " " + LN.str();
233  meShapeMapL2_[i] = dqmStore_->bookProfile2D(name, name, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
234  meShapeMapL2_[i]->setAxisTitle("channel", 1);
235  meShapeMapL2_[i]->setAxisTitle("sample", 2);
236  meShapeMapL2_[i]->setAxisTitle("amplitude", 3);
237  dqmStore_->tag(meShapeMapL2_[i], i+1);
238 
239  name = "EELDT amplitude " + Numbers::sEE(i+1) + " " + LN.str();
240  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");
241  meAmplMapL2_[i]->setAxisTitle("ix", 1);
242  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL2_[i]->setAxisTitle("101-ix", 1);
243  meAmplMapL2_[i]->setAxisTitle("iy", 2);
244  dqmStore_->tag(meAmplMapL2_[i], i+1);
245 
246  name = "EELDT timing " + Numbers::sEE(i+1) + " " + LN.str();
247  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");
248  meTimeMapL2_[i]->setAxisTitle("ix", 1);
249  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL2_[i]->setAxisTitle("101-ix", 1);
250  meTimeMapL2_[i]->setAxisTitle("iy", 2);
251  dqmStore_->tag(meTimeMapL2_[i], i+1);
252 
253  name = "EELDT amplitude over PN " + Numbers::sEE(i+1) + " " + LN.str();
254  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");
255  meAmplPNMapL2_[i]->setAxisTitle("ix", 1);
256  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL2_[i]->setAxisTitle("101-ix", 1);
257  meAmplPNMapL2_[i]->setAxisTitle("iy", 2);
258  dqmStore_->tag(meAmplPNMapL2_[i], i+1);
259  }
260 
261  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN");
262 
263  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain01");
264  for (int i = 0; i < 18; i++) {
265  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G01 " + LN.str();
266  mePnAmplMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
267  mePnAmplMapG01L2_[i]->setAxisTitle("channel", 1);
268  mePnAmplMapG01L2_[i]->setAxisTitle("amplitude", 2);
270 
271  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G01 " + LN.str();
272  mePnPedMapG01L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
273  mePnPedMapG01L2_[i]->setAxisTitle("channel", 1);
274  mePnPedMapG01L2_[i]->setAxisTitle("pedestal", 2);
275  dqmStore_->tag(mePnPedMapG01L2_[i], i+1);
276  }
277 
278  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/" + LedN.str() + "/PN/Gain16");
279 
280  for (int i = 0; i < 18; i++) {
281  name = "EELDT PNs amplitude " + Numbers::sEE(i+1) + " G16 " + LN.str();
282  mePnAmplMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
283  mePnAmplMapG16L2_[i]->setAxisTitle("channel", 1);
284  mePnAmplMapG16L2_[i]->setAxisTitle("amplitude", 2);
286 
287  name = "EELDT PNs pedestal " + Numbers::sEE(i+1) + " G16 " + LN.str();
288  mePnPedMapG16L2_[i] = dqmStore_->bookProfile(name, name, 10, 0., 10., 4096, 0., 4096., "s");
289  mePnPedMapG16L2_[i]->setAxisTitle("channel", 1);
290  mePnPedMapG16L2_[i]->setAxisTitle("pedestal", 2);
291  dqmStore_->tag(mePnPedMapG16L2_[i], i+1);
292  }
293 
294  }
295 
296  }
297 
298 }
299 
301 
302  if ( ! init_ ) return;
303 
304  if ( dqmStore_ ) {
305  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
306 
307  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
308 
309  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
310  for (int i = 0; i < 18; i++) {
312  meShapeMapL1_[i] = 0;
314  meAmplMapL1_[i] = 0;
316  meTimeMapL1_[i] = 0;
318  meAmplPNMapL1_[i] = 0;
319  }
320 
321  }
322 
323  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
324 
325  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
326  for (int i = 0; i < 18; i++) {
328  meShapeMapL2_[i] = 0;
330  meAmplMapL2_[i] = 0;
332  meTimeMapL2_[i] = 0;
334  meAmplPNMapL2_[i] = 0;
335  }
336 
337  }
338 
339  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
340 
341  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
342 
343  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
344  for (int i = 0; i < 18; i++) {
346  mePnAmplMapG01L1_[i] = 0;
348  mePnPedMapG01L1_[i] = 0;
349  }
350 
351  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
352  for (int i = 0; i < 18; i++) {
354  mePnAmplMapG16L1_[i] = 0;
356  mePnPedMapG16L1_[i] = 0;
357  }
358 
359  }
360 
361  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
362 
363  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
364 
365  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
366  for (int i = 0; i < 18; i++) {
368  mePnAmplMapG01L2_[i] = 0;
370  mePnPedMapG01L2_[i] = 0;
371  }
372 
373  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
374  for (int i = 0; i < 18; i++) {
376  mePnAmplMapG16L2_[i] = 0;
378  mePnPedMapG16L2_[i] = 0;
379  }
380 
381  }
382 
383  }
384 
385  init_ = false;
386 
387 }
388 
389 void EELedTask::endJob(void){
390 
391  edm::LogInfo("EELedTask") << "analyzed " << ievt_ << " events";
392 
393  if ( enableCleanup_ ) this->cleanup();
394 
395 }
396 
398 
399  bool enable = false;
400  int runType[18];
401  for (int i=0; i<18; i++) runType[i] = -1;
402  int rtHalf[18];
403  for (int i=0; i<18; i++) rtHalf[i] = -1;
404  int waveLength[18];
405  for (int i=0; i<18; i++) waveLength[i] = -1;
406 
408 
409  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
410 
411  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
412 
413  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
414 
415  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
416 
417  runType[ism-1] = dcchItr->getRunType();
418  rtHalf[ism-1] = dcchItr->getRtHalf();
419  waveLength[ism-1] = dcchItr->getEventSettings().wavelength;
420 
421  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LED_STD ||
422  dcchItr->getRunType() == EcalDCCHeaderBlock::LED_GAP ) enable = true;
423 
424  }
425 
426  } else {
427 
428  edm::LogWarning("EELedTask") << EcalRawDataCollection_ << " not available";
429 
430  }
431 
432  if ( ! enable ) return;
433 
434  if ( ! init_ ) this->setup();
435 
436  ievt_++;
437 
438  bool numPN[80];
439  float adcPN[80];
440  for ( int i = 0; i < 80; i++ ) {
441  numPN[i] = false;
442  adcPN[i] = 0.;
443  }
444 
445  std::vector<int> PNs;
446  PNs.reserve(12);
447 
449 
450  if ( e.getByLabel(EEDigiCollection_, digis) ) {
451 
452  int need = digis->size();
453  LogDebug("EELedTask") << "event " << ievt_ << " digi collection size " << need;
454 
455  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
456 
457  EEDetId id = digiItr->id();
458 
459  int ix = id.ix();
460  int iy = id.iy();
461 
462  int ism = Numbers::iSM( id );
463 
464  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
465  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
466 
467  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
468  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
469 
470  int ic = Numbers::icEE(ism, ix, iy);
471 
472  EEDataFrame dataframe = (*digiItr);
473 
474  for (int i = 0; i < 10; i++) {
475 
476  int adc = dataframe.sample(i).adc();
477  float gain = 1.;
478 
479  MonitorElement* meShapeMap = 0;
480 
481  if ( dataframe.sample(i).gainId() == 1 ) gain = 1./12.;
482  if ( dataframe.sample(i).gainId() == 2 ) gain = 1./ 6.;
483  if ( dataframe.sample(i).gainId() == 3 ) gain = 1./ 1.;
484 
485  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
486 
487  if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1_[ism-1];
488  if ( waveLength[ism-1] == 2 ) meShapeMap = meShapeMapL2_[ism-1];
489 
490  } else {
491 
492  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
493 
494  }
495 
496 // float xval = float(adc) * gain;
497  float xval = float(adc);
498 
499  if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
500 
501  }
502 
503  NumbersPn::getPNs( ism, ix, iy, PNs );
504 
505  for (unsigned int i=0; i<PNs.size(); i++) {
506  int ipn = PNs[i];
507  if ( ipn >= 0 && ipn < 80 ) numPN[ipn] = true;
508  }
509 
510  }
511 
512  } else {
513 
514  edm::LogWarning("EELedTask") << EEDigiCollection_ << " not available";
515 
516  }
517 
519 
520  if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
521 
522  int nep = pns->size();
523  LogDebug("EELedTask") << "event " << ievt_ << " pns collection size " << nep;
524 
525  for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
526 
527  if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
528 
529  int ism = Numbers::iSM( pnItr->id() );
530 
531  int num = pnItr->id().iPnId();
532 
533  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
534  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
535 
536  int ipn = NumbersPn::ipnEE( ism, num );
537 
538  if ( ipn >= 0 && ipn < 80 && numPN[ipn] == false ) continue;
539 
540  float xvalped = 0.;
541 
542  for (int i = 0; i < 4; i++) {
543 
544  int adc = pnItr->sample(i).adc();
545 
546  MonitorElement* mePNPed = 0;
547 
548  if ( pnItr->sample(i).gainId() == 0 ) {
549  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG01L1_[ism-1];
550  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG01L2_[ism-1];
551  }
552  if ( pnItr->sample(i).gainId() == 1 ) {
553  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG16L1_[ism-1];
554  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG16L2_[ism-1];
555  }
556 
557  float xval = float(adc);
558 
559  if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
560 
561  xvalped = xvalped + xval;
562 
563  }
564 
565  xvalped = xvalped / 4;
566 
567  float xvalmax = 0.;
568 
569  MonitorElement* mePN = 0;
570 
571  for (int i = 0; i < 50; i++) {
572 
573  int adc = pnItr->sample(i).adc();
574 
575  float xval = float(adc);
576 
577  if ( xval >= xvalmax ) xvalmax = xval;
578 
579  }
580 
581  xvalmax = xvalmax - xvalped;
582 
583  if ( pnItr->sample(0).gainId() == 0 ) {
584  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG01L1_[ism-1];
585  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG01L2_[ism-1];
586  }
587  if ( pnItr->sample(0).gainId() == 1 ) {
588  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG16L1_[ism-1];
589  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG16L2_[ism-1];
590  }
591 
592  if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
593 
594  if ( ipn >= 0 && ipn < 80 ) adcPN[ipn] = xvalmax;
595 
596  }
597 
598  } else {
599 
600  edm::LogWarning("EELedTask") << EcalPnDiodeDigiCollection_ << " not available";
601 
602  }
603 
605 
607 
608  int neh = hits->size();
609  LogDebug("EELedTask") << "event " << ievt_ << " hits collection size " << neh;
610 
611  for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
612 
613  EEDetId id = hitItr->id();
614 
615  int ix = id.ix();
616  int iy = id.iy();
617 
618  int ism = Numbers::iSM( id );
619 
620  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
621 
622  float xix = ix - 0.5;
623  float xiy = iy - 0.5;
624 
625  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
626  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
627 
628  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
629  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
630 
631  MonitorElement* meAmplMap = 0;
632  MonitorElement* meTimeMap = 0;
633  MonitorElement* meAmplPNMap = 0;
634 
635  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
636 
637  if ( waveLength[ism-1] == 0 ) {
638  meAmplMap = meAmplMapL1_[ism-1];
639  meTimeMap = meTimeMapL1_[ism-1];
640  meAmplPNMap = meAmplPNMapL1_[ism-1];
641  }
642  if ( waveLength[ism-1] == 2 ) {
643  meAmplMap = meAmplMapL2_[ism-1];
644  meTimeMap = meTimeMapL2_[ism-1];
645  meAmplPNMap = meAmplPNMapL2_[ism-1];
646  }
647 
648  } else {
649 
650  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
651 
652  }
653 
654  float xval = hitItr->amplitude();
655  if ( xval <= 0. ) xval = 0.0;
656  float yval = hitItr->jitter() + 6.0;
657  if ( yval <= 0. ) yval = 0.0;
658  float zval = hitItr->pedestal();
659  if ( zval <= 0. ) zval = 0.0;
660 
661  if ( meAmplMap ) meAmplMap->Fill(xix, xiy, xval);
662 
663  if ( xval > 16. ) {
664  if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval);
665  }
666 
667  float wval = 0.;
668 
669  NumbersPn::getPNs( ism, ix, iy, PNs );
670 
671  if ( PNs.size() > 0 ) {
672  int ipn = PNs[0];
673  if ( ipn >= 0 && ipn < 80 ) {
674  if ( adcPN[ipn] != 0. ) wval = xval / adcPN[ipn];
675  }
676  }
677 
678  if ( meAmplPNMap ) meAmplPNMap->Fill(xix, xiy, wval);
679 
680  }
681 
682  } else {
683 
684  edm::LogWarning("EELedTask") << EcalUncalibratedRecHitCollection_ << " not available";
685 
686  }
687 
688 }
689 
int adc(sample_type sample)
get the ADC sample (12 bits)
#define LogDebug(id)
Some &quot;id&quot; conversions.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2311
static int RtHalf(const EBDetId &id)
Definition: Numbers.cc:767
static int iy0EE(const int ism)
Definition: Numbers.cc:987
Some &quot;id&quot; conversions.
static std::string sEE(const int ism)
Definition: Numbers.cc:205
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
Definition: EELedTask.cc:92
edm::InputTag EcalUncalibratedRecHitCollection_
Definition: EELedTask.h:71
std::vector< T >::const_iterator const_iterator
EcalMGPASample sample(int i) const
Definition: EcalDataFrame.h:28
MonitorElement * meAmplPNMapL2_[18]
Definition: EELedTask.h:86
MonitorElement * mePnAmplMapG01L2_[18]
Definition: EELedTask.h:87
MonitorElement * meAmplPNMapL1_[18]
Definition: EELedTask.h:77
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int gainId() const
get the gainId (2 bits)
void beginJob(void)
BeginJob.
Definition: EELedTask.cc:81
bool mergeRuns_
Definition: EELedTask.h:66
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
Definition: EELedTask.cc:100
void Fill(long long x)
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1151
MonitorElement * mePnPedMapG01L1_[18]
Definition: EELedTask.h:79
MonitorElement * meTimeMapL1_[18]
Definition: EELedTask.h:76
static int iSM(const int ism, const EcalSubdetector subdet)
Definition: Numbers.cc:222
std::vector< int > ledWavelengths_
Definition: EELedTask.h:72
static int icEE(const int ism, const int ix, const int iy)
Definition: Numbers.cc:906
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Definition: EELedTask.cc:397
void removeElement(const std::string &name)
Definition: DQMStore.cc:2353
void setup(void)
Setup.
Definition: EELedTask.cc:140
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:828
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
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:300
MonitorElement * meTimeMapL2_[18]
Definition: EELedTask.h:85
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:45
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:389
MonitorElement * mePnPedMapG16L2_[18]
Definition: EELedTask.h:90
static int ix0EE(const int ism)
Definition: Numbers.cc:952
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
bool enableCleanup_
Definition: EELedTask.h:64
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:136
DQMStore * dqmStore_
Definition: EELedTask.h:60
EELedTask(const edm::ParameterSet &ps)
Constructor.
Definition: EELedTask.cc:33
void reset(void)
Reset.
Definition: EELedTask.cc:136
edm::InputTag EcalPnDiodeDigiCollection_
Definition: EELedTask.h:70
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
virtual ~EELedTask()
Destructor.
Definition: EELedTask.cc:77
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:232
Definition: Run.h:32
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:972
MonitorElement * mePnAmplMapG16L2_[18]
Definition: EELedTask.h:89
int ievt_
Definition: EELedTask.h:58