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.
9 #include "CLHEP/Random/RandFlat.h"
10 
11 
12 
14  : theAmplifier(amplifier),
15  theCoderFactory(coderFactory),
16  theRandFlat(0),
17  theStartingCapId(0),
18  theStartingCapIdIsRandom(true)
19 {
20 }
21 
22 
24  if (theRandFlat) delete theRandFlat;
25 }
26 
27 
28 void HcalElectronicsSim::setRandomEngine(CLHEP::HepRandomEngine & engine) {
29  theRandFlat = new CLHEP::RandFlat(engine);
31  theTDC.setRandomEngine(engine);
32 }
33 
34 
36  // theAmplifier->setDbService(service);
37  theTDC.setDbService(service);
38 }
39 
40 template<class Digi>
42  result.setSize(frame.size());
43  theAmplifier->amplify(frame);
44  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
45 }
46 
47 
49  convert<HBHEDataFrame>(lf, result);
50 }
51 
52 
54  convert<HODataFrame>(lf, result);
55 }
56 
57 
59  convert<HFDataFrame>(lf, result);
60 }
61 
63  convert<ZDCDataFrame>(lf, result);
64 }
65 
66 
69  convert<HcalUpgradeDataFrame>(lf, result);
70  theTDC.timing(lf, result);
71 }
72 
74  // pick a new starting Capacitor ID
76  {
77  theStartingCapId = theRandFlat->fireInt(4);
79  }
80 }
81 
82 
83 void HcalElectronicsSim::setStartingCapId(int startingCapId)
84 {
85  theStartingCapId = startingCapId;
87  // turns off random capIDs forever for this instance
89 }
90 
HcalAmplifier * theAmplifier
void setRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: HcalTDC.cc:104
void setStartingCapId(int startingCapId)
void convert(CaloSamples &frame, Digi &result)
HcalElectronicsSim(HcalAmplifier *amplifier, const HcalCoderFactory *coderFactory)
void setStartingCapId(int capId)
Definition: HcalAmplifier.h:42
void setDbService(const HcalDbService *service)
void analogToDigital(CaloSamples &linearFrame, HBHEDataFrame &result)
void setRandomEngine(CLHEP::HepRandomEngine &engine)
tuple result
Definition: query.py:137
const HcalCoderFactory * theCoderFactory
void timing(const CaloSamples &lf, HcalUpgradeDataFrame &digi) const
adds timing information to the digi
Definition: HcalTDC.cc:15
int size() const
get the size
Definition: CaloSamples.h:26
virtual void amplify(CaloSamples &linearFrame) const
CLHEP::RandFlat * theRandFlat
void setRandomEngine(CLHEP::HepRandomEngine &engine)
DetId id() const
get the (generic) id
Definition: CaloSamples.h:23
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
Definition: HcalTDC.cc:108
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer