56 m_EBdigiCollection(params.getParameter<std::
string>(
"EBdigiCollection")),
57 m_EEdigiCollection(params.getParameter<std::
string>(
"EEdigiCollection")),
58 m_ESdigiCollection(params.getParameter<std::
string>(
"ESdigiCollection")),
59 m_hitsProducerTag(params.getParameter<std::
string>(
"hitsProducer")),
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),
73 m_ParameterMap(new
EcalSimParameterMap(params.getParameter<double>(
"simHitToPhotoelectronsBarrel"),
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"),
80 params.getParameter<int>(
"binOfMaximum"),
81 params.getParameter<bool>(
"doPhotostatistics"),
82 params.getParameter<bool>(
"syncPhase"))),
84 m_apdDigiTag(params.getParameter<std::
string>(
"apdDigiTag")),
85 m_apdParameters(new
APDSimParameters(params.getParameter<bool>(
"apdAddToBarrel"),
87 params.getParameter<double>(
"apdSimToPELow"),
88 params.getParameter<double>(
"apdSimToPEHigh"),
89 params.getParameter<double>(
"apdTimeOffset"),
90 params.getParameter<double>(
"apdTimeOffWidth"),
91 params.getParameter<bool>(
"apdDoPEStats"),
93 params.getParameter<std::
vector<double>>(
"apdNonlParms"))),
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")),
116 m_doEB(params.getParameter<bool>(
"doEB")),
117 m_doEE(params.getParameter<bool>(
"doEE")),
118 m_doES(params.getParameter<bool>(
"doES")),
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),
132 m_EndcapDigitizer(nullptr),
135 m_APDElectronicsSim(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");
176 m_EBResponse->setPhaseShift(1. + cosmicsShift);
178 m_EEResponse->setPhaseShift(1. + cosmicsShift);
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]);
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());
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);
256 m_EndcapDigitizer = std::make_unique<EEDigitizer>(m_EEResponse.get(), m_ElectronicsSim.get(),
addNoise);
271 m_APDDigitizer->initializeHits();
375 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size();
379 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size();
385 edm::LogInfo(
"EcalDigi") <<
"EE Digis: " << endcapResult->size();
394 edm::LogInfo(
"EcalDigi") <<
"ES Digis: " << preshowerResult->size();
412 throw cms::Exception(
"Configuration") <<
"RandomNumberGenerator service is not available.\n"
413 "You must add the service in the configuration file\n"
414 "or remove the module that requires it.";
430 m_Coder->setPedestals(pedestals);
437 m_Coder->setIntercalibConstants(ical);
461 m_Coder->setGainRatios(gr);
467 double theGains[m_Coder->NGAINS + 1];
471 theGains[1] = theGains[2] * (defaultRatios->
gain12Over6());
475 <<
" g1 = " << theGains[1] <<
"\n"
476 <<
" g2 = " << theGains[2] <<
"\n"
477 <<
" g3 = " << theGains[3];
479 delete defaultRatios;
493 m_Coder->setFullScaleEnergy(EBscale, EEscale);
495 m_APDCoder->setFullScaleEnergy(EBscale, EEscale);
541 const std::vector<DetId> *theESDets(
std::unique_ptr< EcalCoder > m_APDCoder
int bunchCrossing() const
edm::ESWatcher< CaloGeometryRecord > m_geometryWatcher
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
std::unique_ptr< ESDigitizer > m_ESDigitizer
edm::ESGetToken< ESMIPToGeVConstant, ESMIPToGeVConstantRcd > m_esMIPToGeVToken
const bool applyConstantTerm
LuminosityBlockIndex index() const
const std::string m_ESdigiCollection
const edm::ESGetToken< EcalIntercalibConstantsMC, EcalIntercalibConstantsMCRcd > m_icalToken
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
std::unique_ptr< EEDigitizer > m_EndcapDigitizer
void setGain(const int gain)
std::unique_ptr< EBHitResponse > m_APDResponse
float getESValueLow() const
const edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > m_laserToken
const std::string m_hitsProducerTag
EcalCorrMatrix_Ph2 ebMatrix[2]
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > m_geometryToken
const std::string m_EEdigiCollection
std::unique_ptr< ESHitResponse > m_ESResponse
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void setEENoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
bool getData(T &iHolder) const
void setEBNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void setESNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
void accumulateCaloHits(HitsHandle const &ebHandle, HitsHandle const &eeHandle, HitsHandle const &esHandle, int bunchCrossing)
const double rmsConstantTerm
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
Creates electronics signals from hits.
const double m_EBs25notCont
edm::ESGetToken< ESIntercalibConstants, ESIntercalibConstantsRcd > m_esMIPsToken
std::unique_ptr< CaloHitResponse > m_ESOldResponse
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
unsigned long long TimeValue_t
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const CaloGeometry * m_Geometry
void checkCalibrations(const edm::Event &event, const edm::EventSetup &eventSetup)
const double cosmicsShift
void checkGeometry(const edm::EventSetup &eventSetup)
std::unique_ptr< EBDigitizer > m_BarrelDigitizer
std::unique_ptr< ESElectronicsSimFast > m_ESElectronicsSimFast
Log< level::Info, false > LogInfo
const edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > m_agcToken
CLHEP::HepRandomEngine * randomEngine_
T const * product() const
virtual void cacheEBDigis(const EBDigiCollection *ebDigiPtr) const
std::unique_ptr< EEHitResponse > m_EEResponse
edm::ESGetToken< ESPedestals, ESPedestalsRcd > m_esPedestalsToken
float gain12Over6() const
bool check(const edm::EventSetup &iSetup)
const bool m_apdSeparateDigi
std::unique_ptr< ESElectronicsSim > m_ESElectronicsSim
bool getByLabel(edm::InputTag const &tag, edm::Handle< T > &result) const
StreamID streamID() const
const std::string m_apdDigiTag
void setEventSetup(const edm::EventSetup &evtSetup)
const edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > m_pedestalsToken
std::unique_ptr< EBHitResponse > m_EBResponse
std::unique_ptr< ESOldDigitizer > m_ESOldDigitizer
~EcalDigiProducer() override
EcalDigiProducer(const edm::ParameterSet ¶ms, edm::ProducesCollector, edm::ConsumesCollector &iC)
float getESValueHigh() const
virtual void cacheEEDigis(const EEDigiCollection *eeDigiPtr) const
const std::string m_EBdigiCollection
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
const edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > m_grToken
const double m_EEs25notCont
m_EECorrNoise({{nullptr, nullptr, nullptr}})