CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorElectronicsSim.cc
Go to the documentation of this file.
5 #include "CLHEP/Random/RandFlat.h"
6 
7 
8 
10  : theAmplifier(amplifier),
11  theCoderFactory(coderFactory),
12  theRandFlat(0),
13  theStartingCapId(0)
14 {
15 }
16 
17 
19 {
20  delete theRandFlat;
21 }
22 
23 
24 void CastorElectronicsSim::setRandomEngine(CLHEP::HepRandomEngine & engine)
25 {
26  theRandFlat = new CLHEP::RandFlat(engine);
27 }
28 
29 
30 template<class Digi>
32  result.setSize(frame.size());
33  theAmplifier->amplify(frame);
34  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
35 }
36 
38  convert<CastorDataFrame>(lf, result);
39 }
40 
42  // pick a new starting Capacitor ID
43  theStartingCapId = theRandFlat->fireInt(4);
45 }
46 
void newEvent()
Things that need to be initialized every event.
std::auto_ptr< CastorCoder > coder(const DetId &detId) const
user gets control of the pointer
CastorElectronicsSim(CastorAmplifier *amplifier, const CastorCoderFactory *coderFactory)
tuple result
Definition: query.py:137
virtual void amplify(CaloSamples &linearFrame) const
void setRandomEngine(CLHEP::HepRandomEngine &engine)
const CastorCoderFactory * theCoderFactory
CastorAmplifier * theAmplifier
int size() const
get the size
Definition: CaloSamples.h:24
void analogToDigital(CaloSamples &linearFrame, CastorDataFrame &result)
void convert(CaloSamples &frame, Digi &result)
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
CLHEP::RandFlat * theRandFlat
void setStartingCapId(int capId)