CMS 3D CMS Logo

TTStubAssociationMap.h
Go to the documentation of this file.
1 
18 #ifndef L1_TRACK_TRIGGER_STUB_ASSOCIATION_FORMAT_H
19 #define L1_TRACK_TRIGGER_STUB_ASSOCIATION_FORMAT_H
20 
31 //#include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
41 
42 // Templated aliases
43 template <typename T>
44 using MapStubToTP = std::map<TTStubRefT<T>, TrackingParticlePtr>;
45 template <typename T>
46 using MapTPToVecStub = std::map<TrackingParticlePtr, std::vector<TTStubRefT<T>>>;
47 
48 template <typename T>
50 public:
53 
56 
58 
61 
64 
67  theClusterAssociationMap_ = aCluAssoMap;
68  }
69 
75 
79  const std::vector<TTStubRefT<T>>& findTTStubRefs(TrackingParticlePtr aTrackingParticle) const;
80 
85 
96 
97  bool isGenuine(TTStubRefT<T> aStub) const;
98  bool isCombinatoric(TTStubRefT<T> aStub) const;
99  bool isUnknown(TTStubRefT<T> aStub) const;
100 
101 private:
106 
107  // Allow functions to return reference to null.
109  static const std::vector<TTStubRefT<T>> nullVecStubRef_;
110 
111 };
112 
120 // Static constant data members.
121 template <typename T>
123 template <typename T>
124 const std::vector<TTStubRefT<T>> TTStubAssociationMap<T>::nullVecStubRef_;
125 
128 template <typename T>
131 }
132 
134 template <typename T>
136 
138 template <typename T>
140  if (stubToTrackingParticleMap_.find(aStub) != stubToTrackingParticleMap_.end()) {
141  return stubToTrackingParticleMap_.find(aStub)->second;
142  } else {
143  return nullTrackingParticlePtr_;
144  }
145 }
146 
147 template <typename T>
148 const std::vector<TTStubRefT<T>>& TTStubAssociationMap<T>::findTTStubRefs(TrackingParticlePtr aTrackingParticle) const {
149  if (trackingParticleToStubVectorMap_.find(aTrackingParticle) != trackingParticleToStubVectorMap_.end()) {
150  return trackingParticleToStubVectorMap_.find(aTrackingParticle)->second;
151  } else {
152  return nullVecStubRef_;
153  }
154 }
155 
157 template <typename T>
160  if ((this->findTrackingParticlePtr(aStub)).isNull())
161  return false;
162 
163  return true;
164 }
165 
166 template <typename T>
169  if (this->isGenuine(aStub))
170  return false;
171 
172  if (this->isUnknown(aStub))
173  return false;
174 
175  return true;
176 }
177 
178 template <typename T>
181 
183  if (theClusterAssociationMap_.isNull()) {
184  return true;
185  }
186 
187  if (theClusterAssociationMap_->isUnknown(aStub->clusterRef(0)) &&
188  theClusterAssociationMap_->isUnknown(aStub->clusterRef(1)))
189  return true;
190 
191  return false;
192 }
193 
194 #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.