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 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 ()
 
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...
 

Private Types

typedef std::vector< LutElementLut
 
typedef unsigned short LutElement
 

Private Attributes

int bitToMask_
 
std::vector< float > gain_
 
std::vector< LutinputLUT_
 
bool LUTGenerationMode_
 
std::vector< float > ped_
 

Static Private Attributes

static const size_t INPUT_LUT_SIZE = 128
 
static const float lsb_ =1./16
 
static const size_t nluts = 46007
 

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)] ...
Date:
2010/02/06 18:16:50
Revision:
1.21
Author
M. Weinberger – TAMU
Tulika Bose and Greg Landsberg – Brown

Definition at line 31 of file HcaluLUTTPGCoder.h.

Member Typedef Documentation

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

Definition at line 58 of file HcaluLUTTPGCoder.h.

typedef unsigned short HcaluLUTTPGCoder::LutElement
private

Definition at line 57 of file HcaluLUTTPGCoder.h.

Constructor & Destructor Documentation

HcaluLUTTPGCoder::HcaluLUTTPGCoder ( )

Definition at line 30 of file HcaluLUTTPGCoder.cc.

30  : LUTGenerationMode_(true), bitToMask_(0),
32  gain_(nluts, 0.), ped_ (nluts, 0.){
33 }
std::vector< LutElement > Lut
std::vector< float > ped_
std::vector< float > gain_
static const size_t INPUT_LUT_SIZE
static const size_t nluts
std::vector< Lut > inputLUT_
HcaluLUTTPGCoder::~HcaluLUTTPGCoder ( )
virtual

Definition at line 39 of file HcaluLUTTPGCoder.cc.

39  {
40 }

Member Function Documentation

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

Implements HcalTPGCoder.

Definition at line 283 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

283  {
284  int lutId = getLUTId(df.id());
285  const Lut& lut = inputLUT_.at(lutId);
286  for (int i=0; i<df.size(); i++){
287  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
288  }
289 }
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:33
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::adc2Linear ( const HFDataFrame df,
IntegerCaloSamples ics 
) const
virtual

Implements HcalTPGCoder.

Definition at line 291 of file HcaluLUTTPGCoder.cc.

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

291  {
292  int lutId = getLUTId(df.id());
293  const Lut& lut = inputLUT_.at(lutId);
294  for (int i=0; i<df.size(); i++){
295  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
296  }
297 }
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:33
std::vector< Lut > inputLUT_
unsigned short HcaluLUTTPGCoder::adc2Linear ( HcalQIESample  sample,
HcalDetId  id 
) const
virtual

Implements HcalTPGCoder.

Definition at line 299 of file HcaluLUTTPGCoder.cc.

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

299  {
300  int lutId = getLUTId(id);
301  return ((inputLUT_.at(lutId)).at(sample.adc()) & 0x3FF);
302 }
int adc() const
get the ADC sample
Definition: HcalQIESample.h:24
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
list at
Definition: asciidump.py:428
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::compress ( const IntegerCaloSamples ics,
const std::vector< bool > &  featureBits,
HcalTriggerPrimitiveDigi tp 
) const
virtual

Implements HcalTPGCoder.

Definition at line 35 of file HcaluLUTTPGCoder.cc.

References edm::hlt::Exception.

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

Definition at line 314 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and inputLUT_.

314  {
315  int lutId = getLUTId(id);
316  return inputLUT_.at(lutId);
317 }
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 309 of file HcaluLUTTPGCoder.cc.

References gain_, and getLUTId().

309  {
310  int lutId = getLUTId(id);
311  return gain_.at(lutId);
312 }
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 42 of file HcaluLUTTPGCoder.cc.

References cond::rpcobgas::detid, HcalEndcap, and HcalForward.

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

42  {
43  int detid = 0;
44  if (id == HcalEndcap) detid = 1;
45  else if (id == HcalForward) detid = 2;
46  return iphi + 72 * ((ieta + 41) + 83 * (depth + 3 * detid)) - 7777;
47 }
int HcaluLUTTPGCoder::getLUTId ( uint32_t  rawid) const

Definition at line 49 of file HcaluLUTTPGCoder.cc.

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

49  {
50  HcalDetId detid(rawid);
51  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
52 }
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int HcaluLUTTPGCoder::getLUTId ( const HcalDetId detid) const

Definition at line 54 of file HcaluLUTTPGCoder.cc.

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

54  {
55  return getLUTId(detid.subdet(), detid.ieta(), detid.iphi(), detid.depth());
56 }
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:32
int depth() const
get the tower depth
Definition: HcalDetId.h:42
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
int iphi() const
get the cell iphi
Definition: HcalDetId.h:40
float HcaluLUTTPGCoder::getLUTPedestal ( HcalDetId  id) const
virtual

Implements HcalTPGCoder.

Definition at line 304 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and ped_.

304  {
305  int lutId = getLUTId(id);
306  return ped_.at(lutId);
307 }
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 325 of file HcaluLUTTPGCoder.cc.

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

Referenced by lookupMSB().

325  {
326  int lutId = getLUTId(id);
327  const Lut& lut = inputLUT_.at(lutId);
328  return (lut.at(adc) & 0x400);
329 }
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:33
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::lookupMSB ( const HBHEDataFrame df,
std::vector< bool > &  msb 
) const

Definition at line 319 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

319  {
320  msb.resize(df.size());
321  for (int i=0; i<df.size(); ++i)
322  msb[i] = getMSB(df.id(), df.sample(i).adc());
323 }
int i
Definition: DBlmapReader.cc:9
int adc() const
get the ADC sample
Definition: HcalQIESample.h:24
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
void HcaluLUTTPGCoder::setMaskBit ( int  bit)
inline

Definition at line 47 of file HcaluLUTTPGCoder.h.

References bitToMask_.

Referenced by HcalTPGCoderULUT::HcalTPGCoderULUT().

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

Definition at line 184 of file HcaluLUTTPGCoder.cc.

References abs, ecalMGPA::adc(), HcalCoderDb::adc2fC(), adc2fC, bitToMask_, HcalQIECoder::charge(), 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_, lsb_, LUTGenerationMode_, HcalCalibrations::LUTrespcorrgain(), max(), min, evf::evtn::offset(), ped_, HcalCalibrations::pedestal(), HBHEDataFrame::setSample(), HFDataFrame::setSample(), HFDataFrame::setSize(), HBHEDataFrame::setSize(), ntuplemaker::status, subdets, theHFEtaBounds, and HcalDetId::validDetId().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), python.seqvaluedict.seqdict::__setslice__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), HcalTPGCoderULUT::dbRecordCallback(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), python.seqvaluedict.seqdict::extend(), progressbar.ProgressBar::finish(), HcalTPGCoderULUT::HcalTPGCoderULUT(), 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(), relval_steps.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().

184  {
185 
186  const HcalQIEShape* shape = conditions.getHcalShape();
187  HcalCalibrations calibrations;
188  const HcalLutMetadata *metadata = conditions.getHcalLutMetadata();
189  assert(metadata !=0);
190  float nominalgain_ = metadata->getNominalGain();
191 
192  std::map<int, float> cosh_ieta;
193  for (int i = 0; i < 13; ++i)
194  cosh_ieta[i+29] = cosh((theHFEtaBounds[i+1] + theHFEtaBounds[i])/2.);
195 
197  for (int isub = 0; isub < 3; ++isub){
198  HcalSubdetector subdet = subdets[isub];
199  for (int ieta = -41; ieta <= 41; ++ieta){
200  for (int iphi = 1; iphi <= 72; ++iphi){
201  for (int depth = 1; depth <= 3; ++depth){
202  if (!HcalDetId::validDetId(subdet, ieta, iphi, depth)) continue;
203 
204  HcalDetId cell(subdet, ieta, iphi, depth);
205  const HcalQIECoder* channelCoder = conditions.getHcalCoder (cell);
206  HcalCoderDb coder (*channelCoder, *shape);
207  const HcalLutMetadatum *meta = metadata->getValues(cell);
208 
209 
210  int lutId = getLUTId(subdet, ieta, iphi, depth);
211  float ped = 0;
212  float gain = 0;
213  uint32_t status = 0;
214 
215  if (LUTGenerationMode_){
216  const HcalCalibrations& calibrations = conditions.getHcalCalibrations(cell);
217  for (int capId = 0; capId < 4; ++capId){
218  ped += calibrations.pedestal(capId);
219  gain += calibrations.LUTrespcorrgain(capId);
220  }
221  ped /= 4.0;
222  gain /= 4.0;
223 
224  //Get Channel Quality
225  const HcalChannelStatus* channelStatus = conditions.getHcalChannelStatus(cell);
226  status = channelStatus->getValue();
227  }
228  else {
229  const HcalL1TriggerObject* myL1TObj = conditions.getHcalL1TriggerObject(cell);
230  ped = myL1TObj->getPedestal();
231  gain = myL1TObj->getRespGain();
232  status = myL1TObj->getFlag();
233  } // LUTGenerationMode_
234 
235  ped_[lutId] = ped;
236  gain_[lutId] = gain;
237  bool isMasked = ( (status & bitToMask_) > 0 );
238  float rcalib = meta->getRCalib();
239 
240  // Input LUT for HB/HE/HF
241  if (subdet == HcalBarrel || subdet == HcalEndcap){
242  HBHEDataFrame frame(cell);
243  frame.setSize(1);
244  CaloSamples samples(cell, 1);
245 
246  int granularity = meta->getLutGranularity();
247 
248  for (int adc = 0; adc <= 0x7F; ++adc) {
249  frame.setSample(0,HcalQIESample(adc));
250  coder.adc2fC(frame,samples);
251  float adc2fC = samples[0];
252 
253  if (isMasked) inputLUT_[lutId][adc] = 0;
254  else inputLUT_[lutId][adc] = (LutElement) std::min(std::max(0, int((adc2fC -ped) * gain * rcalib / nominalgain_ / granularity)), 0x3FF);
255  }
256  } // endif HBHE
257  else if (subdet == HcalForward){
258  HFDataFrame frame(cell);
259  frame.setSize(1);
260  CaloSamples samples(cell, 1);
261 
262  float one_adc2fC = 0.0;
263  for (int capId = 0; capId < 4; ++capId)
264  one_adc2fC += channelCoder->charge(*shape, 1, capId) - channelCoder->charge(*shape, 0, capId);
265  one_adc2fC /= 4.0;
266  // Lumi offset of 1 adc (in fC) for the four rings used to measure lumi
267  float offset = (abs(ieta) >= 33 && abs(ieta) <= 36) ? one_adc2fC : 0;
268 
269  for (int adc = 0; adc <= 0x7F; ++adc) {
270  frame.setSample(0,HcalQIESample(adc));
271  coder.adc2fC(frame,samples);
272  float adc2fC = samples[0];
273  if (isMasked) inputLUT_[lutId][adc] = 0;
274  else inputLUT_[lutId][adc] = std::min(std::max(0,int((adc2fC - ped + offset) * gain * rcalib / lsb_ / cosh_ieta[abs(ieta)] )), 0x3FF);
275  }
276  } // endif HF
277  } // for depth
278  } // for iphi
279  } // for iphi
280  }// for subdet
281 }
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
#define abs(x)
Definition: mlp_lapack.h:159
static const float lsb_
#define min(a, b)
Definition: mlp_lapack.h:161
double pedestal(int fCapId) const
get pedestal for capid=0..3
uint8_t getLutGranularity() const
static const float adc2fC[128]
static bool validDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth)
Definition: HcalDetId.cc:70
unsigned short LutElement
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
float getRespGain() const
static std::string subdets[11]
const T & max(const T &a, const T &b)
float getNominalGain() const
float getRCalib() const
const HcalL1TriggerObject * getHcalL1TriggerObject(const HcalGenericDetId &fId) const
HcalSubdetector
Definition: HcalAssistant.h:32
const HcalLutMetadata * getHcalLutMetadata() const
unsigned int offset(bool)
double LUTrespcorrgain(int fCapId) const
get LUT corrected and response corrected gain for capid=0..3
std::vector< float > ped_
std::vector< float > gain_
static const double theHFEtaBounds[]
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
tuple status
Definition: ntuplemaker.py:245
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
const Item * getValues(DetId fId) const
const HcalQIEShape * getHcalShape() const
std::vector< Lut > inputLUT_
float charge(const HcalQIEShape &fShape, unsigned fAdc, unsigned fCapId) const
ADC [0..127] + capid [0..3] -&gt; fC conversion.
Definition: HcalQIECoder.cc:22
void HcaluLUTTPGCoder::update ( const char *  filename,
bool  appendMSB = false 
)

Definition at line 58 of file HcaluLUTTPGCoder.cc.

References ecalMGPA::adc(), mergeVDriftHistosByStation::file, getLUTId(), HcalBarrel, HcalEndcap, HcalForward, i, errorMatrix2Lands_multiChannel::id, recoMuon::in, getHLTprescales::index, INPUT_LUT_SIZE, inputLUT_, findQualityFiles::size, and HcalDetId::validDetId().

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), python.seqvaluedict.seqdict::__setslice__(), 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(), python.seqvaluedict.seqdict::extend(), 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(), relval_steps.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().

58  {
59 
60  std::ifstream file(filename, std::ios::in);
61  assert(file.is_open());
62 
63  std::vector<HcalSubdetector> subdet;
64  std::string buffer;
65 
66  // Drop first (comment) line
67  std::getline(file, buffer);
68  std::getline(file, buffer);
69 
70  unsigned int index = buffer.find("H", 0);
71  while (index < buffer.length()){
72  std::string subdetStr = buffer.substr(index, 2);
73  if (subdetStr == "HB") subdet.push_back(HcalBarrel);
74  else if (subdetStr == "HE") subdet.push_back(HcalEndcap);
75  else if (subdetStr == "HF") subdet.push_back(HcalForward);
76  //TODO Check subdet
77  //else exception
78  index += 2;
79  index = buffer.find("H", index);
80  }
81 
82  // Get upper/lower ranges for ieta/iphi/depth
83  size_t nCol = subdet.size();
84  std::vector<int> ietaU;
85  std::vector<int> ietaL;
86  std::vector<int> iphiU;
87  std::vector<int> iphiL;
88  std::vector<int> depU;
89  std::vector<int> depL;
90  std::vector< Lut > lutFromFile(nCol);
91  LutElement lutValue;
92 
93  for (size_t i=0; i<nCol; ++i) {
94  int ieta;
95  file >> ieta;
96  ietaL.push_back(ieta);
97  }
98 
99  for (size_t i=0; i<nCol; ++i) {
100  int ieta;
101  file >> ieta;
102  ietaU.push_back(ieta);
103  }
104 
105  for (size_t i=0; i<nCol; ++i) {
106  int iphi;
107  file >> iphi;
108  iphiL.push_back(iphi);
109  }
110 
111  for (size_t i=0; i<nCol; ++i) {
112  int iphi;
113  file >> iphi;
114  iphiU.push_back(iphi);
115  }
116 
117  for (size_t i=0; i<nCol; ++i) {
118  int dep;
119  file >> dep;
120  depL.push_back(dep);
121  }
122 
123  for (size_t i=0; i<nCol; ++i) {
124  int dep;
125  file >> dep;
126  depU.push_back(dep);
127  }
128 
129  // Read Lut Entry
130  for (size_t i=0; file >> lutValue; i = (i+1) % nCol){
131  lutFromFile[i].push_back(lutValue);
132  }
133 
134  // Check lut size
135  for (size_t i=0; i<nCol; ++i) assert(lutFromFile[i].size() == INPUT_LUT_SIZE);
136 
137  for (size_t i=0; i<nCol; ++i){
138  for (int ieta = ietaL[i]; ieta <= ietaU[i]; ++ieta){
139  for (int iphi = iphiL[i]; iphi <= iphiU[i]; ++iphi){
140  for (int depth = depL[i]; depth <= depU[i]; ++depth){
141  if (!HcalDetId::validDetId(subdet[i], ieta, iphi, depth)) continue;
142  HcalDetId id(subdet[i], ieta, iphi, depth);
143  int lutId = getLUTId(id);
144  for (size_t adc = 0; adc < INPUT_LUT_SIZE; ++adc){
145  if (appendMSB){
146  // Append FG bit LUT to MSB
147  // MSB = Most Significant Bit = bit 10
148  // Overwrite bit 10
149  LutElement msb = (lutFromFile[i][adc] != 0 ? 0x400 : 0);
150  inputLUT_[lutId][adc] = (msb | (inputLUT_[lutId][adc] & 0x3FF));
151  }
152  else inputLUT_[lutId][adc] = lutFromFile[i][adc];
153  }// for adc
154  }// for depth
155  }// for iphi
156  }// for ieta
157  }// for nCol
158 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
static bool validDetId(HcalSubdetector subdet, int tower_ieta, int tower_iphi, int depth)
Definition: HcalDetId.cc:70
unsigned short LutElement
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) 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 160 of file HcaluLUTTPGCoder.cc.

References LutXml::create_lut_map(), cond::rpcobgas::detid, edm::hlt::Exception, XMLProcessor::getInstance(), LutXml::getLutFast(), getLUTId(), HcalBarrel, HcalEndcap, HcalForward, i, inputLUT_, lumiPlot::lut, XMLProcessor::terminate(), and HcalTopology::valid().

Referenced by HcalTPGCoderULUT::HcalTPGCoderULUT().

160  {
161  HcalTopology theTopo;
162  LutXml * _xml = new LutXml(filename);
163  _xml->create_lut_map();
165  for (int ieta=-41; ieta<=41; ++ieta){
166  for (int iphi=1; iphi<=72; ++iphi){
167  for (int depth=1; depth<=3; ++depth){
168  for (int isub=0; isub<3; ++isub){
169  HcalDetId detid(subdet[isub], ieta, iphi, depth);
170  if (!theTopo.valid(detid)) continue;
171  int id = getLUTId(subdet[isub], ieta, iphi, depth);
172  std::vector<unsigned int>* lut = _xml->getLutFast(detid);
173  if (lut==0) throw cms::Exception("PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
174  if (lut->size()!=128) throw cms::Exception ("PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
175  for (int i=0; i<128; ++i) inputLUT_[id][i] = (LutElement)lut->at(i);
176  }
177  }
178  }
179  }
180  delete _xml;
182 }
int i
Definition: DBlmapReader.cc:9
Definition: LutXml.h:28
virtual bool valid(const HcalDetId &id) const
Definition: HcalTopology.cc:32
int create_lut_map(void)
Definition: LutXml.cc:497
unsigned short LutElement
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int terminate(void)
HcalSubdetector
Definition: HcalAssistant.h:32
tuple lut
Definition: lumiPlot.py:244
std::vector< unsigned int > * getLutFast(uint32_t det_id)
Definition: LutXml.cc:127
tuple filename
Definition: lut2db_cfg.py:20
static XMLProcessor * getInstance()
Definition: XMLProcessor.h:147
std::vector< Lut > inputLUT_

Member Data Documentation

int HcaluLUTTPGCoder::bitToMask_
private

Definition at line 66 of file HcaluLUTTPGCoder.h.

Referenced by setMaskBit(), and update().

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

Definition at line 68 of file HcaluLUTTPGCoder.h.

Referenced by getLUTGain(), and update().

const size_t HcaluLUTTPGCoder::INPUT_LUT_SIZE = 128
staticprivate

Definition at line 61 of file HcaluLUTTPGCoder.h.

Referenced by update().

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

Definition at line 67 of file HcaluLUTTPGCoder.h.

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

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

Definition at line 62 of file HcaluLUTTPGCoder.h.

Referenced by update().

bool HcaluLUTTPGCoder::LUTGenerationMode_
private

Definition at line 65 of file HcaluLUTTPGCoder.h.

Referenced by setLUTGenerationMode(), and update().

const size_t HcaluLUTTPGCoder::nluts = 46007
staticprivate

Definition at line 61 of file HcaluLUTTPGCoder.h.

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

Definition at line 69 of file HcaluLUTTPGCoder.h.

Referenced by getLUTPedestal(), and update().