CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CastorNominalCoder.cc
Go to the documentation of this file.
2 
4  lf=CaloSamples(df.id(),df.size());
5  for (int i=0; i<df.size(); i++) lf[i]=df[i].nominal_fC();
6  lf.setPresamples(df.presamples());
7 }
8 
9 
10 namespace CastorNominalCoderTemplate {
11  template <class Digi>
12  void process(const CaloSamples& clf, Digi& df, int fCapIdOffset) {
13  df=Digi(clf.id());
14  df.setSize(clf.size());
15  df.setPresamples(clf.presamples());
16  for (int i=0; i<clf.size(); i++) {
17  int capId = (fCapIdOffset + i) % 4;
18  for (int q=1; q<128; q++) {
19  df.setSample(i,HcalQIESample(q,capId,0,0));
20  if (df[i].nominal_fC()>clf[i]) {
21  df.setSample(i,HcalQIESample(q-1,capId,0,0));
22  break;
23  }
24  }
25  }
26  }
27 }
28 
29 void CastorNominalCoder::fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const {
30  CastorNominalCoderTemplate::process(clf,df, fCapIdOffset);
31 }
32 
int i
Definition: DBlmapReader.cc:9
int presamples() const
number of samples before the sample from the triggered beam crossing (according to the hardware) ...
virtual void fC2adc(const CaloSamples &clf, CastorDataFrame &df, int fCapIdOffset) 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
virtual void adc2fC(const CastorDataFrame &df, CaloSamples &lf) const
void setPresamples(int pre)
set presample information
Definition: CaloSamples.cc:31
int size() const
get the size
Definition: CaloSamples.h:24
DetId id() const
get the (generic) id
Definition: CaloSamples.h:21
void process(const CaloSamples &clf, Digi &df, int fCapIdOffset)
const HcalCastorDetId & id() const
int size() const
total number of samples in the digi