24 nominal_gain_(0.), rctlsb_factor_(0.),
25 compressionFile_(compressionFile),
26 decompressionFile_(decompressionFile)
38 edm::LogError(
"CaloTPGTranscoderULUT") <<
"Analytic compression expects 10-bit LUT; found LUT with " <<
OUTPUT_LUT_SIZE <<
" entries instead";
41 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
44 std::array<unsigned int, OUTPUT_LUT_SIZE> analyticalLUT;
45 std::array<unsigned int, OUTPUT_LUT_SIZE> identityLUT;
49 analyticalLUT[
i] = (
unsigned int)(
sqrt(14.94*
log(1.+
i/14.94)*
i) + 0.5);
55 for(std::vector<DetId>::iterator
i=allChannels.begin();
i!=allChannels.end(); ++
i){
83 LUT value = isHBHE ? analyticalLUT[
i] : identityLUT[
i];
90 double eta_low = 0., eta_high = 0.;
91 theTrigTowerGeometry.
towerEtaBounds(ieta,version,eta_low,eta_high);
92 double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
101 unsigned int mid = (low +
i)/2;
115 throw cms::Exception(
"Out of Range") <<
"LUT has 1024 entries for " << itower <<
" but " << sample <<
" was requested.";
126 edm::LogError(
"CaloTPGTranscoderULUT") <<
"No decompression LUT found for ieta, iphi = " << ieta <<
", " << iphi;
127 }
else if (compET < 0 || compET >= (
int)
TPGMAX) {
128 edm::LogError(
"CaloTPGTranscoderULUT") <<
"Compressed value out of range: eta, phi, cET = " << ieta <<
", " << iphi <<
", " << compET;
140 if (compET < 0 || compET >= (
int)
TPGMAX) {
141 edm::LogError(
"CaloTPGTranscoderULUT") <<
"Compressed value out of range: eta, cET = " << ieta <<
", " << compET;
144 for (
int iphi=1; iphi <= 72; iphi++) {
154 edm::LogError(
"CaloTPGTranscoderULUT") <<
"No decompression LUTs found for any iphi for ieta = " << ieta;
168 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::ecalCompress";
173 unsigned int& et,
bool& egVecto,
bool& activity)
const {
174 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::rctEGammaUncompress";
178 unsigned int& et)
const {
179 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::rctJetUncompress";
185 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
192 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
199 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
217 <<
" or " <<
LSB_HF <<
")" << std::endl;
224 throw cms::Exception(
"Not Implemented") <<
"setup of CaloTPGTranscoderULUT from text files";
std::vector< RCTdecompression > hcaluncomp_
std::vector< std::vector< LUT > > outputLUT_
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
std::string decompressionFile_
void towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
CaloTPGTranscoderULUT(const std::string &compressionFile="", const std::string &decompressionFile="")
const Item * getValues(DetId fId, bool throwOnFail=true) const
virtual const std::vector< unsigned int > & getCompressionLUT(const HcalTrigTowerDetId &id) const
virtual ~CaloTPGTranscoderULUT()
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.
bool isHcalTrigTowerDetId() const
const HcalTopology * theTopology
std::vector< DetId > getAllChannels() const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
Abs< T >::type abs(const T &t)
static const unsigned int OUTPUT_LUT_SIZE
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 bool HTvalid(const int ieta, const int iphi) const
void loadHCALCompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
std::string compressionFile_
virtual void setup(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
virtual double hcaletValue(const int &ieta, const int &compressedValue) const
static const unsigned int TPGMAX
int compressedEt() const
get the encoded/compressed Et
virtual EcalTriggerPrimitiveSample ecalCompress(const EcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const
Compression from linear samples+fine grain in the ECAL.
virtual HcalTriggerPrimitiveSample hcalCompress(const HcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const
Compression from linear samples+fine grain in the HTR.
const HcalTopology * topo() const
bool validHT(const HcalTrigTowerDetId &id) const
int firstHFTower(int version) const