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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

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
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

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 DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

void analyzeHits (std::vector< PCaloHit > &hits)
 
bool defineGeometry (const cms::DDCompactView *ddViewH)
 
bool defineGeometry (const 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

const std::string caloHitSource_
 
std::vector< MonitorElement * > energy_ [maxTime_]
 
std::vector< MonitorElement * > EtaPhi_Minus_
 
std::vector< MonitorElement * > EtaPhi_Plus_
 
int firstLayer_
 
const bool fromDDD_
 
const HGCalDDDConstantshgcons_
 
std::vector< MonitorElement * > HitOccupancy_Minus_
 
std::vector< MonitorElement * > HitOccupancy_Plus_
 
unsigned int layers_
 
MonitorElementMeanHitOccupancy_Minus_
 
MonitorElementMeanHitOccupancy_Plus_
 
const std::string nameDetector_
 
unsigned int nTimes_
 
bool symmDet_
 
const std::vector< double > times_
 
const edm::ESGetToken< DDCompactView, IdealGeometryRecordtok_cpv_
 
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecordtok_cpvc_
 
edm::EDGetTokenT< edm::HepMCProducttok_hepMC_
 
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordtok_hgcal_
 
edm::EDGetTokenT< edm::PCaloHitContainertok_hits_
 
std::map< uint32_t, HepGeom::Transform3D > transMap_
 
const 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::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 50 of file HGCalSimHitValidation.cc.

Constructor & Destructor Documentation

◆ HGCalSimHitValidation()

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

Definition at line 111 of file HGCalSimHitValidation.cc.

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  fromDDD_(iConfig.getUntrackedParameter<bool>("fromDDD", true)),
117  tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
119  tok_cpv_(esConsumes<DDCompactView, IdealGeometryRecord, edm::Transition::BeginRun>()),
120  tok_cpvc_(esConsumes<cms::DDCompactView, IdealGeometryRecord, edm::Transition::BeginRun>()),
121  symmDet_(true),
122  firstLayer_(1) {
123  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
124  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", caloHitSource_));
125  nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size();
126 }

References nameDetector_.

◆ ~HGCalSimHitValidation()

HGCalSimHitValidation::~HGCalSimHitValidation ( )
inlineoverride

Definition at line 71 of file HGCalSimHitValidation.cc.

71 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 140 of file HGCalSimHitValidation.cc.

140  {
141  //Generator input
142  if (verbosity_ > 0) {
144  iEvent.getByToken(tok_hepMC_, evtMC);
145  if (!evtMC.isValid()) {
146  edm::LogVerbatim("HGCalValidation") << "no HepMCProduct found";
147  } else {
148  const HepMC::GenEvent* myGenEvent = evtMC->GetEvent();
149  unsigned int k(0);
150  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
151  ++p, ++k) {
152  edm::LogVerbatim("HGCalValidation") << "Particle[" << k << "] with pt " << (*p)->momentum().perp() << " eta "
153  << (*p)->momentum().eta() << " phi " << (*p)->momentum().phi();
154  }
155  }
156  }
157 
158  //Now the hits
159  edm::Handle<edm::PCaloHitContainer> theCaloHitContainers;
160  iEvent.getByToken(tok_hits_, theCaloHitContainers);
161  if (theCaloHitContainers.isValid()) {
162  if (verbosity_ > 0)
163  edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size();
164  std::vector<PCaloHit> caloHits;
165  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
166  analyzeHits(caloHits);
167  } else if (verbosity_ > 0) {
168  edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!";
169  }
170 }

References analyzeHits(), edm::HepMCProduct::GetEvent(), iEvent, edm::HandleBase::isValid(), dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, tok_hepMC_, tok_hits_, and verbosity_.

◆ analyzeHits()

void HGCalSimHitValidation::analyzeHits ( std::vector< PCaloHit > &  hits)
private

Definition at line 172 of file HGCalSimHitValidation.cc.

172  {
173  std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
174  OccupancyMap_plus.clear();
175  OccupancyMap_minus.clear();
176 
177  std::map<uint32_t, std::pair<hitsinfo, energysum> > map_hits;
178  map_hits.clear();
179 
180  if (verbosity_ > 0)
181  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hits.size() << " PcaloHit elements";
182  unsigned int nused(0);
183  for (unsigned int i = 0; i < hits.size(); i++) {
184  double energy = hits[i].energy();
185  double time = hits[i].time();
186  uint32_t id_ = hits[i].id();
187  int cell, sector, subsector(0), layer, zside;
188  int subdet(0), cell2(0), type(0);
189  if (hgcons_->waferHexagon8()) {
190  HGCSiliconDetId detId = HGCSiliconDetId(id_);
191  subdet = ForwardEmpty;
192  cell = detId.cellU();
193  cell2 = detId.cellV();
194  sector = detId.waferU();
195  subsector = detId.waferV();
196  type = detId.type();
197  layer = detId.layer();
198  zside = detId.zside();
199  } else if (hgcons_->tileTrapezoid()) {
201  subdet = ForwardEmpty;
202  sector = detId.ietaAbs();
203  cell = detId.iphi();
204  subsector = 1;
205  type = detId.type();
206  layer = detId.layer();
207  zside = detId.zside();
208  } else {
209  HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, type, cell);
210  }
211  nused++;
212  if (verbosity_ > 1)
213  edm::LogVerbatim("HGCalValidation")
214  << "Detector " << nameDetector_ << " zside = " << zside << " sector|wafer = " << sector << ":" << subsector
215  << " type = " << type << " layer = " << layer << " cell = " << cell << ":" << cell2 << " energy = " << energy
216  << " energyem = " << hits[i].energyEM() << " energyhad = " << hits[i].energyHad() << " time = " << time;
217 
218  HepGeom::Point3D<float> gcoord;
219  std::pair<float, float> xy;
220  if (hgcons_->waferHexagon8()) {
221  xy = hgcons_->locateCell(layer, sector, subsector, cell, cell2, false, true);
222  } else if (hgcons_->tileTrapezoid()) {
223  xy = hgcons_->locateCellTrap(layer, sector, cell, false);
224  } else {
225  xy = hgcons_->locateCell(cell, layer, sector, false);
226  }
227  double zp = hgcons_->waferZ(layer, false);
228  if (zside < 0)
229  zp = -zp;
230  float xp = (zp < 0) ? -xy.first : xy.first;
231  gcoord = HepGeom::Point3D<float>(xp, xy.second, zp);
232  double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
233  if (verbosity_ > 1)
234  edm::LogVerbatim("HGCalValidation")
235  << std::hex << id_ << std::dec << " global coordinate " << gcoord << " time " << time << ":" << tof;
236  time -= tof;
237 
238  energysum esum;
239  hitsinfo hinfo;
240  if (map_hits.count(id_) != 0) {
241  hinfo = map_hits[id_].first;
242  esum = map_hits[id_].second;
243  } else {
244  hinfo.x = gcoord.x();
245  hinfo.y = gcoord.y();
246  hinfo.z = gcoord.z();
247  hinfo.sector = sector;
248  hinfo.sector2 = subsector;
249  hinfo.cell = cell;
250  hinfo.cell2 = cell2;
251  hinfo.type = type;
252  hinfo.layer = layer - firstLayer_;
253  hinfo.phi = gcoord.getPhi();
254  hinfo.eta = gcoord.getEta();
255  }
256  esum.etotal += energy;
257  for (unsigned int k = 0; k < nTimes_; ++k) {
258  if (time > 0 && time < times_[k])
259  esum.eTime[k] += energy;
260  }
261 
262  if (verbosity_ > 1)
263  edm::LogVerbatim("HGCalValidation") << " ----------------------- gx = " << hinfo.x << " gy = " << hinfo.y
264  << " gz = " << hinfo.z << " phi = " << hinfo.phi << " eta = " << hinfo.eta;
265  map_hits[id_] = std::pair<hitsinfo, energysum>(hinfo, esum);
266  }
267  if (verbosity_ > 0)
268  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << map_hits.size()
269  << " detector elements being hit";
270 
271  std::map<uint32_t, std::pair<hitsinfo, energysum> >::iterator itr;
272  for (itr = map_hits.begin(); itr != map_hits.end(); ++itr) {
273  hitsinfo hinfo = (*itr).second.first;
274  energysum esum = (*itr).second.second;
275  int layer = hinfo.layer;
276  double eta = hinfo.eta;
277 
278  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
279  fillHitsInfo((*itr).second, itimeslice, esum.eTime[itimeslice]);
280  }
281 
282  if (eta > 0.0)
283  fillOccupancyMap(OccupancyMap_plus, layer);
284  else
285  fillOccupancyMap(OccupancyMap_minus, layer);
286  }
287  if (verbosity_ > 0)
288  edm::LogVerbatim("HGCalValidation") << "With map:used:total " << hits.size() << "|" << nused << "|"
289  << map_hits.size() << " hits";
290 
291  for (auto const& itr : OccupancyMap_plus) {
292  int layer = itr.first;
293  int occupancy = itr.second;
294  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
295  }
296  for (auto const& itr : OccupancyMap_minus) {
297  int layer = itr.first;
298  int occupancy = itr.second;
299  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
300  }
301 }

References hgcalTopologyTester_cfi::cell2, HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), TauDecayModes::dec, HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, HGCalSimHitValidation::energysum::eTime, HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillOccupancyMap(), firstLayer_, ForwardEmpty, hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, hfClusterShapes_cfi::hits, mps_fire::i, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), dqmdumpme::k, HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), phase1PixelTopology::layer, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), nameDetector_, nTimes_, HGCalDDDConstants::tileTrapezoid(), protons_cff::time, times_, HGCScintillatorDetId::type(), HGCSiliconDetId::type(), HGCalTestNumbering::unpackHexagonIndex(), verbosity_, HGCalDDDConstants::waferHexagon8(), HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xy, HGCScintillatorDetId::zside(), HGCSiliconDetId::zside(), and ecaldqm::zside().

Referenced by analyze().

◆ bookHistograms()

void HGCalSimHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 435 of file HGCalSimHitValidation.cc.

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 }

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

◆ defineGeometry() [1/2]

bool HGCalSimHitValidation::defineGeometry ( const cms::DDCompactView ddViewH)
private

Definition at line 376 of file HGCalSimHitValidation.cc.

376  {
377  if (verbosity_ > 0)
378  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalDDDConstants (DD4hep) for " << nameDetector_ << " : "
379  << hgcons_;
380 
382  const cms::DDCompactView& cview = *ddViewH;
383  const cms::DDFilter filter("Volume", nameDetector_);
384  cms::DDFilteredView fv(cview, filter);
385 
386  while (fv.firstChild()) {
387  const auto& name = fv.name();
388  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
389  if (isd > 0) {
390  const auto& copy = fv.copyNos();
391  int nsiz = static_cast<int>(copy.size());
392  int lay = (nsiz > 0) ? copy[0] : -1;
393  int sec = (nsiz > 1) ? copy[1] : -1;
394  int zp = (nsiz > 3) ? copy[3] : -1;
395  if (zp != 1)
396  zp = -1;
397  const auto& pars = fv.parameters();
398  int subs = (pars[6] > 0 ? 1 : 0);
399  symmDet_ = (pars[6] == 0 ? true : false);
400  uint32_t id = HGCalTestNumbering::packSquareIndex(zp, lay, sec, subs, 0);
401  DD3Vector x, y, z;
402  fv.rotation().GetComponents(x, y, z);
403  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
404  const CLHEP::HepRotation hr(rotation);
405  const CLHEP::Hep3Vector h3v(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
406  const HepGeom::Transform3D ht3d(hr, h3v);
407  transMap_.insert(std::make_pair(id, ht3d));
408  if (verbosity_ > 2)
409  edm::LogVerbatim("HGCalValidation") << HGCalDetId(id) << " Transform using " << h3v << " and " << hr;
410  }
411  }
412  if (verbosity_ > 0)
413  edm::LogVerbatim("HGCalValidation") << "Finds " << transMap_.size() << " elements and SymmDet_ = " << symmDet_;
414  }
415  return true;
416 }

References filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), ALCARECOTkAlBeamHalo_cff::filter, cms::DDFilteredView::firstChild(), HGCalDDDConstants::geomMode(), hgcons_, Skims_PA_cff::name, cms::DDFilteredView::name(), nameDetector_, HGCalTestNumbering::packSquareIndex(), cms::DDFilteredView::parameters(), idealTransformation::rotation, cms::DDFilteredView::rotation(), fileinputsource_cfi::sec, HGCalGeometryMode::Square, symmDet_, cms::DDFilteredView::translation(), transMap_, funct::true, verbosity_, x, y, and z.

◆ defineGeometry() [2/2]

bool HGCalSimHitValidation::defineGeometry ( const DDCompactView ddViewH)
private

Definition at line 328 of file HGCalSimHitValidation.cc.

328  {
329  if (verbosity_ > 0)
330  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalDDDConstants (DDD) for " << nameDetector_ << " : "
331  << hgcons_;
332 
334  const DDCompactView& cview = *ddViewH;
335  std::string attribute = "Volume";
337 
339  DDFilteredView fv(cview, filter);
340  bool dodet = fv.firstChild();
341 
342  while (dodet) {
343  const DDSolid& sol = fv.logicalPart().solid();
344  const std::string& name = sol.name().fullname();
345  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
346  if (isd > 0) {
347  std::vector<int> copy = fv.copyNumbers();
348  int nsiz = static_cast<int>(copy.size());
349  int lay = (nsiz > 0) ? copy[nsiz - 1] : -1;
350  int sec = (nsiz > 1) ? copy[nsiz - 2] : -1;
351  int zp = (nsiz > 3) ? copy[nsiz - 4] : -1;
352  if (zp != 1)
353  zp = -1;
354  const DDTrap& trp = static_cast<DDTrap>(sol);
355  int subs = (trp.alpha1() > 0 ? 1 : 0);
356  symmDet_ = (trp.alpha1() == 0 ? true : false);
357  uint32_t id = HGCalTestNumbering::packSquareIndex(zp, lay, sec, subs, 0);
358  DD3Vector x, y, z;
359  fv.rotation().GetComponents(x, y, z);
360  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
361  const CLHEP::HepRotation hr(rotation);
362  const CLHEP::Hep3Vector h3v(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
363  const HepGeom::Transform3D ht3d(hr, h3v);
364  transMap_.insert(std::make_pair(id, ht3d));
365  if (verbosity_ > 2)
366  edm::LogVerbatim("HGCalValidation") << HGCalDetId(id) << " Transform using " << h3v << " and " << hr;
367  }
368  dodet = fv.next();
369  }
370  if (verbosity_ > 0)
371  edm::LogVerbatim("HGCalValidation") << "Finds " << transMap_.size() << " elements and SymmDet_ = " << symmDet_;
372  }
373  return true;
374 }

References DDTrap::alpha1(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), DDName::fullname(), HGCalDDDConstants::geomMode(), hgcons_, 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_, funct::true, verbosity_, x, y, and z.

Referenced by dqmBeginRun().

◆ dqmBeginRun()

void HGCalSimHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 419 of file HGCalSimHitValidation.cc.

419  {
420  hgcons_ = &iSetup.getData(tok_hgcal_);
421  layers_ = hgcons_->layers(false);
423  if (fromDDD_) {
424  const DDCompactView* pDD = &iSetup.getData(tok_cpv_);
425  defineGeometry(pDD);
426  } else {
427  const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_);
428  defineGeometry(pDD);
429  }
430  if (verbosity_ > 0)
431  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at "
432  << firstLayer_;
433 }

References defineGeometry(), HGCalDDDConstants::firstLayer(), firstLayer_, fromDDD_, edm::EventSetup::getData(), hgcons_, HGCalDDDConstants::layers(), layers_, nameDetector_, tok_cpv_, tok_cpvc_, tok_hgcal_, and verbosity_.

◆ fillDescriptions()

void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 128 of file HGCalSimHitValidation.cc.

128  {
130  std::vector<double> times = {25.0, 1000.0};
131  desc.add<std::string>("DetectorName", "HGCalEESensitive");
132  desc.add<std::string>("CaloHitSource", "HGCHitsEE");
133  desc.add<std::vector<double> >("TimeSlices", times);
134  desc.addUntracked<int>("Verbosity", 0);
135  desc.addUntracked<bool>("TestNumber", true);
136  desc.addUntracked<bool>("fromDDD", true);
137  descriptions.add("hgcalSimHitValidationEE", desc);
138 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ fillHitsInfo()

void HGCalSimHitValidation::fillHitsInfo ( std::pair< hitsinfo, energysum hit_,
unsigned int  itimeslice,
double  esum 
)
private

Definition at line 311 of file HGCalSimHitValidation.cc.

311  {
312  unsigned int ilayer = hits.first.layer;
313  if (ilayer < layers_) {
314  energy_[itimeslice].at(ilayer)->Fill(esum);
315  if (itimeslice == 0) {
316  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
317  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
318  }
319  } else {
320  if (verbosity_ > 0)
321  edm::LogVerbatim("HGCalValidation")
322  << "Problematic Hit for " << nameDetector_ << " at sector " << hits.first.sector << ":" << hits.first.sector2
323  << " layer " << hits.first.layer << " cell " << hits.first.cell << ":" << hits.first.cell2 << " energy "
324  << hits.second.etotal;
325  }
326 }

References energy_, EtaPhi_Minus_, EtaPhi_Plus_, hfClusterShapes_cfi::hits, layers_, nameDetector_, and verbosity_.

Referenced by analyzeHits().

◆ fillOccupancyMap()

void HGCalSimHitValidation::fillOccupancyMap ( std::map< int, int > &  OccupancyMap,
int  layer 
)
private

Definition at line 303 of file HGCalSimHitValidation.cc.

303  {
304  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
305  ++OccupancyMap[layer];
306  } else {
307  OccupancyMap[layer] = 1;
308  }
309 }

References phase1PixelTopology::layer.

Referenced by analyzeHits().

Member Data Documentation

◆ caloHitSource_

const std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 88 of file HGCalSimHitValidation.cc.

◆ energy_

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

Definition at line 107 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ EtaPhi_Minus_

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

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ EtaPhi_Plus_

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

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ firstLayer_

int HGCalSimHitValidation::firstLayer_
private

Definition at line 100 of file HGCalSimHitValidation.cc.

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

◆ fromDDD_

const bool HGCalSimHitValidation::fromDDD_
private

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

◆ hgcons_

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 89 of file HGCalSimHitValidation.cc.

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

◆ HitOccupancy_Minus_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ HitOccupancy_Plus_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ layers_

unsigned int HGCalSimHitValidation::layers_
private

Definition at line 99 of file HGCalSimHitValidation.cc.

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

◆ maxTime_

const unsigned int HGCalSimHitValidation::maxTime_ = 6
staticprivate

Definition at line 106 of file HGCalSimHitValidation.cc.

◆ MeanHitOccupancy_Minus_

MonitorElement * HGCalSimHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

◆ MeanHitOccupancy_Plus_

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

◆ nameDetector_

const std::string HGCalSimHitValidation::nameDetector_
private

◆ nTimes_

unsigned int HGCalSimHitValidation::nTimes_
private

Definition at line 108 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ symmDet_

bool HGCalSimHitValidation::symmDet_
private

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by defineGeometry().

◆ times_

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

Definition at line 90 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits().

◆ tok_cpv_

const edm::ESGetToken<DDCompactView, IdealGeometryRecord> HGCalSimHitValidation::tok_cpv_
private

Definition at line 94 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

◆ tok_cpvc_

const edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord> HGCalSimHitValidation::tok_cpvc_
private

Definition at line 95 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

◆ tok_hepMC_

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

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by analyze().

◆ tok_hgcal_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalSimHitValidation::tok_hgcal_
private

Definition at line 93 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

◆ tok_hits_

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

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyze().

◆ transMap_

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

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by defineGeometry().

◆ verbosity_

const int HGCalSimHitValidation::verbosity_
private
HGCalSimHitValidation::HitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Plus_
Definition: HGCalSimHitValidation.cc:103
DDAxes::y
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:58
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ForwardEmpty
Definition: ForwardSubdetector.h:5
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
HGCalSimHitValidation::nTimes_
unsigned int nTimes_
Definition: HGCalSimHitValidation.cc:108
HGCalDDDConstants::firstLayer
int firstLayer() const
Definition: HGCalDDDConstants.h:53
HGCalDDDConstants::locateCellTrap
std::pair< float, float > locateCellTrap(int lay, int ieta, int iphi, bool reco) const
Definition: HGCalDDDConstants.cc:734
HGCalSimHitValidation::MeanHitOccupancy_Plus_
MonitorElement * MeanHitOccupancy_Plus_
Definition: HGCalSimHitValidation.cc:105
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
HGCalDDDConstants::geomMode
HGCalGeometryMode::GeometryMode geomMode() const
Definition: HGCalDDDConstants.h:54
HGCalSimHitValidation::tok_cpvc_
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > tok_cpvc_
Definition: HGCalSimHitValidation.cc:95
HGCalSimHitValidation::hgcons_
const HGCalDDDConstants * hgcons_
Definition: HGCalSimHitValidation.cc:89
HGCalSimHitValidation::layers_
unsigned int layers_
Definition: HGCalSimHitValidation.cc:99
HGCalTestNumbering::unpackHexagonIndex
static void unpackHexagonIndex(const uint32_t &idx, int &subdet, int &z, int &lay, int &wafer, int &celltyp, int &cell)
Definition: HGCalTestNumbering.cc:46
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1412
HGCalSimHitValidation::analyzeHits
void analyzeHits(std::vector< PCaloHit > &hits)
Definition: HGCalSimHitValidation.cc:172
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HGCalDDDConstants::waferHexagon8
bool waferHexagon8() const
Definition: HGCalDDDConstants.h:143
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
protons_cff.time
time
Definition: protons_cff.py:35
hinfo
Definition: TauTagValidation.h:55
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
cms::DDFilteredView
Definition: DDFilteredView.h:70
edm::Handle< edm::HepMCProduct >
HGCalSimHitValidation::nameDetector_
const std::string nameDetector_
Definition: HGCalSimHitValidation.cc:88
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
HGCalSimHitValidation::transMap_
std::map< uint32_t, HepGeom::Transform3D > transMap_
Definition: HGCalSimHitValidation.cc:101
HGCScintillatorDetId::layer
int layer() const
get the layer #
Definition: HGCScintillatorDetId.h:50
HGCalSimHitValidation::defineGeometry
bool defineGeometry(const DDCompactView *ddViewH)
Definition: HGCalSimHitValidation.cc:328
cms::DDFilter
Definition: DDFilteredView.h:59
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HGCalTestNumbering::packSquareIndex
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
Definition: HGCalTestNumbering.cc:5
PVValHelper::eta
Definition: PVValidationHelpers.h:70
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
HGCalSimHitValidation::firstLayer_
int firstLayer_
Definition: HGCalSimHitValidation.cc:100
DDBase::name
const N & name() const
Definition: DDBase.h:59
DDAxes::z
HGCScintillatorDetId::ietaAbs
int ietaAbs() const
Definition: HGCScintillatorDetId.h:56
HGCalSimHitValidation::fillHitsInfo
void fillHitsInfo(std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
Definition: HGCalSimHitValidation.cc:311
HGCalGeometryMode::Square
Definition: HGCalGeometryMode.h:26
HGCalSimHitValidation::energy_
std::vector< MonitorElement * > energy_[maxTime_]
Definition: HGCalSimHitValidation.cc:107
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
dqmdumpme.k
k
Definition: dqmdumpme.py:60
HGCScintillatorDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCScintillatorDetId.h:47
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
HGCalSimHitValidation::EtaPhi_Plus_
std::vector< MonitorElement * > EtaPhi_Plus_
Definition: HGCalSimHitValidation.cc:104
geometryCSVtoXML.xy
xy
Definition: geometryCSVtoXML.py:19
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
HGCalDDDConstants::tileTrapezoid
bool tileTrapezoid() const
Definition: HGCalDDDConstants.h:113
DD3Vector
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
Definition: PGeometricDetBuilder.cc:20
funct::true
true
Definition: Factorize.h:173
DDTrap
Interface to a Trapezoid.
Definition: DDSolid.h:88
idealTransformation.rotation
dictionary rotation
Definition: idealTransformation.py:1
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HGCalSimHitValidation::verbosity_
const int verbosity_
Definition: HGCalSimHitValidation.cc:91
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
HGCalSimHitValidation::fillOccupancyMap
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
Definition: HGCalSimHitValidation.cc:303
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
HGCalDDDConstants::layers
unsigned int layers(bool reco) const
Definition: HGCalDDDConstants.cc:577
HGCalSimHitValidation::tok_hits_
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
Definition: HGCalSimHitValidation.cc:96
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
HGCScintillatorDetId::type
int type() const
get/set the type
Definition: HGCScintillatorDetId.h:43
hgcalTopologyTester_cfi.cell2
cell2
Definition: hgcalTopologyTester_cfi.py:12
HGCalSimHitValidation::MeanHitOccupancy_Minus_
MonitorElement * MeanHitOccupancy_Minus_
Definition: HGCalSimHitValidation.cc:105
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
HGCSiliconDetId::zside
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCSiliconDetId.h:54
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:94
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
HGCalDetId
Definition: HGCalDetId.h:8
HGCSiliconDetId::cellV
int cellV() const
Definition: HGCSiliconDetId.h:61
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
HGCSiliconDetId::cellU
int cellU() const
get the cell #'s in u,v or in x,y
Definition: HGCSiliconDetId.h:60
HGCalSimHitValidation::EtaPhi_Minus_
std::vector< MonitorElement * > EtaPhi_Minus_
Definition: HGCalSimHitValidation.cc:104
HGCalSimHitValidation::caloHitSource_
const std::string caloHitSource_
Definition: HGCalSimHitValidation.cc:88
DDValue
Definition: DDValue.h:22
HGCalSimHitValidation::HitOccupancy_Minus_
std::vector< MonitorElement * > HitOccupancy_Minus_
Definition: HGCalSimHitValidation.cc:103
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:23
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
dqm::implementation::IBooker::book2D
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
HGCalSimHitValidation::maxTime_
static const unsigned int maxTime_
Definition: HGCalSimHitValidation.cc:106
cms::DDCompactView
Definition: DDCompactView.h:31
HGCalSimHitValidation::times_
const std::vector< double > times_
Definition: HGCalSimHitValidation.cc:90
HGCalSimHitValidation::tok_cpv_
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > tok_cpv_
Definition: HGCalSimHitValidation.cc:94
HGCSiliconDetId::type
int type() const
get the type
Definition: HGCSiliconDetId.h:51
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
HGCSiliconDetId::waferU
int waferU() const
Definition: HGCSiliconDetId.h:76
DDSolid
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DDSpecificsMatchesValueFilter
Definition: DDFilter.h:70
HGCalSimHitValidation::tok_hepMC_
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
Definition: HGCalSimHitValidation.cc:97
DDFilteredView
Definition: DDFilteredView.h:20
HGCalSimHitValidation::tok_hgcal_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
Definition: HGCalSimHitValidation.cc:93
DDTrap::alpha1
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:147
pi
const Double_t pi
Definition: trackSplitPlot.h:36
DDName::fullname
const std::string fullname() const
Definition: DDName.h:43
HGCalDDDConstants::locateCell
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
Definition: HGCalDDDConstants.cc:596
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HGCalSimHitValidation::fromDDD_
const bool fromDDD_
Definition: HGCalSimHitValidation.cc:92
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
edm::InputTag
Definition: InputTag.h:15
HGCSiliconDetId::waferV
int waferV() const
Definition: HGCSiliconDetId.h:77
HGCalSimHitValidation::symmDet_
bool symmDet_
Definition: HGCalSimHitValidation.cc:98
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
HGCSiliconDetId::layer
int layer() const
get the layer #
Definition: HGCSiliconDetId.h:57