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 intimeOnly, bool chargedOnly, bool stableOnly, const std::vector< int > &pdgId=std::vector< int >())
 

Private Attributes

bool chargedOnly_
 
bool intimeOnly_
 
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  intimeOnly,
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), intimeOnly_(intimeOnly), 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(), intimeOnly_, 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  // intime only means no OOT PU particles
30  if (intimeOnly_ && !(tp.eventId().bunchCrossing()==0)) return false;
31 
32  auto pdgid = tp.pdgId();
33  if(!pdgId_.empty()) {
34  bool testId = false;
35  for(auto id: pdgId_) {
36  if(id == pdgid) { testId = true; break;}
37  }
38  if(!testId) return false;
39  }
40 
41  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
42 
43  // select only stable particles
44  if (stableOnly_) {
46  if (j->get()==0 || j->get()->status() != 1) {
47  return false;
48  }
49  }
50  // test for remaining unstabled due to lack of genparticle pointer
51  if( tp.status() == -99 &&
52  (std::abs(pdgid) != 11 && std::abs(pdgid) != 13 && std::abs(pdgid) != 211 &&
53  std::abs(pdgid) != 321 && std::abs(pdgid) != 2212 && std::abs(pdgid) != 3112 &&
54  std::abs(pdgid) != 3222 && std::abs(pdgid) != 3312 && std::abs(pdgid) != 3334))
55  return false;
56  }
57 
58  auto etaOk = [&](const TrackingParticle& p)->bool{ float eta= etaFromXYZ(p.px(),p.py(),p.pz()); return (eta>= minRapidity_) & (eta<=maxRapidity_);};
59  return (
61  tp.p4().perp2() >= ptMin2_ &&
62  etaOk(tp) &&
63  std::abs(tp.vertex().z()) <= lip_ && // vertex last to avoid to load it if not striclty necessary...
64  tp.vertex().perp2() <= tip2_
65  );
66  }
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 77 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::intimeOnly_
private

Definition at line 76 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::lip_
private

Definition at line 73 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::maxRapidity_
private

Definition at line 71 of file TrackingParticleSelector.h.

Referenced by operator()().

int TrackingParticleSelector::minHit_
private

Definition at line 74 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::minRapidity_
private

Definition at line 70 of file TrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 79 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::ptMin2_
private

Definition at line 69 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::signalOnly_
private

Definition at line 75 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::stableOnly_
private

Definition at line 78 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::tip2_
private

Definition at line 72 of file TrackingParticleSelector.h.

Referenced by operator()().