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 | Static Public Member Functions | Protected Member Functions | Private Types | Private Attributes
HGCalHitValidation Class Reference

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

Inheritance diagram for HGCalHitValidation:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 HGCalHitValidation (const edm::ParameterSet &)
 
 ~HGCalHitValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
- 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)
 

Private Types

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

Private Attributes

edm::EDGetTokenT
< HBHERecHitCollection
bhRecHitToken_
 
edm::InputTag bhSimHitSource
 
edm::EDGetTokenT< std::vector
< PCaloHit > > 
bhSimHitToken_
 
edm::EDGetTokenT
< HGCeeRecHitCollection
eeRecHitToken_
 
edm::InputTag eeSimHitSource
 
edm::EDGetTokenT< std::vector
< PCaloHit > > 
eeSimHitToken_
 
edm::EDGetTokenT
< HGChefRecHitCollection
fhRecHitToken_
 
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_
 

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
 

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
private

Definition at line 76 of file HGCalHitValidation.cc.

Constructor & Destructor Documentation

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

Definition at line 112 of file HGCalHitValidation.cc.

References bhRecHitToken_, bhSimHitToken_, eeRecHitToken_, eeSimHitToken_, fhRecHitToken_, fhSimHitToken_, geometrySource_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ietaExcludeBH_, and relval_2017::k.

112  {
113 
114  geometrySource_ = cfg.getUntrackedParameter< std::vector<std::string> >("geometrySource");
115  eeSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("eeSimHitSource"));
116  fhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("fhSimHitSource"));
117  bhSimHitToken_ = consumes<std::vector<PCaloHit>>(cfg.getParameter<edm::InputTag>("bhSimHitSource"));
118  eeRecHitToken_ = consumes<HGCeeRecHitCollection>(cfg.getParameter<edm::InputTag>("eeRecHitSource"));
119  fhRecHitToken_ = consumes<HGChefRecHitCollection>(cfg.getParameter<edm::InputTag>("fhRecHitSource"));
120  bhRecHitToken_ = consumes<HBHERecHitCollection>(cfg.getParameter<edm::InputTag>("bhRecHitSource"));
121  ietaExcludeBH_ = cfg.getParameter<std::vector<int> >("ietaExcludeBH");
122 
123 #ifdef EDM_ML_DEBUG
124  edm::LogInfo("HGCalValid") << "Exclude the following "
125  << ietaExcludeBH_.size()
126  << " ieta values from BH plots";
127  for (unsigned int k=0; k<ietaExcludeBH_.size(); ++k)
128  edm::LogInfo("HGCalValid") << " [" << k << "] " << ietaExcludeBH_[k];
129 #endif
130 }
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_
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitToken_
std::vector< int > ietaExcludeBH_
std::vector< std::string > geometrySource_
edm::EDGetTokenT< std::vector< PCaloHit > > bhSimHitToken_
edm::EDGetTokenT< HGChefRecHitCollection > fhRecHitToken_
HGCalHitValidation::~HGCalHitValidation ( )

Definition at line 132 of file HGCalHitValidation.cc.

132 { }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 237 of file HGCalHitValidation.cc.

References edm::SortedCollection< T, SORT >::begin(), bhRecHitToken_, bhSimHitToken_, HcalDDDSimConstants::cell(), funct::cos(), TauDecayModes::dec, HcalDDDRecConstants::HcalID::depth, HLT_25ns10e33_v2_cff::depth, HGCalTopology::detectorType(), HLT_25ns10e33_v2_cff::distance, eeRecHitToken_, eeSimHitToken_, edm::SortedCollection< T, SORT >::end(), relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), HcalDDDRecConstants::HcalID::eta, eta, PV3DBase< T, PVType, FrameType >::eta(), fhRecHitToken_, fhSimHitToken_, MonitorElement::Fill(), spr::find(), edm::Event::getByToken(), CaloSubdetectorGeometry::getGeometry(), HcalDDDRecConstants::getHCID(), CaloCellGeometry::getPosition(), HcalEndcap, hcConr_, hcCons_, hcGeometry_, 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, hgcCons_, hgcGeometry_, ietaExcludeBH_, edm::HandleBase::isValid(), phi, HcalDDDRecConstants::HcalID::phi, PV3DBase< T, PVType, FrameType >::phi(), edm::Handle< T >::product(), HcalCellType::HcalCell::rz, jetcorrextractor::sign(), funct::sin(), HcalTestNumbering::unpackHcalIndex(), HGCalTestNumbering::unpackHexagonIndex(), Geom::Phi< T >::value(), PV3DBase< T, PVType, FrameType >::x(), create_public_lumi_plots::xy, PV3DBase< T, PVType, FrameType >::y(), z, PV3DBase< T, PVType, FrameType >::z(), and ecaldqm::zside().

237  {
238  std::map<unsigned int, HGCHitTuple> eeHitRefs, fhHitRefs, bhHitRefs;
239 
240  //declare topology and DDD constants
241  const HGCalTopology &heeTopo=hgcGeometry_[0]->topology();
242  const HGCalTopology &hefTopo=hgcGeometry_[1]->topology();
243 
244  //Accesing ee simhits
246  iEvent.getByToken(eeSimHitToken_, eeSimHits);
247 
248  if (eeSimHits.isValid()) {
249  for (std::vector<PCaloHit>::const_iterator simHit = eeSimHits->begin(); simHit != eeSimHits->end(); ++simHit) {
250  int subdet, zside, layer, wafer, celltype, cell;
251  HGCalTestNumbering::unpackHexagonIndex(simHit->id(), subdet, zside, layer, wafer, celltype, cell);
252  std::pair<float, float> xy = hgcCons_[0]->locateCell(cell,layer,wafer,false);
253  float zp = hgcCons_[0]->waferZ(layer,false);
254  if (zside < 0) zp = -zp;
255  float xp = (zp<0) ? -xy.first/10 : xy.first/10;
256  float yp = xy.second/10.0;
257 
258  //skip this hit if after ganging it is not valid
259  std::pair<int,int> recoLayerCell=hgcCons_[0]->simToReco(cell,layer,wafer,heeTopo.detectorType());
260  cell = recoLayerCell.first;
261  layer = recoLayerCell.second;
262 
263  //skip this hit if after ganging it is not valid
264  if (layer<0 || cell<0) {
265  } else {
266 
267  //assign the RECO DetId
268  HGCalDetId id = HGCalDetId((ForwardSubdetector)(subdet),zside,layer,celltype,wafer,cell);
269  float energy = simHit->energy();
270 
271  float energySum(0);
272  if (eeHitRefs.count(id.rawId()) != 0) energySum = std::get<0>(eeHitRefs[id.rawId()]);
273  energySum += energy;
274  eeHitRefs[id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
275  heeEnSim->Fill(energy);
276  }
277  }
278 #ifdef EDM_ML_DEBUG
279  for (std::map<unsigned int,HGCHitTuple>::iterator itr=eeHitRefs.begin();
280  itr != eeHitRefs.end(); ++itr) {
281  int idx = std::distance(eeHitRefs.begin(),itr);
282  edm::LogInfo("HGCalValid") << "EEHit[" << idx << "] " << std::hex
283  << itr->first << std::dec << "; Energy "
284  << std::get<0>(itr->second)
285  << "; Position (" << std::get<1>(itr->second)
286  << ", " << std::get<2>(itr->second) <<", "
287  << std::get<3>(itr->second) << ")" <<std::endl;
288  }
289 #endif
290  } else {
291  edm::LogWarning("HGCalValid") << "No EE SimHit Found " << std::endl;
292  }
293 
294  //Accesing fh simhits
296  iEvent.getByToken(fhSimHitToken_, fhSimHits);
297  if (fhSimHits.isValid()) {
298  for (std::vector<PCaloHit>::const_iterator simHit = fhSimHits->begin();
299  simHit != fhSimHits->end();++simHit) {
300  int subdet, zside, layer, wafer, celltype, cell;
301  HGCalTestNumbering::unpackHexagonIndex(simHit->id(), subdet, zside, layer, wafer, celltype, cell);
302  std::pair<float, float> xy = hgcCons_[1]->locateCell(cell,layer,wafer,false);
303  float zp = hgcCons_[1]->waferZ(layer,false);
304  if (zside < 0) zp = -zp;
305  float xp = (zp<0) ? -xy.first/10 : xy.first/10;
306  float yp = xy.second/10.0;
307 
308  //skip this hit if after ganging it is not valid
309  std::pair<int,int> recoLayerCell = hgcCons_[1]->simToReco(cell,layer,wafer,hefTopo.detectorType());
310  cell = recoLayerCell.first;
311  layer = recoLayerCell.second;
312  //skip this hit if after ganging it is not valid
313  if(layer<0 || cell<0) {
314  } else {
315  //assign the RECO DetId
316  HGCalDetId id = HGCalDetId((ForwardSubdetector)(subdet),zside,layer,celltype,wafer,cell);
317 
318  float energy = simHit->energy();
319  float energySum(0);
320  if (fhHitRefs.count(id.rawId()) != 0) energySum = std::get<0>(fhHitRefs[id.rawId()]);
321  energySum += energy;
322  fhHitRefs[id.rawId()] = std::make_tuple(energySum,xp,yp,zp);
323  hefEnSim->Fill(energy);
324  }
325  }
326 #ifdef EDM_ML_DEBUG
327  for (std::map<unsigned int,HGCHitTuple>::iterator itr=fhHitRefs.begin();
328  itr != fhHitRefs.end(); ++itr) {
329  int idx = std::distance(fhHitRefs.begin(),itr);
330  edm::LogInfo("HGCalValid") << "FHHit[" << idx << "] " << std::hex
331  << itr->first << std::dec << "; Energy "
332  << std::get<0>(itr->second) << "; Position ("
333  << std::get<1>(itr->second) << ", "
334  << std::get<2>(itr->second) <<", "
335  << std::get<3>(itr->second) << ")" <<std::endl;
336  }
337 #endif
338  } else {
339  edm::LogWarning("HGCalValid") << "No FH SimHit Found " << std::endl;
340  }
341 
342  //Accessing bh simhits
344  iEvent.getByToken(bhSimHitToken_, bhSimHits);
345  if (bhSimHits.isValid()) {
346  for (std::vector<PCaloHit>::const_iterator simHit = bhSimHits->begin();
347  simHit != bhSimHits->end(); ++simHit) {
348  int subdet, z, depth, eta, phi, lay;
349  HcalTestNumbering::unpackHcalIndex(simHit->id(), subdet, z, depth, eta, phi, lay);
350  HcalCellType::HcalCell cell = hcCons_->cell(subdet, z, lay, eta, phi);
351 
352  double zp = cell.rz/10;
353 
354  if (subdet == static_cast<int>(HcalEndcap)) {
355  HcalDDDRecConstants::HcalID idx = hcConr_->getHCID(subdet,eta,phi,lay,depth);
356  int sign = (z==0)?(-1):(1);
357  zp *= sign;
358  HcalDetId id = HcalDetId(HcalEndcap,sign*idx.eta,idx.phi,idx.depth);
359 
360  float energy = simHit->energy();
361  float energySum(0);
362  if (bhHitRefs.count(id.rawId()) != 0) energySum = std::get<0>(bhHitRefs[id.rawId()]);
363  energySum += energy;
364  hebEnSim->Fill(energy);
365  if (std::find(ietaExcludeBH_.begin(),ietaExcludeBH_.end(),idx.eta) ==
366  ietaExcludeBH_.end()) {
367  bhHitRefs[id.rawId()] = std::make_tuple(energySum,cell.eta,cell.phi,zp);
368 #ifdef EDM_ML_DEBUG
369  edm::LogInfo("HGCalValid") << "Accept " << id << std::endl;
370  } else {
371  edm::LogInfo("HGCalValid") << "Reject " << id << std::endl;
372 #endif
373  }
374  }
375  }
376 #ifdef EDM_ML_DEBUG
377  for (std::map<unsigned int,HGCHitTuple>::iterator itr=bhHitRefs.begin();
378  itr != bhHitRefs.end(); ++itr) {
379  int idx = std::distance(bhHitRefs.begin(),itr);
380  edm::LogInfo("HGCalValid") << "BHHit[" << idx << "] " << std::hex
381  << itr->first << std::dec << "; Energy "
382  << std::get<0>(itr->second) << "; Position ("
383  << std::get<1>(itr->second) << ", "
384  << std::get<2>(itr->second) <<", "
385  << std::get<3>(itr->second) << ")" <<std::endl;
386  }
387 #endif
388  } else {
389  edm::LogWarning("HGCalValid") << "No BH SimHit Found " << std::endl;
390  }
391 
392  //accessing EE Rechit information
394  iEvent.getByToken(eeRecHitToken_, eeRecHit);
395  if (eeRecHit.isValid()) {
396  const HGCeeRecHitCollection* theHits = (eeRecHit.product());
397  for (auto it = theHits->begin(); it != theHits->end(); ++it) {
398  double energy = it->energy();
399  heeEnRec->Fill(energy);
400  std::map<unsigned int, HGCHitTuple>::const_iterator itr = eeHitRefs.find(it->id().rawId());
401  if (itr != eeHitRefs.end()) {
402  GlobalPoint xyz = hgcGeometry_[0]->getPosition(it->id());
403  heeRecVsSimX->Fill(std::get<1>(itr->second),xyz.x());
404  heeRecVsSimY->Fill(std::get<2>(itr->second),xyz.y());
405  heeRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
406  heedxVsX->Fill(std::get<1>(itr->second),(xyz.x()-std::get<1>(itr->second)));
407  heedyVsY->Fill(std::get<2>(itr->second),(xyz.y()-std::get<2>(itr->second)));
408  heedzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
409  heeEnSimRec->Fill(std::get<0>(itr->second),energy);
410 #ifdef EDM_ML_DEBUG
411  edm::LogInfo("HGCalValid") << "EEHit: " << std::hex << it->id().rawId()
412  << std::dec << " Sim ("
413  << std::get<0>(itr->second) << ", "
414  << std::get<1>(itr->second) << ", "
415  << std::get<2>(itr->second) << ", "
416  << std::get<3>(itr->second) << ") Rec ("
417  << energy << ", " << xyz.x() << ", "
418  << xyz.y() << ", " << xyz.z() << ")\n";
419 #endif
420  }
421  }
422  } else {
423  edm::LogWarning("HGCalValid") << "No EE RecHit Found " << std::endl;
424  }
425 
426  //accessing FH Rechit information
428  iEvent.getByToken(fhRecHitToken_, fhRecHit);
429  if (fhRecHit.isValid()) {
430  const HGChefRecHitCollection* theHits = (fhRecHit.product());
431  for (auto it = theHits->begin(); it!=theHits->end(); ++it) {
432  double energy = it->energy();
433  hefEnRec->Fill(energy);
434  std::map<unsigned int, HGCHitTuple>::const_iterator itr = fhHitRefs.find(it->id().rawId());
435  if (itr != fhHitRefs.end()) {
436  GlobalPoint xyz = hgcGeometry_[1]->getPosition(it->id());
437 
438  hefRecVsSimX->Fill(std::get<1>(itr->second),xyz.x());
439  hefRecVsSimY->Fill(std::get<2>(itr->second),xyz.y());
440  hefRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
441  hefdxVsX->Fill(std::get<1>(itr->second),(xyz.x()-std::get<1>(itr->second)));
442  hefdyVsY->Fill(std::get<2>(itr->second),(xyz.y()-std::get<2>(itr->second)));
443  hefdzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
444  hefEnSimRec->Fill(std::get<0>(itr->second),energy);
445 #ifdef EDM_ML_DEBUG
446  edm::LogInfo("HGCalValid") << "FHHit: " << std::hex << it->id().rawId()
447  << std::dec << " Sim ("
448  << std::get<0>(itr->second) << ", "
449  << std::get<1>(itr->second) << ", "
450  << std::get<2>(itr->second) << ", "
451  << std::get<3>(itr->second) << ") Rec ("
452  << energy << "," << xyz.x() << ", "
453  << xyz.y() << ", " << xyz.z() << ")\n";
454 #endif
455  }
456  }
457  } else {
458  edm::LogWarning("HGCalValid") << "No FH RecHit Found " << std::endl;
459  }
460 
461 
462  //accessing BH Rechit information
464  iEvent.getByToken(bhRecHitToken_, bhRecHit);
465  if (bhRecHit.isValid()) {
466  const HBHERecHitCollection* theHits = (bhRecHit.product());
467 
468  for (auto it = theHits->begin(); it!=theHits->end(); ++it) {
469  DetId id = it->id();
470  if (id.subdetId() == (int)(HcalEndcap)) {
471  double energy = it->energy();
472  hebEnRec->Fill(energy);
474 
475  std::map<unsigned int, HGCHitTuple>::const_iterator itr = bhHitRefs.find(id.rawId());
476  if (itr != bhHitRefs.end()) {
477  float ang3 = xyz.phi().value(); // returns the phi in radians
478  double fac = sinh(std::get<1>(itr->second));
479  double pT = std::get<3>(itr->second) / fac;
480  double xp = pT * cos(std::get<2>(itr->second));
481  double yp = pT * sin(std::get<2>(itr->second));
482  hebRecVsSimX->Fill(xp,xyz.x());
483  hebRecVsSimY->Fill(yp,xyz.y());
484  hebRecVsSimZ->Fill(std::get<3>(itr->second),xyz.z());
485  hebdEtaVsEta->Fill(std::get<1>(itr->second),(xyz.eta()-std::get<1>(itr->second)));
486  hebdPhiVsPhi->Fill(std::get<2>(itr->second),(ang3-std::get<2>(itr->second)));
487  hebdzVsZ->Fill(std::get<3>(itr->second),(xyz.z()-std::get<3>(itr->second)));
488  hebEnSimRec->Fill(std::get<0>(itr->second),energy);
489 
490 #ifdef EDM_ML_DEBUG
491  edm::LogInfo("HGCalValid") << "BHHit: " << std::hex << id.rawId()
492  << std::dec << " Sim ("
493  << std::get<0>(itr->second) << ", "
494  << std::get<1>(itr->second) << ", "
495  << std::get<2>(itr->second) << ", "
496  << std::get<3>(itr->second) << ") Rec ("
497  << energy << ", " << xyz.x() << ", "
498  << xyz.y() << ", " << xyz.z() << ")\n";
499 #endif
500  }
501  }
502  }
503  } else {
504  edm::LogWarning("HGCalValid") << "No BH RecHit Found " << std::endl;
505  }
506 
507 }
edm::EDGetTokenT< std::vector< PCaloHit > > fhSimHitToken_
MonitorElement * hebRecVsSimX
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
MonitorElement * hebRecVsSimY
double sign(double x)
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
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
bool detectorType() const
int zside(DetId const &)
MonitorElement * heeRecVsSimX
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
ForwardSubdetector
std::vector< const HGCalDDDConstants * > hgcCons_
MonitorElement * heeRecVsSimZ
const HcalDDDSimConstants * hcCons_
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
void Fill(long long x)
std::vector< const HGCalGeometry * > hgcGeometry_
MonitorElement * hebEnRec
edm::EDGetTokenT< HGCeeRecHitCollection > eeRecHitToken_
edm::EDGetTokenT< std::vector< PCaloHit > > eeSimHitToken_
edm::EDGetTokenT< HBHERecHitCollection > bhRecHitToken_
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
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
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MonitorElement * hebRecVsSimZ
MonitorElement * hefEnRec
const CaloSubdetectorGeometry * hcGeometry_
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:75
MonitorElement * hebdPhiVsPhi
const_iterator end() const
MonitorElement * hebEnSimRec
T value() const
Explicit access to value in case implicit conversion not OK.
Definition: Phi.h:38
Definition: DetId.h:18
MonitorElement * hefdxVsX
T const * product() const
Definition: Handle.h:81
T eta() const
Definition: PV3DBase.h:76
const HcalDDDRecConstants * hcConr_
MonitorElement * hefRecVsSimZ
HcalCellType::HcalCell cell(int det, int zside, int depth, int etaR, int iphi) const
MonitorElement * hefdzVsZ
double energySum(const DataFrame &df, int fs, int ls)
MonitorElement * hebdzVsZ
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
T x() const
Definition: PV3DBase.h:62
MonitorElement * heedyVsY
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
const_iterator begin() const
MonitorElement * hebdEtaVsEta
edm::EDGetTokenT< HGChefRecHitCollection > fhRecHitToken_
void HGCalHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

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

144  {
145 
146  iB.setCurrentFolder("HGCalSimHitsV/HitValidation");
147 
148  //initiating histograms
149  heedzVsZ = iB.book2D("heedzVsZ","",7200,-360,360,100,-0.1,0.1);
150  heedyVsY = iB.book2D("heedyVsY","",400,-200,200,100,-0.02,0.02);
151  heedxVsX = iB.book2D("heedxVsX","",400,-200,200,100,-0.02,0.02);
152  heeRecVsSimZ = iB.book2D("heeRecVsSimZ","",7200,-360,360,7200,-360,360);
153  heeRecVsSimY = iB.book2D("heeRecVsSimY","",400,-200,200,400,-200,200);
154  heeRecVsSimX = iB.book2D("heeRecVsSimX","",400,-200,200,400,-200,200);
155 
156  hefdzVsZ = iB.book2D("hefdzVsZ","",8200,-410,410,100,-0.1,0.1);
157  hefdyVsY = iB.book2D("hefdyVsY","",400,-200,200,100,-0.02,0.02);
158  hefdxVsX = iB.book2D("hefdxVsX","",400,-200,200,100,-0.02,0.02);
159  hefRecVsSimZ = iB.book2D("hefRecVsSimZ","",8200,-410,410,8200,-410,410);
160  hefRecVsSimY = iB.book2D("hefRecVsSimY","",400,-200,200,400,-200,200);
161  hefRecVsSimX = iB.book2D("hefRecVsSimX","",400,-200,200,400,-200,200);
162 
163  hebdzVsZ = iB.book2D("hebdzVsZ","",1080,-540,540,100,-1.0,1.0);
164  hebdPhiVsPhi = iB.book2D("hebdPhiVsPhi","",M_PI*100,-0.5,M_PI+0.5,200,-0.2,0.2);
165  hebdEtaVsEta = iB.book2D("hebdEtaVsEta","",1000,-5,5,200,-0.1,0.1);
166  hebRecVsSimZ = iB.book2D("hebRecVsSimZ","",1080,-540,540,1080,-540,540);
167  hebRecVsSimY = iB.book2D("hebRecVsSimY","",400,-200,200,400,-200,200);
168  hebRecVsSimX = iB.book2D("hebRecVsSimX","",400,-200,200,400,-200,200);
169 
170  heeEnRec = iB.book1D("heeEnRec","",1000,0,10);
171  heeEnSim = iB.book1D("heeEnSim","",1000,0,0.01);
172  heeEnSimRec = iB.book2D("heeEnSimRec","",200,0,0.002,200,0,0.2);
173 
174  hefEnRec = iB.book1D("hefEnRec","",1000,0,10);
175  hefEnSim = iB.book1D("hefEnSim","",1000,0,0.01);
176  hefEnSimRec = iB.book2D("hefEnSimRec","",200,0,0.001,200,0,0.5);
177 
178  hebEnRec = iB.book1D("hebEnRec","",1000,0,15);
179  hebEnSim = iB.book1D("hebEnSim","",1000,0,0.01);
180  hebEnSimRec = iB.book2D("hebEnSimRec","",200,0,0.02,200,0,4);
181 
182 }
MonitorElement * hebRecVsSimX
MonitorElement * hefRecVsSimY
MonitorElement * hefRecVsSimX
MonitorElement * hebRecVsSimY
MonitorElement * hefEnSimRec
MonitorElement * heedzVsZ
MonitorElement * heeRecVsSimX
MonitorElement * heeRecVsSimZ
MonitorElement * heeRecVsSimY
MonitorElement * heeEnRec
MonitorElement * hebEnRec
MonitorElement * hebEnSim
MonitorElement * hefdyVsY
MonitorElement * heeEnSimRec
MonitorElement * hefEnSim
MonitorElement * hebRecVsSimZ
MonitorElement * hefEnRec
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * heedxVsX
MonitorElement * heeEnSim
MonitorElement * hebdPhiVsPhi
#define M_PI
MonitorElement * hebEnSimRec
MonitorElement * hefdxVsX
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * hefRecVsSimZ
MonitorElement * hefdzVsZ
MonitorElement * hebdzVsZ
MonitorElement * heedyVsY
MonitorElement * hebdEtaVsEta
void HGCalHitValidation::dqmBeginRun ( edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 184 of file HGCalHitValidation.cc.

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

185  {
186  //initiating hgc Geometry
187  for (size_t i=0; i<geometrySource_.size(); i++) {
188  if (geometrySource_[i].find("Hcal") != std::string::npos) {
190  iSetup.get<HcalSimNumberingRecord>().get(pHSNDC);
191  if (pHSNDC.isValid()) {
192  hcCons_ = pHSNDC.product();
193  hgcCons_.push_back(0);
194  } else {
195  edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDSimConstants: "
196  << geometrySource_[i] << std::endl;
197  }
199  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
200  if (pHRNDC.isValid()) {
201  hcConr_ = pHRNDC.product();
202  } else {
203  edm::LogWarning("HGCalValid") << "Cannot initiate HcalDDDRecConstants: "
204  << geometrySource_[i] << std::endl;
205  }
207  iSetup.get<CaloGeometryRecord>().get(caloG);
208  if (caloG.isValid()) {
209  const CaloGeometry* geo = caloG.product();
211  hgcGeometry_.push_back(0);
212  } else {
213  edm::LogWarning("HGCalValid") << "Cannot initiate HcalGeometry for "
214  << geometrySource_[i] << std::endl;
215  }
216  } else {
218  iSetup.get<IdealGeometryRecord>().get(geometrySource_[i],hgcCons);
219  if (hgcCons.isValid()) {
220  hgcCons_.push_back(hgcCons.product());
221  } else {
222  edm::LogWarning("HGCalValid") << "Cannot initiate HGCalDDDConstants for "
223  << geometrySource_[i] << std::endl;
224  }
226  iSetup.get<IdealGeometryRecord>().get(geometrySource_[i],hgcGeom);
227  if(hgcGeom.isValid()) {
228  hgcGeometry_.push_back(hgcGeom.product());
229  } else {
230  edm::LogWarning("HGCalValid") << "Cannot initiate HGCalGeometry for "
231  << geometrySource_[i] << std::endl;
232  }
233  }
234  }
235 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
int i
Definition: DBlmapReader.cc:9
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
std::vector< const HGCalDDDConstants * > hgcCons_
const HcalDDDSimConstants * hcCons_
std::vector< const HGCalGeometry * > hgcGeometry_
std::vector< std::string > geometrySource_
const CaloSubdetectorGeometry * hcGeometry_
T const * product() const
Definition: ESHandle.h:86
const HcalDDDRecConstants * hcConr_
bool isValid() const
Definition: ESHandle.h:47
void HGCalHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 134 of file HGCalHitValidation.cc.

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

134  {
135  //The following says we do not know what parameters are allowed so do no validation
136  // Please change this to state exactly what you do use, even if it is no parameters
138  desc.setUnknown();
139  descriptions.addDefault(desc);
140 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

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

Definition at line 93 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::bhSimHitSource
private

Definition at line 87 of file HGCalHitValidation.cc.

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

Definition at line 90 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

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

Definition at line 91 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::eeSimHitSource
private

Definition at line 87 of file HGCalHitValidation.cc.

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

Definition at line 88 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

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

Definition at line 92 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

edm::InputTag HGCalHitValidation::fhSimHitSource
private

Definition at line 87 of file HGCalHitValidation.cc.

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

Definition at line 89 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().

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

Definition at line 84 of file HGCalHitValidation.cc.

Referenced by dqmBeginRun(), and HGCalHitValidation().

const HcalDDDRecConstants* HGCalHitValidation::hcConr_
private

Definition at line 82 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

const HcalDDDSimConstants* HGCalHitValidation::hcCons_
private

Definition at line 81 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

const CaloSubdetectorGeometry* HGCalHitValidation::hcGeometry_
private

Definition at line 83 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

MonitorElement * HGCalHitValidation::hebdEtaVsEta
private

Definition at line 98 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebdPhiVsPhi
private

Definition at line 98 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebdzVsZ
private

Definition at line 98 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebEnRec
private

Definition at line 105 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebEnSim
private

Definition at line 105 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebEnSimRec
private

Definition at line 103 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebRecVsSimX
private

Definition at line 102 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hebRecVsSimY
private

Definition at line 102 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hebRecVsSimZ
private

Definition at line 102 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heedxVsX
private

Definition at line 96 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heedyVsY
private

Definition at line 96 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heedzVsZ
private

Definition at line 96 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeEnRec
private

Definition at line 107 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeEnSim
private

Definition at line 107 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeEnSimRec
private

Definition at line 103 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeRecVsSimX
private

Definition at line 100 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::heeRecVsSimY
private

Definition at line 100 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::heeRecVsSimZ
private

Definition at line 100 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefdxVsX
private

Definition at line 97 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefdyVsY
private

Definition at line 97 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefdzVsZ
private

Definition at line 97 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefEnRec
private

Definition at line 106 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefEnSim
private

Definition at line 106 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefEnSimRec
private

Definition at line 103 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefRecVsSimX
private

Definition at line 101 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement * HGCalHitValidation::hefRecVsSimY
private

Definition at line 101 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

MonitorElement* HGCalHitValidation::hefRecVsSimZ
private

Definition at line 101 of file HGCalHitValidation.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 79 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

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

Definition at line 80 of file HGCalHitValidation.cc.

Referenced by analyze(), and dqmBeginRun().

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

Definition at line 85 of file HGCalHitValidation.cc.

Referenced by analyze(), and HGCalHitValidation().