8 #include "CLHEP/Random/RandFlat.h" 12 : theAmplifier(amplifier),
13 theCoderFactory(coderFactory),
15 theStartingCapIdIsRandom(
true),
16 PreMixDigis(PreMixing)
31 result.setSize(frame.
size());
50 for(
int isample = 0; isample !=frame.
size(); ++isample) {
51 uint16_t theADC = round(preMixFactor*frame[isample]);
52 unsigned capId = result[isample].capid();
54 if(theADC > preMixBits) {
55 uint16_t keepADC = result[isample].adc();
56 result.setSample(isample,
HcalQIESample(keepADC, capId, 0, 0,
true,
true) );
59 result.setSample(isample,
HcalQIESample(theADC, capId, 0, 0) );
66 for(
int isample = 0; isample !=frame.size(); ++isample) {
67 uint16_t theADC = round(preMixFactor*frame[isample]);
68 unsigned capId =
result[isample].capid();
71 if(theADC > preMixBits) {
72 theADC =
result[isample].adc();
76 result.setSample(isample, theADC,
result[isample].le_tdc(),
result[isample].te_tdc(), capId,
result[isample].soi(), ok);
82 for(
int isample = 0; isample !=frame.size(); ++isample) {
83 uint16_t theADC = round(preMixFactor*frame[isample]);
86 if(theADC > preMixBits) {
87 theADC =
result[isample].adc();
91 result.setSample(isample, theADC, tdcErrorBit,
result[isample].soi());
97 convert<Digi>(lf,
result, engine);
HcalAmplifier * theAmplifier
void setStartingCapId(int startingCapId)
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 analogToDigitalImpl(CLHEP::HepRandomEngine *, CaloSamples &linearFrame, Digi &result, double preMixFactor, unsigned preMixBits)
void analogToDigital(CLHEP::HepRandomEngine *, CaloSamples &linearFrame, HBHEDataFrame &result, double preMixFactor=10.0, unsigned preMixBits=126)
DetId id() const
get the (generic) id
std::unique_ptr< HcalCoder > coder(const DetId &detId) const
user gets control of the pointer
void premix(CaloSamples &frame, Digi &result, double preMixFactor, unsigned preMixBits)
void setDbService(const HcalDbService *service)
the Producer will probably update this every event