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 Member Functions | Private Attributes
RawParticleTypeFilter Class Reference

#include <RawParticleTypeFilter.h>

Inheritance diagram for RawParticleTypeFilter:
BaseRawParticleFilter

Public Member Functions

void addAccept (const int id)
 
void addAccept (const std::string &name)
 
void addReject (const int id)
 
void addReject (const std::string &name)
 
 RawParticleTypeFilter ()
 
 RawParticleTypeFilter (const std::string &particleName)
 Construct a filter to accept particles of particleName. More...
 
 RawParticleTypeFilter (const std::string &particleName1, const std::string &particleName2)
 Construct a filter to accept particles of particleName1 or particleName2. More...
 
 RawParticleTypeFilter (const int pid)
 Construct a filter to accept particles with id pid. More...
 
 RawParticleTypeFilter (const int pid1, const int pid2)
 Construct a filter to accept particles with id pid1 or pid2. More...
 
virtual ~RawParticleTypeFilter ()
 
- Public Member Functions inherited from BaseRawParticleFilter
bool accept (const RawParticle &p) const
 
bool accept (const RawParticle *p) const
 
void addFilter (BaseRawParticleFilter *f)
 Add a BaseRawParticleFilter to be run after executing this one. More...
 
 BaseRawParticleFilter ()
 
virtual ~BaseRawParticleFilter ()
 

Private Member Functions

bool isAcceptable (const int id) const
 is this particle id in the list of acceptable particles? More...
 
bool isOKForMe (const RawParticle *p) const
 implemented as required by class BaseRawParticleFilter More...
 
bool isRejectable (const int id) const
 is this particle id in the list of rejectable particles? More...
 

Private Attributes

std::vector< int > myAcceptIDs
 
std::vector< int > myRejectIDs
 

Additional Inherited Members

Detailed Description

A RawParticle filter class. This class rejects or accepts RawParticles based on their pid(). It allows to either accept or (exclusive) reject particle types.

Author
Stephan Wynhoff

Definition at line 13 of file RawParticleTypeFilter.h.

Constructor & Destructor Documentation

RawParticleTypeFilter::RawParticleTypeFilter ( )
inline

Definition at line 16 of file RawParticleTypeFilter.h.

16 { ; };
RawParticleTypeFilter::RawParticleTypeFilter ( const std::string &  particleName)

Construct a filter to accept particles of particleName.

Definition at line 15 of file RawParticleTypeFilter.cc.

References myAcceptIDs, RawParticle::pid(), and tmp.

15  {
17  RawParticle tmp(particleName,one);
18 // cout << tmp.pid() << endl;
19  myAcceptIDs.push_back(tmp.pid());
20 }
std::vector< int > myAcceptIDs
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
RawParticleTypeFilter::RawParticleTypeFilter ( const std::string &  particleName1,
const std::string &  particleName2 
)

Construct a filter to accept particles of particleName1 or particleName2.

Definition at line 22 of file RawParticleTypeFilter.cc.

References myAcceptIDs, and RawParticle::pid().

23  {
25  RawParticle tmp1(particleName1,one),tmp2(particleName2,one);
26 // cout << tmp1.pid() << endl;
27 // cout << tmp2.pid() << endl;
28  myAcceptIDs.push_back(tmp1.pid());
29  myAcceptIDs.push_back(tmp2.pid());
30 }
std::vector< int > myAcceptIDs
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
RawParticleTypeFilter::RawParticleTypeFilter ( const int  pid)

Construct a filter to accept particles with id pid.

Definition at line 32 of file RawParticleTypeFilter.cc.

References myAcceptIDs.

32  {
33  myAcceptIDs.push_back(pid);
34 }
std::vector< int > myAcceptIDs
RawParticleTypeFilter::RawParticleTypeFilter ( const int  pid1,
const int  pid2 
)

Construct a filter to accept particles with id pid1 or pid2.

Definition at line 36 of file RawParticleTypeFilter.cc.

References myAcceptIDs.

36  {
37  myAcceptIDs.push_back(pid1);
38  myAcceptIDs.push_back(pid2);
39 }
std::vector< int > myAcceptIDs
virtual RawParticleTypeFilter::~RawParticleTypeFilter ( )
inlinevirtual

Definition at line 31 of file RawParticleTypeFilter.h.

31 {;};

Member Function Documentation

void RawParticleTypeFilter::addAccept ( const int  id)

Accept in addition particles with id id. The list of particles to reject will be cleared and no longer used.

Definition at line 41 of file RawParticleTypeFilter.cc.

References myAcceptIDs, and myRejectIDs.

Referenced by addAccept().

41  {
42  myAcceptIDs.push_back(pid);
43  myRejectIDs.clear();
44 }
std::vector< int > myRejectIDs
std::vector< int > myAcceptIDs
void RawParticleTypeFilter::addAccept ( const std::string &  name)

Accept in addition particles with name name. The list of particles to reject will be cleared and no longer used.

Definition at line 46 of file RawParticleTypeFilter.cc.

References addAccept(), RawParticle::pid(), and tmp.

46  {
48  RawParticle tmp(name,one);
49  this->addAccept(tmp.pid());
50 }
void addAccept(const int id)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
void RawParticleTypeFilter::addReject ( const int  id)

Reject in addition particles with id id. The list of particles to accept will be cleared and no longer used.

Definition at line 52 of file RawParticleTypeFilter.cc.

References myAcceptIDs, and myRejectIDs.

Referenced by addReject().

52  {
53  myRejectIDs.push_back(pid);
54  myAcceptIDs.clear();
55 }
std::vector< int > myRejectIDs
std::vector< int > myAcceptIDs
void RawParticleTypeFilter::addReject ( const std::string &  name)

Reject in addition particles with name name. The list of particles to accept will be cleared and no longer used.

Definition at line 57 of file RawParticleTypeFilter.cc.

References addReject(), RawParticle::pid(), and tmp.

57  {
59  RawParticle tmp(name,one);
60  this->addReject(tmp.pid());
61 }
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
void addReject(const int id)
bool RawParticleTypeFilter::isAcceptable ( const int  id) const
private

is this particle id in the list of acceptable particles?

Definition at line 75 of file RawParticleTypeFilter.cc.

References myAcceptIDs.

Referenced by isOKForMe().

76 {
77  bool acceptThis = false;
78 
79  std::vector<int>::const_iterator myAcceptIDsItr;
80  for (myAcceptIDsItr = myAcceptIDs.begin(); myAcceptIDsItr != myAcceptIDs.end();
81  myAcceptIDsItr++) {
82  if (id == (*myAcceptIDsItr)) {
83  acceptThis = true;
84  }
85  }
86  return acceptThis;
87 }
std::vector< int > myAcceptIDs
bool RawParticleTypeFilter::isOKForMe ( const RawParticle p) const
privatevirtual

implemented as required by class BaseRawParticleFilter

Implements BaseRawParticleFilter.

Definition at line 63 of file RawParticleTypeFilter.cc.

References isAcceptable(), isRejectable(), myAcceptIDs, myRejectIDs, and RawParticle::pid().

64 {
65  bool acceptThis = true;
66  if (myAcceptIDs.size() > 0) {
67  acceptThis = this->isAcceptable(p->pid());
68  }
69  if (myRejectIDs.size() > 0) {
70  acceptThis = ! this->isRejectable(p->pid());
71  }
72  return acceptThis;
73 }
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:264
std::vector< int > myRejectIDs
bool isRejectable(const int id) const
is this particle id in the list of rejectable particles?
std::vector< int > myAcceptIDs
bool isAcceptable(const int id) const
is this particle id in the list of acceptable particles?
bool RawParticleTypeFilter::isRejectable ( const int  id) const
private

is this particle id in the list of rejectable particles?

Definition at line 89 of file RawParticleTypeFilter.cc.

References myRejectIDs.

Referenced by isOKForMe().

90 {
91  bool acceptThis = false;
92 
93  std::vector<int>::const_iterator myRejectIDsItr;
94  for (myRejectIDsItr = myRejectIDs.begin(); myRejectIDsItr != myRejectIDs.end();
95  myRejectIDsItr++) {
96  if (id == (*myRejectIDsItr)) {
97  acceptThis = true;
98  }
99  }
100  return acceptThis;
101 }
std::vector< int > myRejectIDs

Member Data Documentation

std::vector<int> RawParticleTypeFilter::myAcceptIDs
private
std::vector<int> RawParticleTypeFilter::myRejectIDs
private

Definition at line 63 of file RawParticleTypeFilter.h.

Referenced by addAccept(), addReject(), isOKForMe(), and isRejectable().