CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1tVertexFinder::TP Class Reference

#include <TP.h>

Public Member Functions

unsigned int countLayers (bool onlyPS=false)
 
const TrackingParticlePtr getTrackingParticle () const
 
unsigned int numAssocStubs () const
 
const TrackingParticlePtr operator-> () const
 
bool operator== (const TP &rhs) const
 
bool physicsCollision () const
 
void setMatchingStubs (const std::vector< Stub > &vMatchingStubs)
 
 TP ()
 
 TP (const TrackingParticlePtr &tpPtr, const AnalysisSettings &settings)
 
bool use () const
 
bool useForAlgEff () const
 
bool useForEff () const
 
bool useForVertexReco () const
 
 ~TP ()
 

Private Member Functions

void fillUse ()
 
void fillUseForAlgEff ()
 
void fillUseForEff ()
 
void fillUseForVertexReco ()
 

Private Attributes

std::vector< StubassocStubs_
 
bool inTimeBx_
 
unsigned int nLayersWithStubs_
 
bool physicsCollision_
 
const AnalysisSettingssettings_
 
TrackingParticlePtr trackingParticle_
 
bool use_
 
bool useForAlgEff_
 
bool useForEff_
 
bool useForVertexReco_
 

Detailed Description

Definition at line 16 of file TP.h.

Constructor & Destructor Documentation

◆ TP() [1/2]

l1tVertexFinder::TP::TP ( )

Definition at line 5 of file TP.cc.

6  : settings_(nullptr),
7  inTimeBx_(false),
8  physicsCollision_(false),
9  use_(false),
10  useForEff_(false),
11  useForAlgEff_(false),
12  useForVertexReco_(false),
13  nLayersWithStubs_(0) {}
unsigned int nLayersWithStubs_
Definition: TP.h:74
bool inTimeBx_
Definition: TP.h:66
const AnalysisSettings * settings_
Definition: TP.h:64
bool useForVertexReco_
Definition: TP.h:71
bool useForEff_
Definition: TP.h:69
bool useForAlgEff_
Definition: TP.h:70
bool physicsCollision_
Definition: TP.h:67

◆ TP() [2/2]

l1tVertexFinder::TP::TP ( const TrackingParticlePtr tpPtr,
const AnalysisSettings settings 
)

Definition at line 15 of file TP.cc.

References runTauDisplay::eid, fillUse(), fillUseForEff(), TrackingParticle::g4Tracks(), inTimeBx_, physicsCollision_, and trackingParticle_.

16  : trackingParticle_(tpPtr), settings_(&settings) {
17  const std::vector<SimTrack>& vst = trackingParticle_->g4Tracks();
18  EncodedEventId eid = vst.at(0).eventId();
19  inTimeBx_ = (eid.bunchCrossing() == 0); // TP from in-time or out-of-time Bx.
20  physicsCollision_ = (eid.event() == 0); // TP from physics collision or from pileup.
21 
22  this->fillUse(); // Fill use_ flag, indicating if TP is worth keeping.
23  this->fillUseForEff(); // Fill useForEff_ flag, indicating if TP is good for tracking efficiency measurement.
24  }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
bool inTimeBx_
Definition: TP.h:66
const std::vector< SimTrack > & g4Tracks() const
void fillUse()
Definition: TP.cc:99
const AnalysisSettings * settings_
Definition: TP.h:64
void fillUseForEff()
Definition: TP.cc:106
bool physicsCollision_
Definition: TP.h:67

◆ ~TP()

l1tVertexFinder::TP::~TP ( )
inline

Definition at line 21 of file TP.h.

21 {}

Member Function Documentation

◆ countLayers()

unsigned int l1tVertexFinder::TP::countLayers ( bool  onlyPS = false)

Definition at line 39 of file TP.cc.

References assocStubs_, Exception, newFWLiteAna::found, createfilelist::int, l1tVertexFinder::AlgoSettings::layerIDfromRadiusBin(), settings_, l1tVertexFinder::AlgoSettings::trackerInnerRadius(), and l1tVertexFinder::AnalysisSettings::useLayerID().

Referenced by fillUseForAlgEff(), fillUseForVertexReco(), and setMatchingStubs().

39  {
40  //=== Unpack configuration parameters
41 
42  // Define layers using layer ID (true) or by bins in radius of 5 cm width (false).
43  bool useLayerID = settings_->useLayerID();
44  // When counting stubs in layers, actually histogram stubs in distance from beam-line with this bin size.
45  float layerIDfromRadiusBin = settings_->layerIDfromRadiusBin();
46  // Inner radius of tracker.
47  float trackerInnerRadius = settings_->trackerInnerRadius();
48 
49  const int maxLayerID(30);
50  std::vector<bool> foundLayers(maxLayerID, false);
51 
52  if (useLayerID) {
53  // Count layers using CMSSW layer ID.
54  for (const Stub& stub : assocStubs_) {
55  if ((!onlyPS) || stub.psModule()) { // Consider only stubs in PS modules if that option specified.
56  int layerID = stub.layerId();
57  if (layerID >= 0 && layerID < maxLayerID) {
58  foundLayers[layerID] = true;
59  } else {
60  throw cms::Exception("Utility::invalid layer ID");
61  }
62  }
63  }
64  } else {
65  // Count layers by binning stub distance from beam line.
66  for (const Stub& stub : assocStubs_) {
67  if ((!onlyPS) || stub.psModule()) { // Consider only stubs in PS modules if that option specified.
68  int layerID = (int)((stub.r() - trackerInnerRadius) / layerIDfromRadiusBin);
69  if (layerID >= 0 && layerID < maxLayerID) {
70  foundLayers[layerID] = true;
71  } else {
72  throw cms::Exception("Utility::invalid layer ID");
73  }
74  }
75  }
76  }
77 
78  unsigned int ncount = 0;
79  for (const bool& found : foundLayers) {
80  if (found)
81  ncount++;
82  }
83 
84  return ncount;
85  }
double trackerInnerRadius() const
Definition: AlgoSettings.h:92
double layerIDfromRadiusBin() const
Definition: AlgoSettings.h:94
const AnalysisSettings * settings_
Definition: TP.h:64
std::vector< Stub > assocStubs_
Definition: TP.h:73

◆ fillUse()

void l1tVertexFinder::TP::fillUse ( )
private

Definition at line 99 of file TP.cc.

References edm::Ptr< T >::get(), settings_, l1tVertexFinder::AnalysisSettings::tpsUse(), trackingParticle_, and use_.

Referenced by TP().

99  {
100  // Use looser cuts here those those used for tracking efficiency measurement.
101  // Keep only those TP that have a chance (allowing for finite track resolution) of being reconstructed as L1 tracks. L1 tracks not matching these TP will be defined as fake.
103  }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
const AnalysisSettings * settings_
Definition: TP.h:64
const TrackingParticleSelector & tpsUse() const
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:141

◆ fillUseForAlgEff()

void l1tVertexFinder::TP::fillUseForAlgEff ( )
private

Definition at line 114 of file TP.cc.

References countLayers(), l1tVertexFinder::AnalysisSettings::genMinStubLayers(), settings_, useForAlgEff_, and useForEff_.

Referenced by setMatchingStubs().

114  {
115  useForAlgEff_ = false;
116  if (useForEff_) {
118  }
119  }
unsigned int countLayers(bool onlyPS=false)
Definition: TP.cc:39
const AnalysisSettings * settings_
Definition: TP.h:64
bool useForEff_
Definition: TP.h:69
unsigned int genMinStubLayers() const
bool useForAlgEff_
Definition: TP.h:70

◆ fillUseForEff()

void l1tVertexFinder::TP::fillUseForEff ( )
private

Definition at line 106 of file TP.cc.

References edm::Ptr< T >::get(), settings_, l1tVertexFinder::AnalysisSettings::tpsUseForEff(), trackingParticle_, use_, and useForEff_.

Referenced by TP().

106  {
107  useForEff_ = false;
108  if (use_) {
110  }
111  }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
const AnalysisSettings * settings_
Definition: TP.h:64
bool useForEff_
Definition: TP.h:69
const TrackingParticleSelector & tpsUseForEff() const
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:141

◆ fillUseForVertexReco()

void l1tVertexFinder::TP::fillUseForVertexReco ( )
private

Definition at line 87 of file TP.cc.

References countLayers(), l1tVertexFinder::AnalysisSettings::genMinStubLayers(), edm::Ptr< T >::get(), settings_, l1tVertexFinder::AnalysisSettings::tpsUseForVtxReco(), trackingParticle_, use_, and useForVertexReco_.

Referenced by setMatchingStubs().

87  {
88  useForVertexReco_ = false;
89  if (use_) {
91  }
92 
93  if (useForVertexReco_) {
95  }
96  }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
unsigned int countLayers(bool onlyPS=false)
Definition: TP.cc:39
const TrackingParticleSelector & tpsUseForVtxReco() const
const AnalysisSettings * settings_
Definition: TP.h:64
bool useForVertexReco_
Definition: TP.h:71
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:141
unsigned int genMinStubLayers() const

◆ getTrackingParticle()

const TrackingParticlePtr l1tVertexFinder::TP::getTrackingParticle ( ) const
inline

Definition at line 40 of file TP.h.

References trackingParticle_.

40 { return trackingParticle_; }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63

◆ numAssocStubs()

unsigned int l1tVertexFinder::TP::numAssocStubs ( ) const
inline

Definition at line 44 of file TP.h.

References assocStubs_.

44 { return assocStubs_.size(); }
std::vector< Stub > assocStubs_
Definition: TP.h:73

◆ operator->()

const TrackingParticlePtr l1tVertexFinder::TP::operator-> ( ) const
inline

Definition at line 46 of file TP.h.

References trackingParticle_.

46 { return trackingParticle_; }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63

◆ operator==()

bool l1tVertexFinder::TP::operator== ( const TP rhs) const
inline

Definition at line 24 of file TP.h.

References assocStubs_, inTimeBx_, nLayersWithStubs_, physicsCollision_, settings_, trackingParticle_, use_, useForAlgEff_, useForEff_, and useForVertexReco_.

24  {
25  return (trackingParticle_ == rhs.trackingParticle_ && settings_ == rhs.settings_ && inTimeBx_ == rhs.inTimeBx_ &&
26  physicsCollision_ == rhs.physicsCollision_ && use_ == rhs.use_ && useForEff_ == rhs.useForEff_ &&
27  useForAlgEff_ == rhs.useForAlgEff_ && useForVertexReco_ == rhs.useForVertexReco_ &&
28  nLayersWithStubs_ == rhs.nLayersWithStubs_ && assocStubs_ == rhs.assocStubs_);
29  }
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
unsigned int nLayersWithStubs_
Definition: TP.h:74
bool inTimeBx_
Definition: TP.h:66
const AnalysisSettings * settings_
Definition: TP.h:64
std::vector< Stub > assocStubs_
Definition: TP.h:73
bool useForVertexReco_
Definition: TP.h:71
bool useForEff_
Definition: TP.h:69
bool useForAlgEff_
Definition: TP.h:70
bool physicsCollision_
Definition: TP.h:67

◆ physicsCollision()

bool l1tVertexFinder::TP::physicsCollision ( ) const
inline

Definition at line 42 of file TP.h.

References physicsCollision_.

42 { return physicsCollision_; }
bool physicsCollision_
Definition: TP.h:67

◆ setMatchingStubs()

void l1tVertexFinder::TP::setMatchingStubs ( const std::vector< Stub > &  vMatchingStubs)

Definition at line 27 of file TP.cc.

References assocStubs_, countLayers(), fillUseForAlgEff(), fillUseForVertexReco(), and nLayersWithStubs_.

27  {
28  assocStubs_ = vMatchingStubs;
29 
30  this->fillUseForAlgEff(); // Fill useForAlgEff_ flag.
31  this->fillUseForVertexReco();
32  // Calculate number of tracker layers this TP has stubs in.
34  }
unsigned int nLayersWithStubs_
Definition: TP.h:74
unsigned int countLayers(bool onlyPS=false)
Definition: TP.cc:39
void fillUseForVertexReco()
Definition: TP.cc:87
std::vector< Stub > assocStubs_
Definition: TP.h:73
void fillUseForAlgEff()
Definition: TP.cc:114

◆ use()

bool l1tVertexFinder::TP::use ( ) const
inline

Definition at line 48 of file TP.h.

References use_.

48 { return use_; }

◆ useForAlgEff()

bool l1tVertexFinder::TP::useForAlgEff ( ) const
inline

Definition at line 52 of file TP.h.

References useForAlgEff_.

52 { return useForAlgEff_; }
bool useForAlgEff_
Definition: TP.h:70

◆ useForEff()

bool l1tVertexFinder::TP::useForEff ( ) const
inline

Definition at line 50 of file TP.h.

References useForEff_.

50 { return useForEff_; }
bool useForEff_
Definition: TP.h:69

◆ useForVertexReco()

bool l1tVertexFinder::TP::useForVertexReco ( ) const
inline

Definition at line 54 of file TP.h.

References useForVertexReco_.

54 { return useForVertexReco_; }
bool useForVertexReco_
Definition: TP.h:71

Member Data Documentation

◆ assocStubs_

std::vector<Stub> l1tVertexFinder::TP::assocStubs_
private

Definition at line 73 of file TP.h.

Referenced by countLayers(), numAssocStubs(), operator==(), and setMatchingStubs().

◆ inTimeBx_

bool l1tVertexFinder::TP::inTimeBx_
private

Definition at line 66 of file TP.h.

Referenced by operator==(), and TP().

◆ nLayersWithStubs_

unsigned int l1tVertexFinder::TP::nLayersWithStubs_
private

Definition at line 74 of file TP.h.

Referenced by operator==(), and setMatchingStubs().

◆ physicsCollision_

bool l1tVertexFinder::TP::physicsCollision_
private

Definition at line 67 of file TP.h.

Referenced by operator==(), physicsCollision(), and TP().

◆ settings_

const AnalysisSettings* l1tVertexFinder::TP::settings_
private

◆ trackingParticle_

TrackingParticlePtr l1tVertexFinder::TP::trackingParticle_
private

◆ use_

bool l1tVertexFinder::TP::use_
private

Definition at line 68 of file TP.h.

Referenced by fillUse(), fillUseForEff(), fillUseForVertexReco(), operator==(), and use().

◆ useForAlgEff_

bool l1tVertexFinder::TP::useForAlgEff_
private

Definition at line 70 of file TP.h.

Referenced by fillUseForAlgEff(), operator==(), and useForAlgEff().

◆ useForEff_

bool l1tVertexFinder::TP::useForEff_
private

Definition at line 69 of file TP.h.

Referenced by fillUseForAlgEff(), fillUseForEff(), operator==(), and useForEff().

◆ useForVertexReco_

bool l1tVertexFinder::TP::useForVertexReco_
private

Definition at line 71 of file TP.h.

Referenced by fillUseForVertexReco(), operator==(), and useForVertexReco().