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, const HcalTopology &, bool appendMSB=false)
 
void updateXML (const char *filename, const HcalTopology &)
 
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)] ...
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 56 of file HcaluLUTTPGCoder.h.

typedef unsigned short HcaluLUTTPGCoder::LutElement
private

Definition at line 55 of file HcaluLUTTPGCoder.h.

Constructor & Destructor Documentation

HcaluLUTTPGCoder::HcaluLUTTPGCoder ( )

Definition at line 29 of file HcaluLUTTPGCoder.cc.

29  : LUTGenerationMode_(true), bitToMask_(0),
31  gain_(nluts, 0.), ped_ (nluts, 0.){
32 }
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 38 of file HcaluLUTTPGCoder.cc.

38  {
39 }

Member Function Documentation

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

Implements HcalTPGCoder.

Definition at line 282 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

282  {
283  int lutId = getLUTId(df.id());
284  const Lut& lut = inputLUT_.at(lutId);
285  for (int i=0; i<df.size(); i++){
286  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
287  }
288 }
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 290 of file HcaluLUTTPGCoder.cc.

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

290  {
291  int lutId = getLUTId(df.id());
292  const Lut& lut = inputLUT_.at(lutId);
293  for (int i=0; i<df.size(); i++){
294  ics[i] = (lut.at(df[i].adc()) & 0x3FF);
295  }
296 }
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 298 of file HcaluLUTTPGCoder.cc.

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

298  {
299  int lutId = getLUTId(id);
300  return ((inputLUT_.at(lutId)).at(sample.adc()) & 0x3FF);
301 }
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 34 of file HcaluLUTTPGCoder.cc.

References Exception.

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

Definition at line 313 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and inputLUT_.

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

References gain_, and getLUTId().

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

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

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

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

Definition at line 48 of file HcaluLUTTPGCoder.cc.

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

Referenced by getLUTId().

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

Definition at line 53 of file HcaluLUTTPGCoder.cc.

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

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

Implements HcalTPGCoder.

Definition at line 303 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and ped_.

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

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

Referenced by lookupMSB().

324  {
325  int lutId = getLUTId(id);
326  const Lut& lut = inputLUT_.at(lutId);
327  return (lut.at(adc) & 0x400);
328 }
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 318 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

318  {
319  msb.resize(df.size());
320  for (int i=0; i<df.size(); ++i)
321  msb[i] = getMSB(df.id(), df.sample(i).adc());
322 }
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 44 of file HcaluLUTTPGCoder.h.

References relval_steps::gen(), and LUTGenerationMode_.

Referenced by HcalTPGCoderULUT::buildCoder().

void HcaluLUTTPGCoder::setMaskBit ( int  bit)
inline

Definition at line 45 of file HcaluLUTTPGCoder.h.

References bitToMask_.

Referenced by HcalTPGCoderULUT::buildCoder().

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

Definition at line 186 of file HcaluLUTTPGCoder.cc.

References funct::abs(), ecalMGPA::adc(), HcalCoderDb::adc2fC(), adc2fC, assert(), bitToMask_, HLT_25ns14e33_v1_cff::depth, HcalTopology::etaRange(), EnergyCorrector::etas, HcalTopology::firstHFRing(), 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_, HcalTopology::lastHFRing(), lsb_, LUTGenerationMode_, HcalCalibrations::LUTrespcorrgain(), bookConverter::max, min(), ped_, HcalCalibrations::pedestal(), HBHEDataFrame::setSample(), HFDataFrame::setSample(), HFDataFrame::setSize(), HBHEDataFrame::setSize(), ntuplemaker::status, subdets, HcalCondObjectContainerBase::topo(), and HcalTopology::valid().

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

186  {
187 
188  HcalCalibrations calibrations;
189  const HcalLutMetadata *metadata = conditions.getHcalLutMetadata();
190  assert(metadata !=0);
191  float nominalgain_ = metadata->getNominalGain();
192 
193  std::map<int, float> cosh_ieta;
194  for (int i = metadata->topo()->firstHFRing(); i <= metadata->topo()->lastHFRing(); ++i){
195  std::pair<double,double> etas = metadata->topo()->etaRange(HcalForward,i);
196  double eta1 = etas.first;
197  double eta2 = etas.second;
198  cosh_ieta[i] = cosh((eta1 + eta2)/2.);
199  }
200 
202  for (int isub = 0; isub < 3; ++isub){
203  HcalSubdetector subdet = subdets[isub];
204  for (int ieta = -41; ieta <= 41; ++ieta){
205  for (int iphi = 1; iphi <= 72; ++iphi){
206  for (int depth = 1; depth <= 3; ++depth){
207  HcalDetId cell(subdet, ieta, iphi, depth);
208  if (!metadata->topo()->valid(cell)) continue;
209 
210  const HcalQIECoder* channelCoder = conditions.getHcalCoder (cell);
211  const HcalQIEShape* shape = conditions.getHcalShape(cell);
212  HcalCoderDb coder (*channelCoder, *shape);
213  const HcalLutMetadatum *meta = metadata->getValues(cell);
214 
215 
216  int lutId = getLUTId(subdet, ieta, iphi, depth);
217  float ped = 0;
218  float gain = 0;
219  uint32_t status = 0;
220 
221  if (LUTGenerationMode_){
222  const HcalCalibrations& calibrations = conditions.getHcalCalibrations(cell);
223  for (int capId = 0; capId < 4; ++capId){
224  ped += calibrations.pedestal(capId);
225  gain += calibrations.LUTrespcorrgain(capId);
226  }
227  ped /= 4.0;
228  gain /= 4.0;
229 
230  //Get Channel Quality
231  const HcalChannelStatus* channelStatus = conditions.getHcalChannelStatus(cell);
232  status = channelStatus->getValue();
233  }
234  else {
235  const HcalL1TriggerObject* myL1TObj = conditions.getHcalL1TriggerObject(cell);
236  ped = myL1TObj->getPedestal();
237  gain = myL1TObj->getRespGain();
238  status = myL1TObj->getFlag();
239  } // LUTGenerationMode_
240 
241  ped_[lutId] = ped;
242  gain_[lutId] = gain;
243  bool isMasked = ( (status & bitToMask_) > 0 );
244  float rcalib = meta->getRCalib();
245 
246  // Input LUT for HB/HE/HF
247  if (subdet == HcalBarrel || subdet == HcalEndcap){
248  HBHEDataFrame frame(cell);
249  frame.setSize(1);
250  CaloSamples samples(cell, 1);
251 
252  int granularity = meta->getLutGranularity();
253 
254  for (int adc = 0; adc <= 0x7F; ++adc) {
255  frame.setSample(0,HcalQIESample(adc));
256  coder.adc2fC(frame,samples);
257  float adc2fC = samples[0];
258 
259  if (isMasked) inputLUT_[lutId][adc] = 0;
260  else inputLUT_[lutId][adc] = (LutElement) std::min(std::max(0, int((adc2fC -ped) * gain * rcalib / nominalgain_ / granularity)), 0x3FF);
261  }
262  } // endif HBHE
263  else if (subdet == HcalForward){
264  HFDataFrame frame(cell);
265  frame.setSize(1);
266  CaloSamples samples(cell, 1);
267 
268  for (int adc = 0; adc <= 0x7F; ++adc) {
269  frame.setSample(0,HcalQIESample(adc));
270  coder.adc2fC(frame,samples);
271  float adc2fC = samples[0];
272  if (isMasked) inputLUT_[lutId][adc] = 0;
273  else inputLUT_[lutId][adc] = std::min(std::max(0,int((adc2fC - ped) * gain * rcalib / lsb_ / cosh_ieta[abs(ieta)] )), 0x3FF);
274  }
275  } // endif HF
276  } // for depth
277  } // for iphi
278  } // for iphi
279  }// for subdet
280 }
int adc(sample_type sample)
get the ADC sample (12 bits)
uint32_t getFlag() const
int firstHFRing() const
Definition: HcalTopology.h:87
float getPedestal() const
int i
Definition: DBlmapReader.cc:9
const HcalChannelStatus * getHcalChannelStatus(const HcalGenericDetId &fId) const
assert(m_qm.get())
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
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
int lastHFRing() const
Definition: HcalTopology.h:88
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]
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
tuple status
Definition: ntuplemaker.py:245
uint32_t getValue() const
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
const HcalTopology * topo() const
float adc2fC[128]
std::vector< Lut > inputLUT_
void HcaluLUTTPGCoder::update ( const char *  filename,
const HcalTopology theTopo,
bool  appendMSB = false 
)

Definition at line 57 of file HcaluLUTTPGCoder.cc.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.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(), 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().

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

Definition at line 163 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTPGCoderULUT::buildCoder().

163  {
164  LutXml * _xml = new LutXml(filename);
165  _xml->create_lut_map();
167  for (int ieta=-41; ieta<=41; ++ieta){
168  for (int iphi=1; iphi<=72; ++iphi){
169  for (int depth=1; depth<=3; ++depth){
170  for (int isub=0; isub<3; ++isub){
171  HcalDetId detid(subdet[isub], ieta, iphi, depth);
172  if (!theTopo.valid(detid)) continue;
173  int id = getLUTId(subdet[isub], ieta, iphi, depth);
174  std::vector<unsigned int>* lut = _xml->getLutFast(detid);
175  if (lut==0) throw cms::Exception("PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
176  if (lut->size()!=128) throw cms::Exception ("PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
177  for (int i=0; i<128; ++i) inputLUT_[id][i] = (LutElement)lut->at(i);
178  }
179  }
180  }
181  }
182  delete _xml;
184 }
int i
Definition: DBlmapReader.cc:9
Definition: LutXml.h:27
int create_lut_map(void)
Definition: LutXml.cc:496
unsigned short LutElement
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
virtual bool valid(const DetId &id) const
std::vector< unsigned int > * getLutFast(uint32_t det_id)
Definition: LutXml.cc:126
tuple filename
Definition: lut2db_cfg.py:20
static XMLProcessor * getInstance()
Definition: XMLProcessor.h:145
std::vector< Lut > inputLUT_

Member Data Documentation

int HcaluLUTTPGCoder::bitToMask_
private

Definition at line 64 of file HcaluLUTTPGCoder.h.

Referenced by setMaskBit(), and update().

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

Definition at line 66 of file HcaluLUTTPGCoder.h.

Referenced by getLUTGain(), and update().

const size_t HcaluLUTTPGCoder::INPUT_LUT_SIZE = 128
staticprivate

Definition at line 59 of file HcaluLUTTPGCoder.h.

Referenced by update().

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

Definition at line 65 of file HcaluLUTTPGCoder.h.

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

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

Definition at line 60 of file HcaluLUTTPGCoder.h.

Referenced by update().

bool HcaluLUTTPGCoder::LUTGenerationMode_
private

Definition at line 63 of file HcaluLUTTPGCoder.h.

Referenced by setLUTGenerationMode(), and update().

const size_t HcaluLUTTPGCoder::nluts = 46007
staticprivate

Definition at line 59 of file HcaluLUTTPGCoder.h.

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

Definition at line 67 of file HcaluLUTTPGCoder.h.

Referenced by getLUTPedestal(), and update().