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
tnp::ProbeFlag Class Reference

#include <BaseTreeFiller.h>

Public Member Functions

int32_t * 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 Candidate View if needed) More...
 
const std::string & name () const
 name More...
 
 ProbeFlag (const std::string &name, const std::string &cut)
 Create a ProbeFlag to be evaluated on the fly from a string cut. More...
 
 ProbeFlag (const std::string &name, const edm::EDGetTokenT< edm::View< reco::Candidate > > &srcToken)
 Create a ProbeFlag to be read from a ValueMap. More...
 
 ~ProbeFlag ()
 Destructor (does nothing) More...
 

Private Attributes

StringCutObjectSelector
< reco::Candidate, true > 
cut_
 implementation of the cut using a string selector More...
 
bool external_
 true if it's an external Candidate View, false if it's a StringParser cut More...
 
std::string name_
 the name of the variable, which becomes the ROOT branch name More...
 
std::vector
< reco::CandidateBaseRef
passingProbes_
 the handle to keep the refs to the passing probes More...
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
srcToken_
 the external collection More...
 
int32_t value_
 the place where we store the value, and that ROOT uses to fill the tree More...
 

Detailed Description

Definition at line 91 of file BaseTreeFiller.h.

Constructor & Destructor Documentation

tnp::ProbeFlag::ProbeFlag ( const std::string &  name,
const std::string &  cut 
)
inline

Create a ProbeFlag to be evaluated on the fly from a string cut.

Definition at line 94 of file BaseTreeFiller.h.

94  :
95  name_(name), external_(false), cut_(cut) {}
std::string name_
the name of the variable, which becomes the ROOT branch name
StringCutObjectSelector< reco::Candidate, true > cut_
implementation of the cut using a string selector
bool external_
true if it&#39;s an external Candidate View, false if it&#39;s a StringParser cut
const std::string & name() const
name
tnp::ProbeFlag::ProbeFlag ( const std::string &  name,
const edm::EDGetTokenT< edm::View< reco::Candidate > > &  srcToken 
)
inline

Create a ProbeFlag to be read from a ValueMap.

Definition at line 98 of file BaseTreeFiller.h.

98  :
99  name_(name), external_(true), cut_(""), srcToken_(srcToken) {}
std::string name_
the name of the variable, which becomes the ROOT branch name
StringCutObjectSelector< reco::Candidate, true > cut_
implementation of the cut using a string selector
bool external_
true if it&#39;s an external Candidate View, false if it&#39;s a StringParser cut
const std::string & name() const
name
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
the external collection
tnp::ProbeFlag::~ProbeFlag ( )

Destructor (does nothing)

Definition at line 12 of file BaseTreeFiller.cc.

12 {}

Member Function Documentation

int32_t* tnp::ProbeFlag::address ( ) const
inline

Addess for ROOT Branch.

Definition at line 105 of file BaseTreeFiller.h.

References value_.

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

To be called for each item.

Definition at line 24 of file BaseTreeFiller.cc.

References spr::find().

24  {
25  if (external_) {
26  value_ = (std::find(passingProbes_.begin(), passingProbes_.end(), probe) != passingProbes_.end());
27  } else {
28  value_ = bool(cut_(*probe));
29  }
30 }
StringCutObjectSelector< reco::Candidate, true > cut_
implementation of the cut using a string selector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int32_t value_
the place where we store the value, and that ROOT uses to fill the tree
bool external_
true if it&#39;s an external Candidate View, false if it&#39;s a StringParser cut
std::vector< reco::CandidateBaseRef > passingProbes_
the handle to keep the refs to the passing probes
void tnp::ProbeFlag::init ( const edm::Event iEvent) const

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

Definition at line 14 of file BaseTreeFiller.cc.

References edm::Event::getByToken(), i, and gen::n.

14  {
15  if (external_) {
17  iEvent.getByToken(srcToken_, view);
18  passingProbes_.clear();
19  for (size_t i = 0, n = view->size(); i < n; ++i) passingProbes_.push_back(view->refAt(i));
20  }
21 
22 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
bool external_
true if it&#39;s an external Candidate View, false if it&#39;s a StringParser cut
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
the external collection
std::vector< reco::CandidateBaseRef > passingProbes_
the handle to keep the refs to the passing probes
const std::string& tnp::ProbeFlag::name ( void  ) const
inline

name

Definition at line 108 of file BaseTreeFiller.h.

References name_.

Referenced by cuy.divideElement::__init__(), cuy.plotElement::__init__(), cuy.additionElement::__init__(), cuy.superimposeElement::__init__(), cuy.graphElement::__init__(), config.CFG::__str__(), and validation.Sample::digest().

108 { return name_; }
std::string name_
the name of the variable, which becomes the ROOT branch name

Member Data Documentation

StringCutObjectSelector<reco::Candidate,true> tnp::ProbeFlag::cut_
private

implementation of the cut using a string selector

Definition at line 126 of file BaseTreeFiller.h.

bool tnp::ProbeFlag::external_
private

true if it's an external Candidate View, false if it's a StringParser cut

Definition at line 123 of file BaseTreeFiller.h.

std::string tnp::ProbeFlag::name_
private

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

Definition at line 118 of file BaseTreeFiller.h.

Referenced by name().

std::vector<reco::CandidateBaseRef> tnp::ProbeFlag::passingProbes_
mutableprivate

the handle to keep the refs to the passing probes

Definition at line 132 of file BaseTreeFiller.h.

edm::EDGetTokenT<edm::View<reco::Candidate> > tnp::ProbeFlag::srcToken_
private

the external collection

Definition at line 130 of file BaseTreeFiller.h.

int32_t tnp::ProbeFlag::value_
mutableprivate

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

Definition at line 120 of file BaseTreeFiller.h.

Referenced by address().