CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Attributes
HGCalHitValidation Class Reference

#include <Validation/HGCalValidation/plugins/HGCalHitValidation.cc>

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

Public Member Functions

 HGCalHitValidation (const edm::ParameterSet &)
 
 ~HGCalHitValidation () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Types

typedef std::tuple< float, float, float, float > HGCHitTuple
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
template<class T1 >
void analyzeHGCalRecHit (T1 const &theHits, std::map< unsigned int, HGCHitTuple > const &hitRefs)
 
void analyzeHGCalSimHit (edm::Handle< std::vector< PCaloHit >> const &simHits, int idet, MonitorElement *hist, std::map< unsigned int, HGCHitTuple > &)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 

Private Attributes

edm::EDGetTokenT< HGChebRecHitCollectionbhRecHitTokeng_
 
edm::EDGetTokenT< HBHERecHitCollectionbhRecHitTokenh_
 
edm::InputTag bhSimHitSource
 
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
 
edm::EDGetTokenT< HGCeeRecHitCollectioneeRecHitToken_
 
edm::InputTag eeSimHitSource
 
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
 
edm::EDGetTokenT< HGChefRecHitCollectionfhRecHitToken_
 
edm::InputTag fhSimHitSource
 
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
 
std::vector< std::string > geometrySource_
 
const HcalDDDRecConstantshcConr_
 
const HcalDDDSimConstantshcCons_
 
const CaloSubdetectorGeometryhcGeometry_
 
MonitorElementhebdEtaVsEta
 
MonitorElementhebdPhiVsPhi
 
MonitorElementhebdzVsZ
 
MonitorElementhebEnRec
 
MonitorElementhebEnSim
 
MonitorElementhebEnSimRec
 
MonitorElementhebRecVsSimX
 
MonitorElementhebRecVsSimY
 
MonitorElementhebRecVsSimZ
 
MonitorElementheedxVsX
 
MonitorElementheedyVsY
 
MonitorElementheedzVsZ
 
MonitorElementheeEnRec
 
MonitorElementheeEnSim
 
MonitorElementheeEnSimRec
 
MonitorElementheeRecVsSimX
 
MonitorElementheeRecVsSimY
 
MonitorElementheeRecVsSimZ
 
MonitorElementhefdxVsX
 
MonitorElementhefdyVsY
 
MonitorElementhefdzVsZ
 
MonitorElementhefEnRec
 
MonitorElementhefEnSim
 
MonitorElementhefEnSimRec
 
MonitorElementhefRecVsSimX
 
MonitorElementhefRecVsSimY
 
MonitorElementhefRecVsSimZ
 
std::vector< const HGCalDDDConstants * > hgcCons_
 
std::vector< const HGCalGeometry * > hgcGeometry_
 
std::vector< int > ietaExcludeBH_
 
bool ifHCAL_
 
bool ifHCALsim_
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 62 of file HGCalHitValidation.cc.

Member Typedef Documentation

typedef std::tuple<float,float,float,float> HGCalHitValidation::HGCHitTuple
protected

Definition at line 71 of file HGCalHitValidation.cc.

Constructor & Destructor Documentation

HGCalHitValidation::HGCalHitValidation ( const edm::ParameterSet cfg)
explicit

Definition at line 121 of file HGCalHitValidation.cc.

References bhRecHitTokeng_, bhRecHitTokenh_, bhSimHitToken_, eeRecHitToken_, eeSimHitToken_, fhRecHitToken_, fhSimHitToken_, geometrySource_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ietaExcludeBH_, ifHCAL_, ifHCALsim_, and gen::k.

121  {
122 
123  geometrySource_ = cfg.getUntrackedParameter< std::vector<std::string> >("geometrySource");
124  eeSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("eeSimHitSource"));
125  fhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("fhSimHitSource"));
126  bhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("bhSimHitSource"));
127  eeRecHitToken_ = consumes<HGCeeRecHitCollection>(cfg.getParameter<edm::InputTag>("eeRecHitSource"));
128  fhRecHitToken_ = consumes<HGChefRecHitCollection>(cfg.getParameter<edm::InputTag>("fhRecHitSource"));
129  ietaExcludeBH_ = cfg.getParameter<std::vector<int> >("ietaExcludeBH");
130  ifHCAL_ = cfg.getParameter<bool>("ifHCAL");
131  ifHCALsim_ = cfg.getParameter<bool>("ifHCALsim");
132  if (ifHCAL_)
133  bhRecHitTokenh_ = consumes<HBHERecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource"));
134  else
135  bhRecHitTokeng_ = consumes<HGChebRecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource"));
136 
137 #ifdef EDM_ML_DEBUG
138  edm::LogInfo("HGCalValid") << "Exclude the following "
139  << ietaExcludeBH_.size()
140  << " ieta values from BH plots (BH "
141  << ifHCAL_ << ") ";
142  for (unsigned int k=0; k<ietaExcludeBH_.size(); ++k)
143  edm::LogInfo("HGCalValid") << " [" << k << "] " << ietaExcludeBH_[k];
144 #endif
145 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
std::vector< int > ietaExcludeBH_
std::vector< std::string > geometrySource_
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitTokenh_
int k[5][pyjets_maxn]
edm::EDGetTokenT< HGChebRecHitCollection > bhRecHitTokeng_
edm::EDGetTokenT< HGChefRecHitCollection > fhRecHitToken_
HGCalHitValidation::~HGCalHitValidation ( )
override

Definition at line 147 of file HGCalHitValidation.cc.

147 { }

Member Function Documentation

void HGCalHitValidation::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 252 of file HGCalHitValidation.cc.

References analyzeHGCalRecHit(), analyzeHGCalSimHit(), edm::SortedCollection< T, SORT >::begin(), bhRecHitTokeng_, bhRecHitTokenh_, bhSimHitToken_, HcalDDDSimConstants::cell(), TauDecayModes::dec, egammaForCoreTracking_cff::depth, HcalDDDRecConstants::HcalID::depth, SoftLeptonByDistance_cfi::distance, eeRecHitToken_, eeSimHitToken_, edm::SortedCollection< T, SORT >::end(), CastorDataFrameFilter_impl::energySum(), HcalCellType::HcalCell::eta, HcalDDDRecConstants::HcalID::eta, PVValHelper::eta, fhRecHitToken_, fhSimHitToken_, MonitorElement::Fill(), spr::find(), edm::Event::getByToken(), HcalDDDRecConstants::getHCID(), HcalEndcap, hcConr_, hcCons_, hebEnSim, heedxVsX, heedyVsY, heedzVsZ, heeEnRec, heeEnSim, heeEnSimRec, heeRecVsSimX, heeRecVsSimY, heeRecVsSimZ, hefdxVsX, hefdyVsY, hefdzVsZ, hefEnRec, hefEnSim, hefEnSimRec, hefRecVsSimX, hefRecVsSimY, hefRecVsSimZ, hgcGeometry_, training_settings::idx, ietaExcludeBH_, ifHCAL_, ifHCALsim_, edm::HandleBase::isValid(), phi, HcalCellType::HcalCell::phi, HcalDDDRecConstants::HcalID::phi, edm::Handle< T >::product(), HcalCellType::HcalCell::rz, Validation_hcalonly_cfi::sign, rpcPointValidation_cfi::simHit, HcalTestNumbering::unpackHcalIndex(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

252  {
253  std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
254 
255  //Accesing ee simhits
257  iEvent.getByToken(eeSimHitToken_, eeSimHits);
258 
259  if (eeSimHits.isValid()) {
260  analyzeHGCalSimHit(eeSimHits, 0, heeEnSim, eeHitRefs);
261 #ifdef EDM_ML_DEBUG
262  for (std::map<unsigned int,HGCHitTuple>::iterator itr=eeHitRefs.begin();
263  itr != eeHitRefs.end(); ++itr) {
264  int idx = std::distance(eeHitRefs.begin(),itr);
265  edm::LogInfo("HGCalValid") << "EEHit[" << idx << "] " << std::hex
266  << itr->first << std::dec << "; Energy "
267  << std::get<0>(itr->second)
268  << "; Position (" << std::get<1>(itr->second)
269  << ", " << std::get<2>(itr->second) <<", "
270  << std::get<3>(itr->second) << ")";
271  }
272 #endif
273  } else {
274  edm::LogVerbatim("HGCalValid") << "No EE SimHit Found ";
275  }
276 
277  //Accesing fh simhits
279  iEvent.getByToken(fhSimHitToken_, fhSimHits);
280  if (fhSimHits.isValid()) {
281  analyzeHGCalSimHit(fhSimHits, 1, hefEnSim, fhHitRefs);
282 #ifdef EDM_ML_DEBUG
283  for (std::map<unsigned int,HGCHitTuple>::iterator itr=fhHitRefs.begin();
284  itr != fhHitRefs.end(); ++itr) {
285  int idx = std::distance(fhHitRefs.begin(),itr);
286  edm::LogInfo("HGCalValid") << "FHHit[" << idx << "] " << std::hex
287  << itr->first << std::dec << "; Energy "
288  << std::get<0>(itr->second) << "; Position ("
289  << std::get<1>(itr->second) << ", "
290  << std::get<2>(itr->second) <<", "
291  << std::get<3>(itr->second) << ")";
292  }
293 #endif
294  } else {
295  edm::LogVerbatim("HGCalValid") << "No FH SimHit Found ";
296  }
297 
298  //Accessing bh simhits
300  iEvent.getByToken(bhSimHitToken_, bhSimHits);
301  if (bhSimHits.isValid()) {
302  if(ifHCALsim_){
303  for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin();
304  simHit != bhSimHits->end(); ++simHit) {
305  int subdet, z, depth, eta, phi, lay;
306  HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay);
307 
308  if (subdet == static_cast<int>(HcalEndcap)) {
309  HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi);
310  double zp = cell.rz/10;
311 
312  HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet,eta,phi,lay,depth);
313  int sign = (z==0)?(-1):(1);
314  zp *= sign;
315  HcalDetId id = HcalDetId(HcalEndcap,sign*idx.eta,idx.phi,idx.depth);
316 
317  float energy = simHit->energy();
318  float energySum(energy);
319  if (bhHitRefs.count(id.rawId()) != 0) energySum += std::get<0>(bhHitRefs[id.rawId()]);
320  hebEnSim->Fill(energy);
321  if (std::find(ietaExcludeBH_.begin(),ietaExcludeBH_.end(),idx.eta) ==
322  ietaExcludeBH_.end()) {
323  bhHitRefs[id.rawId()] = std::make_tuple(energySum,cell.eta,cell.phi,zp);
324 #ifdef EDM_ML_DEBUG
325  edm::LogInfo("HGCalValid") << "Accept " << id << std::endl;
326  } else {
327  edm::LogInfo("HGCalValid") << "Reject " << id << std::endl;
328 #endif
329  }
330  }
331  }
332  }
333  else {
334  analyzeHGCalSimHit(bhSimHits, 2, hebEnSim, bhHitRefs);
335  }
336 #ifdef EDM_ML_DEBUG
337  for (std::map<unsigned int,HGCHitTuple>::iterator itr=bhHitRefs.begin();
338  itr != bhHitRefs.end(); ++itr) {
339  int idx = std::distance(bhHitRefs.begin(),itr);
340  edm::LogInfo("HGCalValid") << "BHHit[" << idx << "] " << std::hex
341  << itr->first << std::dec << "; Energy "
342  << std::get<0>(itr->second) << "; Position ("
343  << std::get<1>(itr->second) << ", "
344  << std::get<2>(itr->second) <<", "
345  << std::get<3>(itr->second) << ")";
346  }
347 #endif
348  } else {
349  edm::LogVerbatim("HGCalValid") << "No BH SimHit Found ";
350  }
351 
352  //accessing EE Rechit information
354  iEvent.getByToken(eeRecHitToken_, eeRecHit);
355  if (eeRecHit.isValid()) {
356  const HGCeeRecHitCollection* theHits = (eeRecHit.product());
357  for (auto it = theHits->begin(); it != theHits->end(); ++it) {
358  double energy = it->energy();
359  heeEnRec->Fill(energy);
360  std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
361  if (itr != eeHitRefs.end()) {
362  GlobalPoint xyz = hgcGeometry_[0]->getPosition(it->id());
363  heeRecVsSimX->Fill(std::get<1>(itr->second),xyz.x());
364  heeRecVsSimY->Fill(std::get<2>(itr->second),xyz.y());
365  heeRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
366  heedxVsX->Fill(std::get<1>(itr->second),(xyz.x()-std::get<1>(itr->second)));
367  heedyVsY->Fill(std::get<2>(itr->second),(xyz.y()-std::get<2>(itr->second)));
368  heedzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
369  heeEnSimRec->Fill(std::get<0>(itr->second),energy);
370 #ifdef EDM_ML_DEBUG
371  edm::LogInfo("HGCalValid") << "EEHit: " << std::hex << it->id().rawId()
372  << std::dec << " Sim ("
373  << std::get<0>(itr->second) << ", "
374  << std::get<1>(itr->second) << ", "
375  << std::get<2>(itr->second) << ", "
376  << std::get<3>(itr->second) << ") Rec ("
377  << energy << ", " << xyz.x() << ", "
378  << xyz.y() << ", " << xyz.z() << ")";
379 #endif
380  }
381  }
382  } else {
383  edm::LogVerbatim("HGCalValid") << "No EE RecHit Found ";
384  }
385 
386  //accessing FH Rechit information
388  iEvent.getByToken(fhRecHitToken_, fhRecHit);
389  if (fhRecHit.isValid()) {
390  const HGChefRecHitCollection* theHits = (fhRecHit.product());
391  for (auto it = theHits->begin(); it!=theHits->end(); ++it) {
392  double energy = it->energy();
393  hefEnRec->Fill(energy);
394  std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
395  if (itr != fhHitRefs.end()) {
396  GlobalPoint xyz = hgcGeometry_[1]->getPosition(it->id());
397 
398  hefRecVsSimX->Fill(std::get<1>(itr->second),xyz.x());
399  hefRecVsSimY->Fill(std::get<2>(itr->second),xyz.y());
400  hefRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
401  hefdxVsX->Fill(std::get<1>(itr->second),(xyz.x()-std::get<1>(itr->second)));
402  hefdyVsY->Fill(std::get<2>(itr->second),(xyz.y()-std::get<2>(itr->second)));
403  hefdzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
404  hefEnSimRec->Fill(std::get<0>(itr->second),energy);
405 #ifdef EDM_ML_DEBUG
406  edm::LogInfo("HGCalValid") << "FHHit: " << std::hex << it->id().rawId()
407  << std::dec << " Sim ("
408  << std::get<0>(itr->second) << ", "
409  << std::get<1>(itr->second) << ", "
410  << std::get<2>(itr->second) << ", "
411  << std::get<3>(itr->second) << ") Rec ("
412  << energy << "," << xyz.x() << ", "
413  << xyz.y() << ", " << xyz.z() << ")";
414 #endif
415  }
416  }
417  } else {
418  edm::LogVerbatim("HGCalValid") << "No FH RecHit Found ";
419  }
420 
421 
422  //accessing BH Rechit information
423  if (ifHCAL_) {
425  iEvent.getByToken(bhRecHitTokenh_, bhRecHit);
426  if (bhRecHit.isValid()) {
427  const HBHERecHitCollection* theHits = (bhRecHit.product());
428  analyzeHGCalRecHit(theHits, bhHitRefs);
429  } else {
430  edm::LogVerbatim("HGCalValid") << "No BH RecHit Found ";
431  }
432  } else {
434  iEvent.getByToken(bhRecHitTokeng_, bhRecHit);
435  if (bhRecHit.isValid()) {
436  const HGChebRecHitCollection* theHits = (bhRecHit.product());
437  analyzeHGCalRecHit(theHits, bhHitRefs);
438  } else {
439  edm::LogVerbatim("HGCalValid") << "No BH RecHit Found ";
440  }
441  }
442 }
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
T y() const
Definition: PV3DBase.h:63
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
MonitorElement * heeRecVsSimX
HcalCellType::HcalCell cell(const int &det, const int &zside, const int &depth, const int &etaR, const int &iphi) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
MonitorElement * heeRecVsSimZ
const HcalDDDSimConstants * hcCons_
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
void Fill(long long x)
std::vector< const HGCalGeometry * > hgcGeometry_
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
void analyzeHGCalRecHit(T1 const &theHits, std::map< unsigned int, HGCHitTuple > const &hitRefs)
std::vector< int > ietaExcludeBH_
MonitorElement * hefEnSim
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
T z() const
Definition: PV3DBase.h:64
MonitorElement * hefEnRec
MonitorElement * heedxVsX
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
MonitorElement * heeEnSim
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitTokenh_
const_iterator end() const
MonitorElement * hefdxVsX
T const * product() const
Definition: Handle.h:81
const HcalDDDRecConstants * hcConr_
edm::EDGetTokenT< HGChebRecHitCollection > bhRecHitTokeng_
void analyzeHGCalSimHit(edm::Handle< std::vector< PCaloHit >> const &simHits, int idet, MonitorElement *hist, std::map< unsigned int, HGCHitTuple > &)
MonitorElement * hefRecVsSimZ
MonitorElement * hefdzVsZ
double energySum(const DataFrame &df, int fs, int ls)
T x() const
Definition: PV3DBase.h:62
MonitorElement * heedyVsY
const_iterator begin() const
edm::EDGetTokenT< HGChefRecHitCollection > fhRecHitToken_
template<class T1 >
void HGCalHitValidation::analyzeHGCalRecHit ( T1 const &  theHits,
std::map< unsigned int, HGCHitTuple > const &  hitRefs 
)
protected

Definition at line 479 of file HGCalHitValidation.cc.

References funct::cos(), TauDecayModes::dec, DEFINE_FWK_MODULE, PV3DBase< T, PVType, FrameType >::eta(), MonitorElement::Fill(), CaloSubdetectorGeometry::getGeometry(), DetId::Hcal, HcalEndcap, hcGeometry_, hebdEtaVsEta, hebdPhiVsPhi, hebdzVsZ, hebEnRec, hebEnSimRec, hebRecVsSimX, hebRecVsSimY, hebRecVsSimZ, PV3DBase< T, PVType, FrameType >::phi(), PVValHelper::pT, funct::sin(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by analyze().

480  {
481  for (auto it = theHits->begin(); it!=theHits->end(); ++it) {
482  DetId id = it->id();
483  if (id.det() == DetId::Hcal and id.subdetId() == (int)(HcalEndcap)) {
484  double energy = it->energy();
485  hebEnRec->Fill(energy);
486  GlobalPoint xyz = hcGeometry_->getGeometry(id)->getPosition();
487 
488  std::map<unsigned int, HGCHitTuple>::const_iterator itr = hitRefs.find(id.rawId());
489  if (itr != hitRefs.end()) {
490  float ang3 = xyz.phi().value(); // returns the phi in radians
491  double fac = sinh(std::get<1>(itr->second));
492  double pT = std::get<3>(itr->second) / fac;
493  double xp = pT * cos(std::get<2>(itr->second));
494  double yp = pT * sin(std::get<2>(itr->second));
495  hebRecVsSimX->Fill(xp,xyz.x());
496  hebRecVsSimY->Fill(yp,xyz.y());
497  hebRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
498  hebdEtaVsEta->Fill(std::get<1>(itr->second),(xyz.eta()-std::get<1>(itr->second)));
499  hebdPhiVsPhi->Fill(std::get<2>(itr->second),(ang3-std::get<2>(itr->second)));
500  hebdzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
501  hebEnSimRec->Fill(std::get<0>(itr->second),energy);
502 
503 #ifdef EDM_ML_DEBUG
504  edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId()
505  << std::dec << " Sim ("
506  << std::get<0>(itr->second) << ", "
507  << std::get<1>(itr->second) << ", "
508  << std::get<2>(itr->second) << ", "
509  << std::get<3>(itr->second) << ") Rec ("
510  << energy << ", " << xyz.x() << ", "
511  << xyz.y() << ", " << xyz.z() << ")\n";
512 #endif
513  }
514  }
515  }
516 }
MonitorElement * hebRecVsSimX
MonitorElement * hebRecVsSimY
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
void Fill(long long x)
MonitorElement * hebEnRec
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * hebRecVsSimZ
const CaloSubdetectorGeometry * hcGeometry_
MonitorElement * hebdPhiVsPhi
MonitorElement * hebEnSimRec
Definition: DetId.h:18
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
T eta() const
Definition: PV3DBase.h:76
MonitorElement * hebdzVsZ
T x() const
Definition: PV3DBase.h:62
MonitorElement * hebdEtaVsEta
void HGCalHitValidation::analyzeHGCalSimHit ( edm::Handle< std::vector< PCaloHit >> const &  simHits,
int  idet,
MonitorElement hist,
std::map< unsigned int, HGCHitTuple > &  hitRefs 
)
protected

Definition at line 444 of file HGCalHitValidation.cc.

References HGCalTopology::detectorType(), CastorDataFrameFilter_impl::energySum(), MonitorElement::Fill(), hgcCons_, hgcGeometry_, rpcPointValidation_cfi::simHit, trackerHits::simHits, HGCalTestNumbering::unpackHexagonIndex(), geometryCSVtoXML::xy, and ecaldqm::zside().

Referenced by analyze().

446  {
447 
448  const HGCalTopology &hTopo=hgcGeometry_[idet]->topology();
449  for (std::vector<PCaloHit>::const_iterator simHit = simHits->begin(); simHit != simHits->end(); ++simHit) {
450  int subdet, zside, layer, wafer, celltype, cell;
451  HGCalTestNumbering::unpackHexagonIndex(simHit->id(), subdet, zside, layer, wafer, celltype, cell);
452  std::pair<float, float> xy = hgcCons_[idet]->locateCell(cell,layer,wafer,false);
453  float zp = hgcCons_[idet]->waferZ(layer,false);
454  if (zside < 0) zp = -zp;
455  float xp = (zp<0) ? -xy.first/10 : xy.first/10;
456  float yp = xy.second/10.0;
457 
458  //skip this hit if after ganging it is not valid
459  std::pair<int,int> recoLayerCell=hgcCons_[idet]->simToReco(cell,layer,wafer,hTopo.detectorType());
460  cell = recoLayerCell.first;
461  layer = recoLayerCell.second;
462 
463  //skip this hit if after ganging it is not valid
464  if (layer<0 || cell<0) {
465  } else {
466  //assign the RECO DetId
467  HGCalDetId id = HGCalDetId((ForwardSubdetector)(subdet),zside,layer,celltype,wafer,cell);
468  float energy = simHit->energy();
469 
470  float energySum(energy);
471  if (hitRefs.count(id.rawId()) != 0) energySum += std::get<0>(hitRefs[id.rawId()]);
472  hitRefs[id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
473  hist->Fill(energy);
474  }
475  }
476 }
bool detectorType() const
int zside(DetId const &)
ForwardSubdetector
std::vector< const HGCalDDDConstants * > hgcCons_
void Fill(long long x)
std::vector< const HGCalGeometry * > hgcGeometry_
double energySum(const DataFrame &df, int fs, int ls)
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
void HGCalHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotected

Definition at line 157 of file HGCalHitValidation.cc.

References DQMStore::IBooker::book1D(), DQMStore::IBooker::book2D(), hebdEtaVsEta, hebdPhiVsPhi, hebdzVsZ, hebEnRec, hebEnSim, hebEnSimRec, hebRecVsSimX, hebRecVsSimY, hebRecVsSimZ, heedxVsX, heedyVsY, heedzVsZ, heeEnRec, heeEnSim, heeEnSimRec, heeRecVsSimX, heeRecVsSimY, heeRecVsSimZ, hefdxVsX, hefdyVsY, hefdzVsZ, hefEnRec, hefEnSim, hefEnSimRec, hefRecVsSimX, hefRecVsSimY, hefRecVsSimZ, M_PI, and DQMStore::IBooker::setCurrentFolder().

159  {
160 
161  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/HitValidation");
162 
163  //initiating histograms
164  heedzVsZ = iB.book2D("heedzVsZ","",7200,-360,360,100,-0.1,0.1);
165  heedyVsY = iB.book2D("heedyVsY","",400,-200,200,100,-0.02,0.02);
166  heedxVsX = iB.book2D("heedxVsX","",400,-200,200,100,-0.02,0.02);
167  heeRecVsSimZ = iB.book2D("heeRecVsSimZ","",7200,-360,360,7200,-360,360);
168  heeRecVsSimY = iB.book2D("heeRecVsSimY","",400,-200,200,400,-200,200);
169  heeRecVsSimX = iB.book2D("heeRecVsSimX","",400,-200,200,400,-200,200);
170 
171  hefdzVsZ = iB.book2D("hefdzVsZ","",8200,-410,410,100,-0.1,0.1);
172  hefdyVsY = iB.book2D("hefdyVsY","",400,-200,200,100,-0.02,0.02);
173  hefdxVsX = iB.book2D("hefdxVsX","",400,-200,200,100,-0.02,0.02);
174  hefRecVsSimZ = iB.book2D("hefRecVsSimZ","",8200,-410,410,8200,-410,410);
175  hefRecVsSimY = iB.book2D("hefRecVsSimY","",400,-200,200,400,-200,200);
176  hefRecVsSimX = iB.book2D("hefRecVsSimX","",400,-200,200,400,-200,200);
177 
178  hebdzVsZ = iB.book2D("hebdzVsZ","",1080,-540,540,100,-1.0,1.0);
179  hebdPhiVsPhi = iB.book2D("hebdPhiVsPhi","",M_PI*100,-0.5,M_PI+0.5,200,-0.2,0.2);
180  hebdEtaVsEta = iB.book2D("hebdEtaVsEta","",1000,-5,5,200,-0.1,0.1);
181  hebRecVsSimZ = iB.book2D("hebRecVsSimZ","",1080,-540,540,1080,-540,540);
182  hebRecVsSimY = iB.book2D("hebRecVsSimY","",400,-200,200,400,-200,200);
183  hebRecVsSimX = iB.book2D("hebRecVsSimX","",400,-200,200,400,-200,200);
184 
185  heeEnRec = iB.book1D("heeEnRec","",1000,0,10);
186  heeEnSim = iB.book1D("heeEnSim","",1000,0,0.01);
187  heeEnSimRec = iB.book2D("heeEnSimRec","",200,0,0.002,200,0,0.2);
188 
189  hefEnRec = iB.book1D("hefEnRec","",1000,0,10);
190  hefEnSim = iB.book1D("hefEnSim","",1000,0,0.01);
191  hefEnSimRec = iB.book2D("hefEnSimRec","",200,0,0.001,200,0,0.5);
192 
193  hebEnRec = iB.book1D("hebEnRec","",1000,0,15);
194  hebEnSim = iB.book1D("hebEnSim","",1000,0,0.01);
195  hebEnSimRec = iB.book2D("hebEnSimRec","",200,0,0.02,200,0,4);
196 
197 }
MonitorElement * hebRecVsSimX
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
MonitorElement * hebRecVsSimY
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
MonitorElement * heeRecVsSimX
MonitorElement * heeRecVsSimZ
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
MonitorElement * hebEnRec
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
MonitorElement * hefEnSim
MonitorElement * hebRecVsSimZ
MonitorElement * hefEnRec
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * heedxVsX
MonitorElement * heeEnSim
MonitorElement * hebdPhiVsPhi
#define M_PI
MonitorElement * hebEnSimRec
MonitorElement * hefdxVsX
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
MonitorElement * hefRecVsSimZ
MonitorElement * hefdzVsZ
MonitorElement * hebdzVsZ
MonitorElement * heedyVsY
MonitorElement * hebdEtaVsEta
void HGCalHitValidation::dqmBeginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotected

Definition at line 199 of file HGCalHitValidation.cc.

References spr::find(), geometrySource_, edm::EventSetup::get(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalBarrel, hcConr_, hcCons_, hcGeometry_, hgcCons_, hgcGeometry_, mps_fire::i, edm::ESHandleBase::isValid(), and edm::ESHandle< T >::product().

200  {
201  //initiating hgc Geometry
202  for (size_t i=0; i<geometrySource_.size(); i++) {
203  if (geometrySource_[i].find("Hcal") != std::string::npos) {
205  iSetup.get<HcalSimNumberingRecord>().get(pHSNDC);
206  if (pHSNDC.isValid()) {
207  hcCons_ = pHSNDC.product();
208  hgcCons_.push_back(nullptr);
209  } else {
210  edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: "
211  << geometrySource_[i] << std::endl;
212  }
214  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
215  if (pHRNDC.isValid()) {
216  hcConr_ = pHRNDC.product();
217  } else {
218  edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: "
219  << geometrySource_[i] << std::endl;
220  }
222  iSetup.get<CaloGeometryRecord>().get(caloG);
223  if (caloG.isValid()) {
224  const CaloGeometry* geo = caloG.product();
226  hgcGeometry_.push_back(nullptr);
227  } else {
228  edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for "
229  << geometrySource_[i] << std::endl;
230  }
231  } else {
233  iSetup.get<IdealGeometryRecord>().get(geometrySource_[i],hgcCons);
234  if (hgcCons.isValid()) {
235  hgcCons_.push_back(hgcCons.product());
236  } else {
237  edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for "
238  << geometrySource_[i] << std::endl;
239  }
241  iSetup.get<IdealGeometryRecord>().get(geometrySource_[i],hgcGeom);
242  if(hgcGeom.isValid()) {
243  hgcGeometry_.push_back(hgcGeom.product());
244  } else {
245  edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for "
246  << geometrySource_[i] << std::endl;
247  }
248  }
249  }
250 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< const HGCalDDDConstants * > hgcCons_
const HcalDDDSimConstants * hcCons_
std::vector< const HGCalGeometry * > hgcGeometry_
std::vector< std::string > geometrySource_
const CaloSubdetectorGeometry * hcGeometry_
const HcalDDDRecConstants * hcConr_
bool isValid() const
Definition: ESHandle.h:45
T const * product() const
Definition: ESHandle.h:84
void HGCalHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 149 of file HGCalHitValidation.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

149  {
150  //The following says we do not know what parameters are allowed so do no validation
151  // Please change this to state exactly what you do use, even if it is no parameters
153  desc.setUnknown();
154  descriptions.addDefault(desc);
155 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

edm::EDGetTokenT<HGChebRecHitCollection> HGCalHitValidation::bhRecHitTokeng_
private

Definition at line 101 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::EDGetTokenT<HBHERecHitCollection> HGCalHitValidation::bhRecHitTokenh_
private

Definition at line 102 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::bhSimHitSource
private

Definition at line 95 of file HGCalHitValidation.cc.

edm::EDGetTokenT<std::vector<PCaloHit> > HGCalHitValidation::bhSimHitToken_
private

Definition at line 98 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::EDGetTokenT<HGCeeRecHitCollection> HGCalHitValidation::eeRecHitToken_
private

Definition at line 99 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::eeSimHitSource
private

Definition at line 95 of file HGCalHitValidation.cc.

edm::EDGetTokenT<std::vector<PCaloHit> > HGCalHitValidation::eeSimHitToken_
private

Definition at line 96 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::EDGetTokenT<HGChefRecHitCollection> HGCalHitValidation::fhRecHitToken_
private

Definition at line 100 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::fhSimHitSource
private

Definition at line 95 of file HGCalHitValidation.cc.

edm::EDGetTokenT<std::vector<PCaloHit> > HGCalHitValidation::fhSimHitToken_
private

Definition at line 97 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

std::vector<std::string> HGCalHitValidation::geometrySource_
private

Definition at line 90 of file HGCalHitValidation.cc.

Referenced by dqmBeginRun(), and HGCalHitValidation().

const HcalDDDRecConstants* HGCalHitValidation::hcConr_
private

Definition at line 88 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

const HcalDDDSimConstants* HGCalHitValidation::hcCons_
private

Definition at line 87 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

const CaloSubdetectorGeometry* HGCalHitValidation::hcGeometry_
private

Definition at line 89 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and dqmBeginRun().

MonitorElement * HGCalHitValidation::hebdEtaVsEta
private

Definition at line 107 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebdPhiVsPhi
private

Definition at line 107 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebdzVsZ
private

Definition at line 107 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebEnRec
private

Definition at line 114 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebEnSim
private

Definition at line 114 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebEnSimRec
private

Definition at line 112 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebRecVsSimX
private

Definition at line 111 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebRecVsSimY
private

Definition at line 111 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebRecVsSimZ
private

Definition at line 111 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalRecHit(), and bookHistograms().

MonitorElement * HGCalHitValidation::heedxVsX
private

Definition at line 105 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heedyVsY
private

Definition at line 105 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heedzVsZ
private

Definition at line 105 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeEnRec
private

Definition at line 116 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeEnSim
private

Definition at line 116 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeEnSimRec
private

Definition at line 112 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeRecVsSimX
private

Definition at line 109 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeRecVsSimY
private

Definition at line 109 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeRecVsSimZ
private

Definition at line 109 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefdxVsX
private

Definition at line 106 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefdyVsY
private

Definition at line 106 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefdzVsZ
private

Definition at line 106 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefEnRec
private

Definition at line 115 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefEnSim
private

Definition at line 115 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefEnSimRec
private

Definition at line 112 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefRecVsSimX
private

Definition at line 110 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefRecVsSimY
private

Definition at line 110 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefRecVsSimZ
private

Definition at line 110 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

std::vector<const HGCalDDDConstants*> HGCalHitValidation::hgcCons_
private

Definition at line 85 of file HGCalHitValidation.cc.

Referenced by analyzeHGCalSimHit(), and dqmBeginRun().

std::vector<const HGCalGeometry*> HGCalHitValidation::hgcGeometry_
private

Definition at line 86 of file HGCalHitValidation.cc.

Referenced by analyze(), analyzeHGCalSimHit(), and dqmBeginRun().

std::vector<int> HGCalHitValidation::ietaExcludeBH_
private

Definition at line 91 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

bool HGCalHitValidation::ifHCAL_
private

Definition at line 92 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

bool HGCalHitValidation::ifHCALsim_
private

Definition at line 93 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().