56 m_EBdigiCollection(
params.getParameter<
std::
string>(
"EBdigiCollection")),
57 m_EEdigiCollection(
params.getParameter<
std::
string>(
"EEdigiCollection")),
58 m_ESdigiCollection(
params.getParameter<
std::
string>(
"ESdigiCollection")),
66 m_useLCcorrection(
params.getUntrackedParameter<
bool>(
"UseLCcorrection")),
67 m_apdSeparateDigi(
params.getParameter<
bool>(
"apdSeparateDigi")),
69 m_EBs25notCont(
params.getParameter<double>(
"EBs25notContainment")),
70 m_EEs25notCont(
params.getParameter<double>(
"EEs25notContainment")),
72 m_readoutFrameSize(
ecalPh1::sampleSize),
74 params.getParameter<double>(
"simHitToPhotoelectronsEndcap"),
75 params.getParameter<double>(
"photoelectronsToAnalogBarrel"),
76 params.getParameter<double>(
"photoelectronsToAnalogEndcap"),
77 params.getParameter<double>(
"samplingFactor"),
78 params.getParameter<double>(
"timePhase"),
81 params.getParameter<
bool>(
"doPhotostatistics"),
87 params.getParameter<double>(
"apdSimToPELow"),
88 params.getParameter<double>(
"apdSimToPEHigh"),
89 params.getParameter<double>(
"apdTimeOffset"),
90 params.getParameter<double>(
"apdTimeOffWidth"),
103 m_apdParameters.
get(),
110 m_addESNoise(
params.getParameter<
bool>(
"doESNoise")),
111 m_PreMix1(
params.getParameter<
bool>(
"EcalPreMixStage1")),
112 m_PreMix2(
params.getParameter<
bool>(
"EcalPreMixStage2")),
114 m_doFastES(
params.getParameter<
bool>(
"doFast")),
120 m_ESElectronicsSim(m_doFastES ? nullptr : new
ESElectronicsSim(m_addESNoise)),
122 m_ESOldDigitizer(m_doFastES ? nullptr
125 m_ESElectronicsSimFast(!m_doFastES ? nullptr : new
ESElectronicsSimFast(m_addESNoise, m_PreMix1)),
127 m_ESDigitizer(!m_doFastES ? nullptr
128 : new
ESDigitizer(m_ESResponse.
get(), m_ESElectronicsSimFast.
get(), m_addESNoise)),
130 m_APDDigitizer(nullptr),
131 m_BarrelDigitizer(nullptr),
132 m_EndcapDigitizer(nullptr),
133 m_ElectronicsSim(nullptr),
135 m_APDElectronicsSim(nullptr),
138 m_EBCorrNoise({{
nullptr,
nullptr,
nullptr}}),
139 m_EECorrNoise({{
nullptr,
nullptr,
nullptr}}) {
146 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
148 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEE"));
150 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsES"));
151 m_esGainToken = iC.esConsumes();
152 m_esMIPToGeVToken = iC.esConsumes();
153 m_esPedestalsToken = iC.esConsumes();
154 m_esMIPsToken = iC.esConsumes();
157 const std::vector<double> ebCorMatG12 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG12");
158 const std::vector<double> eeCorMatG12 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG12");
159 const std::vector<double> ebCorMatG06 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG06");
160 const std::vector<double> eeCorMatG06 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG06");
161 const std::vector<double> ebCorMatG01 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG01");
162 const std::vector<double> eeCorMatG01 =
params.getParameter<std::vector<double>>(
"EECorrNoiseMatrixG01");
165 const double rmsConstantTerm =
params.getParameter<
double>(
"ConstantTerm");
167 const bool addNoise =
params.getParameter<
bool>(
"doENoise");
184 assert(ebCorMatG12.size() == m_readoutFrameSize);
185 assert(eeCorMatG12.size() == m_readoutFrameSize);
186 assert(ebCorMatG06.size() == m_readoutFrameSize);
187 assert(eeCorMatG06.size() == m_readoutFrameSize);
188 assert(ebCorMatG01.size() == m_readoutFrameSize);
189 assert(eeCorMatG01.size() == m_readoutFrameSize);
191 assert(1.
e-7 > fabs(ebCorMatG12[0] - 1.0));
192 assert(1.
e-7 > fabs(ebCorMatG06[0] - 1.0));
193 assert(1.
e-7 > fabs(ebCorMatG01[0] - 1.0));
194 assert(1.
e-7 > fabs(eeCorMatG12[0] - 1.0));
195 assert(1.
e-7 > fabs(eeCorMatG06[0] - 1.0));
196 assert(1.
e-7 > fabs(eeCorMatG01[0] - 1.0));
198 for (
unsigned int row(0); row != m_readoutFrameSize; ++row) {
199 assert(0 == row || 1. >= ebCorMatG12[row]);
200 assert(0 == row || 1. >= ebCorMatG06[row]);
201 assert(0 == row || 1. >= ebCorMatG01[row]);
202 assert(0 == row || 1. >= eeCorMatG12[row]);
203 assert(0 == row || 1. >= eeCorMatG06[row]);
204 assert(0 == row || 1. >= eeCorMatG01[row]);
205 for (
unsigned int column(0); column <= row; ++column) {
206 const unsigned int index(row - column);
207 ebMatrix[0](row, column) = ebCorMatG12[
index];
208 eeMatrix[0](row, column) = eeCorMatG12[
index];
209 ebMatrix[1](row, column) = ebCorMatG06[
index];
210 eeMatrix[1](row, column) = eeCorMatG06[
index];
211 ebMatrix[2](row, column) = ebCorMatG01[
index];
212 eeMatrix[2](row, column) = eeCorMatG01[
index];
216 m_EBCorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[0]);
217 m_EECorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[0]);
218 m_EBCorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[1]);
219 m_EECorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[1]);
220 m_EBCorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(ebMatrix[2]);
221 m_EECorrNoise[2] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix>>(eeMatrix[2]);
223 m_Coder = std::make_unique<EcalCoder>(addNoise,
225 m_EBCorrNoise[0].
get(),
226 m_EECorrNoise[0].
get(),
227 m_EBCorrNoise[1].
get(),
228 m_EECorrNoise[1].
get(),
229 m_EBCorrNoise[2].
get(),
230 m_EECorrNoise[2].
get());
233 std::make_unique<EcalElectronicsSim_Ph1>(m_ParameterMap.get(), m_Coder.get(),
applyConstantTerm, rmsConstantTerm);
235 if (m_apdSeparateDigi) {
236 m_APDCoder = std::make_unique<EcalCoder>(
false,
238 m_EBCorrNoise[0].
get(),
239 m_EECorrNoise[0].
get(),
240 m_EBCorrNoise[1].
get(),
241 m_EECorrNoise[1].
get(),
242 m_EBCorrNoise[2].
get(),
243 m_EECorrNoise[2].
get());
245 m_APDElectronicsSim = std::make_unique<EcalElectronicsSim_Ph1>(
248 m_APDDigitizer = std::make_unique<EBDigitizer>(m_APDResponse.get(), m_APDElectronicsSim.get(),
false);
252 m_BarrelDigitizer = std::make_unique<EBDigitizer>(m_EBResponse.get(), m_ElectronicsSim.get(), addNoise);
256 m_EndcapDigitizer = std::make_unique<EEDigitizer>(m_EEResponse.get(), m_ElectronicsSim.get(), addNoise);
319 e.getByLabel(ebTag, ebHandle);
327 e.getByLabel(eeTag, eeHandle);
333 e.getByLabel(esTag, esHandle);
346 e.getByLabel(ebTag, ebHandle);
352 e.getByLabel(eeTag, eeHandle);
358 e.getByLabel(esTag, esHandle);
377 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size();
381 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size();
387 edm::LogInfo(
"EcalDigi") <<
"EE Digis: " << endcapResult->size();
396 edm::LogInfo(
"EcalDigi") <<
"ES Digis: " << preshowerResult->size();
414 throw cms::Exception(
"Configuration") <<
"RandomNumberGenerator service is not available.\n"
415 "You must add the service in the configuration file\n"
416 "or remove the module that requires it.";
418 CLHEP::HepRandomEngine *engine = &rng->
getEngine(
lumi.index());
432 m_Coder->setPedestals(pedestals);
439 m_Coder->setIntercalibConstants(ical);
469 double theGains[
m_Coder->NGAINS + 1];
473 theGains[1] = theGains[2] * (defaultRatios->
gain12Over6());
477 <<
" g1 = " << theGains[1] <<
"\n"
478 <<
" g2 = " << theGains[2] <<
"\n"
479 <<
" g3 = " << theGains[3];
481 delete defaultRatios;
495 m_Coder->setFullScaleEnergy(EBscale, EEscale);
497 m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
543 const std::vector<DetId> *theESDets(