1+
12/*
23 * \file EcalDigiStudy.h
34 *
3637// #define EDM_ML_DEBUG
3738
3839class EcalDigiStudy : public edm ::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
40+
3941public:
4042 EcalDigiStudy (const edm::ParameterSet& ps);
4143 ~EcalDigiStudy () override = default ;
@@ -108,19 +110,21 @@ EcalDigiStudy::EcalDigiStudy(const edm::ParameterSet& ps)
108110 gainConv_[0 ] = 12 .; // saturated channels
109111 barrelADCtoGeV_ = 0.035 ;
110112 endcapADCtoGeV_ = 0.06 ;
113+
111114}
112115
113116void EcalDigiStudy::fillDescriptions (edm::ConfigurationDescriptions& descriptions) {
114117 edm::ParameterSetDescription desc;
115- desc.add <edm::InputTag>(" EBdigiCollection" , edm::InputTag (" simEcalDigis" , " ebDigis" ));
116- desc.add <edm::InputTag>(" EEdigiCollection" , edm::InputTag (" simEcalDigis" , " eeDigis" ));
118+ desc.add <edm::InputTag>(" EBdigiCollection" , edm::InputTag (" simEcalDigis" ," ebDigis" ));
119+ desc.add <edm::InputTag>(" EEdigiCollection" , edm::InputTag (" simEcalDigis" ," eeDigis" ));
117120 desc.addUntracked <bool >(" verbose" , " false" );
118121 descriptions.add (" ecalDigiStudy" , desc);
119122}
120123
121124void EcalDigiStudy::beginRun (const edm::Run&, const edm::EventSetup& es) {
122- checkCalibrations (es);
123125
126+ checkCalibrations (es);
127+
124128 edm::Service<TFileService> fs;
125129 Char_t histo[200 ];
126130
@@ -197,15 +201,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
197201#ifdef EDM_ML_DEBUG
198202 edm::LogVerbatim (" EcalDigiStudy" ) << " EB collection " << EcalDigiEB.isValid ();
199203#endif
200-
204+
201205 if (EcalDigiEB.isValid ()) {
202206 // BARREL: Loop over Digis
203207
204208 const EBDigiCollection* barrelDigi = EcalDigiEB.product ();
205209#ifdef EDM_ML_DEBUG
206210 edm::LogVerbatim (" EcalDigiStudy" ) << " EB Digi size " << EcalDigiEB->size ();
207211#endif
208-
212+
209213 std::vector<double > ebAnalogSignal, ebADCCounts, ebADCGains;
210214 ebAnalogSignal.reserve (EBDataFrame::MAXSAMPLES);
211215 ebADCCounts.reserve (EBDataFrame::MAXSAMPLES);
@@ -259,31 +263,28 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
259263 if ((higherGain > 1 && (higherGainSample != sample) && (ebADCGains[sample] == higherGain)) ||
260264 (higherGain == 3 && (higherGainSample != sample) && (ebADCGains[sample] == 0 )) ||
261265 (higherGain == 0 && (higherGainSample != sample) &&
262- ((ebADCGains[sample] == 3 ) || (ebADCGains[sample] == 0 )))) {
266+ ((ebADCGains[sample] == 3 ) || (ebADCGains[sample] == 0 )))) {
263267 countsAfterGainSwitch++;
264268 }
265269 }
266270
267271 pedestalPreSample /= 3 .;
268272 pedestalPreSampleAnalog /= 3 .;
269273
274+ #ifdef EDM_ML_DEBUG
270275 if (verbose_) {
271- edm::LogVerbatim (" EcalDigiStudy" )
272- << " Barrel Digi for EBDetId = " << ebid.rawId () << " eta,phi " << ebid.ieta () << " " << ebid.iphi ();
273- for (int i = 0 ; i < 10 ; i++)
274- edm::LogVerbatim (" EcalDigiSTudy" ) << " sample " << i << " ADC = " << ebADCCounts[i]
275- << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
276- edm::LogVerbatim (" EcalDigiStudy" ) << " Maximum energy = " << Emax << " in sample " << Pmax
277- << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
278- if (countsAfterGainSwitch > 0 )
279- edm::LogVerbatim (" EcalDigiStudy" ) << " Counts after switch " << countsAfterGainSwitch;
276+ edm::LogVerbatim (" EcalDigiStudy" ) << " Barrel Digi for EBDetId = " << ebid.rawId () << " eta,phi " << ebid.ieta () << " " << ebid.iphi ();
277+ for (int i = 0 ; i < 10 ; i++)
278+ edm::LogVerbatim (" EcalDigiSTudy" ) << " sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
279+ edm::LogVerbatim (" EcalDigiStudy" ) << " Maximum energy = " << Emax << " in sample " << Pmax << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
280+ if (countsAfterGainSwitch > 0 )
281+ edm::LogVerbatim (" EcalDigiStudy" ) << " Counts after switch " << countsAfterGainSwitch;
280282 }
283+ #endif
281284 if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
282- edm::LogWarning (" EcalDigiStudy" ) << " Wrong number of counts after gain switch before next switch! "
283- << countsAfterGainSwitch;
284- for (int i = 0 ; i < 10 ; i++)
285- edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << ebADCCounts[i]
286- << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
285+ edm::LogWarning (" EcalDigiStudy" ) << " Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch;
286+ for (int i = 0 ; i < 10 ; i++)
287+ edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
287288 }
288289
289290 for (int i = 0 ; i < 10 ; i++) {
@@ -309,15 +310,16 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
309310 meEBnADCafterSwitch_->Fill (countsAfterGainSwitch);
310311 }
311312 meEBDigiMultiplicity_->Fill (nDigis);
312- }
313-
314- edm::Handle<EEDigiCollection> EcalDigiEE;
313+ }
314+
315+ edm:: Handle<EEDigiCollection> EcalDigiEE;
315316 e.getByToken (EEdigiCollection_, EcalDigiEE);
316317#ifdef EDM_ML_DEBUG
317318 edm::LogVerbatim (" EcalDigiStudy" ) << " EE collection " << EcalDigiEE.isValid ();
318319#endif
319320
320321 if (EcalDigiEE.isValid ()) {
322+
321323 // ENDCAP: Loop over Digis
322324 const EEDigiCollection* endcapDigi = EcalDigiEE.product ();
323325#ifdef EDM_ML_DEBUG
@@ -384,29 +386,28 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
384386
385387 if ((higherGain > 1 && (higherGainSample != sample) && (eeADCGains[sample] == higherGain)) ||
386388 (higherGain == 3 && (higherGainSample != sample) && (eeADCGains[sample] == 0 )) ||
387- (higherGain == 0 && (higherGainSample != sample) &&
388- ((eeADCGains[sample] == 0 ) || (eeADCGains[sample] == 3 ))))
389+ (higherGain == 0 && (higherGainSample != sample) && ((eeADCGains[sample] == 0 ) || (eeADCGains[sample] == 3 ))))
389390 countsAfterGainSwitch++;
390391 }
391392 pedestalPreSample /= 3 .;
392393 pedestalPreSampleAnalog /= 3 .;
393394
394- edm::LogVerbatim ( " EcalDigiStudy " ) << " Endcap Digi for EEDetId = " << eeid. rawId () << " x,y " << eeid. ix () << " "
395- << eeid.iy ();
395+ # ifdef EDM_ML_DEBUG
396+ edm::LogVerbatim ( " EcalDigiStudy " ) << " Endcap Digi for EEDetId = " << eeid. rawId () << " x,y " << eeid. ix () << " " << eeid.iy ();
396397 for (int i = 0 ; i < 10 ; i++)
397- edm::LogVerbatim (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i]
398- << " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
398+ edm::LogVerbatim (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
399+ << " Analog = " << eeAnalogSignal[i];
399400 edm::LogVerbatim (" EcalDigiStudy" ) << " Maximum energy = " << Emax << " in sample " << Pmax
400401 << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
401402 if (countsAfterGainSwitch > 0 )
402403 edm::LogVerbatim (" EcalDigiStudy" ) << " Counts after switch " << countsAfterGainSwitch;
403-
404+ # endif
404405 if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
405406 edm::LogWarning (" EcalDigiStudy" ) << " Wrong number of counts after gain switch before next switch! "
406407 << countsAfterGainSwitch;
407408 for (int i = 0 ; i < 10 ; i++)
408- edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i]
409- << " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
409+ edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
410+ << " Analog = " << eeAnalogSignal[i];
410411 }
411412
412413 for (int i = 0 ; i < 10 ; i++) {
@@ -455,7 +456,7 @@ void EcalDigiStudy::checkCalibrations(edm::EventSetup const& eventSetup) {
455456 << " g3 = " << gainConv_[3 ];
456457
457458 delete defaultRatios;
458-
459+
459460 edm::LogVerbatim (" EcalDigiStudy" ) << " Barrel GeV/ADC = " << agc->getEBValue ();
460461 edm::LogVerbatim (" EcalDigiStudy" ) << " Endcap GeV/ADC = " << agc->getEEValue ();
461462}
0 commit comments