Belle II Software  release-08-01-10
SegmentFinderFacetAutomaton.cc
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 #include <tracking/trackFindingCDC/findlets/combined/SegmentFinderFacetAutomaton.h>
9 
10 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
11 
12 #include <framework/core/ModuleParamList.templateDetails.h>
13 #include <framework/core/ModuleParam.h>
14 
15 using namespace Belle2;
16 using namespace TrackFindingCDC;
17 
19 {
24 
28 
30 
31  m_facets.reserve(1000);
32  m_facetRelations.reserve(1000);
33  m_segments.reserve(200);
34  m_intermediateSegments.reserve(200);
35 
36  ModuleParamList moduleParamList;
37  const std::string prefix = "";
38  this->exposeParameters(&moduleParamList, prefix);
39  moduleParamList.getParameter<std::string>("SegmentOrientation").setDefaultValue("curling");
40 }
41 
43 {
44  return "Generates segments from hits using a cellular automaton build from hit triples (facets).";
45 }
46 
47 void SegmentFinderFacetAutomaton::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
48 {
49  m_facetCreator.exposeParameters(moduleParamList, prefixed(prefix, "Facet"));
50  m_facetRelationCreator.exposeParameters(moduleParamList, prefixed(prefix, "FacetRelation"));
51  m_segmentCreatorFacetAutomaton.exposeParameters(moduleParamList, prefix);
52  m_segmentLinker.exposeParameters(moduleParamList, prefixed(prefix, "SegmentRelation"));
53 
54  m_segmentFitter.exposeParameters(moduleParamList, prefix);
55  m_segmentAliasResolver.exposeParameters(moduleParamList, prefix);
56  m_segmentOrienter.exposeParameters(moduleParamList, prefix);
57 
58  m_facetSwapper.exposeParameters(moduleParamList, prefix);
59 }
60 
62 {
63  m_facets.clear();
64  m_facetRelations.clear();
65  m_segments.clear();
66  m_intermediateSegments.clear();
68 }
69 
70 void SegmentFinderFacetAutomaton::apply(std::vector<CDCWireHitCluster>& clusters, std::vector<CDCSegment2D>& outputSegments)
71 {
72  outputSegments.reserve(200);
73 
74  m_facetCreator.apply(clusters, m_facets);
75 
76  std::vector<const CDCFacet*> facetPtrs = as_pointers<const CDCFacet>(m_facets);
77  m_facetRelationCreator.apply(facetPtrs, m_facetRelations);
78  if (m_facetRelations.size() == 0) return; // Break point for facet recording runs
79 
82 
85 
88 
90  m_segmentFitter.apply(outputSegments);
91  m_segmentFitter.apply(outputSegments);
92 
93  // Move facets to the DataStore
94  m_facetSwapper.apply(m_facets);
95 }
The Module parameter list class.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void beginEvent() override
Receive and dispatch signal for the start of a new event.
void apply(const std::vector< CDCWireHitCluster > &inputClusters, std::vector< CDCFacet > &facets) final
Central function creating the hit triplets from the clusters.
Definition: FacetCreator.cc:58
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
Definition: FacetCreator.cc:40
void apply(std::vector< CDCSegment2D > &outputSegments) final
Main algorithm applying the fit to each segment.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(const std::vector< CDCFacet > &inputFacets, const std::vector< WeightedRelation< const CDCFacet >> &inputFacetRelations, std::vector< CDCSegment2D > &outputSegments) final
Main function of the segment finding by the cellular automaton.
SegmentLinker m_segmentLinker
Link segments with closeby segments of the same super cluster.
SegmentAliasResolver m_segmentAliasResolver
Resolves ambiguous right left information alias segments and hits.
SegmentOrienter m_segmentOrienter
Adjustes the orientation of the generated segments to a prefered direction of flight.
void beginEvent() final
Signal the beginning of a new event.
SegmentFitter m_segmentFitter
Fits the generated segments.
std::vector< WeightedRelation< const CDCFacet > > m_facetRelations
Memory for the generated facet relations.
std::string getDescription() final
Short description of the findlet.
SegmentCreatorFacetAutomaton m_segmentCreatorFacetAutomaton
Find the segments by composition of facets path from a cellular automaton.
FacetCreator m_facetCreator
Creates the facet (hit triplet) cells of the cellular automaton.
SegmentFinderFacetAutomaton()
Constructor registering the subordinary findlets to the processing signal distribution machinery.
std::vector< CDCFacet > m_facets
Memory for the generated facets.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
WeightedRelationCreator< const CDCFacet, ChooseableFacetRelationFilter > m_facetRelationCreator
Creates the facet (hit triplet) relations of the cellular automaton.
std::vector< CDCSegment2D > m_intermediateSegments
Memory for the reconstructed segments.
void apply(std::vector< CDCWireHitCluster > &clusters, std::vector< CDCSegment2D > &outputSegments) final
Generates the segment from wire hits.
std::vector< CDCSegment2D > m_segments
Memory for the reconstructed segments.
StoreVectorSwapper< CDCFacet > m_facetSwapper
Puts the internal facets on the DataStore.
void apply(std::vector< CDCSegment2D > &outputSegments) override
Main algorithm applying the fit to each segment.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters to a module.
void apply(const std::vector< CDCSegment2D > &inputSegment2Ds, std::vector< CDCSegment2D > &outputSegment2Ds) final
Main algorithm.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void apply(const std::vector< CDCSegment2D > &inputSegments, std::vector< CDCSegment2D > &outputSegments) final
Main algorithm applying the adjustment of the orientation.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Abstract base class for different kinds of events.