61 m_ComponentShapes(iC),
64 m_EBdigiCollection(
params.getParameter<
std::
string>(
"EBdigiCollectionPh2")),
67 m_useLCcorrection(
params.getUntrackedParameter<
bool>(
"UseLCcorrection")),
68 m_apdSeparateDigi(
params.getParameter<
bool>(
"apdSeparateDigi")),
69 m_componentSeparateDigi(
params.getParameter<
bool>(
"componentSeparateDigi")),
71 m_EBs25notCont(
params.getParameter<double>(
"EBs25notContainment")),
73 m_readoutFrameSize(
ecalPh2::sampleSize),
77 params.getParameter<double>(
"photoelectronsToAnalogBarrel"),
79 params.getParameter<double>(
"samplingFactor"),
80 params.getParameter<double>(
"timePhase"),
83 params.getParameter<
bool>(
"doPhotostatistics"),
89 params.getParameter<double>(
"apdSimToPELow"),
90 params.getParameter<double>(
"apdSimToPEHigh"),
91 params.getParameter<double>(
"apdTimeOffset"),
92 params.getParameter<double>(
"apdTimeOffWidth"),
97 m_componentDigiTag(
params.getParameter<
std::
string>(
"componentDigiTag")),
98 m_componentParameters(
100 m_componentSeparateDigi,
101 params.getParameter<double>(
"simHitToPhotoelectronsBarrel"),
103 params.getParameter<double>(
"photoelectronsToAnalogBarrel"),
105 params.getParameter<double>(
"samplingFactor"),
106 params.getParameter<double>(
"componentTimePhase"),
108 params.getParameter<
int>(
"binOfMaximum"),
109 params.getParameter<
bool>(
"doPhotostatistics"),
112 m_APDResponse(!m_apdSeparateDigi ? nullptr
117 m_apdParameters.
get(),
119 m_componentParameters.
get(),
120 &m_ComponentShapes)),
122 m_ComponentResponse(!m_componentSeparateDigi ? nullptr
127 m_apdParameters.
get(),
129 m_componentParameters.
get(),
130 &m_ComponentShapes)),
136 m_apdParameters.
get(),
138 m_componentParameters.
get(),
139 &m_ComponentShapes)),
141 m_PreMix1(
params.getParameter<
bool>(
"EcalPreMixStage1")),
142 m_PreMix2(
params.getParameter<
bool>(
"EcalPreMixStage2")),
145 m_APDDigitizer(nullptr),
146 m_ComponentDigitizer(nullptr),
147 m_BarrelDigitizer(nullptr),
148 m_ElectronicsSim(nullptr),
150 m_APDElectronicsSim(nullptr),
153 m_EBCorrNoise({{
nullptr,
nullptr}})
156 iC.consumes<std::vector<PCaloHit>>(
edm::InputTag(m_hitsProducerTag,
"EcalHitsEB"));
157 pedestalToken_ = iC.esConsumes();
163 const std::vector<double> ebCorMatG10Ph2 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG10Ph2");
164 const std::vector<double> ebCorMatG01Ph2 =
params.getParameter<std::vector<double>>(
"EBCorrNoiseMatrixG01Ph2");
167 const double rmsConstantTerm =
params.getParameter<
double>(
"ConstantTerm");
169 const bool addNoise =
params.getParameter<
bool>(
"doENoise");
179 const double errorCorrelation = 1.e-7;
180 assert(ebCorMatG10Ph2.size() == m_readoutFrameSize);
181 assert(ebCorMatG01Ph2.size() == m_readoutFrameSize);
186 for (
unsigned int row(0); row != m_readoutFrameSize; ++row) {
187 assert(0 == row || 1. >= ebCorMatG10Ph2[row]);
188 assert(0 == row || 1. >= ebCorMatG01Ph2[row]);
191 const unsigned int index(row - column);
196 m_EBCorrNoise[0] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix_Ph2>>(ebMatrix[0]);
197 m_EBCorrNoise[1] = std::make_unique<CorrelatedNoisifier<EcalCorrMatrix_Ph2>>(ebMatrix[1]);
198 m_Coder = std::make_unique<EcalLiteDTUCoder>(addNoise, m_PreMix1, m_EBCorrNoise[0].get(), m_EBCorrNoise[1].get());
200 std::make_unique<EcalElectronicsSim_Ph2>(m_ParameterMap.get(), m_Coder.get(),
applyConstantTerm, rmsConstantTerm);
202 if (m_apdSeparateDigi) {
203 m_APDCoder = std::make_unique<EcalLiteDTUCoder>(
false, m_PreMix1, m_EBCorrNoise[0].get(), m_EBCorrNoise[1].get());
205 m_APDElectronicsSim = std::make_unique<EcalElectronicsSim_Ph2>(
208 m_APDDigitizer = std::make_unique<EBDigitizer_Ph2>(m_APDResponse.get(), m_APDElectronicsSim.get(),
false);
210 if (m_componentSeparateDigi) {
212 std::make_unique<EcalLiteDTUCoder>(addNoise, m_PreMix1, m_EBCorrNoise[0].get(), m_EBCorrNoise[1].get());
213 m_ComponentElectronicsSim = std::make_unique<EcalElectronicsSim_Ph2>(
214 m_ParameterMap.get(), m_ComponentCoder.get(),
applyConstantTerm, rmsConstantTerm);
215 m_ComponentDigitizer =
216 std::make_unique<EBDigitizer_Ph2>(m_ComponentResponse.get(), m_ComponentElectronicsSim.get(), addNoise);
219 m_BarrelDigitizer = std::make_unique<EBDigitizer_Ph2>(m_EBResponse.get(), m_ElectronicsSim.get(), addNoise);
271 e.getByLabel(ebTag, ebHandle);
278 std::unique_ptr<EBDigiCollectionPh2> apdResult(
nullptr);
279 std::unique_ptr<EBDigiCollectionPh2> componentResult(
nullptr);
280 std::unique_ptr<EBDigiCollectionPh2> barrelResult = std::make_unique<EBDigiCollectionPh2>();
282 apdResult = std::make_unique<EBDigiCollectionPh2>();
285 componentResult = std::make_unique<EBDigiCollectionPh2>();
292 edm::LogInfo(
"DigiInfo") <<
"EB Digis: " << barrelResult->size();
296 edm::LogInfo(
"DigiInfo") <<
"APD Digis: " << apdResult->size();
300 edm::LogInfo(
"DigiInfo") <<
"Component Digis: " << componentResult->size();
316 throw cms::Exception(
"Configuration") <<
"RandomNumberGenerator service is not available.\n" 317 "You must add the service in the configuration file\n" 318 "or remove the module that requires it.";
320 CLHEP::HepRandomEngine* engine = &rng->
getEngine(
lumi.index());
333 m_Coder->setPedestals(pedestals);
342 m_Coder->setIntercalibConstants(ical);
373 LogDebug(
"EcalDigi") <<
" GeV/ADC = " << agc->getEBValue() <<
"\n" 377 m_Coder->setFullScaleEnergy(EBscale);
ComponentShapeCollection m_ComponentShapes
void initializeEvent(edm::Event const &e, edm::EventSetup const &c) override
std::unique_ptr< EBHitResponse_Ph2 > m_EBResponse
void accumulate(edm::Event const &e, edm::EventSetup const &c) override
CLHEP::HepRandomEngine * randomEngine_
~EcalDigiProducer_Ph2() override
const bool m_apdSeparateDigi
std::unique_ptr< EBDigitizer_Ph2 > m_ComponentDigitizer
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
const std::string m_apdDigiTag
edm::ESGetToken< EcalLaserDbService, EcalLaserDbRecord > laserToken_
T const * product() const
std::unique_ptr< EBDigitizer_Ph2 > m_APDDigitizer
std::unique_ptr< EBHitResponse_Ph2 > m_APDResponse
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > agcToken_
std::unique_ptr< EcalLiteDTUCoder > m_APDCoder
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::unique_ptr< EcalLiteDTUCoder > m_Coder
void checkCalibrations(const edm::Event &event, const edm::EventSetup &eventSetup)
std::unique_ptr< EBHitResponse_Ph2 > m_ComponentResponse
const std::string m_hitsProducerTag
const edm::EDGetTokenT< std::vector< PCaloHit > > m_HitsEBToken
const double m_EBs25notCont
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geom_token_
const std::string m_EBdigiCollection
Abs< T >::type abs(const T &t)
void finalizeEvent(edm::Event &e, edm::EventSetup const &c) override
void setEventSetup(const edm::EventSetup &evtSetup)
static constexpr const float * gains
virtual void cacheEBDigis(const EBDigiCollectionPh2 *ebDigiPtr) const
const CaloGeometry * m_Geometry
unsigned long long TimeValue_t
void setEventSetup(const edm::EventSetup &evtSetup, bool normalize=true)
void checkGeometry(const edm::EventSetup &eventSetup)
Log< level::Info, false > LogInfo
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > icalToken_
void beginLuminosityBlock(edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
edm::ESGetToken< EcalLiteDTUPedestalsMap, EcalLiteDTUPedestalsRcd > pedestalToken_
EcalIntercalibConstantMap EcalIntercalibConstants
EcalDigiProducer_Ph2(const edm::ParameterSet ¶ms, edm::ProducesCollector producesCollector, edm::ConsumesCollector &iC)
const bool m_componentSeparateDigi
void setEBNoiseSignalGenerator(EcalBaseSignalGenerator *noiseGenerator)
const std::string m_componentDigiTag
void accumulateCaloHits(HitsHandle const &ebHandle, int bunchCrossing)
std::unique_ptr< EBDigitizer_Ph2 > m_BarrelDigitizer
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
static constexpr unsigned int MAXADC
std::unique_ptr< EcalLiteDTUCoder > m_ComponentCoder