CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Types | Private Attributes | Static Private Attributes
HcaluLUTTPGCoder Class Reference

#include <HcaluLUTTPGCoder.h>

Inheritance diagram for HcaluLUTTPGCoder:
HcalTPGCoder

Public Member Functions

virtual void adc2Linear (const HBHEDataFrame &df, IntegerCaloSamples &ics) const
 
virtual void adc2Linear (const HFDataFrame &df, IntegerCaloSamples &ics) const
 
virtual unsigned short adc2Linear (HcalQIESample sample, HcalDetId id) const
 
virtual void compress (const IntegerCaloSamples &ics, const std::vector< bool > &featureBits, HcalTriggerPrimitiveDigi &tp) const
 
std::vector< unsigned short > getLinearizationLUTWithMSB (const HcalDetId &id) const
 
virtual float getLUTGain (HcalDetId id) const
 
int getLUTId (HcalSubdetector id, int ieta, int iphi, int depth) const
 
int getLUTId (uint32_t rawid) const
 
int getLUTId (const HcalDetId &detid) const
 
virtual float getLUTPedestal (HcalDetId id) const
 
bool getMSB (const HcalDetId &id, int adc) const
 
 HcaluLUTTPGCoder (const HcalTopology *topo)
 
void lookupMSB (const HBHEDataFrame &df, std::vector< bool > &msb) const
 
void setLUTGenerationMode (bool gen)
 
void setMaskBit (int bit)
 
void update (const HcalDbService &conditions)
 
void update (const char *filename, bool appendMSB=false)
 
void updateXML (const char *filename)
 
virtual ~HcaluLUTTPGCoder ()
 
- Public Member Functions inherited from HcalTPGCoder
unsigned short adc2Linear (unsigned char adc, HcalDetId id) const
 
virtual std::vector< unsigned
short > 
getLinearizationLUT (HcalDetId id) const
 Get the full linearization LUT (128 elements). Default implementation just uses adc2Linear to get all values. More...
 

Static Public Attributes

static const float lsb_ =1./16
 

Private Types

typedef std::vector< LutElementLut
 
typedef unsigned short LutElement
 

Private Attributes

int bitToMask_
 
int firstHBEta_
 
int firstHEEta_
 
int firstHFEta_
 
std::vector< float > gain_
 
std::vector< LutinputLUT_
 
int lastHBEta_
 
int lastHEEta_
 
int lastHFEta_
 
bool LUTGenerationMode_
 
int maxDepthHB_
 
int maxDepthHE_
 
int maxDepthHF_
 
int nHBEta_
 
int nHEEta_
 
int nHFEta_
 
std::vector< float > ped_
 
int sizeHB_
 
int sizeHE_
 
int sizeHF_
 
const HcalTopologytopo_
 

Static Private Attributes

static const size_t INPUT_LUT_SIZE = 128
 
static const int nFi_ = 72
 

Detailed Description

The nominal coder uses a user-supplied table to linearize the ADC values.

[number of ieta slices]
[low tower 1] [low tower 2] ...
[high tower 1] [ high tower 2] ...
[LUT 1(0)] [LUT 2(0)] ...
[LUT 1(1)] [LUT 2(1)] ...
. . .
[LUT 1(127)] [LUT 2(127)] ...
Author
M. Weinberger – TAMU
Tulika Bose and Greg Landsberg – Brown

Definition at line 29 of file HcaluLUTTPGCoder.h.

Member Typedef Documentation

typedef std::vector<LutElement> HcaluLUTTPGCoder::Lut
private

Definition at line 57 of file HcaluLUTTPGCoder.h.

typedef unsigned short HcaluLUTTPGCoder::LutElement
private

Definition at line 56 of file HcaluLUTTPGCoder.h.

Constructor & Destructor Documentation

HcaluLUTTPGCoder::HcaluLUTTPGCoder ( const HcalTopology topo)

Definition at line 29 of file HcaluLUTTPGCoder.cc.

References firstHBEta_, HcalTopology::firstHBRing(), firstHEEta_, HcalTopology::firstHERing(), firstHFEta_, HcalTopology::firstHFRing(), gain_, HcalBarrel, HcalEndcap, HcalForward, INPUT_LUT_SIZE, inputLUT_, lastHBEta_, HcalTopology::lastHBRing(), lastHEEta_, HcalTopology::lastHERing(), lastHFEta_, HcalTopology::lastHFRing(), HcalTopology::maxDepth(), maxDepthHB_, maxDepthHE_, maxDepthHF_, nFi_, nHBEta_, nHEEta_, nHFEta_, ped_, sizeHB_, sizeHE_, sizeHF_, and topo_.

29  : topo_(top), LUTGenerationMode_(true), bitToMask_(0) {
45  size_t nluts= (size_t)(sizeHB_+sizeHE_+sizeHF_+1);
46  inputLUT_ = std::vector<HcaluLUTTPGCoder::Lut>(nluts,HcaluLUTTPGCoder::Lut(INPUT_LUT_SIZE, 0));
47  gain_ = std::vector<float>(nluts, 0.);
48  ped_ = std::vector<float>(nluts, 0.);
49 }
int firstHFRing() const
Definition: HcalTopology.h:87
static const int nFi_
const HcalTopology * topo_
int firstHBRing() const
Definition: HcalTopology.h:83
int lastHBRing() const
Definition: HcalTopology.h:84
int maxDepth(HcalSubdetector subdet) const
int lastHFRing() const
Definition: HcalTopology.h:88
std::vector< LutElement > Lut
std::vector< float > ped_
std::vector< float > gain_
int firstHERing() const
Definition: HcalTopology.h:85
static const size_t INPUT_LUT_SIZE
int lastHERing() const
Definition: HcalTopology.h:86
std::vector< Lut > inputLUT_
HcaluLUTTPGCoder::~HcaluLUTTPGCoder ( )
virtual

Definition at line 55 of file HcaluLUTTPGCoder.cc.

55  {
56 }

Member Function Documentation

void HcaluLUTTPGCoder::adc2Linear ( const HBHEDataFrame df,
IntegerCaloSamples ics 
) const
virtual

Implements HcalTPGCoder.

Definition at line 314 of file HcaluLUTTPGCoder.cc.

References ecalMGPA::adc(), getLUTId(), i, HBHEDataFrame::id(), inputLUT_, lumiPlot::lut, and HBHEDataFrame::size().

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

314  {
315  int lutId = getLUTId(df.id());
316  const Lut& lut = inputLUT_.at(lutId);
317  for (int i=0; i<df.size(); i++){
318  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
319  }
320 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
tuple lut
Definition: lumiPlot.py:244
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
Definition: Lut.h:32
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::adc2Linear ( const HFDataFrame df,
IntegerCaloSamples ics 
) const
virtual

Implements HcalTPGCoder.

Definition at line 322 of file HcaluLUTTPGCoder.cc.

References ecalMGPA::adc(), getLUTId(), i, HFDataFrame::id(), inputLUT_, lumiPlot::lut, and HFDataFrame::size().

322  {
323  int lutId = getLUTId(df.id());
324  const Lut& lut = inputLUT_.at(lutId);
325  for (int i=0; i<df.size(); i++){
326  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
327  }
328 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
tuple lut
Definition: lumiPlot.py:244
int size() const
total number of samples in the digi
Definition: HFDataFrame.h:26
const HcalDetId & id() const
Definition: HFDataFrame.h:22
Definition: Lut.h:32
std::vector< Lut > inputLUT_
unsigned short HcaluLUTTPGCoder::adc2Linear ( HcalQIESample  sample,
HcalDetId  id 
) const
virtual

Implements HcalTPGCoder.

Definition at line 330 of file HcaluLUTTPGCoder.cc.

References HcalQIESample::adc(), getLUTId(), and inputLUT_.

330  {
331  int lutId = getLUTId(id);
332  return ((inputLUT_.at(lutId)).at(sample.adc()) & 0x3FF);
333 }
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::compress ( const IntegerCaloSamples ics,
const std::vector< bool > &  featureBits,
HcalTriggerPrimitiveDigi tp 
) const
virtual

Implements HcalTPGCoder.

Definition at line 51 of file HcaluLUTTPGCoder.cc.

References Exception.

51  {
52  throw cms::Exception("PROBLEM: This method should never be invoked!");
53 }
std::vector< unsigned short > HcaluLUTTPGCoder::getLinearizationLUTWithMSB ( const HcalDetId id) const

Definition at line 345 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and inputLUT_.

345  {
346  int lutId = getLUTId(id);
347  return inputLUT_.at(lutId);
348 }
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::vector< Lut > inputLUT_
float HcaluLUTTPGCoder::getLUTGain ( HcalDetId  id) const
virtual

Implements HcalTPGCoder.

Definition at line 340 of file HcaluLUTTPGCoder.cc.

References gain_, and getLUTId().

340  {
341  int lutId = getLUTId(id);
342  return gain_.at(lutId);
343 }
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::vector< float > gain_
int HcaluLUTTPGCoder::getLUTId ( HcalSubdetector  id,
int  ieta,
int  iphi,
int  depth 
) const

Definition at line 58 of file HcaluLUTTPGCoder.cc.

References firstHBEta_, firstHEEta_, firstHFEta_, HcalBarrel, HcalEndcap, HcalForward, lastHBEta_, lastHEEta_, lastHFEta_, maxDepthHB_, maxDepthHE_, maxDepthHF_, nFi_, nHBEta_, nHEEta_, nHFEta_, sizeHB_, and sizeHE_.

Referenced by adc2Linear(), getLinearizationLUTWithMSB(), getLUTGain(), getLUTId(), getLUTPedestal(), getMSB(), update(), and updateXML().

58  {
59  int retval(0);
60  if (id == HcalBarrel) {
61  retval = (depth-1)+maxDepthHB_*(iphi-1);
62  if (ieta>0) retval+=maxDepthHB_*nFi_*(ieta-firstHBEta_);
63  else retval+=maxDepthHB_*nFi_*(ieta+lastHBEta_+nHBEta_);
64  } else if (id == HcalEndcap) {
65  retval = sizeHB_;
66  retval+= (depth-1)+maxDepthHE_*(iphi-1);
67  if (ieta>0) retval+=maxDepthHE_*nFi_*(ieta-firstHEEta_);
68  else retval+=maxDepthHE_*nFi_*(ieta+lastHEEta_+nHEEta_);
69  } else if (id == HcalForward) {
70  retval = sizeHB_+sizeHE_;
71  retval+= (depth-1)+maxDepthHF_*(iphi-1);
72  if (ieta>0) retval+=maxDepthHF_*nFi_*(ieta-firstHFEta_);
73  else retval+=maxDepthHF_*nFi_*(ieta+lastHFEta_+nHFEta_);
74  }
75  return retval;
76 }
static const int nFi_
int HcaluLUTTPGCoder::getLUTId ( uint32_t  rawid) const

Definition at line 78 of file HcaluLUTTPGCoder.cc.

References HcalDetId::depth(), getLUTId(), HcalDetId::ieta(), HcalDetId::iphi(), and HcalDetId::subdet().

78  {
79  HcalDetId detid(rawid);
80  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
81 }
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int HcaluLUTTPGCoder::getLUTId ( const HcalDetId detid) const

Definition at line 83 of file HcaluLUTTPGCoder.cc.

References HcalDetId::depth(), getLUTId(), HcalDetId::ieta(), HcalDetId::iphi(), and HcalDetId::subdet().

83  {
84  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
85 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
int depth() const
get the tower depth
Definition: HcalDetId.cc:106
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:101
float HcaluLUTTPGCoder::getLUTPedestal ( HcalDetId  id) const
virtual

Implements HcalTPGCoder.

Definition at line 335 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and ped_.

335  {
336  int lutId = getLUTId(id);
337  return ped_.at(lutId);
338 }
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
std::vector< float > ped_
bool HcaluLUTTPGCoder::getMSB ( const HcalDetId id,
int  adc 
) const

Definition at line 356 of file HcaluLUTTPGCoder.cc.

References getLUTId(), inputLUT_, and lumiPlot::lut.

Referenced by lookupMSB().

356  {
357  int lutId = getLUTId(id);
358  const Lut& lut = inputLUT_.at(lutId);
359  return (lut.at(adc) & 0x400);
360 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
tuple lut
Definition: lumiPlot.py:244
Definition: Lut.h:32
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::lookupMSB ( const HBHEDataFrame df,
std::vector< bool > &  msb 
) const

Definition at line 350 of file HcaluLUTTPGCoder.cc.

References HcalQIESample::adc(), getMSB(), i, HBHEDataFrame::id(), HBHEDataFrame::sample(), and HBHEDataFrame::size().

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

350  {
351  msb.resize(df.size());
352  for (int i=0; i<df.size(); ++i)
353  msb[i] = getMSB(df.id(), df.sample(i).adc());
354 }
int i
Definition: DBlmapReader.cc:9
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:26
const HcalQIESample & sample(int i) const
access a sample
Definition: HBHEDataFrame.h:39
bool getMSB(const HcalDetId &id, int adc) const
const HcalDetId & id() const
Definition: HBHEDataFrame.h:22
void HcaluLUTTPGCoder::setLUTGenerationMode ( bool  gen)
inline

Definition at line 45 of file HcaluLUTTPGCoder.h.

References relval_steps::gen(), and LUTGenerationMode_.

Referenced by HcalTPGCoderULUT::buildCoder().

void HcaluLUTTPGCoder::setMaskBit ( int  bit)
inline

Definition at line 46 of file HcaluLUTTPGCoder.h.

References bitToMask_.

Referenced by HcalTPGCoderULUT::buildCoder().

46 { bitToMask_ = bit; };
void HcaluLUTTPGCoder::update ( const HcalDbService conditions)

Definition at line 217 of file HcaluLUTTPGCoder.cc.

References funct::abs(), ecalMGPA::adc(), HcalCoderDb::adc2fC(), adc2fC, assert(), bitToMask_, HLT_FULL_cff::depth, HcalTopology::etaRange(), EnergyCorrector::etas, firstHFEta_, gain_, HcalL1TriggerObject::getFlag(), HcalDbService::getHcalCalibrations(), HcalDbService::getHcalChannelStatus(), HcalDbService::getHcalCoder(), HcalDbService::getHcalL1TriggerObject(), HcalDbService::getHcalLutMetadata(), HcalDbService::getHcalShape(), HcalLutMetadatum::getLutGranularity(), getLUTId(), HcalLutMetadata::getNominalGain(), HcalL1TriggerObject::getPedestal(), HcalLutMetadatum::getRCalib(), HcalL1TriggerObject::getRespGain(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), HcalBarrel, HcalEndcap, HcalForward, i, inputLUT_, HcalDetId::kHcalDepthMask2, HcalDetId::kHcalEtaMask2, HcalDetId::kHcalPhiMask2, lastHFEta_, lsb_, LUTGenerationMode_, HcalCalibrations::LUTrespcorrgain(), bookConverter::max, min(), ped_, HcalCalibrations::pedestal(), HBHEDataFrame::setSample(), HFDataFrame::setSample(), HFDataFrame::setSize(), HBHEDataFrame::setSize(), mps_update::status, subdets, topo_, and HcalTopology::valid().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), HcalTPGCoderULUT::buildCoder(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), HcalTPGCoderULUT::dbRecordCallback(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

217  {
218 
219  HcalCalibrations calibrations;
220  const HcalLutMetadata *metadata = conditions.getHcalLutMetadata();
221  assert(metadata !=0);
222  float nominalgain_ = metadata->getNominalGain();
223 
224  std::map<int, float> cosh_ieta;
225  for (int i = firstHFEta_; i <= lastHFEta_; ++i){
226  std::pair<double,double> etas = topo_->etaRange(HcalForward,i);
227  double eta1 = etas.first;
228  double eta2 = etas.second;
229  cosh_ieta[i] = cosh((eta1 + eta2)/2.);
230  }
231 
233  for (int isub = 0; isub < 3; ++isub){
234  HcalSubdetector subdet = subdets[isub];
235  for (int ieta = -HcalDetId::kHcalEtaMask2;
236  ieta <= HcalDetId::kHcalEtaMask2; ++ieta) {
237  for (int iphi = 0; iphi <= HcalDetId::kHcalPhiMask2; ++iphi) {
238  for (int depth = 1; depth < HcalDetId::kHcalDepthMask2; ++depth) {
239  HcalDetId cell(subdet, ieta, iphi, depth);
240  if (!topo_->valid(cell)) continue;
241 
242  const HcalQIECoder* channelCoder = conditions.getHcalCoder (cell);
243  const HcalQIEShape* shape = conditions.getHcalShape(cell);
244  HcalCoderDb coder (*channelCoder, *shape);
245  const HcalLutMetadatum *meta = metadata->getValues(cell);
246 
247  int lutId = getLUTId(subdet, ieta, iphi, depth);
248  float ped = 0;
249  float gain = 0;
250  uint32_t status = 0;
251 
252  if (LUTGenerationMode_){
253  const HcalCalibrations& calibrations = conditions.getHcalCalibrations(cell);
254  for (int capId = 0; capId < 4; ++capId){
255  ped += calibrations.pedestal(capId);
256  gain += calibrations.LUTrespcorrgain(capId);
257  }
258  ped /= 4.0;
259  gain /= 4.0;
260 
261  //Get Channel Quality
262  const HcalChannelStatus* channelStatus = conditions.getHcalChannelStatus(cell);
263  status = channelStatus->getValue();
264  }
265  else {
266  const HcalL1TriggerObject* myL1TObj = conditions.getHcalL1TriggerObject(cell);
267  ped = myL1TObj->getPedestal();
268  gain = myL1TObj->getRespGain();
269  status = myL1TObj->getFlag();
270  } // LUTGenerationMode_
271 
272  ped_[lutId] = ped;
273  gain_[lutId] = gain;
274  bool isMasked = ( (status & bitToMask_) > 0 );
275  float rcalib = meta->getRCalib();
276 
277  // Input LUT for HB/HE/HF
278  if (subdet == HcalBarrel || subdet == HcalEndcap){
279  HBHEDataFrame frame(cell);
280  frame.setSize(1);
281  CaloSamples samples(cell, 1);
282 
283  int granularity = meta->getLutGranularity();
284 
285  for (int adc = 0; adc <= 0x7F; ++adc) {
286  frame.setSample(0,HcalQIESample(adc));
287  coder.adc2fC(frame,samples);
288  float adc2fC = samples[0];
289 
290  if (isMasked) inputLUT_[lutId][adc] = 0;
291  else inputLUT_[lutId][adc] = (LutElement) std::min(std::max(0, int((adc2fC -ped) * gain * rcalib / nominalgain_ / granularity)), 0x3FF);
292  }
293  } // endif HBHE
294  else if (subdet == HcalForward){
295  HFDataFrame frame(cell);
296  frame.setSize(1);
297  CaloSamples samples(cell, 1);
298 
299  for (int adc = 0; adc <= 0x7F; ++adc) {
300  frame.setSample(0,HcalQIESample(adc));
301  coder.adc2fC(frame,samples);
302  float adc2fC = samples[0];
303  if (isMasked) inputLUT_[lutId][adc] = 0;
304  else inputLUT_[lutId][adc] = std::min(std::max(0,int((adc2fC - ped) * gain * rcalib / lsb_ / cosh_ieta[abs(ieta)] )), 0x3FF);
305  }
306  } // endif HF
307 
308  } // for depth
309  } // for iphi
310  } // for iphi
311  }// for subdet
312 }
int adc(sample_type sample)
get the ADC sample (12 bits)
uint32_t getFlag() const
float getPedestal() const
int i
Definition: DBlmapReader.cc:9
const HcalChannelStatus * getHcalChannelStatus(const HcalGenericDetId &fId) const
assert(m_qm.get())
const HcalTopology * topo_
static const float lsb_
double pedestal(int fCapId) const
get pedestal for capid=0..3
const Item * getValues(DetId fId, bool throwOnFail=true) const
uint8_t getLutGranularity() const
unsigned short LutElement
static const int kHcalDepthMask2
Definition: HcalDetId.h:26
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
float getRespGain() const
float getNominalGain() const
float getRCalib() const
const HcalL1TriggerObject * getHcalL1TriggerObject(const HcalGenericDetId &fId) const
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const HcalLutMetadata * getHcalLutMetadata() const
T min(T a, T b)
Definition: MathUtil.h:58
char const * subdets[11]
static const int kHcalPhiMask2
Definition: HcalDetId.h:16
double LUTrespcorrgain(int fCapId) const
get LUT corrected and response corrected gain for capid=0..3
std::vector< float > ped_
std::vector< float > gain_
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
virtual bool valid(const DetId &id) const
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
std::pair< double, double > etaRange(HcalSubdetector subdet, int ieta) const
static const int kHcalEtaMask2
Definition: HcalDetId.h:20
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
float adc2fC[128]
tuple status
Definition: mps_update.py:57
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::update ( const char *  filename,
bool  appendMSB = false 
)

Definition at line 87 of file HcaluLUTTPGCoder.cc.

References ecalMGPA::adc(), assert(), HLT_FULL_cff::depth, mergeVDriftHistosByStation::file, getLUTId(), HcalBarrel, HcalEndcap, HcalForward, i, recoMuon::in, cmsHarvester::index, INPUT_LUT_SIZE, inputLUT_, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, topo_, and HcalTopology::valid().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

87  {
88 
89  std::ifstream file(filename, std::ios::in);
90  assert(file.is_open());
91 
92  std::vector<HcalSubdetector> subdet;
93  std::string buffer;
94 
95  // Drop first (comment) line
96  std::getline(file, buffer);
97  std::getline(file, buffer);
98 
99  unsigned int index = buffer.find("H", 0);
100  while (index < buffer.length()){
101  std::string subdetStr = buffer.substr(index, 2);
102  if (subdetStr == "HB") subdet.push_back(HcalBarrel);
103  else if (subdetStr == "HE") subdet.push_back(HcalEndcap);
104  else if (subdetStr == "HF") subdet.push_back(HcalForward);
105  //TODO Check subdet
106  //else exception
107  index += 2;
108  index = buffer.find("H", index);
109  }
110 
111  // Get upper/lower ranges for ieta/iphi/depth
112  size_t nCol = subdet.size();
113  assert(nCol > 0);
114 
115  std::vector<int> ietaU;
116  std::vector<int> ietaL;
117  std::vector<int> iphiU;
118  std::vector<int> iphiL;
119  std::vector<int> depU;
120  std::vector<int> depL;
121  std::vector< Lut > lutFromFile(nCol);
122  LutElement lutValue;
123 
124  for (size_t i=0; i<nCol; ++i) {
125  int ieta;
126  file >> ieta;
127  ietaL.push_back(ieta);
128  }
129 
130  for (size_t i=0; i<nCol; ++i) {
131  int ieta;
132  file >> ieta;
133  ietaU.push_back(ieta);
134  }
135 
136  for (size_t i=0; i<nCol; ++i) {
137  int iphi;
138  file >> iphi;
139  iphiL.push_back(iphi);
140  }
141 
142  for (size_t i=0; i<nCol; ++i) {
143  int iphi;
144  file >> iphi;
145  iphiU.push_back(iphi);
146  }
147 
148  for (size_t i=0; i<nCol; ++i) {
149  int dep;
150  file >> dep;
151  depL.push_back(dep);
152  }
153 
154  for (size_t i=0; i<nCol; ++i) {
155  int dep;
156  file >> dep;
157  depU.push_back(dep);
158  }
159 
160  // Read Lut Entry
161  for (size_t i=0; file >> lutValue; i = (i+1) % nCol){
162  lutFromFile[i].push_back(lutValue);
163  }
164 
165  // Check lut size
166  for (size_t i=0; i<nCol; ++i) assert(lutFromFile[i].size() == INPUT_LUT_SIZE);
167 
168  for (size_t i=0; i<nCol; ++i){
169  for (int ieta = ietaL[i]; ieta <= ietaU[i]; ++ieta){
170  for (int iphi = iphiL[i]; iphi <= iphiU[i]; ++iphi){
171  for (int depth = depL[i]; depth <= depU[i]; ++depth){
172 
173  HcalDetId id(subdet[i], ieta, iphi, depth);
174  if (!topo_->valid(id)) continue;
175 
176  int lutId = getLUTId(id);
177  for (size_t adc = 0; adc < INPUT_LUT_SIZE; ++adc){
178  if (appendMSB){
179  // Append FG bit LUT to MSB
180  // MSB = Most Significant Bit = bit 10
181  // Overwrite bit 10
182  LutElement msb = (lutFromFile[i][adc] != 0 ? 0x400 : 0);
183  inputLUT_[lutId][adc] = (msb | (inputLUT_[lutId][adc] & 0x3FF));
184  }
185  else inputLUT_[lutId][adc] = lutFromFile[i][adc];
186  }// for adc
187  }// for depth
188  }// for iphi
189  }// for ieta
190  }// for nCol
191 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
assert(m_qm.get())
const HcalTopology * topo_
unsigned short LutElement
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
virtual bool valid(const DetId &id) const
static const size_t INPUT_LUT_SIZE
tuple filename
Definition: lut2db_cfg.py:20
tuple size
Write out results.
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::updateXML ( const char *  filename)

Definition at line 193 of file HcaluLUTTPGCoder.cc.

References LutXml::create_lut_map(), HLT_FULL_cff::depth, Exception, XMLProcessor::getInstance(), LutXml::getLutFast(), getLUTId(), HcalBarrel, HcalEndcap, HcalForward, i, inputLUT_, HcalDetId::kHcalDepthMask2, HcalDetId::kHcalEtaMask2, HcalDetId::kHcalPhiMask2, lumiPlot::lut, XMLProcessor::terminate(), topo_, and HcalTopology::valid().

Referenced by HcalTPGCoderULUT::buildCoder().

193  {
194  LutXml * _xml = new LutXml(filename);
195  _xml->create_lut_map();
197  for (int ieta = -HcalDetId::kHcalEtaMask2;
198  ieta <= HcalDetId::kHcalEtaMask2; ++ieta) {
199  for (int iphi = 0; iphi <= HcalDetId::kHcalPhiMask2; ++iphi) {
200  for (int depth = 1; depth < HcalDetId::kHcalDepthMask2; ++depth) {
201  for (int isub=0; isub<3; ++isub) {
202  HcalDetId detid(subdet[isub], ieta, iphi, depth);
203  if (!topo_->valid(detid)) continue;
204  int id = getLUTId(subdet[isub], ieta, iphi, depth);
205  std::vector<unsigned int>* lut = _xml->getLutFast(detid);
206  if (lut==0) throw cms::Exception("PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
207  if (lut->size()!=128) throw cms::Exception ("PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
208  for (int i=0; i<128; ++i) inputLUT_[id][i] = (LutElement)lut->at(i);
209  }
210  }
211  }
212  }
213  delete _xml;
215 }
int i
Definition: DBlmapReader.cc:9
Definition: LutXml.h:27
int create_lut_map(void)
Definition: LutXml.cc:497
const HcalTopology * topo_
unsigned short LutElement
static const int kHcalDepthMask2
Definition: HcalDetId.h:26
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int terminate(void)
HcalSubdetector
Definition: HcalAssistant.h:31
tuple lut
Definition: lumiPlot.py:244
static const int kHcalPhiMask2
Definition: HcalDetId.h:16
virtual bool valid(const DetId &id) const
std::vector< unsigned int > * getLutFast(uint32_t det_id)
Definition: LutXml.cc:127
tuple filename
Definition: lut2db_cfg.py:20
static const int kHcalEtaMask2
Definition: HcalDetId.h:20
static XMLProcessor * getInstance()
Definition: XMLProcessor.h:145
std::vector< Lut > inputLUT_

Member Data Documentation

int HcaluLUTTPGCoder::bitToMask_
private

Definition at line 66 of file HcaluLUTTPGCoder.h.

Referenced by setMaskBit(), and update().

int HcaluLUTTPGCoder::firstHBEta_
private

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::firstHEEta_
private

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::firstHFEta_
private

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), HcaluLUTTPGCoder(), and update().

std::vector<float> HcaluLUTTPGCoder::gain_
private

Definition at line 71 of file HcaluLUTTPGCoder.h.

Referenced by getLUTGain(), HcaluLUTTPGCoder(), and update().

const size_t HcaluLUTTPGCoder::INPUT_LUT_SIZE = 128
staticprivate

Definition at line 60 of file HcaluLUTTPGCoder.h.

Referenced by HcaluLUTTPGCoder(), and update().

std::vector< Lut > HcaluLUTTPGCoder::inputLUT_
private
int HcaluLUTTPGCoder::lastHBEta_
private

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::lastHEEta_
private

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::lastHFEta_
private

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), HcaluLUTTPGCoder(), and update().

const float HcaluLUTTPGCoder::lsb_ =1./16
static

Definition at line 31 of file HcaluLUTTPGCoder.h.

Referenced by CaloTPGTranscoderULUT::setup(), and update().

bool HcaluLUTTPGCoder::LUTGenerationMode_
private

Definition at line 65 of file HcaluLUTTPGCoder.h.

Referenced by setLUTGenerationMode(), and update().

int HcaluLUTTPGCoder::maxDepthHB_
private

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::maxDepthHE_
private

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::maxDepthHF_
private

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

const int HcaluLUTTPGCoder::nFi_ = 72
staticprivate

Definition at line 61 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::nHBEta_
private

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::nHEEta_
private

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::nHFEta_
private

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

std::vector<float> HcaluLUTTPGCoder::ped_
private

Definition at line 72 of file HcaluLUTTPGCoder.h.

Referenced by getLUTPedestal(), HcaluLUTTPGCoder(), and update().

int HcaluLUTTPGCoder::sizeHB_
private

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::sizeHE_
private

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTId(), and HcaluLUTTPGCoder().

int HcaluLUTTPGCoder::sizeHF_
private

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by HcaluLUTTPGCoder().

const HcalTopology* HcaluLUTTPGCoder::topo_
private

Definition at line 64 of file HcaluLUTTPGCoder.h.

Referenced by HcaluLUTTPGCoder(), update(), and updateXML().