Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-14 02:22:57

0001 #ifndef SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixLinearizer_h
0002 #define SimCalorimetry_EcalEBTrigPrimAlgos_EcalEBFenixLinearizer_h
0003 
0004 #include <DataFormats/EcalDigi/interface/EcalMGPASample.h>
0005 #include <CondFormats/EcalObjects/interface/EcalTPGPedestals.h>
0006 #include <CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h>
0007 #include <CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h>
0008 
0009 #include <vector>
0010 
0011 /** 
0012    \class EcalEBFenixLinearizer
0013    \brief Linearisation for Fenix strip
0014    *  input: 16 bits  corresponding to input EBDataFrame
0015    *  output: 18 bits 
0016    *  
0017    */
0018 
0019 class EcalEBFenixLinearizer {
0020 private:
0021   bool famos_;
0022   int uncorrectedSample_;
0023   int gainID_;
0024   int base_;
0025   int mult_;
0026   int shift_;
0027   int strip_;
0028   bool init_;
0029 
0030   const EcalTPGLinearizationConstant *linConsts_;
0031   const EcalTPGPedestal *peds_;
0032   const EcalTPGCrystalStatusCode *badXStatus_;
0033 
0034   std::vector<const EcalTPGCrystalStatusCode *> vectorbadXStatus_;
0035 
0036   int setInput(const EcalMGPASample &RawSam);
0037   int process();
0038 
0039 public:
0040   EcalEBFenixLinearizer(bool famos);
0041   virtual ~EcalEBFenixLinearizer();
0042 
0043   template <class T>
0044   void process(const T &, std::vector<int> &);
0045   void setParameters(uint32_t raw,
0046                      const EcalTPGPedestals *ecaltpPed,
0047                      const EcalTPGLinearizationConst *ecaltpLin,
0048                      const EcalTPGCrystalStatus *ecaltpBadX);
0049 };
0050 
0051 template <class T>
0052 void EcalEBFenixLinearizer::process(const T &df, std::vector<int> &output_percry) {
0053   //We know a tower numbering is:
0054   // S1 S2 S3 S4 S5
0055   //
0056   // 4  5  14 15 24
0057   // 3  6  13 16 23
0058   // 2  7  12 17 22
0059   // 1  8  11 18 21
0060   // 0  9  10 19 20
0061 
0062   for (int i = 0; i < df.size(); i++) {
0063     setInput(df[i]);
0064     output_percry[i] = process();
0065   }
0066 
0067   return;
0068 }
0069 
0070 #endif