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 43 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() ) { edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
27  } else {
28  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will NOT be saved";
29  }
30 
31  nevtot = 0;
32 
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 36 of file HcalSimHitsValidation.cc.

36 { }

Member Function Documentation

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

Definition at line 257 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_.

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

Definition at line 39 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().

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

Definition at line 469 of file HcalSimHitsValidation.cc.

References DEFINE_FWK_MODULE, PI, and tmp.

469  {
470  // clockwise phi2 w.r.t phi1 means "+" phi distance
471  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
472 
473  double PI = 3.1415926535898;
474  double a1 = phi1; double a2 = phi2;
475  double tmp = a2 - a1;
476  if( a1*a2 < 0.) {
477  if(a1 > 0.5 * PI) tmp += 2.*PI;
478  if(a2 > 0.5 * PI) tmp -= 2.*PI;
479  }
480  return tmp;
481 
482 }
#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 443 of file HcalSimHitsValidation.cc.

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

Referenced by analyze().

443  {
444  double PI = 3.1415926535898;
445  double deltaphi= phi1 - phi2;
446  if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
447  if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
448  double deltaeta = eta2 - eta1;
449  double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
450  return tmp;
451 }
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 214 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().

214  {
215 
216  if (auxPlots_){
217 
218  for (int i = 1; i <= occupancy_vs_ieta_HB[0]->getNbinsX(); i++){
219 
220  int ieta = i - 43; // -41 -1, 1 41
221 
222  float phi_factor;
223 
224  if (std::abs(ieta) <= 20) phi_factor = 72.;
225  else if (std::abs(ieta) < 40) phi_factor = 36.;
226  else phi_factor = 18.;
227 
228  float cnorm;
229 
230  //Occupancy vs. iEta TH1Fs
231  for(int depth = 0; depth <= maxDepthHB_; depth++){
232  cnorm = occupancy_vs_ieta_HB[depth]->getBinContent(i) / (phi_factor * nevtot);
233  occupancy_vs_ieta_HB[depth]->setBinContent(i, cnorm);
234  }
235  for(int depth = 0; depth <= maxDepthHE_; depth++){
236  cnorm = occupancy_vs_ieta_HE[depth]->getBinContent(i) / (phi_factor * nevtot);
237  occupancy_vs_ieta_HE[depth]->setBinContent(i, cnorm);
238  }
239 
240  cnorm = occupancy_vs_ieta_HO->getBinContent(i) / (phi_factor * nevtot);
242 
243  for(int depth = 0; depth <= maxDepthHF_; depth++){
244  cnorm = occupancy_vs_ieta_HF[depth]->getBinContent(i) / (phi_factor * nevtot);
245  occupancy_vs_ieta_HF[depth]->setBinContent(i, cnorm);
246  }
247 
248  }
249 
250  }
251 
252  // let's see if this breaks anything
253  //if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
254 }
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 453 of file HcalSimHitsValidation.cc.

References PI, and tmp.

453  {
454  // weighted mean value of phi1 and phi2
455 
456  double tmp;
457  double PI = 3.1415926535898;
458  double a1 = phi1; double a2 = phi2;
459 
460  if( a1 > 0.5*PI && a2 < 0.) a2 += 2*PI;
461  if( a2 > 0.5*PI && a1 < 0.) a1 += 2*PI;
462  tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
463  if(tmp > PI) tmp -= 2.*PI;
464 
465  return tmp;
466 
467 }
#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 73 of file HcalSimHitsValidation.h.

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

std::string HcalSimHitsValidation::ebHits_
private

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

std::string HcalSimHitsValidation::eeHits_
private

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 86 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 87 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 89 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HO
private

Definition at line 88 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

std::string HcalSimHitsValidation::g4Label_
private

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

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

Definition at line 61 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

const HcalDDDRecConstants* HcalSimHitsValidation::hcons
private

Definition at line 68 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

double HcalSimHitsValidation::hf1_
private

Definition at line 113 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

double HcalSimHitsValidation::hf2_
private

Definition at line 114 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

int HcalSimHitsValidation::maxDepthHB_
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHE_
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHF_
private

Definition at line 70 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHO_
private

Definition at line 70 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile
private

Definition at line 97 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_E
private

Definition at line 98 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_EH
private

Definition at line 99 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 102 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 103 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 105 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHO
private

Definition at line 104 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

int HcalSimHitsValidation::nevtot
private

Definition at line 110 of file HcalSimHitsValidation.h.

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

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

Definition at line 76 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 77 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 79 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nho
private

Definition at line 78 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 91 of file HcalSimHitsValidation.h.

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

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

Definition at line 92 of file HcalSimHitsValidation.h.

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

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

Definition at line 94 of file HcalSimHitsValidation.h.

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

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HO
private

Definition at line 93 of file HcalSimHitsValidation.h.

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

std::string HcalSimHitsValidation::outputFile_
private

Definition at line 60 of file HcalSimHitsValidation.h.

Referenced by HcalSimHitsValidation().

bool HcalSimHitsValidation::testNumber_
private

Definition at line 72 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 65 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 66 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 63 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 64 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().