CMS 3D CMS Logo

Public Member Functions | Private Attributes

tnp::ProbeVariable Class Reference

A variable for the probe: can be a string expression or an external ValueMap<float> More...

#include <BaseTreeFiller.h>

List of all members.

Public Member Functions

float * address () const
 Addess for ROOT Branch.
void fill (const reco::CandidateBaseRef &probe) const
 To be called for each item.
void init (const edm::Event &iEvent) const
 To be called at the beginning of the event (will fetch ValueMap if needed)
const std::string & name () const
 name
 ProbeVariable (const std::string &name, const edm::InputTag &src)
 Create a ProbeVariable to be read from a ValueMap.
 ProbeVariable (const std::string &name, const std::string &expression)
 Create a ProbeVariable to be evaluated on the fly from a string expression.
 ~ProbeVariable ()
 Destructor (does nothing)

Private Attributes

bool external_
 true if it's an external ValueMap, false if it's a StringParser function
StringObjectFunction
< reco::Candidate, true > 
function_
 a lazy-parsed StringObjectFunction<reco::Candidate> that gets all the methods of daughter classes too
edm::Handle< edm::ValueMap
< float > > 
handle_
 the handle to keep the ValueMap
std::string name_
 the name of the variable, which becomes the ROOT branch name
edm::InputTag src_
 the external valuemap
float value_
 the place where we store the value, and that ROOT uses to fill the tree

Detailed Description

A variable for the probe: can be a string expression or an external ValueMap<float>

Definition at line 31 of file BaseTreeFiller.h.


Constructor & Destructor Documentation

tnp::ProbeVariable::ProbeVariable ( const std::string &  name,
const std::string &  expression 
) [inline]

Create a ProbeVariable to be evaluated on the fly from a string expression.

Definition at line 34 of file BaseTreeFiller.h.

                                                                          :
            name_(name), external_(false), function_(expression) {}
tnp::ProbeVariable::ProbeVariable ( const std::string &  name,
const edm::InputTag src 
) [inline]

Create a ProbeVariable to be read from a ValueMap.

Definition at line 38 of file BaseTreeFiller.h.

                                                                     :
            name_(name), external_(true), function_("-1"), src_(src) {}
tnp::ProbeVariable::~ProbeVariable ( )

Destructor (does nothing)

Definition at line 19 of file BaseTreeFiller.cc.

{}

Member Function Documentation

float* tnp::ProbeVariable::address ( ) const [inline]

Addess for ROOT Branch.

Definition at line 45 of file BaseTreeFiller.h.

References value_.

{ return &value_; }
void tnp::ProbeVariable::fill ( const reco::CandidateBaseRef probe) const [inline]

To be called for each item.

Definition at line 56 of file BaseTreeFiller.h.

References external_, function_, and value_.

                                                           {
            value_ = external_ ? (*handle_)[probe] : function_(*probe);
        }
void tnp::ProbeVariable::init ( const edm::Event iEvent) const [inline]

To be called at the beginning of the event (will fetch ValueMap if needed)

Definition at line 51 of file BaseTreeFiller.h.

References external_, edm::Event::getByLabel(), handle_, and src_.

                                                {
            if (external_) iEvent.getByLabel(src_, handle_);
        }
const std::string& tnp::ProbeVariable::name ( void  ) const [inline]

name

Definition at line 48 of file BaseTreeFiller.h.

References name_.

{ return name_; }

Member Data Documentation

true if it's an external ValueMap, false if it's a StringParser function

Definition at line 67 of file BaseTreeFiller.h.

Referenced by fill(), and init().

a lazy-parsed StringObjectFunction<reco::Candidate> that gets all the methods of daughter classes too

Definition at line 70 of file BaseTreeFiller.h.

Referenced by fill().

the handle to keep the ValueMap

Definition at line 78 of file BaseTreeFiller.h.

Referenced by init().

std::string tnp::ProbeVariable::name_ [private]

the name of the variable, which becomes the ROOT branch name

Definition at line 62 of file BaseTreeFiller.h.

Referenced by name().

the external valuemap

Definition at line 76 of file BaseTreeFiller.h.

Referenced by init().

float tnp::ProbeVariable::value_ [mutable, private]

the place where we store the value, and that ROOT uses to fill the tree

Definition at line 64 of file BaseTreeFiller.h.

Referenced by address(), and fill().