CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h

Go to the documentation of this file.
00001 #ifndef CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H
00002 #define CALIBCALORIMETRY_HCALTPGALGOS_HCALNOMINALTPGCODER_H 1
00003 
00004 #include "CalibFormats/HcalObjects/interface/HcalTPGCoder.h"
00005 #include "CalibFormats/HcalObjects/interface/HcalNominalCoder.h"
00006 #include "Geometry/CaloTopology/interface/HcalTopology.h"
00007 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00008 #include <vector>
00009 
00010 class HcalDbService;
00011 
00031 class HcaluLUTTPGCoder : public HcalTPGCoder {
00032 public:
00033 
00034   HcaluLUTTPGCoder();
00035   virtual ~HcaluLUTTPGCoder();
00036   virtual void adc2Linear(const HBHEDataFrame& df, IntegerCaloSamples& ics) const;
00037   virtual void adc2Linear(const HFDataFrame& df, IntegerCaloSamples& ics) const;
00038   virtual void compress(const IntegerCaloSamples& ics, const std::vector<bool>& featureBits, HcalTriggerPrimitiveDigi& tp) const;
00039   virtual unsigned short adc2Linear(HcalQIESample sample,HcalDetId id) const;
00040   virtual float getLUTPedestal(HcalDetId id) const;
00041   virtual float getLUTGain(HcalDetId id) const;
00042 
00043   void update(const HcalDbService& conditions);
00044   void update(const char* filename, bool appendMSB = false);
00045   void updateXML(const char* filename);
00046   void setLUTGenerationMode(bool gen){ LUTGenerationMode_ = gen; };
00047   void setMaskBit(int bit){ bitToMask_ = bit; };
00048   std::vector<unsigned short> getLinearizationLUTWithMSB(const HcalDetId& id) const;
00049   void lookupMSB(const HBHEDataFrame& df, std::vector<bool>& msb) const;
00050   bool getMSB(const HcalDetId& id, int adc) const;
00051   int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const;
00052   int getLUTId(uint32_t rawid) const;
00053   int getLUTId(const HcalDetId& detid) const;
00054 
00055 private:
00056   // typedef
00057   typedef unsigned short LutElement;
00058   typedef std::vector<LutElement> Lut;
00059 
00060   // constants
00061   static const size_t nluts = 46007, INPUT_LUT_SIZE = 128;
00062   static const float lsb_;
00063   
00064   // member variables
00065   bool LUTGenerationMode_;
00066   int bitToMask_;
00067   std::vector< Lut > inputLUT_;
00068   std::vector<float> gain_;
00069   std::vector<float> ped_;
00070 };
00071 
00072 #endif