10 #include "CLHEP/Random/RandFlat.h"
14 : theAmplifier(amplifier),
15 theCoderFactory(coderFactory),
17 theStartingCapIdIsRandom(
true),
18 PreMixDigis(PreMixing)
34 result.setSize(frame.
size());
41 theAmplifier->amplify(frame, engine);
42 theCoderFactory->coder(frame.id())->fC2adc(frame,
result, theStartingCapId);
46 convert<HBHEDataFrame>(lf,
result, engine);
48 for(
int isample = 0; isample !=lf.size(); ++isample) {
49 uint16_t theADC = round(10.0*lf[isample]);
50 unsigned capId = result[isample].capid();
53 uint16_t keepADC = result[isample].adc();
55 result.setSample(isample,
HcalQIESample(keepADC, capId, 0, 0,
true,
true) );
58 result.setSample(isample,
HcalQIESample(theADC, capId, 0, 0) );
67 convert<HODataFrame>(lf,
result, engine);
69 for(
int isample = 0; isample !=lf.size(); ++isample) {
70 uint16_t theADC = round(10.0*lf[isample]);
71 unsigned capId = result[isample].capid();
74 uint16_t keepADC = result[isample].adc();
76 result.setSample(isample,
HcalQIESample(keepADC, capId, 0, 0,
true,
true) );
79 result.setSample(isample,
HcalQIESample(theADC, capId, 0, 0) );
88 convert<HFDataFrame>(lf,
result, engine);
90 for(
int isample = 0; isample !=lf.size(); ++isample) {
91 uint16_t theADC = round(10.0*lf[isample]);
92 unsigned capId = result[isample].capid();
95 uint16_t keepADC = result[isample].adc();
97 result.setSample(isample,
HcalQIESample(keepADC, capId, 0, 0,
true,
true) );
100 result.setSample(isample,
HcalQIESample(theADC, capId, 0, 0) );
108 convert<ZDCDataFrame>(lf,
result, engine);
110 for(
int isample = 0; isample !=lf.size(); ++isample) {
111 uint16_t theADC = round(10.0*lf[isample]);
112 unsigned capId = result[isample].capid();
115 uint16_t keepADC = result[isample].adc();
117 result.setSample(isample,
HcalQIESample(keepADC, capId, 0, 0,
true,
true) );
120 result.setSample(isample,
HcalQIESample(theADC, capId, 0, 0) );
130 convert<HcalUpgradeDataFrame>(lf,
result, engine);
137 convert<QIE10DataFrame>(lf,
result, engine);
HcalAmplifier * theAmplifier
void setStartingCapId(int startingCapId)
void analogToDigital(CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HBHEDataFrame &result)
void setStartingCapId(int capId)
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
void setDbService(const HcalDbService *service)
void newEvent(CLHEP::HepRandomEngine *)
HcalElectronicsSim(HcalAmplifier *amplifier, const HcalCoderFactory *coderFactory, bool PreMix)
void convert(CaloSamples &frame, Digi &result, CLHEP::HepRandomEngine *)
const HcalCoderFactory * theCoderFactory
bool theStartingCapIdIsRandom
virtual void amplify(CaloSamples &linearFrame, CLHEP::HepRandomEngine *) const
int size() const
get the size
void timing(const CaloSamples &lf, HcalUpgradeDataFrame &digi, CLHEP::HepRandomEngine *) const
adds timing information to the digi
DetId id() const
get the (generic) id
void setDbService(const HcalDbService *service)
the Producer will probably update this every event
std::auto_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer