CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
HGCalSimHitValidation Class Reference
Inheritance diagram for HGCalSimHitValidation:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  energysum
 
struct  hitsinfo
 

Public Member Functions

 HGCalSimHitValidation (const edm::ParameterSet &)
 
 ~HGCalSimHitValidation () override=default
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

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 DQMEDAnalyzer
uint64_t meId () const
 

Private Member Functions

void analyzeHits (std::vector< PCaloHit > &hits)
 
TH1F * createHisto (std::string histname, const int nbins, float minIndexX, float maxIndexX, bool isLogX=true)
 
void fillHitsInfo (std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)
 
void fillMuonTomoHistos (int partialType, std::pair< hitsinfo, energysum > hit_)
 
void fillOccupancyMap (std::map< int, int > &OccupancyMap, int layer)
 
void histoSetting (TH1F *&histo, const char *xTitle, const char *yTitle="", Color_t lineColor=kBlack, Color_t markerColor=kBlack, int linewidth=1)
 
void histoSetting (TH2F *&histo, const char *xTitle, const char *yTitle="", Color_t lineColor=kBlack, Color_t markerColor=kBlack, int linewidth=1)
 

Private Attributes

const std::string caloHitSource_
 
std::vector< MonitorElement * > energy_ [maxTime_]
 
std::vector< MonitorElement * > energyFWCK_
 
std::vector< MonitorElement * > energyFWCN_
 
std::vector< MonitorElement * > energyFWF_
 
std::vector< MonitorElement * > energyPWCK_
 
std::vector< MonitorElement * > energyPWCN_
 
std::vector< MonitorElement * > energyPWF_
 
std::vector< MonitorElement * > EtaPhi_Minus_
 
std::vector< MonitorElement * > EtaPhi_Plus_
 
int firstLayer_
 
const HGCalDDDConstantshgcons_
 
std::vector< MonitorElement * > HitOccupancy_Minus_
 
std::vector< MonitorElement * > HitOccupancy_Plus_
 
std::vector< MonitorElement * > hitXYB_
 
std::vector< MonitorElement * > hitXYFWCK_
 
std::vector< MonitorElement * > hitXYFWCN_
 
std::vector< MonitorElement * > hitXYFWF_
 
unsigned int layers_
 
MonitorElementMeanHitOccupancy_Minus_
 
MonitorElementMeanHitOccupancy_Plus_
 
const std::string nameDetector_
 
unsigned int nTimes_
 
const std::vector< double > times_
 
const edm::EDGetTokenT< edm::HepMCProducttok_hepMC_
 
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecordtok_hgcal_
 
const edm::EDGetTokenT< edm::PCaloHitContainertok_hits_
 
const int verbosity_
 

Static Private Attributes

static const unsigned int maxTime_ = 6
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 35 of file HGCalSimHitValidation.cc.

Constructor & Destructor Documentation

◆ HGCalSimHitValidation()

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

Definition at line 107 of file HGCalSimHitValidation.cc.

References nameDetector_.

108  : nameDetector_(iConfig.getParameter<std::string>("DetectorName")),
109  caloHitSource_(iConfig.getParameter<std::string>("CaloHitSource")),
110  times_(iConfig.getParameter<std::vector<double> >("TimeSlices")),
111  verbosity_(iConfig.getUntrackedParameter<int>("Verbosity", 0)),
112  tok_hgcal_(esConsumes<HGCalDDDConstants, IdealGeometryRecord, edm::Transition::BeginRun>(
114  tok_hepMC_(consumes<edm::HepMCProduct>(edm::InputTag("generatorSmeared"))),
115  tok_hits_(consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", caloHitSource_))),
116  firstLayer_(1) {
117  nTimes_ = (times_.size() > maxTime_) ? maxTime_ : times_.size();
118 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const std::vector< double > times_
T getUntrackedParameter(std::string const &, T const &) const
const std::string nameDetector_
static const unsigned int maxTime_
const edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
const std::string caloHitSource_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_

◆ ~HGCalSimHitValidation()

HGCalSimHitValidation::~HGCalSimHitValidation ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 131 of file HGCalSimHitValidation.cc.

References analyzeHits(), edm::HepMCProduct::GetEvent(), iEvent, edm::HandleBase::isValid(), dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, tok_hepMC_, tok_hits_, and verbosity_.

131  {
132  //Generator input
133  if (verbosity_ > 0) {
134  const edm::Handle<edm::HepMCProduct>& evtMC = iEvent.getHandle(tok_hepMC_);
135  if (!evtMC.isValid()) {
136  edm::LogVerbatim("HGCalValidation") << "no HepMCProduct found";
137  } else {
138  const HepMC::GenEvent* myGenEvent = evtMC->GetEvent();
139  unsigned int k(0);
140  for (HepMC::GenEvent::particle_const_iterator p = myGenEvent->particles_begin(); p != myGenEvent->particles_end();
141  ++p, ++k) {
142  edm::LogVerbatim("HGCalValidation") << "Particle[" << k << "] with pt " << (*p)->momentum().perp() << " eta "
143  << (*p)->momentum().eta() << " phi " << (*p)->momentum().phi();
144  }
145  }
146  }
147 
148  //Now the hits
149  const edm::Handle<edm::PCaloHitContainer>& theCaloHitContainers = iEvent.getHandle(tok_hits_);
150  if (theCaloHitContainers.isValid()) {
151  if (verbosity_ > 0)
152  edm::LogVerbatim("HGCalValidation") << " PcalohitItr = " << theCaloHitContainers->size();
153  std::vector<PCaloHit> caloHits;
154  caloHits.insert(caloHits.end(), theCaloHitContainers->begin(), theCaloHitContainers->end());
155  analyzeHits(caloHits);
156  } else if (verbosity_ > 0) {
157  edm::LogVerbatim("HGCalValidation") << "PCaloHitContainer does not exist!";
158  }
159 }
Log< level::Info, true > LogVerbatim
void analyzeHits(std::vector< PCaloHit > &hits)
int iEvent
Definition: GenABIO.cc:224
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
const edm::EDGetTokenT< edm::HepMCProduct > tok_hepMC_
const edm::EDGetTokenT< edm::PCaloHitContainer > tok_hits_
bool isValid() const
Definition: HandleBase.h:70

◆ analyzeHits()

void HGCalSimHitValidation::analyzeHits ( std::vector< PCaloHit > &  hits)
private

Definition at line 161 of file HGCalSimHitValidation.cc.

References hgcalTopologyTester_cfi::cell2, TauDecayModes::dec, hcalRecHitTable_cff::detId, hcalRecHitTable_cff::energy, PVValHelper::eta, HGCalSimHitValidation::energysum::eTime, HGCalSimHitValidation::energysum::etotal, fillHitsInfo(), fillMuonTomoHistos(), fillOccupancyMap(), firstLayer_, HGCalDDDConstants::geomMode(), hgcons_, HitOccupancy_Minus_, HitOccupancy_Plus_, hfClusterShapes_cfi::hits, mps_fire::i, dqmdumpme::k, nano_mu_digi_cff::layer, HGCalDDDConstants::locateCell(), HGCalDDDConstants::locateCellTrap(), nameDetector_, nTimes_, hgcalPerformanceValidation::orient, nano_mu_digi_cff::sector, nano_mu_digi_cff::subsector, HGCalDDDConstants::tileTrapezoid(), hcalRecHitTable_cff::time, times_, verbosity_, HGCalDDDConstants::waferHexagon8(), HGCalDDDConstants::waferType(), HGCalDDDConstants::waferZ(), geometryCSVtoXML::xy, and ecaldqm::zside().

Referenced by analyze().

161  {
162  std::map<int, int> OccupancyMap_plus, OccupancyMap_minus;
163  OccupancyMap_plus.clear();
164  OccupancyMap_minus.clear();
165 
166  std::map<uint32_t, std::pair<hitsinfo, energysum> > map_hits;
167  map_hits.clear();
168 
169  if (verbosity_ > 0)
170  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << hits.size() << " PcaloHit elements";
171  unsigned int nused(0);
172  for (unsigned int i = 0; i < hits.size(); i++) {
173  double energy = hits[i].energy();
174  double time = hits[i].time();
175  uint32_t id_ = hits[i].id();
176  int cell, sector, subsector(0), layer, zside;
177  int cell2(0), type(0);
178  if (hgcons_->waferHexagon8()) {
180  cell = detId.cellU();
181  cell2 = detId.cellV();
182  sector = detId.waferU();
183  subsector = detId.waferV();
184  type = detId.type();
185  layer = detId.layer();
186  zside = detId.zside();
187  } else if (hgcons_->tileTrapezoid()) {
189  sector = detId.ietaAbs();
190  cell = detId.iphi();
191  subsector = 1;
192  type = detId.type();
193  layer = detId.layer();
194  zside = detId.zside();
195  } else {
196  edm::LogError("HGCalValidation") << "Wrong geometry mode " << hgcons_->geomMode();
197  continue;
198  }
199  nused++;
200  if (verbosity_ > 1)
201  edm::LogVerbatim("HGCalValidation")
202  << "Detector " << nameDetector_ << " zside = " << zside << " sector|wafer = " << sector << ":" << subsector
203  << " type = " << type << " layer = " << layer << " cell = " << cell << ":" << cell2 << " energy = " << energy
204  << " energyem = " << hits[i].energyEM() << " energyhad = " << hits[i].energyHad() << " time = " << time;
205 
206  HepGeom::Point3D<float> gcoord;
207  std::pair<float, float> xy;
208  if (hgcons_->waferHexagon8()) {
209  xy = hgcons_->locateCell(zside, layer, sector, subsector, cell, cell2, false, true, false, false, false);
210  } else {
211  xy = hgcons_->locateCellTrap(zside, layer, sector, cell, false, false);
212  }
213  double zp = hgcons_->waferZ(layer, false);
214  if (zside < 0)
215  zp = -zp;
216  float xp = (zp < 0) ? -xy.first : xy.first;
217  gcoord = HepGeom::Point3D<float>(xp, xy.second, zp);
218  double tof = (gcoord.mag() * CLHEP::mm) / CLHEP::c_light;
219  if (verbosity_ > 1)
220  edm::LogVerbatim("HGCalValidation")
221  << std::hex << id_ << std::dec << " global coordinate " << gcoord << " time " << time << ":" << tof;
222  time -= tof;
223 
224  energysum esum;
225  hitsinfo hinfo;
226  if (map_hits.count(id_) != 0) {
227  hinfo = map_hits[id_].first;
228  esum = map_hits[id_].second;
229  } else {
230  hinfo.x = gcoord.x();
231  hinfo.y = gcoord.y();
232  hinfo.z = gcoord.z();
233  hinfo.sector = sector;
234  hinfo.sector2 = subsector;
235  hinfo.cell = cell;
236  hinfo.cell2 = cell2;
237  hinfo.type = type;
238  hinfo.layer = layer - firstLayer_;
239  hinfo.phi = gcoord.getPhi();
240  hinfo.eta = gcoord.getEta();
241  }
242  esum.etotal += energy;
243  for (unsigned int k = 0; k < nTimes_; ++k) {
244  if (time > 0 && time < times_[k])
245  esum.eTime[k] += energy;
246  }
247 
248  if (verbosity_ > 1)
249  edm::LogVerbatim("HGCalValidation") << " ----------------------- gx = " << hinfo.x << " gy = " << hinfo.y
250  << " gz = " << hinfo.z << " phi = " << hinfo.phi << " eta = " << hinfo.eta;
251  map_hits[id_] = std::pair<hitsinfo, energysum>(hinfo, esum);
252  }
253  if (verbosity_ > 0)
254  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " with " << map_hits.size()
255  << " detector elements being hit";
256 
257  std::map<uint32_t, std::pair<hitsinfo, energysum> >::iterator itr;
258  for (itr = map_hits.begin(); itr != map_hits.end(); ++itr) {
259  hitsinfo hinfo = (*itr).second.first;
260  energysum esum = (*itr).second.second;
261  int layer = hinfo.layer;
262  double eta = hinfo.eta;
263  int type, part, orient;
264  int partialType = -1;
265  if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive")) {
266  HGCSiliconDetId detId = HGCSiliconDetId((*itr).first);
267  std::tie(type, part, orient) = hgcons_->waferType(detId, false);
268  partialType = part;
269  }
270 
271  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
272  fillHitsInfo((*itr).second, itimeslice, esum.eTime[itimeslice]);
273  }
274 
275  if (eta > 0.0)
276  fillOccupancyMap(OccupancyMap_plus, layer);
277  else
278  fillOccupancyMap(OccupancyMap_minus, layer);
279 
280  fillMuonTomoHistos(partialType, (*itr).second);
281  }
282  if (verbosity_ > 0)
283  edm::LogVerbatim("HGCalValidation") << "With map:used:total " << hits.size() << "|" << nused << "|"
284  << map_hits.size() << " hits";
285 
286  for (auto const& itr : OccupancyMap_plus) {
287  int layer = itr.first;
288  int occupancy = itr.second;
289  HitOccupancy_Plus_.at(layer)->Fill(occupancy);
290  }
291  for (auto const& itr : OccupancyMap_minus) {
292  int layer = itr.first;
293  int occupancy = itr.second;
294  HitOccupancy_Minus_.at(layer)->Fill(occupancy);
295  }
296 }
double waferZ(int layer, bool reco) const
Log< level::Info, true > LogVerbatim
void fillOccupancyMap(std::map< int, int > &OccupancyMap, int layer)
std::vector< MonitorElement * > HitOccupancy_Plus_
const std::vector< double > times_
bool waferHexagon8() const
int zside(DetId const &)
std::vector< MonitorElement * > HitOccupancy_Minus_
Log< level::Error, false > LogError
HGCalGeometryMode::GeometryMode geomMode() const
const std::string nameDetector_
bool tileTrapezoid() const
std::pair< float, float > locateCellTrap(int zside, int lay, int ieta, int iphi, bool reco, bool debug) const
part
Definition: HCALResponse.h:20
int waferType(DetId const &id, bool fromFile) const
std::pair< float, float > locateCell(int cell, int lay, int type, bool reco) const
const HGCalDDDConstants * hgcons_
void fillMuonTomoHistos(int partialType, std::pair< hitsinfo, energysum > hit_)
void fillHitsInfo(std::pair< hitsinfo, energysum > hit_, unsigned int itimeslice, double esum)

◆ bookHistograms()

void HGCalSimHitValidation::bookHistograms ( DQMStore::IBooker iB,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 384 of file HGCalSimHitValidation.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), createHisto(), energy_, energyFWCK_, energyFWCN_, energyFWF_, energyPWCK_, energyPWCN_, energyPWF_, EtaPhi_Minus_, EtaPhi_Plus_, firstLayer_, histoSetting(), HitOccupancy_Minus_, HitOccupancy_Plus_, hitXYB_, hitXYFWCK_, hitXYFWCN_, hitXYFWF_, layers_, MeanHitOccupancy_Minus_, MeanHitOccupancy_Plus_, nameDetector_, nTimes_, pi, dqm::implementation::NavigatorBase::setCurrentFolder(), and to_string().

384  {
385  iB.setCurrentFolder("HGCAL/HGCalSimHitsV/" + nameDetector_);
386 
387  std::ostringstream histoname;
388  for (unsigned int il = 0; il < layers_; ++il) {
389  int ilayer = firstLayer_ + static_cast<int>(il);
390  auto istr1 = std::to_string(ilayer);
391  while (istr1.size() < 2) {
392  istr1.insert(0, "0");
393  }
394  histoname.str("");
395  histoname << "HitOccupancy_Plus_layer_" << istr1;
396  HitOccupancy_Plus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Plus", 501, -0.5, 500.5));
397  histoname.str("");
398  histoname << "HitOccupancy_Minus_layer_" << istr1;
399  HitOccupancy_Minus_.push_back(iB.book1D(histoname.str().c_str(), "HitOccupancy_Minus", 501, -0.5, 500.5));
400 
401  histoname.str("");
402  histoname << "EtaPhi_Plus_"
403  << "layer_" << istr1;
404  EtaPhi_Plus_.push_back(iB.book2D(histoname.str().c_str(), "Occupancy", 31, 1.45, 3.0, 72, -CLHEP::pi, CLHEP::pi));
405  histoname.str("");
406  histoname << "EtaPhi_Minus_"
407  << "layer_" << istr1;
408  EtaPhi_Minus_.push_back(
409  iB.book2D(histoname.str().c_str(), "Occupancy", 31, -3.0, -1.45, 72, -CLHEP::pi, CLHEP::pi));
410 
411  for (unsigned int itimeslice = 0; itimeslice < nTimes_; itimeslice++) {
412  histoname.str("");
413  histoname << "energy_time_" << itimeslice << "_layer_" << istr1;
414  energy_[itimeslice].push_back(iB.book1D(histoname.str().c_str(), "energy_", 100, 0, 0.1));
415  }
416 
418  if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive")) {
419  histoname.str("");
420  histoname << "energy_FullWafer_Fine_layer_" << istr1;
421  TH1F* hEdepFWF = createHisto(histoname.str(), 100, 0., 400., false);
422  histoSetting(hEdepFWF, "Eloss (keV)", "", kRed, kRed, 2);
423  energyFWF_.push_back(iB.book1D(histoname.str().c_str(), hEdepFWF));
424  hEdepFWF->Delete();
425 
426  histoname.str("");
427  histoname << "energy_FullWafer_CoarseThin_layer_" << istr1;
428  TH1F* hEdepFWCN = createHisto(histoname.str(), 100, 0., 400., false);
429  histoSetting(hEdepFWCN, "Eloss (keV)", "", kGreen + 1, kGreen + 1, 2);
430  energyFWCN_.push_back(iB.book1D(histoname.str().c_str(), hEdepFWCN));
431  hEdepFWCN->Delete();
432 
433  histoname.str("");
434  histoname << "energy_FullWafer_CoarseThick_layer_" << istr1;
435  TH1F* hEdepFWCK = createHisto(histoname.str(), 100, 0., 400., false);
436  histoSetting(hEdepFWCK, "Eloss (keV)", "", kMagenta, kMagenta, 2);
437  energyFWCK_.push_back(iB.book1D(histoname.str().c_str(), hEdepFWCK));
438  hEdepFWCK->Delete();
439  }
440 
442 
444  if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive")) {
445  histoname.str("");
446  histoname << "energy_PartialWafer_Fine_layer_" << istr1;
447  TH1F* hEdepPWF = createHisto(histoname.str(), 100, 0., 400., false);
448  histoSetting(hEdepPWF, "Eloss (keV)", "", kRed, kRed, 2);
449  energyPWF_.push_back(iB.book1D(histoname.str().c_str(), hEdepPWF));
450  hEdepPWF->Delete();
451 
452  histoname.str("");
453  histoname << "energy_PartialWafer_CoarseThin_layer_" << istr1;
454  TH1F* hEdepPWCN = createHisto(histoname.str(), 100, 0., 400., false);
455  histoSetting(hEdepPWCN, "Eloss (keV)", "", kGreen + 1, kGreen + 1, 2);
456  energyPWCN_.push_back(iB.book1D(histoname.str().c_str(), hEdepPWCN));
457  hEdepPWCN->Delete();
458 
459  histoname.str("");
460  histoname << "energy_PartialWafer_CoarseThick_layer_" << istr1;
461  TH1F* hEdepPWCK = createHisto(histoname.str(), 100, 0., 400., false);
462  histoSetting(hEdepPWCK, "Eloss (keV)", "", kMagenta, kMagenta, 2);
463  energyPWCK_.push_back(iB.book1D(histoname.str().c_str(), hEdepPWCK));
464  hEdepPWCK->Delete();
465  }
467 
468  // ///////////// Histograms for the XY distribution of fired cells/scintillator tiles ///////////////
469  if ((nameDetector_ == "HGCalEESensitive") || (nameDetector_ == "HGCalHESiliconSensitive")) {
470  histoname.str("");
471  histoname << "hitXY_FullWafer_Fine_layer_" << istr1;
472  TH2F* hitXYFWF = new TH2F(
473  Form("hitXYFWF_%s", histoname.str().c_str()), histoname.str().c_str(), 100, -300., 300., 100, -300., 300.);
474  histoSetting(hitXYFWF, "x (cm)", "y (cm)", kRed, kRed);
475  hitXYFWF_.push_back(iB.book2D(histoname.str().c_str(), hitXYFWF));
476  hitXYFWF->Delete();
477 
478  histoname.str("");
479  histoname << "hitXY_FullWafer_CoarseThin_layer_" << istr1;
480  TH2F* hitXYFWCN = new TH2F(
481  Form("hitXYFWCN_%s", histoname.str().c_str()), histoname.str().c_str(), 100, -300., 300., 100, -300., 300.);
482  histoSetting(hitXYFWCN, "x (cm)", "y (cm)", kGreen + 1, kGreen + 1);
483  hitXYFWCN_.push_back(iB.book2D(histoname.str().c_str(), hitXYFWCN));
484  hitXYFWCN->Delete();
485 
486  histoname.str("");
487  histoname << "hitXY_FullWafer_CoarseThick_layer_" << istr1;
488  TH2F* hitXYFWCK = new TH2F(
489  Form("hitXYFWCK_%s", histoname.str().c_str()), histoname.str().c_str(), 100, -300., 300., 100, -300., 300.);
490  histoSetting(hitXYFWCK, "x (cm)", "y (cm)", kMagenta, kMagenta);
491  hitXYFWCK_.push_back(iB.book2D(histoname.str().c_str(), hitXYFWCK));
492  hitXYFWCK->Delete();
493  }
494 
495  if (nameDetector_ == "HGCalHEScintillatorSensitive") {
496  histoname.str("");
497  histoname << "hitXY_Scintillator_layer_" << istr1;
498  TH2F* hitXYB = new TH2F(
499  Form("hitXYB_%s", histoname.str().c_str()), histoname.str().c_str(), 100, -300., 300., 100, -300., 300.);
500  histoSetting(hitXYB, "x (cm)", "y (cm)", kBlue, kBlue);
501  hitXYB_.push_back(iB.book2D(histoname.str().c_str(), hitXYB));
502  hitXYB->Delete();
503  }
505  }
506  MeanHitOccupancy_Plus_ = iB.book1D("MeanHitOccupancy_Plus", "MeanHitOccupancy_Plus", layers_, 0.5, layers_ + 0.5);
507  MeanHitOccupancy_Minus_ = iB.book1D("MeanHitOccupancy_Minus", "MeanHitOccupancy_Minus", layers_, 0.5, layers_ + 0.5);
508 }
MonitorElement * MeanHitOccupancy_Plus_
std::vector< MonitorElement * > HitOccupancy_Plus_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< MonitorElement * > energyPWF_
std::vector< MonitorElement * > HitOccupancy_Minus_
static std::string to_string(const XMLCh *ch)
MonitorElement * MeanHitOccupancy_Minus_
const Double_t pi
std::vector< MonitorElement * > energyPWCN_
const std::string nameDetector_
std::vector< MonitorElement * > hitXYFWCK_
TH1F * createHisto(std::string histname, const int nbins, float minIndexX, float maxIndexX, bool isLogX=true)
std::vector< MonitorElement * > energyFWF_
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > energyFWCN_
std::vector< MonitorElement * > energyFWCK_
std::vector< MonitorElement * > hitXYFWF_
std::vector< MonitorElement * > energyPWCK_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
std::vector< MonitorElement * > energy_[maxTime_]
void histoSetting(TH1F *&histo, const char *xTitle, const char *yTitle="", Color_t lineColor=kBlack, Color_t markerColor=kBlack, int linewidth=1)
std::vector< MonitorElement * > EtaPhi_Minus_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::vector< MonitorElement * > hitXYFWCN_
std::vector< MonitorElement * > hitXYB_

◆ createHisto()

TH1F * HGCalSimHitValidation::createHisto ( std::string  histname,
const int  nbins,
float  minIndexX,
float  maxIndexX,
bool  isLogX = true 
)
private

Definition at line 510 of file HGCalSimHitValidation.cc.

References PVValHelper::dx, compareTotals::hist, mps_fire::i, LaserClient_cfi::nbins, and fw3dlego::xbins.

Referenced by bookHistograms().

511  {
512  TH1F* hist = nullptr;
513  if (isLogX) {
514  Double_t xbins[nbins + 1];
515  double dx = (maxIndexX - minIndexX) / nbins;
516  for (int i = 0; i <= nbins; i++) {
517  xbins[i] = TMath::Power(10, (minIndexX + i * dx));
518  }
519  hist = new TH1F(Form("hEdep_%s", histname.c_str()), histname.c_str(), nbins, xbins);
520  } else {
521  hist = new TH1F(Form("hEdep_%s", histname.c_str()), histname.c_str(), nbins, minIndexX, maxIndexX);
522  }
523  return hist;
524 }
const double xbins[]

◆ dqmBeginRun()

void HGCalSimHitValidation::dqmBeginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 375 of file HGCalSimHitValidation.cc.

References HGCalDDDConstants::firstLayer(), firstLayer_, edm::EventSetup::getData(), hgcons_, HGCalDDDConstants::layers(), layers_, nameDetector_, tok_hgcal_, and verbosity_.

375  {
376  hgcons_ = &iSetup.getData(tok_hgcal_);
377  layers_ = hgcons_->layers(false);
379  if (verbosity_ > 0)
380  edm::LogVerbatim("HGCalValidation") << nameDetector_ << " defined with " << layers_ << " Layers with first at "
381  << firstLayer_;
382 }
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
int firstLayer() const
const std::string nameDetector_
unsigned int layers(bool reco) const
const HGCalDDDConstants * hgcons_
const edm::ESGetToken< HGCalDDDConstants, IdealGeometryRecord > tok_hgcal_

◆ fillDescriptions()

void HGCalSimHitValidation::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 120 of file HGCalSimHitValidation.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

120  {
122  std::vector<double> times = {25.0, 1000.0};
123  desc.add<std::string>("DetectorName", "HGCalEESensitive");
124  desc.add<std::string>("CaloHitSource", "HGCHitsEE");
125  desc.add<std::vector<double> >("TimeSlices", times);
126  desc.addUntracked<int>("Verbosity", 0);
127  desc.addUntracked<bool>("TestNumber", true);
128  descriptions.add("hgcalSimHitValidationEE", desc);
129 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillHitsInfo()

void HGCalSimHitValidation::fillHitsInfo ( std::pair< hitsinfo, energysum hit_,
unsigned int  itimeslice,
double  esum 
)
private

Definition at line 306 of file HGCalSimHitValidation.cc.

References energy_, EtaPhi_Minus_, EtaPhi_Plus_, hfClusterShapes_cfi::hits, layers_, nameDetector_, and verbosity_.

Referenced by analyzeHits().

306  {
307  unsigned int ilayer = hits.first.layer;
308  if (ilayer < layers_) {
309  energy_[itimeslice].at(ilayer)->Fill(esum);
310  if (itimeslice == 0) {
311  EtaPhi_Plus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
312  EtaPhi_Minus_.at(ilayer)->Fill(hits.first.eta, hits.first.phi);
313  }
314  } else {
315  if (verbosity_ > 0)
316  edm::LogVerbatim("HGCalValidation")
317  << "Problematic Hit for " << nameDetector_ << " at sector " << hits.first.sector << ":" << hits.first.sector2
318  << " layer " << hits.first.layer << " cell " << hits.first.cell << ":" << hits.first.cell2 << " energy "
319  << hits.second.etotal;
320  }
321 }
Log< level::Info, true > LogVerbatim
const std::string nameDetector_
std::vector< MonitorElement * > EtaPhi_Plus_
std::vector< MonitorElement * > energy_[maxTime_]
std::vector< MonitorElement * > EtaPhi_Minus_

◆ fillMuonTomoHistos()

void HGCalSimHitValidation::fillMuonTomoHistos ( int  partialType,
std::pair< hitsinfo, energysum hit_ 
)
private

Definition at line 323 of file HGCalSimHitValidation.cc.

References MillePedeFileConverter_cfg::e, energyFWCK_, energyFWCN_, energyFWF_, energyPWCK_, energyPWCN_, energyPWF_, HGCalSimHitValidation::energysum::eTime, HGCSiliconDetId::HGCalHD120, HGCSiliconDetId::HGCalLD200, HGCSiliconDetId::HGCalLD300, hfClusterShapes_cfi::hits, hitXYB_, hitXYFWCK_, hitXYFWCN_, hitXYFWF_, layers_, nameDetector_, or, x, and y.

Referenced by analyzeHits().

323  {
324  hitsinfo hinfo = hits.first;
325  energysum esum = hits.second;
326  double edep =
327  esum.eTime[0] * CLHEP::GeV /
328  CLHEP::keV; //index 0 and 1 corresponds to 25 ns and 1000 ns, respectively. In addititon, chaging energy loss unit to keV.
329 
330  unsigned int ilayer = hinfo.layer;
331  double x = hinfo.x * CLHEP::mm / CLHEP::cm; // chaging length unit to cm.
332  double y = hinfo.y * CLHEP::mm / CLHEP::cm;
333  if (ilayer < layers_) {
334  if (nameDetector_ == "HGCalEESensitive" or nameDetector_ == "HGCalHESiliconSensitive") {
335  // Fill the energy loss histograms for MIP
336  if (!TMath::AreEqualAbs(edep, 0.0, 1.e-5)) { //to avoid peak at zero due Eloss less than 10 mili eV.
337  if (hinfo.type == HGCSiliconDetId::HGCalHD120) {
338  if (partialType == 0)
339  energyFWF_.at(ilayer)->Fill(edep);
340  if (partialType > 0)
341  energyPWF_.at(ilayer)->Fill(edep);
342  }
343  if (hinfo.type == HGCSiliconDetId::HGCalLD200) {
344  if (partialType == 0)
345  energyFWCN_.at(ilayer)->Fill(edep);
346  if (partialType > 0)
347  energyPWCN_.at(ilayer)->Fill(edep);
348  }
349  if (hinfo.type == HGCSiliconDetId::HGCalLD300) {
350  if (partialType == 0)
351  energyFWCK_.at(ilayer)->Fill(edep);
352  if (partialType > 0)
353  energyPWCK_.at(ilayer)->Fill(edep);
354  }
355  }
356 
357  // Fill the XY distribution of detector hits
359  hitXYFWF_.at(ilayer)->Fill(x, y);
360 
362  hitXYFWCN_.at(ilayer)->Fill(x, y);
363 
365  hitXYFWCK_.at(ilayer)->Fill(x, y);
366 
367  } //is Silicon
368  if (nameDetector_ == "HGCalHEScintillatorSensitive") {
369  hitXYB_.at(ilayer)->Fill(x, y);
370  } //is Scintillator
371  } //layer condition
372 }
std::vector< MonitorElement * > energyPWF_
std::vector< MonitorElement * > energyPWCN_
const std::string nameDetector_
std::vector< MonitorElement * > hitXYFWCK_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< MonitorElement * > energyFWF_
std::vector< MonitorElement * > energyFWCN_
std::vector< MonitorElement * > energyFWCK_
std::vector< MonitorElement * > hitXYFWF_
std::vector< MonitorElement * > energyPWCK_
std::vector< MonitorElement * > hitXYFWCN_
std::vector< MonitorElement * > hitXYB_

◆ fillOccupancyMap()

void HGCalSimHitValidation::fillOccupancyMap ( std::map< int, int > &  OccupancyMap,
int  layer 
)
private

Definition at line 298 of file HGCalSimHitValidation.cc.

References nano_mu_digi_cff::layer.

Referenced by analyzeHits().

298  {
299  if (OccupancyMap.find(layer) != OccupancyMap.end()) {
300  ++OccupancyMap[layer];
301  } else {
302  OccupancyMap[layer] = 1;
303  }
304 }

◆ histoSetting() [1/2]

void HGCalSimHitValidation::histoSetting ( TH1F *&  histo,
const char *  xTitle,
const char *  yTitle = "",
Color_t  lineColor = kBlack,
Color_t  markerColor = kBlack,
int  linewidth = 1 
)
private

Definition at line 526 of file HGCalSimHitValidation.cc.

References timingPdfMaker::histo, RecoTauValidation_cfi::lineColor, RecoTauValidation_cfi::lineWidth, and RecoTauValidation_cfi::markerColor.

Referenced by bookHistograms().

527  {
528  histo->SetStats();
529  histo->SetLineColor(lineColor);
530  histo->SetLineWidth(lineWidth);
531  histo->SetMarkerColor(markerColor);
532  histo->GetXaxis()->SetTitle(xTitle);
533  histo->GetYaxis()->SetTitle(yTitle);
534 }

◆ histoSetting() [2/2]

void HGCalSimHitValidation::histoSetting ( TH2F *&  histo,
const char *  xTitle,
const char *  yTitle = "",
Color_t  lineColor = kBlack,
Color_t  markerColor = kBlack,
int  linewidth = 1 
)
private

Definition at line 536 of file HGCalSimHitValidation.cc.

References timingPdfMaker::histo, RecoTauValidation_cfi::lineColor, RecoTauValidation_cfi::lineWidth, and RecoTauValidation_cfi::markerColor.

537  {
538  histo->SetStats();
539  histo->SetLineColor(lineColor);
540  histo->SetLineWidth(lineWidth);
541  histo->SetMarkerColor(markerColor);
542  histo->SetMarkerStyle(kFullCircle);
543  histo->SetMarkerSize(0.6);
544  histo->GetXaxis()->SetTitle(xTitle);
545  histo->GetYaxis()->SetTitle(yTitle);
546 }

Member Data Documentation

◆ caloHitSource_

const std::string HGCalSimHitValidation::caloHitSource_
private

Definition at line 86 of file HGCalSimHitValidation.cc.

◆ energy_

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

Definition at line 100 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ energyFWCK_

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

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ energyFWCN_

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

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ energyFWF_

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

Definition at line 101 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ energyPWCK_

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

Definition at line 102 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ energyPWCN_

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

Definition at line 102 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ energyPWF_

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

Definition at line 102 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ EtaPhi_Minus_

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

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ EtaPhi_Plus_

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

Definition at line 97 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillHitsInfo().

◆ firstLayer_

int HGCalSimHitValidation::firstLayer_
private

Definition at line 94 of file HGCalSimHitValidation.cc.

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

◆ hgcons_

const HGCalDDDConstants* HGCalSimHitValidation::hgcons_
private

Definition at line 87 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and dqmBeginRun().

◆ HitOccupancy_Minus_

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

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ HitOccupancy_Plus_

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

Definition at line 96 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ hitXYB_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ hitXYFWCK_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ hitXYFWCN_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ hitXYFWF_

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

Definition at line 103 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms(), and fillMuonTomoHistos().

◆ layers_

unsigned int HGCalSimHitValidation::layers_
private

◆ maxTime_

const unsigned int HGCalSimHitValidation::maxTime_ = 6
staticprivate

Definition at line 99 of file HGCalSimHitValidation.cc.

◆ MeanHitOccupancy_Minus_

MonitorElement * HGCalSimHitValidation::MeanHitOccupancy_Minus_
private

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

◆ MeanHitOccupancy_Plus_

MonitorElement* HGCalSimHitValidation::MeanHitOccupancy_Plus_
private

Definition at line 98 of file HGCalSimHitValidation.cc.

Referenced by bookHistograms().

◆ nameDetector_

const std::string HGCalSimHitValidation::nameDetector_
private

◆ nTimes_

unsigned int HGCalSimHitValidation::nTimes_
private

Definition at line 104 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits(), and bookHistograms().

◆ times_

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

Definition at line 88 of file HGCalSimHitValidation.cc.

Referenced by analyzeHits().

◆ tok_hepMC_

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

Definition at line 91 of file HGCalSimHitValidation.cc.

Referenced by analyze().

◆ tok_hgcal_

const edm::ESGetToken<HGCalDDDConstants, IdealGeometryRecord> HGCalSimHitValidation::tok_hgcal_
private

Definition at line 90 of file HGCalSimHitValidation.cc.

Referenced by dqmBeginRun().

◆ tok_hits_

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

Definition at line 92 of file HGCalSimHitValidation.cc.

Referenced by analyze().

◆ verbosity_

const int HGCalSimHitValidation::verbosity_
private

Definition at line 89 of file HGCalSimHitValidation.cc.

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