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;
6  DQTask(ps)
7 {
8  _nevents = ps.getUntrackedParameter<int>("nevents", 2000);
9 
10  // tags
12  edm::InputTag("hcalDigis"));
14  edm::InputTag("hcalDigis"));
16  edm::InputTag("hcalDigis"));
18  edm::InputTag("tbunpacker"));
19  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
20  _tokHO = consumes<HODigiCollection>(_tagHO);
21  _tokHF = consumes<HFDigiCollection>(_tagHF);
22  _tokTrigger = consumes<HcalTBTriggerData>(_tagTrigger);
23 
24  // constants
25  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE",
26  20);
27  _lowHO = ps.getUntrackedParameter<double>("lowHO",
28  20);
29  _lowHF = ps.getUntrackedParameter<double>("lowHF",
30  20);
31 }
32 
34  edm::Run const& r, edm::EventSetup const& es)
35 {
36  if (_ptype==fLocal)
37  if (r.runAuxiliary().run()==1)
38  return;
39 
40  DQTask::bookHistograms(ib, r, es);
41 
43  es.get<HcalDbRecord>().get(dbService);
44  _emap = dbService->getHcalMapping();
45 
46  std::vector<uint32_t> vhashVME;
47  std::vector<uint32_t> vhashuTCA;
48  std::vector<uint32_t> vhashC36;
49  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
51  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
52  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
54  vhashVME);
56  vhashuTCA);
57 
58  // INITIALIZE
59  _cSignalMean_Subdet.initialize(_name, "SignalMean",
63  _cSignalRMS_Subdet.initialize(_name, "SignalRMS",
67  _cTimingMean_Subdet.initialize(_name, "TimingMean",
71  _cTimingRMS_Subdet.initialize(_name, "TimingRMS",
75 
76  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
86  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
96  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
101  _cTimingMean_FEDuTCA.initialize(_name, "TimingMean",
106  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
111  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
116 
121  _cTimingvsEvent_SubdetPM.initialize(_name, "TimingvsEvent",
125  _cSignalvsEvent_SubdetPM.initialize(_name, "SignalvsEvent",
129  _cTimingvsLS_SubdetPM.initialize(_name, "TimingvsLS",
133  _cSignalvsLS_SubdetPM.initialize(_name, "SignalvsLS",
137 
138  _cSignalMean_depth.initialize(_name, "SignalMean",
143  _cSignalRMS_depth.initialize(_name, "SignalRMS",
148  _cTimingMean_depth.initialize(_name, "TimingMean",
153  _cTimingRMS_depth.initialize(_name, "TimingRMS",
158 
159  _cMissing_depth.initialize(_name, "Missing",
164  _cMissing_FEDVME.initialize(_name, "Missing",
174 
175 
176  // initialize compact containers
182 
183  // BOOK
188 
193 
194  if (_ptype==fLocal)
195  {
198  }
199  else
200  {
203  }
204 
213 
218 
224 
226 }
227 
228 /* virtual */ void LaserTask::_resetMonitors(UpdateFreq uf)
229 {
230  DQTask::_resetMonitors(uf);
231 }
232 
233 /* virtual */ void LaserTask::_dump()
234 {
243 
252 
253  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
254  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
255  it!=dids.end(); ++it)
256  {
257  if (!it->isHcalDetId())
258  continue;
259  HcalDetId did = HcalDetId(it->rawId());
261  int n = _xEntries.get(did);
262  double msig = _xSignalSum.get(did)/n;
263  double mtim = _xTimingSum.get(did)/n;
264  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
265  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
266 
267  // channels missing or low signal
268  if (n==0)
269  {
270  _cMissing_depth.fill(did);
271  if (eid.isVMEid())
272  _cMissing_FEDVME.fill(eid);
273  else
274  _cMissing_FEDuTCA.fill(eid);
275  continue;
276  }
277  _cSignalMean_Subdet.fill(did, msig);
278  _cSignalMean_depth.fill(did, msig);
279  _cSignalRMS_Subdet.fill(did, rsig);
280  _cSignalRMS_depth.fill(did, rsig);
281  _cTimingMean_Subdet.fill(did, mtim);
282  _cTimingMean_depth.fill(did, mtim);
283  _cTimingRMS_Subdet.fill(did, rtim);
284  _cTimingRMS_depth.fill(did, rtim);
285  if (eid.isVMEid())
286  {
287  _cSignalMean_FEDVME.fill(eid, msig);
288  _cSignalRMS_FEDVME.fill(eid, rsig);
289  _cTimingMean_FEDVME.fill(eid, mtim);
290  _cTimingRMS_FEDVME.fill(eid, rtim);
291  }
292  else
293  {
294  _cSignalMean_FEDuTCA.fill(eid, msig);
295  _cSignalRMS_FEDuTCA.fill(eid, rsig);
296  _cTimingMean_FEDuTCA.fill(eid, mtim);
297  _cTimingRMS_FEDuTCA.fill(eid, rtim);
298  }
299  }
300 }
301 
302 /* virtual */ void LaserTask::_process(edm::Event const& e,
303  edm::EventSetup const& es)
304 {
308 
309  if (!e.getByToken(_tokHBHE, chbhe))
310  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
311  + _tagHBHE.label() + " " + _tagHBHE.instance());
312  if (!e.getByToken(_tokHO, cho))
313  _logger.dqmthrow("Collection HODigiCollection isn't available "
314  + _tagHO.label() + " " + _tagHO.instance());
315  if (!e.getByToken(_tokHF, chf))
316  _logger.dqmthrow("Collection HFDigiCollection isn't available "
317  + _tagHF.label() + " " + _tagHF.instance());
318 
319 // int currentEvent = e.eventAuxiliary().id().event();
320 
321  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
322  it!=chbhe->end(); ++it)
323  {
324  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
325  double sumQ = utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
326  digi.size()-1);
327  if (sumQ<_lowHBHE)
328  continue;
329  HcalDetId did = digi.id();
330  HcalElectronicsId eid = digi.elecId();
331 
332  double aveTS = utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
333  digi.size()-1);
334  _xSignalSum.get(did)+=sumQ;
335  _xSignalSum2.get(did)+=sumQ*sumQ;
336  _xTimingSum.get(did)+=aveTS;
337  _xTimingSum2.get(did)+=aveTS*aveTS;
338  _xEntries.get(did)++;
339 
340  for (int i=0; i<digi.size(); i++)
341  _cShapeCut_FEDSlot.fill(eid, i,
342  digi.sample(i).nominal_fC()-2.5);
343 
344  // select based on local global
345  if (_ptype==fLocal)
346  {
347  int currentEvent = e.eventAuxiliary().id().event();
348  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
349  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
350  }
351  else
352  {
355  }
356  }
357  for (HODigiCollection::const_iterator it=cho->begin();
358  it!=cho->end(); ++it)
359  {
360  const HODataFrame digi = (const HODataFrame)(*it);
361  double sumQ = utilities::sumQ<HODataFrame>(digi, 8.5, 0,
362  digi.size()-1);
363  if (sumQ<_lowHO)
364  continue;
365  HcalDetId did = digi.id();
366  HcalElectronicsId eid = digi.elecId();
367 
368  double aveTS = utilities::aveTS<HODataFrame>(digi, 8.5, 0,
369  digi.size()-1);
370  _xSignalSum.get(did)+=sumQ;
371  _xSignalSum2.get(did)+=sumQ*sumQ;
372  _xTimingSum.get(did)+=aveTS;
373  _xTimingSum2.get(did)+=aveTS*aveTS;
374  _xEntries.get(did)++;
375 
376  for (int i=0; i<digi.size(); i++)
377  _cShapeCut_FEDSlot.fill(eid, i,
378  digi.sample(i).nominal_fC()-8.5);
379 
380  // select based on local global
381  if (_ptype==fLocal)
382  {
383  int currentEvent = e.eventAuxiliary().id().event();
384  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
385  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
386  }
387  else
388  {
391  }
392  }
393  for (HFDigiCollection::const_iterator it=chf->begin();
394  it!=chf->end(); ++it)
395  {
396  const HFDataFrame digi = (const HFDataFrame)(*it);
397  double sumQ = utilities::sumQ<HFDataFrame>(digi, 2.5, 0,
398  digi.size()-1);
399  if (sumQ<_lowHF)
400  continue;
401  HcalDetId did = digi.id();
402  HcalElectronicsId eid = digi.elecId();
403 
404  double aveTS = utilities::aveTS<HFDataFrame>(digi, 2.5, 0,
405  digi.size()-1);
406  _xSignalSum.get(did)+=sumQ;
407  _xSignalSum2.get(did)+=sumQ*sumQ;
408  _xTimingSum.get(did)+=aveTS;
409  _xTimingSum2.get(did)+=aveTS*aveTS;
410  _xEntries.get(did)++;
411 
412  for (int i=0; i<digi.size(); i++)
413  _cShapeCut_FEDSlot.fill(eid, i,
414  digi.sample(i).nominal_fC()-2.5);
415 
416  // select based on local global
417  if (_ptype==fLocal)
418  {
419  int currentEvent = e.eventAuxiliary().id().event();
420  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
421  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
422  }
423  else
424  {
427  }
428  }
429 
430  if (_ptype==fOnline && _evsTotal>0 &&
432  this->_dump();
433 }
434 
435 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e)
436 {
437  if (_ptype!=fOnline)
438  {
439  // local
441  if (!e.getByToken(_tokTrigger, ctrigger))
442  _logger.dqmthrow("Collection HcalTBTriggerData isn't available "
443  + _tagTrigger.label() + " " + _tagTrigger.instance());
444  return ctrigger->wasLaserTrigger();
445  }
446 
447  return false;
448 }
449 
451 
452 
ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:71
ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:91
EventNumber_t event() const
Definition: EventID.h:41
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:38
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
ContainerProf2D _cSignalMean_depth
Definition: LaserTask.h:90
double _lowHF
Definition: LaserTask.h:67
int const CRATE_VME_MIN
Definition: Constants.h:60
int ib
Definition: cuy.py:660
ContainerXXX< double > _xSignalSum
Definition: LaserTask.h:70
ContainerXXX< int > _xEntries
Definition: LaserTask.h:72
ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LaserTask.h:102
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
Container1D _cSignalMean_Subdet
Definition: LaserTask.h:77
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
double _lowHBHE
Definition: LaserTask.h:65
UpdateFreq
Definition: DQTask.h:17
virtual void _dump()
Definition: LaserTask.cc:233
Container1D _cTimingRMS_Subdet
Definition: LaserTask.h:80
std::vector< HBHEDataFrame >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:85
ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:86
Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:107
int const FIBER_VME_MIN
Definition: Constants.h:90
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: LaserTask.cc:33
void bookHistograms(fwlite::EventContainer &eventCont)
Container1D _cSignalRMS_Subdet
Definition: LaserTask.h:78
int const FIBERCH_MIN
Definition: Constants.h:100
edm::InputTag _tagHO
Definition: LaserTask.h:49
HcalElectronicsMap const * _emap
Definition: LaserTask.h:58
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
ContainerXXX< double > _xTimingSum2
Definition: LaserTask.h:74
edm::InputTag _tagHF
Definition: LaserTask.h:50
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:82
virtual void reset()
Definition: Container1D.cc:65
ContainerProf1D _cSignalvsEvent_SubdetPM
Definition: LaserTask.h:85
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0)
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
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)
Container2D _cMissing_depth
Definition: LaserTask.h:105
ContainerProf2D _cSignalRMS_FEDVME
Definition: LaserTask.h:99
int _nevents
Definition: LaserTask.h:64
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:53
HashFilter _filter_VME
Definition: LaserTask.h:61
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:70
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: LaserTask.h:54
ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:87
std::string _name
Definition: DQModule.h:57
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
double _lowHO
Definition: LaserTask.h:66
ContainerProf2D _cTimingRMS_FEDVME
Definition: LaserTask.h:101
virtual bool _isApplicable(edm::Event const &)
Definition: LaserTask.cc:435
int const CRATE_uTCA_MIN
Definition: Constants.h:65
electronicsmap::ElectronicsMap _ehashmap
Definition: LaserTask.h:59
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LaserTask.h:52
EventAuxiliary const & eventAuxiliary() const
Definition: Event.h:77
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: LaserTask.cc:302
int const CALIBEVENTS_MIN
Definition: Constants.h:211
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
edm::InputTag _tagHBHE
Definition: LaserTask.h:48
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:93
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:83
const T & get() const
Definition: EventSetup.h:56
RunAuxiliary const & runAuxiliary() const
Definition: Run.h:60
std::string const & label() const
Definition: InputTag.h:36
ContainerProf2D _cTimingRMS_depth
Definition: LaserTask.h:93
EventID const & id() const
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:243
Container1D _cTimingMean_Subdet
Definition: LaserTask.h:79
ContainerProf2D _cSignalMean_FEDuTCA
Definition: LaserTask.h:96
edm::EDGetTokenT< HcalTBTriggerData > _tokTrigger
Definition: LaserTask.h:55
ContainerXXX< double > _xTimingSum
Definition: LaserTask.h:73
edm::InputTag _tagTrigger
Definition: LaserTask.h:51
std::string _subsystem
Definition: DQModule.h:64
ContainerProf2D _cTimingMean_depth
Definition: LaserTask.h:92
Container2D _cMissing_FEDVME
Definition: LaserTask.h:106
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:85
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="")
HashFilter _filter_uTCA
Definition: LaserTask.h:60
ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LaserTask.h:100
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
ContainerProf1D _cTimingvsEvent_SubdetPM
Definition: LaserTask.h:84
ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:98
RunNumber_t run() const
Definition: RunAuxiliary.h:41
LaserTask(edm::ParameterSet const &)
Definition: LaserTask.cc:5
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:43
ContainerProf2D _cTimingMean_FEDVME
Definition: LaserTask.h:97
virtual void _resetMonitors(UpdateFreq)
Definition: LaserTask.cc:228
ContainerProf2D _cSignalMean_FEDVME
Definition: LaserTask.h:95
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:52