CMS 3D CMS Logo

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 edm::EDGetTokenT< edm::View< reco::Candidate > > &srcToken)
 Create a ProbeFlag to be read from a ValueMap. 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 ()
 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::CandidateBaseRefpassingProbes_
 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 95 of file BaseTreeFiller.h.

Constructor & Destructor Documentation

◆ ProbeFlag() [1/2]

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 98 of file BaseTreeFiller.h.

98 : name_(name), external_(false), cut_(cut) {}

◆ ProbeFlag() [2/2]

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 101 of file BaseTreeFiller.h.

102  : name_(name), external_(true), cut_(""), srcToken_(srcToken) {}

◆ ~ProbeFlag()

tnp::ProbeFlag::~ProbeFlag ( )

Destructor (does nothing)

Definition at line 13 of file BaseTreeFiller.cc.

13 {}

Member Function Documentation

◆ address()

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

Addess for ROOT Branch.

Definition at line 108 of file BaseTreeFiller.h.

108 { return &value_; }

References value_.

◆ fill()

void tnp::ProbeFlag::fill ( const reco::CandidateBaseRef probe) const

To be called for each item.

Definition at line 25 of file BaseTreeFiller.cc.

25  {
26  if (external_) {
27  value_ = (std::find(passingProbes_.begin(), passingProbes_.end(), probe) != passingProbes_.end());
28  } else {
29  value_ = bool(cut_(*probe));
30  }
31 }

References electrons_cff::bool, and spr::find().

◆ init()

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 15 of file BaseTreeFiller.cc.

15  {
16  if (external_) {
18  iEvent.getByToken(srcToken_, view);
19  passingProbes_.clear();
20  for (size_t i = 0, n = view->size(); i < n; ++i)
21  passingProbes_.push_back(view->refAt(i));
22  }
23 }

References mps_fire::i, iEvent, and dqmiodumpmetadata::n.

◆ name()

const std::string& tnp::ProbeFlag::name ( void  ) const
inline

name

Definition at line 111 of file BaseTreeFiller.h.

111 { return name_; }

References name_.

Referenced by config.CFG::__str__(), and validation.Sample::digest().

Member Data Documentation

◆ cut_

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

implementation of the cut using a string selector

Definition at line 129 of file BaseTreeFiller.h.

◆ external_

bool tnp::ProbeFlag::external_
private

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

Definition at line 126 of file BaseTreeFiller.h.

◆ name_

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

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

Definition at line 121 of file BaseTreeFiller.h.

Referenced by name().

◆ passingProbes_

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

the handle to keep the refs to the passing probes

Definition at line 135 of file BaseTreeFiller.h.

◆ srcToken_

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

the external collection

Definition at line 133 of file BaseTreeFiller.h.

◆ value_

int32_t tnp::ProbeFlag::value_
mutableprivate

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

Definition at line 123 of file BaseTreeFiller.h.

Referenced by address().

electrons_cff.bool
bool
Definition: electrons_cff.py:366
mps_fire.i
i
Definition: mps_fire.py:428
tnp::ProbeFlag::value_
int32_t value_
the place where we store the value, and that ROOT uses to fill the tree
Definition: BaseTreeFiller.h:123
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
TkAlMuonSelectors_cfi.cut
cut
Definition: TkAlMuonSelectors_cfi.py:5
tnp::ProbeFlag::external_
bool external_
true if it's an external Candidate View, false if it's a StringParser cut
Definition: BaseTreeFiller.h:126
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle
Definition: AssociativeIterator.h:50
L1Validator_cfi.srcToken
srcToken
Definition: L1Validator_cfi.py:8
tnp::ProbeFlag::name
const std::string & name() const
name
Definition: BaseTreeFiller.h:111
tnp::ProbeFlag::srcToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > srcToken_
the external collection
Definition: BaseTreeFiller.h:133
tnp::ProbeFlag::passingProbes_
std::vector< reco::CandidateBaseRef > passingProbes_
the handle to keep the refs to the passing probes
Definition: BaseTreeFiller.h:135
iEvent
int iEvent
Definition: GenABIO.cc:224
tnp::ProbeFlag::cut_
StringCutObjectSelector< reco::Candidate, true > cut_
implementation of the cut using a string selector
Definition: BaseTreeFiller.h:129
tnp::ProbeFlag::name_
std::string name_
the name of the variable, which becomes the ROOT branch name
Definition: BaseTreeFiller.h:121