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;
6  DQTask(ps)
7 {
8  // tags
10  edm::InputTag("hcalDigis"));
12  edm::InputTag("hcalDigis"));
14  edm::InputTag("hcalDigis"));
16  edm::InputTag("tbunpacker"));
17  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
18  _tokHO = consumes<HODigiCollection>(_tagHO);
19  _tokHF = consumes<HFDigiCollection>(_tagHF);
20  _tokTrigger = consumes<HcalTBTriggerData>(_tagTrigger);
21 
22  // constants
23  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE",
24  20);
25  _lowHO = ps.getUntrackedParameter<double>("lowHO",
26  20);
27  _lowHF = ps.getUntrackedParameter<double>("lowHF",
28  20);
29 }
30 
32  edm::Run const& r, edm::EventSetup const& es)
33 {
34  if (_ptype==fLocal)
35  if (r.runAuxiliary().run()==1)
36  return;
37 
38  DQTask::bookHistograms(ib, r, es);
39 
41  es.get<HcalDbRecord>().get(dbService);
42  _emap = dbService->getHcalMapping();
43 
44  std::vector<uint32_t> vhashVME;
45  std::vector<uint32_t> vhashuTCA;
46  std::vector<uint32_t> vhashC36;
47  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
49  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
50  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
52  vhashVME);
54  vhashuTCA);
55 
56  // INITIALIZE
57  _cSignalMean_Subdet.initialize(_name, "SignalMean",
61  _cSignalRMS_Subdet.initialize(_name, "SignalRMS",
65  _cTimingMean_Subdet.initialize(_name, "TimingMean",
69  _cTimingRMS_Subdet.initialize(_name, "TimingRMS",
73 
74  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
84  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
94  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
104  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
109  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
114 
119 
120  _cSignalMean_depth.initialize(_name, "SignalMean",
125  _cSignalRMS_depth.initialize(_name, "SignalRMS",
130  _cTimingMean_depth.initialize(_name, "TimingMean",
135  _cTimingRMS_depth.initialize(_name, "TimingRMS",
140 
141  _cMissing_depth.initialize(_name, "Missing",
146  _cMissing_FEDVME.initialize(_name, "Missing",
156 
157 
158  // initialize compact containers
164 
165  // BOOK
170 
175 
184 
189 
195 
197 }
198 
199 /* virtual */ void LEDTask::_resetMonitors(UpdateFreq uf)
200 {
201  DQTask::_resetMonitors(uf);
202 }
203 
204 /* virtual */ void LEDTask::_dump()
205 {
214 
223 
224  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
225  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
226  it!=dids.end(); ++it)
227  {
228  if (!it->isHcalDetId())
229  continue;
230  HcalDetId did = HcalDetId(it->rawId());
232  int n = _xEntries.get(did);
233  double msig = _xSignalSum.get(did)/n;
234  double mtim = _xTimingSum.get(did)/n;
235  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
236  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
237 
238  // channels missing or low signal
239  if (n==0)
240  {
241  _cMissing_depth.fill(did);
242  if (eid.isVMEid())
243  _cMissing_FEDVME.fill(eid);
244  else
245  _cMissing_FEDuTCA.fill(eid);
246  continue;
247  }
248  _cSignalMean_Subdet.fill(did, msig);
249  _cSignalMean_depth.fill(did, msig);
250  _cSignalRMS_Subdet.fill(did, rsig);
251  _cSignalRMS_depth.fill(did, rsig);
252  _cTimingMean_Subdet.fill(did, mtim);
253  _cTimingMean_depth.fill(did, mtim);
254  _cTimingRMS_Subdet.fill(did, rtim);
255  _cTimingRMS_depth.fill(did, rtim);
256  if (eid.isVMEid())
257  {
258  _cSignalMean_FEDVME.fill(eid, msig);
259  _cSignalRMS_FEDVME.fill(eid, rsig);
260  _cTimingMean_FEDVME.fill(eid, mtim);
261  _cTimingRMS_FEDVME.fill(eid, rtim);
262  }
263  else
264  {
265  _cSignalMean_FEDuTCA.fill(eid, msig);
266  _cSignalRMS_FEDuTCA.fill(eid, rsig);
267  _cTimingMean_FEDuTCA.fill(eid, mtim);
268  _cTimingRMS_FEDuTCA.fill(eid, rtim);
269  }
270  }
271 }
272 
273 /* virtual */ void LEDTask::_process(edm::Event const& e,
274  edm::EventSetup const& es)
275 {
279 
280  if (!e.getByToken(_tokHBHE, chbhe))
281  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
282  + _tagHBHE.label() + " " + _tagHBHE.instance());
283  if (!e.getByToken(_tokHO, cho))
284  _logger.dqmthrow("Collection HODigiCollection isn't available "
285  + _tagHO.label() + " " + _tagHO.instance());
286  if (!e.getByToken(_tokHF, chf))
287  _logger.dqmthrow("Collection HFDigiCollection isn't available "
288  + _tagHF.label() + " " + _tagHF.instance());
289 
290 // int currentEvent = e.eventAuxiliary().id().event();
291 
292  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
293  it!=chbhe->end(); ++it)
294  {
295  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
296  double sumQ = utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
297  digi.size()-1);
298  if (sumQ<_lowHBHE)
299  continue;
300  HcalDetId did = digi.id();
301  HcalElectronicsId eid = digi.elecId();
302 
303  double aveTS = utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
304  digi.size()-1);
305  _xSignalSum.get(did)+=sumQ;
306  _xSignalSum2.get(did)+=sumQ*sumQ;
307  _xTimingSum.get(did)+=aveTS;
308  _xTimingSum2.get(did)+=aveTS*aveTS;
309  _xEntries.get(did)++;
310 
311  for (int i=0; i<digi.size(); i++)
312  _cShapeCut_FEDSlot.fill(eid, i,
313  digi.sample(i).nominal_fC()-2.5);
314  }
315  for (HODigiCollection::const_iterator it=cho->begin();
316  it!=cho->end(); ++it)
317  {
318  const HODataFrame digi = (const HODataFrame)(*it);
319  double sumQ = utilities::sumQ<HODataFrame>(digi, 8.5, 0,
320  digi.size()-1);
321  if (sumQ<_lowHO)
322  continue;
323  HcalDetId did = digi.id();
324  HcalElectronicsId eid = digi.elecId();
325 
326  double aveTS = utilities::aveTS<HODataFrame>(digi, 8.5, 0,
327  digi.size()-1);
328  _xSignalSum.get(did)+=sumQ;
329  _xSignalSum2.get(did)+=sumQ*sumQ;
330  _xTimingSum.get(did)+=aveTS;
331  _xTimingSum2.get(did)+=aveTS*aveTS;
332  _xEntries.get(did)++;
333 
334  for (int i=0; i<digi.size(); i++)
335  _cShapeCut_FEDSlot.fill(eid, i,
336  digi.sample(i).nominal_fC()-8.5);
337  }
338  for (HFDigiCollection::const_iterator it=chf->begin();
339  it!=chf->end(); ++it)
340  {
341  const HFDataFrame digi = (const HFDataFrame)(*it);
342  double sumQ = utilities::sumQ<HFDataFrame>(digi, 2.5, 0,
343  digi.size()-1);
344  if (sumQ<_lowHF)
345  continue;
346  HcalDetId did = digi.id();
347  HcalElectronicsId eid = digi.elecId();
348 
349  double aveTS = utilities::aveTS<HFDataFrame>(digi, 2.5, 0,
350  digi.size()-1);
351  _xSignalSum.get(did)+=sumQ;
352  _xSignalSum2.get(did)+=sumQ*sumQ;
353  _xTimingSum.get(did)+=aveTS;
354  _xTimingSum2.get(did)+=aveTS*aveTS;
355  _xEntries.get(did)++;
356 
357  for (int i=0; i<digi.size(); i++)
358  _cShapeCut_FEDSlot.fill(eid, i,
359  digi.sample(i).nominal_fC()-2.5);
360  }
361 
362  if (_ptype==fOnline && _evsTotal>0 &&
364  this->_dump();
365 }
366 
367 /* virtual */ bool LEDTask::_isApplicable(edm::Event const& e)
368 {
369  if (_ptype!=fOnline)
370  {
371  // local
373  if (!e.getByToken(_tokTrigger, ctrigger))
374  _logger.dqmthrow("Collection HcalTBTriggerData isn't available "
375  + _tagTrigger.label() + " " + _tagTrigger.instance());
376  return ctrigger->wasLEDTrigger();
377  }
378 
379  return false;
380 }
381 
383 
384 
Container2D _cMissing_depth
Definition: LEDTask.h:100
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
LEDTask(edm::ParameterSet const &)
Definition: LEDTask.cc:5
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:64
int ib
Definition: cuy.py:660
ContainerProf2D _cSignalMean_FEDVME
Definition: LEDTask.h:90
virtual void _resetMonitors(UpdateFreq)
Definition: LEDTask.cc:199
edm::EDGetTokenT< HcalTBTriggerData > _tokTrigger
Definition: LEDTask.h:55
virtual bool _isApplicable(edm::Event const &)
Definition: LEDTask.cc:367
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
double _lowHF
Definition: LEDTask.h:66
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LEDTask.h:52
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LEDTask.h:95
UpdateFreq
Definition: DQTask.h:17
ContainerProf2D _cSignalMean_depth
Definition: LEDTask.h:85
std::vector< HBHEDataFrame >::const_iterator const_iterator
int const SPIGOT_MIN
Definition: Constants.h:85
edm::InputTag _tagHO
Definition: LEDTask.h:49
edm::InputTag _tagHF
Definition: LEDTask.h:50
int const FIBER_VME_MIN
Definition: Constants.h:90
void bookHistograms(fwlite::EventContainer &eventCont)
int const FIBERCH_MIN
Definition: Constants.h:100
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
ContainerXXX< double > _xSignalSum
Definition: LEDTask.h:69
ContainerXXX< int > _xEntries
Definition: LEDTask.h:71
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:82
ContainerProf1D _cShapeCut_FEDSlot
Definition: LEDTask.h:82
virtual void reset()
Definition: Container1D.cc:65
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0)
ContainerProf2D _cSignalRMS_FEDVME
Definition: LEDTask.h:94
Container2D _cMissing_FEDuTCA
Definition: LEDTask.h:102
double _lowHO
Definition: LEDTask.h:65
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_FEDVME
Definition: LEDTask.h:101
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: LEDTask.cc:273
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:51
std::string _name
Definition: DQModule.h:57
Container1D _cSignalRMS_Subdet
Definition: LEDTask.h:77
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
edm::InputTag _tagHBHE
Definition: LEDTask.h:48
ContainerXXX< double > _xTimingSum2
Definition: LEDTask.h:73
int const CRATE_uTCA_MIN
Definition: Constants.h:65
HashFilter _filter_uTCA
Definition: LEDTask.h:60
ContainerProf2D _cTimingMean_FEDuTCA
Definition: LEDTask.h:93
int const CALIBEVENTS_MIN
Definition: Constants.h:211
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: LEDTask.cc:31
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
HashFilter _filter_VME
Definition: LEDTask.h:61
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LEDTask.h:53
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
ContainerProf2D _cTimingMean_FEDVME
Definition: LEDTask.h:92
ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LEDTask.h:97
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
RunAuxiliary const & runAuxiliary() const
Definition: Run.h:60
ContainerProf2D _cTimingRMS_depth
Definition: LEDTask.h:88
ContainerProf2D _cTimingMean_depth
Definition: LEDTask.h:87
std::string const & label() const
Definition: InputTag.h:36
ContainerProf2D _cSignalRMS_depth
Definition: LEDTask.h:86
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:243
ContainerXXX< double > _xTimingSum
Definition: LEDTask.h:72
virtual void _dump()
Definition: LEDTask.cc:204
std::string _subsystem
Definition: DQModule.h:64
HcalElectronicsMap const * _emap
Definition: LEDTask.h:58
ContainerXXX< double > _xSignalSum2
Definition: LEDTask.h:70
edm::EDGetTokenT< HFDigiCollection > _tokHF
Definition: LEDTask.h:54
Container1D _cSignalMean_Subdet
Definition: LEDTask.h:76
Container1D _cTimingRMS_Subdet
Definition: LEDTask.h:79
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="")
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
ContainerProf2D _cTimingRMS_FEDVME
Definition: LEDTask.h:96
Container1D _cTimingMean_Subdet
Definition: LEDTask.h:78
RunNumber_t run() const
Definition: RunAuxiliary.h:41
electronicsmap::ElectronicsMap _ehashmap
Definition: LEDTask.h:59
int const SLOT_uTCA_MIN
Definition: Constants.h:72
ContainerProf2D _cSignalMean_FEDuTCA
Definition: LEDTask.h:91
Definition: Run.h:43
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:52