40 for (
int i = 0;
i < 10 ;
i++ ) {
69 sprintf (histo,
"EcalDigiTask Barrel occupancy" ) ;
72 sprintf (histo,
"EcalDigiTask Barrel digis multiplicity" ) ;
75 sprintf (histo,
"EcalDigiTask Barrel global pulse shape" ) ;
78 for (
int i = 0;
i < 10 ;
i++ ) {
80 sprintf (histo,
"EcalDigiTask Barrel analog pulse %02d",
i+1) ;
83 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 0 - Saturated",
i+1) ;
86 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 1",
i+1) ;
89 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 6",
i+1) ;
92 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 12",
i+1) ;
95 sprintf (histo,
"EcalDigiTask Barrel gain pulse %02d",
i+1) ;
100 sprintf (histo,
"EcalDigiTask Barrel pedestal for pre-sample" ) ;
103 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 100 ADC" ) ;
106 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 10 ADC" ) ;
109 sprintf (histo,
"EcalDigiTask Barrel ADC counts after gain switch" ) ;
130 if( !EcalDigiEB.
isValid() )
return;
138 std::vector<double> ebAnalogSignal ;
139 std::vector<double> ebADCCounts ;
140 std::vector<double> ebADCGains ;
147 for (
unsigned int digis=0; digis<EcalDigiEB->
size(); ++digis)
151 int nrSamples = ebdf.
size();
160 double pedestalPreSample = 0.;
161 double pedestalPreSampleAnalog = 0.;
162 int countsAfterGainSwitch = -1;
163 double higherGain = 1.;
164 int higherGainSample = 0;
167 ebAnalogSignal[
sample] = 0.;
176 ebADCCounts[
sample] = (thisSample.
adc());
180 if (Emax < ebAnalogSignal[
sample] ) {
181 Emax = ebAnalogSignal[
sample] ;
186 pedestalPreSample += ebADCCounts[
sample] ;
187 pedestalPreSampleAnalog += ebADCCounts[
sample]*
gainConv_[(
int)ebADCGains[sample]]*barrelADCtoGeV_ ;
190 if ( sample > 0 && ( ((ebADCGains[sample] > ebADCGains[sample-1]) && (ebADCGains[sample-1]!=0)) || (countsAfterGainSwitch<0 && ebADCGains[
sample]==0)) ) {
191 higherGain = ebADCGains[
sample];
192 higherGainSample =
sample;
193 countsAfterGainSwitch = 1;
196 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++ ; }
199 pedestalPreSample /= 3. ;
200 pedestalPreSampleAnalog /= 3. ;
202 LogDebug(
"DigiInfo") <<
"Barrel Digi for EBDetId = " << ebid.
rawId() <<
" eta,phi " << ebid.
ieta() <<
" " << ebid.
iphi() ;
203 for (
int i = 0;
i < 10 ;
i++ ) {
204 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
206 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
207 if ( countsAfterGainSwitch > 0 )
LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
209 if ( countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
210 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch ;
211 for (
int i = 0;
i < 10 ;
i++ ) {
212 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
216 for (
int i = 0 ;
i < 10 ;
i++ ) {
220 if ( ebADCGains[i] == 0) {
223 else if ( ebADCGains[i] == 3 ) {
226 else if ( ebADCGains[i] == 2 ) {
229 else if ( ebADCGains[i] == 1 ) {
261 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g0 = " << gainConv_[0] <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
263 delete defaultRatios;
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meEBDigiADCgS_[10]
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * meEBnADCafterSwitch_
~EcalBarrelDigisValidation() override
Destructor.
MonitorElement * meEBMaximumgt100ADC_
MonitorElement * meEBDigiADCAnalog_[10]
MonitorElement * meEBDigiMultiplicity_
int gainId() const
get the gainId (2 bits)
MonitorElement * meEBDigiGain_[10]
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEBDigiADCg6_[10]
int iphi() const
get the crystal iphi
uint32_t rawId() const
get the raw id
void checkCalibrations(edm::EventSetup const &c)
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
edm::EDGetTokenT< EBDigiCollection > EBdigiCollection_
MonitorElement * book1D(Args &&...args)
EcalBarrelDigisValidation(const edm::ParameterSet &ps)
Constructor.
int ieta() const
get the crystal ieta
MonitorElement * meEBDigiOccupancy_
MonitorElement * meEBDigiADCg1_[10]
void reserve(size_t isize)
MonitorElement * meEBPedestal_
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
float gain12Over6() const
MonitorElement * meEBDigiADCGlobal_
MonitorElement * meEBDigiADCg12_[10]
MonitorElement * meEBMaximumgt10ADC_
T const * product() const
static const int MAXSAMPLES
int adc() const
get the ADC sample (12 bits)