CMS 3D CMS Logo

EcalElectronicsSim.cc
Go to the documentation of this file.
4 
5 #include "CLHEP/Random/RandGaussQ.h"
6 
7 #include <cstring>
8 #include <sstream>
9 #include <iostream>
10 #include <unistd.h>
11 #include <fstream>
12 
14  EcalCoder* coder,
15  bool applyConstantTerm,
16  double rmsConstantTerm)
17  : m_simMap(parameterMap), m_theCoder(coder), m_thisCT(rmsConstantTerm), m_applyConstantTerm(applyConstantTerm) {}
18 
20 
21 void EcalElectronicsSim::analogToDigital(CLHEP::HepRandomEngine* engine,
23  EcalDataFrame& df) const {
24  //PG input signal is in pe. Converted in GeV
25  amplify(clf, engine);
26 
27  m_theCoder->analogToDigital(engine, clf, df);
28 }
29 
30 void EcalElectronicsSim::amplify(EcalElectronicsSim::EcalSamples& clf, CLHEP::HepRandomEngine* engine) const {
31  const double fac(m_simMap->simParameters(clf.id()).photoelectronsToAnalog());
32  if (m_applyConstantTerm) {
33  clf *= fac * CLHEP::RandGaussQ::shoot(engine, 1.0, m_thisCT);
34  } else {
35  clf *= fac;
36  }
37 }
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:52
void amplify(EcalSamples &clf, CLHEP::HepRandomEngine *) const
input signal is in pe. Converted in GeV
const bool m_applyConstantTerm
DetId id() const
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
const EcalSimParameterMap * m_simMap
map of parameters
void analogToDigital(CLHEP::HepRandomEngine *, EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
EcalElectronicsSim(const EcalSimParameterMap *parameterMap, EcalCoder *coder, bool applyConstantTerm, double rmsConstantTerm)