CMS 3D CMS Logo

LEDTask.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  // 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<QIE10DigiCollection>(_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  if (_ptype != fOffline) { // hidefed2crate
77  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
87  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
97  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
102  _cTimingMean_FEDuTCA.initialize(_name, "TimingMean",
107  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
112  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
117 
122  }
123 
124  _cSignalMean_depth.initialize(_name, "SignalMean",
129  _cSignalRMS_depth.initialize(_name, "SignalRMS",
134  _cTimingMean_depth.initialize(_name, "TimingMean",
139  _cTimingRMS_depth.initialize(_name, "TimingRMS",
144 
145  _cMissing_depth.initialize(_name, "Missing",
150  if (_ptype != fOffline) { // hidefed2crate
151  _cMissing_FEDVME.initialize(_name, "Missing",
161  }
162 
163  // initialize compact containers
169 
170  // BOOK
175 
180 
182  if (_ptype != fOffline) { // hidefed2crate
194  }
195 
201 
203 }
204 
206 {
207  DQTask::_resetMonitors(uf);
208 }
209 
210 /* virtual */ void LEDTask::_dump()
211 {
220 
221  if (_ptype != fOffline) { // hidefed2crate
230  }
231 
232  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
233  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
234  it!=dids.end(); ++it)
235  {
236  if (!it->isHcalDetId())
237  continue;
238  HcalDetId did = HcalDetId(it->rawId());
240  int n = _xEntries.get(did);
241  double msig = _xSignalSum.get(did)/n;
242  double mtim = _xTimingSum.get(did)/n;
243  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
244  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
245 
246  // channels missing or low signal
247  if (n==0)
248  {
249  _cMissing_depth.fill(did);
250  if (_ptype != fOffline) { // hidefed2crate
251  if (eid.isVMEid())
253  else
255  }
256  continue;
257  }
258  _cSignalMean_Subdet.fill(did, msig);
259  _cSignalMean_depth.fill(did, msig);
260  _cSignalRMS_Subdet.fill(did, rsig);
261  _cSignalRMS_depth.fill(did, rsig);
262  _cTimingMean_Subdet.fill(did, mtim);
263  _cTimingMean_depth.fill(did, mtim);
264  _cTimingRMS_Subdet.fill(did, rtim);
265  _cTimingRMS_depth.fill(did, rtim);
266  if (_ptype != fOffline) { // hidefed2crate
267  if (eid.isVMEid())
268  {
270  _cSignalRMS_FEDVME.fill(eid, rsig);
272  _cTimingRMS_FEDVME.fill(eid, rtim);
273  }
274  else
275  {
280  }
281  }
282  }
283 }
284 
285 /* virtual */ void LEDTask::_process(edm::Event const& e,
286  edm::EventSetup const& es)
287 {
291 
292  if (!e.getByToken(_tokHBHE, chbhe))
293  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
294  + _tagHBHE.label() + " " + _tagHBHE.instance());
295  if (!e.getByToken(_tokHO, cho))
296  _logger.dqmthrow("Collection HODigiCollection isn't available "
297  + _tagHO.label() + " " + _tagHO.instance());
298  if (!e.getByToken(_tokHF, chf))
299  _logger.dqmthrow("Collection QIE10DigiCollection isn't available "
300  + _tagHF.label() + " " + _tagHF.instance());
301 
302 // int currentEvent = e.eventAuxiliary().id().event();
303 
304  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
305  it!=chbhe->end(); ++it)
306  {
307  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
308  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
309  digi.size()-1);
310  if (sumQ<_lowHBHE)
311  continue;
312  HcalDetId did = digi.id();
313  HcalElectronicsId eid = digi.elecId();
314 
315  double aveTS = hcaldqm::utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
316  digi.size()-1);
317  _xSignalSum.get(did)+=sumQ;
318  _xSignalSum2.get(did)+=sumQ*sumQ;
319  _xTimingSum.get(did)+=aveTS;
320  _xTimingSum2.get(did)+=aveTS*aveTS;
321  _xEntries.get(did)++;
322 
323  if (_ptype != fOffline) { // hidefed2crate
324  for (int i=0; i<digi.size(); i++) {
325  _cShapeCut_FEDSlot.fill(eid, i,
326  digi.sample(i).nominal_fC()-2.5);
327  }
328  }
329  }
331  it!=cho->end(); ++it)
332  {
333  const HODataFrame digi = (const HODataFrame)(*it);
334  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0,
335  digi.size()-1);
336  if (sumQ<_lowHO)
337  continue;
338  HcalDetId did = digi.id();
339  HcalElectronicsId eid = digi.elecId();
340 
341  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0,
342  digi.size()-1);
343  _xSignalSum.get(did)+=sumQ;
344  _xSignalSum2.get(did)+=sumQ*sumQ;
345  _xTimingSum.get(did)+=aveTS;
346  _xTimingSum2.get(did)+=aveTS*aveTS;
347  _xEntries.get(did)++;
348 
349  if (_ptype != fOffline) { // hidefed2crate
350  for (int i=0; i<digi.size(); i++) {
351  _cShapeCut_FEDSlot.fill(eid, i,
352  digi.sample(i).nominal_fC()-8.5);
353  }
354  }
355  }
357  it!=chf->end(); ++it)
358  {
359  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
360  double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
361  if (sumQ<_lowHF)
362  continue;
363  HcalDetId did = digi.detid();
365 
366  double aveTS = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
367  _xSignalSum.get(did)+=sumQ;
368  _xSignalSum2.get(did)+=sumQ*sumQ;
369  _xTimingSum.get(did)+=aveTS;
370  _xTimingSum2.get(did)+=aveTS*aveTS;
371  _xEntries.get(did)++;
372 
373  if (_ptype != fOffline) { // hidefed2crate
374  for (int i = 0; i < digi.samples(); ++i) {
376  // Note: this used to be digi.sample(i).nominal_fC() - 2.5, but this branch doesn't exist in QIE10DataFrame.
377  // Instead, use lookup table.
378  }
379  }
380  }
381 
382  if (_ptype==fOnline && _evsTotal>0 &&
384  this->_dump();
385 }
386 
387 /* virtual */ bool LEDTask::_isApplicable(edm::Event const& e)
388 {
389  if (_ptype!=fOnline)
390  {
391  // local
393  if (!e.getByToken(_tokTrigger, ctrigger))
394  _logger.dqmthrow("Collection HcalTBTriggerData isn't available "
395  + _tagTrigger.label() + " " + _tagTrigger.instance());
396  return ctrigger->wasLEDTrigger();
397  }
398 
399  return false;
400 }
401 
403 
404 
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
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::Container2D _cMissing_FEDuTCA
Definition: LEDTask.h:100
hcaldqm::Container2D _cMissing_FEDVME
Definition: LEDTask.h:99
LEDTask(edm::ParameterSet const &)
Definition: LEDTask.cc:7
hcaldqm::ContainerProf2D _cSignalMean_depth
Definition: LEDTask.h:83
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LEDTask.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
int const CRATE_VME_MIN
Definition: Constants.h:68
double _lowHBHE
Definition: LEDTask.h:62
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
hcaldqm::ContainerProf2D _cTimingMean_depth
Definition: LEDTask.h:85
hcaldqm::ContainerProf2D _cSignalMean_FEDVME
Definition: LEDTask.h:88
hcaldqm::Container2D _cMissing_depth
Definition: LEDTask.h:98
bool wasLEDTrigger() const
returns true if this was a LED trigger
edm::EDGetTokenT< HcalTBTriggerData > _tokTrigger
Definition: LEDTask.h:53
virtual bool _isApplicable(edm::Event const &)
Definition: LEDTask.cc:387
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
double _lowHF
Definition: LEDTask.h:64
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LEDTask.h:50
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
hcaldqm::ContainerProf2D _cTimingMean_FEDVME
Definition: LEDTask.h:90
UpdateFreq
Definition: DQTask.h:17
std::vector< HBHEDataFrame >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:93
edm::InputTag _tagHO
Definition: LEDTask.h:47
const_iterator begin() const
hcaldqm::ContainerProf2D _cSignalRMS_FEDVME
Definition: LEDTask.h:92
edm::InputTag _tagHF
Definition: LEDTask.h:48
int const FIBER_VME_MIN
Definition: Constants.h:98
hcaldqm::filter::HashFilter _filter_uTCA
Definition: LEDTask.h:58
hcaldqm::ContainerXXX< int > _xEntries
Definition: LEDTask.h:69
void bookHistograms(fwlite::EventContainer &eventCont)
int const FIBERCH_MIN
Definition: Constants.h:108
virtual void _resetMonitors(hcaldqm::UpdateFreq)
Definition: LEDTask.cc:205
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LEDTask.h:70
hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LEDTask.h:93
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)
double _lowHO
Definition: LEDTask.h:63
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)
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: LEDTask.cc:285
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:101
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:70
edm::InputTag _tagTrigger
Definition: LEDTask.h:49
std::string _name
Definition: DQModule.h:57
hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA
Definition: LEDTask.h:89
hcaldqm::ContainerProf2D _cTimingRMS_depth
Definition: LEDTask.h:86
edm::EDGetTokenT< QIE10DigiCollection > _tokHF
Definition: LEDTask.h:52
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
hcaldqm::Container1D _cSignalRMS_Subdet
Definition: LEDTask.h:75
edm::InputTag _tagHBHE
Definition: LEDTask.h:46
hcaldqm::filter::HashFilter _filter_VME
Definition: LEDTask.h:59
int const CRATE_uTCA_MIN
Definition: Constants.h:73
const_iterator end() const
double const adc2fC[256]
Definition: Constants.h:229
int const CALIBEVENTS_MIN
Definition: Constants.h:222
hcaldqm::ContainerXXX< double > _xTimingSum2
Definition: LEDTask.h:71
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: LEDTask.cc:33
hcaldqm::ContainerProf2D _cTimingRMS_FEDVME
Definition: LEDTask.h:94
hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LEDTask.h:95
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LEDTask.h:51
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:99
hcaldqm::ContainerXXX< double > _xSignalSum
Definition: LEDTask.h:67
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
const T & get() const
Definition: EventSetup.h:56
hcaldqm::Container1D _cTimingMean_Subdet
Definition: LEDTask.h:76
RunAuxiliary const & runAuxiliary() const
Definition: Run.h:59
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LEDTask.h:84
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:249
hcaldqm::Container1D _cTimingRMS_Subdet
Definition: LEDTask.h:77
virtual void fill(HcalDetId const &) override
Definition: Container2D.cc:59
virtual void _dump()
Definition: LEDTask.cc:210
const HcalElectronicsMap * getHcalMapping() const
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LEDTask.h:68
HcalElectronicsMap const * _emap
Definition: LEDTask.h:56
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: LEDTask.h:57
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LEDTask.h:80
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="")
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
RunNumber_t run() const
Definition: RunAuxiliary.h:41
int const SLOT_uTCA_MIN
Definition: Constants.h:80
const_iterator begin() const
Definition: Run.h:42
ib
Definition: cuy.py:660
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LEDTask.h:74