CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HGCalSimHitValidation Class Reference
Inheritance diagram for HGCalSimHitValidation:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  energysum
 
struct  hitsinfo
 

Public Member Functions

 HGCalSimHitValidation (const edm::ParameterSet &)
 
 ~HGCalSimHitValidation () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
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 (const edm::Run &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 Member Functions

void analyzeHits (std::vector< PCaloHit > &hits)
 
bool defineGeometry (edm::ESTransientHandle< DDCompactView > &ddViewH)
 
void fillHitsInfo (std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
 
void fillOccupancyMap (std::map< int, int > &OccupancyMap, int layer)
 

Private Attributes

std::string caloHitSource_
 
std::vector< MonitorElement * > energy_ [maxTime_]
 
std::vector< MonitorElement * > EtaPhi_Minus_
 
std::vector< MonitorElement * > EtaPhi_Plus_
 
int firstLayer_
 
const HcalDDDRecConstantshcons_
 
bool heRebuild_
 
const HGCalDDDConstantshgcons_
 
std::vector< MonitorElement * > HitOccupancy_Minus_
 
std::vector< MonitorElement * > HitOccupancy_Plus_
 
unsigned int layers_
 
MonitorElementMeanHitOccupancy_Minus_
 
MonitorElementMeanHitOccupancy_Plus_
 
std::string nameDetector_
 
unsigned int nTimes_
 
bool symmDet_
 
bool testNumber_
 
std::vector< double > times_
 
edm::EDGetTokenT< edm::HepMCProducttok_hepMC_
 
edm::EDGetTokenT< edm::PCaloHitContainertok_hits_
 
std::map< uint32_t, HepGeom::Transform3D > transMap_
 
int verbosity_
 

Static Private Attributes

static const unsigned int maxTime_ = 6
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 54 of file HGCalSimHitValidation.cc.

Constructor & Destructor Documentation

HGCalSimHitValidation::HGCalSimHitValidation ( const edm::ParameterSet iConfig)
explicit

Definition at line 111 of file HGCalSimHitValidation.cc.

References caloHitSource_, heRebuild_, HLT_2018_cff::InputTag, maxTime_, nameDetector_, nTimes_, times_, tok_hepMC_, and tok_hits_.

112  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
113  caloHitSource_(iConfig.getParameter<std::string>("CaloHitSource")),
114  times_(iConfig.getParameter<std::vector<double> >("TimeSlices")),
115  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
116  testNumber_(iConfig.getUntrackedParameter<bool>("TestNumber", true)),
117  symmDet_(true),
118  firstLayer_(1) {
119  heRebuild_ = (nameDetector_ == "HCal") ? true : false;
120  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
121  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", caloHitSource_));
122  nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size();
123 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
static const unsigned int maxTime_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
std::vector< double > times_
HGCalSimHitValidation::~HGCalSimHitValidation ( )
inlineoverride

Member Function Documentation

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

Definition at line 136 of file HGCalSimHitValidation.cc.

References analyzeHits(), HcalDetId::depth(), edm::Event::getByToken(), edm::HepMCProduct::GetEvent(), HcalEmpty, HcalEndcap, hcons_, heRebuild_, mps_fire::i, edm::HandleBase::id(), HcalDetId::ieta(), createfilelist::int, HcalDetId::iphi(), edm::HandleBase::isValid(), dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), HcalHitRelabeller::relabel(), HcalDetId::subdet(), testNumber_, tok_hepMC_, tok_hits_, and verbosity_.

Referenced by ~HGCalSimHitValidation().

136  {
137  //Generator input
138  if (verbosity_ > 0) {
140  iEvent.getByToken(tok_hepMC_, evtMC);
141  if (!evtMC.isValid()) {
142  edm::LogVerbatim("HGCalValidation") << "no HepMCProduct found";
143  } else {
144  const HepMC::GenEvent* myGenEvent = evtMC->GetEvent();
145  unsigned int k(0);
146  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
147  ++p, ++k) {
148  edm::LogVerbatim("HGCalValidation") << "Particle[" << k << "] with pt " << (*p)->momentum().perp() << " eta "
149  << (*p)->momentum().eta() << " phi " << (*p)->momentum().phi();
150  }
151  }
152  }
153 
154  //Now the hits
155  edm::Handle<edm::PCaloHitContainer> theCaloHitContainers;
156  iEvent.getByToken(tok_hits_, theCaloHitContainers);
157  if (theCaloHitContainers.isValid()) {
158  if (verbosity_ > 0)
159  edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size();
160  std::vector<PCaloHit> caloHits;
161  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
162  if (heRebuild_ && testNumber_) {
163  for (unsigned int i = 0; i < caloHits.size(); ++i) {
164  unsigned int id_ = caloHits[i].id();
166  if (hid.subdet() != int(HcalEndcap))
167  hid = HcalDetId(HcalEmpty, hid.ieta(), hid.iphi(), hid.depth());
168  caloHits[i].setID(hid.rawId());
169  if (verbosity_ > 0)
170  edm::LogVerbatim("HGCalValidation") << "Hit[" << i << "] " << hid;
171  }
172  }
173  analyzeHits(caloHits);
174  } else if (verbosity_ > 0) {
175  edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!";
176  }
177 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
ProductID id() const
Definition: HandleBase.cc:13
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void analyzeHits(std::vector< PCaloHit > &hits)
int depth() const
get the tower depth
Definition: HcalDetId.h:164
const HcalDDDRecConstants * hcons_
int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
bool isValid() const
Definition: HandleBase.h:70
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
DetId relabel(const uint32_t testId) const
void HGCalSimHitValidation::analyzeHits ( std::vector< PCaloHit > &  hits)
private

Definition at line 179 of file HGCalSimHitValidation.cc.

References HGCalSimHitValidation::hitsinfo::cell, hgcalTopologyTester_cfi::cell2, HGCalSimHitValidation::hitsinfo::cell2, HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), funct::cos(), TauDecayModes::dec, HcalDetId::depth(), HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, HGCalSimHitValidation::hitsinfo::eta, fastmath::etaphi(), HGCalSimHitValidation::energysum::eTime, HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillOccupancyMap(), firstLayer_, ForwardEmpty, HGCalDDDConstants::geomMode(), HcalDDDRecConstants::getEtaPhi(), HcalDDDRecConstants::getRZ(), HcalEndcap, hcons_, heRebuild_, HGCalGeometryMode::Hexagon8, HGCalGeometryMode::Hexagon8Full, hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, mps_fire::i, HGCScintillatorDetId::ietaAbs(), HcalDetId::ietaAbs(), HGCScintillatorDetId::iphi(), HcalDetId::iphi(), dqmdumpme::k, HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), HGCalSimHitValidation::hitsinfo::layer, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), nameDetector_, nTimes_, HGCalTestNumbering::packSquareIndex(), HGCalSimHitValidation::hitsinfo::phi, HGCalSimHitValidation::hitsinfo::sector, HGCalSimHitValidation::hitsinfo::sector2, funct::sin(), HGCalGeometryMode::Square, HcalDetId::subdet(), symmDet_, ntuplemaker::time, times_, transMap_, HGCalGeometryMode::Trapezoid, HGCScintillatorDetId::type(), HGCSiliconDetId::type(), HGCalSimHitValidation::hitsinfo::type, HGCalTestNumbering::unpackHexagonIndex(), HGCalTestNumbering::unpackSquareIndex(), verbosity_, HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), HGCalDDDConstants::waferZ(), HGCalSimHitValidation::hitsinfo::x, geometryCSVtoXML::xy, HGCalSimHitValidation::hitsinfo::y, HGCalSimHitValidation::hitsinfo::z, HGCScintillatorDetId::zside(), HGCSiliconDetId::zside(), HcalDetId::zside(), and ecaldqm::zside().

Referenced by analyze(), and ~HGCalSimHitValidation().

179  {
180  std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
181  OccupancyMap_plus.clear();
182  OccupancyMap_minus.clear();
183 
184  std::map<uint32_t, std::pair<hitsinfo, energysum> > map_hits;
185  map_hits.clear();
186 
187  if (verbosity_ > 0)
188  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hits.size() << " PcaloHit elements";
189  unsigned int nused(0);
190  for (unsigned int i = 0; i < hits.size(); i++) {
191  double energy = hits[i].energy();
192  double time = hits[i].time();
193  uint32_t id_ = hits[i].id();
194  int cell, sector, subsector(0), layer, zside;
195  int subdet(0), cell2(0), type(0);
196  if (heRebuild_) {
197  HcalDetId detId = HcalDetId(id_);
198  subdet = detId.subdet();
199  if (subdet != static_cast<int>(HcalEndcap))
200  continue;
201  cell = detId.ietaAbs();
202  sector = detId.iphi();
203  subsector = 1;
204  layer = detId.depth();
205  zside = detId.zside();
206  } else if ((hgcons_->geomMode() == HGCalGeometryMode::Hexagon8) ||
208  HGCSiliconDetId detId = HGCSiliconDetId(id_);
209  subdet = ForwardEmpty;
210  cell = detId.cellU();
211  cell2 = detId.cellV();
212  sector = detId.waferU();
213  subsector = detId.waferV();
214  type = detId.type();
215  layer = detId.layer();
216  zside = detId.zside();
217  } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
218  HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell);
219  } else if (hgcons_->geomMode() == HGCalGeometryMode::Trapezoid) {
221  subdet = ForwardEmpty;
222  sector = detId.ietaAbs();
223  cell = detId.iphi();
224  subsector = 1;
225  type = detId.type();
226  layer = detId.layer();
227  zside = detId.zside();
228  } else {
229  HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, type, cell);
230  }
231  nused++;
232  if (verbosity_ > 1)
233  edm::LogVerbatim("HGCalValidation")
234  << "Detector " << nameDetector_ << " zside = " << zside << " sector|wafer = " << sector << ":" << subsector
235  << " type = " << type << " layer = " << layer << " cell = " << cell << ":" << cell2 << " energy = " << energy
236  << " energyem = " << hits[i].energyEM() << " energyhad = " << hits[i].energyHad() << " time = " << time;
237 
238  HepGeom::Point3D<float> gcoord;
239  if (heRebuild_) {
240  std::pair<double, double> etaphi = hcons_->getEtaPhi(subdet, zside * cell, sector);
241  double rz = hcons_->getRZ(subdet, zside * cell, layer);
242  if (verbosity_ > 2)
243  edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":"
244  << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz;
245  gcoord = HepGeom::Point3D<float>(rz * cos(etaphi.second) / cosh(etaphi.first),
246  rz * sin(etaphi.second) / cosh(etaphi.first),
247  rz * tanh(etaphi.first));
248  } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
249  std::pair<float, float> xy = hgcons_->locateCell(cell, layer, subsector, false);
250  const HepGeom::Point3D<float> lcoord(xy.first, xy.second, 0);
251  int subs = (symmDet_ ? 0 : subsector);
252  id_ = HGCalTestNumbering::packSquareIndex(zside, layer, sector, subs, 0);
253  gcoord = (transMap_[id_] * lcoord);
254  } else {
255  std::pair<float, float> xy;
258  xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true);
259  } else if (hgcons_->geomMode() == HGCalGeometryMode::Trapezoid) {
260  xy = hgcons_->locateCellTrap(layer, sector, cell, false);
261  } else {
262  xy = hgcons_->locateCell(cell, layer, sector, false);
263  }
264  double zp = hgcons_->waferZ(layer, false);
265  if (zside < 0)
266  zp = -zp;
267  float xp = (zp < 0) ? -xy.first : xy.first;
268  gcoord = HepGeom::Point3D<float>(xp, xy.second, zp);
269  }
270  double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
271  if (verbosity_ > 1)
272  edm::LogVerbatim("HGCalValidation")
273  << std::hex << id_ << std::dec << " global coordinate " << gcoord << " time " << time << ":" << tof;
274  time -= tof;
275 
276  energysum esum;
277  hitsinfo hinfo;
278  if (map_hits.count(id_) != 0) {
279  hinfo = map_hits[id_].first;
280  esum = map_hits[id_].second;
281  } else {
282  hinfo.x = gcoord.x();
283  hinfo.y = gcoord.y();
284  hinfo.z = gcoord.z();
285  hinfo.sector = sector;
286  hinfo.sector2 = subsector;
287  hinfo.cell = cell;
288  hinfo.cell2 = cell2;
289  hinfo.type = type;
290  hinfo.layer = layer - firstLayer_;
291  hinfo.phi = gcoord.getPhi();
292  hinfo.eta = gcoord.getEta();
293  }
294  esum.etotal += energy;
295  for (unsigned int k = 0; k < nTimes_; ++k) {
296  if (time > 0 && time < times_[k])
297  esum.eTime[k] += energy;
298  }
299 
300  if (verbosity_ > 1)
301  edm::LogVerbatim("HGCalValidation") << " ----------------------- gx = " << hinfo.x << " gy = " << hinfo.y
302  << " gz = " << hinfo.z << " phi = " << hinfo.phi << " eta = " << hinfo.eta;
303  map_hits[id_] = std::pair<hitsinfo, energysum>(hinfo, esum);
304  }
305  if (verbosity_ > 0)
306  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << map_hits.size()
307  << " detector elements being hit";
308 
309  std::map<uint32_t, std::pair<hitsinfo, energysum> >::iterator itr;
310  for (itr = map_hits.begin(); itr != map_hits.end(); ++itr) {
311  hitsinfo hinfo = (*itr).second.first;
312  energysum esum = (*itr).second.second;
313  int layer = hinfo.layer;
314  double eta = hinfo.eta;
315 
316  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
317  fillHitsInfo((*itr).second, itimeslice, esum.eTime[itimeslice]);
318  }
319 
320  if (eta > 0.0)
321  fillOccupancyMap(OccupancyMap_plus, layer);
322  else
323  fillOccupancyMap(OccupancyMap_minus, layer);
324  }
325  if (verbosity_ > 0)
326  edm::LogVerbatim("HGCalValidation") << "With map:used:total " << hits.size() << "|" << nused << "|"
327  << map_hits.size() << " hits";
328 
329  for (auto const& itr : OccupancyMap_plus) {
330  int layer = itr.first;
331  int occupancy = itr.second;
332  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
333  }
334  for (auto const& itr : OccupancyMap_minus) {
335  int layer = itr.first;
336  int occupancy = itr.second;
337  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
338  }
339 }
std::pair< T, T > etaphi(T x, T y, T z)
Definition: FastMath.h:162
type
Definition: HCALResponse.h:21
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
std::pair< double, double > getEtaPhi(const int &subdet, const int &ieta, const int &iphi) const
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
std::vector< MonitorElement * > HitOccupancy_Plus_
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
int waferU() const
int cellV() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int type() const
get the type
int zside() const
get the z-side of the cell (1/-1)
int zside(DetId const &)
std::vector< MonitorElement * > HitOccupancy_Minus_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
int cellU() const
get the cell #&#39;s in u,v or in x,y
int depth() const
get the tower depth
Definition: HcalDetId.h:164
const HcalDDDRecConstants * hcons_
int type() const
get the type
int layer() const
get the layer #
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
double getRZ(const int &subdet, const int &ieta, const int &depth) const
int waferV() const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int iphi() const
get the phi index
HGCalGeometryMode::GeometryMode geomMode() const
double waferZ(int layer, bool reco) const
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:148
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
static void unpackSquareIndex(const uint32_t &idx, int &z, int &lay, int &sec, int &subsec, int &cell)
int layer() const
get the layer #
int zside() const
get the z-side of the cell (1/-1)
std::map< uint32_t, HepGeom::Transform3D > transMap_
const HGCalDDDConstants * hgcons_
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
void fillHitsInfo(std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
std::vector< double > times_
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
void HGCalSimHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 435 of file HGCalSimHitValidation.cc.

References dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), dqm::dqmstoreimpl::DQMStore::IBooker::book2D(), DEFINE_FWK_MODULE, energy_, EtaPhi_Minus_, EtaPhi_Plus_, firstLayer_, HitOccupancy_Minus_, HitOccupancy_Plus_, layers_, MeanHitOccupancy_Minus_, MeanHitOccupancy_Plus_, nameDetector_, nTimes_, pi, and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

Referenced by ~HGCalSimHitValidation().

435  {
436  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/" + nameDetector_);
437 
438  std::ostringstream histoname;
439  for (unsigned int il = 0; il < layers_; ++il) {
440  int ilayer = firstLayer_ + static_cast<int>(il);
441  auto istr1 = std::to_string(ilayer);
442  while (istr1.size() < 2) {
443  istr1.insert(0, "0");
444  }
445  histoname.str("");
446  histoname << "HitOccupancy_Plus_layer_" << istr1;
447  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
448  histoname.str("");
449  histoname << "HitOccupancy_Minus_layer_" << istr1;
450  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
451 
452  histoname.str("");
453  histoname << "EtaPhi_Plus_"
454  << "layer_" << istr1;
455  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
456  histoname.str("");
457  histoname << "EtaPhi_Minus_"
458  << "layer_" << istr1;
459  EtaPhi_Minus_.push_back(
460  iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
461 
462  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
463  histoname.str("");
464  histoname << "energy_time_" << itimeslice << "_layer_" << istr1;
465  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(), "energy_", 100, 0, 0.1));
466  }
467  }
468 
469  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
470  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
471 }
MonitorElement * MeanHitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Minus_
MonitorElement * MeanHitOccupancy_Minus_
const Double_t pi
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > energy_[maxTime_]
std::vector< MonitorElement * > EtaPhi_Minus_
bool HGCalSimHitValidation::defineGeometry ( edm::ESTransientHandle< DDCompactView > &  ddViewH)
private

Definition at line 366 of file HGCalSimHitValidation.cc.

References DDTrap::alpha1(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), DDName::fullname(), hgcons_, AnalysisDataFormats_SUSYBSMObjects::hr, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDBase< N, C >::name(), nameDetector_, DDFilteredView::next(), HGCalTestNumbering::packSquareIndex(), idealTransformation::rotation, DDFilteredView::rotation(), fileinputsource_cfi::sec, DDLogicalPart::solid(), HGCalGeometryMode::Square, AlCaHLTBitMon_QueryRunRegistry::string, symmDet_, DDFilteredView::translation(), transMap_, verbosity_, x, y, and z.

Referenced by dqmBeginRun(), and ~HGCalSimHitValidation().

366  {
367  if (verbosity_ > 0)
368  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalDDDConstants for " << nameDetector_ << " : " << hgcons_;
369 
370  if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
371  const DDCompactView& cview = *ddViewH;
372  std::string attribute = "Volume";
374 
375  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0)};
376  DDFilteredView fv(cview, filter);
377  bool dodet = fv.firstChild();
378 
379  while (dodet) {
380  const DDSolid& sol = fv.logicalPart().solid();
381  const std::string& name = sol.name().fullname();
382  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
383  if (isd > 0) {
384  std::vector<int> copy = fv.copyNumbers();
385  int nsiz = static_cast<int>(copy.size());
386  int lay = (nsiz > 0) ? copy[nsiz - 1] : -1;
387  int sec = (nsiz > 1) ? copy[nsiz - 2] : -1;
388  int zp = (nsiz > 3) ? copy[nsiz - 4] : -1;
389  if (zp != 1)
390  zp = -1;
391  const DDTrap& trp = static_cast<DDTrap>(sol);
392  int subs = (trp.alpha1() > 0 ? 1 : 0);
393  symmDet_ = (trp.alpha1() == 0 ? true : false);
394  uint32_t id = HGCalTestNumbering::packSquareIndex(zp, lay, sec, subs, 0);
395  DD3Vector x, y, z;
396  fv.rotation().GetComponents(x, y, z);
397  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
398  const CLHEP::HepRotation hr(rotation);
399  const CLHEP::Hep3Vector h3v(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
400  const HepGeom::Transform3D ht3d(hr, h3v);
401  transMap_.insert(std::make_pair(id, ht3d));
402  if (verbosity_ > 2)
403  edm::LogVerbatim("HGCalValidation") << HGCalDetId(id) << " Transform using " << h3v << " and " << hr;
404  }
405  dodet = fv.next();
406  }
407  if (verbosity_ > 0)
408  edm::LogVerbatim("HGCalValidation") << "Finds " << transMap_.size() << " elements and SymmDet_ = " << symmDet_;
409  }
410  return true;
411 }
const N & name() const
Definition: DDBase.h:59
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
susybsm::HSCParticleRef hr
Definition: classes.h:26
const std::string fullname() const
Definition: DDName.h:40
Interface to a Trapezoid.
Definition: DDSolid.h:77
Definition: value.py:1
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:143
std::map< uint32_t, HepGeom::Transform3D > transMap_
const HGCalDDDConstants * hgcons_
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
void HGCalSimHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 414 of file HGCalSimHitValidation.cc.

References defineGeometry(), HGCalDDDConstants::firstLayer(), firstLayer_, edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), hcons_, heRebuild_, hgcons_, HGCalDDDConstants::layers(), layers_, nameDetector_, and verbosity_.

Referenced by ~HGCalSimHitValidation().

414  {
415  if (heRebuild_) {
417  iSetup.get<HcalRecNumberingRecord>().get(pHRNDC);
418  hcons_ = &(*pHRNDC);
419  layers_ = hcons_->getMaxDepth(1);
420  } else {
422  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
423  hgcons_ = &(*pHGDC);
424  layers_ = hgcons_->layers(false);
427  iSetup.get<IdealGeometryRecord>().get(pDD);
428  defineGeometry(pDD);
429  }
430  if (verbosity_ > 0)
431  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at "
432  << firstLayer_;
433 }
bool defineGeometry(edm::ESTransientHandle< DDCompactView > &ddViewH)
unsigned int layers(bool reco) const
const HcalDDDRecConstants * hcons_
int getMaxDepth(const int &type) const
T get() const
Definition: EventSetup.h:73
const HGCalDDDConstants * hgcons_
int firstLayer() const
void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 125 of file HGCalSimHitValidation.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~HGCalSimHitValidation().

125  {
127  std::vector<double> times = {25.0, 1000.0};
128  desc.add<std::string>("DetectorName", "HGCalEESensitive");
129  desc.add<std::string>("CaloHitSource", "HGCHitsEE");
130  desc.add<std::vector<double> >("TimeSlices", times);
131  desc.addUntracked<int>("Verbosity", 0);
132  desc.addUntracked<bool>("TestNumber", true);
133  descriptions.add("hgcalSimHitValidationEE", desc);
134 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HGCalSimHitValidation::fillHitsInfo ( std::pair< hitsinfo, energysum hit_,
unsigned int  itimeslice,
double  esum 
)
private

Definition at line 349 of file HGCalSimHitValidation.cc.

References energy_, EtaPhi_Minus_, EtaPhi_Plus_, layers_, nameDetector_, and verbosity_.

Referenced by analyzeHits(), and ~HGCalSimHitValidation().

349  {
350  unsigned int ilayer = hits.first.layer;
351  if (ilayer < layers_) {
352  energy_[itimeslice].at(ilayer)->Fill(esum);
353  if (itimeslice == 0) {
354  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
355  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
356  }
357  } else {
358  if (verbosity_ > 0)
359  edm::LogVerbatim("HGCalValidation")
360  << "Problematic Hit for " << nameDetector_ << " at sector " << hits.first.sector << ":" << hits.first.sector2
361  << " layer " << hits.first.layer << " cell " << hits.first.cell << ":" << hits.first.cell2 << " energy "
362  << hits.second.etotal;
363  }
364 }
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > energy_[maxTime_]
std::vector< MonitorElement * > EtaPhi_Minus_
void HGCalSimHitValidation::fillOccupancyMap ( std::map< int, int > &  OccupancyMap,
int  layer 
)
private

Definition at line 341 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and ~HGCalSimHitValidation().

341  {
342  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
343  ++OccupancyMap[layer];
344  } else {
345  OccupancyMap[layer] = 1;
346  }
347 }

Member Data Documentation

std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 91 of file HGCalSimHitValidation.cc.

Referenced by HGCalSimHitValidation().

std::vector<MonitorElement*> HGCalSimHitValidation::energy_[maxTime_]
private

Definition at line 107 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

std::vector<MonitorElement*> HGCalSimHitValidation::EtaPhi_Minus_
private

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

std::vector<MonitorElement*> HGCalSimHitValidation::EtaPhi_Plus_
private

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

int HGCalSimHitValidation::firstLayer_
private

Definition at line 100 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), bookHistograms(), and dqmBeginRun().

const HcalDDDRecConstants* HGCalSimHitValidation::hcons_
private

Definition at line 93 of file HGCalSimHitValidation.cc.

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

bool HGCalSimHitValidation::heRebuild_
private

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyze(), analyzeHits(), dqmBeginRun(), and HGCalSimHitValidation().

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), defineGeometry(), and dqmBeginRun().

std::vector<MonitorElement*> HGCalSimHitValidation::HitOccupancy_Minus_
private

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

std::vector<MonitorElement*> HGCalSimHitValidation::HitOccupancy_Plus_
private

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

unsigned int HGCalSimHitValidation::layers_
private

Definition at line 99 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), dqmBeginRun(), and fillHitsInfo().

const unsigned int HGCalSimHitValidation::maxTime_ = 6
staticprivate

Definition at line 106 of file HGCalSimHitValidation.cc.

Referenced by HGCalSimHitValidation().

MonitorElement * HGCalSimHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

std::string HGCalSimHitValidation::nameDetector_
private
unsigned int HGCalSimHitValidation::nTimes_
private

Definition at line 108 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), bookHistograms(), and HGCalSimHitValidation().

bool HGCalSimHitValidation::symmDet_
private

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and defineGeometry().

bool HGCalSimHitValidation::testNumber_
private

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyze().

std::vector<double> HGCalSimHitValidation::times_
private

Definition at line 94 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and HGCalSimHitValidation().

edm::EDGetTokenT<edm::HepMCProduct> HGCalSimHitValidation::tok_hepMC_
private

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by analyze(), and HGCalSimHitValidation().

edm::EDGetTokenT<edm::PCaloHitContainer> HGCalSimHitValidation::tok_hits_
private

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by analyze(), and HGCalSimHitValidation().

std::map<uint32_t, HepGeom::Transform3D> HGCalSimHitValidation::transMap_
private

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and defineGeometry().

int HGCalSimHitValidation::verbosity_
private