CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalElectronicsSim.cc
Go to the documentation of this file.
8 #include "CLHEP/Random/RandFlat.h"
9 
10 
11 
13  : theAmplifier(amplifier),
14  theCoderFactory(coderFactory),
15  theRandFlat(0),
16  theStartingCapId(0),
17  theStartingCapIdIsRandom(true)
18 {
19 }
20 
21 
23 {
24  delete theRandFlat;
25 }
26 
27 
28 void HcalElectronicsSim::setRandomEngine(CLHEP::HepRandomEngine & engine)
29 {
30  theRandFlat = new CLHEP::RandFlat(engine);
32 }
33 
34 
35 template<class Digi>
37  result.setSize(frame.size());
38  theAmplifier->amplify(frame);
39  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
40 }
41 
42 
44  convert<HBHEDataFrame>(lf, result);
45 }
46 
47 
49  convert<HODataFrame>(lf, result);
50 }
51 
52 
54  convert<HFDataFrame>(lf, result);
55 }
56 
58  convert<ZDCDataFrame>(lf, result);
59 }
60 
61 
63  // pick a new starting Capacitor ID
65  {
66  theStartingCapId = theRandFlat->fireInt(4);
68  }
69 }
70 
71 
72 void HcalElectronicsSim::setStartingCapId(int startingCapId)
73 {
74  theStartingCapId = startingCapId;
76  // turns off random capIDs forever for this instance
78 }
79 
HcalAmplifier * theAmplifier
void setStartingCapId(int startingCapId)
void convert(CaloSamples &frame, Digi &result)
HcalElectronicsSim(HcalAmplifier *amplifier, const HcalCoderFactory *coderFactory)
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:38
void analogToDigital(CaloSamples &linearFrame, HBHEDataFrame &result)
void setRandomEngine(CLHEP::HepRandomEngine &engine)
tuple result
Definition: query.py:137
const HcalCoderFactory * theCoderFactory
int size() const
get the size
Definition: CaloSamples.h:24
virtual void amplify(CaloSamples &linearFrame) const
CLHEP::RandFlat * theRandFlat
void setRandomEngine(CLHEP::HepRandomEngine &engine)
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer