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

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

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

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

472  {
473 
474  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/"+nameDetector_);
475 
476  std::ostringstream histoname;
477  for (unsigned int il=0; il < layers_; ++il) {
478  int ilayer = firstLayer_ + (int)(il);
479  histoname.str(""); histoname << "HitOccupancy_Plus_layer_" << ilayer;
480  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
481  histoname.str(""); histoname << "HitOccupancy_Minus_layer_" << ilayer;
482  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
483 
484  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
485  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
486  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
487  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
488 
489  for (unsigned int itimeslice = 0; itimeslice < nTimes_ ; itimeslice++ ) {
490  histoname.str(""); histoname << "energy_time_"<< itimeslice << "_layer_" << ilayer;
491  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.1));
492  }
493  }
494 
495  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
496  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
497 }
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 391 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().

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

448  {
449  if (heRebuild_) {
451  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
452  hcons_ = &(*pHRNDC);
453  layers_ = hcons_->getMaxDepth(1);
454  } else {
456  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
457  hgcons_ = &(*pHGDC);
458  layers_ = hgcons_->layers(false);
461  iSetup.get<IdealGeometryRecord>().get( pDD );
462  defineGeometry(pDD);
463  }
464  if (verbosity_>0)
465  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with "
466  << layers_ << " Layers with first at "
467  << firstLayer_;
468 }
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:62
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 368 of file HGCalSimHitValidation.cc.

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

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

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

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

360  {
361  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
362  ++OccupancyMap[layer];
363  } else {
364  OccupancyMap[layer] = 1;
365  }
366 }

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