36 for (
int i = 0;
i < 10;
i++) {
61 sprintf(histo,
"EcalDigiTask Barrel occupancy");
64 sprintf(histo,
"EcalDigiTask Barrel digis multiplicity");
67 sprintf(histo,
"EcalDigiTask Barrel global pulse shape");
70 for (
int i = 0;
i < 10;
i++) {
71 sprintf(histo,
"EcalDigiTask Barrel analog pulse %02d",
i + 1);
74 sprintf(histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 0 - Saturated",
i + 1);
77 sprintf(histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 1",
i + 1);
80 sprintf(histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 6",
i + 1);
83 sprintf(histo,
"EcalDigiTask Barrel ADC pulse %02d Gain 12",
i + 1);
86 sprintf(histo,
"EcalDigiTask Barrel gain pulse %02d",
i + 1);
90 sprintf(histo,
"EcalDigiTask Barrel pedestal for pre-sample");
93 sprintf(histo,
"EcalDigiTask Barrel maximum position gt 100 ADC");
96 sprintf(histo,
"EcalDigiTask Barrel maximum position gt 10 ADC");
99 sprintf(histo,
"EcalDigiTask Barrel ADC counts after gain switch");
122 std::vector<double> ebAnalogSignal;
123 std::vector<double> ebADCCounts;
124 std::vector<double> ebADCGains;
131 for (
unsigned int digis = 0; digis < EcalDigiEB->
size(); ++digis) {
133 int nrSamples = ebdf.
size();
143 double pedestalPreSample = 0.;
144 double pedestalPreSampleAnalog = 0.;
145 int countsAfterGainSwitch = -1;
146 double higherGain = 1.;
147 int higherGainSample = 0;
150 ebAnalogSignal[
sample] = 0.;
158 ebADCCounts[
sample] = (thisSample.
adc());
162 if (Emax < ebAnalogSignal[
sample]) {
163 Emax = ebAnalogSignal[
sample];
168 pedestalPreSample += ebADCCounts[
sample];
169 pedestalPreSampleAnalog += ebADCCounts[
sample] *
gainConv_[(
int)ebADCGains[sample]] * barrelADCtoGeV_;
172 if (sample > 0 && (((ebADCGains[sample] > ebADCGains[sample - 1]) && (ebADCGains[sample - 1] != 0)) ||
173 (countsAfterGainSwitch < 0 && ebADCGains[
sample] == 0))) {
174 higherGain = ebADCGains[
sample];
175 higherGainSample =
sample;
176 countsAfterGainSwitch = 1;
179 if ((higherGain > 1 && (higherGainSample != sample) && (ebADCGains[
sample] == higherGain)) ||
180 (higherGain == 3 && (higherGainSample !=
sample) && (ebADCGains[sample] == 0)) ||
181 (higherGain == 0 && (higherGainSample != sample) &&
182 ((ebADCGains[
sample] == 3) || (ebADCGains[sample] == 0)))) {
183 countsAfterGainSwitch++;
187 pedestalPreSample /= 3.;
188 pedestalPreSampleAnalog /= 3.;
190 LogDebug(
"DigiInfo") <<
"Barrel Digi for EBDetId = " << ebid.
rawId() <<
" eta,phi " << ebid.
ieta() <<
" " 192 for (
int i = 0;
i < 10;
i++) {
193 LogDebug(
"DigiInfo") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i]
194 <<
" Analog = " << ebAnalogSignal[
i];
196 LogDebug(
"DigiInfo") <<
"Maximum energy = " << Emax <<
" in sample " << Pmax
197 <<
" Pedestal from pre-sample = " << pedestalPreSampleAnalog;
198 if (countsAfterGainSwitch > 0)
199 LogDebug(
"DigiInfo") <<
"Counts after switch " << countsAfterGainSwitch;
201 if (countsAfterGainSwitch > 0 && countsAfterGainSwitch < 5) {
202 edm::LogWarning(
"DigiWarning") <<
"Wrong number of counts after gain switch before next switch! " 203 << countsAfterGainSwitch;
204 for (
int i = 0;
i < 10;
i++) {
205 edm::LogWarning(
"DigiWarning") <<
"sample " <<
i <<
" ADC = " << ebADCCounts[
i] <<
" gain = " << ebADCGains[
i]
206 <<
" Analog = " << ebAnalogSignal[
i];
210 for (
int i = 0;
i < 10;
i++) {
217 if (ebADCGains[i] == 0) {
220 }
else if (ebADCGains[i] == 3) {
223 }
else if (ebADCGains[i] == 2) {
226 }
else if (ebADCGains[i] == 1) {
263 LogDebug(
"EcalDigi") <<
" Gains conversions: " 265 <<
" g0 = " << gainConv_[0] <<
"\n" 266 <<
" g1 = " << gainConv_[1] <<
"\n" 267 <<
" g2 = " << gainConv_[2] <<
"\n" 268 <<
" g3 = " << gainConv_[3];
270 delete defaultRatios;
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
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_
void setCurrentFolder(std::string const &fullpath)
~EcalBarrelDigisValidation() override
Destructor.
MonitorElement * meEBMaximumgt100ADC_
constexpr uint32_t rawId() const
get the raw id
MonitorElement * meEBDigiADCAnalog_[10]
MonitorElement * meEBDigiMultiplicity_
int gainId() const
get the gainId (2 bits)
MonitorElement * meEBDigiGain_[10]
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * meEBDigiADCg6_[10]
int iphi() const
get the crystal iphi
void checkCalibrations(edm::EventSetup const &c)
void analyze(edm::Event const &e, edm::EventSetup const &c) override
Analyze.
edm::EDGetTokenT< EBDigiCollection > EBdigiCollection_
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
EcalBarrelDigisValidation(const edm::ParameterSet &ps)
Constructor.
int ieta() const
get the crystal ieta
MonitorElement * meEBDigiOccupancy_
MonitorElement * meEBDigiADCg1_[10]
Namespace of DDCMS conversion namespace.
void reserve(size_t isize)
MonitorElement * meEBPedestal_
T const * product() const
float gain12Over6() const
MonitorElement * meEBDigiADCGlobal_
MonitorElement * meEBDigiADCg12_[10]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
MonitorElement * meEBMaximumgt10ADC_
static constexpr int MAXSAMPLES
T const * product() const
int adc() const
get the ADC sample (12 bits)