CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes

CaloTPGTranscoderULUT Class Reference

#include <CaloTPGTranscoderULUT.h>

Inheritance diagram for CaloTPGTranscoderULUT:
CaloTPGTranscoder

List of all members.

Public Member Functions

 CaloTPGTranscoderULUT (const std::string &compressionFile="", const std::string &decompressionFile="")
virtual EcalTriggerPrimitiveSample ecalCompress (const EcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const
 Compression from linear samples+fine grain in the ECAL.
virtual std::vector< unsigned
char > 
getCompressionLUT (HcalTrigTowerDetId id) const
virtual int getOutputLUTId (const int ieta, const int iphi) const
virtual HcalTriggerPrimitiveSample hcalCompress (const HcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const
 Compression from linear samples+fine grain in the HTR.
virtual double hcaletValue (const int &ieta, const int &iphi, const int &compressedValue) const
virtual double hcaletValue (const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc) const
virtual double hcaletValue (const int &ieta, const int &compressedValue) const
virtual bool HTvalid (const int ieta, const int iphi) const
void printDecompression () const
virtual void rctEGammaUncompress (const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc, const EcalTrigTowerDetId &eid, const EcalTriggerPrimitiveSample &ec, unsigned int &et, bool &egVecto, bool &activity) const
 Uncompression for the Electron/Photon path in the RCT.
virtual void rctJetUncompress (const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc, const EcalTrigTowerDetId &eid, const EcalTriggerPrimitiveSample &ec, unsigned int &et) const
 Uncompression for the JET path in the RCT.
virtual void setup (const edm::EventSetup &es, Mode) const
 Obtain any needed objects from the EventSetup. Note that any member variables which are changed must be mutable.
virtual ~CaloTPGTranscoderULUT ()

Private Types

typedef unsigned int LUT
typedef std::vector< double > RCTdecompression

Private Member Functions

void loadHCALCompress (void) const
void loadHCALCompress (const std::string &filename) const
void loadHCALUncompress (void) const
void loadHCALUncompress (const std::string &filename) const

Private Attributes

std::string compressionFile_
std::string decompressionFile_
std::vector< RCTdecompressionhcaluncomp_
std::vector< int > ietah
std::vector< int > ietal
bool isLoaded_
std::vector< int > LUTfactor
edm::ESHandle< HcalLutMetadatalutMetadata_
double nominal_gain_
LUToutputLUT_ [NOUTLUTS]
double rctlsb_factor_
std::vector< int > ZS

Static Private Attributes

static const bool newHFphi = true
static const int NOUTLUTS = 4176
static const unsigned int OUTPUT_LUT_SIZE = 1024
static const int TPGMAX = 256

Detailed Description

Date:
2010/05/12 13:22:15
Revision:
1.16
Author:
J. Mans - Minnesota

Definition at line 18 of file CaloTPGTranscoderULUT.h.


Member Typedef Documentation

typedef unsigned int CaloTPGTranscoderULUT::LUT [private]

Definition at line 43 of file CaloTPGTranscoderULUT.h.

typedef std::vector<double> CaloTPGTranscoderULUT::RCTdecompression [private]

Definition at line 44 of file CaloTPGTranscoderULUT.h.


Constructor & Destructor Documentation

CaloTPGTranscoderULUT::CaloTPGTranscoderULUT ( const std::string &  compressionFile = "",
const std::string &  decompressionFile = "" 
)

Definition at line 17 of file CaloTPGTranscoderULUT.cc.

References i, NOUTLUTS, and outputLUT_.

                                                : isLoaded_(false), nominal_gain_(0.), rctlsb_factor_(0.),
                                                  compressionFile_(compressionFile),
                                                  decompressionFile_(decompressionFile)
{
  for (int i = 0; i < NOUTLUTS; i++) outputLUT_[i] = 0;
}
CaloTPGTranscoderULUT::~CaloTPGTranscoderULUT ( ) [virtual]

Definition at line 26 of file CaloTPGTranscoderULUT.cc.

References i, NOUTLUTS, and outputLUT_.

                                              {
  for (int i = 0; i < NOUTLUTS; i++) {
    if (outputLUT_[i] != 0) delete [] outputLUT_[i];
  }
}

Member Function Documentation

EcalTriggerPrimitiveSample CaloTPGTranscoderULUT::ecalCompress ( const EcalTrigTowerDetId id,
unsigned int  sample,
bool  fineGrain 
) const [virtual]

Compression from linear samples+fine grain in the ECAL.

Implements CaloTPGTranscoder.

Definition at line 315 of file CaloTPGTranscoderULUT.cc.

References Exception.

                                                                                                                                      {
  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::ecalCompress";
}
std::vector< unsigned char > CaloTPGTranscoderULUT::getCompressionLUT ( HcalTrigTowerDetId  id) const [virtual]

Definition at line 357 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), i, OUTPUT_LUT_SIZE, and outputLUT_.

Referenced by HcalLutManager::getCompressionLutXmlFromCoder().

                                                                                             {
   std::vector<unsigned char> lut;
   int itower = getOutputLUTId(id.ieta(),id.iphi());
   if (itower >= 0) {
         lut.resize(OUTPUT_LUT_SIZE);
         for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; i++) lut[i]=outputLUT_[itower][i];
   } 
   return lut;
}
int CaloTPGTranscoderULUT::getOutputLUTId ( const int  ieta,
const int  iphi 
) const [virtual]

Definition at line 343 of file CaloTPGTranscoderULUT.cc.

References abs, HTvalid(), newHFphi, NOUTLUTS, and evf::evtn::offset().

Referenced by getCompressionLUT(), hcalCompress(), hcaletValue(), loadHCALCompress(), loadHCALUncompress(), and L1CaloHcalScaleConfigOnlineProd::newObject().

                                                                                {
        int iphi = iphiin;
        if (HTvalid(ieta, iphi)) {
                int offset = 0, ietaabs;
                ietaabs = abs(ieta);
                if (ieta < 0) offset = NOUTLUTS/2;
                if (ietaabs < 29) return 72*(ietaabs - 1) + (iphi - 1) + offset;
                else {
                  if (newHFphi) iphi = iphi/4 + 1;
                  return 18*(ietaabs - 29) + iphi + 2015 + offset;
                }
        } else return -1;       
}
HcalTriggerPrimitiveSample CaloTPGTranscoderULUT::hcalCompress ( const HcalTrigTowerDetId id,
unsigned int  sample,
bool  fineGrain 
) const [virtual]

Compression from linear samples+fine grain in the HTR.

Implements CaloTPGTranscoder.

Definition at line 249 of file CaloTPGTranscoderULUT.cc.

References Exception, getOutputLUTId(), OUTPUT_LUT_SIZE, and outputLUT_.

                                                                                                                                      {
  int ieta = id.ieta();
  int iphi = id.iphi();
//  if (abs(ieta) > 28) iphi = iphi/4 + 1; // Changing iphi index from 1, 5, ..., 69 to 1, 2, ..., 18
  int itower = getOutputLUTId(ieta,iphi);

  if (itower < 0) cms::Exception("Invalid Data") << "No trigger tower found for ieta, iphi = " << ieta << ", " << iphi;
  if (sample >= OUTPUT_LUT_SIZE) {

    throw cms::Exception("Out of Range") << "LUT has 1024 entries for " << itower << " but " << sample << " was requested.";
    sample=OUTPUT_LUT_SIZE - 1;
  }

  return HcalTriggerPrimitiveSample(outputLUT_[itower][sample],fineGrain,0,0);
}
double CaloTPGTranscoderULUT::hcaletValue ( const int &  ieta,
const int &  compressedValue 
) const [virtual]

Implements CaloTPGTranscoder.

Definition at line 278 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, decompressionFile_, getOutputLUTId(), hcaluncomp_, HTvalid(), and loadHCALUncompress().

Referenced by printDecompression().

                                                                                  {
// This is now an obsolete method; we return the AVERAGE over all the allowed iphi channels if it's invoked
// The user is encouraged to use hcaletValue(const int& ieta, const int& iphi, const int& compET) instead

  if (hcaluncomp_.empty()) {
        std::cout << "Initializing the RCT decompression table from the file: " << decompressionFile_ << std::endl;
        CaloTPGTranscoderULUT::loadHCALUncompress(decompressionFile_);
  }

  double etvalue = 0.;
  if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, cET = " << ieta << ", " << compET << std::endl;
  else {
        int nphi = 0;
        for (int iphi=1; iphi <= 72; iphi++) {
                if (HTvalid(ieta,iphi)) {
                        nphi++;
                        int itower = getOutputLUTId(ieta,iphi);
                        etvalue += hcaluncomp_[itower][compET];
                }
        }
        if (nphi > 0) etvalue /= nphi;
        else std::cout << "hcaletValue error: no decompression LUTs found for any iphi for ieta = " << ieta << std::endl;
  }
  return(etvalue);
}
double CaloTPGTranscoderULUT::hcaletValue ( const int &  ieta,
const int &  iphi,
const int &  compressedValue 
) const [virtual]

Implements CaloTPGTranscoder.

Definition at line 265 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, decompressionFile_, getOutputLUTId(), hcaluncomp_, and loadHCALUncompress().

                                                                                                   {
  if (hcaluncomp_.empty()) {

        CaloTPGTranscoderULUT::loadHCALUncompress(decompressionFile_);
  }
  double etvalue = 0.;
  int itower = getOutputLUTId(ieta,iphi);
  if (itower < 0) std::cout << "hcaletValue error: no decompression LUT found for ieta, iphi = " << ieta << ", " << iphi << std::endl;
  else if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, phi, cET = " << ieta << ", " << iphi << ", " << compET << std::endl;
  else etvalue = hcaluncomp_[itower][compET];
  return(etvalue);
}
double CaloTPGTranscoderULUT::hcaletValue ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc 
) const [virtual]

Implements CaloTPGTranscoder.

Definition at line 304 of file CaloTPGTranscoderULUT.cc.

References HcalTriggerPrimitiveSample::compressedEt(), decompressionFile_, getOutputLUTId(), hcaluncomp_, HcalTrigTowerDetId::ieta(), HcalTrigTowerDetId::iphi(), and loadHCALUncompress().

                                                                                                                   {
  if (hcaluncomp_.empty()) loadHCALUncompress(decompressionFile_);

  int ieta = hid.ieta();                        // No need to check the validity,
  int iphi = hid.iphi();                        // as the values are guaranteed
  int compET = hc.compressedEt();       // to be within the range by the class
  int itower = getOutputLUTId(ieta,iphi);
  double etvalue = hcaluncomp_[itower][compET];
  return(etvalue);
}
bool CaloTPGTranscoderULUT::HTvalid ( const int  ieta,
const int  iphi 
) const [virtual]

Definition at line 330 of file CaloTPGTranscoderULUT.cc.

References abs, and newHFphi.

Referenced by HcalLutManager::getCompressionLutXmlFromAsciiMaster(), HcalLutManager::getCompressionLutXmlFromCoder(), getOutputLUTId(), hcaletValue(), loadHCALCompress(), loadHCALUncompress(), and L1CaloHcalScaleConfigOnlineProd::newObject().

                                                                          {
        int iphi = iphiin;
        if (iphi <= 0 || iphi > 72 || ieta == 0 || abs(ieta) > 32) return false;
        if (abs(ieta) > 28) {
          if (newHFphi) {
            if ((iphi/4)*4 + 1 != iphi) return false;
            iphi = iphi/4 + 1;
          }
          if (iphi > 18) return false;
        }
        return true;
}
void CaloTPGTranscoderULUT::loadHCALCompress ( const std::string &  filename) const [private]

Definition at line 71 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, Exception, getOutputLUTId(), HTvalid(), i, getHLTprescales::index, j, loadHCALCompress(), NOUTLUTS, OUTPUT_LUT_SIZE, outputLUT_, and asciidump::s.

                                                                           {
  int tool;
  std::ifstream userfile;
  std::vector< std::vector<LUT> > outputluts;

  std::cout << "Initializing compression LUT's from " << (char *)filename.data() << std::endl;
  for (int i = 0; i < NOUTLUTS; i++) outputLUT_[i] = 0;
  int maxid = 0, minid = 0x7FFFFFFF, rawid = 0;
  for (int ieta=-32; ieta <= 32; ieta++) {
    for (int iphi = 1; iphi <= 72; iphi++) {
                if (HTvalid(ieta,iphi)) {
          rawid = getOutputLUTId(ieta, iphi);
          if (outputLUT_[rawid] != 0) std::cout << "Error: LUT with (ieta,iphi) = (" << ieta << "," << iphi << ") has been previously allocated!" << std::endl;
          else outputLUT_[rawid] = new LUT[OUTPUT_LUT_SIZE];
          if (rawid < minid) minid = rawid;
          if (rawid > maxid) maxid = rawid;
        }
        }
  }

  userfile.open((char *)filename.data());

  if( userfile ) {
    int nluts = 0;
        std::string s;
    std::vector<int> loieta,hiieta;
    std::vector<int> loiphi,hiiphi;
    getline(userfile,s);

    getline(userfile,s);

        unsigned int index = 0;
        while (index < s.length()) {
          while (isspace(s[index])) index++;
          if (index < s.length()) nluts++;
          while (!isspace(s[index])) index++;
        }
        for (unsigned int i=0; i<=s.length(); i++) userfile.unget(); //rewind last line
    outputluts.resize(nluts);
    for (int i=0; i<nluts; i++) outputluts[i].resize(OUTPUT_LUT_SIZE);
    
    
    for (int i=0; i<nluts; i++) {
      userfile >> tool;
      loieta.push_back(tool);
    }
    
    for (int i=0; i<nluts; i++) {
      userfile >> tool;
      hiieta.push_back(tool);    
    }
   
    for (int i=0; i<nluts; i++) {
      userfile >> tool;
      loiphi.push_back(tool);
        
    }
    
    for (int i=0; i<nluts; i++) {
      userfile >> tool;
      hiiphi.push_back(tool);
    
    }
        
    for (unsigned int j=0; j<OUTPUT_LUT_SIZE; j++) { 
      for(int i=0; i <nluts; i++) {
                userfile >> tool;
                if (tool < 0) {
                        std::cout << "Error: LUT can't have negative numbers; 0 used instead: " << i << ", " << j << " : = " << tool << std::endl;
                        tool = 0;
                } else if (tool > 0xff) {
                        std::cout << "Error: LUT can't have >8-bit numbers; 0xff used instead: " << i << ", " << j << " : = " << tool << std::endl;
                        tool = 0xff;
                }
                outputluts[i][j] = tool;
                if (userfile.eof()) std::cout << "Error: LUT file is truncated or has a wrong format: " << i << "," << j << std::endl;
          }
    }
    userfile.close();
        
        HcalDetId cell;
        int id, ntot = 0;
        for (int i=0; i < nluts; i++) {
                int nini = 0;
                for (int iphi = loiphi[i]; iphi <= hiiphi[i]; iphi++) {      
                        for (int ieta=loieta[i]; ieta <= hiieta[i]; ieta++) {
                                        if (HTvalid(ieta,iphi)) {  
                                                id = getOutputLUTId(ieta,iphi);
                                                if (outputLUT_[id] == 0) throw cms::Exception("PROBLEM: outputLUT_ has not been initialized for ieta, iphi, id = ") << ieta << ", " << iphi << ", " << id << std::endl;
                                        for (int j = 0; j <= 0x3ff; j++) outputLUT_[id][j] = outputluts[i][j];
                                                nini++;
                                                ntot++;
                                        }
                        }
       }
        
    }
        
  } else {
    
        loadHCALCompress();
  }
}
void CaloTPGTranscoderULUT::loadHCALCompress ( void  ) const [private]

Definition at line 32 of file CaloTPGTranscoderULUT.cc.

References abs, gather_cfg::cout, HcalTrigTowerGeometry::firstHFTower(), getOutputLUTId(), HcalLutMetadatum::getOutputLutThreshold(), HTvalid(), i, funct::log(), lutMetadata_, min, OUTPUT_LUT_SIZE, outputLUT_, mathSSE::sqrt(), theTrigTowerGeometry, and dtT0WireCalibration_cfg::threshold.

Referenced by loadHCALCompress(), and setup().

                                                  {
// Initialize analytical compression LUT's here
   // TODO cms::Error log
  if (OUTPUT_LUT_SIZE != (unsigned int) 0x400) std::cout << "Error: Analytic compression expects 10-bit LUT; found LUT with " << OUTPUT_LUT_SIZE << " entries instead" << std::endl;

  std::vector<unsigned int> analyticalLUT(OUTPUT_LUT_SIZE, 0);
  std::vector<unsigned int> identityLUT(OUTPUT_LUT_SIZE, 0);

  // Compute compression LUT
  for (unsigned int i=0; i < OUTPUT_LUT_SIZE; i++) {
        analyticalLUT[i] = (unsigned int)(sqrt(14.94*log(1.+i/14.94)*i) + 0.5);
        identityLUT[i] = min(i,0xffu);
  }
 
  for (int ieta=-32; ieta <= 32; ieta++){
     for (int iphi = 1; iphi <= 72; iphi++){
        if (!HTvalid(ieta,iphi)) continue;
        int lutId = getOutputLUTId(ieta,iphi);
        // TODO cms::Error log
        if (outputLUT_[lutId] != 0){
           std::cout << "Error: LUT with (ieta,iphi) = (" << ieta << "," << iphi << ") has been previously allocated!" << std::endl;
           continue;
        }

        outputLUT_[lutId] = new LUT[OUTPUT_LUT_SIZE];

        HcalTrigTowerDetId id(ieta, iphi);
        const HcalLutMetadatum *meta = lutMetadata_->getValues(id);
        int threshold = meta->getOutputLutThreshold();

        for (int i = 0; i < threshold; ++i)
           outputLUT_[lutId][i] = 0;

        for (unsigned int i = threshold; i < OUTPUT_LUT_SIZE; ++i)
           outputLUT_[lutId][i] = (abs(ieta) < theTrigTowerGeometry.firstHFTower()) ? analyticalLUT[i] : identityLUT[i];
     } //for iphi
  } //for ieta
}
void CaloTPGTranscoderULUT::loadHCALUncompress ( void  ) const [private]

Definition at line 175 of file CaloTPGTranscoderULUT.cc.

References abs, HcalTrigTowerGeometry::firstHFTower(), HcalLutMetadatum::getLutGranularity(), getOutputLUTId(), hcaluncomp_, HTvalid(), i, lutMetadata_, nominal_gain_, NOUTLUTS, OUTPUT_LUT_SIZE, outputLUT_, rctlsb_factor_, theTrigTowerGeometry, HcalTrigTowerGeometry::towerEtaBounds(), and TPGMAX.

Referenced by hcaletValue(), and loadHCALUncompress().

                                                     {
   hcaluncomp_.clear();
   for (int i = 0; i < NOUTLUTS; i++){
      RCTdecompression decompressionTable(TPGMAX,0);
      hcaluncomp_.push_back(decompressionTable);
   }

   for (int ieta = -32; ieta <= 32; ++ieta){

      double eta_low = 0., eta_high = 0.;
                theTrigTowerGeometry.towerEtaBounds(ieta,eta_low,eta_high); 
      double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));

                for (int iphi = 1; iphi <= 72; iphi++) {
         if (!HTvalid(ieta, iphi)) continue;

                        int lutId = getOutputLUTId(ieta,iphi);
         HcalTrigTowerDetId id(ieta, iphi);

         const HcalLutMetadatum *meta = lutMetadata_->getValues(id);
         double factor = 0.;

         // HF
         if (abs(ieta) >= theTrigTowerGeometry.firstHFTower())
            factor = rctlsb_factor_;
         // HBHE
         else 
            factor = nominal_gain_ / cosh_ieta * meta->getLutGranularity();

         // tpg - compressed value
         unsigned int tpg = outputLUT_[lutId][0];
         int low = 0;
         for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; ++i){
            if (outputLUT_[lutId][i] != tpg){
               unsigned int mid = (low + i)/2;
               hcaluncomp_[lutId][tpg] = (tpg == 0 ? low : factor * mid);
               low = i;
               tpg = outputLUT_[lutId][i];
            }
         }
         hcaluncomp_[lutId][tpg] = factor * low;
                } // for phi
        } // for ieta
}
void CaloTPGTranscoderULUT::loadHCALUncompress ( const std::string &  filename) const [private]

Definition at line 220 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), hcaluncomp_, i, j, loadHCALUncompress(), NOUTLUTS, and TPGMAX.

                                                                              {
  std::ifstream userfile;
  userfile.open(filename.c_str());
  
  hcaluncomp_.resize(NOUTLUTS);
  for (int i = 0; i < NOUTLUTS; i++) hcaluncomp_[i].resize(TPGMAX);
  
  static const int etabound = 32;
  if( userfile ) {
         double et;
     for (int i=0; i<TPGMAX; i++) { 
      for(int j = 1; j <=etabound; j++) {
            userfile >> et;
                for (int iphi = 1; iphi <= 72; iphi++) {
                  int itower = getOutputLUTId(j,iphi);
                  if (itower >= 0) hcaluncomp_[itower][i] = et;
                  itower = getOutputLUTId(-j,iphi);
                  if (itower >= 0) hcaluncomp_[itower][i] = et;           
                }
          }
         }
         userfile.close();
  }
  else {

        loadHCALUncompress();
  }
}
void CaloTPGTranscoderULUT::printDecompression ( ) const

Definition at line 389 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, hcaletValue(), i, j, HcalTrigTowerGeometry::nTowers(), and theTrigTowerGeometry.

                                                    {
   std::cout << "RCT Decompression table" << std::endl;                          
   for (int i=0; i < 256; i++) {                                                 
      for (int j=1; j <= theTrigTowerGeometry.nTowers(); j++)
         std::cout << int(hcaletValue(j,i)*100. + 0.5)/100. << " ";
      std::cout << std::endl;                                               
      for (int j=1; j <= theTrigTowerGeometry.nTowers(); j++)               
         if (hcaletValue(j,i) != hcaletValue(-j,i))                    
            cout << "Error: decompression table for ieta = +/- " << j << " disagree! " << hcaletValue(-j,i) << ", " << hcaletValue(j,i) << endl;        
   }
}
void CaloTPGTranscoderULUT::rctEGammaUncompress ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc,
const EcalTrigTowerDetId eid,
const EcalTriggerPrimitiveSample ec,
unsigned int &  et,
bool &  egVeto,
bool &  activity 
) const [virtual]

Uncompression for the Electron/Photon path in the RCT.

Implements CaloTPGTranscoder.

Definition at line 319 of file CaloTPGTranscoderULUT.cc.

References Exception.

                                                                                                       {
  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctEGammaUncompress";
}
void CaloTPGTranscoderULUT::rctJetUncompress ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc,
const EcalTrigTowerDetId eid,
const EcalTriggerPrimitiveSample ec,
unsigned int &  et 
) const [virtual]

Uncompression for the JET path in the RCT.

Implements CaloTPGTranscoder.

Definition at line 324 of file CaloTPGTranscoderULUT.cc.

References Exception.

                                                                     {
  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctJetUncompress";
}
void CaloTPGTranscoderULUT::setup ( const edm::EventSetup es,
Mode  mode = All 
) const [virtual]

Obtain any needed objects from the EventSetup. Note that any member variables which are changed must be mutable.

Reimplemented from CaloTPGTranscoder.

Definition at line 367 of file CaloTPGTranscoderULUT.cc.

References compressionFile_, gather_cfg::cout, decompressionFile_, Exception, edm::EventSetup::get(), isLoaded_, loadHCALCompress(), lutMetadata_, nominal_gain_, and rctlsb_factor_.

                                                                             {
   if (isLoaded_) return;
   // TODO Try/except
   es.get<HcalLutMetadataRcd>().get(lutMetadata_);

   nominal_gain_ = lutMetadata_->getNominalGain();
   float rctlsb =lutMetadata_->getRctLsb();
   if (rctlsb != 0.25 && rctlsb != 0.5)
      throw cms::Exception("RCTLSB") << " value=" << rctlsb << " (should be 0.25 or 0.5)" << std::endl;
   rctlsb_factor_ = rctlsb;

   if (compressionFile_.empty() && decompressionFile_.empty()) {
      loadHCALCompress();
   }
   else {
      // TODO Message to discourage using txt.
      std::cout << "From Text File:" << std::endl;
      loadHCALCompress(compressionFile_);
   }
   isLoaded_ = true;
}

Member Data Documentation

Definition at line 65 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

Definition at line 66 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and setup().

std::vector<RCTdecompression> CaloTPGTranscoderULUT::hcaluncomp_ [mutable, private]

Definition at line 73 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and loadHCALUncompress().

std::vector<int> CaloTPGTranscoderULUT::ietah [private]

Definition at line 68 of file CaloTPGTranscoderULUT.h.

std::vector<int> CaloTPGTranscoderULUT::ietal [private]

Definition at line 67 of file CaloTPGTranscoderULUT.h.

bool CaloTPGTranscoderULUT::isLoaded_ [mutable, private]

Definition at line 62 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

std::vector<int> CaloTPGTranscoderULUT::LUTfactor [private]

Definition at line 70 of file CaloTPGTranscoderULUT.h.

Definition at line 74 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), loadHCALUncompress(), and setup().

const bool CaloTPGTranscoderULUT::newHFphi = true [static, private]

Definition at line 51 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTId(), and HTvalid().

double CaloTPGTranscoderULUT::nominal_gain_ [mutable, private]

Definition at line 63 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress(), and setup().

const int CaloTPGTranscoderULUT::NOUTLUTS = 4176 [static, private]
const unsigned int CaloTPGTranscoderULUT::OUTPUT_LUT_SIZE = 1024 [static, private]
double CaloTPGTranscoderULUT::rctlsb_factor_ [mutable, private]

Definition at line 64 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress(), and setup().

const int CaloTPGTranscoderULUT::TPGMAX = 256 [static, private]

Definition at line 50 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress().

std::vector<int> CaloTPGTranscoderULUT::ZS [private]

Definition at line 69 of file CaloTPGTranscoderULUT.h.