16 #ifndef L1_TRACK_TRIGGER_CLUSTER_ASSOCIATION_FORMAT_H
17 #define L1_TRACK_TRIGGER_CLUSTER_ASSOCIATION_FORMAT_H
39 using MapClusToVecTP = std::map<TTClusterRefT<T>, std::vector<TrackingParticlePtr>>;
41 using MapTPToVecClus = std::map<TrackingParticlePtr, std::vector<TTClusterRefT<T>>>;
103 template <
typename T>
105 template <
typename T>
107 template <
typename T>
112 template <
typename T>
119 template <
typename T>
123 template <
typename T>
126 if (trackingParticleToClusterVectorMap_.find(aTrackingParticle) != trackingParticleToClusterVectorMap_.end()) {
127 return trackingParticleToClusterVectorMap_.find(aTrackingParticle)->second;
129 return nullVecClusterRef_;
133 template <
typename T>
136 if (clusterToTrackingParticleVectorMap_.find(aCluster) != clusterToTrackingParticleVectorMap_.end()) {
137 return clusterToTrackingParticleVectorMap_.find(aCluster)->second;
139 return nullVecTrackingParticlePtr_;
143 template <
typename T>
145 if (this->isGenuine(aCluster)) {
146 return this->findTrackingParticlePtrs(aCluster).at(0);
148 return nullTrackingParticlePtr_;
176 template <
typename T>
179 const std::vector<TrackingParticlePtr>& theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
182 if (theseTrackingParticles.empty())
186 unsigned int nullTPs = 0;
187 unsigned int goodDifferentTPs = 0;
188 std::vector<const TrackingParticle*> tpAddressVector;
190 std::vector<float> tp_mom;
195 for (
const auto&
tp : theseTrackingParticles) {
204 tp_mom.push_back(curTP.
get()->p4().pt());
205 tp_tot += curTP.
get()->p4().pt();
212 for (
unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
217 if (tp_mom.at(itp) <= 0.01 * tp_tot) {
222 tpAddressVector.push_back(curTP.
get());
227 std::sort(tpAddressVector.begin(), tpAddressVector.end());
228 tpAddressVector.erase(
std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
229 goodDifferentTPs = tpAddressVector.size();
231 return (goodDifferentTPs == 1);
234 template <
typename T>
237 const std::vector<TrackingParticlePtr>& theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
240 if (theseTrackingParticles.empty())
244 unsigned int goodDifferentTPs = 0;
245 std::vector<const TrackingParticle*> tpAddressVector;
248 for (
unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
256 tpAddressVector.push_back(curTP.
get());
261 std::sort(tpAddressVector.begin(), tpAddressVector.end());
262 tpAddressVector.erase(
std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
263 goodDifferentTPs = tpAddressVector.size();
266 return (goodDifferentTPs == 0);
269 template <
typename T>
272 const std::vector<TrackingParticlePtr>& theseTrackingParticles = this->findTrackingParticlePtrs(aCluster);
275 if (theseTrackingParticles.empty())
278 bool genuineClu = this->isGenuine(aCluster);
279 bool unknownClu = this->isUnknown(aCluster);
281 if (genuineClu || unknownClu)
287 unsigned int nullTPs = 0;
288 unsigned int goodDifferentTPs = 0;
289 std::vector<const TrackingParticle*> tpAddressVector;
292 for (
unsigned int itp = 0; itp < theseTrackingParticles.size(); itp++) {
302 tpAddressVector.push_back(curTP.
get());
307 std::sort(tpAddressVector.begin(), tpAddressVector.end());
308 tpAddressVector.erase(
std::unique(tpAddressVector.begin(), tpAddressVector.end()), tpAddressVector.end());
309 goodDifferentTPs = tpAddressVector.size();
314 return (goodDifferentTPs > 1);
void setTTClusterToTrackingParticlesMap(const MapClusToVecTP< T > &aMap)
~TTClusterAssociationMap()
Destructor.
MapClusToVecTP< T > clusterToTrackingParticleVectorMap_
Data members.
const MapTPToVecClus< T > & getTrackingParticleToTTClustersMap() const
std::map< TTClusterRefT< T >, std::vector< TrackingParticlePtr >> MapClusToVecTP
NOTE: this is needed even if it seems not.
static const std::vector< TTClusterRefT< T > > nullVecClusterRef_
T const * get() const
Returns C++ pointer to the item.
const std::vector< TrackingParticlePtr > & findTrackingParticlePtrs(TTClusterRefT< T > aCluster) const
Get all TPs associated to a cluster.
Stores association of Truth Particles (TP) to L1 Track-Trigger Clusters.
bool isUnknown(TTClusterRefT< T > aCluster) const
Cluster "unknown": i.e. not associated with any TP.
static const TrackingParticlePtr nullTrackingParticlePtr_
Close class.
TTClusterAssociationMap()
Constructors.
bool isNull() const
Checks for null.
const MapClusToVecTP< T > & getTTClusterToTrackingParticlesMap() const
Get/set cluster <-> truth association maps.
void setTrackingParticleToTTClustersMap(const MapTPToVecClus< T > &aMap)
static const std::vector< TrackingParticlePtr > nullVecTrackingParticlePtr_
std::map< TrackingParticlePtr, std::vector< TTClusterRefT< T >>> MapTPToVecClus
const std::vector< TTClusterRefT< T > > & findTTClusterRefs(TrackingParticlePtr aTrackingParticle) const
Operations.
bool isCombinatoric(TTClusterRefT< T > aCluster) const
Cluster is not "genuine" or "unknown".
MapTPToVecClus< T > trackingParticleToClusterVectorMap_
const TrackingParticlePtr & findTrackingParticlePtr(TTClusterRefT< T > aCluster) const
Get main TP associated to a cluster. (Non-NULL if isGenuine() below is true).
bool isGenuine(TTClusterRefT< T > aCluster) const