36 for (
int i = 0;
i < 10;
i++) {
61 sprintf(
histo,
"EcalDigiTask Endcap occupancy z+");
64 sprintf(
histo,
"EcalDigiTask Endcap occupancy z-");
67 sprintf(
histo,
"EcalDigiTask Endcap multiplicity z+");
70 sprintf(
histo,
"EcalDigiTask Endcap multiplicity z-");
73 sprintf(
histo,
"EcalDigiTask Endcap global pulse shape");
76 for (
int i = 0;
i < 10;
i++) {
77 sprintf(
histo,
"EcalDigiTask Endcap analog pulse %02d",
i + 1);
80 sprintf(
histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 0 - Saturated",
i + 1);
83 sprintf(
histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 1",
i + 1);
86 sprintf(
histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 6",
i + 1);
89 sprintf(
histo,
"EcalDigiTask Endcap ADC pulse %02d Gain 12",
i + 1);
92 sprintf(
histo,
"EcalDigiTask Endcap gain pulse %02d",
i + 1);
96 sprintf(
histo,
"EcalDigiTask Endcap pedestal for pre-sample");
99 sprintf(
histo,
"EcalDigiTask Endcap maximum position gt 100 ADC");
102 sprintf(
histo,
"EcalDigiTask Endcap maximum position gt 20 ADC");
105 sprintf(
histo,
"EcalDigiTask Endcap ADC counts after gain switch");
128 std::vector<double> eeAnalogSignal;
129 std::vector<double> eeADCCounts;
130 std::vector<double> eeADCGains;
138 for (
unsigned int digis = 0; digis < EcalDigiEE->
size(); ++digis) {
140 int nrSamples = eedf.
size();
144 if (eeid.
zside() > 0) {
148 }
else if (eeid.
zside() < 0) {
156 double pedestalPreSample = 0.;
157 double pedestalPreSampleAnalog = 0.;
158 int countsAfterGainSwitch = -1;
159 double higherGain = 1.;
160 int higherGainSample = 0;
163 eeAnalogSignal[
sample] = 0.;
175 if (Emax < eeAnalogSignal[
sample]) {
176 Emax = eeAnalogSignal[
sample];
181 pedestalPreSample += eeADCCounts[
sample];
186 (countsAfterGainSwitch < 0 && eeADCGains[
sample] == 0))) {
187 higherGain = eeADCGains[
sample];
188 higherGainSample =
sample;
189 countsAfterGainSwitch = 1;
192 if ((higherGain > 1 && (higherGainSample !=
sample) && (eeADCGains[
sample] == higherGain)) ||
193 (higherGain == 3 && (higherGainSample !=
sample) && (eeADCGains[
sample] == 0)) ||
194 (higherGain == 0 && (higherGainSample !=
sample) && ((eeADCGains[
sample] == 0) || (eeADCGains[
sample] == 3))))
195 countsAfterGainSwitch++;
197 pedestalPreSample /= 3.;
198 pedestalPreSampleAnalog /= 3.;
200 LogDebug(
"DigiInfo") <<
"Endcap Digi for EEDetId = " << eeid.
rawId() <<
" x,y " << eeid.
ix() <<
" " << eeid.
iy();
201 for (
int i = 0;
i < 10;
i++) {
202 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i]
203 <<
" Analog = " << eeAnalogSignal[
i];
205 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " <<
Pmax 206 <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
207 if (countsAfterGainSwitch > 0)
208 LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
210 if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5) {
211 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " 212 << countsAfterGainSwitch;
213 for (
int i = 0;
i < 10;
i++) {
214 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << eeADCCounts[
i] <<
" gain = " << eeADCGains[
i]
215 <<
" Analog = " << eeAnalogSignal[
i];
219 for (
int i = 0;
i < 10;
i++) {
225 if (eeADCGains[
i] == 0) {
228 }
else if (eeADCGains[
i] == 3) {
231 }
else if (eeADCGains[
i] == 2) {
234 }
else if (eeADCGains[
i] == 1) {
271 LogDebug(
"EcalDigi") <<
" Gains conversions: " 278 delete defaultRatios;
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
~EcalEndcapDigisValidation() override
Destructor.
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > pAgc
MonitorElement * meEEDigiADCgS_[10]
virtual void setCurrentFolder(std::string const &fullpath)
MonitorElement * meEEDigiOccupancyzm_
MonitorElement * meEEDigiGain_[10]
T const * product() const
MonitorElement * meEEMaximumgt100ADC_
MonitorElement * meEEDigiMultiplicityzm_
MonitorElement * meEEPedestal_
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
MonitorElement * meEEDigiADCAnalog_[10]
edm::EDGetTokenT< EEDigiCollection > EEdigiCollectionToken_
MonitorElement * meEEDigiADCg12_[10]
Namespace of DDCMS conversion namespace.
void reserve(size_t isize)
float gain12Over6() const
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meEEDigiADCg1_[10]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
MonitorElement * meEEDigiMultiplicityzp_
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
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_
static constexpr int MAXSAMPLES
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
MonitorElement * meEEMaximumgt20ADC_
MonitorElement * meEEDigiADCGlobal_