CMS 3D CMS Logo

HcalCoderDb.cc
Go to the documentation of this file.
1 
9 
10 HcalCoderDb::HcalCoderDb (const HcalQIECoder& fCoder, const HcalQIEShape& fShape)
11  : mCoder (&fCoder),
12  mShape (&fShape)
13 {}
14 
15 template <class Digi> void HcalCoderDb::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 <> void HcalCoderDb::adc2fC_<QIE10DataFrame> (const QIE10DataFrame& df, CaloSamples& clf) const {
24  clf=CaloSamples(df.id(),df.samples());
25  for (int i=0; i<df.samples(); i++) {
26  clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
27  if(df[i].soi()) clf.setPresamples(i);
28  }
29 }
30 
31 template <> void HcalCoderDb::adc2fC_<QIE11DataFrame> (const QIE11DataFrame& df, CaloSamples& clf) const {
32  clf=CaloSamples(df.id(),df.samples());
33  for (int i=0; i<df.samples(); i++) {
34  clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
35  if(df[i].soi()) clf.setPresamples(i);
36  }
37 }
38 
39 template <class Digi> void HcalCoderDb::fC2adc_ (const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
40  df = Digi (clf.id ());
41  df.setSize (clf.size ());
42  df.setPresamples (clf.presamples ());
43  for (int i=0; i<clf.size(); i++) {
44  int capId = (fCapIdOffset + i) % 4;
45  df.setSample(i, HcalQIESample(mCoder->adc(*mShape, clf[i], capId), capId, 0, 0));
46  }
47 }
48 
49 template <> void HcalCoderDb::fC2adc_<QIE10DataFrame> (const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {
50  int presample = clf.presamples ();
51  for (int i=0; i<clf.size(); i++) {
52  int capId = (fCapIdOffset + i) % 4;
53  bool soi = (i==presample);
54  df.setSample(i, mCoder->adc(*mShape, clf[i], capId), 0, 0, capId, soi, true);
55  }
56 }
57 
58 template <> void HcalCoderDb::fC2adc_<QIE11DataFrame> (const CaloSamples& clf, QIE11DataFrame& df, int fCapIdOffset) const {
59  int presample = clf.presamples ();
60  df.setCapid0(fCapIdOffset%4);
61  for (int i=0; i<clf.size(); i++) {
62  int capId = (fCapIdOffset + i) % 4;
63  bool soi = (i==presample);
64  df.setSample(i, mCoder->adc(*mShape, clf[i], capId), 0, soi);
65  }
66 }
67 
68 void HcalCoderDb::adc2fC(const HBHEDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
69 void HcalCoderDb::adc2fC(const HODataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
70 void HcalCoderDb::adc2fC(const HFDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
71 void HcalCoderDb::adc2fC(const ZDCDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
72 void HcalCoderDb::adc2fC(const HcalCalibDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
73 void HcalCoderDb::adc2fC(const QIE10DataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
74 void HcalCoderDb::adc2fC(const QIE11DataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
75 
76 void HcalCoderDb::fC2adc(const CaloSamples& clf, HBHEDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
77 void HcalCoderDb::fC2adc(const CaloSamples& clf, HFDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
78 void HcalCoderDb::fC2adc(const CaloSamples& clf, HODataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
79 void HcalCoderDb::fC2adc(const CaloSamples& clf, ZDCDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
80 void HcalCoderDb::fC2adc(const CaloSamples& clf, HcalCalibDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
81 void HcalCoderDb::fC2adc(const CaloSamples& clf, QIE10DataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
82 void HcalCoderDb::fC2adc(const CaloSamples& clf, QIE11DataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
83 
int adc(sample_type sample)
get the ADC sample (12 bits)
void adc2fC_(const Digi &df, CaloSamples &clf) const
Definition: HcalCoderDb.cc:15
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
virtual void fC2adc(const CaloSamples &clf, HBHEDataFrame &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:76
HcalCoderDb(const HcalQIECoder &fCoder, const HcalQIEShape &fShape)
Definition: HcalCoderDb.cc:10
void fC2adc_(const CaloSamples &clf, Digi &df, int fCapIdOffset) const
Definition: HcalCoderDb.cc:39
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:68
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
const HcalQIEShape * mShape
Definition: HcalCoderDb.h:41
int size() const
get the size
Definition: CaloSamples.h:24
unsigned adc(const HcalQIEShape &fShape, float fCharge, unsigned fCapId) const
fC + capid [0..3] -> ADC conversion
Definition: HcalQIECoder.cc:27
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
const HcalQIECoder * mCoder
Definition: HcalCoderDb.h:40
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -> fC conversion.
Definition: HcalQIECoder.cc:22