CMS 3D CMS Logo

LaserTask.cc
Go to the documentation of this file.
1 
3 
4 using namespace hcaldqm;
5 using namespace hcaldqm::constants;
6 using namespace hcaldqm::filter;
8  DQTask(ps)
9 {
10  _nevents = ps.getUntrackedParameter<int>("nevents", 2000);
11 
12  // tags
14  edm::InputTag("hcalDigis"));
16  edm::InputTag("hcalDigis"));
18  edm::InputTag("hcalDigis"));
20  edm::InputTag("hcalDigis"));
21  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
22  _tokHO = consumes<HODigiCollection>(_tagHO);
23  _tokHF = consumes<QIE10DigiCollection>(_tagHF);
24  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
25 
26  // constants
27  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE",
28  20);
29  _lowHO = ps.getUntrackedParameter<double>("lowHO",
30  20);
31  _lowHF = ps.getUntrackedParameter<double>("lowHF",
32  20);
33  _laserType = (uint32_t)ps.getUntrackedParameter<uint32_t>("laserType");
34 }
35 
37  edm::Run const& r, edm::EventSetup const& es)
38 {
39  if (_ptype==fLocal)
40  if (r.runAuxiliary().run()==1)
41  return;
42 
43  DQTask::bookHistograms(ib, r, es);
44 
46  es.get<HcalDbRecord>().get(dbService);
47  _emap = dbService->getHcalMapping();
48 
49  std::vector<uint32_t> vhashVME;
50  std::vector<uint32_t> vhashuTCA;
51  std::vector<uint32_t> vhashC36;
52  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
54  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
55  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
57  vhashVME);
59  vhashuTCA);
60 
61  // INITIALIZE
62  _cSignalMean_Subdet.initialize(_name, "SignalMean",
66  _cSignalRMS_Subdet.initialize(_name, "SignalRMS",
70  _cTimingMean_Subdet.initialize(_name, "TimingMean",
74  _cTimingRMS_Subdet.initialize(_name, "TimingRMS",
78 
83 
84  if (_ptype != fOffline) { // hidefed2crate
85  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
95  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
100  _cSignalRMS_FEDuTCA.initialize(_name, "SignalRMS",
105  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
110  _cTimingMean_FEDuTCA.initialize(_name, "TimingMean",
115  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
120  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
125 
130  }
131  _cTimingvsEvent_SubdetPM.initialize(_name, "TimingvsEvent",
135  _cSignalvsEvent_SubdetPM.initialize(_name, "SignalvsEvent",
139  _cTimingvsLS_SubdetPM.initialize(_name, "TimingvsLS",
143  _cSignalvsLS_SubdetPM.initialize(_name, "SignalvsLS",
147  _cTimingvsBX_SubdetPM.initialize(_name, "TimingvsBX",
151  _cSignalvsBX_SubdetPM.initialize(_name, "SignalvsBX",
155 
156  _cSignalMean_depth.initialize(_name, "SignalMean",
161  _cSignalRMS_depth.initialize(_name, "SignalRMS",
166  _cTimingMean_depth.initialize(_name, "TimingMean",
171  _cTimingRMS_depth.initialize(_name, "TimingRMS",
176 
177  _cMissing_depth.initialize(_name, "Missing",
182  if (_ptype != fOffline) { // hidefed2crate
183  _cMissing_FEDVME.initialize(_name, "Missing",
193  }
194 
195 
196  // initialize compact containers
202 
203  // BOOK
208 
213 
214  if (_ptype==fLocal)
215  {
218  }
219  else
220  {
225  }
226 
227  if (_ptype != fOffline) { // hidefed2crate
236  }
238 
240  if (_ptype != fOffline) { // hidefed2crate
244  }
245 
251 
253 }
254 
256 {
257  DQTask::_resetMonitors(uf);
258 }
259 
260 /* virtual */ void LaserTask::_dump()
261 {
270 
271  if (_ptype != fOffline) { // hidefed2crate
280  }
281 
282  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
283  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
284  it!=dids.end(); ++it)
285  {
286  if (!it->isHcalDetId())
287  continue;
288  HcalDetId did = HcalDetId(it->rawId());
290  int n = _xEntries.get(did);
291  double msig = _xSignalSum.get(did)/n;
292  double mtim = _xTimingSum.get(did)/n;
293  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
294  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
295 
296  // channels missing or low signal
297  if (n==0)
298  {
299  _cMissing_depth.fill(did);
300  if (_ptype != fOffline) { // hidefed2crate
301  if (eid.isVMEid())
303  else
305  }
306  continue;
307  }
308  _cSignalMean_Subdet.fill(did, msig);
309  _cSignalMean_depth.fill(did, msig);
310  _cSignalRMS_Subdet.fill(did, rsig);
311  _cSignalRMS_depth.fill(did, rsig);
312  _cTimingMean_Subdet.fill(did, mtim);
313  _cTimingMean_depth.fill(did, mtim);
314  _cTimingRMS_Subdet.fill(did, rtim);
315  _cTimingRMS_depth.fill(did, rtim);
316  if (_ptype != fOffline) { // hidefed2crate
317  if (eid.isVMEid())
318  {
320  _cSignalRMS_FEDVME.fill(eid, rsig);
322  _cTimingRMS_FEDVME.fill(eid, rtim);
323  }
324  else
325  {
330  }
331  }
332  }
333 }
334 
335 /* virtual */ void LaserTask::_process(edm::Event const& e,
336  edm::EventSetup const& es)
337 {
341 
342  if (!e.getByToken(_tokHBHE, chbhe))
343  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
344  + _tagHBHE.label() + " " + _tagHBHE.instance());
345  if (!e.getByToken(_tokHO, cho))
346  _logger.dqmthrow("Collection HODigiCollection isn't available "
347  + _tagHO.label() + " " + _tagHO.instance());
348  if (!e.getByToken(_tokHF, chf))
349  _logger.dqmthrow("Collection QIE10DigiCollection isn't available "
350  + _tagHF.label() + " " + _tagHF.instance());
351 
352 // int currentEvent = e.eventAuxiliary().id().event();
353  int bx = e.bunchCrossing();
354 
355  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
356  it!=chbhe->end(); ++it)
357  {
358  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
359  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
360  digi.size()-1);
361  if (sumQ<_lowHBHE)
362  continue;
363  HcalDetId did = digi.id();
364  HcalElectronicsId eid = digi.elecId();
365 
366  double aveTS = hcaldqm::utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
367  digi.size()-1);
368  _xSignalSum.get(did)+=sumQ;
369  _xSignalSum2.get(did)+=sumQ*sumQ;
370  _xTimingSum.get(did)+=aveTS;
371  _xTimingSum2.get(did)+=aveTS*aveTS;
372  _xEntries.get(did)++;
373 
374  for (int i=0; i<digi.size(); i++)
375  {
376  if (_ptype != fOffline) { // hidefed2crate
377  _cShapeCut_FEDSlot.fill(eid, i,
378  digi.sample(i).nominal_fC()-2.5);
379  }
380  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
381  }
382 
383  // select based on local global
384  if (_ptype==fLocal)
385  {
386  int currentEvent = e.eventAuxiliary().id().event();
387  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
388  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
389  }
390  else
391  {
394  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
395  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
396  }
397  }
399  it!=cho->end(); ++it)
400  {
401  const HODataFrame digi = (const HODataFrame)(*it);
402  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0,
403  digi.size()-1);
404  if (sumQ<_lowHO)
405  continue;
406  HcalDetId did = digi.id();
407  HcalElectronicsId eid = digi.elecId();
408 
409  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0,
410  digi.size()-1);
411  _xSignalSum.get(did)+=sumQ;
412  _xSignalSum2.get(did)+=sumQ*sumQ;
413  _xTimingSum.get(did)+=aveTS;
414  _xTimingSum2.get(did)+=aveTS*aveTS;
415  _xEntries.get(did)++;
416 
417  for (int i=0; i<digi.size(); i++)
418  {
419  if (_ptype != fOffline) { // hidefed2crate
420  _cShapeCut_FEDSlot.fill(eid, i,
421  digi.sample(i).nominal_fC()-8.5);
422  }
423  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
424  }
425 
426  // select based on local global
427  if (_ptype==fLocal)
428  {
429  int currentEvent = e.eventAuxiliary().id().event();
430  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
431  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
432  }
433  else
434  {
437  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
438  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
439  }
440  }
442  it!=chf->end(); ++it)
443  {
444  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
445  double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0,
446  digi.samples()-1);
447  if (sumQ<_lowHF)
448  continue;
449  HcalDetId did = digi.detid();
451 
452  double aveTS = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
453  _xSignalSum.get(did)+=sumQ;
454  _xSignalSum2.get(did)+=sumQ*sumQ;
455  _xTimingSum.get(did)+=aveTS;
456  _xTimingSum2.get(did)+=aveTS*aveTS;
457  _xEntries.get(did)++;
458 
459  for (int i=0; i<digi.samples(); i++)
460  {
461  if (_ptype != fOffline) { // hidefed2crate
462  _cShapeCut_FEDSlot.fill(eid, (int)i, constants::adc2fC[digi[i].adc()]-2.5);
463  }
464  _cADC_SubdetPM.fill(did, digi[i].adc());
465  }
466 
467  // select based on local global
468  if (_ptype==fLocal)
469  {
470  int currentEvent = e.eventAuxiliary().id().event();
471  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
472  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
473  }
474  else
475  {
478  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
479  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
480  }
481  }
482 }
483 
485  edm::EventSetup const& es)
486 {
487  if (_ptype==fLocal)
488  return;
489  this->_dump();
490 
491  DQTask::endLuminosityBlock(lb, es);
492 }
493 
494 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e)
495 {
496  if (_ptype!=fOnline)
497  return true;
498  else
499  {
500  // fOnline mode
502  if (!e.getByToken(_tokuMN, cumn))
503  return false;
504 
505  // event type check first
506  uint8_t eventType = cumn->eventType();
507  if (eventType!=constants::EVENTTYPE_LASER)
508  return false;
509 
510  // check if this analysis task is of the right laser type
511  uint32_t laserType = cumn->valueUserWord(0);
512  if (laserType==_laserType) return true;
513  }
514 
515  return false;
516 }
517 
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
EventNumber_t event() const
Definition: EventID.h:41
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:89
T getUntrackedParameter(std::string const &, T const &) const
double aveTS(DIGI const &digi, double ped=0, int i=0, int j=3)
Definition: Utilities.h:65
hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM
Definition: LaserTask.h:91
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:78
double _lowHF
Definition: LaserTask.h:70
int const CRATE_VME_MIN
Definition: Constants.h:68
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:106
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:75
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
hcaldqm::ContainerXXX< int > _xEntries
Definition: LaserTask.h:76
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
hcaldqm::Container1D _cTimingRMS_Subdet
Definition: LaserTask.h:84
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
double _lowHBHE
Definition: LaserTask.h:68
uint32_t _laserType
Definition: LaserTask.h:71
UpdateFreq
Definition: DQTask.h:17
virtual void _dump()
Definition: LaserTask.cc:260
std::vector< HBHEDataFrame >::const_iterator const_iterator
hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM
Definition: LaserTask.h:90
hcaldqm::ContainerProf2D _cSignalRMS_FEDVME
Definition: LaserTask.h:107
int bunchCrossing() const
Definition: EventBase.h:66
int const SPIGOT_MIN
Definition: Constants.h:93
const_iterator begin() const
int const FIBER_VME_MIN
Definition: Constants.h:98
hcaldqm::ContainerXXX< double > _xSignalSum
Definition: LaserTask.h:74
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: LaserTask.cc:36
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LaserTask.h:77
hcaldqm::Container2D _cMissing_depth
Definition: LaserTask.h:113
hcaldqm::Container2D _cMissing_FEDVME
Definition: LaserTask.h:114
void bookHistograms(fwlite::EventContainer &eventCont)
hcaldqm::ContainerProf2D _cSignalMean_depth
Definition: LaserTask.h:98
int const FIBERCH_MIN
Definition: Constants.h:108
edm::InputTag _tagHO
Definition: LaserTask.h:52
hcaldqm::Container1D _cADC_SubdetPM
Definition: LaserTask.h:86
HcalElectronicsMap const * _emap
Definition: LaserTask.h:61
hcaldqm::ContainerProf2D _cTimingRMS_FEDVME
Definition: LaserTask.h:109
hcaldqm::ContainerProf2D _cSignalMean_FEDVME
Definition: LaserTask.h:103
edm::InputTag _tagHF
Definition: LaserTask.h:53
hcaldqm::Container1D _cTimingMean_Subdet
Definition: LaserTask.h:83
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:82
virtual void reset()
Definition: Container1D.cc:65
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0)
hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LaserTask.h:110
hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LaserTask.h:108
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
uint32_t valueUserWord(int iword) const
hcaldqm::filter::HashFilter _filter_uTCA
Definition: LaserTask.h:63
T sqrt(T t)
Definition: SSEVec.h:18
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fEnergy), int debug=0)
hcaldqm::ContainerProf2D _cTimingMean_FEDVME
Definition: LaserTask.h:105
int _nevents
Definition: LaserTask.h:67
int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
uint8_t eventType() const
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
int const FIBER_uTCA_MIN1
Definition: Constants.h:101
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LaserTask.h:56
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:70
std::string _name
Definition: DQModule.h:57
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM
Definition: LaserTask.h:95
double _lowHO
Definition: LaserTask.h:69
virtual bool _isApplicable(edm::Event const &)
Definition: LaserTask.cc:494
int const CRATE_uTCA_MIN
Definition: Constants.h:73
hcaldqm::Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:115
const_iterator end() const
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LaserTask.h:81
double const adc2fC[256]
Definition: Constants.h:229
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LaserTask.h:55
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: LaserTask.cc:335
hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:93
hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:92
edm::InputTag _tagHBHE
Definition: LaserTask.h:51
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:99
hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA
Definition: LaserTask.h:104
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:282
hcaldqm::ContainerProf2D _cTimingMean_depth
Definition: LaserTask.h:100
const T & get() const
Definition: EventSetup.h:56
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: LaserTask.h:62
edm::InputTag _taguMN
Definition: LaserTask.h:54
RunAuxiliary const & runAuxiliary() const
Definition: Run.h:59
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
EventID const & id() const
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:249
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: LaserTask.h:58
hcaldqm::Container1D _cSignalRMS_Subdet
Definition: LaserTask.h:82
virtual void fill(HcalDetId const &) override
Definition: Container2D.cc:59
const HcalElectronicsMap * getHcalMapping() const
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: LaserTask.cc:484
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::ContainerXXX< double > _xTimingSum2
Definition: LaserTask.h:78
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:91
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:895
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
edm::EDGetTokenT< QIE10DigiCollection > _tokHF
Definition: LaserTask.h:57
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:99
virtual void _resetMonitors(hcaldqm::UpdateFreq)
Definition: LaserTask.cc:255
hcaldqm::filter::HashFilter _filter_VME
Definition: LaserTask.h:64
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM
Definition: LaserTask.h:94
RunNumber_t run() const
Definition: RunAuxiliary.h:41
LaserTask(edm::ParameterSet const &)
Definition: LaserTask.cc:7
int const SLOT_uTCA_MIN
Definition: Constants.h:80
const_iterator begin() const
Definition: Run.h:42
ib
Definition: cuy.py:660
hcaldqm::ContainerProf2D _cTimingRMS_depth
Definition: LaserTask.h:101
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79