Belle II Software development
FacetCreator Class Referenceabstract

Class providing construction combinatorics for the facets. More...

#include <FacetCreator.h>

Inheritance diagram for FacetCreator:
Findlet< const TrackingUtilities::CDCWireHitCluster, TrackingUtilities::CDCFacet > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes
 Types that should be served to apply on invocation.
 
using IOTypes
 Types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 
using IOVectors
 Vector types that should be served to apply on invocation.
 

Public Member Functions

 FacetCreator ()
 Constructor adding the filter as a subordinary processing signal listener.
 
std::string getDescription () final
 Short description of the findlet.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) final
 Expose the parameters to a module.
 
void apply (const std::vector< TrackingUtilities::CDCWireHitCluster > &inputClusters, std::vector< TrackingUtilities::CDCFacet > &facets) final
 Central function creating the hit triplets from the clusters.
 
virtual void apply (ToVector< AIOTypes > &... ioVectors)=0
 Main function executing the algorithm.
 
void initialize () override
 Receive and dispatch signal before the start of the event processing.
 
void beginRun () override
 Receive and dispatch signal for the beginning of a new run.
 
void beginEvent () override
 Receive and dispatch signal for the start of a new event.
 
void endRun () override
 Receive and dispatch signal for the end of the run.
 
void terminate () override
 Receive and dispatch Signal for termination of the event processing.
 

Protected Types

using ToVector
 Short hand for ToRangeImpl.
 
using ToVector
 Short hand for ToRangeImpl.
 

Protected Member Functions

void addProcessingSignalListener (ProcessingSignalListener *psl)
 Register a processing signal listener to be notified.
 
int getNProcessingSignalListener ()
 Get the number of currently registered listeners.
 

Private Types

using Super = TrackingUtilities::Findlet<const TrackingUtilities::CDCWireHitCluster, TrackingUtilities::CDCFacet>
 Type of the base class.
 

Private Member Functions

void createFacets (const std::vector< TrackingUtilities::CDCWireHit * > &wireHits, const std::vector< TrackingUtilities::WeightedRelation< TrackingUtilities::CDCWireHit > > &wireHitRelations, std::vector< TrackingUtilities::CDCFacet > &facets)
 Generates facets on the given wire hits generating neighboring triples of hits.
 
void createFacetsForHitTriple (const TrackingUtilities::CDCWireHit &startWireHit, const TrackingUtilities::CDCWireHit &middleWireHit, const TrackingUtilities::CDCWireHit &endWireHit, std::vector< TrackingUtilities::CDCFacet > &facets)
 Generates reconstruted facets on the three given wire hits by hypothesizing over the 8 left right passage combinations.
 

Private Attributes

bool m_param_feasibleRLOnly = true
 Parameter : Switch to apply the rl feasibility cut.
 
bool m_param_updateDriftLength = true
 Parameter : Switch to reestimate the drift length.
 
bool m_param_leastSquareFit = false
 Parameter : Switch to fit the facet with least square method for the drift length update.
 
BridgingWireHitRelationFilter m_wireHitRelationFilter
 The filter for the hit neighborhood.
 
FeasibleRLFacetFilter m_feasibleRLFacetFilter
 The feasibility filter for the right left passage information.
 
ChooseableFacetFilter m_facetFilter
 The filter to be used for the facet generation.
 
DriftLengthEstimator m_driftLengthEstimator
 Instance of the drift length estimator to be used.
 
std::vector< TrackingUtilities::WeightedRelation< TrackingUtilities::CDCWireHit > > m_wireHitRelations
 Memory for the wire hit neighborhood in within a cluster.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized
 Flag to keep track whether initialization happened before.
 
bool m_terminated
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Class providing construction combinatorics for the facets.

Definition at line 38 of file FacetCreator.h.

Member Typedef Documentation

◆ IOTypes [1/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOTypes [2/2]

using IOTypes
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors [1/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ IOVectors [2/2]

using IOVectors
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

Type of the base class.

Definition at line 42 of file FacetCreator.h.

◆ ToVector [1/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

◆ ToVector [2/2]

using ToVector
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ FacetCreator()

Constructor adding the filter as a subordinary processing signal listener.

Definition at line 30 of file FacetCreator.cc.

31{
34}
BridgingWireHitRelationFilter m_wireHitRelationFilter
The filter for the hit neighborhood.
ChooseableFacetFilter m_facetFilter
The filter to be used for the facet generation.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener * psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 53 of file CompositeProcessingSignalListener.cc.

56{
58}
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26

◆ apply()

void apply ( const std::vector< TrackingUtilities::CDCWireHitCluster > & inputClusters,
std::vector< TrackingUtilities::CDCFacet > & facets )
final

Central function creating the hit triplets from the clusters.

Hit triplets are always contained within one cluster and the output hit triplets follow the order of the input clusters such that the triplets of the same cluster remain close to each other.

Definition at line 59 of file FacetCreator.cc.

60{
61 int iCluster = -1;
62 for (const CDCWireHitCluster& cluster : inputClusters) {
63 ++iCluster;
64 // Skip clusters that have been detected as background
65 if (cluster.getBackgroundFlag()) {
66 continue;
67 }
68 B2ASSERT("Expect the clusters to be sorted", std::is_sorted(cluster.begin(), cluster.end()));
69
70 // Obtain the set of wire hits as references
71 const std::vector<CDCWireHit*>& wireHits = cluster;
72
73 // Create the neighborhood of wire hits on the cluster
74 m_wireHitRelations.clear();
76
77 B2ASSERT("Wire neighborhood is not symmetric. Check the geometry.",
79
80 // Create the facets
81 std::size_t nBefore = facets.size();
82 createFacets(cluster, m_wireHitRelations, facets);
83 std::size_t nAfter = facets.size();
84
85 VectorRange<CDCFacet> facetsInCluster(facets.begin() + nBefore, facets.begin() + nAfter);
86 // Sort the facets in their cluster
87 std::sort(facetsInCluster.begin(), facetsInCluster.end());
88
89 B2ASSERT("Expected all facets to be different",
90 std::adjacent_find(facetsInCluster.begin(), facetsInCluster.end()) ==
91 facetsInCluster.end());
92
93 for (CDCFacet& facet : facetsInCluster) {
94 facet.setICluster(iCluster);
95 }
96 }
97}
std::vector< TrackingUtilities::WeightedRelation< TrackingUtilities::CDCWireHit > > m_wireHitRelations
Memory for the wire hit neighborhood in within a cluster.
void createFacets(const std::vector< TrackingUtilities::CDCWireHit * > &wireHits, const std::vector< TrackingUtilities::WeightedRelation< TrackingUtilities::CDCWireHit > > &wireHitRelations, std::vector< TrackingUtilities::CDCFacet > &facets)
Generates facets on the given wire hits generating neighboring triples of hits.
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.
static bool areSymmetric(const AWeightedRelations &weightedRelations)
Checks for the symmetry of a range of weighted relations Explicitly checks for each weighted relation...

◆ beginEvent()

void beginEvent ( )
overrideinherited

Receive and dispatch signal for the start of a new event.

Definition at line 36 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
void beginEvent() override
Receive and dispatch signal for the start of a new event.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overrideinherited

Receive and dispatch signal for the beginning of a new run.

Definition at line 33 of file CompositeProcessingSignalListener.cc.

24{
27 psl->beginRun();
28 }
29}
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
virtual void beginRun()
Receive signal for the beginning of a new run.

◆ createFacets()

void createFacets ( const std::vector< TrackingUtilities::CDCWireHit * > & wireHits,
const std::vector< TrackingUtilities::WeightedRelation< TrackingUtilities::CDCWireHit > > & wireHitRelations,
std::vector< TrackingUtilities::CDCFacet > & facets )
private

Generates facets on the given wire hits generating neighboring triples of hits.

Inserts the result to the end of the GenericFacetCollection.

Definition at line 99 of file FacetCreator.cc.

102{
103 for (const CDCWireHit* ptrMiddleWireHit : wireHits) {
104 if (not ptrMiddleWireHit) continue;
105 const CDCWireHit& middleWireHit = *ptrMiddleWireHit;
106 if (middleWireHit->hasTakenFlag()) continue;
107
108 const auto neighbors = asRange(
109 std::equal_range(wireHitRelations.begin(), wireHitRelations.end(), ptrMiddleWireHit));
110
111 for (const WeightedRelation<CDCWireHit>& startWireHitRelation : neighbors) {
112 const CDCWireHit* ptrStartWireHit(startWireHitRelation.getTo());
113
114 if (not ptrStartWireHit) continue;
115 const CDCWireHit& startWireHit = *ptrStartWireHit;
116 if (startWireHit->hasTakenFlag()) continue;
117
118 for (const WeightedRelation<CDCWireHit>& endWireHitRelation : neighbors) {
119 const CDCWireHit* ptrEndWireHit(endWireHitRelation.getTo());
120
121 if (not ptrEndWireHit) continue;
122 const CDCWireHit& endWireHit = *ptrEndWireHit;
123 if (endWireHit->hasTakenFlag()) continue;
124
125 // Skip combinations where the facet starts and ends on the same wire
126 if (ptrStartWireHit->isOnWire(ptrEndWireHit->getWire())) continue;
127
128 createFacetsForHitTriple(startWireHit, middleWireHit, endWireHit, facets);
129 } // end for itEndWireHit
130 } // end for itStartWireHit
131 } // end for itMiddleWireHit
132}
void createFacetsForHitTriple(const TrackingUtilities::CDCWireHit &startWireHit, const TrackingUtilities::CDCWireHit &middleWireHit, const TrackingUtilities::CDCWireHit &endWireHit, std::vector< TrackingUtilities::CDCFacet > &facets)
Generates reconstruted facets on the three given wire hits by hypothesizing over the 8 left right pas...
bool hasTakenFlag() const
Gets the current state of the taken marker flag.

◆ createFacetsForHitTriple()

void createFacetsForHitTriple ( const TrackingUtilities::CDCWireHit & startWireHit,
const TrackingUtilities::CDCWireHit & middleWireHit,
const TrackingUtilities::CDCWireHit & endWireHit,
std::vector< TrackingUtilities::CDCFacet > & facets )
private

Generates reconstruted facets on the three given wire hits by hypothesizing over the 8 left right passage combinations.

Inserts the result to the end of the GenericFacetCollection.

Prepare a facet - without fitted tangent lines.

Definition at line 134 of file FacetCreator.cc.

138{
140 CDCRLWireHit startRLWireHit(&startWireHit, ERightLeft::c_Left);
141 CDCRLWireHit middleRLWireHit(&middleWireHit, ERightLeft::c_Left);
142 CDCRLWireHit endRLWireHit(&endWireHit, ERightLeft::c_Left);
143 CDCFacet facet(startRLWireHit, middleRLWireHit, endRLWireHit, UncertainParameterLine2D());
144
145 for (ERightLeft startRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
146 facet.setStartRLInfo(startRLInfo);
147 for (ERightLeft middleRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
148 facet.setMiddleRLInfo(middleRLInfo);
149 for (ERightLeft endRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
150 facet.setEndRLInfo(endRLInfo);
151
152 // Reset the lines
153 // The filter shall do the fitting of the tangent lines if it wants to.
154 // He should set them if he accepts the facet.
155 facet.invalidateFitLine();
156
158 Weight feasibleWeight = m_feasibleRLFacetFilter(facet);
159 if (std::isnan(feasibleWeight)) continue;
160 }
161
163
164 // Reset drift length
165 facet.getStartRLWireHit().setRefDriftLength(startWireHit.getRefDriftLength());
166 facet.getMiddleRLWireHit().setRefDriftLength(middleWireHit.getRefDriftLength());
167 facet.getEndRLWireHit().setRefDriftLength(endWireHit.getRefDriftLength());
168
170 /*double chi2 =*/FacetFitter::fit(facet);
171 } else {
172 facet.adjustFitLine();
173 }
174
175 // Update drift length
176 m_driftLengthEstimator.updateDriftLength(facet);
177 }
178
179 Weight weight = m_facetFilter(facet);
180
181 if (not std::isnan(weight)) {
182 facet.getAutomatonCell().setCellWeight(weight);
183 facets.insert(facets.end(), facet);
184 }
185 } // end for endRLWireHit
186 } // end for middleRLWireHit
187 } // end for startRLWireHit
188}
DriftLengthEstimator m_driftLengthEstimator
Instance of the drift length estimator to be used.
bool m_param_feasibleRLOnly
Parameter : Switch to apply the rl feasibility cut.
bool m_param_leastSquareFit
Parameter : Switch to fit the facet with least square method for the drift length update.
bool m_param_updateDriftLength
Parameter : Switch to reestimate the drift length.
FeasibleRLFacetFilter m_feasibleRLFacetFilter
The feasibility filter for the right left passage information.
static double fit(const TrackingUtilities::CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.

◆ endRun()

void endRun ( )
overrideinherited

Receive and dispatch signal for the end of the run.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

40{
42 psl->endRun();
43 }
45}
void endRun() override
Receive and dispatch signal for the end of the run.
virtual void endRun()
Receive signal for the end of the run.

◆ exposeParameters()

void exposeParameters ( ModuleParamList * moduleParamList,
const std::string & prefix )
finalvirtual

Expose the parameters to a module.

Reimplemented from CompositeProcessingSignalListener.

Definition at line 41 of file FacetCreator.cc.

42{
43 m_wireHitRelationFilter.exposeParameters(moduleParamList, prefix);
44 m_feasibleRLFacetFilter.exposeParameters(moduleParamList, prefix);
45 m_facetFilter.exposeParameters(moduleParamList, prefix);
46
47 moduleParamList->addParameter(prefixed(prefix, "updateDriftLength"),
49 "Switch to reestimate the drift length",
51
52 moduleParamList->addParameter(prefixed(prefix, "leastSquareFit"),
54 "Switch to fit the facet with the least square method "
55 "for drift length estimation",
57}
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.

◆ getDescription()

std::string getDescription ( )
finalvirtual

Short description of the findlet.

Reimplemented from Findlet< const TrackingUtilities::CDCWireHitCluster, TrackingUtilities::CDCFacet >.

Definition at line 36 of file FacetCreator.cc.

37{
38 return "Creates hit triplet (facets) from each cluster filtered by a acceptance criterion.";
39}

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 56 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overrideinherited

Receive and dispatch signal before the start of the event processing.

Definition at line 30 of file CompositeProcessingSignalListener.cc.

16{
19 psl->initialize();
20 }
21}
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void initialize()
Receive signal before the start of the event processing.

◆ terminate()

void terminate ( )
overrideinherited

Receive and dispatch Signal for termination of the event processing.

Definition at line 42 of file CompositeProcessingSignalListener.cc.

48{
50 psl->terminate();
51 }
53}
void terminate() override
Receive and dispatch Signal for termination of the event processing.
virtual void terminate()
Receive Signal for termination of the event processing.

Member Data Documentation

◆ m_driftLengthEstimator

DriftLengthEstimator m_driftLengthEstimator
private

Instance of the drift length estimator to be used.

Definition at line 103 of file FacetCreator.h.

◆ m_facetFilter

ChooseableFacetFilter m_facetFilter
private

The filter to be used for the facet generation.

Definition at line 100 of file FacetCreator.h.

◆ m_feasibleRLFacetFilter

FeasibleRLFacetFilter m_feasibleRLFacetFilter
private

The feasibility filter for the right left passage information.

Definition at line 97 of file FacetCreator.h.

◆ m_initialized

bool m_initialized
privateinherited

Flag to keep track whether initialization happened before.

Definition at line 52 of file ProcessingSignalListener.h.

◆ m_initializedAs

std::string m_initializedAs
privateinherited

Name of the type during initialisation.

Definition at line 58 of file ProcessingSignalListener.h.

◆ m_param_feasibleRLOnly

bool m_param_feasibleRLOnly = true
private

Parameter : Switch to apply the rl feasibility cut.

Definition at line 84 of file FacetCreator.h.

◆ m_param_leastSquareFit

bool m_param_leastSquareFit = false
private

Parameter : Switch to fit the facet with least square method for the drift length update.

Definition at line 90 of file FacetCreator.h.

◆ m_param_updateDriftLength

bool m_param_updateDriftLength = true
private

Parameter : Switch to reestimate the drift length.

Definition at line 87 of file FacetCreator.h.

◆ m_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 60 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.

◆ m_wireHitRelationFilter

BridgingWireHitRelationFilter m_wireHitRelationFilter
private

The filter for the hit neighborhood.

Definition at line 94 of file FacetCreator.h.

◆ m_wireHitRelations

std::vector<TrackingUtilities::WeightedRelation<TrackingUtilities::CDCWireHit> > m_wireHitRelations
private

Memory for the wire hit neighborhood in within a cluster.

Definition at line 107 of file FacetCreator.h.


The documentation for this class was generated from the following files: