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
 
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 (HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 
virtual ~CaloTPGTranscoderULUT ()
 
- Public Member Functions inherited from CaloTPGTranscoder
 CaloTPGTranscoder ()
 
boost::shared_ptr< const
EcalTPGCompressor
getEcalCompressor () const
 
boost::shared_ptr< const
HcalTPGCompressor
getHcalCompressor () const
 
virtual ~CaloTPGTranscoder ()
 

Private Types

typedef unsigned int LUT
 
typedef std::vector< double > RCTdecompression
 

Private Member Functions

void loadHCALCompress (HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 
void loadHCALCompress (const std::string &filename, HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 
void loadHCALUncompress (HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 
void loadHCALUncompress (const std::string &filename, HcalLutMetadata const &, HcalTrigTowerGeometry const &)
 

Private Attributes

std::string compressionFile_
 
std::string decompressionFile_
 
std::vector< RCTdecompressionhcaluncomp_
 
std::vector< int > ietah
 
std::vector< int > ietal
 
std::vector< int > LUTfactor
 
double nominal_gain_
 
LUToutputLUT_ [NOUTLUTS]
 
double rctlsb_factor_
 
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 43 of file CaloTPGTranscoderULUT.h.

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

Definition at line 44 of file CaloTPGTranscoderULUT.h.

Constructor & Destructor Documentation

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

Definition at line 18 of file CaloTPGTranscoderULUT.cc.

References i, NOUTLUTS, and outputLUT_.

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

Definition at line 27 of file CaloTPGTranscoderULUT.cc.

References i, NOUTLUTS, and outputLUT_.

27  {
28  for (int i = 0; i < NOUTLUTS; i++) {
29  if (outputLUT_[i] != 0) delete [] outputLUT_[i];
30  }
31 }
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 308 of file CaloTPGTranscoderULUT.cc.

References edm::hlt::Exception.

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

Definition at line 350 of file CaloTPGTranscoderULUT.cc.

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

Referenced by HcalLutManager::getCompressionLutXmlFromCoder().

350  {
351  std::vector<unsigned char> lut;
352  int itower = getOutputLUTId(id.ieta(),id.iphi());
353  if (itower >= 0) {
354  lut.resize(OUTPUT_LUT_SIZE);
355  for (unsigned int i = 0; i < OUTPUT_LUT_SIZE; i++) lut[i]=outputLUT_[itower][i];
356  }
357  return lut;
358 }
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 336 of file CaloTPGTranscoderULUT.cc.

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

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

336  {
337  int iphi = iphiin;
338  if (HTvalid(ieta, iphi)) {
339  int offset = 0, ietaabs;
340  ietaabs = abs(ieta);
341  if (ieta < 0) offset = NOUTLUTS/2;
342  if (ietaabs < 29) return 72*(ietaabs - 1) + (iphi - 1) + offset;
343  else {
344  if (newHFphi) iphi = iphi/4 + 1;
345  return 18*(ietaabs - 29) + iphi + 2015 + offset;
346  }
347  } else return -1;
348 }
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 252 of file CaloTPGTranscoderULUT.cc.

References edm::hlt::Exception, getOutputLUTId(), OUTPUT_LUT_SIZE, and outputLUT_.

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

References gather_cfg::cout, getOutputLUTId(), hcaluncomp_, and HTvalid().

277  {
278 // This is now an obsolete method; we return the AVERAGE over all the allowed iphi channels if it's invoked
279 // The user is encouraged to use hcaletValue(const int& ieta, const int& iphi, const int& compET) instead
280 
281  double etvalue = 0.;
282  if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, cET = " << ieta << ", " << compET << std::endl;
283  else {
284  int nphi = 0;
285  for (int iphi=1; iphi <= 72; iphi++) {
286  if (HTvalid(ieta,iphi)) {
287  nphi++;
288  int itower = getOutputLUTId(ieta,iphi);
289  etvalue += hcaluncomp_[itower][compET];
290  }
291  }
292  if (nphi > 0) etvalue /= nphi;
293  else std::cout << "hcaletValue error: no decompression LUTs found for any iphi for ieta = " << ieta << std::endl;
294  }
295  return(etvalue);
296 }
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
double CaloTPGTranscoderULUT::hcaletValue ( const int &  ieta,
const int &  iphi,
const int &  compressedValue 
) const
virtual

Implements CaloTPGTranscoder.

Definition at line 268 of file CaloTPGTranscoderULUT.cc.

References gather_cfg::cout, getOutputLUTId(), and hcaluncomp_.

268  {
269  double etvalue = 0.;
270  int itower = getOutputLUTId(ieta,iphi);
271  if (itower < 0) std::cout << "hcaletValue error: no decompression LUT found for ieta, iphi = " << ieta << ", " << iphi << std::endl;
272  else if (compET < 0 || compET > 0xff) std::cout << "hcaletValue error: compressed value out of range: eta, phi, cET = " << ieta << ", " << iphi << ", " << compET << std::endl;
273  else etvalue = hcaluncomp_[itower][compET];
274  return(etvalue);
275 }
std::vector< RCTdecompression > hcaluncomp_
virtual int getOutputLUTId(const int ieta, const int iphi) const
tuple cout
Definition: gather_cfg.py:121
double CaloTPGTranscoderULUT::hcaletValue ( const HcalTrigTowerDetId hid,
const HcalTriggerPrimitiveSample hc 
) const
virtual

Implements CaloTPGTranscoder.

Definition at line 298 of file CaloTPGTranscoderULUT.cc.

References HcalTriggerPrimitiveSample::compressedEt(), getOutputLUTId(), hcaluncomp_, HcalTrigTowerDetId::ieta(), and HcalTrigTowerDetId::iphi().

298  {
299 
300  int ieta = hid.ieta(); // No need to check the validity,
301  int iphi = hid.iphi(); // as the values are guaranteed
302  int compET = hc.compressedEt(); // to be within the range by the class
303  int itower = getOutputLUTId(ieta,iphi);
304  double etvalue = hcaluncomp_[itower][compET];
305  return(etvalue);
306 }
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
int iphi() const
get the tower iphi
bool CaloTPGTranscoderULUT::HTvalid ( const int  ieta,
const int  iphi 
) const
virtual

Definition at line 323 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), and newHFphi.

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

323  {
324  int iphi = iphiin;
325  if (iphi <= 0 || iphi > 72 || ieta == 0 || abs(ieta) > 32) return false;
326  if (abs(ieta) > 28) {
327  if (newHFphi) {
328  if ((iphi/4)*4 + 1 != iphi) return false;
329  iphi = iphi/4 + 1;
330  }
331  if (iphi > 18) return false;
332  }
333  return true;
334 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const bool newHFphi
void CaloTPGTranscoderULUT::loadHCALCompress ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry 
)
private

Definition at line 33 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), gather_cfg::cout, HcalTrigTowerGeometry::firstHFTower(), getOutputLUTId(), HcalLutMetadatum::getOutputLutThreshold(), HcalCondObjectContainer< Item >::getValues(), HTvalid(), i, create_public_lumi_plots::log, min(), OUTPUT_LUT_SIZE, outputLUT_, mathSSE::sqrt(), and dtDQMClient_cfg::threshold.

Referenced by loadHCALCompress(), and setup().

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

Definition at line 73 of file CaloTPGTranscoderULUT.cc.

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

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

Definition at line 177 of file CaloTPGTranscoderULUT.cc.

References funct::abs(), HcalTrigTowerGeometry::firstHFTower(), HcalLutMetadatum::getLutGranularity(), getOutputLUTId(), HcalCondObjectContainer< Item >::getValues(), hcaluncomp_, HTvalid(), i, nominal_gain_, NOUTLUTS, OUTPUT_LUT_SIZE, outputLUT_, rctlsb_factor_, HcalTrigTowerGeometry::towerEtaBounds(), and TPGMAX.

Referenced by loadHCALUncompress(), and setup().

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

Definition at line 223 of file CaloTPGTranscoderULUT.cc.

References getOutputLUTId(), hcaluncomp_, i, j, loadHCALUncompress(), NOUTLUTS, and TPGMAX.

223  {
224  std::ifstream userfile;
225  userfile.open(filename.c_str());
226 
227  hcaluncomp_.resize(NOUTLUTS);
228  for (int i = 0; i < NOUTLUTS; i++) hcaluncomp_[i].resize(TPGMAX);
229 
230  static const int etabound = 32;
231  if( userfile ) {
232  double et;
233  for (int i=0; i<TPGMAX; i++) {
234  for(int j = 1; j <=etabound; j++) {
235  userfile >> et;
236  for (int iphi = 1; iphi <= 72; iphi++) {
237  int itower = getOutputLUTId(j,iphi);
238  if (itower >= 0) hcaluncomp_[itower][i] = et;
239  itower = getOutputLUTId(-j,iphi);
240  if (itower >= 0) hcaluncomp_[itower][i] = et;
241  }
242  }
243  }
244  userfile.close();
245  }
246  else {
247 
248  loadHCALUncompress(lutMetadata,theTrigTowerGeometry);
249  }
250 }
int i
Definition: DBlmapReader.cc:9
std::vector< RCTdecompression > hcaluncomp_
void loadHCALUncompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
int j
Definition: DBlmapReader.cc:9
tuple filename
Definition: lut2db_cfg.py:20
virtual int getOutputLUTId(const int ieta, const int iphi) const
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 312 of file CaloTPGTranscoderULUT.cc.

References edm::hlt::Exception.

314  {
315  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctEGammaUncompress";
316 }
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 317 of file CaloTPGTranscoderULUT.cc.

References edm::hlt::Exception.

319  {
320  throw cms::Exception("Not Implemented") << "CaloTPGTranscoderULUT::rctJetUncompress";
321 }
void CaloTPGTranscoderULUT::setup ( HcalLutMetadata const &  lutMetadata,
HcalTrigTowerGeometry const &  theTrigTowerGeometry 
)
virtual

Definition at line 360 of file CaloTPGTranscoderULUT.cc.

References compressionFile_, gather_cfg::cout, decompressionFile_, edm::hlt::Exception, HcalLutMetadata::getNominalGain(), HcalLutMetadata::getRctLsb(), loadHCALCompress(), loadHCALUncompress(), nominal_gain_, and rctlsb_factor_.

361 {
362  nominal_gain_ = lutMetadata.getNominalGain();
363  float rctlsb =lutMetadata.getRctLsb();
364  if (rctlsb != 0.25 && rctlsb != 0.5)
365  throw cms::Exception("RCTLSB") << " value=" << rctlsb << " (should be 0.25 or 0.5)" << std::endl;
366  rctlsb_factor_ = rctlsb;
367 
368  if (compressionFile_.empty() && decompressionFile_.empty()) {
369  loadHCALCompress(lutMetadata,theTrigTowerGeometry);
370  }
371  else {
372  // TODO Message to discourage using txt.
373  std::cout << "From Text File:" << std::endl;
374  loadHCALCompress(compressionFile_, lutMetadata,theTrigTowerGeometry);
375  }
376  loadHCALUncompress(decompressionFile_, lutMetadata,theTrigTowerGeometry);
377 }
void loadHCALUncompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
void loadHCALCompress(HcalLutMetadata const &, HcalTrigTowerGeometry const &)
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::string CaloTPGTranscoderULUT::compressionFile_
private

Definition at line 64 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

std::string CaloTPGTranscoderULUT::decompressionFile_
private

Definition at line 65 of file CaloTPGTranscoderULUT.h.

Referenced by setup().

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

Definition at line 72 of file CaloTPGTranscoderULUT.h.

Referenced by hcaletValue(), and loadHCALUncompress().

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

Definition at line 67 of file CaloTPGTranscoderULUT.h.

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

Definition at line 66 of file CaloTPGTranscoderULUT.h.

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

Definition at line 69 of file CaloTPGTranscoderULUT.h.

const bool CaloTPGTranscoderULUT::newHFphi = true
staticprivate

Definition at line 51 of file CaloTPGTranscoderULUT.h.

Referenced by getOutputLUTId(), and HTvalid().

double CaloTPGTranscoderULUT::nominal_gain_
private

Definition at line 62 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]
private
double CaloTPGTranscoderULUT::rctlsb_factor_
private

Definition at line 63 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress(), and setup().

const int CaloTPGTranscoderULUT::TPGMAX = 256
staticprivate

Definition at line 50 of file CaloTPGTranscoderULUT.h.

Referenced by loadHCALUncompress().

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

Definition at line 68 of file CaloTPGTranscoderULUT.h.