Belle II Software development
Belle2::AnalyzingAlgorithmHelper Namespace Reference

INFO This file contains all the algorithms retrieving infos from Clusters. More...

Functions

template<class TrackCandType >
std::vector< const Belle2::SVDCluster * > getSVDClusters (const TrackCandType *aTC, bool wantUCluster)
 helper function to retrieve SVDClusters from a given TC
 
template<class ClusterType >
std::vector< const ClusterType * > getUniqueClusters (std::vector< const ClusterType * > &firstTC, std::vector< const ClusterType * > &secondTC)
 helper function to retrieve the number of unique Clusters of first tc given, compared with second tc
 

Detailed Description

INFO This file contains all the algorithms retrieving infos from Clusters.

to cluster helper functions for AnalyzingAlgorithms

Function Documentation

◆ getSVDClusters()

std::vector< const Belle2::SVDCluster * > getSVDClusters ( const TrackCandType *  aTC,
bool  wantUCluster 
)

helper function to retrieve SVDClusters from a given TC

Definition at line 40 of file AnalyzingAlgorithmClusterBased.h.

41 {
42 std::vector<const Belle2::SVDCluster*> clusters;
43 for (const Belle2::SpacePoint* aHit : aTC->getHits()) {
44 auto relatedClusters = aHit->getRelationsTo<SVDCluster>("ALL");
45 for (const Belle2::SVDCluster& aCluster : relatedClusters) {
46 if (aCluster.isUCluster() == wantUCluster) { clusters.push_back(&aCluster); }
47 }
48 }
49 // cppcheck-suppress returnDanglingLifetime
50 return clusters;
51 }
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42

◆ getUniqueClusters()

std::vector< const ClusterType * > getUniqueClusters ( std::vector< const ClusterType * > &  firstTC,
std::vector< const ClusterType * > &  secondTC 
)

helper function to retrieve the number of unique Clusters of first tc given, compared with second tc

WARNING: unique clusters of secondTC are ignored on purpose! if you want both, just re-run the function with switched sides for first and second TC

Definition at line 60 of file AnalyzingAlgorithmClusterBased.h.

62 {
63 auto compareClusters = [](const ClusterType * a, const ClusterType * b) -> bool {
64 return (a->getSensorID() == b->getSensorID()
65 and a->isUCluster() == b->isUCluster()
66 and a->getPosition() == b->getPosition()); };
67
68 std::vector<const ClusterType*> uniqueClusters;
69 for (const auto* firstCluster : firstTC) {
70 for (const auto* secondCluster : secondTC) {
71 if (compareClusters(firstCluster, secondCluster)) { uniqueClusters.push_back(firstCluster); break; }
72 }
73 }
74 return uniqueClusters;
75 }