74 m_EBdigiCollection(
params.getParameter<
std::
string>(
"EBdigiCollection")),
75 m_EEdigiCollection(
params.getParameter<
std::
string>(
"EEdigiCollection")),
76 m_ESdigiCollection(
params.getParameter<
std::
string>(
"ESdigiCollection")),
78 m_useLCcorrection(
params.getUntrackedParameter<
bool>(
"UseLCcorrection")),
79 m_apdSeparateDigi(
params.getParameter<
bool>(
"apdSeparateDigi")),
81 m_EBs25notCont(
params.getParameter<double>(
"EBs25notContainment")),
82 m_EEs25notCont(
params.getParameter<double>(
"EEs25notContainment")),
84 m_readoutFrameSize(
params.getParameter<
int>(
"readoutFrameSize")),
86 params.getParameter<double>(
"simHitToPhotoelectronsEndcap"),
87 params.getParameter<double>(
"photoelectronsToAnalogBarrel"),
88 params.getParameter<double>(
"photoelectronsToAnalogEndcap"),
89 params.getParameter<double>(
"samplingFactor"),
90 params.getParameter<double>(
"timePhase"),
93 params.getParameter<
bool>(
"doPhotostatistics"),
99 params.getParameter<double>(
"apdSimToPELow"),
100 params.getParameter<double>(
"apdSimToPEHigh"),
101 params.getParameter<double>(
"apdTimeOffset"),
102 params.getParameter<double>(
"apdTimeOffWidth"),
105 params.getParameter<
std::vector<double>>(
"apdNonlParms"))),
115 m_apdParameters.
get(),
122 m_addESNoise(
params.getParameter<
bool>(
"doESNoise")),
123 m_PreMix1(
params.getParameter<
bool>(
"EcalPreMixStage1")),
124 m_PreMix2(
params.getParameter<
bool>(
"EcalPreMixStage2")),
126 m_doFastES(
params.getParameter<
bool>(
"doFast")),
132 m_ESElectronicsSim(m_doFastES ? nullptr : new
ESElectronicsSim(m_addESNoise)),
134 m_ESOldDigitizer(m_doFastES ? nullptr
137 m_ESElectronicsSimFast(!m_doFastES ? nullptr : new
ESElectronicsSimFast(m_addESNoise, m_PreMix1)),
139 m_ESDigitizer(!m_doFastES ? nullptr
140 : new
ESDigitizer(m_ESResponse.
get(), m_ESElectronicsSimFast.
get(), m_addESNoise)),
142 m_APDDigitizer(nullptr),
143 m_BarrelDigitizer(nullptr),
144 m_EndcapDigitizer(nullptr),
145 m_ElectronicsSim(nullptr),
147 m_APDElectronicsSim(nullptr),
150 m_EBCorrNoise({{
nullptr,
nullptr,
nullptr}}),
151 m_EECorrNoise({{
nullptr,
nullptr,
nullptr}}) {
158 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
160 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEE"));
162 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsES"));
164 const std::vector<double> ebCorMatG12 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG12");
165 const std::vector<double> eeCorMatG12 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG12");
166 const std::vector<double> ebCorMatG06 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG06");
167 const std::vector<double> eeCorMatG06 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG06");
168 const std::vector<double> ebCorMatG01 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG01");
169 const std::vector<double> eeCorMatG01 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG01");
172 const double rmsConstantTerm =
params.getParameter<
double>(
"ConstantTerm");
174 const bool addNoise =
params.getParameter<
bool>(
"doENoise");
191 assert(ebCorMatG12.size() == m_readoutFrameSize);
192 assert(eeCorMatG12.size() == m_readoutFrameSize);
193 assert(ebCorMatG06.size() == m_readoutFrameSize);
194 assert(eeCorMatG06.size() == m_readoutFrameSize);
195 assert(ebCorMatG01.size() == m_readoutFrameSize);
196 assert(eeCorMatG01.size() == m_readoutFrameSize);
198 assert(1.
e-7 > fabs(ebCorMatG12[0] - 1.0));
199 assert(1.
e-7 > fabs(ebCorMatG06[0] - 1.0));
200 assert(1.
e-7 > fabs(ebCorMatG01[0] - 1.0));
201 assert(1.
e-7 > fabs(eeCorMatG12[0] - 1.0));
202 assert(1.
e-7 > fabs(eeCorMatG06[0] - 1.0));
203 assert(1.
e-7 > fabs(eeCorMatG01[0] - 1.0));
205 for (
unsigned int row(0); row != m_readoutFrameSize; ++row) {
206 assert(0 == row || 1. >= ebCorMatG12[row]);
207 assert(0 == row || 1. >= ebCorMatG06[row]);
208 assert(0 == row || 1. >= ebCorMatG01[row]);
209 assert(0 == row || 1. >= eeCorMatG12[row]);
210 assert(0 == row || 1. >= eeCorMatG06[row]);
211 assert(0 == row || 1. >= eeCorMatG01[row]);
212 for (
unsigned int column(0); column <= row; ++column) {
213 const unsigned int index(row - column);
214 ebMatrix[0](row, column) = ebCorMatG12[
index];
215 eeMatrix[0](row, column) = eeCorMatG12[
index];
216 ebMatrix[1](row, column) = ebCorMatG06[
index];
217 eeMatrix[1](row, column) = eeCorMatG06[
index];
218 ebMatrix[2](row, column) = ebCorMatG01[
index];
219 eeMatrix[2](row, column) = eeCorMatG01[
index];
232 m_EBCorrNoise[0].
get(),
233 m_EECorrNoise[0].
get(),
234 m_EBCorrNoise[1].
get(),
235 m_EECorrNoise[1].
get(),
236 m_EBCorrNoise[2].
get(),
237 m_EECorrNoise[2].
get()));
239 m_ElectronicsSim.reset(
242 if (m_apdSeparateDigi) {
245 m_EBCorrNoise[0].
get(),
246 m_EECorrNoise[0].
get(),
247 m_EBCorrNoise[1].
get(),
248 m_EECorrNoise[1].
get(),
249 m_EBCorrNoise[2].
get(),
250 m_EECorrNoise[2].
get()));
252 m_APDElectronicsSim.reset(
255 m_APDDigitizer.reset(
new EBDigitizer(m_APDResponse.get(), m_APDElectronicsSim.get(),
false));
259 m_BarrelDigitizer.reset(
new EBDigitizer(m_EBResponse.get(), m_ElectronicsSim.get(), addNoise));
263 m_EndcapDigitizer.reset(
new EEDigitizer(m_EEResponse.get(), m_ElectronicsSim.get(), addNoise));
326 e.getByLabel(ebTag, ebHandle);
334 e.getByLabel(eeTag, eeHandle);
340 e.getByLabel(esTag, esHandle);
353 e.getByLabel(ebTag, ebHandle);
359 e.getByLabel(eeTag, eeHandle);
365 e.getByLabel(esTag, esHandle);
384 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size();
388 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size();
394 edm::LogInfo(
"EcalDigi") <<
"EE Digis: " << endcapResult->size();
403 edm::LogInfo(
"EcalDigi") <<
"ES Digis: " << preshowerResult->size();
421 throw cms::Exception(
"Configuration") <<
"RandomNumberGenerator service is not available.\n"
422 "You must add the service in the configuration file\n"
423 "or remove the module that requires it.";
425 CLHEP::HepRandomEngine *engine = &rng->
getEngine(
lumi.index());
441 m_Coder->setPedestals(pedestals);
450 m_Coder->setIntercalibConstants(ical);
485 double theGains[
m_Coder->NGAINS + 1];
489 theGains[1] = theGains[2] * (defaultRatios->
gain12Over6());
493 <<
" g1 = " << theGains[1] <<
"\n"
494 <<
" g2 = " << theGains[2] <<
"\n"
495 <<
" g3 = " << theGains[3];
497 delete defaultRatios;
511 m_Coder->setFullScaleEnergy(EBscale, EEscale);
513 m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
531 const int ESGain(1.1 > esgain->getESGain() ? 1 : 2);
532 const double ESMIPToGeV((1 ==
ESGain) ? esMipToGeV->getESValueLow() : esMipToGeV->getESValueHigh());
577 const std::vector<DetId> *theESDets(