CMS 3D CMS Logo

EcalElectronicsSim.cc
Go to the documentation of this file.
4 
5 #include "CLHEP/Random/RandGaussQ.h"
6 
7 #include <string.h>
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 ) ,
18  m_theCoder ( coder ) ,
19  m_thisCT ( rmsConstantTerm ),
20  m_applyConstantTerm ( applyConstantTerm )
21 {
22 }
23 
25 {
26 }
27 
28 void
29 EcalElectronicsSim::analogToDigital( CLHEP::HepRandomEngine* engine,
31  EcalDataFrame& df ) const
32 {
33 
34  //PG input signal is in pe. Converted in GeV
35  amplify( clf, engine ) ;
36 
37  m_theCoder->analogToDigital( engine, clf, df ) ;
38 }
39 
40 void
41 EcalElectronicsSim::amplify( EcalElectronicsSim::EcalSamples& clf, CLHEP::HepRandomEngine* engine ) const
42 {
43  const double fac ( m_simMap->simParameters( clf.id() ).photoelectronsToAnalog() ) ;
45  {
46  clf *= fac*CLHEP::RandGaussQ::shoot(engine, 1.0, m_thisCT);
47  }
48  else
49  {
50  clf *= fac ;
51  }
52 }
virtual const CaloSimParameters & simParameters(const DetId &id) const
return the sim parameters relative to the right subdet
virtual void analogToDigital(CLHEP::HepRandomEngine *, const EcalSamples &clf, EcalDataFrame &df) const
from EcalSamples to EcalDataFrame
Definition: EcalCoder.cc:75
void amplify(EcalSamples &clf, CLHEP::HepRandomEngine *) const
input signal is in pe. Converted in GeV
const bool m_applyConstantTerm
DetId id() const
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)