CMS 3D CMS Logo

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

#include <EcalDigisValidation.h>

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

Public Member Functions

void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 EcalDigisValidation (const edm::ParameterSet &ps)
 Constructor. More...
 
 ~EcalDigisValidation () override
 Destructor. 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
 
 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 (edm::Event const &e, edm::EventSetup const &c) override
 Analyze. More...
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) 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 Member Functions

void checkCalibrations (edm::EventSetup const &c)
 

Private Attributes

double barrelADCtoGeV_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
 
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
 
edm::EDGetTokenT< EBDigiCollectionEBdigiCollectionToken_
 
edm::EDGetTokenT< EEDigiCollectionEEdigiCollectionToken_
 
double endcapADCtoGeV_
 
edm::EDGetTokenT< ESDigiCollectionESdigiCollectionToken_
 
edm::EDGetTokenT< edm::SimTrackContainerg4TkInfoToken_
 
edm::EDGetTokenT< edm::SimVertexContainerg4VtxInfoToken_
 
std::map< int, double, std::less< int > > gainConv_
 
edm::EDGetTokenT< edm::HepMCProductHepMCToken_
 
MonitorElementmeEBDigiSimRatio_
 
MonitorElementmeEBDigiSimRatiogt100ADC_
 
MonitorElementmeEBDigiSimRatiogt10ADC_
 
MonitorElementmeEEDigiSimRatio_
 
MonitorElementmeEEDigiSimRatiogt100ADC_
 
MonitorElementmeEEDigiSimRatiogt20ADC_
 
MonitorElementmeGunEnergy_
 
MonitorElementmeGunEta_
 
MonitorElementmeGunPhi_
 
std::string outputFile_
 
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcdpAgc
 
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 47 of file EcalDigisValidation.h.

Member Typedef Documentation

◆ MapType

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

Definition at line 48 of file EcalDigisValidation.h.

Constructor & Destructor Documentation

◆ EcalDigisValidation()

EcalDigisValidation::EcalDigisValidation ( const edm::ParameterSet ps)

Constructor.

Definition at line 14 of file EcalDigisValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, gainConv_, edm::ParameterSet::getUntrackedParameter(), meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, outputFile_, AlCaHLTBitMon_QueryRunRegistry::string, and verbose_.

15  : HepMCToken_(consumes<edm::HepMCProduct>(edm::InputTag(ps.getParameter<std::string>("moduleLabelMC")))),
16  g4TkInfoToken_(consumes<edm::SimTrackContainer>(edm::InputTag(ps.getParameter<std::string>("moduleLabelG4")))),
17  g4VtxInfoToken_(consumes<edm::SimVertexContainer>(edm::InputTag(ps.getParameter<std::string>("moduleLabelG4")))),
18  EBdigiCollectionToken_(consumes<EBDigiCollection>(ps.getParameter<edm::InputTag>("EBdigiCollection"))),
19  EEdigiCollectionToken_(consumes<EEDigiCollection>(ps.getParameter<edm::InputTag>("EEdigiCollection"))),
20  ESdigiCollectionToken_(consumes<ESDigiCollection>(ps.getParameter<edm::InputTag>("ESdigiCollection"))),
21  pAgc(esConsumes<edm::Transition::BeginRun>()),
23  std::string("mix"), ps.getParameter<std::string>("moduleLabelG4") + std::string("EcalHitsEB")))),
25  std::string("mix"), ps.getParameter<std::string>("moduleLabelG4") + std::string("EcalHitsEE")))),
27  std::string("mix"), ps.getParameter<std::string>("moduleLabelG4") + std::string("EcalHitsES")))) {
28  // DQM ROOT output
29  outputFile_ = ps.getUntrackedParameter<std::string>("outputFile", "");
30 
31  if (!outputFile_.empty()) {
32  edm::LogInfo("OutputInfo") << " Ecal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
33  } else {
34  edm::LogInfo("OutputInfo") << " Ecal Digi Task histograms will NOT be saved";
35  }
36 
37  // verbosity switch
38  verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
39 
40  gainConv_[1] = 1.;
41  gainConv_[2] = 2.;
42  gainConv_[3] = 12.;
43  gainConv_[0] = 12.; // saturated channels
44  barrelADCtoGeV_ = 0.035;
45  endcapADCtoGeV_ = 0.06;
46 
47  meGunEnergy_ = nullptr;
48  meGunEta_ = nullptr;
49  meGunPhi_ = nullptr;
50 
51  meEBDigiSimRatio_ = nullptr;
52  meEEDigiSimRatio_ = nullptr;
53 
54  meEBDigiSimRatiogt10ADC_ = nullptr;
55  meEEDigiSimRatiogt20ADC_ = nullptr;
56 
57  meEBDigiSimRatiogt100ADC_ = nullptr;
58  meEEDigiSimRatiogt100ADC_ = nullptr;
59 }
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
MonitorElement * meEEDigiSimRatiogt100ADC_
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meGunEnergy_
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
MonitorElement * meGunEta_
Log< level::Info, false > LogInfo
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
MonitorElement * meEEDigiSimRatio_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
MonitorElement * meGunPhi_
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_

◆ ~EcalDigisValidation()

EcalDigisValidation::~EcalDigisValidation ( )
override

Destructor.

Definition at line 61 of file EcalDigisValidation.cc.

61 {}

Member Function Documentation

◆ analyze()

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

Analyze.

Reimplemented from DQMEDAnalyzer.

Definition at line 98 of file EcalDigisValidation.cc.

References funct::abs(), barrelADCtoGeV_, HLT_2024v12_cff::barrelHits, crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, MillePedeFileConverter_cfg::e, EBdigiCollectionToken_, EEdigiCollectionToken_, edm::DataFrameContainer::empty(), endcapADCtoGeV_, HLT_2024v12_cff::endcapHits, ESdigiCollectionToken_, dqm::impl::MonitorElement::Fill(), g4TkInfoToken_, g4VtxInfoToken_, gainConv_, edm::HepMCProduct::GetEvent(), HepMCToken_, EEDataFrame::id(), EBDataFrame::id(), EBDetId::ieta(), createfilelist::int, EBDetId::iphi(), PixelPluginsPhase0_cfi::isBarrel, GeomDetEnumerators::isEndcap(), edm::HandleBase::isValid(), EEDetId::ix(), EEDetId::iy(), dqm-mbProfile::log, LogDebug, M_PI, EcalDataFrame::MAXSAMPLES, meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, ecalTB2006H4_GenSimDigiReco_cfg::mySample, AlCaHLTBitMon_ParallelJobs::p, ESDetId::plane(), ElectronMcFakeValidator_cfi::Pmax, gedPhotons_cfi::preshowerHits, edm::Handle< T >::product(), DetId::rawId(), edm::DataFrameContainer::reserve(), ecalGpuTask_cfi::sample, ESDetId::six(), ESDetId::siy(), EcalDataFrame::size(), edm::DataFrameContainer::size(), ESDetId::strip(), funct::tan(), ESDetId::zside(), and EEDetId::zside().

98  {
99  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
100 
101  std::vector<SimTrack> theSimTracks;
102  std::vector<SimVertex> theSimVertexes;
103 
107  edm::Handle<CrossingFrame<PCaloHit> > crossingFrame;
111 
112  bool skipMC = false;
113  e.getByToken(HepMCToken_, MCEvt);
114  if (!MCEvt.isValid()) {
115  skipMC = true;
116  }
117  e.getByToken(g4TkInfoToken_, SimTk);
118  e.getByToken(g4VtxInfoToken_, SimVtx);
119 
120  const EBDigiCollection* EBdigis = nullptr;
121  const EEDigiCollection* EEdigis = nullptr;
122  const ESDigiCollection* ESdigis = nullptr;
123 
124  bool isBarrel = true;
125  e.getByToken(EBdigiCollectionToken_, EcalDigiEB);
126  if (EcalDigiEB.isValid()) {
127  EBdigis = EcalDigiEB.product();
128  LogDebug("DigiInfo") << "total # EBdigis: " << EBdigis->size();
129  if (EBdigis->empty())
130  isBarrel = false;
131  } else {
132  isBarrel = false;
133  }
134 
135  bool isEndcap = true;
136  e.getByToken(EEdigiCollectionToken_, EcalDigiEE);
137  if (EcalDigiEE.isValid()) {
138  EEdigis = EcalDigiEE.product();
139  LogDebug("DigiInfo") << "total # EEdigis: " << EEdigis->size();
140  if (EEdigis->empty())
141  isEndcap = false;
142  } else {
143  isEndcap = false;
144  }
145 
146  bool isPreshower = true;
147  e.getByToken(ESdigiCollectionToken_, EcalDigiES);
148  if (EcalDigiES.isValid()) {
149  ESdigis = EcalDigiES.product();
150  LogDebug("DigiInfo") << "total # ESdigis: " << ESdigis->size();
151  if (ESdigis->empty())
152  isPreshower = false;
153  } else {
154  isPreshower = false;
155  }
156 
157  theSimTracks.insert(theSimTracks.end(), SimTk->begin(), SimTk->end());
158  theSimVertexes.insert(theSimVertexes.end(), SimVtx->begin(), SimVtx->end());
159 
160  if (!skipMC) {
161  double theGunEnergy = 0.;
162  for (HepMC::GenEvent::particle_const_iterator p = MCEvt->GetEvent()->particles_begin();
163  p != MCEvt->GetEvent()->particles_end();
164  ++p) {
165  theGunEnergy = (*p)->momentum().e();
166  double htheta = (*p)->momentum().theta();
167  double heta = -log(tan(htheta * 0.5));
168  double hphi = (*p)->momentum().phi();
169  hphi = (hphi >= 0) ? hphi : hphi + 2 * M_PI;
170  hphi = hphi / M_PI * 180.;
171  LogDebug("EventInfo") << "Particle gun type form MC = " << abs((*p)->pdg_id()) << "\n"
172  << "Energy = " << (*p)->momentum().e() << " Eta = " << heta << " Phi = " << hphi;
173 
174  if (meGunEnergy_)
175  meGunEnergy_->Fill(theGunEnergy);
176  if (meGunEta_)
177  meGunEta_->Fill(heta);
178  if (meGunPhi_)
179  meGunPhi_->Fill(hphi);
180  }
181  }
182 
183  int nvtx = 0;
184  for (std::vector<SimVertex>::iterator isimvtx = theSimVertexes.begin(); isimvtx != theSimVertexes.end(); ++isimvtx) {
185  LogDebug("EventInfo") << " Vertex index = " << nvtx << " event Id = " << isimvtx->eventId().rawId() << "\n"
186  << " vertex dump: " << *isimvtx;
187  ++nvtx;
188  }
189 
190  int ntrk = 0;
191  for (std::vector<SimTrack>::iterator isimtrk = theSimTracks.begin(); isimtrk != theSimTracks.end(); ++isimtrk) {
192  LogDebug("EventInfo") << " Track index = " << ntrk << " track Id = " << isimtrk->trackId()
193  << " event Id = " << isimtrk->eventId().rawId() << "\n"
194  << " track dump: " << *isimtrk;
195  ++ntrk;
196  }
197 
198  // BARREL
199 
200  // loop over simHits
201 
202  if (isBarrel) {
203  e.getByToken(crossingFramePCaloHitEBToken_, crossingFrame);
204  const MixCollection<PCaloHit> barrelHits(crossingFrame.product());
205 
206  MapType ebSimMap;
207  for (auto const& iHit : barrelHits) {
208  EBDetId ebid = EBDetId(iHit.id());
209 
210  LogDebug("HitInfo") << " CaloHit " << iHit.getName() << "\n"
211  << " DetID = " << iHit.id() << " EBDetId = " << ebid.ieta() << " " << ebid.iphi() << "\n"
212  << " Time = " << iHit.time() << " Event id. = " << iHit.eventId().rawId() << "\n"
213  << " Track Id = " << iHit.geantTrackId() << "\n"
214  << " Energy = " << iHit.energy();
215 
216  uint32_t crystid = ebid.rawId();
217  ebSimMap[crystid] += iHit.energy();
218  }
219 
220  // loop over Digis
221 
222  const EBDigiCollection* barrelDigi = EcalDigiEB.product();
223 
224  std::vector<double> ebAnalogSignal;
225  std::vector<double> ebADCCounts;
226  std::vector<double> ebADCGains;
227  ebAnalogSignal.reserve(EBDataFrame::MAXSAMPLES);
228  ebADCCounts.reserve(EBDataFrame::MAXSAMPLES);
229  ebADCGains.reserve(EBDataFrame::MAXSAMPLES);
230 
231  for (unsigned int digis = 0; digis < EcalDigiEB->size(); ++digis) {
232  EBDataFrame ebdf = (*barrelDigi)[digis];
233  int nrSamples = ebdf.size();
234 
235  EBDetId ebid = ebdf.id();
236 
237  double Emax = 0.;
238  int Pmax = 0;
239  double pedestalPreSampleAnalog = 0.;
240 
241  for (int sample = 0; sample < nrSamples; ++sample) {
242  ebAnalogSignal[sample] = 0.;
243  ebADCCounts[sample] = 0.;
244  ebADCGains[sample] = -1.;
245  }
246 
247  for (int sample = 0; sample < nrSamples; ++sample) {
249 
250  ebADCCounts[sample] = (mySample.adc());
251  ebADCGains[sample] = (mySample.gainId());
252  ebAnalogSignal[sample] = (ebADCCounts[sample] * gainConv_[(int)ebADCGains[sample]] * barrelADCtoGeV_);
253  if (Emax < ebAnalogSignal[sample]) {
254  Emax = ebAnalogSignal[sample];
255  Pmax = sample;
256  }
257  if (sample < 3) {
258  pedestalPreSampleAnalog += ebADCCounts[sample] * gainConv_[(int)ebADCGains[sample]] * barrelADCtoGeV_;
259  }
260  LogDebug("DigiInfo") << "EB sample " << sample << " ADC counts = " << ebADCCounts[sample]
261  << " Gain Id = " << ebADCGains[sample] << " Analog eq = " << ebAnalogSignal[sample];
262  }
263 
264  pedestalPreSampleAnalog /= 3.;
265  double Erec = Emax - pedestalPreSampleAnalog * gainConv_[(int)ebADCGains[Pmax]];
266 
267  if (ebSimMap[ebid.rawId()] != 0.) {
268  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << ebSimMap[ebid.rawId()] << " gainConv "
269  << gainConv_[(int)ebADCGains[Pmax]];
270  if (meEBDigiSimRatio_)
271  meEBDigiSimRatio_->Fill(Erec / ebSimMap[ebid.rawId()]);
272  if (Erec > 10. * barrelADCtoGeV_ && meEBDigiSimRatiogt10ADC_)
273  meEBDigiSimRatiogt10ADC_->Fill(Erec / ebSimMap[ebid.rawId()]);
274  if (Erec > 100. * barrelADCtoGeV_ && meEBDigiSimRatiogt100ADC_)
275  meEBDigiSimRatiogt100ADC_->Fill(Erec / ebSimMap[ebid.rawId()]);
276  }
277  }
278  }
279 
280  // ENDCAP
281 
282  // loop over simHits
283 
284  if (isEndcap) {
285  e.getByToken(crossingFramePCaloHitEEToken_, crossingFrame);
286  const MixCollection<PCaloHit> endcapHits(crossingFrame.product());
287 
288  MapType eeSimMap;
289  for (auto const& iHit : endcapHits) {
290  EEDetId eeid = EEDetId(iHit.id());
291 
292  LogDebug("HitInfo") << " CaloHit " << iHit.getName() << "\n"
293  << " DetID = " << iHit.id() << " EEDetId side = " << eeid.zside() << " = " << eeid.ix() << " "
294  << eeid.iy() << "\n"
295  << " Time = " << iHit.time() << " Event id. = " << iHit.eventId().rawId() << "\n"
296  << " Track Id = " << iHit.geantTrackId() << "\n"
297  << " Energy = " << iHit.energy();
298 
299  uint32_t crystid = eeid.rawId();
300  eeSimMap[crystid] += iHit.energy();
301  }
302 
303  // loop over Digis
304 
305  const EEDigiCollection* endcapDigi = EcalDigiEE.product();
306 
307  std::vector<double> eeAnalogSignal;
308  std::vector<double> eeADCCounts;
309  std::vector<double> eeADCGains;
310  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
311  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
312  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
313 
314  for (unsigned int digis = 0; digis < EcalDigiEE->size(); ++digis) {
315  EEDataFrame eedf = (*endcapDigi)[digis];
316  int nrSamples = eedf.size();
317 
318  EEDetId eeid = eedf.id();
319 
320  double Emax = 0.;
321  int Pmax = 0;
322  double pedestalPreSampleAnalog = 0.;
323 
324  for (int sample = 0; sample < nrSamples; ++sample) {
325  eeAnalogSignal[sample] = 0.;
326  eeADCCounts[sample] = 0.;
327  eeADCGains[sample] = -1.;
328  }
329 
330  for (int sample = 0; sample < nrSamples; ++sample) {
332 
333  eeADCCounts[sample] = (mySample.adc());
334  eeADCGains[sample] = (mySample.gainId());
335  eeAnalogSignal[sample] = (eeADCCounts[sample] * gainConv_[(int)eeADCGains[sample]] * endcapADCtoGeV_);
336  if (Emax < eeAnalogSignal[sample]) {
337  Emax = eeAnalogSignal[sample];
338  Pmax = sample;
339  }
340  if (sample < 3) {
341  pedestalPreSampleAnalog += eeADCCounts[sample] * gainConv_[(int)eeADCGains[sample]] * endcapADCtoGeV_;
342  }
343  LogDebug("DigiInfo") << "EE sample " << sample << " ADC counts = " << eeADCCounts[sample]
344  << " Gain Id = " << eeADCGains[sample] << " Analog eq = " << eeAnalogSignal[sample];
345  }
346  pedestalPreSampleAnalog /= 3.;
347  double Erec = Emax - pedestalPreSampleAnalog * gainConv_[(int)eeADCGains[Pmax]];
348 
349  if (eeSimMap[eeid.rawId()] != 0.) {
350  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << eeSimMap[eeid.rawId()] << " gainConv "
351  << gainConv_[(int)eeADCGains[Pmax]];
352  if (meEEDigiSimRatio_)
353  meEEDigiSimRatio_->Fill(Erec / eeSimMap[eeid.rawId()]);
354  if (Erec > 20. * endcapADCtoGeV_ && meEEDigiSimRatiogt20ADC_)
355  meEEDigiSimRatiogt20ADC_->Fill(Erec / eeSimMap[eeid.rawId()]);
356  if (Erec > 100. * endcapADCtoGeV_ && meEEDigiSimRatiogt100ADC_)
357  meEEDigiSimRatiogt100ADC_->Fill(Erec / eeSimMap[eeid.rawId()]);
358  }
359  }
360  }
361 
362  if (isPreshower) {
363  e.getByToken(crossingFramePCaloHitESToken_, crossingFrame);
364  const MixCollection<PCaloHit> preshowerHits(crossingFrame.product());
365  for (auto const& iHit : preshowerHits) {
366  ESDetId esid = ESDetId(iHit.id());
367 
368  LogDebug("HitInfo") << " CaloHit " << iHit.getName() << "\n"
369  << " DetID = " << iHit.id() << "ESDetId: z side " << esid.zside() << " plane "
370  << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
371  << " Time = " << iHit.time() << " Event id. = " << iHit.eventId().rawId() << "\n"
372  << " Track Id = " << iHit.geantTrackId() << "\n"
373  << " Energy = " << iHit.energy();
374  }
375  }
376 }
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitESToken_
std::map< uint32_t, float, std::less< uint32_t > > MapType
edm::EDGetTokenT< EBDigiCollection > EBdigiCollectionToken_
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
T const * product() const
Definition: Handle.h:70
int ix() const
Definition: EEDetId.h:77
edm::EDGetTokenT< edm::SimVertexContainer > g4VtxInfoToken_
key_type id() const
Definition: EBDataFrame.h:28
int zside() const
Definition: ESDetId.h:39
MonitorElement * meEEDigiSimRatiogt100ADC_
key_type id() const
Definition: EEDataFrame.h:24
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meGunEnergy_
int size() const
Definition: EcalDataFrame.h:26
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
void Fill(long long x)
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
int plane() const
Definition: ESDetId.h:41
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MonitorElement * meGunEta_
bool isEndcap(GeomDetEnumerators::SubDetector m)
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:37
#define M_PI
void reserve(size_t isize)
Log< level::Info, false > LogInfo
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEEToken_
int zside() const
Definition: EEDetId.h:71
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
int siy() const
Definition: ESDetId.h:45
MonitorElement * meEEDigiSimRatio_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< CrossingFrame< PCaloHit > > crossingFramePCaloHitEBToken_
int six() const
Definition: ESDetId.h:43
int strip() const
Definition: ESDetId.h:47
MonitorElement * meGunPhi_
edm::EDGetTokenT< ESDigiCollection > ESdigiCollectionToken_
MonitorElement * meEEDigiSimRatiogt20ADC_
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
edm::EDGetTokenT< edm::HepMCProduct > HepMCToken_
MonitorElement * meEBDigiSimRatiogt100ADC_
edm::EDGetTokenT< edm::SimTrackContainer > g4TkInfoToken_
int iy() const
Definition: EEDetId.h:83
#define LogDebug(id)

◆ bookHistograms()

void EcalDigisValidation::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 65 of file EcalDigisValidation.cc.

References dqm::implementation::IBooker::book1D(), timingPdfMaker::histo, meEBDigiSimRatio_, meEBDigiSimRatiogt100ADC_, meEBDigiSimRatiogt10ADC_, meEEDigiSimRatio_, meEEDigiSimRatiogt100ADC_, meEEDigiSimRatiogt20ADC_, meGunEnergy_, meGunEta_, meGunPhi_, and dqm::implementation::NavigatorBase::setCurrentFolder().

65  {
66  Char_t histo[200];
67 
68  ibooker.setCurrentFolder("EcalDigisV/EcalDigiTask");
69 
70  sprintf(histo, "EcalDigiTask Gun Momentum");
71  meGunEnergy_ = ibooker.book1D(histo, histo, 100, 0., 1000.);
72 
73  sprintf(histo, "EcalDigiTask Gun Eta");
74  meGunEta_ = ibooker.book1D(histo, histo, 700, -3.5, 3.5);
75 
76  sprintf(histo, "EcalDigiTask Gun Phi");
77  meGunPhi_ = ibooker.book1D(histo, histo, 360, 0., 360.);
78 
79  sprintf(histo, "EcalDigiTask Barrel maximum Digi over Sim ratio");
80  meEBDigiSimRatio_ = ibooker.book1D(histo, histo, 100, 0., 2.);
81 
82  sprintf(histo, "EcalDigiTask Endcap maximum Digi over Sim ratio");
83  meEEDigiSimRatio_ = ibooker.book1D(histo, histo, 100, 0., 2.);
84 
85  sprintf(histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 10 ADC");
86  meEBDigiSimRatiogt10ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.);
87 
88  sprintf(histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 20 ADC");
89  meEEDigiSimRatiogt20ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.);
90 
91  sprintf(histo, "EcalDigiTask Barrel maximum Digi over Sim ratio gt 100 ADC");
92  meEBDigiSimRatiogt100ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.);
93 
94  sprintf(histo, "EcalDigiTask Endcap maximum Digi over Sim ratio gt 100 ADC");
95  meEEDigiSimRatiogt100ADC_ = ibooker.book1D(histo, histo, 100, 0., 2.);
96 }
MonitorElement * meEEDigiSimRatiogt100ADC_
MonitorElement * meGunEnergy_
MonitorElement * meEBDigiSimRatiogt10ADC_
MonitorElement * meEBDigiSimRatio_
MonitorElement * meGunEta_
MonitorElement * meEEDigiSimRatio_
MonitorElement * meGunPhi_
MonitorElement * meEEDigiSimRatiogt20ADC_
MonitorElement * meEBDigiSimRatiogt100ADC_

◆ checkCalibrations()

void EcalDigisValidation::checkCalibrations ( edm::EventSetup const &  c)
private

Definition at line 378 of file EcalDigisValidation.cc.

References barrelADCtoGeV_, endcapADCtoGeV_, options_cfi::eventSetup, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), gainConv_, EcalADCToGeVConstant::getEBValue(), EcalADCToGeVConstant::getEEValue(), LogDebug, and pAgc.

Referenced by dqmBeginRun().

378  {
379  // ADC -> GeV Scale
380  const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc);
381 
382  EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio();
383 
384  gainConv_[1] = 1.;
385  gainConv_[2] = defaultRatios->gain12Over6();
386  gainConv_[3] = gainConv_[2] * (defaultRatios->gain6Over1());
387  gainConv_[0] = gainConv_[2] * (defaultRatios->gain6Over1()); // saturated channels
388 
389  LogDebug("EcalDigi") << " Gains conversions: "
390  << "\n"
391  << " g1 = " << gainConv_[1] << "\n"
392  << " g2 = " << gainConv_[2] << "\n"
393  << " g3 = " << gainConv_[3];
394  LogDebug("EcalDigi") << " Gains conversions: "
395  << "\n"
396  << " saturation = " << gainConv_[0];
397 
398  delete defaultRatios;
399 
400  const double barrelADCtoGeV_ = agc->getEBValue();
401  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
402  const double endcapADCtoGeV_ = agc->getEEValue();
403  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
404 }
std::map< int, double, std::less< int > > gainConv_
float gain12Over6() const
float gain6Over1() const
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
#define LogDebug(id)

◆ dqmBeginRun()

void EcalDigisValidation::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &  c 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 63 of file EcalDigisValidation.cc.

References HltBtagPostValidation_cff::c, and checkCalibrations().

Member Data Documentation

◆ barrelADCtoGeV_

double EcalDigisValidation::barrelADCtoGeV_
private

Definition at line 85 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

◆ crossingFramePCaloHitEBToken_

edm::EDGetTokenT<CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitEBToken_
private

Definition at line 80 of file EcalDigisValidation.h.

Referenced by analyze().

◆ crossingFramePCaloHitEEToken_

edm::EDGetTokenT<CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitEEToken_
private

Definition at line 80 of file EcalDigisValidation.h.

Referenced by analyze().

◆ crossingFramePCaloHitESToken_

edm::EDGetTokenT<CrossingFrame<PCaloHit> > EcalDigisValidation::crossingFramePCaloHitESToken_
private

Definition at line 80 of file EcalDigisValidation.h.

Referenced by analyze().

◆ EBdigiCollectionToken_

edm::EDGetTokenT<EBDigiCollection> EcalDigisValidation::EBdigiCollectionToken_
private

Definition at line 75 of file EcalDigisValidation.h.

Referenced by analyze().

◆ EEdigiCollectionToken_

edm::EDGetTokenT<EEDigiCollection> EcalDigisValidation::EEdigiCollectionToken_
private

Definition at line 76 of file EcalDigisValidation.h.

Referenced by analyze().

◆ endcapADCtoGeV_

double EcalDigisValidation::endcapADCtoGeV_
private

Definition at line 86 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

◆ ESdigiCollectionToken_

edm::EDGetTokenT<ESDigiCollection> EcalDigisValidation::ESdigiCollectionToken_
private

Definition at line 77 of file EcalDigisValidation.h.

Referenced by analyze().

◆ g4TkInfoToken_

edm::EDGetTokenT<edm::SimTrackContainer> EcalDigisValidation::g4TkInfoToken_
private

Definition at line 72 of file EcalDigisValidation.h.

Referenced by analyze().

◆ g4VtxInfoToken_

edm::EDGetTokenT<edm::SimVertexContainer> EcalDigisValidation::g4VtxInfoToken_
private

Definition at line 73 of file EcalDigisValidation.h.

Referenced by analyze().

◆ gainConv_

std::map<int, double, std::less<int> > EcalDigisValidation::gainConv_
private

Definition at line 83 of file EcalDigisValidation.h.

Referenced by analyze(), checkCalibrations(), and EcalDigisValidation().

◆ HepMCToken_

edm::EDGetTokenT<edm::HepMCProduct> EcalDigisValidation::HepMCToken_
private

Definition at line 71 of file EcalDigisValidation.h.

Referenced by analyze().

◆ meEBDigiSimRatio_

MonitorElement* EcalDigisValidation::meEBDigiSimRatio_
private

Definition at line 92 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meEBDigiSimRatiogt100ADC_

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt100ADC_
private

Definition at line 98 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meEBDigiSimRatiogt10ADC_

MonitorElement* EcalDigisValidation::meEBDigiSimRatiogt10ADC_
private

Definition at line 95 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meEEDigiSimRatio_

MonitorElement* EcalDigisValidation::meEEDigiSimRatio_
private

Definition at line 93 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meEEDigiSimRatiogt100ADC_

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt100ADC_
private

Definition at line 99 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meEEDigiSimRatiogt20ADC_

MonitorElement* EcalDigisValidation::meEEDigiSimRatiogt20ADC_
private

Definition at line 96 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meGunEnergy_

MonitorElement* EcalDigisValidation::meGunEnergy_
private

Definition at line 88 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meGunEta_

MonitorElement* EcalDigisValidation::meGunEta_
private

Definition at line 89 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ meGunPhi_

MonitorElement* EcalDigisValidation::meGunPhi_
private

Definition at line 90 of file EcalDigisValidation.h.

Referenced by analyze(), bookHistograms(), and EcalDigisValidation().

◆ outputFile_

std::string EcalDigisValidation::outputFile_
private

Definition at line 69 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation().

◆ pAgc

edm::ESGetToken<EcalADCToGeVConstant, EcalADCToGeVConstantRcd> EcalDigisValidation::pAgc
private

Definition at line 78 of file EcalDigisValidation.h.

Referenced by checkCalibrations().

◆ verbose_

bool EcalDigisValidation::verbose_
private

Definition at line 67 of file EcalDigisValidation.h.

Referenced by EcalDigisValidation().