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 // std::cout << HcalDetId(lf.id()) << ' ' << lf;
71  theTDC.timing(lf, result);
72 }
73 
75  // pick a new starting Capacitor ID
77  {
78  theStartingCapId = theRandFlat->fireInt(4);
80  }
81 }
82 
83 
84 void HcalElectronicsSim::setStartingCapId(int startingCapId)
85 {
86  theStartingCapId = startingCapId;
88  // turns off random capIDs forever for this instance
90 }
91 
HcalAmplifier * theAmplifier
void setRandomEngine(CLHEP::HepRandomEngine &engine)
Definition: HcalTDC.cc:132
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:16
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
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
Definition: HcalTDC.cc:136
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer