CMS 3D CMS Logo

Public Member Functions | Private Attributes

PhysicsTools::TreeReader::Value Class Reference

List of all members.

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 (int index, bool multiple, bool optional, char type)
 Value ()
 ~Value ()

Private Attributes

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

Detailed Description

Definition at line 78 of file TreeReader.h.


Constructor & Destructor Documentation

PhysicsTools::TreeReader::Value::Value ( ) [inline]

Definition at line 80 of file TreeReader.h.

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

Definition at line 84 of file TreeReader.h.

{}

Member Function Documentation

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

Definition at line 401 of file TreeReader.cc.

References PhysicsTools::Variable::ValueList::add(), getHLTprescales::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.

{
        if (multiple) {
                switch(type) {
                    case 'D': {
                        const std::vector<Double_t> *values =
                                static_cast<const std::vector<Double_t>*>(ptr);
                        if (!values)
                                values = &reader->multiDouble[index].second;
                        for(std::vector<Double_t>::const_iterator iter =
                                values->begin(); iter != values->end(); iter++)
                                reader->values.add(name, *iter);
                        break;
                    }
                    case 'F': {
                        const std::vector<Float_t> *values =
                                static_cast<const std::vector<Float_t>*>(ptr);
                        if (!values)
                                values = &reader->multiFloat[index].second;
                        for(std::vector<Float_t>::const_iterator iter =
                                values->begin(); iter != values->end(); iter++)
                                reader->values.add(name, *iter);
                        break;
                    }
                    case 'I': {
                        const std::vector<Int_t> *values =
                                static_cast<const std::vector<Int_t>*>(ptr);
                        if (!values)
                                values = &reader->multiInt[index].second;
                        for(std::vector<Int_t>::const_iterator iter =
                                values->begin(); iter != values->end(); iter++)
                                reader->values.add(name, *iter);
                        break;
                    }
                    case 'B': {
                        const std::vector<Bool_t> *values =
                                static_cast<const std::vector<Bool_t>*>(ptr);
                        if (!values)
                                values = &reader->multiBool[index].second;
                        for(std::vector<Bool_t>::const_iterator iter =
                                values->begin(); iter != values->end(); iter++)
                                reader->values.add(name, *iter);
                        break;
                    }
                }
        } else {
                double value = 0.0;

                switch(type) {
                    case 'D':
                        value = ptr ? *(const Double_t*)ptr
                                    : reader->singleDouble[index];
                        break;
                    case 'F':
                        value = ptr ? *(const Float_t*)ptr
                                    : reader->singleFloat[index];
                        break;
                    case 'I':
                        value = ptr ? *(const Int_t*)ptr
                                    : reader->singleInt[index];
                        break;
                    case 'B':
                        value = ptr ? *(const Bool_t*)ptr
                                    : reader->singleBool[index];
                        break;
                }

                if (!optional || value != optVal)
                        reader->values.add(name, value);
        }
}
void PhysicsTools::TreeReader::Value::setBranchName ( const TString &  name) [inline]

Definition at line 88 of file TreeReader.h.

References name.

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

Definition at line 86 of file TreeReader.h.

References optional, and optVal.

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

Definition at line 90 of file TreeReader.h.

References ptr.

                { 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.

{
        if (ptr)
                return;

        void *value = 0;
        if (multiple) {
                switch(type) {
                    case 'D':
                        reader->multiDouble[index].first =
                                &reader->multiDouble[index].second;
                        value = &reader->multiDouble[index].first;
                        break;
                    case 'F':
                        reader->multiFloat[index].first =
                                &reader->multiFloat[index].second;
                        value = &reader->multiFloat[index].first;
                        break;
                    case 'I':
                        reader->multiInt[index].first =
                                &reader->multiInt[index].second;
                        value = &reader->multiInt[index].first;
                        break;
                    case 'B':
                        reader->multiBool[index].first = value;
                                &reader->multiBool[index].second;
                        value = &reader->multiBool[index].first;
                        break;
                }
        } else {
                switch(type) {
                    case 'D':
                        value = &reader->singleDouble[index];
                        break;
                    case 'F':
                        value = &reader->singleFloat[index];
                        break;
                    case 'I':
                        value = &reader->singleInt[index];
                        break;
                    case 'B':
                        value = &reader->singleBool[index];
                        break;
                }
        }

        reader->tree->SetBranchAddress(name, value);
}

Member Data Documentation

Definition at line 98 of file TreeReader.h.

Referenced by update().

Definition at line 100 of file TreeReader.h.

Referenced by update().

Definition at line 97 of file TreeReader.h.

Referenced by setBranchName(), and update().

Definition at line 99 of file TreeReader.h.

Referenced by setOpt().

Definition at line 101 of file TreeReader.h.

Referenced by setOpt().

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

Definition at line 103 of file TreeReader.h.

Referenced by setPtr(), and update().

Definition at line 102 of file TreeReader.h.