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 }
EcalElectronicsSim::EcalElectronicsSim
EcalElectronicsSim(const EcalSimParameterMap *parameterMap, EcalCoder *coder, bool applyConstantTerm, double rmsConstantTerm)
Definition: EcalElectronicsSim.cc:13
CaloTSamplesBase::id
DetId id() const
ecalElectronicsSim_cff.applyConstantTerm
applyConstantTerm
Definition: ecalElectronicsSim_cff.py:6
EcalElectronicsSim::m_applyConstantTerm
const bool m_applyConstantTerm
Definition: EcalElectronicsSim.h:53
EcalCoder::analogToDigital
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:53
EcalDataFrame
Definition: EcalDataFrame.h:16
EcalSimParameterMap.h
EcalSimParameterMap
Definition: EcalSimParameterMap.h:11
CaloTSamples
Definition: CaloTSamples.h:14
EcalElectronicsSim::~EcalElectronicsSim
~EcalElectronicsSim()
Definition: EcalElectronicsSim.cc:19
EcalElectronicsSim::amplify
void amplify(EcalSamples &clf, CLHEP::HepRandomEngine *) const
input signal is in pe. Converted in GeV
Definition: EcalElectronicsSim.cc:30
EcalSimParameterMap::simParameters
const CaloSimParameters & simParameters(const DetId &id) const override
return the sim parameters relative to the right subdet
Definition: EcalSimParameterMap.cc:52
EcalElectronicsSim::m_theCoder
EcalCoder * m_theCoder
Definition: EcalElectronicsSim.h:50
EcalElectronicsSim::m_simMap
const EcalSimParameterMap * m_simMap
map of parameters
Definition: EcalElectronicsSim.h:46
hcalSimParameters_cfi.photoelectronsToAnalog
photoelectronsToAnalog
Definition: hcalSimParameters_cfi.py:18
EcalCoder.h
EcalCoder
Definition: EcalCoder.h:27
EcalElectronicsSim::analogToDigital
void analogToDigital(CLHEP::HepRandomEngine *, EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalElectronicsSim.cc:21
EcalElectronicsSim.h
EcalElectronicsSim::m_thisCT
const double m_thisCT
Definition: EcalElectronicsSim.h:52