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 
6 #include "CLHEP/Random/RandFlat.h"
7 
8 
9 
11  : theAmplifier(amplifier),
12  theCoderFactory(coderFactory),
13  theStartingCapId(0)
14 {
15 }
16 
17 
19 {
20 }
21 
22 template<class Digi>
23 void CastorElectronicsSim::convert(CaloSamples & frame, Digi & result, CLHEP::HepRandomEngine* engine) {
24  result.setSize(frame.size());
25  theAmplifier->amplify(frame, engine);
26  theCoderFactory->coder(frame.id())->fC2adc(frame, result, theStartingCapId);
27 }
28 
29 void CastorElectronicsSim::analogToDigital(CLHEP::HepRandomEngine* engine, CaloSamples & lf, CastorDataFrame & result) {
30  convert<CastorDataFrame>(lf, result, engine);
31 }
32 
33 void CastorElectronicsSim::newEvent(CLHEP::HepRandomEngine* engine) {
34  // pick a new starting Capacitor ID
35  theStartingCapId = CLHEP::RandFlat::shootInt(engine, 4);
37 }
std::auto_ptr< CastorCoder > coder(const DetId &detId) const
user gets control of the pointer
void convert(CaloSamples &frame, Digi &result, CLHEP::HepRandomEngine *)
CastorElectronicsSim(CastorAmplifier *amplifier, const CastorCoderFactory *coderFactory)
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:30
tuple result
Definition: mps_fire.py:95
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
const CastorCoderFactory * theCoderFactory
CastorAmplifier * theAmplifier
int size() const
get the size
Definition: CaloSamples.h:24
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
void analogToDigital(CLHEP::HepRandomEngine *, CaloSamples &linearFrame, CastorDataFrame &result)
void newEvent(CLHEP::HepRandomEngine *)
Things that need to be initialized every event.
void setStartingCapId(int capId)