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
TrackingParticleSelector Class Reference

#include <TrackingParticleSelector.h>

Public Member Functions

bool operator() (const TrackingParticle &tp) const
 Operator() performs the selection: e.g. if (tPSelector(tp)) {...}. More...
 
 TrackingParticleSelector ()
 
 TrackingParticleSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, int minHit, bool signalOnly, bool chargedOnly, std::vector< int > pdgId=std::vector< int >())
 

Private Attributes

bool chargedOnly_
 
double lip_
 
double maxRapidity_
 
int minHit_
 
double minRapidity_
 
std::vector< int > pdgId_
 
double ptMin_
 
bool signalOnly_
 
double tip_
 

Detailed Description

Definition at line 13 of file TrackingParticleSelector.h.

Constructor & Destructor Documentation

TrackingParticleSelector::TrackingParticleSelector ( )
inline

Definition at line 16 of file TrackingParticleSelector.h.

16 {}
TrackingParticleSelector::TrackingParticleSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
bool  signalOnly,
bool  chargedOnly,
std::vector< int >  pdgId = std::vector<int>() 
)
inline

Member Function Documentation

bool TrackingParticleSelector::operator() ( const TrackingParticle tp) const
inline

Operator() performs the selection: e.g. if (tPSelector(tp)) {...}.

Definition at line 24 of file TrackingParticleSelector.h.

References EncodedEventId::bunchCrossing(), ParticleBase::charge(), chargedOnly_, EncodedEventId::event(), TrackingParticle::eventId(), lip_, TrackingParticle::matchedHit(), maxRapidity_, minHit_, minRapidity_, ParticleBase::momentum(), TrackingParticle::pdgId(), pdgId_, ptMin_, signalOnly_, mathSSE::sqrt(), tip_, and ParticleBase::vertex().

24  {
25 
26  //quickly reject if it is from pile-up
27  if (signalOnly_ && !(tp.eventId().bunchCrossing()==0 && tp.eventId().event()==0) )return false;
28 
29  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
30  bool testId = false;
31  unsigned int idSize = pdgId_.size();
32  if (idSize==0) testId = true;
33  else for (unsigned int it=0;it!=idSize;++it){
34  if (tp.pdgId()==pdgId_[it]) testId = true;
35  }
36  return (
37  tp.matchedHit() >= minHit_ &&
38  sqrt(tp.momentum().perp2()) >= ptMin_ &&
39  tp.momentum().eta() >= minRapidity_ && tp.momentum().eta() <= maxRapidity_ &&
40  sqrt(tp.vertex().perp2()) <= tip_ &&
41  fabs(tp.vertex().z()) <= lip_ &&
42  testId
43  );
44  }
int event() const
get the contents of the subdetector field (should be protected?)
int charge() const
electric charge
Definition: ParticleBase.h:55
int pdgId() const
PDG id, signal source, crossing number.
int matchedHit() const
T sqrt(T t)
Definition: SSEVec.h:28
int bunchCrossing() const
get the detector field from this detid
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:87
EncodedEventId eventId() const
const Point & vertex() const
vertex position
Definition: ParticleBase.h:229

Member Data Documentation

bool TrackingParticleSelector::chargedOnly_
private

Definition at line 54 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::lip_
private

Definition at line 51 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::maxRapidity_
private

Definition at line 49 of file TrackingParticleSelector.h.

Referenced by operator()().

int TrackingParticleSelector::minHit_
private

Definition at line 52 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::minRapidity_
private

Definition at line 48 of file TrackingParticleSelector.h.

Referenced by operator()().

std::vector<int> TrackingParticleSelector::pdgId_
private

Definition at line 55 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::ptMin_
private

Definition at line 47 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::signalOnly_
private

Definition at line 53 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::tip_
private

Definition at line 50 of file TrackingParticleSelector.h.

Referenced by operator()().