20 : theTopology(nullptr),
27 compressionFile_(compressionFile),
28 decompressionFile_(decompressionFile) {}
35 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
38 std::array<unsigned int, OUTPUT_LUT_SIZE> analyticalLUT;
39 std::array<unsigned int, OUTPUT_LUT_SIZE> linearQIE8LUT;
40 std::array<unsigned int, OUTPUT_LUT_SIZE> linearQIE11LUT;
41 std::array<unsigned int, OUTPUT_LUT_SIZE> linearRctLUT;
42 std::array<unsigned int, OUTPUT_LUT_SIZE> linearNctLUT;
46 analyticalLUT[
i] =
min(static_cast<unsigned int>(
sqrt(14.94 *
log(1. +
i / 14.94) *
i) + 0.5),
TPGMAX - 1);
55 for (std::vector<DetId>::iterator
i = allChannels.begin();
i != allChannels.end(); ++
i) {
98 double eta_low = 0., eta_high = 0.;
100 double cosh_ieta = fabs(cosh((eta_low + eta_high) / 2.));
107 for (
unsigned int i = 0;
i < lutsize; ++
i) {
121 for (
unsigned int i = 0;
i < lutsize; ++
i) {
123 unsigned int mid = (
low +
i) / 2;
134 for (
unsigned int i = 0;
i < lutsize; ++
i) {
146 int fineGrain)
const {
151 <<
sample <<
" was requested.";
154 throw cms::Exception(
"Out of Range") <<
"No decompression LUT found for " <<
id;
162 const int& compET)
const {
166 edm::LogError(
"CaloTPGTranscoderULUT") <<
"No decompression LUT found for ieta, iphi = " <<
ieta <<
", " <<
iphi;
167 }
else if (compET < 0 || compET >= (
int)
TPGMAX) {
169 <<
"Compressed value out of range: eta, phi, cET = " <<
ieta <<
", " <<
iphi <<
", " << compET;
185 bool fineGrain)
const {
186 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::ecalCompress";
195 bool& activity)
const {
196 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::rctEGammaUncompress";
202 unsigned int&
et)
const {
203 throw cms::Exception(
"Not Implemented") <<
"CaloTPGTranscoderULUT::rctJetUncompress";
210 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
217 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
224 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
233 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
265 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Unknown trigger mode used by the topology!";
271 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
286 throw cms::Exception(
"CaloTPGTranscoderULUT") <<
"Unknown trigger mode used by the topology!";
293 std::vector<unsigned int>
result(lut.begin(), lut.end());
325 for (
const auto&
tower : theTrigTowerGeometry.
towerIds(cell))
332 throw cms::Exception(
"Not Implemented") <<
"setup of CaloTPGTranscoderULUT from text files";
bool validHT(const HcalTrigTowerDetId &id) const
std::vector< RCTdecompression > hcaluncomp_
std::vector< std::vector< LUT > > outputLUT_
std::set< HcalDetId > plan1_towers_
static const unsigned int QIE8_OUTPUT_LUT_SIZE
virtual bool HTvalid(const int ieta, const int iphi, const int version) const
int compressedEt() const
get the encoded/compressed Et
bool valid(const DetId &id) const override
virtual void setup(HcalLutMetadata const &, HcalTrigTowerGeometry const &, int nctScaleShift, int rctScaleShift, double lsbQIE8, double lsbQIE11, bool allLinear)
CaloTPGTranscoderULUT(const std::string &compressionFile="", const std::string &decompressionFile="")
Log< level::Error, false > LogError
const std::string decompressionFile_
void rctJetUncompress(const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc, const EcalTrigTowerDetId &eid, const EcalTriggerPrimitiveSample &ec, unsigned int &et) const override
Uncompression for the JET path in the RCT.
const Item * getValues(DetId fId, bool throwOnFail=true) const
int firstHFTower(int version) const
const HcalTopology * topo() const
virtual const std::vector< unsigned int > getCompressionLUT(const HcalTrigTowerDetId &id) const
HcalTriggerPrimitiveSample hcalCompress(const HcalTrigTowerDetId &id, unsigned int sample, int fineGrain) const override
Compression from linear samples+fine grain in the HTR.
const HcalTopology * theTopology
HcalTopologyMode::TriggerMode triggerMode() const
static const unsigned int QIE10_OUTPUT_LUT_SIZE
void rctEGammaUncompress(const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc, const EcalTrigTowerDetId &eid, const EcalTriggerPrimitiveSample &ec, unsigned int &et, bool &egVecto, bool &activity) const override
Uncompression for the Electron/Photon path in the RCT.
Abs< T >::type abs(const T &t)
static const unsigned int OUTPUT_LUT_SIZE
std::vector< DetId > getAllChannels() const
bool isHcalCastorDetId() const
unsigned int getHTSize() const
void loadHCALCompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
EcalTriggerPrimitiveSample ecalCompress(const EcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const override
Compression from linear samples+fine grain in the ECAL.
static const unsigned int QIE11_OUTPUT_LUT_SIZE
bool isHcalZDCDetId() const
const std::string compressionFile_
static const unsigned int TPGMAX
void towerEtaBounds(int ieta, int version, double &eta1, double &eta2) const
where this tower begins and ends in eta
const HcalDDDRecConstants * dddConstants() const
unsigned int getOutputLUTSize(const HcalTrigTowerDetId &id) const
Log< level::Warning, false > LogWarning
bool isPlan1(const HcalDetId &id) const
double hcaletValue(const int &ieta, const int &iphi, const int &version, const int &compressedValue) const override
std::vector< HcalTrigTowerDetId > towerIds(const HcalDetId &cellId) const
the mapping to and from DetIds
~CaloTPGTranscoderULUT() override
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
bool isOnlyQIE11(const HcalTrigTowerDetId &id) const
bool isHcalTrigTowerDetId() const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const