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