00001 #ifndef ECAL_FENIX_LINEARIZER_H 00002 #define ECAL_FENIX_LINEARIZER_H 00003 00004 #include <DataFormats/EcalDigi/interface/EcalMGPASample.h> 00005 #include <CondFormats/EcalObjects/interface/EcalTPGPedestals.h> 00006 #include <CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h> 00007 #include <CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h> 00008 00009 #include <vector> 00010 00019 class EcalFenixLinearizer { 00020 00021 00022 private: 00023 bool famos_; 00024 int uncorrectedSample_; 00025 int gainID_; 00026 int base_; 00027 int mult_; 00028 int shift_; 00029 int strip_; 00030 bool init_; 00031 00032 const EcalTPGLinearizationConstant *linConsts_; 00033 const EcalTPGPedestal *peds_; 00034 const EcalTPGCrystalStatusCode *badXStatus_; 00035 00036 std::vector<const EcalTPGCrystalStatusCode *> vectorbadXStatus_; 00037 00038 int setInput(const EcalMGPASample &RawSam) ; 00039 int process() ; 00040 00041 00042 public: 00043 EcalFenixLinearizer(bool famos); 00044 virtual ~EcalFenixLinearizer(); 00045 00046 template <class T> 00047 void process(const T &, std::vector<int>&); 00048 void setParameters(uint32_t raw, const EcalTPGPedestals * ecaltpPed,const EcalTPGLinearizationConst * ecaltpLin, const EcalTPGCrystalStatus * ecaltpBadX) ; 00049 }; 00050 00051 template <class T> 00052 void EcalFenixLinearizer::process(const T&df, std::vector<int> & output_percry) 00053 { 00054 00055 //We know a tower numbering is: 00056 // S1 S2 S3 S4 S5 00057 // 00058 // 4 5 14 15 24 00059 // 3 6 13 16 23 00060 // 2 7 12 17 22 00061 // 1 8 11 18 21 00062 // 0 9 10 19 20 00063 for (int i=0;i<df.size();i++) { 00064 setInput(df[i]); 00065 output_percry[i]=process(); 00066 } 00067 00068 return; 00069 } 00070 00071 #endif