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:303
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_2022v11_cff::barrelHits, crossingFramePCaloHitEBToken_, crossingFramePCaloHitEEToken_, crossingFramePCaloHitESToken_, MillePedeFileConverter_cfg::e, EBdigiCollectionToken_, EEdigiCollectionToken_, edm::DataFrameContainer::empty(), endcapADCtoGeV_, HLT_2022v11_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(), dataAnalyzerFineBiningParameters_cff::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 pedestalPreSample = 0.;
240  double pedestalPreSampleAnalog = 0.;
241 
242  for (int sample = 0; sample < nrSamples; ++sample) {
243  ebAnalogSignal[sample] = 0.;
244  ebADCCounts[sample] = 0.;
245  ebADCGains[sample] = -1.;
246  }
247 
248  for (int sample = 0; sample < nrSamples; ++sample) {
250 
251  ebADCCounts[sample] = (mySample.adc());
252  ebADCGains[sample] = (mySample.gainId());
253  ebAnalogSignal[sample] = (ebADCCounts[sample] * gainConv_[(int)ebADCGains[sample]] * barrelADCtoGeV_);
254  if (Emax < ebAnalogSignal[sample]) {
255  Emax = ebAnalogSignal[sample];
256  Pmax = sample;
257  }
258  if (sample < 3) {
259  pedestalPreSample += ebADCCounts[sample];
260  pedestalPreSampleAnalog += ebADCCounts[sample] * gainConv_[(int)ebADCGains[sample]] * barrelADCtoGeV_;
261  }
262  LogDebug("DigiInfo") << "EB sample " << sample << " ADC counts = " << ebADCCounts[sample]
263  << " Gain Id = " << ebADCGains[sample] << " Analog eq = " << ebAnalogSignal[sample];
264  }
265 
266  pedestalPreSample /= 3.;
267  pedestalPreSampleAnalog /= 3.;
268  double Erec = Emax - pedestalPreSampleAnalog * gainConv_[(int)ebADCGains[Pmax]];
269 
270  if (ebSimMap[ebid.rawId()] != 0.) {
271  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << ebSimMap[ebid.rawId()] << " gainConv "
272  << gainConv_[(int)ebADCGains[Pmax]];
273  if (meEBDigiSimRatio_)
274  meEBDigiSimRatio_->Fill(Erec / ebSimMap[ebid.rawId()]);
275  if (Erec > 10. * barrelADCtoGeV_ && meEBDigiSimRatiogt10ADC_)
276  meEBDigiSimRatiogt10ADC_->Fill(Erec / ebSimMap[ebid.rawId()]);
277  if (Erec > 100. * barrelADCtoGeV_ && meEBDigiSimRatiogt100ADC_)
278  meEBDigiSimRatiogt100ADC_->Fill(Erec / ebSimMap[ebid.rawId()]);
279  }
280  }
281  }
282 
283  // ENDCAP
284 
285  // loop over simHits
286 
287  if (isEndcap) {
288  e.getByToken(crossingFramePCaloHitEEToken_, crossingFrame);
289  const MixCollection<PCaloHit> endcapHits(crossingFrame.product());
290 
291  MapType eeSimMap;
292  for (auto const& iHit : endcapHits) {
293  EEDetId eeid = EEDetId(iHit.id());
294 
295  LogDebug("HitInfo") << " CaloHit " << iHit.getName() << "\n"
296  << " DetID = " << iHit.id() << " EEDetId side = " << eeid.zside() << " = " << eeid.ix() << " "
297  << eeid.iy() << "\n"
298  << " Time = " << iHit.time() << " Event id. = " << iHit.eventId().rawId() << "\n"
299  << " Track Id = " << iHit.geantTrackId() << "\n"
300  << " Energy = " << iHit.energy();
301 
302  uint32_t crystid = eeid.rawId();
303  eeSimMap[crystid] += iHit.energy();
304  }
305 
306  // loop over Digis
307 
308  const EEDigiCollection* endcapDigi = EcalDigiEE.product();
309 
310  std::vector<double> eeAnalogSignal;
311  std::vector<double> eeADCCounts;
312  std::vector<double> eeADCGains;
313  eeAnalogSignal.reserve(EEDataFrame::MAXSAMPLES);
314  eeADCCounts.reserve(EEDataFrame::MAXSAMPLES);
315  eeADCGains.reserve(EEDataFrame::MAXSAMPLES);
316 
317  for (unsigned int digis = 0; digis < EcalDigiEE->size(); ++digis) {
318  EEDataFrame eedf = (*endcapDigi)[digis];
319  int nrSamples = eedf.size();
320 
321  EEDetId eeid = eedf.id();
322 
323  double Emax = 0.;
324  int Pmax = 0;
325  double pedestalPreSample = 0.;
326  double pedestalPreSampleAnalog = 0.;
327 
328  for (int sample = 0; sample < nrSamples; ++sample) {
329  eeAnalogSignal[sample] = 0.;
330  eeADCCounts[sample] = 0.;
331  eeADCGains[sample] = -1.;
332  }
333 
334  for (int sample = 0; sample < nrSamples; ++sample) {
336 
337  eeADCCounts[sample] = (mySample.adc());
338  eeADCGains[sample] = (mySample.gainId());
339  eeAnalogSignal[sample] = (eeADCCounts[sample] * gainConv_[(int)eeADCGains[sample]] * endcapADCtoGeV_);
340  if (Emax < eeAnalogSignal[sample]) {
341  Emax = eeAnalogSignal[sample];
342  Pmax = sample;
343  }
344  if (sample < 3) {
345  pedestalPreSample += eeADCCounts[sample];
346  pedestalPreSampleAnalog += eeADCCounts[sample] * gainConv_[(int)eeADCGains[sample]] * endcapADCtoGeV_;
347  }
348  LogDebug("DigiInfo") << "EE sample " << sample << " ADC counts = " << eeADCCounts[sample]
349  << " Gain Id = " << eeADCGains[sample] << " Analog eq = " << eeAnalogSignal[sample];
350  }
351  pedestalPreSample /= 3.;
352  pedestalPreSampleAnalog /= 3.;
353  double Erec = Emax - pedestalPreSampleAnalog * gainConv_[(int)eeADCGains[Pmax]];
354 
355  if (eeSimMap[eeid.rawId()] != 0.) {
356  LogDebug("DigiInfo") << " Digi / Hit = " << Erec << " / " << eeSimMap[eeid.rawId()] << " gainConv "
357  << gainConv_[(int)eeADCGains[Pmax]];
358  if (meEEDigiSimRatio_)
359  meEEDigiSimRatio_->Fill(Erec / eeSimMap[eeid.rawId()]);
360  if (Erec > 20. * endcapADCtoGeV_ && meEEDigiSimRatiogt20ADC_)
361  meEEDigiSimRatiogt20ADC_->Fill(Erec / eeSimMap[eeid.rawId()]);
362  if (Erec > 100. * endcapADCtoGeV_ && meEEDigiSimRatiogt100ADC_)
363  meEEDigiSimRatiogt100ADC_->Fill(Erec / eeSimMap[eeid.rawId()]);
364  }
365  }
366  }
367 
368  if (isPreshower) {
369  e.getByToken(crossingFramePCaloHitESToken_, crossingFrame);
370  const MixCollection<PCaloHit> preshowerHits(crossingFrame.product());
371  for (auto const& iHit : preshowerHits) {
372  ESDetId esid = ESDetId(iHit.id());
373 
374  LogDebug("HitInfo") << " CaloHit " << iHit.getName() << "\n"
375  << " DetID = " << iHit.id() << "ESDetId: z side " << esid.zside() << " plane "
376  << esid.plane() << esid.six() << ',' << esid.siy() << ':' << esid.strip() << "\n"
377  << " Time = " << iHit.time() << " Event id. = " << iHit.eventId().rawId() << "\n"
378  << " Track Id = " << iHit.geantTrackId() << "\n"
379  << " Energy = " << iHit.energy();
380  }
381  }
382 }
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 384 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().

384  {
385  // ADC -> GeV Scale
386  const EcalADCToGeVConstant* agc = &eventSetup.getData(pAgc);
387 
388  EcalMGPAGainRatio* defaultRatios = new EcalMGPAGainRatio();
389 
390  gainConv_[1] = 1.;
391  gainConv_[2] = defaultRatios->gain12Over6();
392  gainConv_[3] = gainConv_[2] * (defaultRatios->gain6Over1());
393  gainConv_[0] = gainConv_[2] * (defaultRatios->gain6Over1()); // saturated channels
394 
395  LogDebug("EcalDigi") << " Gains conversions: "
396  << "\n"
397  << " g1 = " << gainConv_[1] << "\n"
398  << " g2 = " << gainConv_[2] << "\n"
399  << " g3 = " << gainConv_[3];
400  LogDebug("EcalDigi") << " Gains conversions: "
401  << "\n"
402  << " saturation = " << gainConv_[0];
403 
404  delete defaultRatios;
405 
406  const double barrelADCtoGeV_ = agc->getEBValue();
407  LogDebug("EcalDigi") << " Barrel GeV/ADC = " << barrelADCtoGeV_;
408  const double endcapADCtoGeV_ = agc->getEEValue();
409  LogDebug("EcalDigi") << " Endcap GeV/ADC = " << endcapADCtoGeV_;
410 }
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 c, and checkCalibrations().

63 { checkCalibrations(c); }
void checkCalibrations(edm::EventSetup const &c)

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().