CMS 3D CMS Logo

CastorCoderDB.cc
Go to the documentation of this file.
1 
8 
10 
12  : mCoder(&fCoder), mShape(&fShape) {}
13 
14 template <class Digi>
15 void CastorCoderDb::adc2fC_(const Digi& df, CaloSamples& clf) const {
16  clf = CaloSamples(df.id(), df.size());
17  for (int i = 0; i < df.size(); i++) {
18  clf[i] = mCoder->charge(*mShape, df[i].adc(), df[i].capid());
19  }
20  clf.setPresamples(df.presamples());
21 }
22 
23 template <class Digi>
24 void CastorCoderDb::fC2adc_(const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
25  df = Digi(clf.id());
26  df.setSize(clf.size());
27  df.setPresamples(clf.presamples());
28  for (int i = 0; i < clf.size(); i++) {
29  int capId = (fCapIdOffset + i) % 4;
30  df.setSample(i, HcalQIESample(mCoder->adc(*mShape, clf[i], capId), capId, 0, 0));
31  }
32 }
33 
34 void CastorCoderDb::adc2fC(const CastorDataFrame& df, CaloSamples& lf) const { adc2fC_(df, lf); }
35 
36 void CastorCoderDb::fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const {
37  fC2adc_(clf, df, fCapIdOffset);
38 }
void fC2adc(const CaloSamples &clf, CastorDataFrame &df, int fCapIdOffset) const override
CastorCoderDb(const CastorQIECoder &fCoder, const CastorQIEShape &fShape)
void adc2fC_(const Digi &df, CaloSamples &clf) const
int presamples() const
access presample information
Definition: CaloSamples.h:36
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:40
const CastorQIEShape * mShape
Definition: CastorCoderDb.h:31
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:33
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
const CastorQIECoder * mCoder
Definition: CastorCoderDb.h:30
int size() const
get the size
Definition: CaloSamples.h:24
void adc2fC(const CastorDataFrame &df, CaloSamples &lf) const override
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
unsigned adc(const CastorQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -> ADC conversion