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/07/30 05:42:47 $
5  * $Revision: 1.64 $
6  * \author G. Della Ricca
7  *
8 */
9 
10 #include <iostream>
11 #include <fstream>
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  char histo[200];
145 
146  if ( dqmStore_ ) {
147  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
148 
149  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
150 
151  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
152  for (int i = 0; i < 18; i++) {
153  sprintf(histo, "EELDT shape %s L1", Numbers::sEE(i+1).c_str());
154  meShapeMapL1_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
155  meShapeMapL1_[i]->setAxisTitle("channel", 1);
156  meShapeMapL1_[i]->setAxisTitle("sample", 2);
157  meShapeMapL1_[i]->setAxisTitle("amplitude", 3);
158  dqmStore_->tag(meShapeMapL1_[i], i+1);
159  sprintf(histo, "EELDT amplitude %s L1", Numbers::sEE(i+1).c_str());
160  meAmplMapL1_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
161  meAmplMapL1_[i]->setAxisTitle("ix", 1);
162  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL1_[i]->setAxisTitle("101-ix", 1);
163  meAmplMapL1_[i]->setAxisTitle("iy", 2);
164  dqmStore_->tag(meAmplMapL1_[i], i+1);
165  sprintf(histo, "EELDT timing %s L1", Numbers::sEE(i+1).c_str());
166  meTimeMapL1_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
167  meTimeMapL1_[i]->setAxisTitle("ix", 1);
168  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL1_[i]->setAxisTitle("101-ix", 1);
169  meTimeMapL1_[i]->setAxisTitle("iy", 2);
170  dqmStore_->tag(meTimeMapL1_[i], i+1);
171  sprintf(histo, "EELDT amplitude over PN %s L1", Numbers::sEE(i+1).c_str());
172  meAmplPNMapL1_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
173  meAmplPNMapL1_[i]->setAxisTitle("ix", 1);
174  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL1_[i]->setAxisTitle("101-ix", 1);
175  meAmplPNMapL1_[i]->setAxisTitle("iy", 2);
176  dqmStore_->tag(meAmplPNMapL1_[i], i+1);
177  }
178 
179  }
180 
181  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
182 
183  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
184  for (int i = 0; i < 18; i++) {
185  sprintf(histo, "EELDT shape %s L2", Numbers::sEE(i+1).c_str());
186  meShapeMapL2_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
187  meShapeMapL2_[i]->setAxisTitle("channel", 1);
188  meShapeMapL2_[i]->setAxisTitle("sample", 2);
189  meShapeMapL2_[i]->setAxisTitle("amplitude", 3);
190  dqmStore_->tag(meShapeMapL2_[i], i+1);
191  sprintf(histo, "EELDT amplitude %s L2", Numbers::sEE(i+1).c_str());
192  meAmplMapL2_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
193  meAmplMapL2_[i]->setAxisTitle("ix", 1);
194  if ( i+1 >= 1 && i+1 <= 9 ) meAmplMapL1_[i]->setAxisTitle("101-ix", 1);
195  meAmplMapL2_[i]->setAxisTitle("iy", 2);
196  dqmStore_->tag(meAmplMapL2_[i], i+1);
197  sprintf(histo, "EELDT timing %s L2", Numbers::sEE(i+1).c_str());
198  meTimeMapL2_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
199  meTimeMapL2_[i]->setAxisTitle("ix", 1);
200  if ( i+1 >= 1 && i+1 <= 9 ) meTimeMapL2_[i]->setAxisTitle("101-ix", 1);
201  meTimeMapL2_[i]->setAxisTitle("iy", 2);
202  dqmStore_->tag(meTimeMapL2_[i], i+1);
203  sprintf(histo, "EELDT amplitude over PN %s L2", Numbers::sEE(i+1).c_str());
204  meAmplPNMapL2_[i] = dqmStore_->bookProfile2D(histo, histo, 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");
205  meAmplPNMapL2_[i]->setAxisTitle("ix", 1);
206  if ( i+1 >= 1 && i+1 <= 9 ) meAmplPNMapL2_[i]->setAxisTitle("101-ix", 1);
207  meAmplPNMapL2_[i]->setAxisTitle("iy", 2);
208  dqmStore_->tag(meAmplPNMapL2_[i], i+1);
209  }
210 
211  }
212 
213  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
214 
215  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
216 
217  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
218  for (int i = 0; i < 18; i++) {
219  sprintf(histo, "EELDT PNs amplitude %s G01 L1", Numbers::sEE(i+1).c_str());
220  mePnAmplMapG01L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
221  mePnAmplMapG01L1_[i]->setAxisTitle("channel", 1);
222  mePnAmplMapG01L1_[i]->setAxisTitle("amplitude", 2);
224  sprintf(histo, "EELDT PNs pedestal %s G01 L1", Numbers::sEE(i+1).c_str());
225  mePnPedMapG01L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
226  mePnPedMapG01L1_[i]->setAxisTitle("channel", 1);
227  mePnPedMapG01L1_[i]->setAxisTitle("pedestal", 2);
228  dqmStore_->tag(mePnPedMapG01L1_[i], i+1);
229  }
230 
231  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
232  for (int i = 0; i < 18; i++) {
233  sprintf(histo, "EELDT PNs amplitude %s G16 L1", Numbers::sEE(i+1).c_str());
234  mePnAmplMapG16L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
235  mePnAmplMapG16L1_[i]->setAxisTitle("channel", 1);
236  mePnAmplMapG16L1_[i]->setAxisTitle("amplitude", 2);
238  sprintf(histo, "EELDT PNs pedestal %s G16 L1", Numbers::sEE(i+1).c_str());
239  mePnPedMapG16L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
240  mePnPedMapG16L1_[i]->setAxisTitle("channel", 1);
241  mePnPedMapG16L1_[i]->setAxisTitle("pedestal", 2);
242  dqmStore_->tag(mePnPedMapG16L1_[i], i+1);
243  }
244 
245  }
246 
247  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
248 
249  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
250 
251  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
252  for (int i = 0; i < 18; i++) {
253  sprintf(histo, "EELDT PNs amplitude %s G01 L2", Numbers::sEE(i+1).c_str());
254  mePnAmplMapG01L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
255  mePnAmplMapG01L2_[i]->setAxisTitle("amplitude", 2);
256  mePnAmplMapG01L2_[i]->setAxisTitle("channel", 1);
258  sprintf(histo, "EELDT PNs pedestal %s G01 L2", Numbers::sEE(i+1).c_str());
259  mePnPedMapG01L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
260  mePnPedMapG01L2_[i]->setAxisTitle("channel", 1);
261  mePnPedMapG01L2_[i]->setAxisTitle("pedestal", 2);
262  dqmStore_->tag(mePnPedMapG01L2_[i], i+1);
263  }
264 
265  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
266  for (int i = 0; i < 18; i++) {
267  sprintf(histo, "EELDT PNs amplitude %s G16 L2", Numbers::sEE(i+1).c_str());
268  mePnAmplMapG16L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
269  mePnAmplMapG16L2_[i]->setAxisTitle("channel", 1);
270  mePnAmplMapG16L2_[i]->setAxisTitle("amplitude", 2);
272  sprintf(histo, "EELDT PNs pedestal %s G16 L2", Numbers::sEE(i+1).c_str());
273  mePnPedMapG16L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
274  mePnPedMapG16L2_[i]->setAxisTitle("channel", 1);
275  mePnPedMapG16L2_[i]->setAxisTitle("pedestal", 2);
276  dqmStore_->tag(mePnPedMapG16L2_[i], i+1);
277  }
278 
279  }
280 
281  }
282 
283 }
284 
286 
287  if ( ! init_ ) return;
288 
289  if ( dqmStore_ ) {
290  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
291 
292  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
293 
294  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
295  for (int i = 0; i < 18; i++) {
297  meShapeMapL1_[i] = 0;
299  meAmplMapL1_[i] = 0;
301  meTimeMapL1_[i] = 0;
303  meAmplPNMapL1_[i] = 0;
304  }
305 
306  }
307 
308  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
309 
310  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
311  for (int i = 0; i < 18; i++) {
313  meShapeMapL2_[i] = 0;
315  meAmplMapL2_[i] = 0;
317  meTimeMapL2_[i] = 0;
319  meAmplPNMapL2_[i] = 0;
320  }
321 
322  }
323 
324  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 1) != ledWavelengths_.end() ) {
325 
326  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
327 
328  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
329  for (int i = 0; i < 18; i++) {
331  mePnAmplMapG01L1_[i] = 0;
333  mePnPedMapG01L1_[i] = 0;
334  }
335 
336  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
337  for (int i = 0; i < 18; i++) {
339  mePnAmplMapG16L1_[i] = 0;
341  mePnPedMapG16L1_[i] = 0;
342  }
343 
344  }
345 
346  if ( find(ledWavelengths_.begin(), ledWavelengths_.end(), 2) != ledWavelengths_.end() ) {
347 
348  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
349 
350  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
351  for (int i = 0; i < 18; i++) {
353  mePnAmplMapG01L2_[i] = 0;
355  mePnPedMapG01L2_[i] = 0;
356  }
357 
358  dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
359  for (int i = 0; i < 18; i++) {
361  mePnAmplMapG16L2_[i] = 0;
363  mePnPedMapG16L2_[i] = 0;
364  }
365 
366  }
367 
368  }
369 
370  init_ = false;
371 
372 }
373 
374 void EELedTask::endJob(void){
375 
376  edm::LogInfo("EELedTask") << "analyzed " << ievt_ << " events";
377 
378  if ( enableCleanup_ ) this->cleanup();
379 
380 }
381 
383 
384  bool enable = false;
385  int runType[18];
386  for (int i=0; i<18; i++) runType[i] = -1;
387  int rtHalf[18];
388  for (int i=0; i<18; i++) rtHalf[i] = -1;
389  int waveLength[18];
390  for (int i=0; i<18; i++) waveLength[i] = -1;
391 
393 
394  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
395 
396  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
397 
398  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
399 
400  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
401 
402  runType[ism-1] = dcchItr->getRunType();
403  rtHalf[ism-1] = dcchItr->getRtHalf();
404  waveLength[ism-1] = dcchItr->getEventSettings().wavelength;
405 
406  if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LED_STD ||
407  dcchItr->getRunType() == EcalDCCHeaderBlock::LED_GAP ) enable = true;
408 
409  }
410 
411  } else {
412 
413  edm::LogWarning("EELedTask") << EcalRawDataCollection_ << " not available";
414 
415  }
416 
417  if ( ! enable ) return;
418 
419  if ( ! init_ ) this->setup();
420 
421  ievt_++;
422 
423  bool numPN[80];
424  float adcPN[80];
425  for ( int i = 0; i < 80; i++ ) {
426  numPN[i] = false;
427  adcPN[i] = 0.;
428  }
429 
430  std::vector<int> PNs;
431  PNs.reserve(12);
432 
434 
435  if ( e.getByLabel(EEDigiCollection_, digis) ) {
436 
437  int need = digis->size();
438  LogDebug("EELedTask") << "event " << ievt_ << " digi collection size " << need;
439 
440  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
441 
442  EEDetId id = digiItr->id();
443 
444  int ix = id.ix();
445  int iy = id.iy();
446 
447  int ism = Numbers::iSM( id );
448 
449  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
450  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
451 
452  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
453  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
454 
455  int ic = Numbers::icEE(ism, ix, iy);
456 
457  EEDataFrame dataframe = (*digiItr);
458 
459  for (int i = 0; i < 10; i++) {
460 
461  int adc = dataframe.sample(i).adc();
462  float gain = 1.;
463 
464  MonitorElement* meShapeMap = 0;
465 
466  if ( dataframe.sample(i).gainId() == 1 ) gain = 1./12.;
467  if ( dataframe.sample(i).gainId() == 2 ) gain = 1./ 6.;
468  if ( dataframe.sample(i).gainId() == 3 ) gain = 1./ 1.;
469 
470  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
471 
472  if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1_[ism-1];
473  if ( waveLength[ism-1] == 2 ) meShapeMap = meShapeMapL2_[ism-1];
474 
475  } else {
476 
477  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
478 
479  }
480 
481 // float xval = float(adc) * gain;
482  float xval = float(adc);
483 
484  if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
485 
486  }
487 
488  NumbersPn::getPNs( ism, ix, iy, PNs );
489 
490  for (unsigned int i=0; i<PNs.size(); i++) {
491  int ipn = PNs[i];
492  if ( ipn >= 0 && ipn < 80 ) numPN[ipn] = true;
493  }
494 
495  }
496 
497  } else {
498 
499  edm::LogWarning("EELedTask") << EEDigiCollection_ << " not available";
500 
501  }
502 
504 
505  if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
506 
507  int nep = pns->size();
508  LogDebug("EELedTask") << "event " << ievt_ << " pns collection size " << nep;
509 
510  for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
511 
512  if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
513 
514  int ism = Numbers::iSM( pnItr->id() );
515 
516  int num = pnItr->id().iPnId();
517 
518  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
519  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
520 
521  int ipn = NumbersPn::ipnEE( ism, num );
522 
523  if ( ipn >= 0 && ipn < 80 && numPN[ipn] == false ) continue;
524 
525  float xvalped = 0.;
526 
527  for (int i = 0; i < 4; i++) {
528 
529  int adc = pnItr->sample(i).adc();
530 
531  MonitorElement* mePNPed = 0;
532 
533  if ( pnItr->sample(i).gainId() == 0 ) {
534  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG01L1_[ism-1];
535  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG01L2_[ism-1];
536  }
537  if ( pnItr->sample(i).gainId() == 1 ) {
538  if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG16L1_[ism-1];
539  if ( waveLength[ism-1] == 2 ) mePNPed = mePnPedMapG16L2_[ism-1];
540  }
541 
542  float xval = float(adc);
543 
544  if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
545 
546  xvalped = xvalped + xval;
547 
548  }
549 
550  xvalped = xvalped / 4;
551 
552  float xvalmax = 0.;
553 
554  MonitorElement* mePN = 0;
555 
556  for (int i = 0; i < 50; i++) {
557 
558  int adc = pnItr->sample(i).adc();
559 
560  float xval = float(adc);
561 
562  if ( xval >= xvalmax ) xvalmax = xval;
563 
564  }
565 
566  xvalmax = xvalmax - xvalped;
567 
568  if ( pnItr->sample(0).gainId() == 0 ) {
569  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG01L1_[ism-1];
570  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG01L2_[ism-1];
571  }
572  if ( pnItr->sample(0).gainId() == 1 ) {
573  if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG16L1_[ism-1];
574  if ( waveLength[ism-1] == 2 ) mePN = mePnAmplMapG16L2_[ism-1];
575  }
576 
577  if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
578 
579  if ( ipn >= 0 && ipn < 80 ) adcPN[ipn] = xvalmax;
580 
581  }
582 
583  } else {
584 
585  edm::LogWarning("EELedTask") << EcalPnDiodeDigiCollection_ << " not available";
586 
587  }
588 
590 
592 
593  int neh = hits->size();
594  LogDebug("EELedTask") << "event " << ievt_ << " hits collection size " << neh;
595 
596  for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
597 
598  EEDetId id = hitItr->id();
599 
600  int ix = id.ix();
601  int iy = id.iy();
602 
603  int ism = Numbers::iSM( id );
604 
605  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
606 
607  float xix = ix - 0.5;
608  float xiy = iy - 0.5;
609 
610  if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
611  runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
612 
613  if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
614  rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
615 
616  MonitorElement* meAmplMap = 0;
617  MonitorElement* meTimeMap = 0;
618  MonitorElement* meAmplPNMap = 0;
619 
620  if ( Numbers::RtHalf(id) == 0 || Numbers::RtHalf(id) == 1 ) {
621 
622  if ( waveLength[ism-1] == 0 ) {
623  meAmplMap = meAmplMapL1_[ism-1];
624  meTimeMap = meTimeMapL1_[ism-1];
625  meAmplPNMap = meAmplPNMapL1_[ism-1];
626  }
627  if ( waveLength[ism-1] == 2 ) {
628  meAmplMap = meAmplMapL2_[ism-1];
629  meTimeMap = meTimeMapL2_[ism-1];
630  meAmplPNMap = meAmplPNMapL2_[ism-1];
631  }
632 
633  } else {
634 
635  edm::LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
636 
637  }
638 
639  float xval = hitItr->amplitude();
640  if ( xval <= 0. ) xval = 0.0;
641  float yval = hitItr->jitter() + 6.0;
642  if ( yval <= 0. ) yval = 0.0;
643  float zval = hitItr->pedestal();
644  if ( zval <= 0. ) zval = 0.0;
645 
646  if ( meAmplMap ) meAmplMap->Fill(xix, xiy, xval);
647 
648  if ( xval > 16. ) {
649  if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval);
650  }
651 
652  float wval = 0.;
653 
654  NumbersPn::getPNs( ism, ix, iy, PNs );
655 
656  if ( PNs.size() > 0 ) {
657  int ipn = PNs[0];
658  if ( ipn >= 0 && ipn < 80 ) {
659  if ( adcPN[ipn] != 0. ) wval = xval / adcPN[ipn];
660  }
661  }
662 
663  if ( meAmplPNMap ) meAmplPNMap->Fill(xix, xiy, wval);
664 
665  }
666 
667  } else {
668 
669  edm::LogWarning("EELedTask") << EcalUncalibratedRecHitCollection_ << " not available";
670 
671  }
672 
673 }
674 
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:2296
static int RtHalf(const EBDetId &id)
Definition: Numbers.cc:761
static int iy0EE(const int ism)
Definition: Numbers.cc:964
Some &quot;id&quot; conversions.
static std::string sEE(const int ism)
Definition: Numbers.cc:199
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
tuple histo
Definition: trackerHits.py:12
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:1156
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:216
std::vector< int > ledWavelengths_
Definition: EELedTask.h:72
static int icEE(const int ism, const int ix, const int iy)
Definition: Numbers.cc:900
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Definition: EELedTask.cc:382
void removeElement(const std::string &name)
Definition: DQMStore.cc:2338
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:833
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
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:285
MonitorElement * meTimeMapL2_[18]
Definition: EELedTask.h:85
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:43
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:374
MonitorElement * mePnPedMapG16L2_[18]
Definition: EELedTask.h:90
static int ix0EE(const int ism)
Definition: Numbers.cc:946
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:130
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:47
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:237
Definition: Run.h:31
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:977
MonitorElement * mePnAmplMapG16L2_[18]
Definition: EELedTask.h:89
int ievt_
Definition: EELedTask.h:58