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, 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 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,
bool  stableOnly,
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(), configurableAnalysis::GenParticle, TrackingParticle::genParticle_begin(), TrackingParticle::genParticle_end(), j, lip_, TrackingParticle::matchedHit(), maxRapidity_, minHit_, minRapidity_, ParticleBase::momentum(), AlCaHLTBitMon_ParallelJobs::p, TrackingParticle::pdgId(), pdgId_, ptMin_, signalOnly_, mathSSE::sqrt(), TopDecayID::stable, stableOnly_, ParticleBase::status(), tip_, and ParticleBase::vertex().

24  {
25  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
26  bool testId = false;
27  unsigned int idSize = pdgId_.size();
28  if (idSize==0) testId = true;
29  else for (unsigned int it=0;it!=idSize;++it){
30  if (tp.pdgId()==pdgId_[it]) testId = true;
31  }
32  bool signal = true;
33  if (signalOnly_) signal = (tp.eventId().bunchCrossing()== 0 && tp.eventId().event() == 0); // signal only means no PU particles
34  // select only stable particles
35  bool stable = true;
36  if (stableOnly_) {
37  if (!signal) {
38  stable = false; // we are not interested into PU particles among the stable ones
39  } else {
41  const HepMC::GenParticle * p = j->get();
42  if (!p || p->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 (
54  tp.matchedHit() >= minHit_ &&
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 charge() const
electric charge
Definition: ParticleBase.h:54
int pdgId() const
PDG id, signal source, crossing number.
static const int stable
Definition: TopGenEvent.h:11
int matchedHit() const
T sqrt(T t)
Definition: SSEVec.h:46
int bunchCrossing() const
get the detector field from this detid
int j
Definition: DBlmapReader.cc:9
int status() const
status word
Definition: ParticleBase.h:263
genp_iterator genParticle_end() const
Vector momentum() const
spatial momentum vector
Definition: ParticleBase.h:86
EncodedEventId eventId() const
const Point & vertex() const
vertex position
Definition: ParticleBase.h:228

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()().