CMS 3D CMS Logo

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

Classes

struct  energysum
 
struct  hitsinfo
 

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

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

Private Attributes

std::string caloHitSource_
 
std::vector< MonitorElement * > energy_ [6]
 
std::vector< MonitorElement * > EtaPhi_Minus_
 
std::vector< MonitorElement * > EtaPhi_Plus_
 
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_
 

Additional Inherited Members

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

Detailed Description

Definition at line 54 of file HGCalSimHitValidation.cc.

Constructor & Destructor Documentation

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

Definition at line 110 of file HGCalSimHitValidation.cc.

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

110  :
111  nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
112  caloHitSource_(iConfig.getParameter<std::string>("CaloHitSource")),
113  times_(iConfig.getParameter<std::vector<double> >("TimeSlices")),
114  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity",0)),
115  testNumber_(iConfig.getUntrackedParameter<bool>("TestNumber",true)),
116  symmDet_(true) {
117 
118  heRebuild_ = (nameDetector_ == "HCal") ? true : false;
119  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"));
120  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",caloHitSource_));
121  nTimes_ = (times_.size() > 6) ? 6 : times_.size();
122 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
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 135 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().

136  {
137 
138  //Generator input
140  iEvent.getByToken(tok_hepMC_,evtMC);
141  if (!evtMC.isValid()) {
142  edm::LogVerbatim("HGCalValidation") << "no HepMCProduct found";
143  } else {
144  const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
145  unsigned int k(0);
146  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
147  p != myGenEvent->particles_end(); ++p, ++k) {
148  edm::LogVerbatim("HGCalValidation") << "Particle[" << k << "] with pt "
149  << (*p)->momentum().perp() << " eta "
150  << (*p)->momentum().eta() << " phi "
151  << (*p)->momentum().phi();
152  }
153  }
154 
155  //Now the hits
156  edm::Handle<edm::PCaloHitContainer> theCaloHitContainers;
157  iEvent.getByToken(tok_hits_, theCaloHitContainers);
158  if (theCaloHitContainers.isValid()) {
159  if (verbosity_>0)
160  edm::LogVerbatim("HGCalValidation") << " PcalohitItr = "
161  << theCaloHitContainers->size();
162  std::vector<PCaloHit> caloHits;
163  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
164  theCaloHitContainers->end());
165  if (heRebuild_ && testNumber_) {
166  for (unsigned int i=0; i<caloHits.size(); ++i) {
167  unsigned int id_ = caloHits[i].id();
169  if(hid.subdet()!=int(HcalEndcap)) hid = HcalDetId(HcalEmpty,hid.ieta(),hid.iphi(),hid.depth());
170  caloHits[i].setID(hid.rawId());
171  if (verbosity_>0)
172  edm::LogVerbatim("HGCalValidation") << "Hit[" << i << "] " << hid;
173  }
174  }
175  analyzeHits(caloHits);
176  } else if (verbosity_>0) {
177  edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!";
178  }
179 }
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 181 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(), 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().

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

Implements DQMEDAnalyzer.

Definition at line 462 of file HGCalSimHitValidation.cc.

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

Referenced by ~HGCalSimHitValidation().

464  {
465 
466  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/"+nameDetector_);
467 
468  std::ostringstream histoname;
469  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ) {
470  histoname.str(""); histoname << "HitOccupancy_Plus_layer_" << ilayer;
471  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
472  histoname.str(""); histoname << "HitOccupancy_Minus_layer_" << ilayer;
473  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
474 
475  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
476  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
477  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
478  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
479 
480  for (unsigned int itimeslice = 0; itimeslice < nTimes_ ; itimeslice++ ) {
481  histoname.str(""); histoname << "energy_time_"<< itimeslice << "_layer_" << ilayer;
482  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.1));
483  }
484  }
485 
486  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
487  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
488 }
MonitorElement * MeanHitOccupancy_Plus_
std::vector< MonitorElement * > energy_[6]
std::vector< MonitorElement * > HitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Minus_
MonitorElement * MeanHitOccupancy_Minus_
const Double_t pi
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
std::vector< MonitorElement * > EtaPhi_Plus_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
std::vector< MonitorElement * > EtaPhi_Minus_
bool HGCalSimHitValidation::defineGeometry ( edm::ESTransientHandle< DDCompactView > &  ddViewH)
private

Definition at line 385 of file HGCalSimHitValidation.cc.

References DDTrap::alpha1(), popcon2dropbox::copy(), DDFilteredView::copyNumbers(), ALCARECOTkAlBeamHalo_cff::filter, DDFilteredView::firstChild(), 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().

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

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

Referenced by ~HGCalSimHitValidation().

442  {
443  if (heRebuild_) {
445  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
446  hcons_ = &(*pHRNDC);
447  layers_ = hcons_->getMaxDepth(1);
448  } else {
450  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
451  hgcons_ = &(*pHGDC);
452  layers_ = hgcons_->layers(false);
454  iSetup.get<IdealGeometryRecord>().get( pDD );
455  defineGeometry(pDD);
456  }
457  if (verbosity_>0)
458  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with "
459  << layers_ << " Layers";
460 }
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:63
const HGCalDDDConstants * hgcons_
void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

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

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

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

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

363  {
364 
365  unsigned int ilayer = hits.first.layer - 1;
366  if (ilayer < layers_) {
367  energy_[itimeslice].at(ilayer)->Fill(esum);
368  if (itimeslice==0) {
369  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
370  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
371  }
372  } else {
373  if (verbosity_>0)
374  edm::LogVerbatim("HGCalValidation") << "Problematic Hit for "
375  << nameDetector_ << " at sector "
376  << hits.first.sector << ":"
377  << hits.first.sector2 << " layer "
378  << hits.first.layer << " cell "
379  << hits.first.cell << ":"
380  << hits.first.cell2 << " energy "
381  << hits.second.etotal;
382  }
383 }
std::vector< MonitorElement * > energy_[6]
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > EtaPhi_Minus_
void HGCalSimHitValidation::fillOccupancyMap ( std::map< int, int > &  OccupancyMap,
int  layer 
)
private

Definition at line 354 of file HGCalSimHitValidation.cc.

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

354  {
355  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
356  OccupancyMap[layer] ++;
357  } else {
358  OccupancyMap[layer] = 1;
359  }
360 }

Member Data Documentation

std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by HGCalSimHitValidation().

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

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

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

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

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 98 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 100 of file HGCalSimHitValidation.cc.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 99 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