3636// #define EDM_ML_DEBUG
3737
3838class EcalDigiStudy : public edm ::one::EDAnalyzer<edm::one::WatchRuns, edm::one::SharedResources> {
39-
4039public:
4140 EcalDigiStudy (const edm::ParameterSet& ps);
4241 ~EcalDigiStudy () override = default ;
@@ -109,21 +108,19 @@ EcalDigiStudy::EcalDigiStudy(const edm::ParameterSet& ps)
109108 gainConv_[0 ] = 12 .; // saturated channels
110109 barrelADCtoGeV_ = 0.035 ;
111110 endcapADCtoGeV_ = 0.06 ;
112-
113111}
114112
115113void EcalDigiStudy::fillDescriptions (edm::ConfigurationDescriptions& descriptions) {
116114 edm::ParameterSetDescription desc;
117- desc.add <edm::InputTag>(" EBdigiCollection" , edm::InputTag (" simEcalDigis" ," ebDigis" ));
118- desc.add <edm::InputTag>(" EEdigiCollection" , edm::InputTag (" simEcalDigis" ," eeDigis" ));
115+ desc.add <edm::InputTag>(" EBdigiCollection" , edm::InputTag (" simEcalDigis" , " ebDigis" ));
116+ desc.add <edm::InputTag>(" EEdigiCollection" , edm::InputTag (" simEcalDigis" , " eeDigis" ));
119117 desc.addUntracked <bool >(" verbose" , " false" );
120118 descriptions.add (" ecalDigiStudy" , desc);
121119}
122120
123121void EcalDigiStudy::beginRun (const edm::Run&, const edm::EventSetup& es) {
124-
125122 checkCalibrations (es);
126-
123+
127124 edm::Service<TFileService> fs;
128125 Char_t histo[200 ];
129126
@@ -200,15 +197,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
200197#ifdef EDM_ML_DEBUG
201198 edm::LogVerbatim (" EcalDigiStudy" ) << " EB collection " << EcalDigiEB.isValid ();
202199#endif
203-
200+
204201 if (EcalDigiEB.isValid ()) {
205202 // BARREL: Loop over Digis
206203
207204 const EBDigiCollection* barrelDigi = EcalDigiEB.product ();
208205#ifdef EDM_ML_DEBUG
209206 edm::LogVerbatim (" EcalDigiStudy" ) << " EB Digi size " << EcalDigiEB->size ();
210207#endif
211-
208+
212209 std::vector<double > ebAnalogSignal, ebADCCounts, ebADCGains;
213210 ebAnalogSignal.reserve (EBDataFrame::MAXSAMPLES);
214211 ebADCCounts.reserve (EBDataFrame::MAXSAMPLES);
@@ -262,7 +259,7 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
262259 if ((higherGain > 1 && (higherGainSample != sample) && (ebADCGains[sample] == higherGain)) ||
263260 (higherGain == 3 && (higherGainSample != sample) && (ebADCGains[sample] == 0 )) ||
264261 (higherGain == 0 && (higherGainSample != sample) &&
265- ((ebADCGains[sample] == 3 ) || (ebADCGains[sample] == 0 )))) {
262+ ((ebADCGains[sample] == 3 ) || (ebADCGains[sample] == 0 )))) {
266263 countsAfterGainSwitch++;
267264 }
268265 }
@@ -271,17 +268,22 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
271268 pedestalPreSampleAnalog /= 3 .;
272269
273270 if (verbose_) {
274- edm::LogVerbatim (" EcalDigiStudy" ) << " Barrel Digi for EBDetId = " << ebid.rawId () << " eta,phi " << ebid.ieta () << " " << ebid.iphi ();
275- for (int i = 0 ; i < 10 ; i++)
276- edm::LogVerbatim (" EcalDigiSTudy" ) << " sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
277- edm::LogVerbatim (" EcalDigiStudy" ) << " Maximum energy = " << Emax << " in sample " << Pmax << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
278- if (countsAfterGainSwitch > 0 )
279- edm::LogVerbatim (" EcalDigiStudy" ) << " Counts after switch " << countsAfterGainSwitch;
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;
280280 }
281281 if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
282- edm::LogWarning (" EcalDigiStudy" ) << " Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch;
283- for (int i = 0 ; i < 10 ; i++)
284- edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << ebADCCounts[i] << " gain = " << ebADCGains[i] << " Analog = " << ebAnalogSignal[i];
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];
285287 }
286288
287289 for (int i = 0 ; i < 10 ; i++) {
@@ -307,16 +309,15 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
307309 meEBnADCafterSwitch_->Fill (countsAfterGainSwitch);
308310 }
309311 meEBDigiMultiplicity_->Fill (nDigis);
310- }
311-
312- edm:: Handle<EEDigiCollection> EcalDigiEE;
312+ }
313+
314+ edm::Handle<EEDigiCollection> EcalDigiEE;
313315 e.getByToken (EEdigiCollection_, EcalDigiEE);
314316#ifdef EDM_ML_DEBUG
315317 edm::LogVerbatim (" EcalDigiStudy" ) << " EE collection " << EcalDigiEE.isValid ();
316318#endif
317319
318320 if (EcalDigiEE.isValid ()) {
319-
320321 // ENDCAP: Loop over Digis
321322 const EEDigiCollection* endcapDigi = EcalDigiEE.product ();
322323#ifdef EDM_ML_DEBUG
@@ -383,16 +384,18 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
383384
384385 if ((higherGain > 1 && (higherGainSample != sample) && (eeADCGains[sample] == higherGain)) ||
385386 (higherGain == 3 && (higherGainSample != sample) && (eeADCGains[sample] == 0 )) ||
386- (higherGain == 0 && (higherGainSample != sample) && ((eeADCGains[sample] == 0 ) || (eeADCGains[sample] == 3 ))))
387+ (higherGain == 0 && (higherGainSample != sample) &&
388+ ((eeADCGains[sample] == 0 ) || (eeADCGains[sample] == 3 ))))
387389 countsAfterGainSwitch++;
388390 }
389391 pedestalPreSample /= 3 .;
390392 pedestalPreSampleAnalog /= 3 .;
391393
392- edm::LogVerbatim (" EcalDigiStudy" ) << " Endcap Digi for EEDetId = " << eeid.rawId () << " x,y " << eeid.ix () << " " << eeid.iy ();
394+ edm::LogVerbatim (" EcalDigiStudy" ) << " Endcap Digi for EEDetId = " << eeid.rawId () << " x,y " << eeid.ix () << " "
395+ << eeid.iy ();
393396 for (int i = 0 ; i < 10 ; i++)
394- edm::LogVerbatim (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
395- << " Analog = " << eeAnalogSignal[i];
397+ edm::LogVerbatim (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i]
398+ << " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
396399 edm::LogVerbatim (" EcalDigiStudy" ) << " Maximum energy = " << Emax << " in sample " << Pmax
397400 << " Pedestal from pre-sample = " << pedestalPreSampleAnalog;
398401 if (countsAfterGainSwitch > 0 )
@@ -402,8 +405,8 @@ void EcalDigiStudy::analyze(edm::Event const& e, edm::EventSetup const& c) {
402405 edm::LogWarning (" EcalDigiStudy" ) << " Wrong number of counts after gain switch before next switch! "
403406 << countsAfterGainSwitch;
404407 for (int i = 0 ; i < 10 ; i++)
405- edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i] << " gain = " << eeADCGains[i]
406- << " Analog = " << eeAnalogSignal[i];
408+ edm::LogWarning (" EcalDigiStudy" ) << " sample " << i << " ADC = " << eeADCCounts[i]
409+ << " gain = " << eeADCGains[i] << " Analog = " << eeAnalogSignal[i];
407410 }
408411
409412 for (int i = 0 ; i < 10 ; i++) {
@@ -452,7 +455,7 @@ void EcalDigiStudy::checkCalibrations(edm::EventSetup const& eventSetup) {
452455 << " g3 = " << gainConv_[3 ];
453456
454457 delete defaultRatios;
455-
458+
456459 edm::LogVerbatim (" EcalDigiStudy" ) << " Barrel GeV/ADC = " << agc->getEBValue ();
457460 edm::LogVerbatim (" EcalDigiStudy" ) << " Endcap GeV/ADC = " << agc->getEEValue ();
458461}
0 commit comments