CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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>

Public Member Functions

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

Private Attributes

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

Detailed Description

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

Definition at line 46 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 49 of file BaseTreeFiller.h.

50  : name_(name), external_(false), function_(expression) {}
bool external_
true if it&#39;s an external ValueMap, false if it&#39;s a StringParser function
std::string name_
the name of the variable, which becomes the ROOT branch name
const std::string & name() const
name
StringObjectFunction< reco::Candidate, true > function_
a lazy-parsed StringObjectFunction&lt;reco::Candidate&gt; that gets all the methods of daughter classes too...
tnp::ProbeVariable::ProbeVariable ( const std::string &  name,
const edm::EDGetTokenT< edm::ValueMap< float > > &  srcToken 
)
inline

Create a ProbeVariable to be read from a ValueMap.

Definition at line 53 of file BaseTreeFiller.h.

54  : name_(name), external_(true), function_("-1"), srcToken_(srcToken) {}
bool external_
true if it&#39;s an external ValueMap, false if it&#39;s a StringParser function
std::string name_
the name of the variable, which becomes the ROOT branch name
const std::string & name() const
name
StringObjectFunction< reco::Candidate, true > function_
a lazy-parsed StringObjectFunction&lt;reco::Candidate&gt; that gets all the methods of daughter classes too...
edm::EDGetTokenT< edm::ValueMap< float > > srcToken_
the external valuemap
tnp::ProbeVariable::~ProbeVariable ( )

Destructor (does nothing)

Definition at line 11 of file BaseTreeFiller.cc.

11 {}

Member Function Documentation

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

Addess for ROOT Branch.

Definition at line 60 of file BaseTreeFiller.h.

References value_.

60 { return &value_; }
float value_
the place where we store the value, and that ROOT uses to fill the tree
void tnp::ProbeVariable::fill ( const reco::CandidateBaseRef probe) const
inline

To be called for each item.

Definition at line 72 of file BaseTreeFiller.h.

References external_, function_, and value_.

72 { value_ = external_ ? (*handle_)[probe] : function_(*probe); }
bool external_
true if it&#39;s an external ValueMap, false if it&#39;s a StringParser function
StringObjectFunction< reco::Candidate, true > function_
a lazy-parsed StringObjectFunction&lt;reco::Candidate&gt; that gets all the methods of daughter classes too...
float value_
the place where we store the value, and that ROOT uses to fill the tree
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 66 of file BaseTreeFiller.h.

References external_, edm::Event::getByToken(), handle_, and srcToken_.

66  {
67  if (external_)
68  iEvent.getByToken(srcToken_, handle_);
69  }
bool external_
true if it&#39;s an external ValueMap, false if it&#39;s a StringParser function
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::Handle< edm::ValueMap< float > > handle_
the handle to keep the ValueMap
edm::EDGetTokenT< edm::ValueMap< float > > srcToken_
the external valuemap
const std::string& tnp::ProbeVariable::name ( void  ) const
inline

Member Data Documentation

bool tnp::ProbeVariable::external_
private

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

Definition at line 81 of file BaseTreeFiller.h.

Referenced by fill(), and init().

StringObjectFunction<reco::Candidate, true> tnp::ProbeVariable::function_
private

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

Definition at line 84 of file BaseTreeFiller.h.

Referenced by fill().

edm::Handle<edm::ValueMap<float> > tnp::ProbeVariable::handle_
mutableprivate

the handle to keep the ValueMap

Definition at line 92 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 76 of file BaseTreeFiller.h.

Referenced by name().

edm::EDGetTokenT<edm::ValueMap<float> > tnp::ProbeVariable::srcToken_
private

the external valuemap

Definition at line 90 of file BaseTreeFiller.h.

Referenced by init().

float tnp::ProbeVariable::value_
mutableprivate

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

Definition at line 78 of file BaseTreeFiller.h.

Referenced by address(), and fill().