test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
HGCalSimHitValidation Class Reference

#include <Validation/HGCalValidation/plugins/HGCalSimHitValidation.cc>

Inheritance diagram for HGCalSimHitValidation:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  energysum
 
struct  hitsinfo
 

Public Member Functions

 HGCalSimHitValidation (const edm::ParameterSet &)
 
 ~HGCalSimHitValidation ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & 
itemsToGetFromEvent () 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
 
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 DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
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::HepMCProduct
tok_hepMC_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_hits_
 
std::map< uint32_t,
HepGeom::Transform3D > 
transMap_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Detailed Description

Description: Validates SimHits of High Granularity Calorimeter Implementation: [Notes on implementation]

Definition at line 55 of file HGCalSimHitValidation.h.

Constructor & Destructor Documentation

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

Definition at line 39 of file HGCalSimHitValidation.cc.

References caloHitSource_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), heRebuild_, HLT_25ns10e33_v2_cff::InputTag, nameDetector_, nTimes_, AlCaHLTBitMon_QueryRunRegistry::string, testNumber_, times_, tok_hepMC_, tok_hits_, and verbosity_.

39  :
40  symmDet_(true) {
41 
42  nameDetector_ = iConfig.getParameter<std::string>("DetectorName");
43  caloHitSource_ = iConfig.getParameter<std::string>("CaloHitSource");
44  times_ = iConfig.getParameter<std::vector<double> >("TimeSlices");
45  verbosity_ = iConfig.getUntrackedParameter<int>("Verbosity",0);
46  testNumber_ = iConfig.getUntrackedParameter<bool>("TestNumber", true);
47  heRebuild_ = (nameDetector_ == "HCal") ? true : false;
48  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generator"));
49  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",caloHitSource_));
50  nTimes_ = (times_.size() > 6) ? 6 : times_.size();
51 }
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 ( )

Definition at line 53 of file HGCalSimHitValidation.cc.

53 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 55 of file HGCalSimHitValidation.cc.

References analyzeHits(), HLT_25ns10e33_v2_cff::depth, eta, edm::Event::getByToken(), HcalDDDRecConstants::getHCID(), HcalEmpty, HcalEndcap, hcons_, heRebuild_, i, edm::HandleBase::id(), edm::HandleBase::isValid(), relval_2017::k, AlCaHLTBitMon_ParallelJobs::p, phi, DetId::rawId(), jetcorrextractor::sign(), testNumber_, tok_hepMC_, tok_hits_, HcalTestNumbering::unpackHcalIndex(), verbosity_, and z.

56  {
57 
58  //Generator input
60  iEvent.getByToken(tok_hepMC_,evtMC);
61  if (!evtMC.isValid()) {
62  edm::LogWarning("HGCalValidation") << "no HepMCProduct found\n";
63  } else {
64  const HepMC::GenEvent * myGenEvent = evtMC->GetEvent();
65  unsigned int k(0);
66  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin();
67  p != myGenEvent->particles_end(); ++p, ++k) {
68  edm::LogInfo("HGCalValidation") << "Particle[" << k << "] with pt "
69  << (*p)->momentum().perp() << " eta "
70  << (*p)->momentum().eta() << " phi "
71  << (*p)->momentum().phi() << std::endl;
72  }
73  }
74 
75  //Now the hits
76  edm::Handle<edm::PCaloHitContainer> theCaloHitContainers;
77  iEvent.getByToken(tok_hits_, theCaloHitContainers);
78  if (theCaloHitContainers.isValid()) {
79  if (verbosity_>0)
80  edm::LogInfo("HGCalValidation") << " PcalohitItr = "
81  << theCaloHitContainers->size() << "\n";
82  std::vector<PCaloHit> caloHits;
83  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(),
84  theCaloHitContainers->end());
85  if (heRebuild_ && testNumber_) {
86  for (unsigned int i=0; i<caloHits.size(); ++i) {
87  unsigned int id_ = caloHits[i].id();
88  int subdet, z, depth0, eta0, phi0, lay;
89  HcalTestNumbering::unpackHcalIndex(id_, subdet, z, depth0, eta0, phi0, lay);
90  int sign = (z==0) ? (-1):(1);
91  if (verbosity_>0)
92  edm::LogInfo("HGCalValidation") << "Hit[" << i << "] subdet "
93  << subdet << " z " << z << " depth "
94  << depth0 << " eta " << eta0
95  << " phi " << phi0 << " lay " << lay
96  << std::endl;
97  HcalDDDRecConstants::HcalID id = hcons_->getHCID(subdet, eta0, phi0, lay, depth0);
98  HcalDetId hid = ((subdet==int(HcalEndcap)) ?
99  HcalDetId(HcalEndcap,sign*id.eta,id.phi,id.depth) :
100  HcalDetId(HcalEmpty,sign*id.eta,id.phi,id.depth));
101  caloHits[i].setID(hid.rawId());
102  if (verbosity_>0)
103  edm::LogInfo("HGCalValidation") << "Hit[" << i << "] " << hid <<"\n";
104  }
105  }
106  analyzeHits(caloHits);
107  } else if (verbosity_>0) {
108  edm::LogInfo("HGCalValidation") << "PCaloHitContainer does not exist !!!\n";
109  }
110 }
int i
Definition: DBlmapReader.cc:9
ProductID id() const
Definition: HandleBase.cc:15
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
double sign(double x)
void analyzeHits(std::vector< PCaloHit > &hits)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
const HcalDDDRecConstants * hcons_
HcalID getHCID(int subdet, int ieta, int iphi, int lay, int idepth) const
static void unpackHcalIndex(const uint32_t &idx, int &det, int &z, int &depth, int &eta, int &phi, int &lay)
bool isValid() const
Definition: HandleBase.h:75
edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
void HGCalSimHitValidation::analyzeHits ( std::vector< PCaloHit > &  hits)
private

Definition at line 112 of file HGCalSimHitValidation.cc.

References HGCalSimHitValidation::hitsinfo::cell, funct::cos(), TauDecayModes::dec, HcalDetId::depth(), relval_parameters_module::energy, eta, HGCalSimHitValidation::hitsinfo::eta, fastmath::etaphi(), HGCalSimHitValidation::energysum::eTime, HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillOccupancyMap(), HGCalDDDConstants::geomMode(), HcalDDDRecConstants::getEtaPhi(), HcalDDDRecConstants::getRZ(), HcalEndcap, hcons_, heRebuild_, hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, i, HcalDetId::ietaAbs(), HcalDetId::iphi(), relval_2017::k, HGCalSimHitValidation::hitsinfo::layer, HGCalDDDConstants::locateCell(), nameDetector_, nTimes_, HGCalTestNumbering::packSquareIndex(), HGCalSimHitValidation::hitsinfo::phi, HGCalSimHitValidation::hitsinfo::sector, funct::sin(), Square, HcalDetId::subdet(), symmDet_, times_, transMap_, HGCalTestNumbering::unpackHexagonIndex(), HGCalTestNumbering::unpackSquareIndex(), verbosity_, HGCalDDDConstants::waferZ(), HGCalSimHitValidation::hitsinfo::x, create_public_lumi_plots::xy, HGCalSimHitValidation::hitsinfo::y, HGCalSimHitValidation::hitsinfo::z, HcalDetId::zside(), and ecaldqm::zside().

Referenced by analyze().

112  {
113 
114  std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
115  OccupancyMap_plus.clear(); OccupancyMap_minus.clear();
116 
117  std::map<uint32_t,std::pair<hitsinfo,energysum> > map_hits;
118  map_hits.clear();
119 
120  if (verbosity_ > 0)
121  edm::LogInfo("HGCalValidation") << nameDetector_ << " with " << hits.size()
122  << " PcaloHit elements\n";
123  unsigned int nused(0);
124  for (unsigned int i=0; i<hits.size(); i++) {
125  double energy = hits[i].energy();
126  double time = hits[i].time();
127  uint32_t id_ = hits[i].id();
128  int cell, sector, subsector, layer, zside;
129  int subdet(0);
130  if (heRebuild_) {
131  HcalDetId detId = HcalDetId(id_);
132  subdet = detId.subdet();
133  if (subdet != static_cast<int>(HcalEndcap)) continue;
134  cell = detId.ietaAbs();
135  sector = detId.iphi();
136  subsector = 1;
137  layer = detId.depth();
138  zside = detId.zside();
139  } else {
141  HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell);
142  } else {
143  HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, subsector, cell);
144  }
145  }
146  nused++;
147  if (verbosity_>1)
148  edm::LogInfo("HGCalValidation") << "Detector " << nameDetector_
149  << " zside = " << zside
150  << " sector|wafer = " << sector
151  << " subsector|type = " << subsector
152  << " layer = " << layer
153  << " cell = " << cell
154  << " energy = " << energy
155  << " energyem = " << hits[i].energyEM()
156  << " energyhad = " << hits[i].energyHad()
157  << " time = " << time << "\n";
158 
159  HepGeom::Point3D<float> gcoord;
160  if (heRebuild_) {
161  std::pair<double,double> etaphi = hcons_->getEtaPhi(subdet,zside*cell,sector);
162  double rz = hcons_->getRZ(subdet,zside*cell,layer);
163 // std::cout << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz << std::endl;
164  gcoord = HepGeom::Point3D<float>(rz*cos(etaphi.second)/cosh(etaphi.first),
165  rz*sin(etaphi.second)/cosh(etaphi.first),
166  rz*tanh(etaphi.first));
167  } else {
169  std::pair<float,float> xy = hgcons_->locateCell(cell,layer,subsector,false);
170  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
171  int subs = (symmDet_ ? 0 : subsector);
172  id_ = HGCalTestNumbering::packSquareIndex(zside,layer,sector,subs,0);
173  gcoord = (transMap_[id_]*lcoord);
174  } else {
175  std::pair<float,float> xy = hgcons_->locateCell(cell,layer,sector,false);
176  double zp = hgcons_->waferZ(layer,false);
177  if (zside < 0) zp = -zp;
178  float xp = (zp < 0) ? -xy.first : xy.first;
179  gcoord = HepGeom::Point3D<float>(xp,xy.second,zp);
180  }
181  }
182  double tof = (gcoord.mag()*CLHEP::mm)/CLHEP::c_light;
183  if (verbosity_>1)
184  edm::LogInfo("HGCalValidation") << std::hex << id_ << std::dec
185  << " global coordinate " << gcoord
186  << " time " << time << ":" << tof <<"\n";
187  time -= tof;
188 
189  energysum esum;
190  hitsinfo hinfo;
191  if (map_hits.count(id_) != 0) {
192  hinfo = map_hits[id_].first;
193  esum = map_hits[id_].second;
194  } else {
195  hinfo.x = gcoord.x();
196  hinfo.y = gcoord.y();
197  hinfo.z = gcoord.z();
198  hinfo.sector = sector;
199  hinfo.cell = cell;
200  hinfo.layer = layer;
201  hinfo.phi = gcoord.getPhi();
202  hinfo.eta = gcoord.getEta();
203  }
204  esum.etotal += energy;
205  for (unsigned int k=0; k<nTimes_; ++k) {
206  if (time > 0 && time < times_[k]) esum.eTime[k] += energy;
207  }
208  if (verbosity_>1)
209  edm::LogInfo("HGCalValidation") << " -------------------------- gx = "
210  << hinfo.x << " gy = " << hinfo.y
211  << " gz = " << hinfo.z << " phi = "
212  << hinfo.phi << " eta = " << hinfo.eta
213  << std::endl;
214  map_hits[id_] = std::pair<hitsinfo,energysum>(hinfo,esum);
215  }
216  if (verbosity_>0)
217  edm::LogInfo("HGCalValidation") << nameDetector_ << " with "
218  << map_hits.size()
219  << " detector elements being hit\n";
220 
221  std::map<uint32_t,std::pair<hitsinfo,energysum> >::iterator itr;
222  for (itr = map_hits.begin() ; itr != map_hits.end(); ++itr) {
223  hitsinfo hinfo = (*itr).second.first;
224  energysum esum = (*itr).second.second;
225  int layer = hinfo.layer;
226 
227  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++ ) {
228  fillHitsInfo((*itr).second, itimeslice, esum.eTime[itimeslice]);
229  }
230 
231  double eta = hinfo.eta;
232 
233  if (eta > 0.0) fillOccupancyMap(OccupancyMap_plus, layer-1);
234  else fillOccupancyMap(OccupancyMap_minus, layer-1);
235  }
236  edm::LogInfo("HGCalValidation") << "With map:used:total " << hits.size()
237  << "|" << nused << "|" << map_hits.size()
238  << " hits\n";
239 
240  for (auto itr = OccupancyMap_plus.begin() ; itr != OccupancyMap_plus.end(); ++itr) {
241  int layer = (*itr).first;
242  int occupancy = (*itr).second;
243  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
244  }
245  for (auto itr = OccupancyMap_minus.begin() ; itr != OccupancyMap_minus.end(); ++itr) {
246  int layer = (*itr).first;
247  int occupancy = (*itr).second;
248  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
249  }
250 }
int i
Definition: DBlmapReader.cc:9
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
double getRZ(int subdet, int ieta, int depth) const
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
std::vector< MonitorElement * > HitOccupancy_Plus_
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:93
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
int zside(DetId const &)
std::vector< MonitorElement * > HitOccupancy_Minus_
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
const HcalDDDRecConstants * hcons_
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
HGCalGeometryMode geomMode() const
double waferZ(int layer, bool reco) const
int ietaAbs() const
get the absolute value of the cell ieta
Definition: HcalDetId.cc:98
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
static void unpackSquareIndex(const uint32_t &idx, int &z, int &lay, int &sec, int &subsec, int &cell)
std::map< uint32_t, HepGeom::Transform3D > transMap_
const HGCalDDDConstants * hgcons_
static uint32_t packSquareIndex(int z, int lay, int sec, int subsec, int cell)
std::pair< double, double > getEtaPhi(int subdet, int ieta, int iphi) const
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 361 of file HGCalSimHitValidation.cc.

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

363  {
364 
365  iB.setCurrentFolder("HGCalSimHitsV/"+nameDetector_);
366 
367  std::ostringstream histoname;
368  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ) {
369  histoname.str(""); histoname << "HitOccupancy_Plus_layer_" << ilayer;
370  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
371  histoname.str(""); histoname << "HitOccupancy_Minus_layer_" << ilayer;
372  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
373 
374  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
375  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
376  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
377  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
378 
379  for (unsigned int itimeslice = 0; itimeslice < nTimes_ ; itimeslice++ ) {
380  histoname.str(""); histoname << "energy_time_"<< itimeslice << "_layer_" << ilayer;
381  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.1));
382  }
383  }
384 
385  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
386  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
387 }
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:115
std::vector< MonitorElement * > EtaPhi_Plus_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::vector< MonitorElement * > EtaPhi_Minus_
bool HGCalSimHitValidation::defineGeometry ( edm::ESTransientHandle< DDCompactView > &  ddViewH)
private

Definition at line 281 of file HGCalSimHitValidation.cc.

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

Referenced by dqmBeginRun().

281  {
282  if (verbosity_>0)
283  edm::LogInfo("HGCalValidation") << "Initialize HGCalDDDConstants for "
284  << nameDetector_ << " : " << hgcons_ <<"\n";
285 
286  if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
287  const DDCompactView & cview = *ddViewH;
288  std::string attribute = "Volume";
290  DDValue val(attribute, value, 0);
291 
294  DDFilteredView fv(cview);
295  fv.addFilter(filter);
296  bool dodet = fv.firstChild();
297 
298  while (dodet) {
299  const DDSolid & sol = fv.logicalPart().solid();
300  std::string name = sol.name();
301  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
302  if (isd > 0) {
303  std::vector<int> copy = fv.copyNumbers();
304  int nsiz = (int)(copy.size());
305  int lay = (nsiz > 0) ? copy[nsiz-1] : -1;
306  int sec = (nsiz > 1) ? copy[nsiz-2] : -1;
307  int zp = (nsiz > 3) ? copy[nsiz-4] : -1;
308  if (zp !=1 ) zp = -1;
309  const DDTrap & trp = static_cast<DDTrap>(sol);
310  int subs = (trp.alpha1()>0 ? 1 : 0);
311  symmDet_ = (trp.alpha1()==0 ? true : false);
312  uint32_t id = HGCalTestNumbering::packSquareIndex(zp,lay,sec,subs,0);
313  DD3Vector x, y, z;
314  fv.rotation().GetComponents( x, y, z ) ;
315  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
316  x.Y(), y.Y(), z.Y(),
317  x.Z(), y.Z(), z.Z() );
318  const CLHEP::HepRotation hr ( rotation );
319  const CLHEP::Hep3Vector h3v ( fv.translation().X(),
320  fv.translation().Y(),
321  fv.translation().Z() ) ;
322  const HepGeom::Transform3D ht3d (hr, h3v);
323  transMap_.insert(std::make_pair(id,ht3d));
324  if (verbosity_>2)
325  edm::LogInfo("HGCalValidation") << HGCalDetId(id)
326  << " Transform using " << h3v
327  << " and " << hr << std::endl;
328  }
329  dodet = fv.next();
330  }
331  if (verbosity_>0)
332  edm::LogInfo("HGCalValidation") << "Finds " << transMap_.size()
333  << " elements and SymmDet_ = "
334  << symmDet_ << std::endl;
335  }
336  return true;
337 }
const N & name() const
Definition: DDBase.h:78
type of data representation of DDCompactView
Definition: DDCompactView.h:90
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
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
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:186
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 setCriteria(const DDValue &nameVal, DDCompOp, DDLogOp l=DDLogOp::AND, bool asString=true, bool merged=true)
Definition: DDFilter.cc:253
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:33
void HGCalSimHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 340 of file HGCalSimHitValidation.cc.

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

341  {
342  if (heRebuild_) {
344  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
345  hcons_ = &(*pHRNDC);
346  layers_ = hcons_->getMaxDepth(1);
347  } else {
349  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
350  hgcons_ = &(*pHGDC);
351  layers_ = hgcons_->layers(false);
353  iSetup.get<IdealGeometryRecord>().get( pDD );
354  defineGeometry(pDD);
355  }
356  if (verbosity_>0)
357  edm::LogInfo("HGCalValidation") << nameDetector_ << " defined with "
358  << layers_ << " Layers\n";
359 }
bool defineGeometry(edm::ESTransientHandle< DDCompactView > &ddViewH)
int getMaxDepth(const int type) const
unsigned int layers(bool reco) const
const HcalDDDRecConstants * hcons_
const T & get() const
Definition: EventSetup.h:56
const HGCalDDDConstants * hgcons_
void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 390 of file HGCalSimHitValidation.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

390  {
391  //The following says we do not know what parameters are allowed so do no validation
392  // Please change this to state exactly what you do use, even if it is no parameters
394  desc.setUnknown();
395  descriptions.addDefault(desc);
396 }
void addDefault(ParameterSetDescription const &psetDescription)
void HGCalSimHitValidation::fillHitsInfo ( std::pair< hitsinfo, energysum hit_,
unsigned int  itimeslice,
double  esum 
)
private

Definition at line 260 of file HGCalSimHitValidation.cc.

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

Referenced by analyzeHits().

261  {
262 
263  unsigned int ilayer = hits.first.layer - 1;
264  if (ilayer < layers_) {
265  energy_[itimeslice].at(ilayer)->Fill(esum);
266  if (itimeslice==0) {
267  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
268  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
269  }
270  } else {
271  if (verbosity_>0)
272  edm::LogInfo("HGCalValidation") << "Problematic Hit for "
273  << nameDetector_ << " at sector "
274  << hits.first.sector << " layer "
275  << hits.first.layer << " cell "
276  << hits.first.cell << " energy "
277  << hits.second.etotal << std::endl;
278  }
279 }
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 252 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits().

252  {
253  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
254  OccupancyMap[layer] ++;
255  } else {
256  OccupancyMap[layer] = 1;
257  }
258 }

Member Data Documentation

std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 93 of file HGCalSimHitValidation.h.

Referenced by HGCalSimHitValidation().

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

Definition at line 108 of file HGCalSimHitValidation.h.

Referenced by bookHistograms(), and fillHitsInfo().

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

Definition at line 106 of file HGCalSimHitValidation.h.

Referenced by bookHistograms(), and fillHitsInfo().

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

Definition at line 106 of file HGCalSimHitValidation.h.

Referenced by bookHistograms(), and fillHitsInfo().

const HcalDDDRecConstants* HGCalSimHitValidation::hcons_
private

Definition at line 95 of file HGCalSimHitValidation.h.

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

bool HGCalSimHitValidation::heRebuild_
private

Definition at line 97 of file HGCalSimHitValidation.h.

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

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 94 of file HGCalSimHitValidation.h.

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

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

Definition at line 105 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and bookHistograms().

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

Definition at line 105 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and bookHistograms().

unsigned int HGCalSimHitValidation::layers_
private

Definition at line 102 of file HGCalSimHitValidation.h.

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

MonitorElement * HGCalSimHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 107 of file HGCalSimHitValidation.h.

Referenced by bookHistograms().

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 107 of file HGCalSimHitValidation.h.

Referenced by bookHistograms().

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

Definition at line 99 of file HGCalSimHitValidation.h.

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

bool HGCalSimHitValidation::symmDet_
private

Definition at line 97 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and defineGeometry().

bool HGCalSimHitValidation::testNumber_
private

Definition at line 97 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 98 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and HGCalSimHitValidation().

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

Definition at line 101 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 100 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 103 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and defineGeometry().

int HGCalSimHitValidation::verbosity_
private