CMS 3D CMS Logo

TTStubAssociationMap.h
Go to the documentation of this file.
1 
18 #ifndef SimDataFormats_Associations_TTStubAssociationMap_h
19 #define SimDataFormats_Associations_TTStubAssociationMap_h
20 
39 
40 // Templated aliases
41 template <typename T>
42 using MapStubToTP = std::map<TTStubRefT<T>, TrackingParticlePtr>;
43 template <typename T>
44 using MapTPToVecStub = std::map<TrackingParticlePtr, std::vector<TTStubRefT<T>>>;
45 
46 template <typename T>
48 public:
51 
54 
56 
59 
62 
65  theClusterAssociationMap_ = aCluAssoMap;
66  }
67 
73 
77  const std::vector<TTStubRefT<T>>& findTTStubRefs(TrackingParticlePtr aTrackingParticle) const;
78 
83 
94 
95  bool isGenuine(TTStubRefT<T> aStub) const;
96  bool isCombinatoric(TTStubRefT<T> aStub) const;
97  bool isUnknown(TTStubRefT<T> aStub) const;
98 
99 private:
104 
105  // Allow functions to return reference to null.
107  static const std::vector<TTStubRefT<T>> nullVecStubRef_;
108 
109 };
110 
118 // Static constant data members.
119 template <typename T>
121 template <typename T>
122 const std::vector<TTStubRefT<T>> TTStubAssociationMap<T>::nullVecStubRef_;
123 
126 template <typename T>
129 }
130 
132 template <typename T>
134 
136 template <typename T>
138  if (stubToTrackingParticleMap_.find(aStub) != stubToTrackingParticleMap_.end()) {
139  return stubToTrackingParticleMap_.find(aStub)->second;
140  } else {
141  return nullTrackingParticlePtr_;
142  }
143 }
144 
145 template <typename T>
146 const std::vector<TTStubRefT<T>>& TTStubAssociationMap<T>::findTTStubRefs(TrackingParticlePtr aTrackingParticle) const {
147  if (trackingParticleToStubVectorMap_.find(aTrackingParticle) != trackingParticleToStubVectorMap_.end()) {
148  return trackingParticleToStubVectorMap_.find(aTrackingParticle)->second;
149  } else {
150  return nullVecStubRef_;
151  }
152 }
153 
155 template <typename T>
158  if ((this->findTrackingParticlePtr(aStub)).isNull())
159  return false;
160 
161  return true;
162 }
163 
164 template <typename T>
167  if (this->isGenuine(aStub))
168  return false;
169 
170  if (this->isUnknown(aStub))
171  return false;
172 
173  return true;
174 }
175 
176 template <typename T>
179 
181  if (theClusterAssociationMap_.isNull()) {
182  return true;
183  }
184 
185  if (theClusterAssociationMap_->isUnknown(aStub->clusterRef(0)) &&
186  theClusterAssociationMap_->isUnknown(aStub->clusterRef(1)))
187  return true;
188 
189  return false;
190 }
191 
192 #endif
TTStubAssociationMap()
Constructors.
MapTPToVecStub< T > trackingParticleToStubVectorMap_
const TrackingParticlePtr & findTrackingParticlePtr(TTStubRefT< T > aStub) const
Operations.
std::map< TTStubRefT< T >, TrackingParticlePtr > MapStubToTP
NOTE: this is needed even if it seems not.
bool isCombinatoric(TTStubRefT< T > aStub) const
bool isUnknown(TTStubRefT< T > aStub) const
std::map< TrackingParticlePtr, std::vector< TTStubRefT< T > >> MapTPToVecStub
void setTTClusterAssociationMap(edm::RefProd< TTClusterAssociationMap< T >> aCluAssoMap)
Set cluster <-> truth association object.
Stores association of Truth Particles (TP) to L1 Track-Trigger Clusters.
edm::RefProd< TTClusterAssociationMap< T > > theClusterAssociationMap_
static const std::vector< TTStubRefT< T > > nullVecStubRef_
const std::vector< TTStubRefT< T > > & findTTStubRefs(TrackingParticlePtr aTrackingParticle) const
~TTStubAssociationMap()
Destructor.
void setTrackingParticleToTTStubsMap(const MapTPToVecStub< T > &aMap)
static const TrackingParticlePtr nullTrackingParticlePtr_
Close class.
MapStubToTP< T > stubToTrackingParticleMap_
Data members.
void setTTStubToTrackingParticleMap(const MapStubToTP< T > &aMap)
bool isGenuine(TTStubRefT< T > aStub) const
MC truth.
const MapStubToTP< T > & getTTStubToTrackingParticleMap() const
Get/set stub <-> truth association maps.
const MapTPToVecStub< T > & getTrackingParticleToTTStubsMap() const
Stores association of Truth Particles (TP) to L1 Track-Trigger Stubs.