CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalSimHitsValidation Class Reference

#include <HcalSimHitsValidation.h>

Inheritance diagram for HcalSimHitsValidation:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (edm::Event const &ev, edm::EventSetup const &c) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
 HcalSimHitsValidation (edm::ParameterSet const &conf)
 
 ~HcalSimHitsValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Member Functions

double dPhiWsign (double phi1, double phi2)
 
double dR (double eta1, double phi1, double eta2, double phi2)
 
double phi12 (double phi1, double en1, double phi2, double en2)
 

Private Attributes

bool auxPlots_
 
std::string ebHits_
 
std::string eeHits_
 
std::vector< MonitorElement * > emean_vs_ieta_HB
 
std::vector< MonitorElement * > emean_vs_ieta_HE
 
std::vector< MonitorElement * > emean_vs_ieta_HF
 
MonitorElementemean_vs_ieta_HO
 
std::string g4Label_
 
edm::ESHandle< CaloGeometrygeometry
 
std::string hcalHits_
 
const HcalDDDRecConstantshcons
 
double hf1_
 
double hf2_
 
int maxDepthHB_
 
int maxDepthHE_
 
int maxDepthHF_
 
int maxDepthHO_
 
MonitorElementmeEnConeEtaProfile
 
MonitorElementmeEnConeEtaProfile_E
 
MonitorElementmeEnConeEtaProfile_EH
 
std::vector< MonitorElement * > meSimHitsEnergyHB
 
std::vector< MonitorElement * > meSimHitsEnergyHE
 
std::vector< MonitorElement * > meSimHitsEnergyHF
 
MonitorElementmeSimHitsEnergyHO
 
int nevtot
 
std::vector< MonitorElement * > Nhb
 
std::vector< MonitorElement * > Nhe
 
std::vector< MonitorElement * > Nhf
 
MonitorElementNho
 
std::vector< MonitorElement * > occupancy_vs_ieta_HB
 
std::vector< MonitorElement * > occupancy_vs_ieta_HE
 
std::vector< MonitorElement * > occupancy_vs_ieta_HF
 
MonitorElementoccupancy_vs_ieta_HO
 
std::string outputFile_
 
bool testNumber_
 
edm::EDGetTokenT< edm::PCaloHitContainertok_ecalEB_
 
edm::EDGetTokenT< edm::PCaloHitContainertok_ecalEE_
 
edm::EDGetTokenT< edm::HepMCProducttok_evt_
 
edm::EDGetTokenT< edm::PCaloHitContainertok_hcal_
 

Detailed Description

Definition at line 42 of file HcalSimHitsValidation.h.

Constructor & Destructor Documentation

HcalSimHitsValidation::HcalSimHitsValidation ( edm::ParameterSet const &  conf)

Definition at line 5 of file HcalSimHitsValidation.cc.

References auxPlots_, ebHits_, eeHits_, g4Label_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hcalHits_, hf1_, hf2_, nevtot, outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, testNumber_, tok_ecalEB_, tok_ecalEE_, tok_evt_, and tok_hcal_.

5  {
6  // DQM ROOT output
7  outputFile_ = conf.getUntrackedParameter<std::string>("outputFile", "myfile.root");
8  testNumber_ = conf.getUntrackedParameter<bool>("TestNumber", false);
9  auxPlots_ = conf.getUntrackedParameter<bool>("auxiliaryPlots", false);
10 
11  // register for data access
12  g4Label_ = conf.getUntrackedParameter<std::string>("ModuleLabel", "g4SimHits");
13  hcalHits_ = conf.getUntrackedParameter<std::string>("HcalHitCollection", "HcalHits");
14  ebHits_ = conf.getUntrackedParameter<std::string>("EBHitCollection", "EcalHitsEB");
15  eeHits_ = conf.getUntrackedParameter<std::string>("EEHitCollection", "EcalHitsEE");
16 
17  // import sampling factors
18  hf1_ = conf.getParameter<double>("hf1");
19  hf2_ = conf.getParameter<double>("hf2");
20 
21  tok_evt_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
22  tok_hcal_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, hcalHits_));
23  tok_ecalEB_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, ebHits_));
24  tok_ecalEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_, eeHits_));
25 
26  if (!outputFile_.empty()) {
27  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
28  } else {
29  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will NOT be saved";
30  }
31 
32  nevtot = 0;
33 }
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
HcalSimHitsValidation::~HcalSimHitsValidation ( )
override

Definition at line 35 of file HcalSimHitsValidation.cc.

35 {}

Member Function Documentation

void HcalSimHitsValidation::analyze ( edm::Event const &  ev,
edm::EventSetup const &  c 
)
override

Definition at line 288 of file HcalSimHitsValidation.cc.

References funct::abs(), auxPlots_, gather_cfg::cout, egammaForCoreTracking_cff::depth, dR(), ebHits_, eeHits_, emean_vs_ieta_HB, emean_vs_ieta_HE, emean_vs_ieta_HF, emean_vs_ieta_HO, ALCARECOTkAlBeamHalo_cff::etaMax, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), hcons, hf1_, hf2_, edm::HandleBase::isValid(), MuonErrorMatrixAnalyzer_cfi::maxPt, meEnConeEtaProfile, meEnConeEtaProfile_E, meEnConeEtaProfile_EH, meSimHitsEnergyHB, meSimHitsEnergyHE, meSimHitsEnergyHF, meSimHitsEnergyHO, nevtot, npart, occupancy_vs_ieta_HB, occupancy_vs_ieta_HE, occupancy_vs_ieta_HF, occupancy_vs_ieta_HO, AlCaHLTBitMon_ParallelJobs::p, edm::Handle< T >::product(), EnergyCorrector::pt, alignCSCRings::r, HcalHitRelabeller::relabel(), HcalDetId::subdet(), testNumber_, tok_ecalEB_, tok_ecalEE_, tok_evt_, and tok_hcal_.

288  {
289  using namespace edm;
290  using namespace std;
291 
292  //===========================================================================
293  // Getting SimHits
294  //===========================================================================
295 
296  double phi_MC = -999.; // phi of initial particle from HepMC
297  double eta_MC = -999.; // eta of initial particle from HepMC
298 
300  ev.getByToken(tok_evt_, evtMC); // generator in late 310_preX
301  if (!evtMC.isValid()) {
302  std::cout << "no HepMCProduct found" << std::endl;
303  }
304 
305  // MC particle with highest pt is taken as a direction reference
306  double maxPt = -99999.;
307  int npart = 0;
308 
309  const HepMC::GenEvent *myGenEvent = evtMC->GetEvent();
310  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
311  ++p) {
312  double phip = (*p)->momentum().phi();
313  double etap = (*p)->momentum().eta();
314  double pt = (*p)->momentum().perp();
315  if (pt > maxPt) {
316  npart++;
317  maxPt = pt;
318  phi_MC = phip;
319  eta_MC = etap;
320  }
321  }
322 
323  double partR = 0.3;
324 
325  // Hcal SimHits
326 
327  // Approximate calibration constants
328  const float calib_HB = 120.;
329  const float calib_HE = 190.;
330  const float calib_HF1 = hf1_; // 1.0/0.383;
331  const float calib_HF2 = hf2_; // 1.0/0.368;
332 
334  ev.getByToken(tok_hcal_, hcalHits);
335  const PCaloHitContainer *SimHitResult = hcalHits.product();
336 
337  float eta_diff;
338  float etaMax = 9999;
339  int ietaMax = 0;
340 
341  double HcalCone = 0;
342 
343  c.get<CaloGeometryRecord>().get(geometry);
344 
345  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin(); SimHits != SimHitResult->end();
346  ++SimHits) {
347  HcalDetId cell;
348  if (testNumber_)
349  cell = HcalHitRelabeller::relabel(SimHits->id(), hcons);
350  else
351  cell = HcalDetId(SimHits->id());
352 
353  auto cellGeometry = geometry->getSubdetectorGeometry(cell)->getGeometry(cell);
354  double etaS = cellGeometry->getPosition().eta();
355  double phiS = cellGeometry->getPosition().phi();
356  double en = SimHits->energy();
357 
358  int sub = cell.subdet();
359  int depth = cell.depth();
360  double ieta = cell.ieta();
361 
362  // Energy in Cone
363  double r = dR(eta_MC, phi_MC, etaS, phiS);
364 
365  if (r < partR) {
366  eta_diff = std::abs(eta_MC - etaS);
367  if (eta_diff < etaMax) {
368  etaMax = eta_diff;
369  ietaMax = cell.ieta();
370  }
371  // Approximation of calibration
372  if (sub == 1)
373  HcalCone += en * calib_HB;
374  else if (sub == 2)
375  HcalCone += en * calib_HE;
376  else if (sub == 4 && (depth == 1 || depth == 3))
377  HcalCone += en * calib_HF1;
378  else if (sub == 4 && (depth == 2 || depth == 4))
379  HcalCone += en * calib_HF2;
380  }
381 
382  if (auxPlots_) {
383  // HB
384  if (sub == 1) {
385  meSimHitsEnergyHB[0]->Fill(en);
386  meSimHitsEnergyHB[depth]->Fill(en);
387 
388  emean_vs_ieta_HB[0]->Fill(double(ieta), en);
389  emean_vs_ieta_HB[depth]->Fill(double(ieta), en);
390 
391  occupancy_vs_ieta_HB[0]->Fill(double(ieta));
392  occupancy_vs_ieta_HB[depth]->Fill(double(ieta));
393  }
394  // HE
395  if (sub == 2) {
396  meSimHitsEnergyHE[0]->Fill(en);
397  meSimHitsEnergyHE[depth]->Fill(en);
398 
399  emean_vs_ieta_HE[0]->Fill(double(ieta), en);
400  emean_vs_ieta_HE[depth]->Fill(double(ieta), en);
401 
402  occupancy_vs_ieta_HE[0]->Fill(double(ieta));
403  occupancy_vs_ieta_HE[depth]->Fill(double(ieta));
404  }
405  // HO
406  if (sub == 3) {
407  meSimHitsEnergyHO->Fill(en);
408 
409  emean_vs_ieta_HO->Fill(double(ieta), en);
410 
411  occupancy_vs_ieta_HO->Fill(double(ieta));
412  }
413  // HF
414  if (sub == 4) {
415  meSimHitsEnergyHF[0]->Fill(en);
416  meSimHitsEnergyHF[depth]->Fill(en);
417 
418  emean_vs_ieta_HF[0]->Fill(double(ieta), en);
419  emean_vs_ieta_HF[depth]->Fill(double(ieta), en);
420 
421  occupancy_vs_ieta_HF[0]->Fill(double(ieta));
422  occupancy_vs_ieta_HF[depth]->Fill(double(ieta));
423  }
424 
425  } // auxPlots_
426 
427  } // Loop over SimHits
428 
429  // Ecal EB SimHits
430  double EcalCone = 0;
431 
432  if (!ebHits_.empty()) {
434  ev.getByToken(tok_ecalEB_, ecalEBHits);
435  const PCaloHitContainer *SimHitResultEB = ecalEBHits.product();
436 
437  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin(); SimHits != SimHitResultEB->end();
438  ++SimHits) {
439  EBDetId EBid = EBDetId(SimHits->id());
440 
441  auto cellGeometry = geometry->getSubdetectorGeometry(EBid)->getGeometry(EBid);
442  double etaS = cellGeometry->getPosition().eta();
443  double phiS = cellGeometry->getPosition().phi();
444  double en = SimHits->energy();
445 
446  double r = dR(eta_MC, phi_MC, etaS, phiS);
447 
448  if (r < partR)
449  EcalCone += en;
450  }
451  } // ebHits_
452 
453  // Ecal EE SimHits
454  if (!eeHits_.empty()) {
456  ev.getByToken(tok_ecalEE_, ecalEEHits);
457  const PCaloHitContainer *SimHitResultEE = ecalEEHits.product();
458 
459  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin(); SimHits != SimHitResultEE->end();
460  ++SimHits) {
461  EEDetId EEid = EEDetId(SimHits->id());
462 
463  auto cellGeometry = geometry->getSubdetectorGeometry(EEid)->getGeometry(EEid);
464  double etaS = cellGeometry->getPosition().eta();
465  double phiS = cellGeometry->getPosition().phi();
466  double en = SimHits->energy();
467 
468  double r = dR(eta_MC, phi_MC, etaS, phiS);
469 
470  if (r < partR)
471  EcalCone += en;
472  }
473  } // eeHits_
474 
475  if (ietaMax != 0) { // If ietaMax == 0, there were no good HCAL SimHits
476  meEnConeEtaProfile->Fill(double(ietaMax), HcalCone);
477  meEnConeEtaProfile_E->Fill(double(ietaMax), EcalCone);
478  meEnConeEtaProfile_EH->Fill(double(ietaMax), HcalCone + EcalCone);
479  }
480 
481  nevtot++;
482 }
MonitorElement * meEnConeEtaProfile
std::vector< PCaloHit > PCaloHitContainer
double dR(double eta1, double phi1, double eta2, double phi2)
std::vector< MonitorElement * > emean_vs_ieta_HF
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
std::vector< MonitorElement * > occupancy_vs_ieta_HF
std::vector< MonitorElement * > meSimHitsEnergyHE
MonitorElement * meSimHitsEnergyHO
double npart
Definition: HydjetWrapper.h:49
bool ev
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEB_
void Fill(long long x)
MonitorElement * meEnConeEtaProfile_E
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHB
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * emean_vs_ieta_HO
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< MonitorElement * > emean_vs_ieta_HE
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
bool isValid() const
Definition: HandleBase.h:74
std::vector< MonitorElement * > occupancy_vs_ieta_HE
const HcalDDDRecConstants * hcons
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:38
T const * product() const
Definition: Handle.h:74
MonitorElement * meEnConeEtaProfile_EH
HLT enums.
MonitorElement * occupancy_vs_ieta_HO
std::vector< MonitorElement * > occupancy_vs_ieta_HB
DetId relabel(const uint32_t testId) const
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
std::vector< MonitorElement * > meSimHitsEnergyHF
void HcalSimHitsValidation::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  run,
edm::EventSetup const &  es 
)
override

Definition at line 37 of file HcalSimHitsValidation.cc.

References auxPlots_, DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), egammaForCoreTracking_cff::depth, emean_vs_ieta_HB, emean_vs_ieta_HE, emean_vs_ieta_HF, emean_vs_ieta_HO, edm::EventSetup::get(), HcalDDDRecConstants::getEtaRange(), HcalDDDRecConstants::getMaxDepth(), HcalDDDRecConstants::getNPhi(), hcons, trackerHits::histo, hcalTTPDigis_cfi::iEtaMax, createfilelist::int, maxDepthHB_, maxDepthHE_, maxDepthHF_, maxDepthHO_, meEnConeEtaProfile, meEnConeEtaProfile_E, meEnConeEtaProfile_EH, meSimHitsEnergyHB, meSimHitsEnergyHE, meSimHitsEnergyHF, meSimHitsEnergyHO, Nhb, Nhe, Nhf, Nho, occupancy_vs_ieta_HB, occupancy_vs_ieta_HE, occupancy_vs_ieta_HF, occupancy_vs_ieta_HO, and DQMStore::IBooker::setCurrentFolder().

37  {
39  es.get<HcalRecNumberingRecord>().get(pHRNDC);
40  hcons = &(*pHRNDC);
45 
46  // Get Phi segmentation from geometry, use the max phi number so that all iphi
47  // values are included.
48 
49  int NphiMax = hcons->getNPhi(0);
50 
51  NphiMax = (hcons->getNPhi(1) > NphiMax ? hcons->getNPhi(1) : NphiMax);
52  NphiMax = (hcons->getNPhi(2) > NphiMax ? hcons->getNPhi(2) : NphiMax);
53  NphiMax = (hcons->getNPhi(3) > NphiMax ? hcons->getNPhi(3) : NphiMax);
54 
55  // Center the iphi bins on the integers
56  // float iphi_min = 0.5;
57  // float iphi_max = NphiMax + 0.5;
58  // int iphi_bins = (int) (iphi_max - iphi_min);
59 
60  int iEtaHBMax = hcons->getEtaRange(0).second;
61  int iEtaHEMax = hcons->getEtaRange(1).second;
62  int iEtaHFMax = hcons->getEtaRange(2).second;
63  int iEtaHOMax = hcons->getEtaRange(3).second;
64 
65  // Retain classic behavior, all plots have same ieta range.
66  // Comment out code to allow each subdetector to have its on range
67 
68  int iEtaMax = (iEtaHBMax > iEtaHEMax ? iEtaHBMax : iEtaHEMax);
69  iEtaMax = (iEtaMax > iEtaHFMax ? iEtaMax : iEtaHFMax);
70  iEtaMax = (iEtaMax > iEtaHOMax ? iEtaMax : iEtaHOMax);
71 
72  iEtaHBMax = iEtaMax;
73  iEtaHEMax = iEtaMax;
74  iEtaHFMax = iEtaMax;
75  iEtaHOMax = iEtaMax;
76 
77  // Give an empty bin around the subdet ieta range to make it clear that all
78  // ieta rings have been included
79  float ieta_min_HB = -iEtaHBMax - 1.5;
80  float ieta_max_HB = iEtaHBMax + 1.5;
81  int ieta_bins_HB = (int)(ieta_max_HB - ieta_min_HB);
82 
83  float ieta_min_HE = -iEtaHEMax - 1.5;
84  float ieta_max_HE = iEtaHEMax + 1.5;
85  int ieta_bins_HE = (int)(ieta_max_HE - ieta_min_HE);
86 
87  float ieta_min_HF = -iEtaHFMax - 1.5;
88  float ieta_max_HF = iEtaHFMax + 1.5;
89  int ieta_bins_HF = (int)(ieta_max_HF - ieta_min_HF);
90 
91  float ieta_min_HO = -iEtaHOMax - 1.5;
92  float ieta_max_HO = iEtaHOMax + 1.5;
93  int ieta_bins_HO = (int)(ieta_max_HO - ieta_min_HO);
94 
95  Char_t histo[200];
96 
97  ib.setCurrentFolder("HcalHitsV/HcalSimHitTask");
98 
99  if (auxPlots_) {
100  // General counters
101  for (int depth = 0; depth <= maxDepthHB_; depth++) {
102  if (depth == 0) {
103  sprintf(histo, "N_HB");
104  } else {
105  sprintf(histo, "N_HB%d", depth);
106  }
107 
108  Nhb.push_back(ib.book1D(histo, histo, 2600, 0., 2600.));
109  }
110  for (int depth = 0; depth <= maxDepthHE_; depth++) {
111  if (depth == 0) {
112  sprintf(histo, "N_HE");
113  } else {
114  sprintf(histo, "N_HE%d", depth);
115  }
116 
117  Nhe.push_back(ib.book1D(histo, histo, 2600, 0., 2600.));
118  }
119 
120  sprintf(histo, "N_HO");
121  Nho = ib.book1D(histo, histo, 2200, 0., 2200.);
122 
123  for (int depth = 0; depth <= maxDepthHF_; depth++) {
124  if (depth == 0) {
125  sprintf(histo, "N_HF");
126  } else {
127  sprintf(histo, "N_HF%d", depth);
128  }
129 
130  Nhf.push_back(ib.book1D(histo, histo, 1800, 0., 1800.));
131  }
132 
133  // Mean energy vs iEta TProfiles
134  for (int depth = 0; depth <= maxDepthHB_; depth++) {
135  if (depth == 0) {
136  sprintf(histo, "emean_vs_ieta_HB");
137  } else {
138  sprintf(histo, "emean_vs_ieta_HB%d", depth);
139  }
140 
141  emean_vs_ieta_HB.push_back(
142  ib.bookProfile(histo, histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB, -10., 2000., " "));
143  }
144  for (int depth = 0; depth <= maxDepthHE_; depth++) {
145  if (depth == 0) {
146  sprintf(histo, "emean_vs_ieta_HE");
147  } else {
148  sprintf(histo, "emean_vs_ieta_HE%d", depth);
149  }
150 
151  emean_vs_ieta_HE.push_back(
152  ib.bookProfile(histo, histo, ieta_bins_HE, ieta_min_HE, ieta_max_HE, -10., 2000., " "));
153  }
154 
155  sprintf(histo, "emean_vs_ieta_HO");
156  emean_vs_ieta_HO = ib.bookProfile(histo, histo, ieta_bins_HO, ieta_min_HO, ieta_max_HO, -10., 2000., " ");
157 
158  for (int depth = 0; depth <= maxDepthHF_; depth++) {
159  if (depth == 0) {
160  sprintf(histo, "emean_vs_ieta_HF");
161  } else {
162  sprintf(histo, "emean_vs_ieta_HF%d", depth);
163  }
164 
165  emean_vs_ieta_HF.push_back(
166  ib.bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 2000., " "));
167  }
168 
169  // Occupancy vs. iEta TH1Fs
170  for (int depth = 0; depth <= maxDepthHB_; depth++) {
171  if (depth == 0) {
172  sprintf(histo, "occupancy_vs_ieta_HB");
173  } else {
174  sprintf(histo, "occupancy_vs_ieta_HB%d", depth);
175  }
176 
177  occupancy_vs_ieta_HB.push_back(ib.book1D(histo, histo, ieta_bins_HB, ieta_min_HB, ieta_max_HB));
178  }
179  for (int depth = 0; depth <= maxDepthHE_; depth++) {
180  if (depth == 0) {
181  sprintf(histo, "occupancy_vs_ieta_HE");
182  } else {
183  sprintf(histo, "occupancy_vs_ieta_HE%d", depth);
184  }
185 
186  occupancy_vs_ieta_HE.push_back(ib.book1D(histo, histo, ieta_bins_HE, ieta_min_HE, ieta_max_HE));
187  }
188 
189  sprintf(histo, "occupancy_vs_ieta_HO");
190  occupancy_vs_ieta_HO = ib.book1D(histo, histo, ieta_bins_HO, ieta_min_HO, ieta_max_HO);
191 
192  for (int depth = 0; depth <= maxDepthHF_; depth++) {
193  if (depth == 0) {
194  sprintf(histo, "occupancy_vs_ieta_HF");
195  } else {
196  sprintf(histo, "occupancy_vs_ieta_HF%d", depth);
197  }
198 
199  occupancy_vs_ieta_HF.push_back(ib.book1D(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF));
200  }
201 
202  // Energy spectra
203  for (int depth = 0; depth <= maxDepthHB_; depth++) {
204  if (depth == 0) {
205  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HB");
206  } else {
207  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HB%d", depth);
208  }
209 
210  meSimHitsEnergyHB.push_back(ib.book1D(histo, histo, 510, -0.1, 5.));
211  }
212  for (int depth = 0; depth <= maxDepthHE_; depth++) {
213  if (depth == 0) {
214  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HE");
215  } else {
216  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HE%d", depth);
217  }
218 
219  meSimHitsEnergyHE.push_back(ib.book1D(histo, histo, 510, -0.1, 5.));
220  }
221 
222  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HO");
223  meSimHitsEnergyHO = ib.book1D(histo, histo, 510, -0.1, 5.);
224 
225  for (int depth = 0; depth <= maxDepthHF_; depth++) {
226  if (depth == 0) {
227  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HF");
228  } else {
229  sprintf(histo, "HcalSimHitTask_energy_of_simhits_HF%d", depth);
230  }
231 
232  meSimHitsEnergyHF.push_back(ib.book1D(histo, histo, 1010, -5., 500.));
233  }
234 
235  } // auxPlots_
236 
237  // Energy in Cone
238  sprintf(histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths");
239  meEnConeEtaProfile = ib.bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 200., " ");
240 
241  sprintf(histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_E");
242  meEnConeEtaProfile_E = ib.bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 200., " ");
243 
244  sprintf(histo, "HcalSimHitTask_En_simhits_cone_profile_vs_ieta_all_depths_EH");
245  meEnConeEtaProfile_EH = ib.bookProfile(histo, histo, ieta_bins_HF, ieta_min_HF, ieta_max_HF, -10., 200., " ");
246 }
MonitorElement * meEnConeEtaProfile
std::vector< MonitorElement * > emean_vs_ieta_HF
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
std::vector< MonitorElement * > occupancy_vs_ieta_HF
std::vector< MonitorElement * > Nhf
std::vector< MonitorElement * > meSimHitsEnergyHE
MonitorElement * meSimHitsEnergyHO
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * meEnConeEtaProfile_E
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHB
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * emean_vs_ieta_HO
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::vector< MonitorElement * > emean_vs_ieta_HE
std::vector< MonitorElement * > occupancy_vs_ieta_HE
const HcalDDDRecConstants * hcons
int getMaxDepth(const int &type) const
MonitorElement * meEnConeEtaProfile_EH
MonitorElement * occupancy_vs_ieta_HO
std::vector< MonitorElement * > occupancy_vs_ieta_HB
std::vector< MonitorElement * > Nhb
std::vector< MonitorElement * > Nhe
int getNPhi(const int &type) const
std::vector< MonitorElement * > meSimHitsEnergyHF
double HcalSimHitsValidation::dPhiWsign ( double  phi1,
double  phi2 
)
private

Definition at line 517 of file HcalSimHitsValidation.cc.

References DEFINE_FWK_MODULE, PI, and tmp.

517  {
518  // clockwise phi2 w.r.t phi1 means "+" phi distance
519  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
520 
521  double PI = 3.1415926535898;
522  double a1 = phi1;
523  double a2 = phi2;
524  double tmp = a2 - a1;
525  if (a1 * a2 < 0.) {
526  if (a1 > 0.5 * PI)
527  tmp += 2. * PI;
528  if (a2 > 0.5 * PI)
529  tmp -= 2. * PI;
530  }
531  return tmp;
532 }
#define PI
Definition: QcdUeDQM.h:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double HcalSimHitsValidation::dR ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)
private

Definition at line 484 of file HcalSimHitsValidation.cc.

References PI, mathSSE::sqrt(), and tmp.

Referenced by analyze().

484  {
485  double PI = 3.1415926535898;
486  double deltaphi = phi1 - phi2;
487  if (phi2 > phi1) {
488  deltaphi = phi2 - phi1;
489  }
490  if (deltaphi > PI) {
491  deltaphi = 2. * PI - deltaphi;
492  }
493  double deltaeta = eta2 - eta1;
494  double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
495  return tmp;
496 }
T sqrt(T t)
Definition: SSEVec.h:18
#define PI
Definition: QcdUeDQM.h:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void HcalSimHitsValidation::endJob ( void  )
override

Definition at line 248 of file HcalSimHitsValidation.cc.

References funct::abs(), auxPlots_, egammaForCoreTracking_cff::depth, MonitorElement::getBinContent(), mps_fire::i, maxDepthHB_, maxDepthHE_, maxDepthHF_, nevtot, occupancy_vs_ieta_HB, occupancy_vs_ieta_HE, occupancy_vs_ieta_HF, occupancy_vs_ieta_HO, and MonitorElement::setBinContent().

248  {
249  if (auxPlots_) {
250  for (int i = 1; i <= occupancy_vs_ieta_HB[0]->getNbinsX(); i++) {
251  int ieta = i - 43; // -41 -1, 1 41
252 
253  float phi_factor;
254 
255  if (std::abs(ieta) <= 20)
256  phi_factor = 72.;
257  else if (std::abs(ieta) < 40)
258  phi_factor = 36.;
259  else
260  phi_factor = 18.;
261 
262  float cnorm;
263 
264  // Occupancy vs. iEta TH1Fs
265  for (int depth = 0; depth <= maxDepthHB_; depth++) {
266  cnorm = occupancy_vs_ieta_HB[depth]->getBinContent(i) / (phi_factor * nevtot);
267  occupancy_vs_ieta_HB[depth]->setBinContent(i, cnorm);
268  }
269  for (int depth = 0; depth <= maxDepthHE_; depth++) {
270  cnorm = occupancy_vs_ieta_HE[depth]->getBinContent(i) / (phi_factor * nevtot);
271  occupancy_vs_ieta_HE[depth]->setBinContent(i, cnorm);
272  }
273 
274  cnorm = occupancy_vs_ieta_HO->getBinContent(i) / (phi_factor * nevtot);
276 
277  for (int depth = 0; depth <= maxDepthHF_; depth++) {
278  cnorm = occupancy_vs_ieta_HF[depth]->getBinContent(i) / (phi_factor * nevtot);
279  occupancy_vs_ieta_HF[depth]->setBinContent(i, cnorm);
280  }
281  }
282  }
283 
284  // let's see if this breaks anything
285  // if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
286 }
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< MonitorElement * > occupancy_vs_ieta_HF
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< MonitorElement * > occupancy_vs_ieta_HE
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * occupancy_vs_ieta_HO
std::vector< MonitorElement * > occupancy_vs_ieta_HB
double HcalSimHitsValidation::phi12 ( double  phi1,
double  en1,
double  phi2,
double  en2 
)
private

Definition at line 498 of file HcalSimHitsValidation.cc.

References PI, and tmp.

498  {
499  // weighted mean value of phi1 and phi2
500 
501  double tmp;
502  double PI = 3.1415926535898;
503  double a1 = phi1;
504  double a2 = phi2;
505 
506  if (a1 > 0.5 * PI && a2 < 0.)
507  a2 += 2 * PI;
508  if (a2 > 0.5 * PI && a1 < 0.)
509  a1 += 2 * PI;
510  tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
511  if (tmp > PI)
512  tmp -= 2. * PI;
513 
514  return tmp;
515 }
#define PI
Definition: QcdUeDQM.h:36
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

bool HcalSimHitsValidation::auxPlots_
private

Definition at line 70 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), endJob(), and HcalSimHitsValidation().

std::string HcalSimHitsValidation::ebHits_
private

Definition at line 58 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

std::string HcalSimHitsValidation::eeHits_
private

Definition at line 58 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

std::vector<MonitorElement *> HcalSimHitsValidation::emean_vs_ieta_HB
private

Definition at line 83 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::emean_vs_ieta_HE
private

Definition at line 84 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::emean_vs_ieta_HF
private

Definition at line 86 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HO
private

Definition at line 85 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::string HcalSimHitsValidation::g4Label_
private

Definition at line 58 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

edm::ESHandle<CaloGeometry> HcalSimHitsValidation::geometry
private
std::string HcalSimHitsValidation::hcalHits_
private

Definition at line 58 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

const HcalDDDRecConstants* HcalSimHitsValidation::hcons
private

Definition at line 65 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

double HcalSimHitsValidation::hf1_
private

Definition at line 110 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

double HcalSimHitsValidation::hf2_
private

Definition at line 111 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

int HcalSimHitsValidation::maxDepthHB_
private

Definition at line 66 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHE_
private

Definition at line 66 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHF_
private

Definition at line 67 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHO_
private

Definition at line 67 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile
private

Definition at line 94 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_E
private

Definition at line 95 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_EH
private

Definition at line 96 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::meSimHitsEnergyHB
private

Definition at line 99 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::meSimHitsEnergyHE
private

Definition at line 100 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::meSimHitsEnergyHF
private

Definition at line 102 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHO
private

Definition at line 101 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

int HcalSimHitsValidation::nevtot
private

Definition at line 107 of file HcalSimHitsValidation.h.

Referenced by analyze(), endJob(), and HcalSimHitsValidation().

std::vector<MonitorElement *> HcalSimHitsValidation::Nhb
private

Definition at line 73 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::Nhe
private

Definition at line 74 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::Nhf
private

Definition at line 76 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nho
private

Definition at line 75 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

std::vector<MonitorElement *> HcalSimHitsValidation::occupancy_vs_ieta_HB
private

Definition at line 88 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

std::vector<MonitorElement *> HcalSimHitsValidation::occupancy_vs_ieta_HE
private

Definition at line 89 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

std::vector<MonitorElement *> HcalSimHitsValidation::occupancy_vs_ieta_HF
private

Definition at line 91 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HO
private

Definition at line 90 of file HcalSimHitsValidation.h.

Referenced by analyze(), bookHistograms(), and endJob().

std::string HcalSimHitsValidation::outputFile_
private

Definition at line 57 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

bool HcalSimHitsValidation::testNumber_
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_ecalEB_
private

Definition at line 62 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_ecalEE_
private

Definition at line 63 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::HepMCProduct> HcalSimHitsValidation::tok_evt_
private

Definition at line 60 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HcalSimHitsValidation::tok_hcal_
private

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().