CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecHitTask.cc
Go to the documentation of this file.
1 
3 
4  using namespace hcaldqm;
6  DQTask(ps)
7  {
8  // Energy
9  _cEnergy_SubDet.initialize(_name+"/Energy/SubDet", "Energy", mapper::fSubDet,
12  _cEnergyvsieta_SubDet.initialize(_name+"/Energy/vsieta_SubDet", "Energyvsieta",
16  _cEnergyvsiphi_SubDet.initialize(_name+"/Energy/vsiphi_SubDet", "Energyvsiphi",
20  _cEnergy_depth.initialize(_name+"/Energy/depth", "Energy",
25  _cEnergyvsietaCut_SubDet.initialize(_name+"/Energy/vsieta_SubDet", "Energyvsieta",
29  _cEnergyvsiphiCut_SubDet.initialize(_name+"/Energy/vsiphi_SubDet", "Energyvsiphi",
33  _cEnergyCut_depth.initialize(_name+"/Energy/depth", "Energy",
38 
39  // Timing
40  _cTimingCut_SubDet.initialize(_name+"/Timing/SubDet", "Timing", mapper::fSubDet,
43  _cTimingCut_SubDetPM_iphi.initialize(_name+"/Timing/SubDetPM_iphi", "Timing",
47  _cTimingCut_depth.initialize(_name+"/Timing/depth", "Timing",
52  _cTimingCut_HBHEPrt.initialize(_name+"/Timing/HBHEPartition", "Timing",
56 
57  // Occupancy
58  _cOccupancy_depth.initialize(_name+"/Occupancy/depth", "Occupancy", mapper::fdepth,
62  _cOccupancyvsLS_SubDet.initialize(_name+"/Occupancy/vsLS_SubDet", "Occupancy",
66  _cOccupancyCutvsLS_SubDet.initialize(_name+"/Occupancy/vsLS_SubDet", "Occupancy",
70  _cOccupancyCut_depth.initialize(_name+"/Occupancy/depth", "Occupancy",
75  _cOccupancyvsiphi_SubDetPM.initialize(_name+"/Occupancy/vsiphi_SubDetPM",
76  "Occupancy", mapper::fSubDetPM,
79  _cOccupancyCutvsiphi_SubDetPM.initialize(_name+"/Occupancy/vsiphi_SubDetPM",
80  "Occupancy", mapper::fSubDetPM,
83 
84  // Energy vs Timing
85  if (this->_ptype!=fOffline)
86  {
87  // these plots are too consuming and will only show up for
88  // Online/Playback processing
89  _cEnergy_SubDet_ieta.initialize(_name+"/Energy/SubDet_ieta", "Energy",
93  _cEnergy_SubDetPM_iphi.initialize(_name+"/Energy/SubDetPM_iphi",
94  "Energy", mapper::fSubDetPM_iphi,
97  _cTimingCutvsLS_SubDetPM_iphi.initialize(_name+"/Timing/vsLS_SubDetPM_iphi",
98  "Timing", mapper::fSubDetPM_iphi,
101  _cTimingCut_SubDet_ieta.initialize(_name+"/Timing/SubDet_ieta", "Timing",
105  _cTimingvsietaCut_SubDet_iphi.initialize(_name+"/Timing/vsieta_SubDet_iphi",
106  "Timing",
110  _cTimingvsiphiCut_SubDet_ieta.initialize(_name+"/Timing/vsiphi_SubDet_ieta",
111  "Timing",
116  _name+"/TimingvsEnergy/SubDetPM_iphi",
117  "TimingvsEnergy", mapper::fSubDetPM_iphi,
121  }
122 
123  // Summary
124  _cSummary.initialize(_name+"/Summary", "Summary",
126  new axis::FlagAxis(axis::fYaxis, "Flag", int(nRecHitFlag)));
127  _cSummaryvsLS_SubDet.initialize(_name+"/Summary/vsLS_SubDet", "SummaryvsLS",
130  new axis::FlagAxis(axis::fYaxis, "Flag", int(nRecHitFlag)));
131 
132  // tags
134  edm::InputTag("hbhereco"));
136  edm::InputTag("horeco"));
138  edm::InputTag("hfreco"));
139  _tokHBHE = consumes<HBHERecHitCollection>(_tagHBHE);
140  _tokHO = consumes<HORecHitCollection>(_tagHO);
141  _tokHF = consumes<HFRecHitCollection>(_tagHF);
142 
143  // cuts
144  _cutE_HBHE = ps.getUntrackedParameter<double>("cutE_HBHE", 5);
145  _cutE_HO = ps.getUntrackedParameter<double>("cutE_HO", 5);
146  _cutE_HF = ps.getUntrackedParameter<double>("cutE_HF", 5);
147 
148  // load labels
149  _fNames.push_back("Low Occupancy");
150  _fNames.push_back("iphi Uniformity");
151  _fNames.push_back("HBHE Partition Timing");
154  }
155 
157  edm::Run const& r, edm::EventSetup const& es)
158  {
159  DQTask::bookHistograms(ib, r, es);
160  char cutstr[200];
161  sprintf(cutstr, "_EHBHE%dHO%dHF%d", int(_cutE_HBHE),
162  int(_cutE_HO), int(_cutE_HF));
163 
164  _cEnergy_SubDet.book(ib);
167  _cEnergy_depth.book(ib);
168 
172 
177 
184 
185  if (this->_ptype!=fOffline)
186  {
187  // Book the following histograms only when you are running not
188  // Offline
196  }
197 
198  _cSummary.book(ib);
200  }
201 
202  /* virtual */ void RecHitTask::_process(edm::Event const& e,
203  edm::EventSetup const& es)
204  {
208 
209  if (!(e.getByToken(_tokHBHE, chbhe)))
210  _logger.dqmthrow("Collection HBHERecHitCollection not available "
211  + _tagHBHE.label() + " " + _tagHBHE.instance());
212  if (!(e.getByToken(_tokHO, cho)))
213  _logger.dqmthrow("Collection HORecHitCollection not available "
214  + _tagHO.label() + " " + _tagHO.instance());
215  if (!(e.getByToken(_tokHF, chf)))
216  _logger.dqmthrow("Collection HFRecHitCollection not available "
217  + _tagHF.label() + " " + _tagHF.instance());
218 
219  // Processing
220  for (HBHERecHitCollection::const_iterator it=chbhe->begin();
221  it!=chbhe->end(); ++it)
222  {
223  const HBHERecHit rh = (const HBHERecHit)(*it);
224  double energy = rh.energy();
225  double time = rh.time();
226  const HcalDetId did = rh.id();
227 
228  _cEnergy_SubDet.fill(did, energy);
229  _cEnergyvsieta_SubDet.fill(did, energy);
230  _cEnergyvsiphi_SubDet.fill(did, energy);
231  _cEnergy_depth.fill(did, energy);
232 
233  _cOccupancy_depth.fill(did);
235  _nRecHits[did.subdet()-1]++;
236 
237  if (this->_ptype!=fOffline)
238  {
239  _cEnergy_SubDet_ieta.fill(did, energy);
240  _cEnergy_SubDetPM_iphi.fill(did, energy);
241  }
242 
243  if (energy>_cutE_HBHE)
244  {
245  _cEnergyCut_depth.fill(did, energy);
246  _cEnergyvsietaCut_SubDet.fill(did, energy);
247  _cEnergyvsiphiCut_SubDet.fill(did, energy);
248  _cEnergyCut_depth.fill(did, energy);
249  _cTimingCut_SubDet.fill(did, time);
250  _cTimingCut_SubDetPM_iphi.fill(did, time);
251  _cTimingCut_depth.fill(did, time);
254  _nRecHitsCut[did.subdet()-1]++;
255  _cTimingCut_HBHEPrt.fill(did, time);
256 
257  if (this->_ptype!=fOffline)
258  {
259  // fill the following plots only when we aren't in Offline
260  //
261  _cTimingvsEnergyCut_SubDetPM_iphi.fill(did, energy, time);
263  _cTimingCut_SubDet_ieta.fill(did, time);
266  }
267  }
268  }
269  for (HORecHitCollection::const_iterator it=cho->begin();
270  it!=cho->end(); ++it)
271  {
272  const HORecHit rh = (const HORecHit)(*it);
273  double energy = rh.energy();
274  double time = rh.time();
275  const HcalDetId did = rh.id();
276 
277  _cEnergy_SubDet.fill(did, energy);
278  _cEnergyvsieta_SubDet.fill(did, energy);
279  _cEnergyvsiphi_SubDet.fill(did, energy);
280  _cEnergy_depth.fill(did, energy);
281 
282  _cOccupancy_depth.fill(did);
284  _nRecHits[did.subdet()-1]++;
285 
286  if (this->_ptype!=fOffline)
287  {
288  _cEnergy_SubDet_ieta.fill(did, energy);
289  _cEnergy_SubDetPM_iphi.fill(did, energy);
290  }
291 
292  if (energy>_cutE_HO)
293  {
294  _cEnergyCut_depth.fill(did, energy);
295  _cEnergyvsietaCut_SubDet.fill(did, energy);
296  _cEnergyvsiphiCut_SubDet.fill(did, energy);
297  _cEnergyCut_depth.fill(did, energy);
298  _cTimingCut_SubDet.fill(did, time);
299  _cTimingCut_SubDetPM_iphi.fill(did, time);
300  _cTimingCut_depth.fill(did, time);
303  _nRecHitsCut[did.subdet()-1]++;
304 
305  if (this->_ptype!=fOffline)
306  {
307  // Fill the following plots only when you are running not
308  // Offline
309  _cTimingvsEnergyCut_SubDetPM_iphi.fill(did, energy, time);
311  _cTimingCut_SubDet_ieta.fill(did, time);
314  }
315  }
316  }
317  for (HFRecHitCollection::const_iterator it=chf->begin();
318  it!=chf->end(); ++it)
319  {
320  const HFRecHit rh = (const HFRecHit)(*it);
321  double energy = rh.energy();
322  double time = rh.time();
323  const HcalDetId did = rh.id();
324 
325  _cEnergy_SubDet.fill(did, energy);
326  _cEnergyvsieta_SubDet.fill(did, energy);
327  _cEnergyvsiphi_SubDet.fill(did, energy);
328  _cEnergy_depth.fill(did, energy);
329 
330  _cOccupancy_depth.fill(did);
332  _nRecHits[did.subdet()-1]++;
333 
334  if (this->_ptype!=fOffline)
335  {
336  _cEnergy_SubDet_ieta.fill(did, energy);
337  _cEnergy_SubDetPM_iphi.fill(did, energy);
338  }
339 
340  if (energy>_cutE_HF)
341  {
342  _cEnergyCut_depth.fill(did, energy);
343  _cEnergyvsietaCut_SubDet.fill(did, energy);
344  _cEnergyvsiphiCut_SubDet.fill(did, energy);
345  _cEnergyCut_depth.fill(did, energy);
346  _cTimingCut_SubDet.fill(did, time);
347  _cTimingCut_SubDetPM_iphi.fill(did, time);
348  _cTimingCut_depth.fill(did, time);
351  _nRecHitsCut[did.subdet()-1]++;
352 
353  if (this->_ptype!=fOffline)
354  {
355  // Fill the following plots only when processing not
356  // Offline
357  _cTimingvsEnergyCut_SubDetPM_iphi.fill(did, energy, time);
359  _cTimingCut_SubDet_ieta.fill(did, time);
362  }
363  }
364  }
365 
367  _currentLS, _nRecHits[0]);
371  _currentLS, _nRecHits[1]);
375  _currentLS, _nRecHits[2]);
379  _currentLS, _nRecHits[3]);
382  }
383 
384  /* virtual */ void RecHitTask::_resetMonitors(UpdateFreq uf)
385  {
386  switch(uf)
387  {
388  case fEvent:
389  for (unsigned int i=0; i<constants::SUBDET_NUM; i++)
390  {
391  _nRecHits[i] = 0;
392  _nRecHitsCut[i] = 0;
393  }
394  break;
395  default:
396  break;
397  }
398  DQTask::_resetMonitors(uf);
399  }
400 
402  edm::EventSetup const& es)
403 {
404  // statuses
405  // By default all the flags are set as NOT APPLICABLE
407  for (unsigned int i=0; i<constants::SUBDET_NUM; i++)
408  for (int j=fLowOcp; j<nRecHitFlag; j++)
409  status[i][j] = constants::NOT_APPLICABLE;
410 
411  /*
412  * Do the checks here
413  * -> HF Digi Occupancy
414  * -> iphi Uniformity
415  */
417  double numChs = meocpHF->getBinContent(_currentLS);
418  if (constants::CHS_NUM[3] - numChs>=48)
419  status[3][fLowOcp] = constants::VERY_LOW;
420  else if (constants::CHS_NUM[3]-numChs>=24)
421  status[3][fLowOcp] = constants::LOW;
422  else if (constants::CHS_NUM[3]-numChs>=10)
423  status[3][fLowOcp] = constants::LOW;
424  else if (constants::CHS_NUM[3] - numChs>=1)
425  status[3][fLowOcp] = constants::PROBLEMATIC;
426  else if (constants::CHS_NUM[3]-numChs<0)
427  status[3][fLowOcp] = constants::PROBLEMATIC;
428  else if (constants::CHS_NUM[3]==numChs)
429  status[3][fLowOcp] = constants::GOOD;
430 
431  // Check HF uniformity vs iphi
432  for (int i=0; i<IPHI_NUM; i+=4)
433  {
434  int i1 = (IPHI_NUM-1+i)%IPHI_NUM;
435  int i2 = (IPHI_NUM-1+2+i)%IPHI_NUM;
436  int j1 = (IPHI_NUM-1+4+i)%IPHI_NUM;
437  int j2 = (IPHI_NUM-1+6+i)%IPHI_NUM;
438 
439  double occ1_m = _cOccupancyCutvsiphi_SubDetPM.getBinContent(6, i1) +
441  double occ2_m = _cOccupancyCutvsiphi_SubDetPM.getBinContent(6, j1) +
443  double ratio_m = std::min(occ1_m, occ2_m)/std::max(occ1_m, occ2_m);
444  double occ1_p = _cOccupancyCutvsiphi_SubDetPM.getBinContent(7, i1) +
446  double occ2_p = _cOccupancyCutvsiphi_SubDetPM.getBinContent(7, j1) +
448  double ratio_p = std::min(occ1_p, occ2_p)/std::max(occ1_p, occ2_p);
449 
450  if (ratio_m<0.8 || ratio_p<0.8)
451  {
452  // set and exit
453  status[3][fUniphi] = constants::VERY_LOW;
454  break;
455  }
456  else
457  status[3][fUniphi] = constants::GOOD;
458  }
459 
460  // Check the shifts between HBHEabc partitions
461  // Currently, we use 1.5 ns threshold
462  double mean_A = _cTimingCut_HBHEPrt.at(0)->getMean();
463  double mean_B = _cTimingCut_HBHEPrt.at(1)->getMean();
464  double mean_C = _cTimingCut_HBHEPrt.at(2)->getMean();
465 
466  double diff_AB = abs(mean_A - mean_B);
467  double diff_AC = abs(mean_A - mean_C);
468  double diff_BC = abs(mean_B - mean_C);
469 
470  if (diff_AB>=1.5 || diff_AC>=1.5 || diff_BC>=1.5)
471  {
472  status[0][fTCDS] = constants::LOW;
473  status[1][fTCDS] = constants::LOW;
474  }
475  else
476  {
477  status[0][fTCDS] = constants::GOOD;
478  status[1][fTCDS] = constants::GOOD;
479  }
480 
481  // fill the statuses in the end
482  for (unsigned int i=0; i<constants::SUBDET_NUM; i++)
483  for (int j=fLowOcp; j<nRecHitFlag; j++)
484  {
485  _cSummary.setBinContent(i, j, status[i][j]);
487  }
488 
489  DQTask::endLuminosityBlock(l, es);
490 }
491 
493 
494 
495 
496 
double const LOW
Definition: Constants.h:17
virtual void initialize(std::string const &folder, std::string const &nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new axis::ValueAxis(axis::fYaxis, axis::fEntries), int debug=0)
virtual void initialize(std::string const &folder, std::string const &nametitle, axis::Axis *xaxis, axis::Axis *yaxis=new CoordinateAxis(fYaxis, axis::fiphi), axis::Axis *zaxis=new ValueAxis(fZaxis, fEntries), int debug=0)
Container1D _cOccupancyCutvsiphi_SubDetPM
Definition: RecHitTask.h:91
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:233
int const IPHI_NUM
Definition: Constants.h:100
int _nRecHits[constants::SUBDET_NUM]
Definition: RecHitTask.h:53
edm::EDGetTokenT< HBHERecHitCollection > _tokHBHE
Definition: RecHitTask.h:48
virtual void initialize(std::string const &folder, std::string nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new axis::CoordinateAxis(axis::fYaxis, axis::fiphi), axis::Axis *zaxis=new axis::ValueAxis(axis::fZaxis, axis::fEntries), int debug=0)
Definition: Container2D.cc:30
int ib
Definition: cuy.py:660
int const SUBDET_NUM
Definition: Constants.h:87
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
double _cutE_HO
Definition: RecHitTask.h:61
Container1D _cEnergy_SubDetPM_iphi
Definition: RecHitTask.h:66
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:198
edm::EDGetTokenT< HFRecHitCollection > _tokHF
Definition: RecHitTask.h:50
double const VERY_LOW
Definition: Constants.h:18
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
Container2D _cOccupancy_depth
Definition: RecHitTask.h:86
HcalDetId id() const
get the id
Definition: HBHERecHit.h:23
UpdateFreq
Definition: DQTask.h:16
std::vector< HBHERecHit >::const_iterator const_iterator
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: RecHitTask.cc:401
RecHitTask(edm::ParameterSet const &ps)
Definition: RecHitTask.cc:5
float time() const
Definition: CaloRecHit.h:19
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
virtual void setBinContent(int, int, double)
virtual void loadLabels(std::vector< std::string > const &)
virtual void initialize(std::string const &folder, std::string const &nametitle, MapperType mt, Axis *xaxis, Axis *yaxis=new CoordinateAxis(axis::fYaxis, axis::fiphi), Axis *zaxis=new ValueAxis(axis::fZaxis, axis::fEntries), int debug=0)
void bookHistograms(fwlite::EventContainer &eventCont)
ContainerProf1D _cTimingCutvsLS_SubDetPM_iphi
Definition: RecHitTask.h:78
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
ContainerProf1D _cTimingvsietaCut_SubDet_iphi
Definition: RecHitTask.h:80
Container1D _cTimingCut_HBHEPrt
Definition: RecHitTask.h:83
ContainerProf2D _cEnergyCut_depth
Definition: RecHitTask.h:73
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:39
double _cutE_HBHE
Definition: RecHitTask.h:61
ProcessingType _ptype
Definition: DQModule.h:52
Container1D _cEnergy_SubDet_ieta
Definition: RecHitTask.h:65
ContainerSingle2D _cSummary
Definition: RecHitTask.h:97
Container2D _cOccupancyCut_depth
Definition: RecHitTask.h:89
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
float energy() const
Definition: CaloRecHit.h:17
Container1D _cTimingCut_SubDet
Definition: RecHitTask.h:76
virtual void fill(double)
Definition: Container1D.h:53
virtual void loadLabels(std::vector< std::string > const &)
Definition: Container2D.cc:294
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
double _cutE_HF
Definition: RecHitTask.h:61
ContainerProf1D _cTimingvsiphiCut_SubDet_ieta
Definition: RecHitTask.h:81
Logger _logger
Definition: DQModule.h:62
double const GOOD
Definition: Constants.h:15
T min(T a, T b)
Definition: MathUtil.h:58
ContainerProf2D _cEnergy_depth
Definition: RecHitTask.h:69
virtual void initialize(std::string const &folder, std::string const &nametitle, mapper::MapperType mt, axis::Axis *xaxis, axis::Axis *yaxis=new ValueAxis(fYaxis, fEntries), int debug=0)
Definition: Container1D.cc:28
int _nRecHitsCut[constants::SUBDET_NUM]
Definition: RecHitTask.h:54
std::string _name
Definition: DQModule.h:50
Container1D _cEnergy_SubDet
Definition: RecHitTask.h:64
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Container2D _cTimingvsEnergyCut_SubDetPM_iphi
Definition: RecHitTask.h:94
Container2D _cSummaryvsLS_SubDet
Definition: RecHitTask.h:98
edm::InputTag _tagHO
Definition: RecHitTask.h:46
ContainerProf2D _cTimingCut_depth
Definition: RecHitTask.h:82
ContainerProf1D _cEnergyvsietaCut_SubDet
Definition: RecHitTask.h:71
virtual MonitorElement * at(unsigned int i)
Definition: Container1D.cc:236
int const CHS_NUM[SUBDET_NUM]
Definition: Constants.h:136
edm::InputTag _tagHF
Definition: RecHitTask.h:47
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: RecHitTask.cc:202
virtual void _resetMonitors(UpdateFreq)
Definition: RecHitTask.cc:384
std::vector< std::string > _fNames
Definition: RecHitTask.h:58
std::string const & label() const
Definition: InputTag.h:36
ContainerProf1D _cEnergyvsieta_SubDet
Definition: RecHitTask.h:67
virtual void setBinContent(int, int, int, double)
Definition: Container2D.cc:263
ContainerProf1D _cOccupancyvsLS_SubDet
Definition: RecHitTask.h:87
double const NOT_APPLICABLE
Definition: Constants.h:19
double getBinContent(int binx) const
get content of bin (1-D)
Container1D _cTimingCut_SubDetPM_iphi
Definition: RecHitTask.h:77
std::string _subsystem
Definition: DQModule.h:57
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: RecHitTask.cc:156
edm::EDGetTokenT< HORecHitCollection > _tokHO
Definition: RecHitTask.h:49
edm::InputTag _tagHBHE
Definition: RecHitTask.h:45
HcalDetId id() const
Definition: HFRecHit.h:23
ContainerProf1D _cOccupancyCutvsLS_SubDet
Definition: RecHitTask.h:88
ContainerProf1D _cEnergyvsiphiCut_SubDet
Definition: RecHitTask.h:72
virtual double getBinContent(unsigned int, int)
Definition: Container1D.cc:225
Container1D _cOccupancyvsiphi_SubDetPM
Definition: RecHitTask.h:90
double const PROBLEMATIC
Definition: Constants.h:16
std::string const & instance() const
Definition: InputTag.h:37
ContainerProf1D _cEnergyvsiphi_SubDet
Definition: RecHitTask.h:68
HcalDetId id() const
get the id
Definition: HORecHit.h:19
Definition: Run.h:43
tuple status
Definition: mps_update.py:57
Container1D _cTimingCut_SubDet_ieta
Definition: RecHitTask.h:79