CMS 3D CMS Logo

Public Member Functions | Private Attributes

tnp::ProbeFlag Class Reference

#include <BaseTreeFiller.h>

List of all members.

Public Member Functions

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

Private Attributes

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

Detailed Description

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

                                                               :
            name_(name), external_(false), cut_(cut) {}
tnp::ProbeFlag::ProbeFlag ( const std::string &  name,
const edm::InputTag src 
) [inline]

Create a ProbeFlag to be read from a ValueMap.

Definition at line 88 of file BaseTreeFiller.h.

                                                                 :
            name_(name), external_(true), cut_(""), src_(src) {}
tnp::ProbeFlag::~ProbeFlag ( )

Destructor (does nothing)

Definition at line 21 of file BaseTreeFiller.cc.

{}

Member Function Documentation

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

Addess for ROOT Branch.

Definition at line 95 of file BaseTreeFiller.h.

References value_.

{ return &value_; }
void tnp::ProbeFlag::fill ( const reco::CandidateBaseRef probe) const

To be called for each item.

Definition at line 33 of file BaseTreeFiller.cc.

References spr::find().

                                                               {
    if (external_) {
        value_ = (std::find(passingProbes_.begin(), passingProbes_.end(), probe) != passingProbes_.end());
    } else {
        value_ = bool(cut_(*probe));
    }
}
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 23 of file BaseTreeFiller.cc.

References edm::Event::getByLabel(), i, and n.

                                                    {
    if (external_) {
        edm::Handle<edm::View<reco::Candidate> > view;
        iEvent.getByLabel(src_, view);
        passingProbes_.clear();
        for (size_t i = 0, n = view->size(); i < n; ++i) passingProbes_.push_back(view->refAt(i));
    }

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

name

Definition at line 98 of file BaseTreeFiller.h.

References name_.

{ return name_; }

Member Data Documentation

implementation of the cut using a string selector

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

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

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

Definition at line 108 of file BaseTreeFiller.h.

Referenced by name().

std::vector<reco::CandidateBaseRef> tnp::ProbeFlag::passingProbes_ [mutable, private]

the handle to keep the refs to the passing probes

Definition at line 122 of file BaseTreeFiller.h.

the external collection

Definition at line 120 of file BaseTreeFiller.h.

int32_t tnp::ProbeFlag::value_ [mutable, private]

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

Definition at line 110 of file BaseTreeFiller.h.

Referenced by address().