37 if (
verbose_ ) dbe_->showDirStructure();
53 for (
int i = 0;
i < 10 ;
i++ ) {
74 dbe_->setCurrentFolder(
"EcalDigisV/EcalDigiTask");
76 sprintf (histo,
"EcalDigiTask Barrel occupancy" ) ;
79 sprintf (histo,
"EcalDigiTask Barrel digis multiplicity" ) ;
82 sprintf (histo,
"EcalDigiTask Barrel global pulse shape" ) ;
85 for (
int i = 0;
i < 10 ;
i++ ) {
87 sprintf (histo,
"EcalDigiTask Barrel analog pulse %02d",
i+1) ;
90 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 0 - Saturated",
i+1) ;
93 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 1",
i+1) ;
96 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 6",
i+1) ;
99 sprintf (histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 12",
i+1) ;
102 sprintf (histo,
"EcalDigiTask Barrel gain pulse %02d",
i+1) ;
107 sprintf (histo,
"EcalDigiTask Barrel pedestal for pre-sample" ) ;
108 meEBPedestal_ = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
110 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 100 ADC" ) ;
113 sprintf (histo,
"EcalDigiTask Barrel maximum position gt 10 ADC" ) ;
116 sprintf (histo,
"EcalDigiTask Barrel ADC counts after gain switch" ) ;
146 if( !EcalDigiEB.
isValid() )
return;
154 std::vector<double> ebAnalogSignal ;
155 std::vector<double> ebADCCounts ;
156 std::vector<double> ebADCGains ;
163 for (
unsigned int digis=0; digis<EcalDigiEB->size(); ++digis)
167 int nrSamples = ebdf.
size();
176 double pedestalPreSample = 0.;
177 double pedestalPreSampleAnalog = 0.;
178 int countsAfterGainSwitch = -1;
179 double higherGain = 1.;
180 int higherGainSample = 0;
183 ebAnalogSignal[
sample] = 0.;
192 ebADCCounts[
sample] = (thisSample.
adc());
196 if (Emax < ebAnalogSignal[
sample] ) {
197 Emax = ebAnalogSignal[
sample] ;
202 pedestalPreSample += ebADCCounts[
sample] ;
203 pedestalPreSampleAnalog += ebADCCounts[
sample]*
gainConv_[(int)ebADCGains[sample]]*barrelADCtoGeV_ ;
206 if ( sample > 0 && ( ((ebADCGains[sample] > ebADCGains[sample-1]) && (ebADCGains[sample-1]!=0)) || (countsAfterGainSwitch<0 && ebADCGains[
sample]==0)) ) {
207 higherGain = ebADCGains[
sample];
208 higherGainSample =
sample;
209 countsAfterGainSwitch = 1;
212 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++ ; }
215 pedestalPreSample /= 3. ;
216 pedestalPreSampleAnalog /= 3. ;
218 LogDebug(
"DigiInfo") <<
"Barrel Digi for EBDetId = " << ebid.
rawId() <<
" eta,phi " << ebid.
ieta() <<
" " << ebid.
iphi() ;
219 for (
int i = 0;
i < 10 ;
i++ ) {
220 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
222 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
223 if ( countsAfterGainSwitch > 0 )
LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
225 if ( countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
226 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch ;
227 for (
int i = 0;
i < 10 ;
i++ ) {
228 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i] <<
" Analog = " << ebAnalogSignal[
i];
232 for (
int i = 0 ;
i < 10 ;
i++ ) {
236 if ( ebADCGains[i] == 0) {
239 else if ( ebADCGains[i] == 3 ) {
242 else if ( ebADCGains[i] == 2 ) {
245 else if ( ebADCGains[i] == 1 ) {
277 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g0 = " << gainConv_[0] <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
279 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]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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)
edm::EDGetTokenT< EBDigiCollection > EBdigiCollection_
EcalBarrelDigisValidation(const edm::ParameterSet &ps)
Constructor.
int ieta() const
get the crystal ieta
~EcalBarrelDigisValidation()
Destructor.
MonitorElement * meEBDigiOccupancy_
MonitorElement * meEBDigiADCg1_[10]
MonitorElement * meEBPedestal_
T const * product() const
float gain12Over6() const
MonitorElement * meEBDigiADCGlobal_
T const * product() const
MonitorElement * meEBDigiADCg12_[10]
MonitorElement * meEBMaximumgt10ADC_
static const int MAXSAMPLES
int adc() const
get the ADC sample (12 bits)