CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<HFDigiCollection>(_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  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
94  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
104  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
109  _cTimingMean_FEDuTCA.initialize(_name, "TimingMean",
114  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
119  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
124 
129  _cTimingvsEvent_SubdetPM.initialize(_name, "TimingvsEvent",
133  _cSignalvsEvent_SubdetPM.initialize(_name, "SignalvsEvent",
137  _cTimingvsLS_SubdetPM.initialize(_name, "TimingvsLS",
141  _cSignalvsLS_SubdetPM.initialize(_name, "SignalvsLS",
145  _cTimingvsBX_SubdetPM.initialize(_name, "TimingvsBX",
149  _cSignalvsBX_SubdetPM.initialize(_name, "SignalvsBX",
153 
154  _cSignalMean_depth.initialize(_name, "SignalMean",
159  _cSignalRMS_depth.initialize(_name, "SignalRMS",
164  _cTimingMean_depth.initialize(_name, "TimingMean",
169  _cTimingRMS_depth.initialize(_name, "TimingRMS",
174 
175  _cMissing_depth.initialize(_name, "Missing",
180  _cMissing_FEDVME.initialize(_name, "Missing",
190 
191 
192  // initialize compact containers
198 
199  // BOOK
204 
209 
210  if (_ptype==fLocal)
211  {
214  }
215  else
216  {
221  }
222 
232 
237 
243 
245 }
246 
248 {
249  DQTask::_resetMonitors(uf);
250 }
251 
252 /* virtual */ void LaserTask::_dump()
253 {
262 
271 
272  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
273  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
274  it!=dids.end(); ++it)
275  {
276  if (!it->isHcalDetId())
277  continue;
278  HcalDetId did = HcalDetId(it->rawId());
280  int n = _xEntries.get(did);
281  double msig = _xSignalSum.get(did)/n;
282  double mtim = _xTimingSum.get(did)/n;
283  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
284  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
285 
286  // channels missing or low signal
287  if (n==0)
288  {
289  _cMissing_depth.fill(did);
290  if (eid.isVMEid())
291  _cMissing_FEDVME.fill(eid);
292  else
293  _cMissing_FEDuTCA.fill(eid);
294  continue;
295  }
296  _cSignalMean_Subdet.fill(did, msig);
297  _cSignalMean_depth.fill(did, msig);
298  _cSignalRMS_Subdet.fill(did, rsig);
299  _cSignalRMS_depth.fill(did, rsig);
300  _cTimingMean_Subdet.fill(did, mtim);
301  _cTimingMean_depth.fill(did, mtim);
302  _cTimingRMS_Subdet.fill(did, rtim);
303  _cTimingRMS_depth.fill(did, rtim);
304  if (eid.isVMEid())
305  {
306  _cSignalMean_FEDVME.fill(eid, msig);
307  _cSignalRMS_FEDVME.fill(eid, rsig);
308  _cTimingMean_FEDVME.fill(eid, mtim);
309  _cTimingRMS_FEDVME.fill(eid, rtim);
310  }
311  else
312  {
313  _cSignalMean_FEDuTCA.fill(eid, msig);
314  _cSignalRMS_FEDuTCA.fill(eid, rsig);
315  _cTimingMean_FEDuTCA.fill(eid, mtim);
316  _cTimingRMS_FEDuTCA.fill(eid, rtim);
317  }
318  }
319 }
320 
321 /* virtual */ void LaserTask::_process(edm::Event const& e,
322  edm::EventSetup const& es)
323 {
327 
328  if (!e.getByToken(_tokHBHE, chbhe))
329  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
330  + _tagHBHE.label() + " " + _tagHBHE.instance());
331  if (!e.getByToken(_tokHO, cho))
332  _logger.dqmthrow("Collection HODigiCollection isn't available "
333  + _tagHO.label() + " " + _tagHO.instance());
334  if (!e.getByToken(_tokHF, chf))
335  _logger.dqmthrow("Collection HFDigiCollection isn't available "
336  + _tagHF.label() + " " + _tagHF.instance());
337 
338 // int currentEvent = e.eventAuxiliary().id().event();
339  int bx = e.bunchCrossing();
340 
341  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
342  it!=chbhe->end(); ++it)
343  {
344  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
345  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
346  digi.size()-1);
347  if (sumQ<_lowHBHE)
348  continue;
349  HcalDetId did = digi.id();
350  HcalElectronicsId eid = digi.elecId();
351 
352  double aveTS = hcaldqm::utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
353  digi.size()-1);
354  _xSignalSum.get(did)+=sumQ;
355  _xSignalSum2.get(did)+=sumQ*sumQ;
356  _xTimingSum.get(did)+=aveTS;
357  _xTimingSum2.get(did)+=aveTS*aveTS;
358  _xEntries.get(did)++;
359 
360  for (int i=0; i<digi.size(); i++)
361  {
362  _cShapeCut_FEDSlot.fill(eid, i,
363  digi.sample(i).nominal_fC()-2.5);
364  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
365  }
366 
367  // select based on local global
368  if (_ptype==fLocal)
369  {
370  int currentEvent = e.eventAuxiliary().id().event();
371  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
372  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
373  }
374  else
375  {
378  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
379  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
380  }
381  }
382  for (HODigiCollection::const_iterator it=cho->begin();
383  it!=cho->end(); ++it)
384  {
385  const HODataFrame digi = (const HODataFrame)(*it);
386  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0,
387  digi.size()-1);
388  if (sumQ<_lowHO)
389  continue;
390  HcalDetId did = digi.id();
391  HcalElectronicsId eid = digi.elecId();
392 
393  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0,
394  digi.size()-1);
395  _xSignalSum.get(did)+=sumQ;
396  _xSignalSum2.get(did)+=sumQ*sumQ;
397  _xTimingSum.get(did)+=aveTS;
398  _xTimingSum2.get(did)+=aveTS*aveTS;
399  _xEntries.get(did)++;
400 
401  for (int i=0; i<digi.size(); i++)
402  {
403  _cShapeCut_FEDSlot.fill(eid, i,
404  digi.sample(i).nominal_fC()-8.5);
405  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
406  }
407 
408  // select based on local global
409  if (_ptype==fLocal)
410  {
411  int currentEvent = e.eventAuxiliary().id().event();
412  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
413  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
414  }
415  else
416  {
419  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
420  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
421  }
422  }
423  for (HFDigiCollection::const_iterator it=chf->begin();
424  it!=chf->end(); ++it)
425  {
426  const HFDataFrame digi = (const HFDataFrame)(*it);
427  double sumQ = hcaldqm::utilities::sumQ<HFDataFrame>(digi, 2.5, 0,
428  digi.size()-1);
429  if (sumQ<_lowHF)
430  continue;
431  HcalDetId did = digi.id();
432  HcalElectronicsId eid = digi.elecId();
433 
434  double aveTS = hcaldqm::utilities::aveTS<HFDataFrame>(digi, 2.5, 0,
435  digi.size()-1);
436  _xSignalSum.get(did)+=sumQ;
437  _xSignalSum2.get(did)+=sumQ*sumQ;
438  _xTimingSum.get(did)+=aveTS;
439  _xTimingSum2.get(did)+=aveTS*aveTS;
440  _xEntries.get(did)++;
441 
442  for (int i=0; i<digi.size(); i++)
443  {
444  _cShapeCut_FEDSlot.fill(eid, i,
445  digi.sample(i).nominal_fC()-2.5);
446  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
447  }
448 
449  // select based on local global
450  if (_ptype==fLocal)
451  {
452  int currentEvent = e.eventAuxiliary().id().event();
453  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
454  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
455  }
456  else
457  {
460  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
461  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
462  }
463  }
464 }
465 
467  edm::EventSetup const& es)
468 {
469  if (_ptype==fLocal)
470  return;
471  this->_dump();
472 
473  DQTask::endLuminosityBlock(lb, es);
474 }
475 
476 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e)
477 {
478  if (_ptype!=fOnline)
479  return true;
480  else
481  {
482  // fOnline mode
484  if (!e.getByToken(_tokuMN, cumn))
485  return false;
486 
487  // event type check first
488  uint8_t eventType = cumn->eventType();
489  if (eventType!=constants::EVENTTYPE_LASER)
490  return false;
491 
492  // check if this analysis task is of the right laser type
493  uint32_t laserType = cumn->valueUserWord(0);
494  if (laserType==_laserType) return true;
495  }
496 
497  return false;
498 }
499 
EventNumber_t event() const
Definition: EventID.h:41
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:89
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
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
double _lowHF
Definition: LaserTask.h:70
int const CRATE_VME_MIN
Definition: Constants.h:60
int ib
Definition: cuy.py:660
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:106
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:75
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:252
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:65
int const SPIGOT_MIN
Definition: Constants.h:85
int const FIBER_VME_MIN
Definition: Constants.h:90
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:100
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
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
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
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
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:93
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LaserTask.h:56
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:70
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: LaserTask.h:57
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:476
int const CRATE_uTCA_MIN
Definition: Constants.h:65
hcaldqm::Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:115
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LaserTask.h:81
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LaserTask.h:55
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:77
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: LaserTask.cc:321
hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:93
hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:92
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
edm::InputTag _tagHBHE
Definition: LaserTask.h:51
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:895
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:274
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:60
std::string const & label() const
Definition: InputTag.h:36
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 endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: LaserTask.cc:466
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="")
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:99
virtual void _resetMonitors(hcaldqm::UpdateFreq)
Definition: LaserTask.cc:247
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:72
Definition: Run.h:43
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