CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
TTTrackAssociationMap< T > Class Template Reference

Stores association of Truth Particles (TP) to L1 Track-Trigger Tracks. More...

#include <TTTrackAssociationMap.h>

Public Member Functions

template<>
const TrackingParticlePtrfindTrackingParticlePtr (TTTrackPtr aTrack) const
 Implementation of methods. More...
 
const TrackingParticlePtrfindTrackingParticlePtr (TTTrackPtrT< T > aTrack) const
 
template<>
const TrackingParticlePtrfindTrackingParticlePtr (TTTrackPtr aTrack) const
 Operations. More...
 
template<>
const std::vector< TTTrackPtr > & findTTTrackPtrs (TrackingParticlePtr aTrackingParticle) const
 
const std::vector< TTTrackPtrT< T > > & findTTTrackPtrs (TrackingParticlePtr aTrackingParticle) const
 
template<>
const std::vector< TTTrackPtr > & findTTTrackPtrs (TrackingParticlePtr aTrackingParticle) const
 
bool getAllowOneFalse2SStub ()
 
template<>
bool getAllowOneFalse2SStub ()
 
const MapTPToVecL1Track< T > & getTrackingParticleToTTTracksMap () const
 
const MapL1TrackToTP< T > & getTTTrackToTrackingParticleMap () const
 Get/set stub <-> truth association maps. More...
 
template<>
bool isCombinatoric (TTTrackPtr aTrack) const
 
bool isCombinatoric (TTTrackPtrT< T > aTrack) const
 Both isLooselyGenuine() & isUnknown() are false. More...
 
template<>
bool isCombinatoric (TTTrackPtr aTrack) const
 
template<>
bool isGenuine (TTTrackPtr aTrack) const
 MC truth. More...
 
bool isGenuine (TTTrackPtrT< T > aTrack) const
 
template<>
bool isGenuine (TTTrackPtr aTrack) const
 MC truth. More...
 
template<>
bool isLooselyGenuine (TTTrackPtr aTrack) const
 MC truth. More...
 
bool isLooselyGenuine (TTTrackPtrT< T > aTrack) const
 
template<>
bool isLooselyGenuine (TTTrackPtr aTrack) const
 MC truth. More...
 
template<>
bool isUnknown (TTTrackPtr aTrack) const
 
bool isUnknown (TTTrackPtrT< T > aTrack) const
 More than one stub on track is "unknown". More...
 
template<>
bool isUnknown (TTTrackPtr aTrack) const
 
void setAllowOneFalse2SStub (bool allowFalse2SStub)
 
template<>
void setAllowOneFalse2SStub (bool allowFalse2SStub)
 
void setTrackingParticleToTTTracksMap (const MapTPToVecL1Track< T > &aMap)
 
void setTTStubAssociationMap (edm::RefProd< TTStubAssociationMap< T >> aStubAssoMap)
 Set stub <-> truth association object. More...
 
void setTTTrackToTrackingParticleMap (const MapL1TrackToTP< T > &aMap)
 
 TTTrackAssociationMap ()
 Constructors. More...
 
 ~TTTrackAssociationMap ()
 Destructor. More...
 

Private Attributes

bool AllowOneFalse2SStub
 
edm::RefProd< TTStubAssociationMap< T > > theStubAssociationMap_
 
MapTPToVecL1Track< TtrackingParticleToTrackVectorMap_
 
MapL1TrackToTP< TtrackToTrackingParticleMap_
 Data members. More...
 

Static Private Attributes

static const TrackingParticlePtr nullTrackingParticlePtr_
 Close class. More...
 
static const std::vector< TTTrackPtrnullVecTTTrackPtr_
 

Detailed Description

template<typename T>
class TTTrackAssociationMap< T >

Stores association of Truth Particles (TP) to L1 Track-Trigger Tracks.

Contains two maps. One associates each L1 track its principle TP. (i.e. Not to all TP that contributed to it). The other associates each TP to a vector of all L1 tracks it contributed to. The two maps are therefore not forward-backward symmetric.

(The template structure is used to accomodate types other than PixelDigis, in case they are needed in future).

Author
Nicola Pozzobon
Date
2013, Jul 19 (tidy up: Ian Tomalin, 2020)

Definition at line 46 of file TTTrackAssociationMap.h.

Constructor & Destructor Documentation

◆ TTTrackAssociationMap()

template<typename T >
TTTrackAssociationMap< T >::TTTrackAssociationMap ( )

Constructors.

Default Constructor NOTE: to be used with setSomething(...) methods

Set default data members

Definition at line 130 of file TTTrackAssociationMap.h.

130  {
132 }

◆ ~TTTrackAssociationMap()

template<typename T >
TTTrackAssociationMap< T >::~TTTrackAssociationMap ( )

Destructor.

Definition at line 136 of file TTTrackAssociationMap.h.

136 {}

Member Function Documentation

◆ findTrackingParticlePtr() [1/3]

template<>
const TrackingParticlePtr & TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::findTrackingParticlePtr ( TTTrackPtr  aTrack) const

Implementation of methods.

Here, in the header file, the methods which do not depend on the specific type <T> that can fit the template. Other methods, with type-specific features, are implemented in the source file.Operations

Definition at line 12 of file TTTrackAssociationMap.cc.

13  {
14  if (trackToTrackingParticleMap_.find(aTrack) != trackToTrackingParticleMap_.end()) {
15  return trackToTrackingParticleMap_.find(aTrack)->second;
16  } else {
18  }
19 }
MapL1TrackToTP< T > trackToTrackingParticleMap_
Data members.
static const TrackingParticlePtr nullTrackingParticlePtr_
Close class.

◆ findTrackingParticlePtr() [2/3]

template<typename T>
const TrackingParticlePtr& TTTrackAssociationMap< T >::findTrackingParticlePtr ( TTTrackPtrT< T aTrack) const

Get principle TP associated to a L1 track. (Non-NULL if isLooselyGenuine() below is true). (N.B. There is no function returning all TP associated to a L1 track).

Referenced by l1tVertexFinder::VertexNTupler::analyze().

◆ findTrackingParticlePtr() [3/3]

template<>
const TrackingParticlePtr & TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::findTrackingParticlePtr ( TTTrackPtr  aTrack) const

Operations.

◆ findTTTrackPtrs() [1/3]

template<>
const std::vector< TTTrackPtr > & TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::findTTTrackPtrs ( TrackingParticlePtr  aTrackingParticle) const

Definition at line 22 of file TTTrackAssociationMap.cc.

23  {
24  if (trackingParticleToTrackVectorMap_.find(aTrackingParticle) != trackingParticleToTrackVectorMap_.end()) {
25  return trackingParticleToTrackVectorMap_.find(aTrackingParticle)->second;
26  } else {
27  return nullVecTTTrackPtr_;
28  }
29 }
static const std::vector< TTTrackPtr > nullVecTTTrackPtr_
MapTPToVecL1Track< T > trackingParticleToTrackVectorMap_

◆ findTTTrackPtrs() [2/3]

template<typename T>
const std::vector<TTTrackPtrT<T> >& TTTrackAssociationMap< T >::findTTTrackPtrs ( TrackingParticlePtr  aTrackingParticle) const

Get all L1 tracks associated to a TP. (Even if the TP just contributes to one cluster in one stub, and even if their are other such TP, it is still listed here).

◆ findTTTrackPtrs() [3/3]

template<>
const std::vector< TTTrackPtr > & TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::findTTTrackPtrs ( TrackingParticlePtr  aTrackingParticle) const

◆ getAllowOneFalse2SStub() [1/2]

template<typename T>
bool TTTrackAssociationMap< T >::getAllowOneFalse2SStub ( )

◆ getAllowOneFalse2SStub() [2/2]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::getAllowOneFalse2SStub ( )

Definition at line 108 of file TTTrackAssociationMap.cc.

108  {
109  return AllowOneFalse2SStub;
110 }

◆ getTrackingParticleToTTTracksMap()

template<typename T>
const MapTPToVecL1Track<T>& TTTrackAssociationMap< T >::getTrackingParticleToTTTracksMap ( ) const
inline

◆ getTTTrackToTrackingParticleMap()

template<typename T>
const MapL1TrackToTP<T>& TTTrackAssociationMap< T >::getTTTrackToTrackingParticleMap ( ) const
inline

Get/set stub <-> truth association maps.

Definition at line 56 of file TTTrackAssociationMap.h.

References TTTrackAssociationMap< T >::trackToTrackingParticleMap_.

MapL1TrackToTP< T > trackToTrackingParticleMap_
Data members.

◆ isCombinatoric() [1/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isCombinatoric ( TTTrackPtr  aTrack) const

Defined by exclusion

Definition at line 74 of file TTTrackAssociationMap.cc.

74  {
76  if (this->isLooselyGenuine(aTrack))
77  return false;
78 
79  if (this->isUnknown(aTrack))
80  return false;
81 
82  return true;
83 }
bool isUnknown(TTTrackPtrT< T > aTrack) const
More than one stub on track is "unknown".
bool isLooselyGenuine(TTTrackPtrT< T > aTrack) const

◆ isCombinatoric() [2/3]

template<typename T>
bool TTTrackAssociationMap< T >::isCombinatoric ( TTTrackPtrT< T aTrack) const

◆ isCombinatoric() [3/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isCombinatoric ( TTTrackPtr  aTrack) const

◆ isGenuine() [1/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isGenuine ( TTTrackPtr  aTrack) const

MC truth.

Check if there is an associated TrackingParticle

Get all the stubs from this track & associated TrackingParticle

We want that all the stubs of the track are included in the container of all the stubs produced by this particular TrackingParticle which we already know is one of the TrackingParticles that released hits in this track we are evaluating right now Now modifying to allow one and only one false 2S stub in the track idr 06/19

Definition at line 43 of file TTTrackAssociationMap.cc.

References spr::find().

43  {
45  if ((this->findTrackingParticlePtr(aTrack)).isNull())
46  return false;
47 
49  const std::vector<TTStubRef>& TRK_Stubs = aTrack->getStubRefs();
50  const std::vector<TTStubRef>& TP_Stubs =
52 
53  bool one2SStub = false;
54  for (unsigned int js = 0; js < TRK_Stubs.size(); js++) {
60  if (std::find(TP_Stubs.begin(), TP_Stubs.end(), TRK_Stubs.at(js)) == TP_Stubs.end()) {
61  if (!AllowOneFalse2SStub || TRK_Stubs.at(js)->moduleTypePS() || one2SStub) // Has to be first false 2S stub
62  {
63  return false;
64  } else {
65  one2SStub = true;
66  }
67  }
68  }
69 
70  return true;
71 }
const TrackingParticlePtr & findTrackingParticlePtr(TTTrackPtrT< T > aTrack) const
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::vector< TTStubRefT< T > > & findTTStubRefs(TrackingParticlePtr aTrackingParticle) const
edm::RefProd< TTStubAssociationMap< T > > theStubAssociationMap_

◆ isGenuine() [2/3]

template<typename T>
bool TTTrackAssociationMap< T >::isGenuine ( TTTrackPtrT< T aTrack) const

— Get quality of L1 track based on truth info. (N.B. "genuine" tracks are used for official L1 track efficiency measurements). Exactly one (i.e. not 0 or >= 2) unique TP contributes to every stub on the track. (even if it is not the principle TP in a stub, or contributes to only one cluster in the stub, it still counts). N.B. If cfg param getAllowOneFalse2SStub() is true, then one incorrect stub in a 2S module is alowed ISSUE: a track with 4 stubs can be accepted if only 3 of its stubs are correct! ISSUE: isLooselyGenuine() must also be true. So if 2 TPs match track, one with an incorrect PS stub, both isGenuine() & isLooselyGenuine() will be false!

Referenced by l1tVertexFinder::VertexNTupler::analyze().

◆ isGenuine() [3/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isGenuine ( TTTrackPtr  aTrack) const

MC truth.

◆ isLooselyGenuine() [1/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isLooselyGenuine ( TTTrackPtr  aTrack) const

MC truth.

Check if there is a TrackingParticle

Definition at line 33 of file TTTrackAssociationMap.cc.

33  {
35  if ((this->findTrackingParticlePtr(aTrack)).isNull())
36  return false;
37 
38  return true;
39 }
const TrackingParticlePtr & findTrackingParticlePtr(TTTrackPtrT< T > aTrack) const

◆ isLooselyGenuine() [2/3]

template<typename T>
bool TTTrackAssociationMap< T >::isLooselyGenuine ( TTTrackPtrT< T aTrack) const

Same criteria as for "genuine" track, except that one incorrect stub in either PS or 2S module is allowed, irrespective of value of cfg param getAllowOneFalse2SStub().

Referenced by l1tVertexFinder::VertexNTupler::analyze().

◆ isLooselyGenuine() [3/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isLooselyGenuine ( TTTrackPtr  aTrack) const

MC truth.

◆ isUnknown() [1/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isUnknown ( TTTrackPtr  aTrack) const

UNKNOWN means that >= 2 stubs are unknown

Definition at line 86 of file TTTrackAssociationMap.cc.

References mps_fire::i.

86  {
88  int unknownstubs = 0;
89 
90  const std::vector<TTStubRef>& theseStubs = aTrack->getStubRefs();
91  for (unsigned int i = 0; i < theseStubs.size(); i++) {
92  if (theStubAssociationMap_->isUnknown(theseStubs.at(i)) == false) {
93  ++unknownstubs;
94  if (unknownstubs >= 2)
95  return false;
96  }
97  }
98 
99  return true;
100 }
bool isUnknown(TTStubRefT< T > aStub) const
edm::RefProd< TTStubAssociationMap< T > > theStubAssociationMap_

◆ isUnknown() [2/3]

template<typename T>
bool TTTrackAssociationMap< T >::isUnknown ( TTTrackPtrT< T aTrack) const

More than one stub on track is "unknown".

Referenced by l1tVertexFinder::VertexNTupler::analyze().

◆ isUnknown() [3/3]

template<>
bool TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::isUnknown ( TTTrackPtr  aTrack) const

◆ setAllowOneFalse2SStub() [1/2]

template<typename T>
void TTTrackAssociationMap< T >::setAllowOneFalse2SStub ( bool  allowFalse2SStub)

◆ setAllowOneFalse2SStub() [2/2]

template<>
void TTTrackAssociationMap< Ref_Phase2TrackerDigi_ >::setAllowOneFalse2SStub ( bool  allowFalse2SStub)

Definition at line 103 of file TTTrackAssociationMap.cc.

103  {
104  AllowOneFalse2SStub = allowFalse2SStub;
105 }

◆ setTrackingParticleToTTTracksMap()

template<typename T>
void TTTrackAssociationMap< T >::setTrackingParticleToTTTracksMap ( const MapTPToVecL1Track< T > &  aMap)
inline

◆ setTTStubAssociationMap()

template<typename T>
void TTTrackAssociationMap< T >::setTTStubAssociationMap ( edm::RefProd< TTStubAssociationMap< T >>  aStubAssoMap)
inline

Set stub <-> truth association object.

Definition at line 63 of file TTTrackAssociationMap.h.

References TTTrackAssociationMap< T >::theStubAssociationMap_.

63  {
64  theStubAssociationMap_ = aStubAssoMap;
65  }
edm::RefProd< TTStubAssociationMap< T > > theStubAssociationMap_

◆ setTTTrackToTrackingParticleMap()

template<typename T>
void TTTrackAssociationMap< T >::setTTTrackToTrackingParticleMap ( const MapL1TrackToTP< T > &  aMap)
inline

Definition at line 59 of file TTTrackAssociationMap.h.

References TTTrackAssociationMap< T >::trackToTrackingParticleMap_.

MapL1TrackToTP< T > trackToTrackingParticleMap_
Data members.

Member Data Documentation

◆ AllowOneFalse2SStub

template<typename T>
bool TTTrackAssociationMap< T >::AllowOneFalse2SStub
private

Definition at line 106 of file TTTrackAssociationMap.h.

◆ nullTrackingParticlePtr_

template<typename T>
const TrackingParticlePtr TTTrackAssociationMap< T >::nullTrackingParticlePtr_
staticprivate

Close class.

Implementation of methods

Here, in the header file, the methods which do not depend on the specific type <T> that can fit the template. Other methods, with type-specific features, are implemented in the source file.

Definition at line 109 of file TTTrackAssociationMap.h.

◆ nullVecTTTrackPtr_

template<typename T>
const std::vector< TTTrackPtr > TTTrackAssociationMap< T >::nullVecTTTrackPtr_
staticprivate

Definition at line 110 of file TTTrackAssociationMap.h.

◆ theStubAssociationMap_

template<typename T>
edm::RefProd<TTStubAssociationMap<T> > TTTrackAssociationMap< T >::theStubAssociationMap_
private

◆ trackingParticleToTrackVectorMap_

template<typename T>
MapTPToVecL1Track<T> TTTrackAssociationMap< T >::trackingParticleToTrackVectorMap_
private

◆ trackToTrackingParticleMap_

template<typename T>
MapL1TrackToTP<T> TTTrackAssociationMap< T >::trackToTrackingParticleMap_
private