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