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 | Static 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 ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 &)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &)
 
- 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_ [netaBins]
 
std::vector< MonitorElement * > HitOccupancy_Plus_ [netaBins]
 
unsigned int layers_
 
MonitorElementMeanHitOccupancy_Minus_ [netaBins]
 
MonitorElementMeanHitOccupancy_Plus_ [netaBins]
 
std::string nameDetector_
 
bool symmDet_
 
bool testNumber_
 
edm::EDGetTokenT
< edm::HepMCProduct
tok_hepMC_
 
edm::EDGetTokenT
< edm::PCaloHitContainer
tok_hits_
 
std::map< uint32_t,
HepGeom::Transform3D > 
transMap_
 
int verbosity_
 

Static Private Attributes

static const int netaBins = 4
 

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_, AlCaHLTBitMon_QueryRunRegistry::string, testNumber_, 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  verbosity_ = iConfig.getUntrackedParameter<int>("Verbosity",0);
45  testNumber_ = iConfig.getUntrackedParameter<bool>("TestNumber", false);
46  heRebuild_ = (nameDetector_ == "HCal") ? true : false;
47  tok_hepMC_ = consumes<edm::HepMCProduct>(edm::InputTag("generator"));
48  tok_hits_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits",caloHitSource_));
49 
50 }
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_
HGCalSimHitValidation::~HGCalSimHitValidation ( )

Definition at line 52 of file HGCalSimHitValidation.cc.

52 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

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

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

References begin, HGCalSimHitValidation::hitsinfo::cell, funct::cos(), TauDecayModes::dec, HcalDetId::depth(), HGCalSimHitValidation::energysum::e100, HGCalSimHitValidation::energysum::e1000, HGCalSimHitValidation::energysum::e15, HGCalSimHitValidation::energysum::e25, HGCalSimHitValidation::energysum::e250, HGCalSimHitValidation::energysum::e50, relval_parameters_module::energy, eta, HGCalSimHitValidation::hitsinfo::eta, fastmath::etaphi(), HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillOccupancyMap(), HGCalDDDConstants::geomMode(), HcalDDDRecConstants::getEtaPhi(), HcalDDDRecConstants::getRZ(), HcalEndcap, hcons_, heRebuild_, hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, i, HcalDetId::ietaAbs(), HcalDetId::iphi(), HGCalSimHitValidation::hitsinfo::layer, HGCalDDDConstants::locateCell(), nameDetector_, netaBins, HGCalTestNumbering::packSquareIndex(), HGCalSimHitValidation::hitsinfo::phi, HGCalSimHitValidation::hitsinfo::sector, funct::sin(), Square, HcalDetId::subdet(), symmDet_, 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().

110  {
111 
112  std::map<int, int> OccupancyMap_plus[netaBins];
113  std::map<int, int> OccupancyMap_minus[netaBins];
114  for(int i=0; i<netaBins; ++i) {
115  OccupancyMap_plus[i].clear();
116  OccupancyMap_minus[i].clear();
117  }
118 
119  std::map<uint32_t,std::pair<hitsinfo,energysum> > map_hits;
120  map_hits.clear();
121 
122  if (verbosity_ > 0)
123  edm::LogInfo("HGCalValidation") << nameDetector_ << " with " << hits.size()
124  << " PcaloHit elements";
125  unsigned int nused(0);
126  for (unsigned int i=0; i<hits.size(); i++) {
127  double energy = hits[i].energy();
128  double time = hits[i].time();
129  uint32_t id_ = hits[i].id();
130  int cell, sector, subsector, layer, zside;
131  int subdet(0);
132  if (heRebuild_) {
133  HcalDetId detId = HcalDetId(id_);
134  subdet = detId.subdet();
135  if (subdet != static_cast<int>(HcalEndcap)) continue;
136  cell = detId.ietaAbs();
137  sector = detId.iphi();
138  subsector = 1;
139  layer = detId.depth();
140  zside = detId.zside();
141  } else {
143  HGCalTestNumbering::unpackSquareIndex(id_, zside, layer, sector, subsector, cell);
144  } else {
145  HGCalTestNumbering::unpackHexagonIndex(id_, subdet, zside, layer, sector, subsector, cell);
146  }
147  }
148  nused++;
149  if (verbosity_>1)
150  edm::LogInfo("HGCalValidation") << "Detector " << nameDetector_
151  << " zside = " << zside
152  << " sector|wafer = " << sector
153  << " subsector|type = " << subsector
154  << " layer = " << layer
155  << " cell = " << cell
156  << " energy = " << energy
157  << " energyem = " << hits[i].energyEM()
158  << " energyhad = " << hits[i].energyHad()
159  << " time = " << time;
160 
161  HepGeom::Point3D<float> gcoord;
162  if (heRebuild_) {
163  std::pair<double,double> etaphi = hcons_->getEtaPhi(subdet,zside*cell,sector);
164  double rz = hcons_->getRZ(subdet,zside*cell,layer);
165 // std::cout << "i/p " << subdet << ":" << zside << ":" << cell << ":" << sector << ":" << layer << " o/p " << etaphi.first << ":" << etaphi.second << ":" << rz << std::endl;
166  gcoord = HepGeom::Point3D<float>(rz*cos(etaphi.second)/cosh(etaphi.first),
167  rz*sin(etaphi.second)/cosh(etaphi.first),
168  rz*tanh(etaphi.first));
169  } else {
170  std::pair<float,float> xy = hgcons_->locateCell(cell,layer,subsector,false);
172  const HepGeom::Point3D<float> lcoord(xy.first,xy.second,0);
173  int subs = (symmDet_ ? 0 : subsector);
174  id_ = HGCalTestNumbering::packSquareIndex(zside,layer,sector,subs,0);
175  gcoord = (transMap_[id_]*lcoord);
176  } else {
177  double zp = hgcons_->waferZ(layer,false);
178  if (zp < 0) gcoord = HepGeom::Point3D<float>(-xy.first,xy.second,zp);
179  else gcoord = HepGeom::Point3D<float>( xy.first,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;
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  esum.etotal += energy;
204  if (time > 0 && time < 1000) {
205  esum.e1000 += energy;
206  if (time < 250) {
207  esum.e250 += energy;
208  if (time < 100) {
209  esum.e100 += energy;
210  if (time < 50) {
211  esum.e50 += energy;
212  if (time < 25) {
213  esum.e25 += energy;
214  if (time < 15) {
215  esum.e15 += energy;
216  }
217  }
218  }
219  }
220  }
221  }
222  }
223  if (verbosity_>1)
224  edm::LogInfo("HGCalValidation") << " -------------------------- gx = "
225  << hinfo.x << " gy = " << hinfo.y
226  << " gz = " << hinfo.z << " phi = "
227  << hinfo.phi << " eta = " << hinfo.eta;
228  std::pair<hitsinfo,energysum> pair_tmp(hinfo,esum);
229  map_hits[id_] = pair_tmp;
230  }
231  if (verbosity_>0)
232  edm::LogInfo("HGCalValidation") << nameDetector_ << " with "
233  << map_hits.size()
234  << " detector elements being hit";
235 
236  std::map<uint32_t,std::pair<hitsinfo,energysum> >::iterator itr;
237  for (itr = map_hits.begin() ; itr != map_hits.end(); ++itr) {
238  hitsinfo hinfo = (*itr).second.first;
239  energysum esum = (*itr).second.second;
240  int layer = hinfo.layer;
241 
242 
243  std::vector<double> esumVector;
244  esumVector.push_back(esum.e15);
245  esumVector.push_back(esum.e25);
246  esumVector.push_back(esum.e50);
247  esumVector.push_back(esum.e100);
248  esumVector.push_back(esum.e250);
249  esumVector.push_back(esum.e1000);
250 
251  for(unsigned int itimeslice = 0; itimeslice < esumVector.size();
252  itimeslice++ ) {
253  fillHitsInfo((*itr).second, itimeslice, esumVector.at(itimeslice));
254  }
255 
256  double eta = hinfo.eta;
257 
258  if (eta >= 1.75 && eta <= 2.5) fillOccupancyMap(OccupancyMap_plus[0], layer-1);
259  if (eta >= 1.75 && eta <= 2.0) fillOccupancyMap(OccupancyMap_plus[1], layer-1);
260  else if (eta >= 2.0 && eta <= 2.25) fillOccupancyMap(OccupancyMap_plus[2], layer-1);
261  else if(eta >= 2.25 && eta <= 2.5) fillOccupancyMap(OccupancyMap_plus[3], layer-1);
262 
263  if (eta >= -2.5 && eta <= -1.75) fillOccupancyMap(OccupancyMap_minus[0], layer-1);
264  if (eta >= -2.0 && eta <= -1.75) fillOccupancyMap(OccupancyMap_minus[1], layer-1);
265  else if (eta >= -2.25 && eta <= -2.0) fillOccupancyMap(OccupancyMap_minus[2], layer-1);
266  else if (eta >= -2.5 && eta <= -2.25) fillOccupancyMap(OccupancyMap_minus[3], layer-1);
267  }
268  edm::LogInfo("HGCalValidation") << "With map:used:total " << hits.size()
269  << "|" << nused << "|" << map_hits.size()
270  << " hits";
271 
272  for(int indx=0; indx<netaBins;++indx) {
273  for (auto itr = OccupancyMap_plus[indx].begin() ; itr != OccupancyMap_plus[indx].end(); ++itr) {
274  int layer = (*itr).first;
275  int occupancy = (*itr).second;
276  HitOccupancy_Plus_[indx].at(layer)->Fill(occupancy);
277  }
278  for (auto itr = OccupancyMap_minus[indx].begin() ; itr != OccupancyMap_minus[indx].end(); ++itr) {
279  int layer = (*itr).first;
280  int occupancy = (*itr).second;
281  HitOccupancy_Minus_[indx].at(layer)->Fill(occupancy);
282  }
283  }
284 }
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
int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.cc:91
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< MonitorElement * > HitOccupancy_Minus_[netaBins]
int zside(DetId const &)
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
int depth() const
get the tower depth
Definition: HcalDetId.cc:106
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:96
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
static void unpackSquareIndex(const uint32_t &idx, int &z, int &lay, int &sec, int &subsec, int &cell)
std::vector< MonitorElement * > HitOccupancy_Plus_[netaBins]
#define begin
Definition: vmac.h:30
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)
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 394 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_, netaBins, and DQMStore::IBooker::setCurrentFolder().

396  {
397  iB.setCurrentFolder("HGCalSimHitsV/"+nameDetector_);
398 
399  std::ostringstream histoname;
400  for (unsigned int ilayer = 0; ilayer < layers_; ilayer++ ) {
401  for (int indx=0; indx<netaBins; ++indx){
402  histoname.str(""); histoname << "HitOccupancy_Plus"<< indx << "_layer_" << ilayer;
403  HitOccupancy_Plus_[indx].push_back(iB.book1D( histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
404  histoname.str(""); histoname << "HitOccupancy_Minus" << indx << "_layer_" << ilayer;
405  HitOccupancy_Minus_[indx].push_back(iB.book1D( histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
406  }
407 
408  histoname.str(""); histoname << "EtaPhi_Plus_" << "layer_" << ilayer;
409  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -3.14, 3.14));
410  histoname.str(""); histoname << "EtaPhi_Minus_" << "layer_" << ilayer;
411  EtaPhi_Minus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -3.14, 3.14));
412 
413  for (int itimeslice = 0; itimeslice < 6 ; itimeslice++ ) {
414  histoname.str(""); histoname << "energy_time_"<< itimeslice << "_layer_" << ilayer;
415  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(),"energy_",100,0,0.1));
416  }
417  }
418  for(int indx=0; indx<netaBins; ++indx) {
419  histoname.str(""); histoname << "MeanHitOccupancy_Plus"<< indx ;
420  MeanHitOccupancy_Plus_[indx] = iB.book1D( histoname.str().c_str(), "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
421  histoname.str(""); histoname << "MeanHitOccupancy_Minus"<< indx ;
422  MeanHitOccupancy_Minus_[indx] = iB.book1D( histoname.str().c_str(), "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
423  }
424 }
std::vector< MonitorElement * > energy_[6]
std::vector< MonitorElement * > HitOccupancy_Minus_[netaBins]
MonitorElement * MeanHitOccupancy_Minus_[netaBins]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::vector< MonitorElement * > EtaPhi_Plus_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * MeanHitOccupancy_Plus_[netaBins]
std::vector< MonitorElement * > HitOccupancy_Plus_[netaBins]
std::vector< MonitorElement * > EtaPhi_Minus_
bool HGCalSimHitValidation::defineGeometry ( edm::ESTransientHandle< DDCompactView > &  ddViewH)
private

Definition at line 315 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_, relativeConstraints::value, verbosity_, x, y, and z.

Referenced by dqmBeginRun().

315  {
316  if (verbosity_>0)
317  edm::LogInfo("HGCalValidation") << "Initialize HGCalDDDConstants for "
318  << nameDetector_ << " : " << hgcons_;
319 
320  if (hgcons_->geomMode() == HGCalGeometryMode::Square) {
321  const DDCompactView & cview = *ddViewH;
322  std::string attribute = "Volume";
324  DDValue val(attribute, value, 0);
325 
327  filter.setCriteria(val, DDCompOp::equals);
328  DDFilteredView fv(cview);
329  fv.addFilter(filter);
330  bool dodet = fv.firstChild();
331 
332  while (dodet) {
333  const DDSolid & sol = fv.logicalPart().solid();
334  std::string name = sol.name();
335  int isd = (name.find(nameDetector_) == std::string::npos) ? -1 : 1;
336  if (isd > 0) {
337  std::vector<int> copy = fv.copyNumbers();
338  int nsiz = (int)(copy.size());
339  int lay = (nsiz > 0) ? copy[nsiz-1] : -1;
340  int sec = (nsiz > 1) ? copy[nsiz-2] : -1;
341  int zp = (nsiz > 3) ? copy[nsiz-4] : -1;
342  if (zp !=1 ) zp = -1;
343  const DDTrap & trp = static_cast<DDTrap>(sol);
344  int subs = (trp.alpha1()>0 ? 1 : 0);
345  symmDet_ = (trp.alpha1()==0 ? true : false);
346  uint32_t id = HGCalTestNumbering::packSquareIndex(zp,lay,sec,subs,0);
347  DD3Vector x, y, z;
348  fv.rotation().GetComponents( x, y, z ) ;
349  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
350  x.Y(), y.Y(), z.Y(),
351  x.Z(), y.Z(), z.Z() );
352  const CLHEP::HepRotation hr ( rotation );
353  const CLHEP::Hep3Vector h3v ( fv.translation().X(),
354  fv.translation().Y(),
355  fv.translation().Z() ) ;
356  const HepGeom::Transform3D ht3d (hr, h3v);
357  transMap_.insert(std::make_pair(id,ht3d));
358  if (verbosity_>2)
359  edm::LogInfo("HGCalValidation") << HGCalDetId(id)
360  << " Transform using " << h3v
361  << " and " << hr;
362  }
363  dodet = fv.next();
364  }
365  if (verbosity_>0)
366  edm::LogInfo("HGCalValidation") << "Finds " << transMap_.size()
367  << " elements and SymmDet_ = " <<symmDet_;
368  }
369  return true;
370 }
const N & name() const
Definition: DDBase.h:78
type of data representation of DDCompactView
Definition: DDCompactView.h:77
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
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:77
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:179
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:245
The DDGenericFilter is a runtime-parametrized Filter looking on DDSpecifcs.
Definition: DDFilter.h:32
void HGCalSimHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
protectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 373 of file HGCalSimHitValidation.cc.

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

374  {
375  if (heRebuild_) {
377  iSetup.get<HcalRecNumberingRecord>().get( pHRNDC );
378  hcons_ = &(*pHRNDC);
379  layers_ = hcons_->getMaxDepth(1);
380  } else {
382  iSetup.get<IdealGeometryRecord>().get(nameDetector_, pHGDC);
383  hgcons_ = &(*pHGDC);
384  layers_ = hgcons_->layers(false);
386  iSetup.get<IdealGeometryRecord>().get( pDD );
387  defineGeometry(pDD);
388  }
389  if (verbosity_>0)
390  edm::LogInfo("HGCalValidation") << nameDetector_ << " defined with "
391  << layers_ << " Layers";
392 }
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 427 of file HGCalSimHitValidation.cc.

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

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

Definition at line 294 of file HGCalSimHitValidation.cc.

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

Referenced by analyzeHits().

295  {
296 
297  unsigned int ilayer = hits.first.layer - 1;
298  if (ilayer < layers_) {
299  energy_[itimeslice].at(ilayer)->Fill(esum);
300  if (itimeslice==1) {
301  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
302  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta , hits.first.phi);
303  }
304  } else {
305  if (verbosity_>0)
306  edm::LogInfo("HGCalValidation") << "Problematic Hit for "
307  << nameDetector_ << " at sector "
308  << hits.first.sector << " layer "
309  << hits.first.layer << " cell "
310  << hits.first.cell << " energy "
311  << hits.second.etotal;
312  }
313 }
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 286 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits().

286  {
287  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
288  OccupancyMap[layer] ++;
289  } else {
290  OccupancyMap[layer] = 1;
291  }
292 }

Member Data Documentation

std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 94 of file HGCalSimHitValidation.h.

Referenced by HGCalSimHitValidation().

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

Definition at line 110 of file HGCalSimHitValidation.h.

Referenced by bookHistograms(), and fillHitsInfo().

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

Definition at line 107 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 96 of file HGCalSimHitValidation.h.

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

bool HGCalSimHitValidation::heRebuild_
private

Definition at line 98 of file HGCalSimHitValidation.h.

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

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 95 of file HGCalSimHitValidation.h.

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

std::vector<MonitorElement*> HGCalSimHitValidation::HitOccupancy_Minus_[netaBins]
private

Definition at line 105 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and bookHistograms().

std::vector<MonitorElement*> HGCalSimHitValidation::HitOccupancy_Plus_[netaBins]
private

Definition at line 104 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and bookHistograms().

unsigned int HGCalSimHitValidation::layers_
private

Definition at line 101 of file HGCalSimHitValidation.h.

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

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Minus_[netaBins]
private

Definition at line 109 of file HGCalSimHitValidation.h.

Referenced by bookHistograms().

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_[netaBins]
private

Definition at line 108 of file HGCalSimHitValidation.h.

Referenced by bookHistograms().

std::string HGCalSimHitValidation::nameDetector_
private
const int HGCalSimHitValidation::netaBins = 4
staticprivate

Definition at line 93 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and bookHistograms().

bool HGCalSimHitValidation::symmDet_
private

Definition at line 98 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and defineGeometry().

bool HGCalSimHitValidation::testNumber_
private

Definition at line 98 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 100 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 99 of file HGCalSimHitValidation.h.

Referenced by analyze(), and HGCalSimHitValidation().

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

Definition at line 102 of file HGCalSimHitValidation.h.

Referenced by analyzeHits(), and defineGeometry().

int HGCalSimHitValidation::verbosity_
private