76 m_EBdigiCollection(
params.getParameter<
std::
string>(
"EBdigiCollection")),
77 m_EEdigiCollection(
params.getParameter<
std::
string>(
"EEdigiCollection")),
78 m_ESdigiCollection(
params.getParameter<
std::
string>(
"ESdigiCollection")),
80 m_useLCcorrection(
params.getUntrackedParameter<
bool>(
"UseLCcorrection")),
81 m_apdSeparateDigi(
params.getParameter<
bool>(
"apdSeparateDigi")),
83 m_EBs25notCont(
params.getParameter<double>(
"EBs25notContainment")),
84 m_EEs25notCont(
params.getParameter<double>(
"EEs25notContainment")),
86 m_readoutFrameSize(
ecalPh1::sampleSize),
88 params.getParameter<double>(
"simHitToPhotoelectronsEndcap"),
89 params.getParameter<double>(
"photoelectronsToAnalogBarrel"),
90 params.getParameter<double>(
"photoelectronsToAnalogEndcap"),
91 params.getParameter<double>(
"samplingFactor"),
92 params.getParameter<double>(
"timePhase"),
95 params.getParameter<
bool>(
"doPhotostatistics"),
101 params.getParameter<double>(
"apdSimToPELow"),
102 params.getParameter<double>(
"apdSimToPEHigh"),
103 params.getParameter<double>(
"apdTimeOffset"),
104 params.getParameter<double>(
"apdTimeOffWidth"),
117 m_apdParameters.
get(),
124 m_addESNoise(
params.getParameter<
bool>(
"doESNoise")),
125 m_PreMix1(
params.getParameter<
bool>(
"EcalPreMixStage1")),
126 m_PreMix2(
params.getParameter<
bool>(
"EcalPreMixStage2")),
128 m_doFastES(
params.getParameter<
bool>(
"doFast")),
134 m_ESElectronicsSim(m_doFastES ? nullptr : new
ESElectronicsSim(m_addESNoise)),
136 m_ESOldDigitizer(m_doFastES ? nullptr
139 m_ESElectronicsSimFast(!m_doFastES ? nullptr : new
ESElectronicsSimFast(m_addESNoise, m_PreMix1)),
141 m_ESDigitizer(!m_doFastES ? nullptr
142 : new
ESDigitizer(m_ESResponse.
get(), m_ESElectronicsSimFast.
get(), m_addESNoise)),
144 m_APDDigitizer(nullptr),
145 m_BarrelDigitizer(nullptr),
146 m_EndcapDigitizer(nullptr),
147 m_ElectronicsSim(nullptr),
149 m_APDElectronicsSim(nullptr),
152 m_EBCorrNoise({{
nullptr,
nullptr,
nullptr}}),
153 m_EECorrNoise({{
nullptr,
nullptr,
nullptr}}) {
160 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
162 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEE"));
164 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsES"));
166 const std::vector<double> ebCorMatG12 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG12");
167 const std::vector<double> eeCorMatG12 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG12");
168 const std::vector<double> ebCorMatG06 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG06");
169 const std::vector<double> eeCorMatG06 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG06");
170 const std::vector<double> ebCorMatG01 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG01");
171 const std::vector<double> eeCorMatG01 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG01");
174 const double rmsConstantTerm =
params.getParameter<
double>(
"ConstantTerm");
176 const bool addNoise =
params.getParameter<
bool>(
"doENoise");
193 assert(ebCorMatG12.size() == m_readoutFrameSize);
194 assert(eeCorMatG12.size() == m_readoutFrameSize);
195 assert(ebCorMatG06.size() == m_readoutFrameSize);
196 assert(eeCorMatG06.size() == m_readoutFrameSize);
197 assert(ebCorMatG01.size() == m_readoutFrameSize);
198 assert(eeCorMatG01.size() == m_readoutFrameSize);
200 assert(1.
e-7 > fabs(ebCorMatG12[0] - 1.0));
201 assert(1.
e-7 > fabs(ebCorMatG06[0] - 1.0));
202 assert(1.
e-7 > fabs(ebCorMatG01[0] - 1.0));
203 assert(1.
e-7 > fabs(eeCorMatG12[0] - 1.0));
204 assert(1.
e-7 > fabs(eeCorMatG06[0] - 1.0));
205 assert(1.
e-7 > fabs(eeCorMatG01[0] - 1.0));
207 for (
unsigned int row(0); row != m_readoutFrameSize; ++row) {
208 assert(0 == row || 1. >= ebCorMatG12[row]);
209 assert(0 == row || 1. >= ebCorMatG06[row]);
210 assert(0 == row || 1. >= ebCorMatG01[row]);
211 assert(0 == row || 1. >= eeCorMatG12[row]);
212 assert(0 == row || 1. >= eeCorMatG06[row]);
213 assert(0 == row || 1. >= eeCorMatG01[row]);
214 for (
unsigned int column(0); column <= row; ++column) {
215 const unsigned int index(row - column);
216 ebMatrix[0](row, column) = ebCorMatG12[
index];
217 eeMatrix[0](row, column) = eeCorMatG12[
index];
218 ebMatrix[1](row, column) = ebCorMatG06[
index];
219 eeMatrix[1](row, column) = eeCorMatG06[
index];
220 ebMatrix[2](row, column) = ebCorMatG01[
index];
221 eeMatrix[2](row, column) = eeCorMatG01[
index];
225 m_EBCorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[0]);
226 m_EECorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[0]);
227 m_EBCorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[1]);
228 m_EECorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[1]);
229 m_EBCorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[2]);
230 m_EECorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[2]);
232 m_Coder = std::make_unique<EcalCoder>(addNoise,
234 m_EBCorrNoise[0].
get(),
235 m_EECorrNoise[0].
get(),
236 m_EBCorrNoise[1].
get(),
237 m_EECorrNoise[1].
get(),
238 m_EBCorrNoise[2].
get(),
239 m_EECorrNoise[2].
get());
242 std::make_unique<EcalElectronicsSim_Ph1>(m_ParameterMap.get(), m_Coder.get(),
applyConstantTerm, rmsConstantTerm);
244 if (m_apdSeparateDigi) {
245 m_APDCoder = std::make_unique<EcalCoder>(
false,
247 m_EBCorrNoise[0].
get(),
248 m_EECorrNoise[0].
get(),
249 m_EBCorrNoise[1].
get(),
250 m_EECorrNoise[1].
get(),
251 m_EBCorrNoise[2].
get(),
252 m_EECorrNoise[2].
get());
254 m_APDElectronicsSim = std::make_unique<EcalElectronicsSim_Ph1>(
257 m_APDDigitizer = std::make_unique<EBDigitizer>(m_APDResponse.get(), m_APDElectronicsSim.get(),
false);
261 m_BarrelDigitizer = std::make_unique<EBDigitizer>(m_EBResponse.get(), m_ElectronicsSim.get(), addNoise);
265 m_EndcapDigitizer = std::make_unique<EEDigitizer>(m_EEResponse.get(), m_ElectronicsSim.get(), addNoise);
328 e.getByLabel(ebTag, ebHandle);
336 e.getByLabel(eeTag, eeHandle);
342 e.getByLabel(esTag, esHandle);
355 e.getByLabel(ebTag, ebHandle);
361 e.getByLabel(eeTag, eeHandle);
367 e.getByLabel(esTag, esHandle);
386 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size();
390 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size();
396 edm::LogInfo(
"EcalDigi") <<
"EE Digis: " << endcapResult->size();
405 edm::LogInfo(
"EcalDigi") <<
"ES Digis: " << preshowerResult->size();
423 throw cms::Exception(
"Configuration") <<
"RandomNumberGenerator service is not available.\n"
424 "You must add the service in the configuration file\n"
425 "or remove the module that requires it.";
427 CLHEP::HepRandomEngine *engine = &rng->
getEngine(
lumi.index());
443 m_Coder->setPedestals(pedestals);
452 m_Coder->setIntercalibConstants(ical);
487 double theGains[
m_Coder->NGAINS + 1];
491 theGains[1] = theGains[2] * (defaultRatios->
gain12Over6());
495 <<
" g1 = " << theGains[1] <<
"\n"
496 <<
" g2 = " << theGains[2] <<
"\n"
497 <<
" g3 = " << theGains[3];
499 delete defaultRatios;
513 m_Coder->setFullScaleEnergy(EBscale, EEscale);
515 m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
533 const int ESGain(1.1 > esgain->getESGain() ? 1 : 2);
534 const double ESMIPToGeV((1 ==
ESGain) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh());
579 const std::vector<DetId> *theESDets(