CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PhysicsTools::TreeReader::Value Class Reference

#include <TreeReader.h>

Public Member Functions

void fill (AtomicId name, TreeReader *reader) const
 
void setBranchName (const TString &name)
 
void setOpt (bool opt, double optVal)
 
void setPtr (const void *ptr)
 
void update (TreeReader *reader) const
 
 Value ()
 
 Value (int index, bool multiple, bool optional, char type)
 
 ~Value ()
 

Private Attributes

int index
 
bool multiple
 
TString name
 
bool optional
 
double optVal
 
const void * ptr
 
char type
 

Detailed Description

Definition at line 62 of file TreeReader.h.

Constructor & Destructor Documentation

PhysicsTools::TreeReader::Value::Value ( )
inline

Definition at line 64 of file TreeReader.h.

64 {}
PhysicsTools::TreeReader::Value::Value ( int  index,
bool  multiple,
bool  optional,
char  type 
)
inline
PhysicsTools::TreeReader::Value::~Value ( )
inline

Definition at line 72 of file TreeReader.h.

72 {}

Member Function Documentation

void PhysicsTools::TreeReader::Value::fill ( AtomicId  name,
TreeReader reader 
) const

Definition at line 348 of file TreeReader.cc.

References PhysicsTools::Variable::ValueList::add(), PhysicsTools::TreeReader::multiBool, PhysicsTools::TreeReader::multiDouble, PhysicsTools::TreeReader::multiFloat, PhysicsTools::TreeReader::multiInt, Types::optional, PhysicsTools::TreeReader::singleBool, PhysicsTools::TreeReader::singleDouble, PhysicsTools::TreeReader::singleFloat, PhysicsTools::TreeReader::singleInt, and PhysicsTools::TreeReader::values.

348  {
349  if (multiple) {
350  switch (type) {
351  case 'D': {
352  const std::vector<Double_t> *values = static_cast<const std::vector<Double_t> *>(ptr);
353  if (!values)
354  values = &reader->multiDouble[index].second;
355  for (std::vector<Double_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
356  reader->values.add(name, *iter);
357  break;
358  }
359  case 'F': {
360  const std::vector<Float_t> *values = static_cast<const std::vector<Float_t> *>(ptr);
361  if (!values)
362  values = &reader->multiFloat[index].second;
363  for (std::vector<Float_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
364  reader->values.add(name, *iter);
365  break;
366  }
367  case 'I': {
368  const std::vector<Int_t> *values = static_cast<const std::vector<Int_t> *>(ptr);
369  if (!values)
370  values = &reader->multiInt[index].second;
371  for (std::vector<Int_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
372  reader->values.add(name, *iter);
373  break;
374  }
375  case 'B': {
376  const std::vector<Bool_t> *values = static_cast<const std::vector<Bool_t> *>(ptr);
377  if (!values)
378  values = &reader->multiBool[index].second;
379  for (std::vector<Bool_t>::const_iterator iter = values->begin(); iter != values->end(); iter++)
380  reader->values.add(name, *iter);
381  break;
382  }
383  }
384  } else {
385  double value = 0.0;
386 
387  switch (type) {
388  case 'D':
389  value = ptr ? *(const Double_t *)ptr : reader->singleDouble[index];
390  break;
391  case 'F':
392  value = ptr ? *(const Float_t *)ptr : reader->singleFloat[index];
393  break;
394  case 'I':
395  value = ptr ? *(const Int_t *)ptr : reader->singleInt[index];
396  break;
397  case 'B':
398  value = ptr ? *(const Bool_t *)ptr : reader->singleBool[index];
399  break;
400  }
401 
402  if (!optional || value != optVal)
403  reader->values.add(name, value);
404  }
405  }
type
Definition: HCALResponse.h:21
Variable::ValueList values
Definition: TreeReader.h:107
reader
Definition: DQM.py:105
Definition: value.py:1
void PhysicsTools::TreeReader::Value::setBranchName ( const TString &  name)
inline

Definition at line 75 of file TreeReader.h.

References Skims_PA_cff::name.

75 { this->name = name; }
void PhysicsTools::TreeReader::Value::setOpt ( bool  opt,
double  optVal 
)
inline

Definition at line 74 of file TreeReader.h.

References runTheMatrix::opt, and Types::optional.

void PhysicsTools::TreeReader::Value::setPtr ( const void *  ptr)
inline

Definition at line 76 of file TreeReader.h.

References PhysicsTools::TreeReader::fill(), DQM::reader, and PhysicsTools::TreeReader::update().

76 { this->ptr = ptr; }
void PhysicsTools::TreeReader::Value::update ( TreeReader reader) const

Definition at line 304 of file TreeReader.cc.

References PhysicsTools::TreeReader::multiBool, PhysicsTools::TreeReader::multiDouble, PhysicsTools::TreeReader::multiFloat, PhysicsTools::TreeReader::multiInt, Skims_PA_cff::name, PhysicsTools::TreeReader::singleBool, PhysicsTools::TreeReader::singleDouble, PhysicsTools::TreeReader::singleFloat, PhysicsTools::TreeReader::singleInt, PhysicsTools::TreeReader::tree, and relativeConstraints::value.

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

304  {
305  if (ptr)
306  return;
307 
308  void *value = nullptr;
309  if (multiple) {
310  switch (type) {
311  case 'D':
312  reader->multiDouble[index].first = &reader->multiDouble[index].second;
313  value = &reader->multiDouble[index].first;
314  break;
315  case 'F':
316  reader->multiFloat[index].first = &reader->multiFloat[index].second;
317  value = &reader->multiFloat[index].first;
318  break;
319  case 'I':
320  reader->multiInt[index].first = &reader->multiInt[index].second;
321  value = &reader->multiInt[index].first;
322  break;
323  case 'B':
324  reader->multiBool[index].first = value;
325  value = &reader->multiBool[index].first;
326  break;
327  }
328  } else {
329  switch (type) {
330  case 'D':
331  value = &reader->singleDouble[index];
332  break;
333  case 'F':
334  value = &reader->singleFloat[index];
335  break;
336  case 'I':
337  value = &reader->singleInt[index];
338  break;
339  case 'B':
340  value = &reader->singleBool[index];
341  break;
342  }
343  }
344 
345  reader->tree->SetBranchAddress(name, value);
346  }
type
Definition: HCALResponse.h:21
reader
Definition: DQM.py:105
Definition: value.py:1

Member Data Documentation

int PhysicsTools::TreeReader::Value::index
private

Definition at line 83 of file TreeReader.h.

Referenced by BeautifulSoup.PageElement::insert().

bool PhysicsTools::TreeReader::Value::multiple
private

Definition at line 85 of file TreeReader.h.

TString PhysicsTools::TreeReader::Value::name
private
bool PhysicsTools::TreeReader::Value::optional
private

Definition at line 84 of file TreeReader.h.

double PhysicsTools::TreeReader::Value::optVal
private

Definition at line 86 of file TreeReader.h.

const void* PhysicsTools::TreeReader::Value::ptr
private

Definition at line 88 of file TreeReader.h.

char PhysicsTools::TreeReader::Value::type
private