Go to the documentation of this file.00001
00006 #include "CondFormats/CastorObjects/interface/CastorQIEShape.h"
00007 #include "CondFormats/CastorObjects/interface/CastorQIECoder.h"
00008
00009 #include "CalibFormats/CastorObjects/interface/CastorCoderDb.h"
00010
00011 CastorCoderDb::CastorCoderDb (const CastorQIECoder& fCoder, const CastorQIEShape& fShape)
00012 : mCoder (&fCoder),
00013 mShape (&fShape)
00014 {}
00015
00016 template <class Digi> void CastorCoderDb::adc2fC_ (const Digi& df, CaloSamples& clf) const {
00017 clf=CaloSamples(df.id(),df.size());
00018 for (int i=0; i<df.size(); i++) {
00019 clf[i]=mCoder->charge (*mShape, df[i].adc (), df[i].capid ());
00020 }
00021 clf.setPresamples(df.presamples());
00022 }
00023
00024 template <class Digi> void CastorCoderDb::fC2adc_ (const CaloSamples& clf, Digi& df, int fCapIdOffset) const {
00025 df = Digi (clf.id ());
00026 df.setSize (clf.size ());
00027 df.setPresamples (clf.presamples ());
00028 for (int i=0; i<clf.size(); i++) {
00029 int capId = (fCapIdOffset + i) % 4;
00030 df.setSample(i, HcalQIESample(mCoder->adc(*mShape, clf[i], capId), capId, 0, 0));
00031 }
00032 }
00033
00034 void CastorCoderDb::adc2fC(const CastorDataFrame& df, CaloSamples& lf) const {adc2fC_ (df, lf);}
00035
00036 void CastorCoderDb::fC2adc(const CaloSamples& clf, CastorDataFrame& df, int fCapIdOffset) const {fC2adc_ (clf, df, fCapIdOffset);}
00037