CMS 3D CMS Logo

CastorCoderDB.cc
Go to the documentation of this file.
1 
8 
10 
12  : mCoder (&fCoder),
13  mShape (&fShape)
14 {}
15 
16 template <class Digi> void CastorCoderDb::adc2fC_ (const Digi& df, CaloSamples& clf) const {
17  clf=CaloSamples(df.id(),df.size());
18  for (int i=0; i<df.size(); i++) {
19  clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
20  }
21  clf.setPresamples(df.presamples());
22 }
23 
24 template <class Digi> 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 {fC2adc_ (clf, df, fCapIdOffset);}
37 
int adc(sample_type sample)
get the ADC sample (12 bits)
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:30
const CastorQIEShape * mShape
Definition: CastorCoderDb.h:29
float charge(const CastorQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
const CastorQIECoder * mCoder
Definition: CastorCoderDb.h:28
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