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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  energysum
 
struct  hitsinfo
 

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected 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
 

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
 

Detailed Description

Definition at line 54 of file HGCalSimHitValidation.cc.

Constructor & Destructor Documentation

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

Definition at line 112 of file HGCalSimHitValidation.cc.

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

112  :
113  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
114  caloHitSource_(iConfig.getParameter<std::string>("CaloHitSource")),
115  times_(iConfig.getParameter<std::vector<double> >("TimeSlices")),
116  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)),
117  testNumber_(iConfig.getUntrackedParameter<bool>("TestNumber",true)),
118  symmDet_(true), firstLayer_(1) {
119 
120  heRebuild_ = (nameDetector_ == "HCal") ? true : false;
121  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
122  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",caloHitSource_));
123  nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size();
124 }
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 137 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(), gen::k, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), HcalHitRelabeller::relabel(), HcalDetId::subdet(), testNumber_, tok_hepMC_, tok_hits_, and verbosity_.

Referenced by ~HGCalSimHitValidation().

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

Definition at line 188 of file HGCalSimHitValidation.cc.

References HGCalSimHitValidation::hitsinfo::cell, HGCalSimHitValidation::hitsinfo::cell2, HGCSiliconDetId::cellU(), HGCSiliconDetId::cellV(), funct::cos(), TauDecayModes::dec, HcalDetId::depth(), 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(), gen::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().

188  {
189 
190  std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
191  OccupancyMap_plus.clear(); OccupancyMap_minus.clear();
192 
193  std::map<uint32_t,std::pair<hitsinfo,energysum> > map_hits;
194  map_hits.clear();
195 
196  if (verbosity_ > 0)
197  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
198  << hits.size() << " PcaloHit elements";
199  unsigned int nused(0);
200  for (unsigned int i=0; i<hits.size(); i++) {
201  double energy = hits[i].energy();
202  double time = hits[i].time();
203  uint32_t id_ = hits[i].id();
204  int cell, sector, subsector(0), layer, zside;
205  int subdet(0), cell2(0), type(0);
206  if (heRebuild_) {
207  HcalDetId detId = HcalDetId(id_);
208  subdet = detId.subdet();
209  if (subdet != static_cast<int>(HcalEndcap)) continue;
210  cell = detId.ietaAbs();
211  sector = detId.iphi();
212  subsector = 1;
213  layer = detId.depth();
214  zside = detId.zside();
215  } else if ((hgcons_->geomMode() == HGCalGeometryMode::Hexagon8) ||
217  HGCSiliconDetId detId = HGCSiliconDetId(id_);
218  subdet = ForwardEmpty;
219  cell = detId.cellU();
220  cell2 = detId.cellV();
221  sector = detId.waferU();
222  subsector = detId.waferV();
223  type = detId.type();
224  layer = detId.layer();
225  zside = detId.zside();
226  } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
227  HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell);
228  } else if (hgcons_->geomMode() == HGCalGeometryMode::Trapezoid) {
230  subdet = ForwardEmpty;
231  sector = detId.ietaAbs();
232  cell = detId.iphi();
233  subsector = 1;
234  type = detId.type();
235  layer = detId.layer();
236  zside = detId.zside();
237  } else {
238  HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, type, cell);
239  }
240  nused++;
241  if (verbosity_>1)
242  edm::LogVerbatim("HGCalValidation") << "Detector " << nameDetector_
243  << " zside = " << zside
244  << " sector|wafer = " << sector
245  << ":" << subsector
246  << " type = " << type
247  << " layer = " << layer
248  << " cell = " << cell
249  << ":" << cell2
250  << " energy = " << energy
251  << " energyem = " << hits[i].energyEM()
252  << " energyhad = " << hits[i].energyHad()
253  << " time = " << time;
254 
255  HepGeom::Point3D<float> gcoord;
256  if (heRebuild_) {
257  std::pair<double,double> etaphi = hcons_->getEtaPhi(subdet,zside*cell,
258  sector);
259  double rz = hcons_->getRZ(subdet,zside*cell,layer);
260  if (verbosity_>2)
261  edm::LogVerbatim("HGCalValidation") << "i/p " << subdet << ":"
262  << zside << ":" << cell << ":"
263  << sector << ":" << layer <<" o/p "
264  << etaphi.first << ":"
265  << etaphi.second << ":" << rz;
266  gcoord = HepGeom::Point3D<float>(rz*cos(etaphi.second)/cosh(etaphi.first),
267  rz*sin(etaphi.second)/cosh(etaphi.first),
268  rz*tanh(etaphi.first));
269  } else if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
270  std::pair<float,float> xy = hgcons_->locateCell(cell,layer,subsector,false);
271  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
272  int subs = (symmDet_ ? 0 : subsector);
273  id_ = HGCalTestNumbering::packSquareIndex(zside,layer,sector,subs,0);
274  gcoord = (transMap_[id_]*lcoord);
275  } else {
276  std::pair<float,float> xy;
279  xy = hgcons_->locateCell(layer,sector,subsector,cell,cell2,false,true);
280  } else if (hgcons_->geomMode() == HGCalGeometryMode::Trapezoid) {
281  xy = hgcons_->locateCellTrap(layer,sector,cell,false);
282  } else {
283  xy = hgcons_->locateCell(cell,layer,sector,false);
284  }
285  double zp = hgcons_->waferZ(layer,false);
286  if (zside < 0) zp = -zp;
287  float xp = (zp < 0) ? -xy.first : xy.first;
288  gcoord = HepGeom::Point3D<float>(xp,xy.second,zp);
289  }
290  double tof = (gcoord.mag()*CLHEP::mm)/CLHEP::c_light;
291  if (verbosity_>1)
292  edm::LogVerbatim("HGCalValidation") << std::hex << id_ << std::dec
293  << " global coordinate " << gcoord
294  << " time " << time << ":" << tof;
295  time -= tof;
296 
297  energysum esum;
298  hitsinfo hinfo;
299  if (map_hits.count(id_) != 0) {
300  hinfo = map_hits[id_].first;
301  esum = map_hits[id_].second;
302  } else {
303  hinfo.x = gcoord.x();
304  hinfo.y = gcoord.y();
305  hinfo.z = gcoord.z();
306  hinfo.sector = sector;
307  hinfo.sector2= subsector;
308  hinfo.cell = cell;
309  hinfo.cell2 = cell;
310  hinfo.type = type;
311  hinfo.layer = layer-firstLayer_;
312  hinfo.phi = gcoord.getPhi();
313  hinfo.eta = gcoord.getEta();
314  }
315  esum.etotal += energy;
316  for (unsigned int k=0; k<nTimes_; ++k) {
317  if (time > 0 && time < times_[k]) esum.eTime[k] += energy;
318  }
319 
320  if (verbosity_>1)
321  edm::LogVerbatim("HGCalValidation") << " ----------------------- gx = "
322  << hinfo.x << " gy = " << hinfo.y
323  << " gz = " << hinfo.z << " phi = "
324  << hinfo.phi << " eta = "
325  << hinfo.eta;
326  map_hits[id_] = std::pair<hitsinfo,energysum>(hinfo,esum);
327  }
328  if (verbosity_>0)
329  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with "
330  << map_hits.size()
331  << " detector elements being hit";
332 
333  std::map<uint32_t,std::pair<hitsinfo,energysum> >::iterator itr;
334  for (itr = map_hits.begin() ; itr != map_hits.end(); ++itr) {
335  hitsinfo hinfo = (*itr).second.first;
336  energysum esum = (*itr).second.second;
337  int layer = hinfo.layer;
338  double eta = hinfo.eta;
339 
340  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++ ) {
341  fillHitsInfo((*itr).second, itimeslice, esum.eTime[itimeslice]);
342  }
343 
344  if (eta > 0.0) fillOccupancyMap(OccupancyMap_plus, layer);
345  else fillOccupancyMap(OccupancyMap_minus,layer);
346  }
347  if (verbosity_ > 0)
348  edm::LogVerbatim("HGCalValidation") << "With map:used:total "
349  << hits.size() << "|" << nused << "|"
350  << map_hits.size() << " hits";
351 
352  for (auto const & itr : OccupancyMap_plus) {
353  int layer = itr.first;
354  int occupancy = itr.second;
355  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
356  }
357  for (auto const & itr : OccupancyMap_minus) {
358  int layer = itr.first;
359  int occupancy = itr.second;
360  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
361  }
362 }
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:146
std::vector< MonitorElement * > HitOccupancy_Plus_
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:149
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:166
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
std::pair< T, T > etaphi(T x, T y, T z)
Definition: FastMath.h:128
int iphi() const
get the phi index
HGCalGeometryMode::GeometryMode geomMode() const
double waferZ(int layer, bool reco) const
int k[5][pyjets_maxn]
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.h:154
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
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 &   
)
overrideprotected

Definition at line 475 of file HGCalSimHitValidation.cc.

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

Referenced by ~HGCalSimHitValidation().

477  {
478 
479  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/"+nameDetector_);
480 
481  std::ostringstream histoname;
482  for (unsigned int il=0; il < layers_; ++il) {
483  int ilayer = firstLayer_ + (int)(il);
484  histoname.str(""); histoname << "HitOccupancy_Plus_layer_" << ilayer;
485  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
486  histoname.str(""); histoname << "HitOccupancy_Minus_layer_" << ilayer;
487  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
488 
489  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
490  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
491  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
492  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
493 
494  for (unsigned int itimeslice = 0; itimeslice < nTimes_ ; itimeslice++ ) {
495  histoname.str(""); histoname << "energy_time_"<< itimeslice << "_layer_" << ilayer;
496  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.1));
497  }
498  }
499 
500  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
501  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
502 }
MonitorElement * MeanHitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Minus_
MonitorElement * MeanHitOccupancy_Minus_
const Double_t pi
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::vector< MonitorElement * > EtaPhi_Plus_
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::vector< MonitorElement * > energy_[maxTime_]
std::vector< MonitorElement * > EtaPhi_Minus_
bool HGCalSimHitValidation::defineGeometry ( edm::ESTransientHandle< DDCompactView > &  ddViewH)
private

Definition at line 396 of file HGCalSimHitValidation.cc.

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

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

396  {
397  if (verbosity_>0)
398  edm::LogVerbatim("HGCalValidation") << "Initialize HGCalDDDConstants for "
399  << nameDetector_ << " : " << hgcons_;
400 
401  if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
402  const DDCompactView & cview = *ddViewH;
403  std::string attribute = "Volume";
405 
406  DDSpecificsMatchesValueFilter filter{DDValue(attribute, value, 0)};
407  DDFilteredView fv(cview,filter);
408  bool dodet = fv.firstChild();
409 
410  while (dodet) {
411  const DDSolid & sol = fv.logicalPart().solid();
412  const std::string & name = sol.name().fullname();
413  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
414  if (isd > 0) {
415  std::vector<int> copy = fv.copyNumbers();
416  int nsiz = (int)(copy.size());
417  int lay = (nsiz > 0) ? copy[nsiz-1] : -1;
418  int sec = (nsiz > 1) ? copy[nsiz-2] : -1;
419  int zp = (nsiz > 3) ? copy[nsiz-4] : -1;
420  if (zp !=1 ) zp = -1;
421  const DDTrap & trp = static_cast<DDTrap>(sol);
422  int subs = (trp.alpha1()>0 ? 1 : 0);
423  symmDet_ = (trp.alpha1()==0 ? true : false);
424  uint32_t id = HGCalTestNumbering::packSquareIndex(zp,lay,sec,subs,0);
425  DD3Vector x, y, z;
426  fv.rotation().GetComponents( x, y, z ) ;
427  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
428  x.Y(), y.Y(), z.Y(),
429  x.Z(), y.Z(), z.Z() );
430  const CLHEP::HepRotation hr ( rotation );
431  const CLHEP::Hep3Vector h3v ( fv.translation().X(),
432  fv.translation().Y(),
433  fv.translation().Z() ) ;
434  const HepGeom::Transform3D ht3d (hr, h3v);
435  transMap_.insert(std::make_pair(id,ht3d));
436  if (verbosity_>2)
437  edm::LogVerbatim("HGCalValidation") << HGCalDetId(id)
438  << " Transform using " << h3v
439  << " and " << hr;
440  }
441  dodet = fv.next();
442  }
443  if (verbosity_>0)
444  edm::LogVerbatim("HGCalValidation") << "Finds " << transMap_.size()
445  << " elements and SymmDet_ = "
446  << symmDet_;
447  }
448  return true;
449 }
const N & name() const
Definition: DDBase.h:74
def copy(args, dbName)
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:43
Interface to a Trapezoid.
Definition: DDSolid.h:78
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:177
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 452 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().

453  {
454  if (heRebuild_) {
456  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
457  hcons_ = &(*pHRNDC);
458  layers_ = hcons_->getMaxDepth(1);
459  } else {
461  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
462  hgcons_ = &(*pHGDC);
463  layers_ = hgcons_->layers(false);
466  iSetup.get<IdealGeometryRecord>().get( pDD );
467  defineGeometry(pDD);
468  }
469  if (verbosity_>0)
470  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with "
471  << layers_ << " Layers with first at "
472  << firstLayer_;
473 }
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:71
const HGCalDDDConstants * hgcons_
int firstLayer() const
void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 126 of file HGCalSimHitValidation.cc.

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

Referenced by ~HGCalSimHitValidation().

126  {
128  std::vector<double> times = {25.0,1000.0};
129  desc.add<std::string>("DetectorName","HGCalEESensitive");
130  desc.add<std::string>("CaloHitSource","HGCHitsEE");
131  desc.add<std::vector<double> >("TimeSlices",times);
132  desc.addUntracked<int>("Verbosity",0);
133  desc.addUntracked<bool>("TestNumber",true);
134  descriptions.add("hgcalSimHitValidationEE",desc);
135 }
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 373 of file HGCalSimHitValidation.cc.

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

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

374  {
375 
376  unsigned int ilayer = hits.first.layer;
377  if (ilayer < layers_) {
378  energy_[itimeslice].at(ilayer)->Fill(esum);
379  if (itimeslice==0) {
380  EtaPhi_Plus_.at(ilayer) ->Fill(hits.first.eta , hits.first.phi);
381  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
382  }
383  } else {
384  if (verbosity_>0)
385  edm::LogVerbatim("HGCalValidation") << "Problematic Hit for "
386  << nameDetector_ << " at sector "
387  << hits.first.sector << ":"
388  << hits.first.sector2 << " layer "
389  << hits.first.layer << " cell "
390  << hits.first.cell << ":"
391  << hits.first.cell2 << " energy "
392  << hits.second.etotal;
393  }
394 }
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 364 of file HGCalSimHitValidation.cc.

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

365  {
366  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
367  ++OccupancyMap[layer];
368  } else {
369  OccupancyMap[layer] = 1;
370  }
371 }

Member Data Documentation

std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by HGCalSimHitValidation().

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

Definition at line 108 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

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

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

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

Definition at line 105 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

int HGCalSimHitValidation::firstLayer_
private

Definition at line 101 of file HGCalSimHitValidation.cc.

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

const HcalDDDRecConstants* HGCalSimHitValidation::hcons_
private

Definition at line 94 of file HGCalSimHitValidation.cc.

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

bool HGCalSimHitValidation::heRebuild_
private

Definition at line 97 of file HGCalSimHitValidation.cc.

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

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 93 of file HGCalSimHitValidation.cc.

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

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

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

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

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

unsigned int HGCalSimHitValidation::layers_
private

Definition at line 100 of file HGCalSimHitValidation.cc.

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

const unsigned int HGCalSimHitValidation::maxTime_ =6
staticprivate

Definition at line 107 of file HGCalSimHitValidation.cc.

Referenced by HGCalSimHitValidation().

MonitorElement * HGCalSimHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 106 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 106 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

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

Definition at line 109 of file HGCalSimHitValidation.cc.

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

bool HGCalSimHitValidation::symmDet_
private

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and defineGeometry().

bool HGCalSimHitValidation::testNumber_
private

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by analyze().

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

Definition at line 95 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and HGCalSimHitValidation().

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

Definition at line 99 of file HGCalSimHitValidation.cc.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 102 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and defineGeometry().

int HGCalSimHitValidation::verbosity_
private