Belle II Software  release-08-01-10
ClusterCreator.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/findlets/base/Findlet.h>
11 
12 #include <tracking/trackFindingCDC/filters/wireHitRelation/WholeWireHitRelationFilter.h>
13 
14 #include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
15 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
16 
17 #include <tracking/trackFindingCDC/ca/Clusterizer.h>
18 
19 #include <tracking/trackFindingCDC/filters/base/RelationFilterUtil.h>
20 
21 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
22 
23 #include <vector>
24 #include <string>
25 
26 namespace Belle2 {
31  namespace TrackFindingCDC {
32 
34  template <class AWireHitRelationFilter = WholeWireHitRelationFilter>
35  class ClusterCreator : public Findlet<CDCWireHit&, CDCWireHitCluster> {
36 
37  private:
40 
41  public:
44  {
46  }
47 
49  std::string getDescription() final {
50  return "Groups the wire hits into super by expanding the given wire hit relation";
51  }
52 
53  public:
55  void apply(std::vector<CDCWireHit>& inputWireHits,
56  std::vector<CDCWireHitCluster>& outputClusters) final {
57 
58  // Obtain the wire hits as pointers.
59  const std::vector<CDCWireHit*> wireHitPtrs = as_pointers<CDCWireHit>(inputWireHits);
60 
61  // create the neighborhood
62  m_wireHitRelations.clear();
64 
65  B2ASSERT("Expect wire hit neighborhood to be symmetric ",
67 
68  // Compose the clusters
69  m_wirehitClusterizer.apply(wireHitPtrs, m_wireHitRelations, outputClusters);
70  }
71 
72  private:
75 
77  std::vector<WeightedRelation<CDCWireHit>> m_wireHitRelations;
78 
80  AWireHitRelationFilter m_wireHitRelationFilter;
81  };
82  }
84 }
Refines the clustering of wire hits from clusters to clusters.
void apply(std::vector< CDCWireHit > &inputWireHits, std::vector< CDCWireHitCluster > &outputClusters) final
Main algorithm applying the cluster refinement.
std::vector< WeightedRelation< CDCWireHit > > m_wireHitRelations
Memory for the wire hit neighborhood in a cluster.
AWireHitRelationFilter m_wireHitRelationFilter
Wire hit neighborhood relation filter.
std::string getDescription() final
Short description of the findlet.
Clusterizer< CDCWireHit, CDCWireHitCluster > m_wirehitClusterizer
Instance of the hit cluster generator.
ClusterCreator()
Constructor adding the filter as a subordinary processing signal listener.
Implementation of the clustering Clusters elements of a given collection using the relations presente...
Definition: Clusterizer.h:41
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition: Findlet.h:26
Abstract base class for different kinds of events.
static void appendUsing(ARelationFilter &relationFilter, const std::vector< AObject * > &froms, const std::vector< AObject * > &tos, std::vector< WeightedRelation< AObject >> &weightedRelations, unsigned int maximumNumberOfRelations=std::numeric_limits< unsigned int >::max())
Appends relations between elements in the given AItems using the ARelationFilter.
Utility structure with functions related to weighted relations.