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_
 
float maxRapidity_
 
int minHit_
 
float minRapidity_
 
std::vector< int > pdgId_
 
double ptMin2_
 
bool signalOnly_
 
bool stableOnly_
 
double tip2_
 

Detailed Description

Definition at line 15 of file TrackingParticleSelector.h.

Constructor & Destructor Documentation

TrackingParticleSelector::TrackingParticleSelector ( )
inline

Definition at line 18 of file TrackingParticleSelector.h.

18 {}
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

Definition at line 19 of file TrackingParticleSelector.h.

21  :
23  tip2_( tip*tip ), lip_( lip ), minHit_( minHit ), signalOnly_(signalOnly), chargedOnly_(chargedOnly), stableOnly_(stableOnly), pdgId_( pdgId ) { }

Member Function Documentation

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

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

Definition at line 26 of file TrackingParticleSelector.h.

References funct::abs(), EncodedEventId::bunchCrossing(), TrackingParticle::charge(), chargedOnly_, eta, EncodedEventId::event(), TrackingParticle::eventId(), TrackingParticle::genParticle_begin(), TrackingParticle::genParticle_end(), j, lip_, maxRapidity_, minHit_, minRapidity_, TrackingParticle::numberOfTrackerLayers(), AlCaHLTBitMon_ParallelJobs::p, TrackingParticle::p4(), TrackingParticle::pdgId(), pdgId_, ptMin2_, signalOnly_, stableOnly_, TrackingParticle::status(), tip2_, and TrackingParticle::vertex().

26  {
27  // signal only means no PU particles
28  if (signalOnly_ && !(tp.eventId().bunchCrossing()== 0 && tp.eventId().event() == 0)) return false;
29 
30  auto pdgid = tp.pdgId();
31  if(!pdgId_.empty()) {
32  bool testId = false;
33  for(auto id: pdgId_) {
34  if(id == pdgid) { testId = true; break;}
35  }
36  if(!testId) return false;
37  }
38 
39  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
40 
41  // select only stable particles
42  if (stableOnly_) {
44  if (j->get()==0 || j->get()->status() != 1) {
45  return false;
46  }
47  }
48  // test for remaining unstabled due to lack of genparticle pointer
49  if( tp.status() == -99 &&
50  (std::abs(pdgid) != 11 && std::abs(pdgid) != 13 && std::abs(pdgid) != 211 &&
51  std::abs(pdgid) != 321 && std::abs(pdgid) != 2212 && std::abs(pdgid) != 3112 &&
52  std::abs(pdgid) != 3222 && std::abs(pdgid) != 3312 && std::abs(pdgid) != 3334))
53  return false;
54  }
55 
56  auto etaOk = [&](const TrackingParticle& p)->bool{ float eta= etaFromXYZ(p.px(),p.py(),p.pz()); return (eta>= minRapidity_) & (eta<=maxRapidity_);};
57  return (
59  tp.p4().perp2() >= ptMin2_ &&
60  etaOk(tp) &&
61  std::abs(tp.vertex().z()) <= lip_ && // vertex last to avoid to load it if not striclty necessary...
62  tp.vertex().perp2() <= tip2_
63  );
64  }
const LorentzVector & p4() const
Four-momentum Lorentz vector. Note this is taken from the first SimTrack only.
genp_iterator genParticle_begin() const
iterators
int event() const
get the contents of the subdetector field (should be protected?)
int pdgId() const
PDG ID.
int status() const
Status word.
float charge() const
Electric charge. Note this is taken from the first SimTrack only.
int bunchCrossing() const
get the detector field from this detid
int numberOfTrackerLayers() const
The number of tracker layers with a hit.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
genp_iterator genParticle_end() const
Point vertex() const
Parent vertex position.
EncodedEventId eventId() const
Signal source, crossing number.
Monte Carlo truth information used for tracking validation.

Member Data Documentation

bool TrackingParticleSelector::chargedOnly_
private

Definition at line 74 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::lip_
private

Definition at line 71 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::maxRapidity_
private

Definition at line 69 of file TrackingParticleSelector.h.

Referenced by operator()().

int TrackingParticleSelector::minHit_
private

Definition at line 72 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::minRapidity_
private

Definition at line 68 of file TrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 76 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::ptMin2_
private

Definition at line 67 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::signalOnly_
private

Definition at line 73 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::stableOnly_
private

Definition at line 75 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::tip2_
private

Definition at line 70 of file TrackingParticleSelector.h.

Referenced by operator()().