CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<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 
122  _cSignalMean_depth.initialize(_name, "SignalMean",
127  _cSignalRMS_depth.initialize(_name, "SignalRMS",
132  _cTimingMean_depth.initialize(_name, "TimingMean",
137  _cTimingRMS_depth.initialize(_name, "TimingRMS",
142 
143  _cMissing_depth.initialize(_name, "Missing",
148  _cMissing_FEDVME.initialize(_name, "Missing",
158 
159 
160  // initialize compact containers
166 
167  // BOOK
172 
177 
186 
191 
197 
199 }
200 
202 {
203  DQTask::_resetMonitors(uf);
204 }
205 
206 /* virtual */ void LEDTask::_dump()
207 {
216 
225 
226  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
227  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
228  it!=dids.end(); ++it)
229  {
230  if (!it->isHcalDetId())
231  continue;
232  HcalDetId did = HcalDetId(it->rawId());
234  int n = _xEntries.get(did);
235  double msig = _xSignalSum.get(did)/n;
236  double mtim = _xTimingSum.get(did)/n;
237  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
238  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
239 
240  // channels missing or low signal
241  if (n==0)
242  {
243  _cMissing_depth.fill(did);
244  if (eid.isVMEid())
245  _cMissing_FEDVME.fill(eid);
246  else
247  _cMissing_FEDuTCA.fill(eid);
248  continue;
249  }
250  _cSignalMean_Subdet.fill(did, msig);
251  _cSignalMean_depth.fill(did, msig);
252  _cSignalRMS_Subdet.fill(did, rsig);
253  _cSignalRMS_depth.fill(did, rsig);
254  _cTimingMean_Subdet.fill(did, mtim);
255  _cTimingMean_depth.fill(did, mtim);
256  _cTimingRMS_Subdet.fill(did, rtim);
257  _cTimingRMS_depth.fill(did, rtim);
258  if (eid.isVMEid())
259  {
260  _cSignalMean_FEDVME.fill(eid, msig);
261  _cSignalRMS_FEDVME.fill(eid, rsig);
262  _cTimingMean_FEDVME.fill(eid, mtim);
263  _cTimingRMS_FEDVME.fill(eid, rtim);
264  }
265  else
266  {
267  _cSignalMean_FEDuTCA.fill(eid, msig);
268  _cSignalRMS_FEDuTCA.fill(eid, rsig);
269  _cTimingMean_FEDuTCA.fill(eid, mtim);
270  _cTimingRMS_FEDuTCA.fill(eid, rtim);
271  }
272  }
273 }
274 
275 /* virtual */ void LEDTask::_process(edm::Event const& e,
276  edm::EventSetup const& es)
277 {
281 
282  if (!e.getByToken(_tokHBHE, chbhe))
283  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
284  + _tagHBHE.label() + " " + _tagHBHE.instance());
285  if (!e.getByToken(_tokHO, cho))
286  _logger.dqmthrow("Collection HODigiCollection isn't available "
287  + _tagHO.label() + " " + _tagHO.instance());
288  if (!e.getByToken(_tokHF, chf))
289  _logger.dqmthrow("Collection HFDigiCollection isn't available "
290  + _tagHF.label() + " " + _tagHF.instance());
291 
292 // int currentEvent = e.eventAuxiliary().id().event();
293 
294  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
295  it!=chbhe->end(); ++it)
296  {
297  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
298  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
299  digi.size()-1);
300  if (sumQ<_lowHBHE)
301  continue;
302  HcalDetId did = digi.id();
303  HcalElectronicsId eid = digi.elecId();
304 
305  double aveTS = hcaldqm::utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
306  digi.size()-1);
307  _xSignalSum.get(did)+=sumQ;
308  _xSignalSum2.get(did)+=sumQ*sumQ;
309  _xTimingSum.get(did)+=aveTS;
310  _xTimingSum2.get(did)+=aveTS*aveTS;
311  _xEntries.get(did)++;
312 
313  for (int i=0; i<digi.size(); i++)
314  _cShapeCut_FEDSlot.fill(eid, i,
315  digi.sample(i).nominal_fC()-2.5);
316  }
317  for (HODigiCollection::const_iterator it=cho->begin();
318  it!=cho->end(); ++it)
319  {
320  const HODataFrame digi = (const HODataFrame)(*it);
321  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0,
322  digi.size()-1);
323  if (sumQ<_lowHO)
324  continue;
325  HcalDetId did = digi.id();
326  HcalElectronicsId eid = digi.elecId();
327 
328  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0,
329  digi.size()-1);
330  _xSignalSum.get(did)+=sumQ;
331  _xSignalSum2.get(did)+=sumQ*sumQ;
332  _xTimingSum.get(did)+=aveTS;
333  _xTimingSum2.get(did)+=aveTS*aveTS;
334  _xEntries.get(did)++;
335 
336  for (int i=0; i<digi.size(); i++)
337  _cShapeCut_FEDSlot.fill(eid, i,
338  digi.sample(i).nominal_fC()-8.5);
339  }
340  for (HFDigiCollection::const_iterator it=chf->begin();
341  it!=chf->end(); ++it)
342  {
343  const HFDataFrame digi = (const HFDataFrame)(*it);
344  double sumQ = hcaldqm::utilities::sumQ<HFDataFrame>(digi, 2.5, 0,
345  digi.size()-1);
346  if (sumQ<_lowHF)
347  continue;
348  HcalDetId did = digi.id();
349  HcalElectronicsId eid = digi.elecId();
350 
351  double aveTS = hcaldqm::utilities::aveTS<HFDataFrame>(digi, 2.5, 0,
352  digi.size()-1);
353  _xSignalSum.get(did)+=sumQ;
354  _xSignalSum2.get(did)+=sumQ*sumQ;
355  _xTimingSum.get(did)+=aveTS;
356  _xTimingSum2.get(did)+=aveTS*aveTS;
357  _xEntries.get(did)++;
358 
359  for (int i=0; i<digi.size(); i++)
360  _cShapeCut_FEDSlot.fill(eid, i,
361  digi.sample(i).nominal_fC()-2.5);
362  }
363 
364  if (_ptype==fOnline && _evsTotal>0 &&
366  this->_dump();
367 }
368 
369 /* virtual */ bool LEDTask::_isApplicable(edm::Event const& e)
370 {
371  if (_ptype!=fOnline)
372  {
373  // local
375  if (!e.getByToken(_tokTrigger, ctrigger))
376  _logger.dqmthrow("Collection HcalTBTriggerData isn't available "
377  + _tagTrigger.label() + " " + _tagTrigger.instance());
378  return ctrigger->wasLEDTrigger();
379  }
380 
381  return false;
382 }
383 
385 
386 
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::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:60
double _lowHBHE
Definition: LEDTask.h:62
int ib
Definition: cuy.py:660
hcaldqm::ContainerProf2D _cTimingMean_depth
Definition: LEDTask.h:85
hcaldqm::ContainerProf2D _cSignalMean_FEDVME
Definition: LEDTask.h:88
hcaldqm::Container2D _cMissing_depth
Definition: LEDTask.h:98
edm::EDGetTokenT< HcalTBTriggerData > _tokTrigger
Definition: LEDTask.h:53
virtual bool _isApplicable(edm::Event const &)
Definition: LEDTask.cc:369
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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:85
edm::InputTag _tagHO
Definition: LEDTask.h:47
hcaldqm::ContainerProf2D _cSignalRMS_FEDVME
Definition: LEDTask.h:92
edm::InputTag _tagHF
Definition: LEDTask.h:48
int const FIBER_VME_MIN
Definition: Constants.h:90
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:100
virtual void _resetMonitors(hcaldqm::UpdateFreq)
Definition: LEDTask.cc:201
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LEDTask.h:70
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
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:275
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
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
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:65
int const CALIBEVENTS_MIN
Definition: Constants.h:214
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
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LEDTask.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::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:60
std::string const & label() const
Definition: InputTag.h:36
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 _dump()
Definition: LEDTask.cc:206
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LEDTask.h:68
HcalElectronicsMap const * _emap
Definition: LEDTask.h:56
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: LEDTask.h:52
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="")
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:72
Definition: Run.h:43
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