Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:28

0001 #ifndef SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXLINEARIZER_H
0002 #define SIMCALORIMETRY_ECALTRIGPRIMALGOS_ECALFENIXLINEARIZER_H
0003 
0004 #include <CondFormats/EcalObjects/interface/EcalTPGCrystalStatus.h>
0005 #include <CondFormats/EcalObjects/interface/EcalTPGLinearizationConst.h>
0006 #include <CondFormats/EcalObjects/interface/EcalTPGPedestals.h>
0007 #include <DataFormats/EcalDigi/interface/EcalMGPASample.h>
0008 
0009 #include <vector>
0010 
0011 /**
0012  \class EcalFenixLinearizer
0013  \brief Linearisation for Fenix strip
0014  *  input: 16 bits  corresponding to input EBDataFrame
0015  *  output: 18 bits
0016  *
0017  */
0018 
0019 class EcalFenixLinearizer {
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   EcalFenixLinearizer(bool famos);
0041   virtual ~EcalFenixLinearizer();
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 EcalFenixLinearizer::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   for (int i = 0; i < df.size(); i++) {
0062     setInput(df[i]);
0063     output_percry[i] = process();
0064   }
0065 
0066   return;
0067 }
0068 
0069 #endif