CMS 3D CMS Logo

HcalHitValidation.cc
Go to the documentation of this file.
2 
7 
11 
15 
19 
20 #include <fstream>
21 #include <iostream>
22 #include <map>
23 #include <string>
24 #include <vector>
25 
27 public:
29  ~HcalHitValidation() override = default;
30 
31 protected:
32  void analyze(const edm::Event &e, const edm::EventSetup &c) override;
33  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
34 
35  void analyzeHits(std::vector<PCaloHit> &);
39 
40 private:
43  const bool verbose_, scheme_;
49 
61 
62  static const int nLayersMAX = 20, nDepthsMAX = 5;
70 
74 
79 };
80 
82  : g4Label(ps.getUntrackedParameter<std::string>("moduleLabel", "g4SimHits")),
83  hcalHits(ps.getUntrackedParameter<std::string>("HitCollection", "HcalHits")),
84  layerInfo(ps.getUntrackedParameter<std::string>("LayerInfo", "PHcalValidInfoLayer")),
85  nxNInfo(ps.getUntrackedParameter<std::string>("NxNInfo", "PHcalValidInfoNxN")),
86  jetsInfo(ps.getUntrackedParameter<std::string>("JetsInfo", "PHcalValidInfoJets")),
87  outFile_(ps.getUntrackedParameter<std::string>("outputFile", "hcValid.root")),
88  verbose_(ps.getUntrackedParameter<bool>("Verbose", false)),
89  scheme_(ps.getUntrackedParameter<bool>("TestNumbering", true)),
90  checkHit_(ps.getUntrackedParameter<bool>("CheckHits", true)),
91  checkLay_(ps.getUntrackedParameter<bool>("CheckLayer", true)),
92  checkNxN_(ps.getUntrackedParameter<bool>("CheckNxN", true)),
93  checkJet_(ps.getUntrackedParameter<bool>("CheckJets", true)),
94  tok_hh_(consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label, hcalHits))),
95  tok_iL_(consumes<PHcalValidInfoLayer>(edm::InputTag(g4Label, layerInfo))),
96  tok_iN_(consumes<PHcalValidInfoNxN>(edm::InputTag(g4Label, nxNInfo))),
97  tok_iJ_(consumes<PHcalValidInfoJets>(edm::InputTag(g4Label, jetsInfo))) {
98  edm::LogVerbatim("HcalHitValid") << "Module Label: " << g4Label << " Hits: " << hcalHits << " / " << checkHit_
99  << " LayerInfo: " << layerInfo << " / " << checkLay_ << " NxNInfo: " << nxNInfo
100  << " / " << checkNxN_ << " jetsInfo: " << jetsInfo << " / " << checkJet_
101  << " Output: " << outFile_ << " Usage of TestNumberingScheme " << scheme_;
102 }
103 
105  ibooker.setCurrentFolder("HcalHitValidation");
106 
107  char title[60], name[20];
108  double my_pi = 3.1415926;
109  // Histograms for Hits
110  if (checkHit_) {
111  meAllNHit_ = ibooker.book1D("Hit01", "Number of Hits in HCal", 1000, 0., 5000.);
112  meBadDetHit_ = ibooker.book1D("Hit02", "Hits with wrong Det", 100, 0., 100.);
113  meBadSubHit_ = ibooker.book1D("Hit03", "Hits with wrong Subdet", 100, 0., 100.);
114  meBadIdHit_ = ibooker.book1D("Hit04", "Hits with wrong ID", 100, 0., 100.);
115  meHBNHit_ = ibooker.book1D("Hit05", "Number of Hits in HB", 1000, 0., 5000.);
116  meHENHit_ = ibooker.book1D("Hit06", "Number of Hits in HE", 1000, 0., 5000.);
117  meHONHit_ = ibooker.book1D("Hit07", "Number of Hits in HO", 1000, 0., 5000.);
118  meHFNHit_ = ibooker.book1D("Hit08", "Number of Hits in HF", 1000, 0., 5000.);
119  meDetectHit_ = ibooker.book1D("Hit09", "Detector ID", 50, 0., 50.);
120  meSubdetHit_ = ibooker.book1D("Hit10", "Subdetectors in HCal", 50, 0., 50.);
121  meDepthHit_ = ibooker.book1D("Hit11", "Depths in HCal", 20, 0., 20.);
122  meEtaHit_ = ibooker.book1D("Hit12", "Eta in HCal", 100, -50., 50.);
123  mePhiHit_ = ibooker.book1D("Hit13", "Phi in HCal", 100, 0., 100.);
124  meEnergyHit_ = ibooker.book1D("Hit14", "Energy in HCal", 100, 0., 1.);
125  meTimeHit_ = ibooker.book1D("Hit15", "Time in HCal", 100, 0., 400.);
126  meTimeWHit_ = ibooker.book1D("Hit16", "Time in HCal (E wtd)", 100, 0., 400.);
127  meHBDepHit_ = ibooker.book1D("Hit17", "Depths in HB", 20, 0., 20.);
128  meHEDepHit_ = ibooker.book1D("Hit18", "Depths in HE", 20, 0., 20.);
129  meHODepHit_ = ibooker.book1D("Hit19", "Depths in HO", 20, 0., 20.);
130  meHFDepHit_ = ibooker.book1D("Hit20", "Depths in HF", 20, 0., 20.);
131  meHBEtaHit_ = ibooker.book1D("Hit21", "Eta in HB", 100, -50., 50.);
132  meHEEtaHit_ = ibooker.book1D("Hit22", "Eta in HE", 100, -50., 50.);
133  meHOEtaHit_ = ibooker.book1D("Hit23", "Eta in HO", 100, -50., 50.);
134  meHFEtaHit_ = ibooker.book1D("Hit24", "Eta in HF", 100, -50., 50.);
135  meHBPhiHit_ = ibooker.book1D("Hit25", "Phi in HB", 100, 0., 100.);
136  meHEPhiHit_ = ibooker.book1D("Hit26", "Phi in HE", 100, 0., 100.);
137  meHOPhiHit_ = ibooker.book1D("Hit27", "Phi in HO", 100, 0., 100.);
138  meHFPhiHit_ = ibooker.book1D("Hit28", "Phi in HF", 100, 0., 100.);
139  meHBEneHit_ = ibooker.book1D("Hit29", "Energy in HB", 100, 0., 1.);
140  meHEEneHit_ = ibooker.book1D("Hit30", "Energy in HE", 100, 0., 1.);
141  meHOEneHit_ = ibooker.book1D("Hit31", "Energy in HO", 100, 0., 1.);
142  meHFEneHit_ = ibooker.book1D("Hit32", "Energy in HF", 100, 0., 100.);
143  meHBTimHit_ = ibooker.book1D("Hit33", "Time in HB", 100, 0., 400.);
144  meHETimHit_ = ibooker.book1D("Hit34", "Time in HE", 100, 0., 400.);
145  meHOTimHit_ = ibooker.book1D("Hit35", "Time in HO", 100, 0., 400.);
146  meHFTimHit_ = ibooker.book1D("Hit36", "Time in HF", 100, 0., 400.);
147  mePMTHit_ = ibooker.book1D("Hit37", "Number of Hit in PMT", 1000, 0., 1000.);
148  mePMTDepHit_ = ibooker.book1D("Hit38", "Depths in HF PMT", 20, 0., 20.);
149  mePMTEtaHit_ = ibooker.book1D("Hit39", "Eta in HF PMT", 100, -50., 50.);
150  mePMTPhiHit_ = ibooker.book1D("Hit40", "Phi in HF PMT", 100, 0., 100.);
151  mePMTEn1Hit_ = ibooker.book1D("Hit41", "Energy (Ceren) in PMT", 100, 0., 100.);
152  mePMTEn2Hit_ = ibooker.book1D("Hit42", "Energy (dE/dx) in PMT", 100, 0., 100.);
153  mePMTTimHit_ = ibooker.book1D("Hit43", "Time in HF PMT", 100, 0., 400.);
154  }
155 
156  // Histograms for Layers
157  if (checkLay_) {
158  meLayerLay_ = ibooker.book1D("Lay01", "Layer # of the Hits", 20, 0., 20.);
159  meEtaHLay_ = ibooker.book1D("Lay02", "Eta of the Hits", 100, -5., 5.);
160  mePhiHLay_ = ibooker.book1D("Lay03", "Phi of the Hits", 100, -my_pi, my_pi);
161  meEneHLay_ = ibooker.book1D("Lay04", "Energy of the Hits", 100, 0., 2.);
162  meDepHlay_ = ibooker.book1D("Lay05", "Depth of the Hits", 10, 0., 10.);
163  meTimHLay_ = ibooker.book1D("Lay06", "Time of the Hits", 100, 0., 400.);
164  meTimWLay_ = ibooker.book1D("Lay07", "Time (wtd) of Hits", 100, 0., 400.);
165  meEtaPhi_ = ibooker.book2D("Lay08", "Phi%Eta of the Hits", 100, -5., 5., 100, -my_pi, my_pi);
166 
167  meHitELay_ = ibooker.book1D("Lay09", "Hit in Ecal", 1000, 0., 2000.);
168  meHitHLay_ = ibooker.book1D("Lay10", "Hit in Hcal", 1000, 0., 2000.);
169  meHitTLay_ = ibooker.book1D("Lay11", "Total Hits", 1000, 0., 2000.);
170  meEneLLay_ = ibooker.book1D("Lay12", "Energy per layer", 100, 0., 1.);
171  int nn = 0;
172  for (int i = 0; i < nLayersMAX; i++) {
173  sprintf(name, "Layl%d", nn);
174  nn++;
175  sprintf(title, "Energy deposit in Layer %d", i);
176  meEneLay_[i] = ibooker.book1D(name, title, 100, 0., 0.4);
177  }
178  meLngLay_ = ibooker.book1D("Lay13", "Lonitudinal Shower Profile", 20, 0, 20.);
179  meEneDLay_ = ibooker.book1D("Lay14", "Energy per depth", 100, 0., 1.);
180  for (int i = 0; i < nDepthsMAX; i++) {
181  sprintf(name, "Layl%d", nn);
182  nn++;
183  sprintf(title, "Energy deposit in Depth %d", i);
184  meDepLay_[i] = ibooker.book1D(name, title, 100, 0., 2.);
185  }
186 
187  meEtotLay_ = ibooker.book1D("Lay15", "Total Energy", 100, 0., 1.);
188  meEHOLay_ = ibooker.book1D("Lay16", "Energy in HO", 100, 0., 2000.);
189  meEHBHELay_ = ibooker.book1D("Lay17", "Energy in HB/HE", 100, 0., 2000.);
190  meEFibLLay_ = ibooker.book1D("Lay18", "Energy in HF (Long)", 100, 0., 100.);
191  meEFibSLay_ = ibooker.book1D("Lay19", "Energy in HF (Short)", 100, 0., 100.);
192  meEHFEmLay_ = ibooker.book1D("Lay20", "EM energy in HF", 100, 0., 200.);
193  meEHFHdLay_ = ibooker.book1D("Lay21", "Had. energy in HF", 100, 0., 200.);
194  }
195 
196  // Histograms for NxN analysis
197  if (checkNxN_) {
198  meEcalRNxN_ = ibooker.book1D("NxN01", "Energy in ECal (NxN)r", 100, 0., 200.);
199  meHcalRNxN_ = ibooker.book1D("NxN02", "Energy in HCal (NxN)r", 100, 0., 200.);
200  meHoRNxN_ = ibooker.book1D("NxN03", "Energy in HO (NxN)r", 100, 0., 200.);
201  meEtotRNxN_ = ibooker.book1D("NxN04", "Energy Total (NxN)r", 100, 0., 200.);
202  meEcalNxN_ = ibooker.book1D("NxN05", "Energy in ECal (NxN)", 100, 0., 200.);
203  meHcalNxN_ = ibooker.book1D("NxN06", "Energy in HCal (NxN)", 100, 0., 200.);
204  meHoNxN_ = ibooker.book1D("NxN07", "Energy in HO (NxN)", 100, 0., 200.);
205  meEtotNxN_ = ibooker.book1D("NxN08", "Energy Total (NxN)", 100, 0., 200.);
206  meEiNxN_ = ibooker.book1D("NxN09", "Energy of Hits in (NxN)", 100, 0., 1.);
207  meTiNxN_ = ibooker.book1D("NxN10", "Time of Hits in (NxN)", 100, 0., 400.);
208  meTrNxN_ = ibooker.book1D("NxN11", "Dist. of Hits in (NxN)", 100, 0., 1.);
209  }
210 
211  // Histograms for Jets
212  if (checkJet_) {
213  meRJet_ = ibooker.book1D("Jet01", "R of Hits", 100, 0., 1.);
214  meTJet_ = ibooker.book1D("Jet02", "T of Hits", 100, 0., 200.);
215  meEJet_ = ibooker.book1D("Jet03", "E of Hits", 100, 0., 200.);
216  meEcalJet_ = ibooker.book1D("Jet04", "Ecal Energy (First Jet)", 100, 0., 200.);
217  meHcalJet_ = ibooker.book1D("Jet05", "Hcal Energy (First Jet)", 100, 0., 200.);
218  meHoJet_ = ibooker.book1D("Jet06", "Ho Energy (First Jet)", 100, 0., 200.);
219  meEtotJet_ = ibooker.book1D("Jet07", "Total Energy(First Jet)", 100, 0., 200.);
220  meEcHcJet_ = ibooker.book2D("Jet08", "Energy in Hcal% Ecal", 100, 0., 200., 100, 0., 200.);
221 
222  meDetaJet_ = ibooker.book1D("Jet09", "Delta Eta", 100, 0., 2.);
223  meDphiJet_ = ibooker.book1D("Jet10", "Delta Phi", 100, 0., 1.);
224  meDrJet_ = ibooker.book1D("Jet11", "Delta R", 100, 0., 2.);
225  meMassJet_ = ibooker.book1D("Jet12", "Di-jet mass", 100, 0., 200.);
226  meEneJet_ = ibooker.book1D("Jet13", "Jet Energy", 100, 0., 200.);
227  meEtaJet_ = ibooker.book1D("Jet14", "Jet Eta", 100, -5., 5.);
228  mePhiJet_ = ibooker.book1D("Jet15", "Jet Phi", 100, -my_pi, my_pi);
229  }
230 }
231 
233  edm::LogVerbatim("HcalHitValid") << "Run = " << e.id().run() << " Event = " << e.id().event();
234 
235  bool getHits = false;
236  if (checkHit_) {
237  const edm::Handle<edm::PCaloHitContainer> &hitsHcal = e.getHandle(tok_hh_);
238  if (hitsHcal.isValid())
239  getHits = true;
240  if (getHits) {
241  std::vector<PCaloHit> caloHits;
242  caloHits.insert(caloHits.end(), hitsHcal->begin(), hitsHcal->end());
243  edm::LogVerbatim("HcalHitValid") << "HcalValidation: Hit buffer " << caloHits.size();
244  analyzeHits(caloHits);
245  }
246  }
247 
248  bool getLayer = false;
249  if (checkLay_) {
250  const edm::Handle<PHcalValidInfoLayer> &infoLayer = e.getHandle(tok_iL_);
251  if (infoLayer.isValid()) {
252  getLayer = true;
253  analyzeLayer(infoLayer);
254  }
255  }
256 
257  bool getNxN = false;
258  if (checkNxN_) {
259  const edm::Handle<PHcalValidInfoNxN> &infoNxN = e.getHandle(tok_iN_);
260  if (infoNxN.isValid()) {
261  getNxN = true;
262  analyzeNxN(infoNxN);
263  }
264  }
265 
266  bool getJets = false;
267  if (checkJet_) {
268  const edm::Handle<PHcalValidInfoJets> &infoJets = e.getHandle(tok_iJ_);
269  if (infoJets.isValid()) {
270  getJets = true;
271  analyzeJets(infoJets);
272  }
273  }
274 
275  edm::LogVerbatim("HcalHitValid") << "HcalValidation: Input flags Hits " << getHits << ", Layer " << getLayer
276  << ", NxN " << getNxN << ", Jets " << getJets;
277 }
278 
279 void HcalHitValidation::analyzeHits(std::vector<PCaloHit> &hits) {
280  int nHit = hits.size();
281  int nHB = 0, nHE = 0, nHO = 0, nHF = 0, nPMT = 0, nBad1 = 0, nBad2 = 0, nBad = 0;
282  for (int i = 0; i < nHit; i++) {
283  double energy = hits[i].energy();
284  double time = hits[i].time();
285  unsigned int id_ = hits[i].id();
286  int det, subdet, depth, eta, phi;
287  if (scheme_) {
288  det = 4;
289  subdet = (id_ >> 28) & 15;
290  depth = (id_ >> 26) & 3;
291  depth++;
292  int zside = ((id_ & 0x100000) ? (1) : (-1));
293  eta = zside * ((id_ >> 10) & 1023);
294  phi = (id_ & 1023);
295  } else {
296  HcalDetId id = HcalDetId(id_);
297  det = id.det();
298  subdet = id.subdet();
299  depth = id.depth();
300  eta = id.ieta();
301  phi = id.iphi();
302  }
303  uint16_t depth_ = hits[i].depth();
304  double energyEM = hits[i].energyEM();
305  double energyHad = hits[i].energyHad();
306  edm::LogVerbatim("HcalHitValid") << "Hit[" << i << "] ID " << std::hex << id_ << std::dec << " Det " << det
307  << " Sub " << subdet << " depth " << depth << " " << depth_ << " Eta " << eta
308  << " Phi " << phi << " E " << energy << "(EM " << energyEM << ", Had " << energyHad
309  << ") time " << time;
310  if (det == 4) { // Check DetId.h
311  if (subdet == static_cast<int>(HcalBarrel)) {
312  nHB++;
313  } else if (subdet == static_cast<int>(HcalEndcap)) {
314  nHE++;
315  } else if (subdet == static_cast<int>(HcalOuter)) {
316  nHO++;
317  } else if (subdet == static_cast<int>(HcalForward)) {
318  if (depth_ == 0)
319  nHF++;
320  else
321  nPMT++;
322  } else {
323  nBad++;
324  nBad2++;
325  }
326  } else {
327  nBad++;
328  nBad1++;
329  }
330 
331  meDetectHit_->Fill(double(det));
332  if (det == 4 && depth_ == 0) {
333  meSubdetHit_->Fill(double(subdet));
334  meDepthHit_->Fill(double(depth));
335  meEtaHit_->Fill(double(eta));
336  mePhiHit_->Fill(double(phi));
338  meTimeHit_->Fill(time);
339  meTimeWHit_->Fill(double(time), energy);
340  if (subdet == static_cast<int>(HcalBarrel)) {
341  meHBDepHit_->Fill(double(depth));
342  meHBEtaHit_->Fill(double(eta));
343  meHBPhiHit_->Fill(double(phi));
346  } else if (subdet == static_cast<int>(HcalEndcap)) {
347  meHEDepHit_->Fill(double(depth));
348  meHEEtaHit_->Fill(double(eta));
349  meHEPhiHit_->Fill(double(phi));
352  } else if (subdet == static_cast<int>(HcalOuter)) {
353  meHODepHit_->Fill(double(depth));
354  meHOEtaHit_->Fill(double(eta));
355  meHOPhiHit_->Fill(double(phi));
358  } else if (subdet == static_cast<int>(HcalForward)) {
359  meHFDepHit_->Fill(double(depth));
360  meHFEtaHit_->Fill(double(eta));
361  meHFPhiHit_->Fill(double(phi));
364  }
365  } else if (det == 0 && subdet == static_cast<int>(HcalForward)) {
366  mePMTDepHit_->Fill(double(depth));
367  mePMTEtaHit_->Fill(double(eta));
368  mePMTPhiHit_->Fill(double(phi));
369  mePMTEn1Hit_->Fill(energyEM);
370  mePMTEn2Hit_->Fill(energyHad);
372  }
373  }
374  meAllNHit_->Fill(double(nHit));
375  meBadDetHit_->Fill(double(nBad1));
376  meBadSubHit_->Fill(double(nBad2));
377  meBadIdHit_->Fill(double(nBad));
378  meHBNHit_->Fill(double(nHB));
379  meHENHit_->Fill(double(nHE));
380  meHONHit_->Fill(double(nHO));
381  meHFNHit_->Fill(double(nHF));
382  mePMTHit_->Fill(double(nPMT));
383 
384  edm::LogVerbatim("HcalHitValid") << "HcalHitValidation::analyzeHits: HB " << nHB << " HE " << nHE << " HO " << nHO
385  << " HF " << nHF << " PMT " << nPMT << " Bad " << nBad << " All " << nHit;
386 }
387 
389  // CaloHits from PHcalValidInfoLayer
390  int nHits = infoLayer->nHit();
391  std::vector<float> idHits = infoLayer->idHit();
392  std::vector<float> phiHits = infoLayer->phiHit();
393  std::vector<float> etaHits = infoLayer->etaHit();
394  std::vector<float> layerHits = infoLayer->layerHit();
395  std::vector<float> eHits = infoLayer->eHit();
396  std::vector<float> tHits = infoLayer->tHit();
397 
398  int ne = 0, nh = 0;
399  for (int j = 0; j < nHits; j++) {
400  int layer = (int)(layerHits[j]) - 1;
401  int id = (int)(idHits[j]);
402 
403  if (id >= 10) {
404  ne++;
405  } else {
406  nh++;
407  }
408 
409  edm::LogVerbatim("HcalHitValid") << "HcalHitValidation::analyzeLayer:Hit subdet = " << id << " lay = " << layer;
410 
411  meLayerLay_->Fill(double(layer));
412  meEtaHLay_->Fill(etaHits[j]);
413  mePhiHLay_->Fill(phiHits[j]);
414  meEneHLay_->Fill(eHits[j]);
415  meDepHlay_->Fill(idHits[j]);
416  meTimHLay_->Fill(tHits[j]);
417  meTimWLay_->Fill(tHits[j], eHits[j]);
418  if (id < 6) // HCAL only. Depth is needed, not layer !!!
419  {
420  meEtaPhi_->Fill(etaHits[j], phiHits[j]);
421  }
422  }
423 
424  meHitELay_->Fill(double(ne));
425  meHitHLay_->Fill(double(nh));
426  meHitTLay_->Fill(double(nHits));
427 
428  // Layers and depths PHcalValidInfoLayer
429  std::vector<float> eLayer = infoLayer->elayer();
430  std::vector<float> eDepth = infoLayer->edepth();
431  float eTot = 0.;
432 
433  for (int j = 0; j < nLayersMAX; j++) {
434  eTot += eLayer[j];
435  meEneLLay_->Fill(eLayer[j]);
436  meEneLay_[j]->Fill(eLayer[j]);
437  meLngLay_->Fill((double)(j), eLayer[j]); // HCAL SimHits only
438  }
439  for (int j = 0; j < nDepthsMAX; j++) {
440  meEneDLay_->Fill(eDepth[j]);
441  meDepLay_[j]->Fill(eDepth[j]);
442  }
443  meEtotLay_->Fill(eTot);
444 
445  // The rest PHcalValidInfoLayer
446  double eHO = infoLayer->eho();
447  double eHBHE = infoLayer->ehbhe();
448  double elongHF = infoLayer->elonghf();
449  double eshortHF = infoLayer->eshorthf();
450  double eEcalHF = infoLayer->eecalhf();
451  double eHcalHF = infoLayer->ehcalhf();
452 
453  meEHOLay_->Fill(eHO);
454  meEHBHELay_->Fill(eHBHE);
455  meEFibLLay_->Fill(elongHF);
456  meEFibSLay_->Fill(eshortHF);
457  meEHFEmLay_->Fill(eEcalHF);
458  meEHFHdLay_->Fill(eHcalHF);
459 
460  edm::LogVerbatim("HcalHitValid") << "HcalHitValidation::analyzeLayer: eHO " << eHO << " eHBHE = " << eHBHE
461  << " elongHF = " << elongHF << " eshortHF = " << eshortHF
462  << " eEcalHF = " << eEcalHF << " eHcalHF = " << eHcalHF;
463 }
464 
466  // NxN quantities
467  double ecalNxNr = infoNxN->ecalnxnr();
468  double hcalNxNr = infoNxN->hcalnxnr();
469  double hoNxNr = infoNxN->honxnr();
470  double etotNxNr = infoNxN->etotnxnr();
471 
472  double ecalNxN = infoNxN->ecalnxn();
473  double hcalNxN = infoNxN->hcalnxn();
474  double hoNxN = infoNxN->honxn();
475  double etotNxN = infoNxN->etotnxn();
476 
477  meEcalRNxN_->Fill(ecalNxNr);
478  meHcalRNxN_->Fill(hcalNxNr);
479  meHoRNxN_->Fill(hoNxNr);
480  meEtotRNxN_->Fill(etotNxNr);
481 
482  meEcalNxN_->Fill(ecalNxN);
483  meHcalNxN_->Fill(hcalNxN);
484  meHoNxN_->Fill(hoNxN);
485  meEtotNxN_->Fill(etotNxN);
486 
487  int nIxI = infoNxN->nnxn();
488  std::vector<float> idIxI = infoNxN->idnxn();
489  std::vector<float> eIxI = infoNxN->enxn();
490  std::vector<float> tIxI = infoNxN->tnxn();
491 
492  for (int j = 0; j < nIxI; j++) // NB !!! j < nIxI
493  {
494  meEiNxN_->Fill(eIxI[j]);
495  meTiNxN_->Fill(tIxI[j]);
496  meTrNxN_->Fill(idIxI[j], eIxI[j]); // transverse profile
497  }
498 
499  edm::LogVerbatim("HcalHitValid") << "HcalHitValidation::analyzeNxN: " << nIxI
500  << " hits in NxN analysis; Total Energy " << etotNxN << "/" << etotNxNr;
501 }
502 
504  // -- Leading Jet
505  int nJetHits = infoJets->njethit();
506 
507  std::vector<float> rJetHits = infoJets->jethitr();
508  std::vector<float> tJetHits = infoJets->jethitt();
509  std::vector<float> eJetHits = infoJets->jethite();
510 
511  double ecalJet = infoJets->ecaljet();
512  double hcalJet = infoJets->hcaljet();
513  double hoJet = infoJets->hojet();
514  double etotJet = infoJets->etotjet();
515 
516  double detaJet = infoJets->detajet();
517  double dphiJet = infoJets->dphijet();
518  double drJet = infoJets->drjet();
519  double dijetM = infoJets->dijetm();
520 
521  for (int j = 0; j < nJetHits; j++) {
522  meRJet_->Fill(rJetHits[j]);
523  meTJet_->Fill(tJetHits[j]);
524  meEJet_->Fill(eJetHits[j]);
525  }
526 
527  meEcalJet_->Fill(ecalJet);
528  meHcalJet_->Fill(hcalJet);
529  meHoJet_->Fill(hoJet);
530  meEtotJet_->Fill(etotJet);
531  meEcHcJet_->Fill(ecalJet, hcalJet);
532 
533  meDetaJet_->Fill(detaJet);
534  meDphiJet_->Fill(dphiJet);
535  meDrJet_->Fill(drJet);
536  meMassJet_->Fill(dijetM);
537 
538  // All Jets
539  int nJets = infoJets->njet();
540  std::vector<float> jetE = infoJets->jete();
541  std::vector<float> jetEta = infoJets->jeteta();
542  std::vector<float> jetPhi = infoJets->jetphi();
543 
544  for (int j = 0; j < nJets; j++) {
545  meEneJet_->Fill(jetE[j]);
546  meEtaJet_->Fill(jetEta[j]);
547  mePhiJet_->Fill(jetPhi[j]);
548  }
549  edm::LogVerbatim("HcalHitValid") << "HcalHitValidation::analyzeJets: " << nJets << " jets with " << nJetHits
550  << " hits in the leading jet\n"
551  << " d(Eta) = " << detaJet << " d(Phi) = " << dphiJet << " d(R) = " << drJet
552  << " diJet Mass = " << dijetM;
553 }
554 
555 // define this as a plug-in
MonitorElement * meHONHit_
MonitorElement * meDetaJet_
Log< level::Info, true > LogVerbatim
MonitorElement * meHODepHit_
MonitorElement * meEnergyHit_
std::vector< float > jetphi() const
std::vector< PCaloHit > PCaloHitContainer
std::vector< float > jethitt() const
MonitorElement * meHitHLay_
MonitorElement * meHOEtaHit_
MonitorElement * meAllNHit_
MonitorElement * meHBPhiHit_
MonitorElement * meHoNxN_
MonitorElement * mePMTTimHit_
MonitorElement * mePMTEtaHit_
MonitorElement * meHFEneHit_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const std::string nxNInfo
MonitorElement * meEcalRNxN_
MonitorElement * meHFDepHit_
MonitorElement * mePMTDepHit_
MonitorElement * meBadDetHit_
MonitorElement * meHcalNxN_
MonitorElement * meBadIdHit_
MonitorElement * meTrNxN_
MonitorElement * meHFEtaHit_
MonitorElement * meEJet_
MonitorElement * meEFibSLay_
MonitorElement * meEtaHLay_
std::vector< float > eHit() const
MonitorElement * meEtotNxN_
std::vector< float > enxn() const
MonitorElement * mePMTPhiHit_
int zside(DetId const &)
MonitorElement * meHOPhiHit_
std::vector< float > idHit() const
MonitorElement * meTimeWHit_
MonitorElement * meEneLay_[nLayersMAX]
MonitorElement * meHitELay_
MonitorElement * meEHFEmLay_
std::vector< float > layerHit() const
MonitorElement * meHENHit_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
void Fill(long long x)
MonitorElement * meHoJet_
MonitorElement * meHOEneHit_
~HcalHitValidation() override=default
MonitorElement * meEtotJet_
std::vector< float > etaHit() const
MonitorElement * mePhiHLay_
MonitorElement * meEtaPhi_
std::vector< float > tnxn() const
constexpr uint8_t getLayer(uint32_t detId)
std::vector< float > jeteta() const
MonitorElement * meHEEneHit_
MonitorElement * meHFNHit_
MonitorElement * meHFTimHit_
MonitorElement * meHBDepHit_
MonitorElement * mePMTEn1Hit_
const std::string outFile_
MonitorElement * meTiNxN_
MonitorElement * meDphiJet_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
MonitorElement * meRJet_
HcalHitValidation(const edm::ParameterSet &ps)
MonitorElement * meEHBHELay_
MonitorElement * meTJet_
std::vector< float > jete() const
MonitorElement * meHETimHit_
MonitorElement * meEneHLay_
MonitorElement * mePMTHit_
MonitorElement * meHBEtaHit_
static const int nDepthsMAX
const edm::EDGetTokenT< PHcalValidInfoNxN > tok_iN_
MonitorElement * meTimeHit_
std::vector< float > jethite() const
MonitorElement * meBadSubHit_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
MonitorElement * meEtotLay_
void analyzeHits(std::vector< PCaloHit > &)
MonitorElement * meLngLay_
MonitorElement * meMassJet_
MonitorElement * meTimWLay_
uint32_t nh
MonitorElement * meEHFHdLay_
MonitorElement * meHitTLay_
MonitorElement * meHEEtaHit_
std::vector< float > idnxn() const
MonitorElement * meHBNHit_
MonitorElement * mePhiHit_
MonitorElement * meHoRNxN_
MonitorElement * meHOTimHit_
const std::string jetsInfo
void analyzeNxN(const edm::Handle< PHcalValidInfoNxN > &)
MonitorElement * meEneDLay_
std::vector< float > phiHit() const
MonitorElement * meLayerLay_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * meHcalJet_
MonitorElement * meEtotRNxN_
MonitorElement * meEFibLLay_
MonitorElement * meEHOLay_
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * meEneLLay_
const edm::EDGetTokenT< PHcalValidInfoJets > tok_iJ_
MonitorElement * mePMTEn2Hit_
static const int nLayersMAX
HLT enums.
MonitorElement * meEcalNxN_
void analyzeLayer(const edm::Handle< PHcalValidInfoLayer > &)
MonitorElement * meHBEneHit_
MonitorElement * meDepthHit_
MonitorElement * mePhiJet_
MonitorElement * meHEPhiHit_
MonitorElement * meEneJet_
MonitorElement * meEtaHit_
std::vector< float > edepth() const
MonitorElement * meEcalJet_
MonitorElement * meDepLay_[nDepthsMAX]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * meSubdetHit_
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
MonitorElement * meDetectHit_
MonitorElement * meHcalRNxN_
const std::string g4Label
const std::string layerInfo
void analyzeJets(const edm::Handle< PHcalValidInfoJets > &)
MonitorElement * meHEDepHit_
std::vector< float > elayer() const
MonitorElement * meEiNxN_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hh_
const edm::EDGetTokenT< PHcalValidInfoLayer > tok_iL_
MonitorElement * meHFPhiHit_
std::vector< float > jethitr() const
MonitorElement * meDrJet_
MonitorElement * meEcHcJet_
MonitorElement * meEtaJet_
Definition: Run.h:45
MonitorElement * meTimHLay_
const std::string hcalHits
MonitorElement * meDepHlay_
MonitorElement * meHBTimHit_
std::vector< float > tHit() const