test
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 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 65 of file TreeReader.h.

Constructor & Destructor Documentation

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

Definition at line 67 of file TreeReader.h.

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

Definition at line 71 of file TreeReader.h.

71 {}

Member Function Documentation

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

Definition at line 400 of file TreeReader.cc.

References PhysicsTools::Variable::ValueList::add(), cmsHarvester::index, PhysicsTools::TreeReader::multiBool, PhysicsTools::TreeReader::multiDouble, PhysicsTools::TreeReader::multiFloat, PhysicsTools::TreeReader::multiInt, PhysicsTools::TreeReader::singleBool, PhysicsTools::TreeReader::singleDouble, PhysicsTools::TreeReader::singleFloat, PhysicsTools::TreeReader::singleInt, relativeConstraints::value, and PhysicsTools::TreeReader::values.

401 {
402  if (multiple) {
403  switch(type) {
404  case 'D': {
405  const std::vector<Double_t> *values =
406  static_cast<const std::vector<Double_t>*>(ptr);
407  if (!values)
408  values = &reader->multiDouble[index].second;
409  for(std::vector<Double_t>::const_iterator iter =
410  values->begin(); iter != values->end(); iter++)
411  reader->values.add(name, *iter);
412  break;
413  }
414  case 'F': {
415  const std::vector<Float_t> *values =
416  static_cast<const std::vector<Float_t>*>(ptr);
417  if (!values)
418  values = &reader->multiFloat[index].second;
419  for(std::vector<Float_t>::const_iterator iter =
420  values->begin(); iter != values->end(); iter++)
421  reader->values.add(name, *iter);
422  break;
423  }
424  case 'I': {
425  const std::vector<Int_t> *values =
426  static_cast<const std::vector<Int_t>*>(ptr);
427  if (!values)
428  values = &reader->multiInt[index].second;
429  for(std::vector<Int_t>::const_iterator iter =
430  values->begin(); iter != values->end(); iter++)
431  reader->values.add(name, *iter);
432  break;
433  }
434  case 'B': {
435  const std::vector<Bool_t> *values =
436  static_cast<const std::vector<Bool_t>*>(ptr);
437  if (!values)
438  values = &reader->multiBool[index].second;
439  for(std::vector<Bool_t>::const_iterator iter =
440  values->begin(); iter != values->end(); iter++)
441  reader->values.add(name, *iter);
442  break;
443  }
444  }
445  } else {
446  double value = 0.0;
447 
448  switch(type) {
449  case 'D':
450  value = ptr ? *(const Double_t*)ptr
451  : reader->singleDouble[index];
452  break;
453  case 'F':
454  value = ptr ? *(const Float_t*)ptr
455  : reader->singleFloat[index];
456  break;
457  case 'I':
458  value = ptr ? *(const Int_t*)ptr
459  : reader->singleInt[index];
460  break;
461  case 'B':
462  value = ptr ? *(const Bool_t*)ptr
463  : reader->singleBool[index];
464  break;
465  }
466 
467  if (!optional || value != optVal)
468  reader->values.add(name, value);
469  }
470 }
type
Definition: HCALResponse.h:21
Variable::ValueList values
Definition: TreeReader.h:109
void PhysicsTools::TreeReader::Value::setBranchName ( const TString &  name)
inline

Definition at line 75 of file TreeReader.h.

References name.

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

Definition at line 73 of file TreeReader.h.

References optional, and optVal.

74  { this->optional = opt, this->optVal = optVal; }
void PhysicsTools::TreeReader::Value::setPtr ( const void *  ptr)
inline

Definition at line 77 of file TreeReader.h.

References ptr.

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

Definition at line 352 of file TreeReader.cc.

References index, PhysicsTools::TreeReader::multiBool, PhysicsTools::TreeReader::multiDouble, PhysicsTools::TreeReader::multiFloat, PhysicsTools::TreeReader::multiInt, multiple, name, ptr, 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().

353 {
354  if (ptr)
355  return;
356 
357  void *value = 0;
358  if (multiple) {
359  switch(type) {
360  case 'D':
361  reader->multiDouble[index].first =
362  &reader->multiDouble[index].second;
363  value = &reader->multiDouble[index].first;
364  break;
365  case 'F':
366  reader->multiFloat[index].first =
367  &reader->multiFloat[index].second;
368  value = &reader->multiFloat[index].first;
369  break;
370  case 'I':
371  reader->multiInt[index].first =
372  &reader->multiInt[index].second;
373  value = &reader->multiInt[index].first;
374  break;
375  case 'B':
376  reader->multiBool[index].first = value;
377  value = &reader->multiBool[index].first;
378  break;
379  }
380  } else {
381  switch(type) {
382  case 'D':
383  value = &reader->singleDouble[index];
384  break;
385  case 'F':
386  value = &reader->singleFloat[index];
387  break;
388  case 'I':
389  value = &reader->singleInt[index];
390  break;
391  case 'B':
392  value = &reader->singleBool[index];
393  break;
394  }
395  }
396 
397  reader->tree->SetBranchAddress(name, value);
398 }
type
Definition: HCALResponse.h:21

Member Data Documentation

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

Definition at line 85 of file TreeReader.h.

Referenced by BeautifulSoup.PageElement::_invert(), and update().

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

Definition at line 87 of file TreeReader.h.

Referenced by update().

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

Definition at line 86 of file TreeReader.h.

Referenced by setOpt().

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

Definition at line 88 of file TreeReader.h.

Referenced by setOpt().

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

Definition at line 90 of file TreeReader.h.

Referenced by setPtr(), and update().

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