CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalElectronicsSim.cc
Go to the documentation of this file.
4 
7 #include "CLHEP/Random/RandGaussQ.h"
9 
10 #include <string.h>
11 #include <sstream>
12 #include <iostream>
13 #include <unistd.h>
14 #include <fstream>
15 
17  EcalCoder * coder,
18  bool applyConstantTerm,
19  double rmsConstantTerm)
20 : theParameterMap(parameterMap),
21  theCoder(coder),
22  applyConstantTerm_(applyConstantTerm),
23  rmsConstantTerm_(rmsConstantTerm)
24 {
25 }
26 
27 
29 {
30  clf *= theParameterMap->simParameters(clf.id()).photoelectronsToAnalog();
31  if (applyConstantTerm_) {
32  clf *= (1.+constantTerm());
33  }
34 }
35 
37 {
39  if ( ! rng.isAvailable()) {
40  throw cms::Exception("Configuration")
41  << "EcalElectroncSim requires the RandomNumberGeneratorService\n"
42  "which is not present in the configuration file. You must add the service\n"
43  "in the configuration file or remove the modules that require it.";
44  }
45 
46  double thisCT = rmsConstantTerm_;
47  CLHEP::RandGaussQ gaussQDistribution(rng->getEngine(), 0.0, thisCT);
48  return gaussQDistribution.fire();
49 }
50 
52 {
53  //PG input signal is in pe. Converted in GeV
54  amplify(clf);
55  theCoder->analogToDigital(clf, df);
56 }
57 
58 
59 
60 
virtual const CaloSimParameters & simParameters(const DetId &id) const
return the sim parameters relative to the right subdet
double constantTerm() const
compute the event random constant term
EcalCoder * theCoder
Converts CaloDataFrame in CaloTimeSample and vice versa.
const bool applyConstantTerm_
virtual void analogToDigital(const CaloSamples &clf, EcalDataFrame &df) const
from CaloSamples to EcalDataFrame
Definition: EcalCoder.cc:70
void analogToDigital(CaloSamples &clf, EcalDataFrame &df) const
from CaloSamples to EcalDataFrame
const EcalSimParameterMap * theParameterMap
map of parameters
bool isAvailable() const
Definition: Service.h:47
virtual CLHEP::HepRandomEngine & getEngine() const =0
Use this to get the random number engine, this is the only function most users should call...
void amplify(CaloSamples &clf) const
input signal is in pe. Converted in GeV
EcalElectronicsSim(const EcalSimParameterMap *parameterMap, EcalCoder *coder, bool applyConstantTerm, double rmsConstantTerm)
ctor
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
const double rmsConstantTerm_