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 ptMin_
 
bool signalOnly_
 
bool stableOnly_
 
double tip_
 

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  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::momentum(), TrackingParticle::numberOfTrackerLayers(), AlCaHLTBitMon_ParallelJobs::p, TrackingParticle::pdgId(), pdgId_, ptMin_, signalOnly_, TopDecayID::stable, stableOnly_, TrackingParticle::status(), tip_, and TrackingParticle::vertex().

26  {
27  auto pdgid = tp.pdgId();
28  if (chargedOnly_ && tp.charge()==0) return false;//select only if charge!=0
29 
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 (pdgid==pdgId_[it]) { testId = true; break;}
35  }
36 
37  bool signal = true;
38  if (signalOnly_) signal = (tp.eventId().bunchCrossing()== 0 && tp.eventId().event() == 0); // signal only means no PU particles
39 
40  // select only stable particles
41  bool stable = true;
42  if (stableOnly_) {
43  if (!signal) {
44  stable = false; // we are not interested into PU particles among the stable ones
45  } else {
47  if (j->get()==0 || j->get()->status() != 1) {
48  stable = false; break;
49  }
50  }
51  // test for remaining unstabled due to lack of genparticle pointer
52  if( (stable & (tp.status() == -99) ) &&
53  (std::abs(pdgid) != 11 && std::abs(pdgid) != 13 && std::abs(pdgid) != 211 &&
54  std::abs(pdgid) != 321 && std::abs(pdgid) != 2212 && std::abs(pdgid) != 3112 &&
55  std::abs(pdgid) != 3222 && std::abs(pdgid) != 3312 && std::abs(pdgid) != 3334)) stable = false;
56  }
57  }
58 
59  auto etaOk = [&](const TrackingParticle::Vector& p)->bool{ float eta= etaFromXYZ(p.x(),p.y(),p.z()); return (eta>= minRapidity_) & (eta<=maxRapidity_);};
60  return (
61  (testId & signal & stable) &&
63  tp.momentum().perp2() >= ptMin_*ptMin_ &&
64  etaOk(tp.momentum()) &&
65  std::abs(tp.vertex().z()) <= lip_ && // vertex last to avoid to load it if not striclty necessary...
66  tp.vertex().perp2() <= tip_*tip_
67  );
68  }
genp_iterator genParticle_begin() const
iterators
int event() const
get the contents of the subdetector field (should be protected?)
int pdgId() const
PDG ID.
static const int stable
Definition: TopGenEvent.h:11
T eta() const
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.
Vector momentum() const
spatial momentum vector
math::XYZVectorD Vector
point in the space

Member Data Documentation

bool TrackingParticleSelector::chargedOnly_
private

Definition at line 78 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::lip_
private

Definition at line 75 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::maxRapidity_
private

Definition at line 73 of file TrackingParticleSelector.h.

Referenced by operator()().

int TrackingParticleSelector::minHit_
private

Definition at line 76 of file TrackingParticleSelector.h.

Referenced by operator()().

float TrackingParticleSelector::minRapidity_
private

Definition at line 72 of file TrackingParticleSelector.h.

Referenced by operator()().

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

Definition at line 80 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::ptMin_
private

Definition at line 71 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::signalOnly_
private

Definition at line 77 of file TrackingParticleSelector.h.

Referenced by operator()().

bool TrackingParticleSelector::stableOnly_
private

Definition at line 79 of file TrackingParticleSelector.h.

Referenced by operator()().

double TrackingParticleSelector::tip_
private

Definition at line 74 of file TrackingParticleSelector.h.

Referenced by operator()().