CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h

Go to the documentation of this file.
00001 #ifndef CALOTPGTRANSCODERULUT_H
00002 #define CALOTPGTRANSCODERULUT_H 1
00003 
00004 #include <vector>
00005 #include "CalibFormats/CaloTPG/interface/CaloTPGTranscoder.h"
00006 
00007 // tmp
00008 #include "FWCore/Framework/interface/ESHandle.h"
00009 #include "CondFormats/HcalObjects/interface/HcalLutMetadata.h"
00010 
00011 
00018 class CaloTPGTranscoderULUT : public CaloTPGTranscoder {
00019 public:
00020   CaloTPGTranscoderULUT(const std::string& compressionFile="",
00021                         const std::string& decompressionFile="");
00022   virtual ~CaloTPGTranscoderULUT();
00023   virtual HcalTriggerPrimitiveSample hcalCompress(const HcalTrigTowerDetId& id, unsigned int sample, bool fineGrain) const;
00024   virtual EcalTriggerPrimitiveSample ecalCompress(const EcalTrigTowerDetId& id, unsigned int sample, bool fineGrain) const;
00025 
00026   virtual void rctEGammaUncompress(const HcalTrigTowerDetId& hid, const HcalTriggerPrimitiveSample& hc,
00027                                    const EcalTrigTowerDetId& eid, const EcalTriggerPrimitiveSample& ec, 
00028                                    unsigned int& et, bool& egVecto, bool& activity) const;
00029   virtual void rctJetUncompress(const HcalTrigTowerDetId& hid, const HcalTriggerPrimitiveSample& hc,
00030                                    const EcalTrigTowerDetId& eid, const EcalTriggerPrimitiveSample& ec, 
00031                                    unsigned int& et) const;
00032   virtual double hcaletValue(const int& ieta, const int& compressedValue) const;
00033   virtual double hcaletValue(const int& ieta, const int& iphi, const int& compressedValue) const;
00034   virtual double hcaletValue(const HcalTrigTowerDetId& hid, const HcalTriggerPrimitiveSample& hc) const;
00035   virtual bool HTvalid(const int ieta, const int iphi) const;
00036   virtual std::vector<unsigned char> getCompressionLUT(HcalTrigTowerDetId id) const;
00037   virtual void setup(const edm::EventSetup& es, Mode) const;
00038   virtual int getOutputLUTId(const int ieta, const int iphi) const;
00039   void printDecompression() const;
00040 
00041  private:
00042   // Typedef
00043   typedef unsigned int LUT;
00044   typedef std::vector<double> RCTdecompression;
00045 
00046   // Constant
00047   // TODO prefix k
00048   static const int NOUTLUTS = 4176;
00049   static const unsigned int OUTPUT_LUT_SIZE = 1024;
00050   static const int TPGMAX = 256;
00051   static const bool newHFphi = true;
00052 
00053   // Member functions
00054   void loadHCALCompress(void) const; //Analytical compression tables
00055   void loadHCALCompress(const std::string& filename) const; //Compression tables from file
00056   void loadHCALUncompress(void) const; //Analytical decompression
00057   void loadHCALUncompress(const std::string& filename) const; //Decompression tables from file
00058   //int getLutGranularity(const DetId& id) const;
00059   //int getLutThreshold(const DetId& id) const;
00060 
00061   // Member Variables
00062   mutable bool isLoaded_;
00063   mutable double nominal_gain_;
00064   mutable double rctlsb_factor_;
00065   std::string compressionFile_;
00066   std::string decompressionFile_;
00067   std::vector<int> ietal;
00068   std::vector<int> ietah;
00069   std::vector<int> ZS;
00070   std::vector<int> LUTfactor;
00071 
00072   mutable LUT *outputLUT_[NOUTLUTS];
00073   mutable std::vector<RCTdecompression> hcaluncomp_;
00074   mutable edm::ESHandle<HcalLutMetadata> lutMetadata_;
00075 };
00076 #endif