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, bool stableOnly, const 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_
 
bool stableOnly_
 
double tip_
 

Detailed Description

Definition at line 14 of file TrackingParticleSelector.h.

Constructor & Destructor Documentation

TrackingParticleSelector::TrackingParticleSelector ( )
inline

Definition at line 17 of file TrackingParticleSelector.h.

17 {}
TrackingParticleSelector::TrackingParticleSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
int  minHit,
bool  signalOnly,
bool  chargedOnly,
bool  stableOnly,
const 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 25 of file TrackingParticleSelector.h.

References EncodedEventId::bunchCrossing(), TrackingParticle::charge(), chargedOnly_, EncodedEventId::event(), TrackingParticle::eventId(), TrackingParticle::genParticle_begin(), TrackingParticle::genParticle_end(), j, lip_, maxRapidity_, minHit_, minRapidity_, TrackingParticle::momentum(), TrackingParticle::numberOfTrackerLayers(), TrackingParticle::pdgId(), pdgId_, ptMin_, signalOnly_, mathSSE::sqrt(), TopDecayID::stable, stableOnly_, TrackingParticle::status(), tip_, and TrackingParticle::vertex().

25  {
26  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
27  bool testId = false;
28  unsigned int idSize = pdgId_.size();
29  if (idSize==0) testId = true;
30  else for (unsigned int it=0;it!=idSize;++it){
31  if (tp.pdgId()==pdgId_[it]) testId = true;
32  }
33  bool signal = true;
34  if (signalOnly_) signal = (tp.eventId().bunchCrossing()== 0 && tp.eventId().event() == 0); // signal only means no PU particles
35  // select only stable particles
36  bool stable = true;
37  if (stableOnly_) {
38  if (!signal) {
39  stable = false; // we are not interested into PU particles among the stable ones
40  } else {
42  if (j->get()==0 || j->get()->status() != 1) {
43  stable = 0; break;
44  }
45  }
46  // test for remaining unstabled due to lack of genparticle pointer
47  if(stable == 1 && tp.status() == -99 &&
48  (fabs(tp.pdgId()) != 11 && fabs(tp.pdgId()) != 13 && fabs(tp.pdgId()) != 211 &&
49  fabs(tp.pdgId()) != 321 && fabs(tp.pdgId()) != 2212 && fabs(tp.pdgId()) != 3112 &&
50  fabs(tp.pdgId()) != 3222 && fabs(tp.pdgId()) != 3312 && fabs(tp.pdgId()) != 3334)) stable = 0;
51  }
52  }
53  return (
55  sqrt(tp.momentum().perp2()) >= ptMin_ &&
56  tp.momentum().eta() >= minRapidity_ && tp.momentum().eta() <= maxRapidity_ &&
57  sqrt(tp.vertex().perp2()) <= tip_ &&
58  fabs(tp.vertex().z()) <= lip_ &&
59  testId &&
60  signal &&
61  stable
62  );
63  }
genp_iterator genParticle_begin() const
iterators
int event() const
get the contents of the subdetector field (should be protected?)
int pdgId() const
PDG ID.
Point vertex() const
Parent vertex position.
static const int stable
Definition: TopGenEvent.h:11
int status() const
Status word.
T sqrt(T t)
Definition: SSEVec.h:48
int bunchCrossing() const
get the detector field from this detid
int numberOfTrackerLayers() const
The number of tracker layers with a hit.
int j
Definition: DBlmapReader.cc:9
genp_iterator genParticle_end() const
EncodedEventId eventId() const
Signal source, crossing number.
Vector momentum() const
spatial momentum vector
int charge() const
Electric charge. Note this is taken from the first SimTrack only.

Member Data Documentation

bool TrackingParticleSelector::chargedOnly_
private

Definition at line 73 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::lip_
private

Definition at line 70 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::maxRapidity_
private

Definition at line 68 of file TrackingParticleSelector.h.

Referenced by operator()().

int TrackingParticleSelector::minHit_
private

Definition at line 71 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::minRapidity_
private

Definition at line 67 of file TrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 75 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::ptMin_
private

Definition at line 66 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::signalOnly_
private

Definition at line 72 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::stableOnly_
private

Definition at line 74 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::tip_
private

Definition at line 69 of file TrackingParticleSelector.h.

Referenced by operator()().