CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
CaloTPGTranscoderULUT Class Reference

#include <CaloTPGTranscoderULUT.h>

Inheritance diagram for CaloTPGTranscoderULUT:
CaloTPGTranscoder

Public Member Functions

 CaloTPGTranscoderULUT (const std::string &compressionFile="", const std::string &decompressionFile="")
 
EcalTriggerPrimitiveSample ecalCompress (const EcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const override
 Compression from linear samples+fine grain in the ECAL. More...
 
virtual const std::vector< unsigned int > getCompressionLUT (const HcalTrigTowerDetId &id) const
 
virtual int getOutputLUTId (const HcalTrigTowerDetId &id) const
 
virtual int getOutputLUTId (const int ieta, const int iphi, const int version) const
 
HcalTriggerPrimitiveSample hcalCompress (const HcalTrigTowerDetId &id, unsigned int sample, int fineGrain) const override
 Compression from linear samples+fine grain in the HTR. More...
 
double hcaletValue (const int &ieta, const int &iphi, const int &version, const int &compressedValue) const override
 
double hcaletValue (const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc) const override
 
virtual bool HTvalid (const int ieta, const int iphi, const int version) const
 
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. More...
 
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. More...
 
virtual void setup (HcalLutMetadata const &, HcalTrigTowerGeometry const &, int nctScaleShift, int rctScaleShift, double lsbQIE8, double lsbQIE11, bool allLinear)
 
 ~CaloTPGTranscoderULUT () override
 
- Public Member Functions inherited from CaloTPGTranscoder
 CaloTPGTranscoder ()
 
std::shared_ptr< const EcalTPGCompressorgetEcalCompressor () const
 
std::shared_ptr< const HcalTPGCompressorgetHcalCompressor () const
 
virtual ~CaloTPGTranscoder ()
 

Private Types

typedef uint8_t LUT
 
typedef std::array< float, TPGMAXRCTdecompression
 

Private Member Functions

unsigned int getOutputLUTSize (const HcalTrigTowerDetId &id) const
 
bool isOnlyQIE11 (const HcalTrigTowerDetId &id) const
 
void loadHCALCompress (HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 

Private Attributes

bool allLinear_ = false
 
const std::string compressionFile_
 
const std::string decompressionFile_
 
std::vector< RCTdecompressionhcaluncomp_
 
std::vector< int > ietah
 
std::vector< int > ietal
 
double lin11_factor_
 
double lin8_factor_
 
double lsb_factor_
 
std::vector< int > LUTfactor
 
double nct_factor_
 
double nominal_gain_
 
std::vector< std::vector< LUT > > outputLUT_
 
std::set< HcalDetIdplan1_towers_
 
double rct_factor_
 
const HcalTopologytheTopology
 
std::vector< int > ZS
 

Static Private Attributes

static const bool newHFphi = true
 
static const int NOUTLUTS = 4176
 
static const unsigned int OUTPUT_LUT_SIZE
 
static const unsigned int QIE10_OUTPUT_LUT_SIZE = REDUCE11BIT
 
static const unsigned int QIE11_OUTPUT_LUT_SIZE = REDUCE11BIT
 
static const unsigned int QIE8_OUTPUT_LUT_SIZE = REDUCE10BIT
 
static const unsigned int REDUCE10BIT = 1024
 
static const unsigned int REDUCE11BIT = 2048
 
static const unsigned int TPGMAX = 256
 

Additional Inherited Members

- Public Types inherited from CaloTPGTranscoder
enum  Mode { All = 0, RCT = 1, HcalTPG = 2, EcalTPG = 3 }
 

Detailed Description

Author
J. Mans - Minnesota

Definition at line 18 of file CaloTPGTranscoderULUT.h.

Member Typedef Documentation

◆ LUT

typedef uint8_t CaloTPGTranscoderULUT::LUT
private

Definition at line 72 of file CaloTPGTranscoderULUT.h.

◆ RCTdecompression

typedef std::array<float, TPGMAX> CaloTPGTranscoderULUT::RCTdecompression
private

Definition at line 73 of file CaloTPGTranscoderULUT.h.

Constructor & Destructor Documentation

◆ CaloTPGTranscoderULUT()

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

Definition at line 19 of file CaloTPGTranscoderULUT.cc.

20  : theTopology(nullptr),
21  nominal_gain_(0.),
22  lsb_factor_(0.),
23  rct_factor_(1.),
24  nct_factor_(1.),
25  lin8_factor_(1.),
26  lin11_factor_(1.),
27  compressionFile_(compressionFile),
28  decompressionFile_(decompressionFile) {}
const std::string decompressionFile_
const HcalTopology * theTopology
const std::string compressionFile_

◆ ~CaloTPGTranscoderULUT()

CaloTPGTranscoderULUT::~CaloTPGTranscoderULUT ( )
override

Definition at line 30 of file CaloTPGTranscoderULUT.cc.

30 {}

Member Function Documentation

◆ ecalCompress()

EcalTriggerPrimitiveSample CaloTPGTranscoderULUT::ecalCompress ( const EcalTrigTowerDetId id,
unsigned int  sample,
bool  fineGrain 
) const
overridevirtual

Compression from linear samples+fine grain in the ECAL.

Implements CaloTPGTranscoder.

Definition at line 183 of file CaloTPGTranscoderULUT.cc.

References Exception.

185  {
186  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::ecalCompress";
187 }

◆ getCompressionLUT()

const std::vector< unsigned int > CaloTPGTranscoderULUT::getCompressionLUT ( const HcalTrigTowerDetId id) const
virtual

Definition at line 290 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), outputLUT_, and mps_fire::result.

Referenced by HcalLutManager::getCompressionLutXmlFromCoder().

290  {
291  int itower = getOutputLUTId(id);
292  auto lut = outputLUT_[itower];
293  std::vector<unsigned int> result(lut.begin(), lut.end());
294  return result;
295 }
std::vector< std::vector< LUT > > outputLUT_
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const

◆ getOutputLUTId() [1/2]

int CaloTPGTranscoderULUT::getOutputLUTId ( const HcalTrigTowerDetId id) const
virtual

Definition at line 215 of file CaloTPGTranscoderULUT.cc.

References HcalTopology::detId2denseIdHT(), Exception, and theTopology.

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

215  {
216  if (!theTopology) {
217  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
218  }
219  return theTopology->detId2denseIdHT(id);
220 }
const HcalTopology * theTopology
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT

◆ getOutputLUTId() [2/2]

int CaloTPGTranscoderULUT::getOutputLUTId ( const int  ieta,
const int  iphi,
const int  version 
) const
virtual

Definition at line 222 of file CaloTPGTranscoderULUT.cc.

References HcalTopology::detId2denseIdHT(), Exception, triggerObjects_cff::id, LEDCalibrationChannels::ieta, theTopology, and BeamSplash_cfg::version.

222  {
223  if (!theTopology) {
224  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
225  }
226  HcalTrigTowerDetId id(ieta, iphiin);
227  id.setVersion(version);
228  return theTopology->detId2denseIdHT(id);
229 }
const HcalTopology * theTopology
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT

◆ getOutputLUTSize()

unsigned int CaloTPGTranscoderULUT::getOutputLUTSize ( const HcalTrigTowerDetId id) const
private

Definition at line 231 of file CaloTPGTranscoderULUT.cc.

References Exception, HcalTopology::lastHBHERing(), HcalTopology::lastHBRing(), HcalTopology::lastHERing(), plan1_towers_, QIE10_OUTPUT_LUT_SIZE, QIE11_OUTPUT_LUT_SIZE, QIE8_OUTPUT_LUT_SIZE, theTopology, HcalTopology::triggerMode(), HcalTopologyMode::TriggerMode_2009, HcalTopologyMode::TriggerMode_2016, HcalTopologyMode::TriggerMode_2017, HcalTopologyMode::TriggerMode_2017plan1, HcalTopologyMode::TriggerMode_2018, HcalTopologyMode::TriggerMode_2018legacy, and HcalTopologyMode::TriggerMode_2021.

Referenced by hcalCompress(), and loadHCALCompress().

231  {
232  if (!theTopology)
233  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
234 
235  switch (theTopology->triggerMode()) {
238  return QIE8_OUTPUT_LUT_SIZE;
240  if (id.ietaAbs() <= theTopology->lastHERing())
241  return QIE8_OUTPUT_LUT_SIZE;
242  else
243  return QIE10_OUTPUT_LUT_SIZE;
245  if (plan1_towers_.find(id) != plan1_towers_.end())
246  return QIE11_OUTPUT_LUT_SIZE;
247  else if (id.ietaAbs() <= theTopology->lastHERing())
248  return QIE8_OUTPUT_LUT_SIZE;
249  else
250  return QIE10_OUTPUT_LUT_SIZE;
253  if (id.ietaAbs() <= theTopology->lastHBRing())
254  return QIE8_OUTPUT_LUT_SIZE;
255  else if (id.ietaAbs() <= theTopology->lastHERing())
256  return QIE11_OUTPUT_LUT_SIZE;
257  else
258  return QIE10_OUTPUT_LUT_SIZE;
260  if (id.ietaAbs() <= theTopology->lastHBHERing())
261  return QIE11_OUTPUT_LUT_SIZE;
262  else
263  return QIE10_OUTPUT_LUT_SIZE;
264  default:
265  throw cms::Exception("CaloTPGTranscoderULUT") << "Unknown trigger mode used by the topology!";
266  }
267 }
std::set< HcalDetId > plan1_towers_
static const unsigned int QIE8_OUTPUT_LUT_SIZE
const HcalTopology * theTopology
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:35
int lastHBRing() const
Definition: HcalTopology.h:92
static const unsigned int QIE10_OUTPUT_LUT_SIZE
static const unsigned int QIE11_OUTPUT_LUT_SIZE
int lastHERing() const
Definition: HcalTopology.h:94
int lastHBHERing() const
Definition: HcalTopology.h:95

◆ hcalCompress()

HcalTriggerPrimitiveSample CaloTPGTranscoderULUT::hcalCompress ( const HcalTrigTowerDetId id,
unsigned int  sample,
int  fineGrain 
) const
overridevirtual

Compression from linear samples+fine grain in the HTR.

Implements CaloTPGTranscoder.

Definition at line 144 of file CaloTPGTranscoderULUT.cc.

References Exception, getOutputLUTId(), getOutputLUTSize(), triggerObjects_cff::id, outputLUT_, and ecalGpuTask_cfi::sample.

146  {
147  unsigned int itower = getOutputLUTId(id);
148 
149  if (sample >= getOutputLUTSize(id))
150  throw cms::Exception("Out of Range") << "LUT has " << getOutputLUTSize(id) << " entries for " << id << " but "
151  << sample << " was requested.";
152 
153  if (itower >= outputLUT_.size())
154  throw cms::Exception("Out of Range") << "No decompression LUT found for " << id;
155 
156  return HcalTriggerPrimitiveSample(outputLUT_[itower][sample], fineGrain);
157 }
std::vector< std::vector< LUT > > outputLUT_
unsigned int getOutputLUTSize(const HcalTrigTowerDetId &id) const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const

◆ hcaletValue() [1/2]

double CaloTPGTranscoderULUT::hcaletValue ( const int &  ieta,
const int &  iphi,
const int &  version,
const int &  compressedValue 
) const
overridevirtual

Implements CaloTPGTranscoder.

Definition at line 159 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), hcaluncomp_, LEDCalibrationChannels::ieta, LEDCalibrationChannels::iphi, TPGMAX, and BeamSplash_cfg::version.

162  {
163  double etvalue = 0.;
164  int itower = getOutputLUTId(ieta, iphi, version);
165  if (itower < 0) {
166  edm::LogError("CaloTPGTranscoderULUT") << "No decompression LUT found for ieta, iphi = " << ieta << ", " << iphi;
167  } else if (compET < 0 || compET >= (int)TPGMAX) {
168  edm::LogError("CaloTPGTranscoderULUT")
169  << "Compressed value out of range: eta, phi, cET = " << ieta << ", " << iphi << ", " << compET;
170  } else {
171  etvalue = hcaluncomp_[itower][compET];
172  }
173  return (etvalue);
174 }
std::vector< RCTdecompression > hcaluncomp_
Log< level::Error, false > LogError
static const unsigned int TPGMAX
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const

◆ hcaletValue() [2/2]

double CaloTPGTranscoderULUT::hcaletValue ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc 
) const
overridevirtual

Implements CaloTPGTranscoder.

Definition at line 176 of file CaloTPGTranscoderULUT.cc.

References HcalTriggerPrimitiveSample::compressedEt(), getOutputLUTId(), and hcaluncomp_.

176  {
177  int compET = hc.compressedEt(); // to be within the range by the class
178  int itower = getOutputLUTId(hid);
179  double etvalue = hcaluncomp_[itower][compET];
180  return etvalue;
181 }
std::vector< RCTdecompression > hcaluncomp_
int compressedEt() const
get the encoded/compressed Et
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const

◆ HTvalid()

bool CaloTPGTranscoderULUT::HTvalid ( const int  ieta,
const int  iphi,
const int  version 
) const
virtual

Definition at line 206 of file CaloTPGTranscoderULUT.cc.

References Exception, triggerObjects_cff::id, LEDCalibrationChannels::ieta, theTopology, HcalTopology::validHT(), and BeamSplash_cfg::version.

Referenced by HcalLutManager::getCompressionLutXmlFromAsciiMaster(), HcalLutManager::getCompressionLutXmlFromCoder(), and L1CaloHcalScaleConfigOnlineProd::newObject().

206  {
207  HcalTrigTowerDetId id(ieta, iphiin);
208  id.setVersion(version);
209  if (!theTopology) {
210  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
211  }
212  return theTopology->validHT(id);
213 }
bool validHT(const HcalTrigTowerDetId &id) const
const HcalTopology * theTopology

◆ isOnlyQIE11()

bool CaloTPGTranscoderULUT::isOnlyQIE11 ( const HcalTrigTowerDetId id) const
private

Definition at line 269 of file CaloTPGTranscoderULUT.cc.

References Exception, HcalTopology::lastHBRing(), plan1_towers_, theTopology, HcalTopology::triggerMode(), HcalTopologyMode::TriggerMode_2017plan1, HcalTopologyMode::TriggerMode_2018, HcalTopologyMode::TriggerMode_2018legacy, and HcalTopologyMode::TriggerMode_2021.

Referenced by loadHCALCompress().

269  {
270  if (!theTopology)
271  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
272 
273  switch (theTopology->triggerMode()) {
275  if (plan1_towers_.find(id) != plan1_towers_.end() and id.ietaAbs() != theTopology->lastHBRing())
276  return true;
277  return false;
280  if (id.ietaAbs() <= theTopology->lastHBRing())
281  return false;
282  return true;
284  return true;
285  default:
286  throw cms::Exception("CaloTPGTranscoderULUT") << "Unknown trigger mode used by the topology!";
287  }
288 }
std::set< HcalDetId > plan1_towers_
const HcalTopology * theTopology
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:35
int lastHBRing() const
Definition: HcalTopology.h:92

◆ loadHCALCompress()

void CaloTPGTranscoderULUT::loadHCALCompress ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry 
)
private

Definition at line 32 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), allLinear_, Exception, DQMScaleToClient_cfi::factor, HcalTrigTowerGeometry::firstHFTower(), HcalCondObjectContainer< Item >::getAllChannels(), HcalLutMetadatum::getLutGranularity(), getOutputLUTId(), getOutputLUTSize(), HcalLutMetadatum::getOutputLutThreshold(), HcalCondObjectContainer< Item >::getValues(), hcaluncomp_, mps_fire::i, triggerObjects_cff::id, LEDCalibrationChannels::ieta, HcalGenericDetId::isHcalCastorDetId(), HcalGenericDetId::isHcalDetId(), HcalGenericDetId::isHcalTrigTowerDetId(), HcalGenericDetId::isHcalZDCDetId(), isOnlyQIE11(), lin11_factor_, lin8_factor_, dqm-mbProfile::log, LaserClient_cfi::low, lsb_factor_, SiStripPI::min, nct_factor_, nominal_gain_, OUTPUT_LUT_SIZE, outputLUT_, rct_factor_, mathSSE::sqrt(), theTopology, remoteMonitoring_LASER_era2018_cfg::threshold, HcalTrigTowerGeometry::towerEtaBounds(), TPGMAX, HcalTopology::validHT(), and BeamSplash_cfg::version.

Referenced by setup().

33  {
34  if (!theTopology) {
35  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
36  }
37 
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;
43 
44  // Compute compression LUT
45  for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; i++) {
46  analyticalLUT[i] = min(static_cast<unsigned int>(sqrt(14.94 * log(1. + i / 14.94) * i) + 0.5), TPGMAX - 1);
47  linearQIE8LUT[i] = min(static_cast<unsigned int>((i + .5) / lin8_factor_), TPGMAX - 1);
48  linearQIE11LUT[i] = min(static_cast<unsigned int>((i + .5) / lin11_factor_), TPGMAX - 1);
49  linearRctLUT[i] = min(static_cast<unsigned int>((i + .5) / rct_factor_), TPGMAX - 1);
50  linearNctLUT[i] = min(static_cast<unsigned int>((i + .5) / nct_factor_), TPGMAX - 1);
51  }
52 
53  std::vector<DetId> allChannels = lutMetadata.getAllChannels();
54 
55  for (std::vector<DetId>::iterator i = allChannels.begin(); i != allChannels.end(); ++i) {
56  if (not HcalGenericDetId(*i).isHcalTrigTowerDetId()) {
57  if ((not HcalGenericDetId(*i).isHcalDetId()) and (not HcalGenericDetId(*i).isHcalZDCDetId()) and
59  edm::LogWarning("CaloTPGTranscoderULUT") << "Encountered invalid HcalDetId " << HcalGenericDetId(*i);
60  continue;
61  }
62 
64  if (!theTopology->validHT(id))
65  continue;
66 
67  unsigned int index = getOutputLUTId(id);
68 
69  const HcalLutMetadatum* meta = lutMetadata.getValues(id);
70  unsigned int threshold = meta->getOutputLutThreshold();
71 
72  int ieta = id.ieta();
73  int version = id.version();
74  bool isHBHE = (abs(ieta) < theTrigTowerGeometry.firstHFTower(version));
75 
76  unsigned int lutsize = getOutputLUTSize(id);
77  outputLUT_[index].resize(lutsize);
78 
79  for (unsigned int i = 0; i < threshold; ++i)
80  outputLUT_[index][i] = 0;
81 
82  if (isHBHE) {
83  for (unsigned int i = threshold; i < lutsize; ++i)
84  if (allLinear_) {
85  outputLUT_[index][i] = isOnlyQIE11(id) ? linearQIE11LUT[i] : linearQIE8LUT[i];
86  //Modifying the saturation (127 -> 255) for the 'split cells'.
87  if (abs(ieta) > 20 && isOnlyQIE11(id) && linearQIE11LUT[i] >= (TPGMAX - 2) / 2.) {
88  outputLUT_[index][i] = TPGMAX - 1;
89  }
90  } else {
91  outputLUT_[index][i] = analyticalLUT[i];
92  }
93  } else {
94  for (unsigned int i = threshold; i < lutsize; ++i)
95  outputLUT_[index][i] = version == 1 ? linearNctLUT[i] : linearRctLUT[i];
96  }
97 
98  double eta_low = 0., eta_high = 0.;
99  theTrigTowerGeometry.towerEtaBounds(ieta, version, eta_low, eta_high);
100  double cosh_ieta = fabs(cosh((eta_low + eta_high) / 2.));
101  double granularity = meta->getLutGranularity();
102 
103  if (isHBHE) {
104  if (allLinear_) {
105  LUT tpg = outputLUT_[index][0];
106  hcaluncomp_[index][tpg] = 0;
107  for (unsigned int i = 0; i < lutsize; ++i) {
108  if (outputLUT_[index][i] != tpg) {
109  tpg = outputLUT_[index][i];
111  //Modifying the saturation for the 'split cells'
112  if (abs(ieta) > 20 && isOnlyQIE11(id) && linearQIE11LUT[i] >= (TPGMAX - 2) / 2.) {
113  hcaluncomp_[index][tpg] = (TPGMAX - 1) / 2.;
114  }
115  }
116  }
117  } else {
118  double factor = nominal_gain_ / cosh_ieta * granularity;
119  LUT tpg = outputLUT_[index][0];
120  int low = 0;
121  for (unsigned int i = 0; i < lutsize; ++i) {
122  if (outputLUT_[index][i] != tpg) {
123  unsigned int mid = (low + i) / 2;
124  hcaluncomp_[index][tpg] = (tpg == 0 ? low : factor * mid);
125  low = i;
126  tpg = outputLUT_[index][i];
127  }
128  }
129  hcaluncomp_[index][tpg] = factor * low;
130  }
131  } else {
132  LUT tpg = outputLUT_[index][0];
133  hcaluncomp_[index][tpg] = 0;
134  for (unsigned int i = 0; i < lutsize; ++i) {
135  if (outputLUT_[index][i] != tpg) {
136  tpg = outputLUT_[index][i];
138  }
139  }
140  }
141  }
142 }
bool validHT(const HcalTrigTowerDetId &id) const
std::vector< RCTdecompression > hcaluncomp_
std::vector< std::vector< LUT > > outputLUT_
uint8_t getLutGranularity() const
uint8_t getOutputLutThreshold() const
bool isHcalDetId() const
const HcalTopology * theTopology
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned int OUTPUT_LUT_SIZE
bool isHcalCastorDetId() const
bool isHcalZDCDetId() const
static const unsigned int TPGMAX
unsigned int getOutputLUTSize(const HcalTrigTowerDetId &id) const
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:31
Log< level::Warning, false > LogWarning
bool isOnlyQIE11(const HcalTrigTowerDetId &id) const
bool isHcalTrigTowerDetId() const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const

◆ rctEGammaUncompress()

void CaloTPGTranscoderULUT::rctEGammaUncompress ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc,
const EcalTrigTowerDetId eid,
const EcalTriggerPrimitiveSample ec,
unsigned int &  et,
bool &  egVeto,
bool &  activity 
) const
overridevirtual

Uncompression for the Electron/Photon path in the RCT.

Implements CaloTPGTranscoder.

Definition at line 189 of file CaloTPGTranscoderULUT.cc.

References Exception.

195  {
196  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctEGammaUncompress";
197 }

◆ rctJetUncompress()

void CaloTPGTranscoderULUT::rctJetUncompress ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc,
const EcalTrigTowerDetId eid,
const EcalTriggerPrimitiveSample ec,
unsigned int &  et 
) const
overridevirtual

Uncompression for the JET path in the RCT.

Implements CaloTPGTranscoder.

Definition at line 198 of file CaloTPGTranscoderULUT.cc.

References Exception.

202  {
203  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctJetUncompress";
204 }

◆ setup()

void CaloTPGTranscoderULUT::setup ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry,
int  nctScaleShift,
int  rctScaleShift,
double  lsbQIE8,
double  lsbQIE11,
bool  allLinear 
)
virtual

Definition at line 297 of file CaloTPGTranscoderULUT.cc.

References allLinear_, compressionFile_, HcalTopology::dddConstants(), decompressionFile_, Exception, HcalCondObjectContainer< Item >::getAllChannels(), HcalTopology::getHTSize(), HcalLutMetadata::getNominalGain(), HcalLutMetadata::getRctLsb(), DetId::Hcal, hcaluncomp_, HcalDDDRecConstants::isPlan1(), lin11_factor_, lin8_factor_, loadHCALCompress(), HcaluLUTTPGCoder::lsb_, lsb_factor_, nct_factor_, nominal_gain_, outputLUT_, plan1_towers_, rct_factor_, theTopology, HcalCondObjectContainerBase::topo(), hgcalTowerProducer_cfi::tower, HcalTrigTowerGeometry::towerIds(), and HcalTopology::valid().

Referenced by o2olib.O2OTool::execute().

303  {
304  theTopology = lutMetadata.topo();
305  nominal_gain_ = lutMetadata.getNominalGain();
306  lsb_factor_ = lutMetadata.getRctLsb();
307 
308  allLinear_ = allLinear;
309 
310  rct_factor_ = lsb_factor_ / (HcaluLUTTPGCoder::lsb_ * (1 << rctScaleShift));
311  nct_factor_ = lsb_factor_ / (HcaluLUTTPGCoder::lsb_ * (1 << nctScaleShift));
312  lin8_factor_ = lsb_factor_ / lsbQIE8;
313  lin11_factor_ = lsb_factor_ / lsbQIE11;
314 
315  outputLUT_.resize(theTopology->getHTSize());
316  hcaluncomp_.resize(theTopology->getHTSize());
317 
318  plan1_towers_.clear();
319  for (const auto& id : lutMetadata.getAllChannels()) {
320  if (not(id.det() == DetId::Hcal and theTopology->valid(id)))
321  continue;
322  HcalDetId cell(id);
323  if (not theTopology->dddConstants()->isPlan1(cell))
324  continue;
325  for (const auto& tower : theTrigTowerGeometry.towerIds(cell))
326  plan1_towers_.emplace(tower);
327  }
328 
329  if (compressionFile_.empty() && decompressionFile_.empty()) {
330  loadHCALCompress(lutMetadata, theTrigTowerGeometry);
331  } else {
332  throw cms::Exception("Not Implemented") << "setup of CaloTPGTranscoderULUT from text files";
333  }
334 }
std::vector< RCTdecompression > hcaluncomp_
std::vector< std::vector< LUT > > outputLUT_
std::set< HcalDetId > plan1_towers_
bool valid(const DetId &id) const override
static const float lsb_
const std::string decompressionFile_
const HcalTopology * theTopology
unsigned int getHTSize() const
Definition: HcalTopology.h:136
void loadHCALCompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
const std::string compressionFile_
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:164
bool isPlan1(const HcalDetId &id) const

Member Data Documentation

◆ allLinear_

bool CaloTPGTranscoderULUT::allLinear_ = false
private

Definition at line 84 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ compressionFile_

const std::string CaloTPGTranscoderULUT::compressionFile_
private

Definition at line 91 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

◆ decompressionFile_

const std::string CaloTPGTranscoderULUT::decompressionFile_
private

Definition at line 92 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

◆ hcaluncomp_

std::vector<RCTdecompression> CaloTPGTranscoderULUT::hcaluncomp_
private

Definition at line 99 of file CaloTPGTranscoderULUT.h.

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

◆ ietah

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

Definition at line 94 of file CaloTPGTranscoderULUT.h.

◆ ietal

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

Definition at line 93 of file CaloTPGTranscoderULUT.h.

◆ lin11_factor_

double CaloTPGTranscoderULUT::lin11_factor_
private

Definition at line 90 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ lin8_factor_

double CaloTPGTranscoderULUT::lin8_factor_
private

Definition at line 89 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ lsb_factor_

double CaloTPGTranscoderULUT::lsb_factor_
private

Definition at line 86 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ LUTfactor

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

Definition at line 96 of file CaloTPGTranscoderULUT.h.

◆ nct_factor_

double CaloTPGTranscoderULUT::nct_factor_
private

Definition at line 88 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ newHFphi

const bool CaloTPGTranscoderULUT::newHFphi = true
staticprivate

Definition at line 76 of file CaloTPGTranscoderULUT.h.

◆ nominal_gain_

double CaloTPGTranscoderULUT::nominal_gain_
private

Definition at line 85 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ NOUTLUTS

const int CaloTPGTranscoderULUT::NOUTLUTS = 4176
staticprivate

Definition at line 57 of file CaloTPGTranscoderULUT.h.

◆ OUTPUT_LUT_SIZE

const unsigned int CaloTPGTranscoderULUT::OUTPUT_LUT_SIZE
staticprivate

◆ outputLUT_

std::vector<std::vector<LUT> > CaloTPGTranscoderULUT::outputLUT_
private

Definition at line 98 of file CaloTPGTranscoderULUT.h.

Referenced by getCompressionLUT(), hcalCompress(), loadHCALCompress(), and setup().

◆ plan1_towers_

std::set<HcalDetId> CaloTPGTranscoderULUT::plan1_towers_
private

Definition at line 101 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize(), isOnlyQIE11(), and setup().

◆ QIE10_OUTPUT_LUT_SIZE

const unsigned int CaloTPGTranscoderULUT::QIE10_OUTPUT_LUT_SIZE = REDUCE11BIT
staticprivate

Definition at line 65 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

◆ QIE11_OUTPUT_LUT_SIZE

const unsigned int CaloTPGTranscoderULUT::QIE11_OUTPUT_LUT_SIZE = REDUCE11BIT
staticprivate

Definition at line 66 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

◆ QIE8_OUTPUT_LUT_SIZE

const unsigned int CaloTPGTranscoderULUT::QIE8_OUTPUT_LUT_SIZE = REDUCE10BIT
staticprivate

Definition at line 64 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

◆ rct_factor_

double CaloTPGTranscoderULUT::rct_factor_
private

Definition at line 87 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

◆ REDUCE10BIT

const unsigned int CaloTPGTranscoderULUT::REDUCE10BIT = 1024
staticprivate

Definition at line 60 of file CaloTPGTranscoderULUT.h.

◆ REDUCE11BIT

const unsigned int CaloTPGTranscoderULUT::REDUCE11BIT = 2048
staticprivate

Definition at line 61 of file CaloTPGTranscoderULUT.h.

◆ theTopology

const HcalTopology* CaloTPGTranscoderULUT::theTopology
private

◆ TPGMAX

const unsigned int CaloTPGTranscoderULUT::TPGMAX = 256
staticprivate

Definition at line 69 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and loadHCALCompress().

◆ ZS

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

Definition at line 95 of file CaloTPGTranscoderULUT.h.