19 EBdigiCollection_(ps.getParameter<edm::
InputTag>(
"EBdigiCollection"))
39 if (
verbose_ ) dbe_->showDirStructure();
55 for (
int i = 0;
i < 10 ;
i++ ) {
76 dbe_->setCurrentFolder(
"EcalDigisV/EcalDigiTask");
78 sprintf (histo,
"EcalDigiTask Barrel occupancy" ) ;
81 sprintf (histo,
"EcalDigiTask Barrel digis multiplicity" ) ;
84 sprintf (histo,
"EcalDigiTask Barrel global pulse shape" ) ;
87 for (
int i = 0;
i < 10 ;
i++ ) {
89 sprintf (histo,
"EcalDigiTask Barrel analog pulse %02d",
i+1) ;
92 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 0 - Saturated",
i+1) ;
95 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 1",
i+1) ;
98 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 6",
i+1) ;
101 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 12",
i+1) ;
104 sprintf (histo,
"EcalDigiTask Barrel gain pulse %02d",
i+1) ;
109 sprintf (histo,
"EcalDigiTask Barrel pedestal for pre-sample" ) ;
110 meEBPedestal_ = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
112 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 100 ADC" ) ;
115 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 10 ADC" ) ;
118 sprintf (histo,
"EcalDigiTask Barrel ADC counts after gain switch" ) ;
148 if( !EcalDigiEB.
isValid() )
return;
156 std::vector<double> ebAnalogSignal ;
157 std::vector<double> ebADCCounts ;
158 std::vector<double> ebADCGains ;
165 for (
unsigned int digis=0; digis<EcalDigiEB->size(); ++digis)
169 int nrSamples = ebdf.
size();
178 double pedestalPreSample = 0.;
179 double pedestalPreSampleAnalog = 0.;
180 int countsAfterGainSwitch = -1;
181 double higherGain = 1.;
182 int higherGainSample = 0;
185 ebAnalogSignal[
sample] = 0.;
194 ebADCCounts[
sample] = (thisSample.
adc());
198 if (Emax < ebAnalogSignal[
sample] ) {
199 Emax = ebAnalogSignal[
sample] ;
204 pedestalPreSample += ebADCCounts[
sample] ;
205 pedestalPreSampleAnalog += ebADCCounts[
sample]*
gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_ ;
208 if ( sample > 0 && ( ((ebADCGains[sample] > ebADCGains[sample-1]) && (ebADCGains[sample-1]!=0)) || (countsAfterGainSwitch<0 && ebADCGains[
sample]==0)) ) {
209 higherGain = ebADCGains[
sample];
210 higherGainSample =
sample;
211 countsAfterGainSwitch = 1;
214 if ( (higherGain > 1 && (higherGainSample != sample) && (ebADCGains[
sample] == higherGain)) || (higherGain==3 && (higherGainSample !=
sample) && (ebADCGains[sample]==0)) || (higherGain==0 && (higherGainSample != sample) && ((ebADCGains[
sample] == 3) || (ebADCGains[sample]==0))) ) { countsAfterGainSwitch++ ; }
217 pedestalPreSample /= 3. ;
218 pedestalPreSampleAnalog /= 3. ;
220 LogDebug(
"DigiInfo") <<
"Barrel Digi for EBDetId = " << ebid.
rawId() <<
" eta,phi " << ebid.
ieta() <<
" " << ebid.
iphi() ;
221 for (
int i = 0;
i < 10 ;
i++ ) {
222 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
224 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
225 if ( countsAfterGainSwitch > 0 )
LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
227 if ( countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
228 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch ;
229 for (
int i = 0;
i < 10 ;
i++ ) {
230 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
234 for (
int i = 0 ;
i < 10 ;
i++ ) {
238 if ( ebADCGains[i] == 0) {
241 else if ( ebADCGains[i] == 3 ) {
244 else if ( ebADCGains[i] == 2 ) {
247 else if ( ebADCGains[i] == 1 ) {
279 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g0 = " << gainConv_[0] <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
281 delete defaultRatios;
void analyze(edm::Event const &e, edm::EventSetup const &c)
Analyze.
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meEBDigiADCgS_[10]
MonitorElement * meEBnADCafterSwitch_
MonitorElement * meEBMaximumgt100ADC_
MonitorElement * meEBDigiADCAnalog_[10]
MonitorElement * meEBDigiMultiplicity_
int gainId() const
get the gainId (2 bits)
MonitorElement * meEBDigiGain_[10]
void beginRun(edm::Run const &, edm::EventSetup const &c)
MonitorElement * meEBDigiADCg6_[10]
int iphi() const
get the crystal iphi
uint32_t rawId() const
get the raw id
void checkCalibrations(edm::EventSetup const &c)
EcalBarrelDigisValidation(const edm::ParameterSet &ps)
Constructor.
int ieta() const
get the crystal ieta
~EcalBarrelDigisValidation()
Destructor.
MonitorElement * meEBDigiOccupancy_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * meEBDigiADCg1_[10]
MonitorElement * meEBPedestal_
T const * product() const
float gain12Over6() const
MonitorElement * meEBDigiADCGlobal_
T const * product() const
MonitorElement * meEBDigiADCg12_[10]
MonitorElement * meEBMaximumgt10ADC_
edm::InputTag EBdigiCollection_
static const int MAXSAMPLES
int adc() const
get the ADC sample (12 bits)