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 ()
 
boost::shared_ptr< const EcalTPGCompressorgetEcalCompressor () const
 
boost::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 = std::max({QIE8_OUTPUT_LUT_SIZE, QIE10_OUTPUT_LUT_SIZE, QIE11_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 19 of file CaloTPGTranscoderULUT.h.

Member Typedef Documentation

typedef uint8_t CaloTPGTranscoderULUT::LUT
private

Definition at line 59 of file CaloTPGTranscoderULUT.h.

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

Definition at line 60 of file CaloTPGTranscoderULUT.h.

Constructor & Destructor Documentation

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

Definition at line 19 of file CaloTPGTranscoderULUT.cc.

21  : theTopology(nullptr),
23  lin8_factor_(1.), lin11_factor_(1.),
24  compressionFile_(compressionFile),
25  decompressionFile_(decompressionFile)
26 {
27 }
const std::string decompressionFile_
const HcalTopology * theTopology
const std::string compressionFile_
CaloTPGTranscoderULUT::~CaloTPGTranscoderULUT ( )
override

Definition at line 29 of file CaloTPGTranscoderULUT.cc.

29  {
30 }

Member Function Documentation

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 172 of file CaloTPGTranscoderULUT.cc.

References Exception.

172  {
173  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::ecalCompress";
174 }
const std::vector< unsigned int > CaloTPGTranscoderULUT::getCompressionLUT ( const HcalTrigTowerDetId id) const
virtual

Definition at line 280 of file CaloTPGTranscoderULUT.cc.

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

Referenced by HcalLutManager::getCompressionLutXmlFromCoder().

280  {
281  int itower = getOutputLUTId(id);
282  auto lut = outputLUT_[itower];
283  std::vector<unsigned int> result(lut.begin(), lut.end());
284  return result;
285 }
std::vector< std::vector< LUT > > outputLUT_
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
int CaloTPGTranscoderULUT::getOutputLUTId ( const HcalTrigTowerDetId id) const
virtual

Definition at line 196 of file CaloTPGTranscoderULUT.cc.

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

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

196  {
197  if (!theTopology) {
198  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
199  }
200  return theTopology->detId2denseIdHT(id);
201 }
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
const HcalTopology * theTopology
int CaloTPGTranscoderULUT::getOutputLUTId ( const int  ieta,
const int  iphi,
const int  version 
) const
virtual

Definition at line 203 of file CaloTPGTranscoderULUT.cc.

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

203  {
204  if (!theTopology) {
205  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
206  }
207  HcalTrigTowerDetId id(ieta, iphiin);
208  id.setVersion(version);
209  return theTopology->detId2denseIdHT(id);
210 }
unsigned int detId2denseIdHT(const DetId &id) const
return a linear packed id from HT
const HcalTopology * theTopology
unsigned int CaloTPGTranscoderULUT::getOutputLUTSize ( const HcalTrigTowerDetId id) const
private

Definition at line 213 of file CaloTPGTranscoderULUT.cc.

References Exception, 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_2019.

Referenced by hcalCompress(), and loadHCALCompress().

214 {
215  if (!theTopology)
216  throw cms::Exception("CaloTPGTranscoderULUT")
217  << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
218 
219  switch (theTopology->triggerMode()) {
222  return QIE8_OUTPUT_LUT_SIZE;
224  if (id.ietaAbs() <= theTopology->lastHERing())
225  return QIE8_OUTPUT_LUT_SIZE;
226  else
227  return QIE10_OUTPUT_LUT_SIZE;
229  if (plan1_towers_.find(id) != plan1_towers_.end())
230  return QIE11_OUTPUT_LUT_SIZE;
231  else if (id.ietaAbs() <= theTopology->lastHERing())
232  return QIE8_OUTPUT_LUT_SIZE;
233  else
234  return QIE10_OUTPUT_LUT_SIZE;
237  if (id.ietaAbs() <= theTopology->lastHBRing())
238  return QIE8_OUTPUT_LUT_SIZE;
239  else if (id.ietaAbs() <= theTopology->lastHERing())
240  return QIE11_OUTPUT_LUT_SIZE;
241  else
242  return QIE10_OUTPUT_LUT_SIZE;
244  if (id.ietaAbs() <= theTopology->lastHERing())
245  return QIE11_OUTPUT_LUT_SIZE;
246  else
247  return QIE10_OUTPUT_LUT_SIZE;
248  default:
249  throw cms::Exception("CaloTPGTranscoderULUT")
250  << "Unknown trigger mode used by the topology!";
251  }
252 }
std::set< HcalDetId > plan1_towers_
static const unsigned int QIE8_OUTPUT_LUT_SIZE
int lastHBRing() const
Definition: HcalTopology.h:88
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
const HcalTopology * theTopology
static const unsigned int QIE10_OUTPUT_LUT_SIZE
static const unsigned int QIE11_OUTPUT_LUT_SIZE
int lastHERing() const
Definition: HcalTopology.h:90
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 139 of file CaloTPGTranscoderULUT.cc.

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

139  {
140  unsigned int itower = getOutputLUTId(id);
141 
142  if (sample >= getOutputLUTSize(id))
143  throw cms::Exception("Out of Range")
144  << "LUT has " << getOutputLUTSize(id) << " entries for " << id << " but " << sample << " was requested.";
145 
146  if(itower >= outputLUT_.size())
147  throw cms::Exception("Out of Range") << "No decompression LUT found for " << id;
148 
149  return HcalTriggerPrimitiveSample(outputLUT_[itower][sample], fineGrain);
150 }
std::vector< std::vector< LUT > > outputLUT_
unsigned int getOutputLUTSize(const HcalTrigTowerDetId &id) const
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
double CaloTPGTranscoderULUT::hcaletValue ( const int &  ieta,
const int &  iphi,
const int &  version,
const int &  compressedValue 
) const
overridevirtual

Implements CaloTPGTranscoder.

Definition at line 152 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), hcaluncomp_, and TPGMAX.

152  {
153  double etvalue = 0.;
154  int itower = getOutputLUTId(ieta,iphi, version);
155  if (itower < 0) {
156  edm::LogError("CaloTPGTranscoderULUT") << "No decompression LUT found for ieta, iphi = " << ieta << ", " << iphi;
157  } else if (compET < 0 || compET >= (int) TPGMAX) {
158  edm::LogError("CaloTPGTranscoderULUT") << "Compressed value out of range: eta, phi, cET = " << ieta << ", " << iphi << ", " << compET;
159  } else {
160  etvalue = hcaluncomp_[itower][compET];
161  }
162  return(etvalue);
163 }
std::vector< RCTdecompression > hcaluncomp_
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
static const unsigned int TPGMAX
double CaloTPGTranscoderULUT::hcaletValue ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc 
) const
overridevirtual

Implements CaloTPGTranscoder.

Definition at line 165 of file CaloTPGTranscoderULUT.cc.

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

165  {
166  int compET = hc.compressedEt(); // to be within the range by the class
167  int itower = getOutputLUTId(hid);
168  double etvalue = hcaluncomp_[itower][compET];
169  return etvalue;
170 }
std::vector< RCTdecompression > hcaluncomp_
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
int compressedEt() const
get the encoded/compressed Et
bool CaloTPGTranscoderULUT::HTvalid ( const int  ieta,
const int  iphi,
const int  version 
) const
virtual

Definition at line 187 of file CaloTPGTranscoderULUT.cc.

References Exception, triggerObjects_cff::id, theTopology, and HcalTopology::validHT().

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

187  {
188  HcalTrigTowerDetId id(ieta, iphiin);
189  id.setVersion(version);
190  if (!theTopology) {
191  throw cms::Exception("CaloTPGTranscoderULUT") << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
192  }
193  return theTopology->validHT(id);
194 }
const HcalTopology * theTopology
bool validHT(const HcalTrigTowerDetId &id) const
bool CaloTPGTranscoderULUT::isOnlyQIE11 ( const HcalTrigTowerDetId id) const
private

Definition at line 255 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_2019.

Referenced by loadHCALCompress().

256 {
257  if (!theTopology)
258  throw cms::Exception("CaloTPGTranscoderULUT")
259  << "Topology not set! Use CaloTPGTranscoderULUT::setup(...) first!";
260 
261  switch (theTopology->triggerMode()) {
263  if (plan1_towers_.find(id) != plan1_towers_.end() and id.ietaAbs() != theTopology->lastHBRing())
264  return true;
265  return false;
268  if (id.ietaAbs() <= theTopology->lastHBRing())
269  return false;
270  return true;
272  return true;
273  default:
274  throw cms::Exception("CaloTPGTranscoderULUT")
275  << "Unknown trigger mode used by the topology!";
276  }
277 }
std::set< HcalDetId > plan1_towers_
int lastHBRing() const
Definition: HcalTopology.h:88
HcalTopologyMode::TriggerMode triggerMode() const
Definition: HcalTopology.h:32
const HcalTopology * theTopology
void CaloTPGTranscoderULUT::loadHCALCompress ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry 
)
private

Definition at line 32 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), allLinear_, Exception, HcalTrigTowerGeometry::firstHFTower(), HcalCondObjectContainer< Item >::getAllChannels(), HcalLutMetadatum::getLutGranularity(), getOutputLUTId(), getOutputLUTSize(), HcalLutMetadatum::getOutputLutThreshold(), HcalCondObjectContainer< Item >::getValues(), hcaluncomp_, mps_fire::i, triggerObjects_cff::id, HcalGenericDetId::isHcalCastorDetId(), HcalGenericDetId::isHcalDetId(), HcalGenericDetId::isHcalTrigTowerDetId(), HcalGenericDetId::isHcalZDCDetId(), isOnlyQIE11(), lin11_factor_, lin8_factor_, cmsBatch::log, lsb_factor_, min(), nct_factor_, nominal_gain_, OUTPUT_LUT_SIZE, outputLUT_, rct_factor_, mathSSE::sqrt(), theTopology, electronIdCutBased_cfi::threshold, HcalTrigTowerGeometry::towerEtaBounds(), TPGMAX, HcalTopology::validHT(), and jets_cff::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 
57  if (not HcalGenericDetId(*i).isHcalTrigTowerDetId()) {
58  if ((not HcalGenericDetId(*i).isHcalDetId()) and
59  (not HcalGenericDetId(*i).isHcalZDCDetId()) and
61  edm::LogWarning("CaloTPGTranscoderULUT") << "Encountered invalid HcalDetId " << HcalGenericDetId(*i);
62  continue;
63  }
64 
66  if(!theTopology->validHT(id)) continue;
67 
68  unsigned int index = getOutputLUTId(id);
69 
70  const HcalLutMetadatum *meta = lutMetadata.getValues(id);
71  unsigned int threshold = meta->getOutputLutThreshold();
72 
73  int ieta=id.ieta();
74  int version=id.version();
75  bool isHBHE = (abs(ieta) < theTrigTowerGeometry.firstHFTower(version));
76 
77  unsigned int lutsize = getOutputLUTSize(id);
78  outputLUT_[index].resize(lutsize);
79 
80  for (unsigned int i = 0; i < threshold; ++i)
81  outputLUT_[index][i] = 0;
82 
83  if (isHBHE) {
84  for (unsigned int i = threshold; i < lutsize; ++i)
85  if (allLinear_) {
86  outputLUT_[index][i] = isOnlyQIE11(id) ? linearQIE11LUT[i] : linearQIE8LUT[i];
87  } else {
88  outputLUT_[index][i] = analyticalLUT[i];
89  }
90  } else {
91  for (unsigned int i = threshold; i < lutsize; ++i)
92  outputLUT_[index][i] = version == 0 ? linearRctLUT[i] : linearNctLUT[i];
93  }
94 
95  double eta_low = 0., eta_high = 0.;
96  theTrigTowerGeometry.towerEtaBounds(ieta,version,eta_low,eta_high);
97  double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
98  double granularity = meta->getLutGranularity();
99 
100  if(isHBHE){
101  if (allLinear_) {
102  LUT tpg = outputLUT_[index][0];
103  hcaluncomp_[index][tpg] = 0;
104  for (unsigned int i = 0; i < lutsize; ++i){
105  if (outputLUT_[index][i] != tpg){
106  tpg = outputLUT_[index][i];
108  }
109  }
110  } else {
111  double factor = nominal_gain_ / cosh_ieta * granularity;
112  LUT tpg = outputLUT_[index][0];
113  int low = 0;
114  for (unsigned int i = 0; i < lutsize; ++i){
115  if (outputLUT_[index][i] != tpg){
116  unsigned int mid = (low + i)/2;
117  hcaluncomp_[index][tpg] = (tpg == 0 ? low : factor * mid);
118  low = i;
119  tpg = outputLUT_[index][i];
120  }
121  }
122  hcaluncomp_[index][tpg] = factor * low;
123  }
124  }
125  else{
126  LUT tpg = outputLUT_[index][0];
127  hcaluncomp_[index][tpg]=0;
128  for (unsigned int i = 0; i < lutsize; ++i){
129  if (outputLUT_[index][i] != tpg){
130  tpg = outputLUT_[index][i];
131  hcaluncomp_[index][tpg] = lsb_factor_ * i / (version==0?rct_factor_:nct_factor_);
132  }
133  }
134  }
135  }
136 
137 }
std::vector< RCTdecompression > hcaluncomp_
bool isHcalZDCDetId() const
std::vector< std::vector< LUT > > outputLUT_
uint8_t getOutputLutThreshold() const
unsigned int getOutputLUTSize(const HcalTrigTowerDetId &id) const
uint8_t getLutGranularity() const
bool isOnlyQIE11(const HcalTrigTowerDetId &id) const
bool isHcalTrigTowerDetId() const
const HcalTopology * theTopology
T sqrt(T t)
Definition: SSEVec.h:18
virtual int getOutputLUTId(const HcalTrigTowerDetId &id) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned int OUTPUT_LUT_SIZE
T min(T a, T b)
Definition: MathUtil.h:58
bool isHcalDetId() const
static const unsigned int TPGMAX
bool isHcalCastorDetId() const
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
bool validHT(const HcalTrigTowerDetId &id) const
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 176 of file CaloTPGTranscoderULUT.cc.

References Exception.

178  {
179  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctEGammaUncompress";
180 }
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 181 of file CaloTPGTranscoderULUT.cc.

References Exception.

183  {
184  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctJetUncompress";
185 }
void CaloTPGTranscoderULUT::setup ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry,
int  nctScaleShift,
int  rctScaleShift,
double  lsbQIE8,
double  lsbQIE11,
bool  allLinear 
)
virtual

Definition at line 287 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(), HcalTrigTowerGeometry::towerIds(), and HcalTopology::valid().

Referenced by o2olib.O2OTool::execute().

288 {
289  theTopology = lutMetadata.topo();
290  nominal_gain_ = lutMetadata.getNominalGain();
291  lsb_factor_ = lutMetadata.getRctLsb();
292 
293  allLinear_ = allLinear;
294 
295  rct_factor_ = lsb_factor_/(HcaluLUTTPGCoder::lsb_*(1<<rctScaleShift));
296  nct_factor_ = lsb_factor_/(HcaluLUTTPGCoder::lsb_*(1<<nctScaleShift));
297  lin8_factor_ = lsb_factor_/lsbQIE8;
298  lin11_factor_ = lsb_factor_/lsbQIE11;
299 
300  outputLUT_.resize(theTopology->getHTSize());
301  hcaluncomp_.resize(theTopology->getHTSize());
302 
303  plan1_towers_.clear();
304  for (const auto& id: lutMetadata.getAllChannels()) {
305  if (not (id.det() == DetId::Hcal and theTopology->valid(id)))
306  continue;
307  HcalDetId cell(id);
308  if (not theTopology->dddConstants()->isPlan1(cell))
309  continue;
310  for (const auto& tower: theTrigTowerGeometry.towerIds(cell))
311  plan1_towers_.emplace(tower);
312  }
313 
314  if (compressionFile_.empty() && decompressionFile_.empty()) {
315  loadHCALCompress(lutMetadata,theTrigTowerGeometry);
316  }
317  else {
318  throw cms::Exception("Not Implemented") << "setup of CaloTPGTranscoderULUT from text files";
319  }
320 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
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:142
void loadHCALCompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
const std::string compressionFile_
bool isPlan1(const HcalDetId &id) const

Member Data Documentation

bool CaloTPGTranscoderULUT::allLinear_ = false
private

Definition at line 71 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

const std::string CaloTPGTranscoderULUT::compressionFile_
private

Definition at line 78 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

const std::string CaloTPGTranscoderULUT::decompressionFile_
private

Definition at line 79 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

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

Definition at line 86 of file CaloTPGTranscoderULUT.h.

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

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

Definition at line 81 of file CaloTPGTranscoderULUT.h.

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

Definition at line 80 of file CaloTPGTranscoderULUT.h.

double CaloTPGTranscoderULUT::lin11_factor_
private

Definition at line 77 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

double CaloTPGTranscoderULUT::lin8_factor_
private

Definition at line 76 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

double CaloTPGTranscoderULUT::lsb_factor_
private

Definition at line 73 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

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

Definition at line 83 of file CaloTPGTranscoderULUT.h.

double CaloTPGTranscoderULUT::nct_factor_
private

Definition at line 75 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

const bool CaloTPGTranscoderULUT::newHFphi = true
staticprivate

Definition at line 63 of file CaloTPGTranscoderULUT.h.

double CaloTPGTranscoderULUT::nominal_gain_
private

Definition at line 72 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

const int CaloTPGTranscoderULUT::NOUTLUTS = 4176
staticprivate

Definition at line 45 of file CaloTPGTranscoderULUT.h.

const unsigned int CaloTPGTranscoderULUT::OUTPUT_LUT_SIZE = std::max({QIE8_OUTPUT_LUT_SIZE, QIE10_OUTPUT_LUT_SIZE, QIE11_OUTPUT_LUT_SIZE})
staticprivate

Definition at line 55 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress().

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

Definition at line 85 of file CaloTPGTranscoderULUT.h.

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

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

Definition at line 88 of file CaloTPGTranscoderULUT.h.

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

const unsigned int CaloTPGTranscoderULUT::QIE10_OUTPUT_LUT_SIZE = REDUCE11BIT
staticprivate

Definition at line 53 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

const unsigned int CaloTPGTranscoderULUT::QIE11_OUTPUT_LUT_SIZE = REDUCE11BIT
staticprivate

Definition at line 54 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

const unsigned int CaloTPGTranscoderULUT::QIE8_OUTPUT_LUT_SIZE = REDUCE10BIT
staticprivate

Definition at line 52 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTSize().

double CaloTPGTranscoderULUT::rct_factor_
private

Definition at line 74 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALCompress(), and setup().

const unsigned int CaloTPGTranscoderULUT::REDUCE10BIT = 1024
staticprivate

Definition at line 48 of file CaloTPGTranscoderULUT.h.

const unsigned int CaloTPGTranscoderULUT::REDUCE11BIT = 2048
staticprivate

Definition at line 49 of file CaloTPGTranscoderULUT.h.

const HcalTopology* CaloTPGTranscoderULUT::theTopology
private
const unsigned int CaloTPGTranscoderULUT::TPGMAX = 256
staticprivate

Definition at line 56 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and loadHCALCompress().

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

Definition at line 82 of file CaloTPGTranscoderULUT.h.