CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Types | Private Attributes
EcalPreshowerSimHitsValidation Class Reference

#include <EcalPreshowerSimHitsValidation.h>

Inheritance diagram for EcalPreshowerSimHitsValidation:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 EcalPreshowerSimHitsValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
- 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
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 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
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 Analyze. More...
 
void bookHistograms (DQMStore::IBooker &ib, edm::Run const &, edm::EventSetup const &c) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Types

typedef std::map< uint32_t, float, std::less< uint32_t > > MapType
 

Private Attributes

std::string EEHitsCollection
 
edm::EDGetTokenT< edm::PCaloHitContainerEEHitsToken
 
std::string ESHitsCollection
 
edm::EDGetTokenT< edm::PCaloHitContainerESHitsToken
 
std::string g4InfoLabel
 
edm::EDGetTokenT< edm::HepMCProductHepMCToken
 
MonitorElementme2eszmOver1eszm_
 
MonitorElementme2eszpOver1eszp_
 
MonitorElementmeE1alphaE2zm_
 
MonitorElementmeE1alphaE2zp_
 
MonitorElementmeEEoverESzm_
 
MonitorElementmeEEoverESzp_
 
MonitorElementmeESEnergyHits1zm_
 
MonitorElementmeESEnergyHits1zp_
 
MonitorElementmeESEnergyHits2zm_
 
MonitorElementmeESEnergyHits2zp_
 
MonitorElementmeEShitLog10Energy_
 
MonitorElementmeEShitLog10EnergyNorm_
 
MonitorElementmenESHits1zm_
 
MonitorElementmenESHits1zp_
 
MonitorElementmenESHits2zm_
 
MonitorElementmenESHits2zp_
 
bool verbose_
 

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
 
- 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 Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 33 of file EcalPreshowerSimHitsValidation.h.

Member Typedef Documentation

◆ MapType

typedef std::map<uint32_t, float, std::less<uint32_t> > EcalPreshowerSimHitsValidation::MapType
private

Definition at line 34 of file EcalPreshowerSimHitsValidation.h.

Constructor & Destructor Documentation

◆ EcalPreshowerSimHitsValidation()

EcalPreshowerSimHitsValidation::EcalPreshowerSimHitsValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 18 of file EcalPreshowerSimHitsValidation.cc.

References EEHitsCollection, EEHitsToken, ESHitsCollection, ESHitsToken, g4InfoLabel, edm::ParameterSet::getUntrackedParameter(), HLT_2022v15_cff::InputTag, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

19  : g4InfoLabel(ps.getParameter<std::string>("moduleLabelG4")),
20  EEHitsCollection(ps.getParameter<std::string>("EEHitsCollection")),
21  ESHitsCollection(ps.getParameter<std::string>("ESHitsCollection")),
22  HepMCToken(consumes<edm::HepMCProduct>(ps.getParameter<edm::InputTag>("moduleLabelMC"))) {
23  EEHitsToken =
24  consumes<edm::PCaloHitContainer>(edm::InputTag(std::string(g4InfoLabel), std::string(EEHitsCollection)));
25  ESHitsToken =
26  consumes<edm::PCaloHitContainer>(edm::InputTag(std::string(g4InfoLabel), std::string(ESHitsCollection)));
27  // verbosity switch
28  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
29 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
edm::EDGetTokenT< edm::PCaloHitContainer > ESHitsToken

Member Function Documentation

◆ analyze()

void EcalPreshowerSimHitsValidation::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Analyze.

Reimplemented from DQMEDAnalyzer.

Definition at line 84 of file EcalPreshowerSimHitsValidation.cc.

References MillePedeFileConverter_cfg::e, EEHitsToken, ESHitsToken, dqm::impl::MonitorElement::Fill(), edm::HepMCProduct::GetEvent(), HepMCToken, mps_fire::i, createfilelist::int, edm::HandleBase::isValid(), dqm-mbProfile::log, LogDebug, me2eszmOver1eszm_, me2eszpOver1eszp_, meE1alphaE2zm_, meE1alphaE2zp_, meEEoverESzm_, meEEoverESzp_, meESEnergyHits1zm_, meESEnergyHits1zp_, meESEnergyHits2zm_, meESEnergyHits2zp_, meEShitLog10Energy_, meEShitLog10EnergyNorm_, menESHits1zm_, menESHits1zp_, menESHits2zm_, menESHits2zp_, AlCaHLTBitMon_ParallelJobs::p, and funct::tan().

84  {
85  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
86 
88  e.getByToken(HepMCToken, MCEvt);
89 
91  e.getByToken(EEHitsToken, EcalHitsEE);
92 
94  e.getByToken(ESHitsToken, EcalHitsES);
95 
96  std::vector<PCaloHit> theEECaloHits;
97  if (EcalHitsEE.isValid()) {
98  theEECaloHits.insert(theEECaloHits.end(), EcalHitsEE->begin(), EcalHitsEE->end());
99  }
100 
101  std::vector<PCaloHit> theESCaloHits;
102  if (EcalHitsES.isValid()) {
103  theESCaloHits.insert(theESCaloHits.end(), EcalHitsES->begin(), EcalHitsES->end());
104  }
105 
106  double ESEnergy_ = 0.;
107  // std::map<unsigned int, std::vector<PCaloHit>,std::less<unsigned int> >
108  // CaloHitMap;
109 
110  // endcap
111  double EEetzp_ = 0.;
112  double EEetzm_ = 0.;
113  for (std::vector<PCaloHit>::iterator isim = theEECaloHits.begin(); isim != theEECaloHits.end(); ++isim) {
114  EEDetId eeid(isim->id());
115  if (eeid.zside() > 0)
116  EEetzp_ += isim->energy();
117  if (eeid.zside() < 0)
118  EEetzm_ += isim->energy();
119  }
120 
121  uint32_t nESHits1zp = 0;
122  uint32_t nESHits1zm = 0;
123  uint32_t nESHits2zp = 0;
124  uint32_t nESHits2zm = 0;
125  double ESet1zp_ = 0.;
126  double ESet2zp_ = 0.;
127  double ESet1zm_ = 0.;
128  double ESet2zm_ = 0.;
129  std::vector<double> econtr(140, 0.);
130 
131  for (std::vector<PCaloHit>::iterator isim = theESCaloHits.begin(); isim != theESCaloHits.end(); ++isim) {
132  // CaloHitMap[(*isim).id()].push_back((*isim));
133 
134  ESDetId esid(isim->id());
135 
136  LogDebug("HitInfo") << " CaloHit " << isim->getName() << "\n"
137  << " DetID = " << isim->id() << " ESDetId: z side " << esid.zside() << " plane "
138  << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
139  << " Time = " << isim->time() << "\n"
140  << " Track Id = " << isim->geantTrackId() << "\n"
141  << " Energy = " << isim->energy();
142 
143  ESEnergy_ += isim->energy();
144  if (isim->energy() > 0) {
145  meEShitLog10Energy_->Fill(log10(isim->energy()));
146  int log10i = int((log10(isim->energy()) + 10.) * 10.);
147  if (log10i >= 0 && log10i < 140)
148  econtr[log10i] += isim->energy();
149  }
150 
151  if (esid.plane() == 1) {
152  if (esid.zside() > 0) {
153  nESHits1zp++;
154  ESet1zp_ += isim->energy();
155  meESEnergyHits1zp_->Fill(isim->energy());
156  } else if (esid.zside() < 0) {
157  nESHits1zm++;
158  ESet1zm_ += isim->energy();
159  meESEnergyHits1zm_->Fill(isim->energy());
160  }
161  } else if (esid.plane() == 2) {
162  if (esid.zside() > 0) {
163  nESHits2zp++;
164  ESet2zp_ += isim->energy();
165  meESEnergyHits2zp_->Fill(isim->energy());
166  } else if (esid.zside() < 0) {
167  nESHits2zm++;
168  ESet2zm_ += isim->energy();
169  meESEnergyHits2zm_->Fill(isim->energy());
170  }
171  }
172  }
173 
174  menESHits1zp_->Fill(nESHits1zp);
175  menESHits1zm_->Fill(nESHits1zm);
176 
177  menESHits2zp_->Fill(nESHits2zp);
178  menESHits2zm_->Fill(nESHits2zm);
179 
180  if (ESEnergy_ != 0) {
181  for (int i = 0; i < 140; i++) {
182  meEShitLog10EnergyNorm_->Fill(-10. + (float(i) + 0.5) / 10., econtr[i] / ESEnergy_);
183  }
184  }
185 
186  for (HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
187  p != MCEvt->GetEvent()->particles_end();
188  ++p) {
189  double htheta = (*p)->momentum().theta();
190  double heta = -99999.;
191  if (tan(htheta * 0.5) > 0) {
192  heta = -log(tan(htheta * 0.5));
193  }
194 
195  if (heta > 1.653 && heta < 2.6) {
196  meE1alphaE2zp_->Fill(ESet1zp_ + 0.7 * ESet2zp_);
197  meEEoverESzp_->Fill((ESet1zp_ + 0.7 * ESet2zp_) / 0.00009, EEetzp_);
198  if (ESet1zp_ != 0.)
199  me2eszpOver1eszp_->Fill(ESet2zp_ / ESet1zp_);
200  }
201  if (heta < -1.653 && heta > -2.6) {
202  meE1alphaE2zm_->Fill(ESet1zm_ + 0.7 * ESet2zm_);
203  meEEoverESzm_->Fill((ESet1zm_ + 0.7 * ESet2zm_) / 0.00009, EEetzm_);
204  if (ESet1zm_ != 0.)
205  me2eszmOver1eszm_->Fill(ESet2zm_ / ESet1zm_);
206  }
207  }
208 }
void Fill(long long x)
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
Log< level::Info, false > LogInfo
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< edm::PCaloHitContainer > EEHitsToken
edm::EDGetTokenT< edm::PCaloHitContainer > ESHitsToken
#define LogDebug(id)

◆ bookHistograms()

void EcalPreshowerSimHitsValidation::bookHistograms ( DQMStore::IBooker ib,
edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 31 of file EcalPreshowerSimHitsValidation.cc.

References timingPdfMaker::histo, cuy::ib, me2eszmOver1eszm_, me2eszpOver1eszp_, meE1alphaE2zm_, meE1alphaE2zp_, meEEoverESzm_, meEEoverESzp_, meESEnergyHits1zm_, meESEnergyHits1zp_, meESEnergyHits2zm_, meESEnergyHits2zp_, meEShitLog10Energy_, meEShitLog10EnergyNorm_, menESHits1zm_, menESHits1zp_, menESHits2zm_, menESHits2zp_, and AlCaHLTBitMon_QueryRunRegistry::string.

31  {
32  ib.setCurrentFolder("EcalHitsV/EcalSimHitsValidation");
33  ib.setScope(MonitorElementData::Scope::RUN);
34 
35  std::string histo = "ES hits layer 1 multiplicity z+";
36  menESHits1zp_ = ib.book1D(histo, histo, 50, 0., 50.);
37 
38  histo = "ES hits layer 2 multiplicity z+";
39  menESHits2zp_ = ib.book1D(histo, histo, 50, 0., 50.);
40 
41  histo = "ES hits layer 1 multiplicity z-";
42  menESHits1zm_ = ib.book1D(histo, histo, 50, 0., 50.);
43 
44  histo = "ES hits layer 2 multiplicity z-";
45  menESHits2zm_ = ib.book1D(histo, histo, 50, 0., 50.);
46 
47  histo = "ES hits energy layer 1 z+";
48  meESEnergyHits1zp_ = ib.book1D(histo, histo, 100, 0., 0.05);
49 
50  histo = "ES hits energy layer 2 z+";
51  meESEnergyHits2zp_ = ib.book1D(histo, histo, 100, 0., 0.05);
52 
53  histo = "ES hits energy layer 1 z-";
54  meESEnergyHits1zm_ = ib.book1D(histo, histo, 100, 0., 0.05);
55 
56  histo = "ES hits energy layer 2 z-";
57  meESEnergyHits2zm_ = ib.book1D(histo, histo, 100, 0., 0.05);
58 
59  histo = "ES hits log10energy spectrum";
60  meEShitLog10Energy_ = ib.book1D(histo, histo, 140, -10., 4.);
61 
62  histo = "ES hits log10energy spectrum vs normalized energy";
63  meEShitLog10EnergyNorm_ = ib.bookProfile(histo, histo, 140, -10., 4., 100, 0., 1.);
64 
65  histo = "ES E1+07E2 z+";
66  meE1alphaE2zp_ = ib.book1D(histo, histo, 100, 0., 0.05);
67 
68  histo = "ES E1+07E2 z-";
69  meE1alphaE2zm_ = ib.book1D(histo, histo, 100, 0., 0.05);
70 
71  histo = "EE vs ES z+";
72  meEEoverESzp_ = ib.bookProfile(histo, histo, 250, 0., 500., 200, 0., 200.);
73 
74  histo = "EE vs ES z-";
75  meEEoverESzm_ = ib.bookProfile(histo, histo, 250, 0., 500., 200, 0., 200.);
76 
77  histo = "ES ene2oEne1 z+";
78  me2eszpOver1eszp_ = ib.book1D(histo, histo, 50, 0., 10.);
79 
80  histo = "ES ene2oEne1 z-";
81  me2eszmOver1eszm_ = ib.book1D(histo, histo, 50, 0., 10.);
82 }
ib
Definition: cuy.py:661

Member Data Documentation

◆ EEHitsCollection

std::string EcalPreshowerSimHitsValidation::EEHitsCollection
private

Definition at line 48 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().

◆ EEHitsToken

edm::EDGetTokenT<edm::PCaloHitContainer> EcalPreshowerSimHitsValidation::EEHitsToken
private

Definition at line 52 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

◆ ESHitsCollection

std::string EcalPreshowerSimHitsValidation::ESHitsCollection
private

Definition at line 49 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().

◆ ESHitsToken

edm::EDGetTokenT<edm::PCaloHitContainer> EcalPreshowerSimHitsValidation::ESHitsToken
private

Definition at line 53 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and EcalPreshowerSimHitsValidation().

◆ g4InfoLabel

std::string EcalPreshowerSimHitsValidation::g4InfoLabel
private

Definition at line 47 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().

◆ HepMCToken

edm::EDGetTokenT<edm::HepMCProduct> EcalPreshowerSimHitsValidation::HepMCToken
private

Definition at line 51 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze().

◆ me2eszmOver1eszm_

MonitorElement* EcalPreshowerSimHitsValidation::me2eszmOver1eszm_
private

Definition at line 79 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ me2eszpOver1eszp_

MonitorElement* EcalPreshowerSimHitsValidation::me2eszpOver1eszp_
private

Definition at line 78 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meE1alphaE2zm_

MonitorElement* EcalPreshowerSimHitsValidation::meE1alphaE2zm_
private

Definition at line 73 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meE1alphaE2zp_

MonitorElement* EcalPreshowerSimHitsValidation::meE1alphaE2zp_
private

Definition at line 72 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meEEoverESzm_

MonitorElement* EcalPreshowerSimHitsValidation::meEEoverESzm_
private

Definition at line 76 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meEEoverESzp_

MonitorElement* EcalPreshowerSimHitsValidation::meEEoverESzp_
private

Definition at line 75 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meESEnergyHits1zm_

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits1zm_
private

Definition at line 69 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meESEnergyHits1zp_

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits1zp_
private

Definition at line 66 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meESEnergyHits2zm_

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits2zm_
private

Definition at line 70 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meESEnergyHits2zp_

MonitorElement* EcalPreshowerSimHitsValidation::meESEnergyHits2zp_
private

Definition at line 67 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meEShitLog10Energy_

MonitorElement* EcalPreshowerSimHitsValidation::meEShitLog10Energy_
private

Definition at line 63 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ meEShitLog10EnergyNorm_

MonitorElement* EcalPreshowerSimHitsValidation::meEShitLog10EnergyNorm_
private

Definition at line 64 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ menESHits1zm_

MonitorElement* EcalPreshowerSimHitsValidation::menESHits1zm_
private

Definition at line 60 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ menESHits1zp_

MonitorElement* EcalPreshowerSimHitsValidation::menESHits1zp_
private

Definition at line 57 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ menESHits2zm_

MonitorElement* EcalPreshowerSimHitsValidation::menESHits2zm_
private

Definition at line 61 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ menESHits2zp_

MonitorElement* EcalPreshowerSimHitsValidation::menESHits2zp_
private

Definition at line 58 of file EcalPreshowerSimHitsValidation.h.

Referenced by analyze(), and bookHistograms().

◆ verbose_

bool EcalPreshowerSimHitsValidation::verbose_
private

Definition at line 55 of file EcalPreshowerSimHitsValidation.h.

Referenced by EcalPreshowerSimHitsValidation().