CMS 3D CMS Logo

L1TrackTruthMatched.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_VertexFinder_L1TrackTruthMatched_h__
2 #define __L1Trigger_VertexFinder_L1TrackTruthMatched_h__
3 
4 #include <vector>
5 
10 // TTStubAssociationMap.h forgets to two needed files, so must include them here ...
13 
14 class TrackerGeometry;
15 class TrackerTopology;
16 
17 namespace l1tVertexFinder {
18 
19  class AnalysisSettings;
20  class TP;
21 
23 
25  class L1TrackTruthMatched : public L1Track {
26  public:
29  const edm::ValueMap<TP>& tpValueMap,
30  edm::Handle<TTTrackAssMap> mcTruthTTTrackHandle)
31  : L1Track(aTrack), matchedTPidx_(-1) {
32  auto mcTruthTP = mcTruthTTTrackHandle->findTrackingParticlePtr(aTrack);
33  if (!mcTruthTP.isNull()) {
34  auto tpTranslation = tpPtrToRefMap.find(mcTruthTP);
35  if (tpTranslation != tpPtrToRefMap.end()) {
36  matchedTP_ = &tpValueMap[tpTranslation->second];
37  matchedTPidx_ = std::distance(tpPtrToRefMap.begin(), tpTranslation);
38  } else {
39  matchedTP_ = nullptr;
40  }
41  } else {
42  matchedTP_ = nullptr;
43  }
44  }
46 
47  // Get best matching tracking particle (=nullptr if none).
48  const TP* getMatchedTP() const { return matchedTP_; }
49 
50  // Get the index of the matched TP in the map of TP particles with the use flag set
51  const int getMatchedTPidx() const { return matchedTPidx_; }
52 
53  private:
54  const TP* matchedTP_;
56  };
57 
58 } // namespace l1tVertexFinder
59 
60 #endif
TTTrackAssociationMap< Ref_Phase2TrackerDigi_ > TTTrackAssMap
Stores association of Truth Particles (TP) to L1 Track-Trigger Tracks.
Simple wrapper class for TTTrack, with match to a tracking particle.
Simple wrapper class for TTTrack.
Definition: L1Track.h:17
L1TrackTruthMatched(const edm::Ptr< TTTrack< Ref_Phase2TrackerDigi_ >> &aTrack, const std::map< edm::Ptr< TrackingParticle >, edm::RefToBase< TrackingParticle >> &tpPtrToRefMap, const edm::ValueMap< TP > &tpValueMap, edm::Handle< TTTrackAssMap > mcTruthTTTrackHandle)
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29