37 for (
int i = 0;
i < 10 ;
i++ ) {
66 sprintf (histo,
"EcalDigiTask Endcap occupancy z+" ) ;
69 sprintf (histo,
"EcalDigiTask Endcap occupancy z-" ) ;
72 sprintf (histo,
"EcalDigiTask Endcap multiplicity z+" ) ;
75 sprintf (histo,
"EcalDigiTask Endcap multiplicity z-" ) ;
78 sprintf (histo,
"EcalDigiTask Endcap global pulse shape" ) ;
81 for (
int i = 0;
i < 10 ;
i++ ) {
83 sprintf (histo,
"EcalDigiTask Endcap analog pulse %02d",
i+1) ;
86 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 0 - Saturated",
i+1) ;
89 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 1",
i+1) ;
92 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 6",
i+1) ;
95 sprintf (histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 12",
i+1) ;
98 sprintf (histo,
"EcalDigiTask Endcap gain pulse %02d",
i+1) ;
102 sprintf (histo,
"EcalDigiTask Endcap pedestal for pre-sample" ) ;
105 sprintf (histo,
"EcalDigiTask Endcap maximum position gt 100 ADC" ) ;
108 sprintf (histo,
"EcalDigiTask Endcap maximum position gt 20 ADC" ) ;
111 sprintf (histo,
"EcalDigiTask Endcap ADC counts after gain switch" ) ;
132 if( !EcalDigiEE.
isValid() )
return;
140 std::vector<double> eeAnalogSignal ;
141 std::vector<double> eeADCCounts ;
142 std::vector<double> eeADCGains ;
150 for (
unsigned int digis=0; digis<EcalDigiEE->
size(); ++digis) {
153 int nrSamples=eedf.
size();
157 if (eeid.
zside() > 0 ) {
161 else if (eeid.
zside() < 0 ) {
168 double pedestalPreSample = 0.;
169 double pedestalPreSampleAnalog = 0.;
170 int countsAfterGainSwitch = -1;
171 double higherGain = 1.;
172 int higherGainSample = 0;
175 eeAnalogSignal[
sample] = 0.;
188 if (Emax < eeAnalogSignal[
sample] ) {
189 Emax = eeAnalogSignal[
sample] ;
194 pedestalPreSample += eeADCCounts[
sample] ;
195 pedestalPreSampleAnalog += eeADCCounts[
sample]*
gainConv_[(
int)eeADCGains[sample]]*endcapADCtoGeV_ ;
198 if (sample > 0 && ( ((eeADCGains[sample] > eeADCGains[sample-1]) && (eeADCGains[sample-1]!=0)) || (countsAfterGainSwitch<0 && eeADCGains[
sample]==0)) ){
199 higherGain = eeADCGains[
sample];
200 higherGainSample =
sample;
201 countsAfterGainSwitch = 1;
204 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++ ;
206 pedestalPreSample /= 3. ;
207 pedestalPreSampleAnalog /= 3. ;
209 LogDebug(
"DigiInfo") <<
"Endcap Digi for EEDetId = " << eeid.
rawId() <<
" x,y " << eeid.
ix() <<
" " << eeid.
iy() ;
210 for (
int i = 0;
i < 10 ;
i++ ) {
211 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i] <<
" Analog = " << eeAnalogSignal[
i] ;
213 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
214 if ( countsAfterGainSwitch > 0 )
LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
216 if ( countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5 ) {
217 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " << countsAfterGainSwitch ;
218 for (
int i = 0;
i < 10 ;
i++ ) {
219 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i] <<
" Analog = " << eeAnalogSignal[
i];
223 for (
int i = 0 ;
i < 10 ;
i++ ) {
226 if ( eeADCGains[i] == 0 ) {
229 else if ( eeADCGains[i] == 3 ) {
232 else if ( eeADCGains[i] == 2 ) {
235 else if ( eeADCGains[i] == 1 ) {
268 LogDebug(
"EcalDigi") <<
" Gains conversions: " <<
"\n" <<
" g0 = " << gainConv_[0] <<
"\n" <<
" g1 = " << gainConv_[1] <<
"\n" <<
" g2 = " << gainConv_[2] <<
"\n" <<
" g3 = " << gainConv_[3];
270 delete defaultRatios;
T getUntrackedParameter(std::string const &, T const &) const
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEEDigiADCgS_[10]
MonitorElement * bookProfile(Args &&...args)
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]
MonitorElement * book1D(Args &&...args)
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
MonitorElement * meEEDigiADCg12_[10]
void reserve(size_t isize)
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
MonitorElement * meEEDigiADCg1_[10]
MonitorElement * meEEDigiMultiplicityzp_
virtual void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
float gain12Over6() const
EcalEndcapDigisValidation(const edm::ParameterSet &ps)
Constructor.
void checkCalibrations(edm::EventSetup const &c)
MonitorElement * meEEDigiOccupancyzp_
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
MonitorElement * meEEDigiADCg6_[10]
std::map< int, double, std::less< int > > gainConv_
MonitorElement * meEEnADCafterSwitch_
T const * product() const
static const int MAXSAMPLES
int adc() const
get the ADC sample (12 bits)
MonitorElement * meEEMaximumgt20ADC_
MonitorElement * meEEDigiADCGlobal_