CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (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 DDCompactView *ddViewH)
 
bool defineGeometry (const cms::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,
IdealGeometryRecord
tok_cpv_
 
const edm::ESGetToken
< cms::DDCompactView,
IdealGeometryRecord
tok_cpvc_
 
edm::EDGetTokenT
< edm::HepMCProduct
tok_hepMC_
 
const edm::ESGetToken
< HGCalDDDConstants,
IdealGeometryRecord
tok_hgcal_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 111 of file HGCalSimHitValidation.cc.

References nameDetector_.

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 }
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< double > times_
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
const std::string nameDetector_
static const unsigned int maxTime_
const std::string caloHitSource_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > tok_cpvc_
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > tok_cpv_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
HGCalSimHitValidation::~HGCalSimHitValidation ( )
inlineoverride

Definition at line 71 of file HGCalSimHitValidation.cc.

71 {}

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 140 of file HGCalSimHitValidation.cc.

References analyzeHits(), edm::Event::getByToken(), edm::HandleBase::isValid(), isotrackApplyRegressor::k, AlCaHLTBitMon_ParallelJobs::p, tok_hepMC_, and verbosity_.

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 }
Log< level::Info, true > LogVerbatim
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
void analyzeHits(std::vector< PCaloHit > &hits)
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
void HGCalSimHitValidation::analyzeHits ( std::vector< PCaloHit > &  hits)
private

Definition at line 172 of file HGCalSimHitValidation.cc.

References HGCalSimHitValidation::hitsinfo::cell, HGCalSimHitValidation::hitsinfo::cell2, HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), TauDecayModes::dec, relval_parameters_module::energy, HGCalSimHitValidation::hitsinfo::eta, PVValHelper::eta, HGCalSimHitValidation::energysum::eTime, HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillOccupancyMap(), firstLayer_, hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, mps_fire::i, HGCScintillatorDetId::ietaAbs(), HGCScintillatorDetId::iphi(), isotrackApplyRegressor::k, HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), HGCalSimHitValidation::hitsinfo::layer, phase1PixelTopology::layer, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), nameDetector_, nTimes_, HGCalSimHitValidation::hitsinfo::phi, HGCalSimHitValidation::hitsinfo::sector, HGCalSimHitValidation::hitsinfo::sector2, HGCalDDDConstants::tileTrapezoid(), times_, HGCScintillatorDetId::type(), HGCSiliconDetId::type(), HGCalSimHitValidation::hitsinfo::type, HGCalTestNumbering::unpackHexagonIndex(), verbosity_, HGCalDDDConstants::waferHexagon8(), HGCSiliconDetId::waferU(), HGCSiliconDetId::waferV(), HGCalDDDConstants::waferZ(), HGCalSimHitValidation::hitsinfo::x, xy(), HGCalSimHitValidation::hitsinfo::y, HGCalSimHitValidation::hitsinfo::z, HGCScintillatorDetId::zside(), HGCSiliconDetId::zside(), and ecaldqm::zside().

Referenced by analyze().

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

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().

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

Definition at line 327 of file HGCalSimHitValidation.cc.

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

Referenced by dqmBeginRun().

327  {
328  if (verbosity_ > 0)
329  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalDDDConstants (DDD) for " << nameDetector_ << " : "
330  << hgcons_;
331 
332  if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
333  const DDCompactView& cview = *ddViewH;
334  std::string attribute = "Volume";
336 
337  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0)};
338  DDFilteredView fv(cview, filter);
339  bool dodet = fv.firstChild();
340 
341  while (dodet) {
342  const DDSolid& sol = fv.logicalPart().solid();
343  const std::string& name = sol.name().fullname();
344  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
345  if (isd > 0) {
346  std::vector<int> copy = fv.copyNumbers();
347  int nsiz = static_cast<int>(copy.size());
348  int lay = (nsiz > 0) ? copy[nsiz - 1] : -1;
349  int sec = (nsiz > 1) ? copy[nsiz - 2] : -1;
350  int zp = (nsiz > 3) ? copy[nsiz - 4] : -1;
351  if (zp != 1)
352  zp = -1;
353  const DDTrap& trp = static_cast<DDTrap>(sol);
354  int subs = (trp.alpha1() > 0 ? 1 : 0);
355  symmDet_ = (trp.alpha1() == 0 ? true : false);
356  uint32_t id = HGCalTestNumbering::packSquareIndex(zp, lay, sec, subs, 0);
357  DD3Vector x, y, z;
358  fv.rotation().GetComponents(x, y, z);
359  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
360  const CLHEP::HepRotation hr(rotation);
361  const CLHEP::Hep3Vector h3v(fv.translation().X(), fv.translation().Y(), fv.translation().Z());
362  const HepGeom::Transform3D ht3d(hr, h3v);
363  transMap_.insert(std::make_pair(id, ht3d));
364  if (verbosity_ > 2)
365  edm::LogVerbatim("HGCalValidation") << HGCalDetId(id) << " Transform using " << h3v << " and " << hr;
366  }
367  dodet = fv.next();
368  }
369  if (verbosity_ > 0)
370  edm::LogVerbatim("HGCalValidation") << "Finds " << transMap_.size() << " elements and SymmDet_ = " << symmDet_;
371  }
372  return true;
373 }
Log< level::Info, true > LogVerbatim
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double >> DD3Vector
const N & name() const
Definition: DDBase.h:59
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
const std::string nameDetector_
const std::string fullname() const
Definition: DDName.h:43
Interface to a Trapezoid.
Definition: DDSolid.h:88
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
std::map< uint32_t, HepGeom::Transform3D > transMap_
const HGCalDDDConstants * hgcons_
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
bool HGCalSimHitValidation::defineGeometry ( const cms::DDCompactView ddViewH)
private

Definition at line 375 of file HGCalSimHitValidation.cc.

References filterCSVwithJSON::copy, cms::DDFilteredView::copyNos(), alcazmumu_cfi::filter, cms::DDFilteredView::firstChild(), hgcons_, mergeVDriftHistosByStation::name, cms::DDFilteredView::name(), nameDetector_, HGCalTestNumbering::packSquareIndex(), cms::DDFilteredView::parameters(), idealTransformation::rotation, cms::DDFilteredView::rotation(), HGCalGeometryMode::Square, symmDet_, cms::DDFilteredView::translation(), transMap_, verbosity_, x, y, and z.

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

Reimplemented from DQMEDAnalyzer.

Definition at line 418 of file HGCalSimHitValidation.cc.

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

418  {
419  hgcons_ = &iSetup.getData(tok_hgcal_);
420  layers_ = hgcons_->layers(false);
422  if (fromDDD_) {
423  const DDCompactView* pDD = &iSetup.getData(tok_cpv_);
424  defineGeometry(pDD);
425  } else {
426  const cms::DDCompactView* pDD = &iSetup.getData(tok_cpvc_);
427  defineGeometry(pDD);
428  }
429  if (verbosity_ > 0)
430  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at "
431  << firstLayer_;
432 }
Log< level::Info, true > LogVerbatim
bool defineGeometry(const DDCompactView *ddViewH)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const std::string nameDetector_
unsigned int layers(bool reco) const
const edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > tok_cpvc_
const HGCalDDDConstants * hgcons_
int firstLayer() const
const edm::ESGetToken< DDCompactView, IdealGeometryRecord > tok_cpv_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_
void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 128 of file HGCalSimHitValidation.cc.

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

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 }
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 310 of file HGCalSimHitValidation.cc.

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

Referenced by analyzeHits().

310  {
311  unsigned int ilayer = hits.first.layer;
312  if (ilayer < layers_) {
313  energy_[itimeslice].at(ilayer)->Fill(esum);
314  if (itimeslice == 0) {
315  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
316  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
317  }
318  } else {
319  if (verbosity_ > 0)
320  edm::LogVerbatim("HGCalValidation")
321  << "Problematic Hit for " << nameDetector_ << " at sector " << hits.first.sector << ":" << hits.first.sector2
322  << " layer " << hits.first.layer << " cell " << hits.first.cell << ":" << hits.first.cell2 << " energy "
323  << hits.second.etotal;
324  }
325 }
Log< level::Info, true > LogVerbatim
const std::string nameDetector_
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 302 of file HGCalSimHitValidation.cc.

References phase1PixelTopology::layer.

Referenced by analyzeHits().

302  {
303  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
304  ++OccupancyMap[layer];
305  } else {
306  OccupancyMap[layer] = 1;
307  }
308 }
constexpr std::array< uint8_t, layerIndexSize > layer

Member Data Documentation

const std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 88 of file HGCalSimHitValidation.cc.

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 bool HGCalSimHitValidation::fromDDD_
private

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 89 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.

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().

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

Definition at line 108 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

bool HGCalSimHitValidation::symmDet_
private

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by defineGeometry().

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

Definition at line 90 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits().

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

Definition at line 94 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

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

Definition at line 95 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

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

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by analyze().

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

Definition at line 93 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

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

Definition at line 96 of file HGCalSimHitValidation.cc.

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

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by defineGeometry().

const int HGCalSimHitValidation::verbosity_
private