 |
Belle II Software
release-05-01-25
|
10 #include <tracking/trackFindingCDC/findlets/minimal/FacetCreator.h>
12 #include <tracking/trackFindingCDC/eventdata/segments/CDCWireHitCluster.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
16 #include <tracking/trackFindingCDC/filters/base/RelationFilterUtil.h>
17 #include <tracking/trackFindingCDC/fitting/FacetFitter.h>
19 #include <tracking/trackFindingCDC/utilities/VectorRange.h>
20 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
22 #include <framework/core/ModuleParamList.templateDetails.h>
29 using namespace TrackFindingCDC;
39 return "Creates hit triplet (facets) from each cluster filtered by a acceptance criterion.";
48 moduleParamList->
addParameter(prefixed(prefix,
"updateDriftLength"),
50 "Switch to reestimate the drift length",
53 moduleParamList->
addParameter(prefixed(prefix,
"leastSquareFit"),
55 "Switch to fit the facet with the least square method "
56 "for drift length estimation",
60 void FacetCreator::apply(
const std::vector<CDCWireHitCluster>& inputClusters, std::vector<CDCFacet>& facets)
66 if (cluster.getBackgroundFlag()) {
69 B2ASSERT(
"Expect the clusters to be sorted", std::is_sorted(cluster.begin(), cluster.end()));
72 const std::vector<CDCWireHit*>& wireHits = cluster;
78 B2ASSERT(
"Wire neighborhood is not symmetric. Check the geometry.",
82 std::size_t nBefore = facets.size();
84 std::size_t nAfter = facets.size();
88 std::sort(facetsInCluster.
begin(), facetsInCluster.
end());
90 B2ASSERT(
"Expected all facets to be different",
91 std::adjacent_find(facetsInCluster.
begin(), facetsInCluster.
end()) ==
92 facetsInCluster.
end());
94 for (
CDCFacet& facet : facetsInCluster) {
95 facet.setICluster(iCluster);
102 std::vector<CDCFacet>& facets)
104 for (
const CDCWireHit* ptrMiddleWireHit : wireHits) {
105 if (not ptrMiddleWireHit)
continue;
106 const CDCWireHit& middleWireHit = *ptrMiddleWireHit;
109 const auto neighbors = asRange(
110 std::equal_range(wireHitRelations.begin(), wireHitRelations.end(), ptrMiddleWireHit));
113 const CDCWireHit* ptrStartWireHit(startWireHitRelation.getTo());
115 if (not ptrStartWireHit)
continue;
116 const CDCWireHit& startWireHit = *ptrStartWireHit;
120 const CDCWireHit* ptrEndWireHit(endWireHitRelation.getTo());
122 if (not ptrEndWireHit)
continue;
123 const CDCWireHit& endWireHit = *ptrEndWireHit;
127 if (ptrStartWireHit->isOnWire(ptrEndWireHit->getWire()))
continue;
138 std::vector<CDCFacet>& facets)
141 CDCRLWireHit startRLWireHit(&startWireHit, ERightLeft::c_Left);
142 CDCRLWireHit middleRLWireHit(&middleWireHit, ERightLeft::c_Left);
143 CDCRLWireHit endRLWireHit(&endWireHit, ERightLeft::c_Left);
146 for (
ERightLeft startRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
148 for (
ERightLeft middleRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
150 for (
ERightLeft endRLInfo : {ERightLeft::c_Left, ERightLeft::c_Right}) {
160 if (std::isnan(feasibleWeight))
continue;
182 if (not std::isnan(weight)) {
184 facets.insert(facets.end(), facet);
bool m_param_updateDriftLength
Parameter : Switch to reestimate the drift length.
ChooseableFacetFilter m_facetFilter
The filter to be used for the facet generation.
Iterator begin() const
Begin of the range for range based for.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Utility structure with functions related to weighted relations.
BridgingWireHitRelationFilter m_wireHitRelationFilter
The filter for the hit neighborhood.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
static double fit(const CDCFacet &facet, int nSteps=100)
Fits a proper line to facet and returns the chi2.
Iterator end() const
End of the range for range based for.
void setMiddleRLInfo(const ERightLeft middleRLInfo)
Setter for the right left passage information of the second oriented wire hit.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void setEndRLInfo(const ERightLeft endRLInfo)
Setter for the right left passage information of the third oriented wire hit.
void adjustFitLine() const
Adjusts the contained fit line to touch such that it touches the first and third hit.
double updateDriftLength(CDCRecoHit2D &recoHit2D)
Update the drift length of the reconstructed hit in place.
void createFacetsForHitTriple(const CDCWireHit &startWireHit, const CDCWireHit &middleWireHit, const CDCWireHit &endWireHit, std::vector< CDCFacet > &facets)
Generates reconstruted facets on the three given wire hits by hypothesizing over the 8 left right pas...
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.
std::string getDescription() final
Short description of the findlet.
bool m_param_feasibleRLOnly
Parameter : Switch to apply the rl feasibility cut.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
bool m_param_leastSquareFit
Parameter : Switch to fit the facet with least square method for the drift length update.
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
CDCRLWireHit & getMiddleRLWireHit()
Getter for the second oriented wire hit.
A pair of iterators usable with the range base for loop.
bool hasTakenFlag() const
Gets the current state of the taken marker flag.
DriftLengthEstimator m_driftLengthEstimator
Instance of the drift length estimator to be used.
void invalidateFitLine()
Clear all information in the fit.
Class representing a triple of neighboring oriented wire with additional trajectory information.
An aggregation of CDCWireHits.
void setStartRLInfo(const ERightLeft startRLInfo)
Setter for the right left passage information of the first oriented wire hit.
CDCRLWireHit & getEndRLWireHit()
Getter for the third oriented wire hit.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
void createFacets(const std::vector< CDCWireHit * > &wireHits, const std::vector< WeightedRelation< CDCWireHit > > &wireHitRelations, std::vector< CDCFacet > &facets)
Generates facets on the given wire hits generating neighboring triples of hits.
Type for two related objects with a weight.
void apply(const std::vector< CDCWireHitCluster > &inputClusters, std::vector< CDCFacet > &facets) final
Central function creating the hit triplets from the clusters.
Class representing a hit wire in the central drift chamber.
A parameter line including including an line covariance matrix which is interpreted as located in the...
The Module parameter list class.
CDCRLWireHit & getStartRLWireHit()
Getter for the first oriented wire hit.
std::vector< WeightedRelation< CDCWireHit > > m_wireHitRelations
Memory for the wire hit neighborhood in within a cluster.
void setCellWeight(Weight weight)
Setter for the cell weight.
FeasibleRLFacetFilter m_feasibleRLFacetFilter
The feasibility filter for the right left passage information.
FacetCreator()
Constructor adding the filter as a subordinary processing signal listener.