36 if (
verbose_ ) dbe_->showDirStructure();
54 for (
int i = 0;
i < 10 ;
i++ ) {
75 dbe_->setCurrentFolder(
"EcalDigisV/EcalDigiTask");
77 sprintf (histo,
"EcalDigiTask Endcap occupancy z+" ) ;
80 sprintf (histo,
"EcalDigiTask Endcap occupancy z-" ) ;
83 sprintf (histo,
"EcalDigiTask Endcap multiplicity z+" ) ;
86 sprintf (histo,
"EcalDigiTask Endcap multiplicity z-" ) ;
89 sprintf (histo,
"EcalDigiTask Endcap global pulse shape" ) ;
92 for (
int i = 0;
i < 10 ;
i++ ) {
94 sprintf (histo,
"EcalDigiTask Endcap analog pulse %02d",
i+1) ;
97 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 0 - Saturated",
i+1) ;
100 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 1",
i+1) ;
103 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 6",
i+1) ;
106 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 12",
i+1) ;
109 sprintf (histo,
"EcalDigiTask Endcap gain pulse %02d",
i+1) ;
113 sprintf (histo,
"EcalDigiTask Endcap pedestal for pre-sample" ) ;
114 meEEPedestal_ = dbe_->book1D(histo, histo, 4096, -0.5, 4095.5) ;
116 sprintf (histo,
"EcalDigiTask Endcap maximum position gt 100 ADC" ) ;
119 sprintf (histo,
"EcalDigiTask Endcap maximum position gt 20 ADC" ) ;
122 sprintf (histo,
"EcalDigiTask Endcap ADC counts after gain switch" ) ;
152 if( !EcalDigiEE.
isValid() )
return;
160 std::vector<double> eeAnalogSignal ;
161 std::vector<double> eeADCCounts ;
162 std::vector<double> eeADCGains ;
170 for (
unsigned int digis=0; digis<EcalDigiEE->size(); ++digis) {
173 int nrSamples=eedf.
size();
177 if (eeid.
zside() > 0 ) {
181 else if (eeid.
zside() < 0 ) {
188 double pedestalPreSample = 0.;
189 double pedestalPreSampleAnalog = 0.;
190 int countsAfterGainSwitch = -1;
191 double higherGain = 1.;
192 int higherGainSample = 0;
195 eeAnalogSignal[
sample] = 0.;
208 if (Emax < eeAnalogSignal[
sample] ) {
209 Emax = eeAnalogSignal[
sample] ;
214 pedestalPreSample += eeADCCounts[
sample] ;
215 pedestalPreSampleAnalog += eeADCCounts[
sample]*
gainConv_[(int)eeADCGains[sample]]*endcapADCtoGeV_ ;
218 if (sample > 0 && ( ((eeADCGains[sample] > eeADCGains[sample-1]) && (eeADCGains[sample-1]!=0)) || (countsAfterGainSwitch<0 && eeADCGains[
sample]==0)) ){
219 higherGain = eeADCGains[
sample];
220 higherGainSample =
sample;
221 countsAfterGainSwitch = 1;
224 if ( (higherGain > 1 && (higherGainSample != sample) && (eeADCGains[
sample] == higherGain)) || (higherGain==3 && (higherGainSample !=
sample) && (eeADCGains[sample]==0)) || (higherGain==0 && (higherGainSample != sample) && ((eeADCGains[
sample]==0) || (eeADCGains[sample]==3))) ) countsAfterGainSwitch++ ;
226 pedestalPreSample /= 3. ;
227 pedestalPreSampleAnalog /= 3. ;
229 LogDebug(
"DigiInfo") <<
"Endcap Digi for EEDetId = " << eeid.
rawId() <<
" x,y " << eeid.
ix() <<
" " << eeid.
iy() ;
230 for (
int i = 0;
i < 10 ;
i++ ) {
231 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i] <<
" Analog = " << eeAnalogSignal[
i] ;
233 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
234 if ( countsAfterGainSwitch > 0 )
LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
236 if ( countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
237 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch ;
238 for (
int i = 0;
i < 10 ;
i++ ) {
239 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i] <<
" Analog = " << eeAnalogSignal[
i];
243 for (
int i = 0 ;
i < 10 ;
i++ ) {
246 if ( eeADCGains[i] == 0 ) {
249 else if ( eeADCGains[i] == 3 ) {
252 else if ( eeADCGains[i] == 2 ) {
255 else if ( eeADCGains[i] == 1 ) {
288 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g0 = " << gainConv_[0] <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
290 delete defaultRatios;
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meEEDigiADCgS_[10]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * meEEDigiOccupancyzm_
MonitorElement * meEEDigiGain_[10]
MonitorElement * meEEMaximumgt100ADC_
MonitorElement * meEEDigiMultiplicityzm_
MonitorElement * meEEPedestal_
int gainId() const
get the gainId (2 bits)
uint32_t rawId() const
get the raw id
~EcalEndcapDigisValidation()
Destructor.
MonitorElement * meEEDigiADCAnalog_[10]
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
MonitorElement * meEEDigiADCg12_[10]
T const * product() const
MonitorElement * meEEDigiADCg1_[10]
T const * product() const
MonitorElement * meEEDigiMultiplicityzp_
float gain12Over6() const
EcalEndcapDigisValidation(const edm::ParameterSet &ps)
Constructor.
void checkCalibrations(edm::EventSetup const &c)
void beginRun(edm::Run const &, edm::EventSetup const &c)
MonitorElement * meEEDigiOccupancyzp_
MonitorElement * meEEDigiADCg6_[10]
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meEEnADCafterSwitch_
void analyze(edm::Event const &e, edm::EventSetup const &c)
Analyze.
static const int MAXSAMPLES
int adc() const
get the ADC sample (12 bits)
MonitorElement * meEEMaximumgt20ADC_
MonitorElement * meEEDigiADCGlobal_