CMS 3D CMS Logo

TP.cc
Go to the documentation of this file.
2 
3 namespace l1tVertexFinder {
4 
6  : settings_(nullptr),
7  inTimeBx_(false),
8  physicsCollision_(false),
9  use_(false),
10  useForEff_(false),
11  useForAlgEff_(false),
12  useForVertexReco_(false),
13  nLayersWithStubs_(0) {}
14 
15  TP::TP(const TrackingParticlePtr& tpPtr, const AnalysisSettings& settings)
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  }
25 
26  //=== Fill truth info with association from tracking particle to stubs.
27  void TP::setMatchingStubs(const std::vector<Stub>& vMatchingStubs) {
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  }
35 
36  //=== Count number of tracker layers a given list of stubs are in.
37  //=== By default, consider both PS+2S modules, but optionally consider only the PS ones.
38 
39  unsigned int TP::countLayers(bool onlyPS) {
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  }
86 
88  useForVertexReco_ = false;
89  if (use_) {
91  }
92 
93  if (useForVertexReco_) {
95  }
96  }
97 
98  //=== Check if this tracking particle is worth keeping.
99  void TP::fillUse() {
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  }
104 
105  //=== Check if this tracking particle can be used to measure the L1 tracking efficiency.
107  useForEff_ = false;
108  if (use_) {
110  }
111  }
112 
113  //=== Check if this tracking particle can be used to measure the L1 tracking algorithmic efficiency (makes stubs in enough layers).
115  useForAlgEff_ = false;
116  if (useForEff_) {
118  }
119  }
120 
121 } // namespace l1tVertexFinder
l1tVertexFinder
Definition: AlgoSettings.h:10
TP.h
l1tVertexFinder::AnalysisSettings
Definition: AnalysisSettings.h:15
funct::false
false
Definition: Factorize.h:29
l1tVertexFinder::TP::fillUseForEff
void fillUseForEff()
Definition: TP.cc:106
l1tVertexFinder::TP::setMatchingStubs
void setMatchingStubs(const std::vector< Stub > &vMatchingStubs)
Definition: TP.cc:27
l1tVertexFinder::TP::useForVertexReco_
bool useForVertexReco_
Definition: TP.h:71
l1tVertexFinder::TP::fillUseForVertexReco
void fillUseForVertexReco()
Definition: TP.cc:87
l1tVertexFinder::AnalysisSettings::tpsUseForVtxReco
const TrackingParticleSelector & tpsUseForVtxReco() const
Definition: AnalysisSettings.h:31
l1tVertexFinder::TP::fillUseForAlgEff
void fillUseForAlgEff()
Definition: TP.cc:114
edm::Ptr::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
l1tVertexFinder::TP::fillUse
void fillUse()
Definition: TP.cc:99
EncodedEventId
Definition: EncodedEventId.h:11
l1tVertexFinder::TP::nLayersWithStubs_
unsigned int nLayersWithStubs_
Definition: TP.h:74
l1tVertexFinder::TP::useForEff_
bool useForEff_
Definition: TP.h:69
l1tVertexFinder::Stub
Definition: Stub.h:37
l1tVertexFinder::AnalysisSettings::tpsUseForEff
const TrackingParticleSelector & tpsUseForEff() const
Definition: AnalysisSettings.h:33
l1tVertexFinder::TP::trackingParticle_
TrackingParticlePtr trackingParticle_
Definition: TP.h:63
l1tVertexFinder::AnalysisSettings::tpsUse
const TrackingParticleSelector & tpsUse() const
Definition: AnalysisSettings.h:32
createfilelist.int
int
Definition: createfilelist.py:10
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
l1tVertexFinder::AnalysisSettings::genMinStubLayers
unsigned int genMinStubLayers() const
Definition: AnalysisSettings.h:28
l1tVertexFinder::TP::useForAlgEff_
bool useForAlgEff_
Definition: TP.h:70
l1tVertexFinder::TP::countLayers
unsigned int countLayers(bool onlyPS=false)
Definition: TP.cc:39
l1tVertexFinder::TP::settings_
const AnalysisSettings * settings_
Definition: TP.h:64
edm::Ptr< TrackingParticle >
l1tVertexFinder::AnalysisSettings::useLayerID
bool useLayerID() const
Definition: AnalysisSettings.h:38
l1tVertexFinder::AlgoSettings::trackerInnerRadius
double trackerInnerRadius() const
Definition: AlgoSettings.h:77
l1tVertexFinder::AlgoSettings::layerIDfromRadiusBin
double layerIDfromRadiusBin() const
Definition: AlgoSettings.h:79
Exception
Definition: hltDiff.cc:245
l1tVertexFinder::TP::inTimeBx_
bool inTimeBx_
Definition: TP.h:66
l1tVertexFinder::TP::use_
bool use_
Definition: TP.h:68
l1tVertexFinder::TP::TP
TP()
Definition: TP.cc:5
l1tVertexFinder::TP::assocStubs_
std::vector< Stub > assocStubs_
Definition: TP.h:73
l1tVertexFinder::TP::physicsCollision_
bool physicsCollision_
Definition: TP.h:67
TrackingParticle::g4Tracks
const std::vector< SimTrack > & g4Tracks() const
Definition: TrackingParticle.h:89