35 for (
int i = 0;
i < 10;
i++) {
60 sprintf(histo,
"EcalDigiTask Endcap occupancy z+");
63 sprintf(histo,
"EcalDigiTask Endcap occupancy z-");
66 sprintf(histo,
"EcalDigiTask Endcap multiplicity z+");
69 sprintf(histo,
"EcalDigiTask Endcap multiplicity z-");
72 sprintf(histo,
"EcalDigiTask Endcap global pulse shape");
75 for (
int i = 0;
i < 10;
i++) {
76 sprintf(histo,
"EcalDigiTask Endcap analog pulse %02d",
i + 1);
79 sprintf(histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 0 - Saturated",
i + 1);
82 sprintf(histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 1",
i + 1);
85 sprintf(histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 6",
i + 1);
88 sprintf(histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 12",
i + 1);
91 sprintf(histo,
"EcalDigiTask Endcap gain pulse %02d",
i + 1);
95 sprintf(histo,
"EcalDigiTask Endcap pedestal for pre-sample");
98 sprintf(histo,
"EcalDigiTask Endcap maximum position gt 100 ADC");
101 sprintf(histo,
"EcalDigiTask Endcap maximum position gt 20 ADC");
104 sprintf(histo,
"EcalDigiTask Endcap ADC counts after gain switch");
127 std::vector<double> eeAnalogSignal;
128 std::vector<double> eeADCCounts;
129 std::vector<double> eeADCGains;
137 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
139 int nrSamples = eedf.
size();
143 if (eeid.
zside() > 0) {
147 }
else if (eeid.
zside() < 0) {
155 double pedestalPreSample = 0.;
156 double pedestalPreSampleAnalog = 0.;
157 int countsAfterGainSwitch = -1;
158 double higherGain = 1.;
159 int higherGainSample = 0;
162 eeAnalogSignal[
sample] = 0.;
174 if (Emax < eeAnalogSignal[
sample]) {
175 Emax = eeAnalogSignal[
sample];
180 pedestalPreSample += eeADCCounts[
sample];
181 pedestalPreSampleAnalog += eeADCCounts[
sample] *
gainConv_[(
int)eeADCGains[sample]] * endcapADCtoGeV_;
184 if (sample > 0 && (((eeADCGains[sample] > eeADCGains[sample - 1]) && (eeADCGains[sample - 1] != 0)) ||
185 (countsAfterGainSwitch < 0 && eeADCGains[
sample] == 0))) {
186 higherGain = eeADCGains[
sample];
187 higherGainSample =
sample;
188 countsAfterGainSwitch = 1;
191 if ((higherGain > 1 && (higherGainSample != sample) && (eeADCGains[
sample] == higherGain)) ||
192 (higherGain == 3 && (higherGainSample !=
sample) && (eeADCGains[sample] == 0)) ||
193 (higherGain == 0 && (higherGainSample != sample) && ((eeADCGains[
sample] == 0) || (eeADCGains[sample] == 3))))
194 countsAfterGainSwitch++;
196 pedestalPreSample /= 3.;
197 pedestalPreSampleAnalog /= 3.;
199 LogDebug(
"DigiInfo") <<
"Endcap Digi for EEDetId = " << eeid.
rawId() <<
" x,y " << eeid.
ix() <<
" " << eeid.
iy();
200 for (
int i = 0;
i < 10;
i++) {
201 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i]
202 <<
" Analog = " << eeAnalogSignal[
i];
204 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax
205 <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
206 if (countsAfterGainSwitch > 0)
207 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! " 211 << countsAfterGainSwitch;
212 for (
int i = 0;
i < 10;
i++) {
213 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i]
214 <<
" Analog = " << eeAnalogSignal[
i];
218 for (
int i = 0;
i < 10;
i++) {
224 if (eeADCGains[i] == 0) {
227 }
else if (eeADCGains[i] == 3) {
230 }
else if (eeADCGains[i] == 2) {
233 }
else if (eeADCGains[i] == 1) {
272 LogDebug(
"EcalDigi") <<
" Gains conversions: " 274 <<
" g0 = " << gainConv_[0] <<
"\n" 275 <<
" g1 = " << gainConv_[1] <<
"\n" 276 <<
" g2 = " << gainConv_[2] <<
"\n" 277 <<
" g3 = " << gainConv_[3];
279 delete defaultRatios;
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getUntrackedParameter(std::string const &, T const &) const
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
~EcalEndcapDigisValidation() override
Destructor.
MonitorElement * meEEDigiADCgS_[10]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * meEEDigiOccupancyzm_
void setCurrentFolder(std::string const &fullpath)
MonitorElement * meEEDigiGain_[10]
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meEEMaximumgt100ADC_
MonitorElement * meEEDigiMultiplicityzm_
MonitorElement * meEEPedestal_
int gainId() const
get the gainId (2 bits)
MonitorElement * meEEDigiADCAnalog_[10]
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
MonitorElement * meEEDigiADCg12_[10]
Namespace of DDCMS conversion namespace.
void reserve(size_t isize)
T const * product() const
MonitorElement * meEEDigiADCg1_[10]
MonitorElement * meEEDigiMultiplicityzp_
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 * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
MonitorElement * meEEnADCafterSwitch_
static constexpr int MAXSAMPLES
T const * product() const
int adc() const
get the ADC sample (12 bits)
MonitorElement * meEEMaximumgt20ADC_
MonitorElement * meEEDigiADCGlobal_