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:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

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
 
virtual void endJob ()
 
 HcalSimHitsValidation (edm::ParameterSet const &conf)
 
 ~HcalSimHitsValidation () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void beginRun (edm::Run const &, edm::EventSetup const &) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
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_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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::getUntrackedParameter(), hcalHits_, 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  tok_evt_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
18  tok_hcal_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_,hcalHits_));
19  tok_ecalEB_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_,ebHits_));
20  tok_ecalEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag(g4Label_,eeHits_));
21 
22  if ( !outputFile_.empty() ) { edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
23  } else {
24  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will NOT be saved";
25  }
26 
27  nevtot = 0;
28 
29 }
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 32 of file HcalSimHitsValidation.cc.

32 { }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 254 of file HcalSimHitsValidation.cc.

References funct::abs(), auxPlots_, gather_cfg::cout, particleFlowClusterECALTimeSelected_cfi::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, 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_.

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

Implements DQMEDAnalyzer.

Definition at line 35 of file HcalSimHitsValidation.cc.

References auxPlots_, DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), particleFlowClusterECALTimeSelected_cfi::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().

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

References DEFINE_FWK_MODULE, PI, and tmp.

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

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

Referenced by analyze().

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

Definition at line 210 of file HcalSimHitsValidation.cc.

References funct::abs(), auxPlots_, particleFlowClusterECALTimeSelected_cfi::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().

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

References PI, and tmp.

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

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().