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 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 286 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

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

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

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

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

302  {
303  int lutId = getLUTId(id);
304  return ((inputLUT_.at(lutId)).at(sample.adc()) & 0x3FF);
305 }
int adc() const
get the ADC sample
Definition: HcalQIESample.h:22
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 317 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and inputLUT_.

317  {
318  int lutId = getLUTId(id);
319  return inputLUT_.at(lutId);
320 }
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 312 of file HcaluLUTTPGCoder.cc.

References gain_, and getLUTId().

312  {
313  int lutId = getLUTId(id);
314  return gain_.at(lutId);
315 }
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:30
int depth() const
get the tower depth
Definition: HcalDetId.h:40
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
float HcaluLUTTPGCoder::getLUTPedestal ( HcalDetId  id) const
virtual

Implements HcalTPGCoder.

Definition at line 307 of file HcaluLUTTPGCoder.cc.

References getLUTId(), and ped_.

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

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

Referenced by lookupMSB().

328  {
329  int lutId = getLUTId(id);
330  const Lut& lut = inputLUT_.at(lutId);
331  return (lut.at(adc) & 0x400);
332 }
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 322 of file HcaluLUTTPGCoder.cc.

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

Referenced by HcalTriggerPrimitiveAlgo::addSignal().

322  {
323  msb.resize(df.size());
324  for (int i=0; i<df.size(); ++i)
325  msb[i] = getMSB(df.id(), df.sample(i).adc());
326 }
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 187 of file HcaluLUTTPGCoder.cc.

References funct::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(), bookConverter::min, evf::evtn::offset(), ped_, HcalCalibrations::pedestal(), HFDataFrame::setSample(), HBHEDataFrame::setSample(), HFDataFrame::setSize(), HBHEDataFrame::setSize(), ntuplemaker::status, subdets, theHFEtaBounds, HcalCondObjectContainerBase::topo(), and HcalTopology::valid().

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

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

Definition at line 58 of file HcaluLUTTPGCoder.cc.

References ecalMGPA::adc(), 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__(), 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  assert(nCol > 0);
85 
86  std::vector<int> ietaU;
87  std::vector<int> ietaL;
88  std::vector<int> iphiU;
89  std::vector<int> iphiL;
90  std::vector<int> depU;
91  std::vector<int> depL;
92  std::vector< Lut > lutFromFile(nCol);
93  LutElement lutValue;
94 
95  for (size_t i=0; i<nCol; ++i) {
96  int ieta;
97  file >> ieta;
98  ietaL.push_back(ieta);
99  }
100 
101  for (size_t i=0; i<nCol; ++i) {
102  int ieta;
103  file >> ieta;
104  ietaU.push_back(ieta);
105  }
106 
107  for (size_t i=0; i<nCol; ++i) {
108  int iphi;
109  file >> iphi;
110  iphiL.push_back(iphi);
111  }
112 
113  for (size_t i=0; i<nCol; ++i) {
114  int iphi;
115  file >> iphi;
116  iphiU.push_back(iphi);
117  }
118 
119  for (size_t i=0; i<nCol; ++i) {
120  int dep;
121  file >> dep;
122  depL.push_back(dep);
123  }
124 
125  for (size_t i=0; i<nCol; ++i) {
126  int dep;
127  file >> dep;
128  depU.push_back(dep);
129  }
130 
131  // Read Lut Entry
132  for (size_t i=0; file >> lutValue; i = (i+1) % nCol){
133  lutFromFile[i].push_back(lutValue);
134  }
135 
136  // Check lut size
137  for (size_t i=0; i<nCol; ++i) assert(lutFromFile[i].size() == INPUT_LUT_SIZE);
138 
139  for (size_t i=0; i<nCol; ++i){
140  for (int ieta = ietaL[i]; ieta <= ietaU[i]; ++ieta){
141  for (int iphi = iphiL[i]; iphi <= iphiU[i]; ++iphi){
142  for (int depth = depL[i]; depth <= depU[i]; ++depth){
143 
144  HcalDetId id(subdet[i], ieta, iphi, depth);
145  if (!theTopo.valid(id)) continue;
146 
147  int lutId = getLUTId(id);
148  for (size_t adc = 0; adc < INPUT_LUT_SIZE; ++adc){
149  if (appendMSB){
150  // Append FG bit LUT to MSB
151  // MSB = Most Significant Bit = bit 10
152  // Overwrite bit 10
153  LutElement msb = (lutFromFile[i][adc] != 0 ? 0x400 : 0);
154  inputLUT_[lutId][adc] = (msb | (inputLUT_[lutId][adc] & 0x3FF));
155  }
156  else inputLUT_[lutId][adc] = lutFromFile[i][adc];
157  }// for adc
158  }// for depth
159  }// for iphi
160  }// for ieta
161  }// for nCol
162 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
unsigned short LutElement
int getLUTId(HcalSubdetector id, int ieta, int iphi, int depth) const
virtual bool valid(const DetId &id) const
Definition: HcalTopology.cc:58
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 164 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::buildCoder().

164  {
165  LutXml * _xml = new LutXml(filename);
166  _xml->create_lut_map();
168  for (int ieta=-41; ieta<=41; ++ieta){
169  for (int iphi=1; iphi<=72; ++iphi){
170  for (int depth=1; depth<=3; ++depth){
171  for (int isub=0; isub<3; ++isub){
172  HcalDetId detid(subdet[isub], ieta, iphi, depth);
173  if (!theTopo.valid(detid)) continue;
174  int id = getLUTId(subdet[isub], ieta, iphi, depth);
175  std::vector<unsigned int>* lut = _xml->getLutFast(detid);
176  if (lut==0) throw cms::Exception("PROBLEM: No inputLUT_ in xml file for ") << detid << std::endl;
177  if (lut->size()!=128) throw cms::Exception ("PROBLEM: Wrong inputLUT_ size in xml file for ") << detid << std::endl;
178  for (int i=0; i<128; ++i) inputLUT_[id][i] = (LutElement)lut->at(i);
179  }
180  }
181  }
182  }
183  delete _xml;
185 }
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
Definition: HcalTopology.cc:58
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:146
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().