test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void analyze (edm::Event const &ev, edm::EventSetup const &c)
 
virtual void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
 HcalSimHitsValidation (edm::ParameterSet const &conf)
 
 ~HcalSimHitsValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual 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
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & 
itemsToGetFromEvent () 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
 
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

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
 
edm::ESHandle< CaloGeometrygeometry
 
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::PCaloHitContainer
tok_ecalEB_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_ecalEE_
 
edm::EDGetTokenT
< edm::HepMCProduct
tok_evt_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
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::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (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 edm::ParameterSet::getUntrackedParameter(), HLT_25ns10e33_v2_cff::InputTag, 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 
10  // register for data access
11  tok_evt_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
12  tok_hcal_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","HcalHits"));
13  tok_ecalEB_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","EcalHitsEB"));
14  tok_ecalEE_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","EcalHitsEE"));
15 
16  if ( outputFile_.size() != 0 ) { edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
17  } else {
18  edm::LogInfo("OutputInfo") << " Hcal SimHit Task histograms will NOT be saved";
19  }
20 
21  nevtot = 0;
22 
23 
24 }
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 ( )

Definition at line 27 of file HcalSimHitsValidation.cc.

27 { }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 255 of file HcalSimHitsValidation.cc.

References funct::abs(), gather_cfg::cout, HcalDetId::depth(), HLT_25ns10e33_v2_cff::depth, dR(), emean_vs_ieta_HB, emean_vs_ieta_HE, emean_vs_ieta_HF, emean_vs_ieta_HO, eta, PV3DBase< T, PVType, FrameType >::eta(), HLT_25ns10e33_v2_cff::etaMax, MonitorElement::Fill(), geometry, edm::EventSetup::get(), edm::Event::getByToken(), CaloCellGeometry::getPosition(), HcalDetId::ieta(), meEnConeEtaProfile, meEnConeEtaProfile_E, meEnConeEtaProfile_EH, meSimHitsEnergyHB, meSimHitsEnergyHE, meSimHitsEnergyHF, meSimHitsEnergyHO, nevtot, occupancy_vs_ieta_HB, occupancy_vs_ieta_HE, occupancy_vs_ieta_HF, occupancy_vs_ieta_HO, AlCaHLTBitMon_ParallelJobs::p, phi, PV3DBase< T, PVType, FrameType >::phi(), EnergyCorrector::pt, alignCSCRings::r, jetcorrextractor::sign(), HcalDetId::subdet(), testNumber_, tok_ecalEB_, tok_ecalEE_, tok_evt_, tok_hcal_, HcalTestNumbering::unpackHcalIndex(), and z.

255  {
256 
257  using namespace edm;
258  using namespace std;
259 
260  //===========================================================================
261  // Getting SimHits
262  //===========================================================================
263 
264  double phi_MC = -999.; // phi of initial particle from HepMC
265  double eta_MC = -999.; // eta of initial particle from HepMC
266 
268  ev.getByToken(tok_evt_,evtMC); // generator in late 310_preX
269  if (!evtMC.isValid()) {
270  std::cout << "no HepMCProduct found" << std::endl;
271  }
272 
273  // MC particle with highest pt is taken as a direction reference
274  double maxPt = -99999.;
275  int npart = 0;
276 
277  const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
278  for ( HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
279  p != myGenEvent->particles_end(); ++p ) {
280  double phip = (*p)->momentum().phi();
281  double etap = (*p)->momentum().eta();
282  double pt = (*p)->momentum().perp();
283  if(pt > maxPt) {npart++; maxPt = pt; phi_MC = phip; eta_MC = etap; }
284  }
285 
286  double partR = 0.3;
287 
288 
289  //Hcal SimHits
290 
291  //Approximate calibration constants
292  const float calib_HB = 120.;
293  const float calib_HE = 190.;
294  const float calib_HF1 = 1.0/0.383;
295  const float calib_HF2 = 1.0/0.368;
296 
298  ev.getByToken(tok_hcal_,hcalHits);
299  const PCaloHitContainer * SimHitResult = hcalHits.product () ;
300 
301  float eta_diff;
302  float etaMax = 9999;
303  int ietaMax = 0;
304 
305  double HcalCone = 0;
306 
307  c.get<CaloGeometryRecord>().get (geometry);
308 
309  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResult->begin () ; SimHits != SimHitResult->end(); ++SimHits) {
310  HcalDetId cell;
311  if (testNumber_) {
312  int subdet, z, depth, eta, phi, lay;
313  HcalTestNumbering::unpackHcalIndex(SimHits->id(), subdet, z, depth, eta,
314  phi, lay);
315  int sign = (z==0) ? (-1):(1);
316  eta *= sign;
317  cell = HcalDetId((HcalSubdetector)(subdet), eta, phi, depth);
318  } else {
319  cell = HcalDetId(SimHits->id());
320  }
321 
322  const CaloCellGeometry* cellGeometry = geometry->getSubdetectorGeometry (cell)->getGeometry (cell);
323  double etaS = cellGeometry->getPosition().eta () ;
324  double phiS = cellGeometry->getPosition().phi () ;
325  double en = SimHits->energy();
326 
327  int sub = cell.subdet();
328  int depth = cell.depth();
329  double ieta = cell.ieta();
330 
331  //Energy in Cone
332  double r = dR(eta_MC, phi_MC, etaS, phiS);
333 
334  if (r < partR){
335  eta_diff = std::abs(eta_MC - etaS);
336  if(eta_diff < etaMax) {
337  etaMax = eta_diff;
338  ietaMax = cell.ieta();
339  }
340  //Approximation of calibration
341  if (sub == 1) HcalCone += en*calib_HB;
342  else if (sub == 2) HcalCone += en*calib_HE;
343  else if (sub == 4 && (depth == 1 || depth == 3)) HcalCone += en*calib_HF1;
344  else if (sub == 4 && (depth == 2 || depth == 4)) HcalCone += en*calib_HF2;
345  }
346 
347  //HB
348  if (sub == 1){
349  meSimHitsEnergyHB[0]->Fill(en);
350  meSimHitsEnergyHB[depth]->Fill(en);
351 
352  emean_vs_ieta_HB[0]->Fill(double(ieta), en);
353  emean_vs_ieta_HB[depth]->Fill(double(ieta), en);
354 
355  occupancy_vs_ieta_HB[0]->Fill(double(ieta));
356  occupancy_vs_ieta_HB[depth]->Fill(double(ieta));
357  }
358  //HE
359  if (sub == 2){
360  meSimHitsEnergyHE[0]->Fill(en);
361  meSimHitsEnergyHE[depth]->Fill(en);
362 
363  emean_vs_ieta_HE[0]->Fill(double(ieta), en);
364  emean_vs_ieta_HE[depth]->Fill(double(ieta), en);
365 
366  occupancy_vs_ieta_HE[0]->Fill(double(ieta));
367  occupancy_vs_ieta_HE[depth]->Fill(double(ieta));
368  }
369  //HO
370  if (sub == 3){
371  meSimHitsEnergyHO->Fill(en);
372 
373  emean_vs_ieta_HO->Fill(double(ieta), en);
374 
375  occupancy_vs_ieta_HO->Fill(double(ieta));
376  }
377  //HF
378  if (sub == 4){
379  meSimHitsEnergyHF[0]->Fill(en);
380  meSimHitsEnergyHF[depth]->Fill(en);
381 
382  emean_vs_ieta_HF[0]->Fill(double(ieta), en);
383  emean_vs_ieta_HF[depth]->Fill(double(ieta), en);
384 
385  occupancy_vs_ieta_HF[0]->Fill(double(ieta));
386  occupancy_vs_ieta_HF[depth]->Fill(double(ieta));
387  }
388  } //Loop over SimHits
389 
390  //Ecal EB SimHits
392  ev.getByToken(tok_ecalEB_,ecalEBHits);
393  const PCaloHitContainer * SimHitResultEB = ecalEBHits.product () ;
394 
395  double EcalCone = 0;
396 
397  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEB->begin () ; SimHits != SimHitResultEB->end(); ++SimHits) {
398 
399  EBDetId EBid = EBDetId(SimHits->id());
400 
401  const CaloCellGeometry* 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 
411  //Ecal EE SimHits
413  ev.getByToken(tok_ecalEE_,ecalEEHits);
414  const PCaloHitContainer * SimHitResultEE = ecalEEHits.product () ;
415 
416  for (std::vector<PCaloHit>::const_iterator SimHits = SimHitResultEE->begin () ; SimHits != SimHitResultEE->end(); ++SimHits) {
417 
418  EEDetId EEid = EEDetId(SimHits->id());
419 
420  const CaloCellGeometry* cellGeometry = geometry->getSubdetectorGeometry (EEid)->getGeometry (EEid) ;
421  double etaS = cellGeometry->getPosition().eta () ;
422  double phiS = cellGeometry->getPosition().phi () ;
423  double en = SimHits->energy();
424 
425  double r = dR(eta_MC, phi_MC, etaS, phiS);
426 
427  if (r < partR) EcalCone += en;
428  }
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
double sign(double x)
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
MonitorElement * meSimHitsEnergyHO
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
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
edm::EDGetTokenT< edm::PCaloHitContainer > tok_ecalEE_
MonitorElement * emean_vs_ieta_HO
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
std::vector< MonitorElement * > emean_vs_ieta_HB
std::vector< MonitorElement * > meSimHitsEnergyHF
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hcal_
std::vector< MonitorElement * > occupancy_vs_ieta_HE
std::vector< MonitorElement * > meSimHitsEnergyHE
MonitorElement * meEnConeEtaProfile_EH
T eta() const
Definition: PV3DBase.h:76
MonitorElement * occupancy_vs_ieta_HO
edm::ESHandle< CaloGeometry > geometry
tuple cout
Definition: gather_cfg.py:145
edm::EDGetTokenT< edm::HepMCProduct > tok_evt_
std::vector< MonitorElement * > occupancy_vs_ieta_HB
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void HcalSimHitsValidation::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  run,
edm::EventSetup const &  es 
)
virtual

Implements DQMEDAnalyzer.

Definition at line 30 of file HcalSimHitsValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::bookProfile(), HLT_25ns10e33_v2_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, timingPdfMaker::histo, 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().

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

Definition at line 468 of file HcalSimHitsValidation.cc.

References 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 201 of file HcalSimHitsValidation.cc.

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

201  {
202  //before check that histos are there....
203 
204  // let's see if this breaks anything
205  // check if ME still there (and not killed by MEtoEDM for memory saving)
206  /*if( dbe_ )
207  {
208  // check existence of first histo in the list
209  if (! dbe_->get("HcalSimHitsV/HcalSimHitTask/N_HB")) return;
210  }
211  else
212  return;*/
213 
214  //======================================
215 
216  for (int i = 1; i <= occupancy_vs_ieta_HB[0]->getNbinsX(); i++){
217 
218  int ieta = i - 42; // -41 -1, 0 40
219  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
220 
221  float phi_factor;
222 
223  if (std::abs(ieta) <= 20) phi_factor = 72.;
224  else if (std::abs(ieta) < 40) phi_factor = 36.;
225  else phi_factor = 18.;
226 
227  float cnorm;
228 
229  //Occupancy vs. iEta TH1Fs
230  for(int depth = 0; depth <= maxDepthHB_; depth++){
231  cnorm = occupancy_vs_ieta_HB[depth]->getBinContent(i) / (phi_factor * nevtot);
232  occupancy_vs_ieta_HB[depth]->setBinContent(i, cnorm);
233  }
234  for(int depth = 0; depth <= maxDepthHE_; depth++){
235  cnorm = occupancy_vs_ieta_HE[depth]->getBinContent(i) / (phi_factor * nevtot);
236  occupancy_vs_ieta_HE[depth]->setBinContent(i, cnorm);
237  }
238 
239  cnorm = occupancy_vs_ieta_HO->getBinContent(i) / (phi_factor * nevtot);
241 
242  for(int depth = 0; depth <= maxDepthHF_; depth++){
243  cnorm = occupancy_vs_ieta_HF[depth]->getBinContent(i) / (phi_factor * nevtot);
244  occupancy_vs_ieta_HF[depth]->setBinContent(i, cnorm);
245  }
246 
247  }
248 
249 
250  // let's see if this breaks anything
251  //if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_);
252 }
int i
Definition: DBlmapReader.cc:9
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

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

Definition at line 84 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 85 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 87 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::emean_vs_ieta_HO
private

Definition at line 86 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

edm::ESHandle<CaloGeometry> HcalSimHitsValidation::geometry
private
const HcalDDDRecConstants* HcalSimHitsValidation::hcons
private

Definition at line 67 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

int HcalSimHitsValidation::maxDepthHB_
private

Definition at line 68 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHE_
private

Definition at line 68 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHF_
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by bookHistograms(), and endJob().

int HcalSimHitsValidation::maxDepthHO_
private

Definition at line 69 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile
private

Definition at line 95 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_E
private

Definition at line 96 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meEnConeEtaProfile_EH
private

Definition at line 97 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 100 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 101 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 103 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* HcalSimHitsValidation::meSimHitsEnergyHO
private

Definition at line 102 of file HcalSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

int HcalSimHitsValidation::nevtot
private

Definition at line 108 of file HcalSimHitsValidation.h.

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

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

Definition at line 74 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 75 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 77 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

MonitorElement* HcalSimHitsValidation::Nho
private

Definition at line 76 of file HcalSimHitsValidation.h.

Referenced by bookHistograms().

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

Definition at line 89 of file HcalSimHitsValidation.h.

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

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

Definition at line 90 of file HcalSimHitsValidation.h.

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

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

Definition at line 92 of file HcalSimHitsValidation.h.

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

MonitorElement* HcalSimHitsValidation::occupancy_vs_ieta_HO
private

Definition at line 91 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 71 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 64 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 65 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 62 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().

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

Definition at line 63 of file HcalSimHitsValidation.h.

Referenced by analyze(), and HcalSimHitsValidation().