CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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="")
 
virtual EcalTriggerPrimitiveSample ecalCompress (const EcalTrigTowerDetId &id, unsigned int sample, bool fineGrain) const
 Compression from linear samples+fine grain in the ECAL. More...
 
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. More...
 
virtual double hcaletValue (const int &ieta, const int &compressedValue) const
 
virtual double hcaletValue (const int &ieta, const int &iphi, const int &compressedValue) const
 
virtual double hcaletValue (const HcalTrigTowerDetId &hid, const HcalTriggerPrimitiveSample &hc) 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. More...
 
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. More...
 
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. More...
 
virtual ~CaloTPGTranscoderULUT ()
 
- Public Member Functions inherited from CaloTPGTranscoder
 CaloTPGTranscoder ()
 
boost::shared_ptr
< EcalTPGCompressor
getEcalCompressor () const
 
boost::shared_ptr
< HcalTPGCompressor
getHcalCompressor () const
 
virtual void releaseSetup () const
 Release any objects obtained from the EventSetup. More...
 
virtual ~CaloTPGTranscoder ()
 

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_
 
edm::ESHandle
< HcalTrigTowerGeometry
theTrigTowerGeometry
 
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
 

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 unsigned int CaloTPGTranscoderULUT::LUT
private

Definition at line 44 of file CaloTPGTranscoderULUT.h.

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

Definition at line 45 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_.

19  : isLoaded_(false), nominal_gain_(0.), rctlsb_factor_(0.),
20  compressionFile_(compressionFile),
21  decompressionFile_(decompressionFile)
22 {
23  for (int i = 0; i < NOUTLUTS; i++) outputLUT_[i] = 0;
24 }
int i
Definition: DBlmapReader.cc:9
CaloTPGTranscoderULUT::~CaloTPGTranscoderULUT ( )
virtual

Definition at line 26 of file CaloTPGTranscoderULUT.cc.

References i, NOUTLUTS, and outputLUT_.

26  {
27  for (int i = 0; i < NOUTLUTS; i++) {
28  if (outputLUT_[i] != 0) delete [] outputLUT_[i];
29  }
30 }
int i
Definition: DBlmapReader.cc:9

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 edm::hlt::Exception.

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

Definition at line 357 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), i, lumiPlot::lut, OUTPUT_LUT_SIZE, and outputLUT_.

Referenced by HcalLutManager::getCompressionLutXmlFromCoder().

357  {
358  std::vector<unsigned char> lut;
359  int itower = getOutputLUTId(id.ieta(),id.iphi());
360  if (itower >= 0) {
361  lut.resize(OUTPUT_LUT_SIZE);
362  for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; i++) lut[i]=outputLUT_[itower][i];
363  }
364  return lut;
365 }
int i
Definition: DBlmapReader.cc:9
static const unsigned int OUTPUT_LUT_SIZE
tuple lut
Definition: lumiPlot.py:244
virtual int getOutputLUTId(const int ieta, const int iphi) const
int CaloTPGTranscoderULUT::getOutputLUTId ( const int  ieta,
const int  iphi 
) const
virtual

Definition at line 343 of file CaloTPGTranscoderULUT.cc.

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

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

343  {
344  int iphi = iphiin;
345  if (HTvalid(ieta, iphi)) {
346  int offset = 0, ietaabs;
347  ietaabs = abs(ieta);
348  if (ieta < 0) offset = NOUTLUTS/2;
349  if (ietaabs < 29) return 72*(ietaabs - 1) + (iphi - 1) + offset;
350  else {
351  if (newHFphi) iphi = iphi/4 + 1;
352  return 18*(ietaabs - 29) + iphi + 2015 + offset;
353  }
354  } else return -1;
355 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int offset(bool)
virtual bool HTvalid(const int ieta, const int iphi) const
static const bool newHFphi
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 edm::hlt::Exception, getOutputLUTId(), OUTPUT_LUT_SIZE, and outputLUT_.

249  {
250  int ieta = id.ieta();
251  int iphi = id.iphi();
252 // if (abs(ieta) > 28) iphi = iphi/4 + 1; // Changing iphi index from 1, 5, ..., 69 to 1, 2, ..., 18
253  int itower = getOutputLUTId(ieta,iphi);
254 
255  if (itower < 0) cms::Exception("Invalid Data") << "No trigger tower found for ieta, iphi = " << ieta << ", " << iphi;
256  if (sample >= OUTPUT_LUT_SIZE) {
257 
258  throw cms::Exception("Out of Range") << "LUT has 1024 entries for " << itower << " but " << sample << " was requested.";
259  sample=OUTPUT_LUT_SIZE - 1;
260  }
261 
262  return HcalTriggerPrimitiveSample(outputLUT_[itower][sample],fineGrain,0,0);
263 }
static const unsigned int OUTPUT_LUT_SIZE
virtual int getOutputLUTId(const int ieta, const int iphi) const
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().

278  {
279 // This is now an obsolete method; we return the AVERAGE over all the allowed iphi channels if it's invoked
280 // The user is encouraged to use hcaletValue(const int& ieta, const int& iphi, const int& compET) instead
281 
282  if (hcaluncomp_.empty()) {
283  std::cout << "Initializing the RCT decompression table from the file: " << decompressionFile_ << std::endl;
285  }
286 
287  double etvalue = 0.;
288  if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, cET = " << ieta << ", " << compET << std::endl;
289  else {
290  int nphi = 0;
291  for (int iphi=1; iphi <= 72; iphi++) {
292  if (HTvalid(ieta,iphi)) {
293  nphi++;
294  int itower = getOutputLUTId(ieta,iphi);
295  etvalue += hcaluncomp_[itower][compET];
296  }
297  }
298  if (nphi > 0) etvalue /= nphi;
299  else std::cout << "hcaletValue error: no decompression LUTs found for any iphi for ieta = " << ieta << std::endl;
300  }
301  return(etvalue);
302 }
std::vector< RCTdecompression > hcaluncomp_
virtual bool HTvalid(const int ieta, const int iphi) const
virtual int getOutputLUTId(const int ieta, const int iphi) const
tuple cout
Definition: gather_cfg.py:121
void loadHCALUncompress(void) const
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().

265  {
266  if (hcaluncomp_.empty()) {
267 
269  }
270  double etvalue = 0.;
271  int itower = getOutputLUTId(ieta,iphi);
272  if (itower < 0) std::cout << "hcaletValue error: no decompression LUT found for ieta, iphi = " << ieta << ", " << iphi << std::endl;
273  else if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, phi, cET = " << ieta << ", " << iphi << ", " << compET << std::endl;
274  else etvalue = hcaluncomp_[itower][compET];
275  return(etvalue);
276 }
std::vector< RCTdecompression > hcaluncomp_
virtual int getOutputLUTId(const int ieta, const int iphi) const
tuple cout
Definition: gather_cfg.py:121
void loadHCALUncompress(void) const
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().

304  {
306 
307  int ieta = hid.ieta(); // No need to check the validity,
308  int iphi = hid.iphi(); // as the values are guaranteed
309  int compET = hc.compressedEt(); // to be within the range by the class
310  int itower = getOutputLUTId(ieta,iphi);
311  double etvalue = hcaluncomp_[itower][compET];
312  return(etvalue);
313 }
std::vector< RCTdecompression > hcaluncomp_
int ieta() const
get the tower ieta
virtual int getOutputLUTId(const int ieta, const int iphi) const
int compressedEt() const
get the encoded/compressed Et
void loadHCALUncompress(void) const
int iphi() const
get the tower iphi
bool CaloTPGTranscoderULUT::HTvalid ( const int  ieta,
const int  iphi 
) const
virtual

Definition at line 330 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), and newHFphi.

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

330  {
331  int iphi = iphiin;
332  if (iphi <= 0 || iphi > 72 || ieta == 0 || abs(ieta) > 32) return false;
333  if (abs(ieta) > 28) {
334  if (newHFphi) {
335  if ((iphi/4)*4 + 1 != iphi) return false;
336  iphi = iphi/4 + 1;
337  }
338  if (iphi > 18) return false;
339  }
340  return true;
341 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const bool newHFphi
void CaloTPGTranscoderULUT::loadHCALCompress ( void  ) const
private

Definition at line 32 of file CaloTPGTranscoderULUT.cc.

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

Referenced by loadHCALCompress(), and setup().

32  {
33 // Initialize analytical compression LUT's here
34  // TODO cms::Error log
35  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;
36 
37  std::vector<unsigned int> analyticalLUT(OUTPUT_LUT_SIZE, 0);
38  std::vector<unsigned int> identityLUT(OUTPUT_LUT_SIZE, 0);
39 
40  // Compute compression LUT
41  for (unsigned int i=0; i < OUTPUT_LUT_SIZE; i++) {
42  analyticalLUT[i] = (unsigned int)(sqrt(14.94*log(1.+i/14.94)*i) + 0.5);
43  identityLUT[i] = min(i,0xffu);
44  }
45 
46  for (int ieta=-32; ieta <= 32; ieta++){
47  for (int iphi = 1; iphi <= 72; iphi++){
48  if (!HTvalid(ieta,iphi)) continue;
49  int lutId = getOutputLUTId(ieta,iphi);
50  // TODO cms::Error log
51  if (outputLUT_[lutId] != 0){
52  std::cout << "Error: LUT with (ieta,iphi) = (" << ieta << "," << iphi << ") has been previously allocated!" << std::endl;
53  continue;
54  }
55 
56  outputLUT_[lutId] = new LUT[OUTPUT_LUT_SIZE];
57 
58  HcalTrigTowerDetId id(ieta, iphi);
59  const HcalLutMetadatum *meta = lutMetadata_->getValues(id);
60  int threshold = meta->getOutputLutThreshold();
61 
62  for (int i = 0; i < threshold; ++i)
63  outputLUT_[lutId][i] = 0;
64 
65  for (unsigned int i = threshold; i < OUTPUT_LUT_SIZE; ++i)
66  outputLUT_[lutId][i] = (abs(ieta) < theTrigTowerGeometry->firstHFTower()) ? analyticalLUT[i] : identityLUT[i];
67  } //for iphi
68  } //for ieta
69 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< HcalLutMetadata > lutMetadata_
uint8_t getOutputLutThreshold() const
edm::ESHandle< HcalTrigTowerGeometry > theTrigTowerGeometry
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned int OUTPUT_LUT_SIZE
virtual bool HTvalid(const int ieta, const int iphi) const
virtual int getOutputLUTId(const int ieta, const int iphi) const
tuple cout
Definition: gather_cfg.py:121
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
void CaloTPGTranscoderULUT::loadHCALCompress ( const std::string &  filename) const
private

Definition at line 71 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, edm::hlt::Exception, getOutputLUTId(), HTvalid(), i, getHLTprescales::index, j, loadHCALCompress(), NOUTLUTS, OUTPUT_LUT_SIZE, outputLUT_, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

71  {
72  int tool;
73  std::ifstream userfile;
74  std::vector< std::vector<LUT> > outputluts;
75 
76  std::cout << "Initializing compression LUT's from " << (char *)filename.data() << std::endl;
77  for (int i = 0; i < NOUTLUTS; i++) outputLUT_[i] = 0;
78  int maxid = 0, minid = 0x7FFFFFFF, rawid = 0;
79  for (int ieta=-32; ieta <= 32; ieta++) {
80  for (int iphi = 1; iphi <= 72; iphi++) {
81  if (HTvalid(ieta,iphi)) {
82  rawid = getOutputLUTId(ieta, iphi);
83  if (outputLUT_[rawid] != 0) std::cout << "Error: LUT with (ieta,iphi) = (" << ieta << "," << iphi << ") has been previously allocated!" << std::endl;
84  else outputLUT_[rawid] = new LUT[OUTPUT_LUT_SIZE];
85  if (rawid < minid) minid = rawid;
86  if (rawid > maxid) maxid = rawid;
87  }
88  }
89  }
90 
91  userfile.open((char *)filename.data());
92 
93  if( userfile ) {
94  int nluts = 0;
95  std::string s;
96  std::vector<int> loieta,hiieta;
97  std::vector<int> loiphi,hiiphi;
98  getline(userfile,s);
99 
100  getline(userfile,s);
101 
102  unsigned int index = 0;
103  while (index < s.length()) {
104  while (isspace(s[index])) index++;
105  if (index < s.length()) nluts++;
106  while (!isspace(s[index])) index++;
107  }
108  for (unsigned int i=0; i<=s.length(); i++) userfile.unget(); //rewind last line
109  outputluts.resize(nluts);
110  for (int i=0; i<nluts; i++) outputluts[i].resize(OUTPUT_LUT_SIZE);
111 
112 
113  for (int i=0; i<nluts; i++) {
114  userfile >> tool;
115  loieta.push_back(tool);
116  }
117 
118  for (int i=0; i<nluts; i++) {
119  userfile >> tool;
120  hiieta.push_back(tool);
121  }
122 
123  for (int i=0; i<nluts; i++) {
124  userfile >> tool;
125  loiphi.push_back(tool);
126 
127  }
128 
129  for (int i=0; i<nluts; i++) {
130  userfile >> tool;
131  hiiphi.push_back(tool);
132 
133  }
134 
135  for (unsigned int j=0; j<OUTPUT_LUT_SIZE; j++) {
136  for(int i=0; i <nluts; i++) {
137  userfile >> tool;
138  if (tool < 0) {
139  std::cout << "Error: LUT can't have negative numbers; 0 used instead: " << i << ", " << j << " : = " << tool << std::endl;
140  tool = 0;
141  } else if (tool > 0xff) {
142  std::cout << "Error: LUT can't have >8-bit numbers; 0xff used instead: " << i << ", " << j << " : = " << tool << std::endl;
143  tool = 0xff;
144  }
145  outputluts[i][j] = tool;
146  if (userfile.eof()) std::cout << "Error: LUT file is truncated or has a wrong format: " << i << "," << j << std::endl;
147  }
148  }
149  userfile.close();
150 
151  HcalDetId cell;
152  int id, ntot = 0;
153  for (int i=0; i < nluts; i++) {
154  int nini = 0;
155  for (int iphi = loiphi[i]; iphi <= hiiphi[i]; iphi++) {
156  for (int ieta=loieta[i]; ieta <= hiieta[i]; ieta++) {
157  if (HTvalid(ieta,iphi)) {
158  id = getOutputLUTId(ieta,iphi);
159  if (outputLUT_[id] == 0) throw cms::Exception("PROBLEM: outputLUT_ has not been initialized for ieta, iphi, id = ") << ieta << ", " << iphi << ", " << id << std::endl;
160  for (int j = 0; j <= 0x3ff; j++) outputLUT_[id][j] = outputluts[i][j];
161  nini++;
162  ntot++;
163  }
164  }
165  }
166 
167  }
168 
169  } else {
170 
172  }
173 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
static const unsigned int OUTPUT_LUT_SIZE
virtual bool HTvalid(const int ieta, const int iphi) const
tuple filename
Definition: lut2db_cfg.py:20
virtual int getOutputLUTId(const int ieta, const int iphi) const
void loadHCALCompress(void) const
tuple cout
Definition: gather_cfg.py:121
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:32
void CaloTPGTranscoderULUT::loadHCALUncompress ( void  ) const
private

Definition at line 175 of file CaloTPGTranscoderULUT.cc.

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

Referenced by hcaletValue(), and loadHCALUncompress().

175  {
176  hcaluncomp_.clear();
177  for (int i = 0; i < NOUTLUTS; i++){
178  RCTdecompression decompressionTable(TPGMAX,0);
179  hcaluncomp_.push_back(decompressionTable);
180  }
181 
182  for (int ieta = -32; ieta <= 32; ++ieta){
183 
184  double eta_low = 0., eta_high = 0.;
185  theTrigTowerGeometry->towerEtaBounds(ieta,eta_low,eta_high);
186  double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.));
187 
188  for (int iphi = 1; iphi <= 72; iphi++) {
189  if (!HTvalid(ieta, iphi)) continue;
190 
191  int lutId = getOutputLUTId(ieta,iphi);
192  HcalTrigTowerDetId id(ieta, iphi);
193 
194  const HcalLutMetadatum *meta = lutMetadata_->getValues(id);
195  double factor = 0.;
196 
197  // HF
198  if (abs(ieta) >= theTrigTowerGeometry->firstHFTower())
199  factor = rctlsb_factor_;
200  // HBHE
201  else
202  factor = nominal_gain_ / cosh_ieta * meta->getLutGranularity();
203 
204  // tpg - compressed value
205  unsigned int tpg = outputLUT_[lutId][0];
206  int low = 0;
207  for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; ++i){
208  if (outputLUT_[lutId][i] != tpg){
209  unsigned int mid = (low + i)/2;
210  hcaluncomp_[lutId][tpg] = (tpg == 0 ? low : factor * mid);
211  low = i;
212  tpg = outputLUT_[lutId][i];
213  }
214  }
215  hcaluncomp_[lutId][tpg] = factor * low;
216  } // for phi
217  } // for ieta
218 }
int i
Definition: DBlmapReader.cc:9
std::vector< RCTdecompression > hcaluncomp_
edm::ESHandle< HcalLutMetadata > lutMetadata_
edm::ESHandle< HcalTrigTowerGeometry > theTrigTowerGeometry
uint8_t getLutGranularity() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const unsigned int OUTPUT_LUT_SIZE
virtual bool HTvalid(const int ieta, const int iphi) const
std::vector< double > RCTdecompression
virtual int getOutputLUTId(const int ieta, const int iphi) const
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.

220  {
221  std::ifstream userfile;
222  userfile.open(filename.c_str());
223 
224  hcaluncomp_.resize(NOUTLUTS);
225  for (int i = 0; i < NOUTLUTS; i++) hcaluncomp_[i].resize(TPGMAX);
226 
227  static const int etabound = 32;
228  if( userfile ) {
229  double et;
230  for (int i=0; i<TPGMAX; i++) {
231  for(int j = 1; j <=etabound; j++) {
232  userfile >> et;
233  for (int iphi = 1; iphi <= 72; iphi++) {
234  int itower = getOutputLUTId(j,iphi);
235  if (itower >= 0) hcaluncomp_[itower][i] = et;
236  itower = getOutputLUTId(-j,iphi);
237  if (itower >= 0) hcaluncomp_[itower][i] = et;
238  }
239  }
240  }
241  userfile.close();
242  }
243  else {
244 
246  }
247 }
int i
Definition: DBlmapReader.cc:9
std::vector< RCTdecompression > hcaluncomp_
int j
Definition: DBlmapReader.cc:9
tuple filename
Definition: lut2db_cfg.py:20
virtual int getOutputLUTId(const int ieta, const int iphi) const
void loadHCALUncompress(void) const
void CaloTPGTranscoderULUT::printDecompression ( ) const

Definition at line 390 of file CaloTPGTranscoderULUT.cc.

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

390  {
391  std::cout << "RCT Decompression table" << std::endl;
392  for (int i=0; i < 256; i++) {
393  for (int j=1; j <= theTrigTowerGeometry->nTowers(); j++)
394  std::cout << int(hcaletValue(j,i)*100. + 0.5)/100. << " ";
395  std::cout << std::endl;
396  for (int j=1; j <= theTrigTowerGeometry->nTowers(); j++)
397  if (hcaletValue(j,i) != hcaletValue(-j,i))
398  cout << "Error: decompression table for ieta = +/- " << j << " disagree! " << hcaletValue(-j,i) << ", " << hcaletValue(j,i) << endl;
399  }
400 }
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< HcalTrigTowerGeometry > theTrigTowerGeometry
int j
Definition: DBlmapReader.cc:9
virtual double hcaletValue(const int &ieta, const int &compressedValue) const
tuple cout
Definition: gather_cfg.py:121
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 edm::hlt::Exception.

321  {
322  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctEGammaUncompress";
323 }
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 edm::hlt::Exception.

326  {
327  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctJetUncompress";
328 }
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_, edm::hlt::Exception, edm::EventSetup::get(), isLoaded_, loadHCALCompress(), lutMetadata_, nominal_gain_, rctlsb_factor_, and theTrigTowerGeometry.

367  {
368  if (isLoaded_) return;
369  // TODO Try/except
372 
373  nominal_gain_ = lutMetadata_->getNominalGain();
374  float rctlsb =lutMetadata_->getRctLsb();
375  if (rctlsb != 0.25 && rctlsb != 0.5)
376  throw cms::Exception("RCTLSB") << " value=" << rctlsb << " (should be 0.25 or 0.5)" << std::endl;
377  rctlsb_factor_ = rctlsb;
378 
379  if (compressionFile_.empty() && decompressionFile_.empty()) {
381  }
382  else {
383  // TODO Message to discourage using txt.
384  std::cout << "From Text File:" << std::endl;
386  }
387  isLoaded_ = true;
388 }
edm::ESHandle< HcalLutMetadata > lutMetadata_
edm::ESHandle< HcalTrigTowerGeometry > theTrigTowerGeometry
const T & get() const
Definition: EventSetup.h:55
void loadHCALCompress(void) const
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::string CaloTPGTranscoderULUT::compressionFile_
private

Definition at line 66 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

std::string CaloTPGTranscoderULUT::decompressionFile_
private

Definition at line 67 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and setup().

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

Definition at line 74 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and loadHCALUncompress().

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

Definition at line 69 of file CaloTPGTranscoderULUT.h.

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

Definition at line 68 of file CaloTPGTranscoderULUT.h.

bool CaloTPGTranscoderULUT::isLoaded_
mutableprivate

Definition at line 63 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

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

Definition at line 71 of file CaloTPGTranscoderULUT.h.

edm::ESHandle<HcalLutMetadata> CaloTPGTranscoderULUT::lutMetadata_
mutableprivate

Definition at line 75 of file CaloTPGTranscoderULUT.h.

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

const bool CaloTPGTranscoderULUT::newHFphi = true
staticprivate

Definition at line 52 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTId(), and HTvalid().

double CaloTPGTranscoderULUT::nominal_gain_
mutableprivate

Definition at line 64 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress(), and setup().

const int CaloTPGTranscoderULUT::NOUTLUTS = 4176
staticprivate
const unsigned int CaloTPGTranscoderULUT::OUTPUT_LUT_SIZE = 1024
staticprivate
LUT* CaloTPGTranscoderULUT::outputLUT_[NOUTLUTS]
mutableprivate
double CaloTPGTranscoderULUT::rctlsb_factor_
mutableprivate

Definition at line 65 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress(), and setup().

edm::ESHandle<HcalTrigTowerGeometry> CaloTPGTranscoderULUT::theTrigTowerGeometry
mutableprivate
const int CaloTPGTranscoderULUT::TPGMAX = 256
staticprivate

Definition at line 51 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress().

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

Definition at line 70 of file CaloTPGTranscoderULUT.h.