Belle II Software development
CDCCKFDuplicateRemover Class Referenceabstract

Remove duplicate paths created from ECLShowers These typically come from the seeding with two charge assumptions and Bremsstrahlung. More...

#include <CDCCKFDuplicateRemover.h>

Inheritance diagram for CDCCKFDuplicateRemover:
Findlet< CDCCKFResult > CompositeProcessingSignalListener ProcessingSignalListener

Public Types

using IOTypes = std::tuple< AIOTypes... >
 Types that should be served to apply on invocation.
 
using IOVectors = std::tuple< std::vector< AIOTypes >... >
 Vector types that should be served to apply on invocation.
 

Public Member Functions

void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix) override
 Expose the parameters of the sub findlets.
 
void apply (std::vector< CDCCKFResult > &results) override
 main method of the findlet, merges and filters paths
 
virtual std::string getDescription ()
 Brief description of the purpose of the concrete findlet.
 
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 = typename ToVectorImpl< T >::Type
 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 = ProcessingSignalListener
 Type of the base class.
 

Private Attributes

TrackFindingCDC::ChooseableFilter< CDCPathFilterFactorym_filter_badTracks
 Filter to remove badly reconstructed tracks (e.g. wrongly assigned charge)
 
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactorym_filter_duplicateTrack
 Filter to remove duplicates from helix extrapolation (2 charge assumptions)
 
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactorym_filter_duplicateSeed
 Merge duplicate paths (mostly seeds from Bremstrahlung)
 
double duplicateSeed_maxPhi = 2.
 Seeds within this dPhi can be considered as duplicates.
 
double duplicateSeed_maxTheta = 0.1
 Seeds within this dTheta can be considered as duplicates.
 
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
 References to subordinary signal processing listener contained in this findlet.
 
bool m_initialized = false
 Flag to keep track whether initialization happened before.
 
bool m_terminated = false
 Flag to keep track whether termination happened before.
 
std::string m_initializedAs
 Name of the type during initialisation.
 

Detailed Description

Remove duplicate paths created from ECLShowers These typically come from the seeding with two charge assumptions and Bremsstrahlung.

Definition at line 30 of file CDCCKFDuplicateRemover.h.

Member Typedef Documentation

◆ IOTypes

using IOTypes = std::tuple<AIOTypes...>
inherited

Types that should be served to apply on invocation.

Definition at line 30 of file Findlet.h.

◆ IOVectors

using IOVectors = std::tuple< std::vector<AIOTypes>... >
inherited

Vector types that should be served to apply on invocation.

Definition at line 53 of file Findlet.h.

◆ Super

using Super = ProcessingSignalListener
privateinherited

Type of the base class.

Definition at line 25 of file CompositeProcessingSignalListener.h.

◆ ToVector

using ToVector = typename ToVectorImpl<T>::Type
protectedinherited

Short hand for ToRangeImpl.

Definition at line 49 of file Findlet.h.

Constructor & Destructor Documentation

◆ CDCCKFDuplicateRemover()

Definition at line 32 of file CDCCKFDuplicateRemover.h.

33 {
37 }
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactory > m_filter_duplicateTrack
Filter to remove duplicates from helix extrapolation (2 charge assumptions)
TrackFindingCDC::ChooseableFilter< CDCPathPairFilterFactory > m_filter_duplicateSeed
Merge duplicate paths (mostly seeds from Bremstrahlung)
TrackFindingCDC::ChooseableFilter< CDCPathFilterFactory > m_filter_badTracks
Filter to remove badly reconstructed tracks (e.g. wrongly assigned charge)
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.

Member Function Documentation

◆ addProcessingSignalListener()

void addProcessingSignalListener ( ProcessingSignalListener psl)
protectedinherited

Register a processing signal listener to be notified.

Definition at line 55 of file CompositeProcessingSignalListener.cc.

56{
58}
std::vector< ProcessingSignalListener * > m_subordinaryProcessingSignalListeners
References to subordinary signal processing listener contained in this findlet.

◆ apply()

void apply ( std::vector< CDCCKFResult > &  results)
inlineoverride

main method of the findlet, merges and filters paths

Definition at line 58 of file CDCCKFDuplicateRemover.h.

59 {
60 B2DEBUG(29, "CDCCKFDuplicateRemover: " << results.size() << " paths created (might be without any hits)");
61
62 std::vector<CDCCKFResult> goodResults;
63
64 // Additional filter (typically check if charge of reconstructed track is equal to charge of seed)
65 TrackFindingCDC::Weight weight;
66 std::unordered_map<double, CDCCKFResult> resultToWeightList;
67 for (const auto& result : results) {
68 weight = m_filter_badTracks(result);
69 if (not std::isnan(weight)) {
70 goodResults.push_back(result);
71 }
72 }
73
74 int n_goodresults = goodResults.size();
75
76 B2DEBUG(29, "CDCCKFDuplicateRemover: " << goodResults.size() << " paths created (after filtering)");
77
78 if (n_goodresults > 1) {
79 for (const auto& result : goodResults) {
80 B2DEBUG(29, "charge = " << result.front().getSeed()->getChargeSeed() << "; "
81 << "theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI << "; "
82 << (result.size() - 1) << " hits (" << result.at(1).getWireHit()->getWire().getICLayer() << "->" <<
83 result.back().getWireHit()->getWire().getICLayer() << "); "
84 << "r/z = " << result.front().getSeed()->getPositionSeed().Rho() << "; " << result.front().getSeed()->getPositionSeed().Z());
85 }
86 }
87
88 // If both charge assumptions lead to a good track, only pick one to avoid duplicate tracks
89 auto iter = goodResults.begin();
90 while (iter < goodResults.end()) {
91 auto iter2 = iter + 1;
92 bool increaseIter = true;
93 while (iter2 < goodResults.end()) {
94 // find tracks from same seed
95 if (iter2->front().getSeed()->getRelated<ECLShower>() == iter2->front().getSeed()->getRelated<ECLShower>()) {
96 // let filter decide which one to keep
97 bool selectFirst = m_filter_duplicateTrack(std::pair(&*iter, &*iter2)) > 0;
98 if (selectFirst) {
99 iter2 = goodResults.erase(iter2);
100 } else {
101 iter = goodResults.erase(iter);
102 increaseIter = false;
103 break;
104 }
105 } else {
106 ++iter2;
107 }
108 }
109 if (increaseIter) {
110 ++iter;
111 }
112 }
113
114 B2DEBUG(29, "CDCCKFDuplicateRemover: " << goodResults.size() << " paths created (after duplicates)");
115
116 if (n_goodresults > 1) {
117 for (const auto& result : goodResults) {
118 B2DEBUG(29, "charge = " << result.front().getSeed()->getChargeSeed() << "; "
119 << "theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI << "; "
120 << (result.size() - 1) << " hits (" << result.at(1).getWireHit()->getWire().getICLayer() << "->" <<
121 result.back().getWireHit()->getWire().getICLayer() << "); "
122 << "r/z = " << result.front().getSeed()->getPositionSeed().Rho() << "; " << result.front().getSeed()->getPositionSeed().Z());
123 }
124 }
125
126 // Remove duplicate tracks from Bremsstrahlung
127 // Be careful as this might also remove photon conversions (m_filter_duplicateSeed decides if both should be kept)
128 iter = goodResults.begin();
129 while (iter < goodResults.end()) {
130 double phiClus = iter->front().getSeed()->getPositionSeed().Phi();
131 double thetaClus = iter->front().getSeed()->getPositionSeed().Theta();
132
133 auto iter2 = iter + 1;
134 bool increaseIter = true;
135 while (iter2 < goodResults.end()) {
136 // find tracks from close-by seeds (use small strip in phi direction as expected from Bremsstrahlung)
137 // to disregard this filter set duplicateSeed_maxPhi and duplicateSeed_maxTheta to negative values
138 if (std::abs(ROOT::Math::VectorUtil::Phi_mpi_pi(iter2->front().getSeed()->getPositionSeed().Phi() - phiClus)) < duplicateSeed_maxPhi
139 && std::abs(iter2->front().getSeed()->getPositionSeed().Theta() - thetaClus) < duplicateSeed_maxTheta) {
140 // let filter decide which one to keep
141 bool isDuplicate = m_filter_duplicateSeed(std::pair(&*iter, &*iter2)) > 0;
142 if (! isDuplicate) {
143 B2DEBUG(29, "Keeping both tracks");
144 ++iter2;
145 } else {
146 B2DEBUG(29, "Duplicate hits found");
147 bool selectFirst = m_filter_duplicateTrack(std::pair(&*iter, &*iter2)) > 0;
148 if (selectFirst) {
149 iter2 = goodResults.erase(iter2);
150 } else {
151 iter = goodResults.erase(iter);
152 increaseIter = false;
153 break;
154 }
155 }
156 } else {
157 ++iter2;
158 }
159 }
160 if (increaseIter) {
161 ++iter;
162 }
163 }
164
165 results = goodResults;
166
167 B2DEBUG(29, "CDCCKFDuplicateRemover: " << results.size() << " paths created (after merging)");
168
169 if (n_goodresults > 1) {
170 for (const auto& result : results) {
171 B2DEBUG(29, "charge = " << result.front().getSeed()->getChargeSeed() << "; "
172 << "theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI << "; "
173 << (result.size() - 1) << " hits (" << result.at(1).getWireHit()->getWire().getICLayer() << "->" <<
174 result.back().getWireHit()->getWire().getICLayer() << "); "
175 << "r/z = " << result.front().getSeed()->getPositionSeed().Rho() << "; " << result.front().getSeed()->getPositionSeed().Z());
176 }
177 }
178 }
double duplicateSeed_maxPhi
Seeds within this dPhi can be considered as duplicates.
double duplicateSeed_maxTheta
Seeds within this dTheta can be considered as duplicates.

◆ beginEvent()

void beginEvent ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in SpacePointTagger< Belle2::CKFToPXDResult, Belle2::PXDCluster >, SpacePointTagger< Belle2::CKFToSVDResult, Belle2::SVDCluster >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, SharingHitsMatcher< Belle2::TrackFindingCDC::CDCTrack, Belle2::TrackFindingCDC::CDCSegment2D >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RecoTrackStorer, ROIFinder, and SVDHoughTracking.

Definition at line 31 of file CompositeProcessingSignalListener.cc.

32{
35 psl->beginEvent();
36 }
37}
Interface for an algorithm part that needs to receive the module processing signals.
virtual void beginEvent()
Receive signal for the start of a new event.

◆ beginRun()

void beginRun ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in LayerRelationFilter< AFilter >, FourHitFilter, QualityIndicatorFilter, ThreeHitFilter, TwoHitVirtualIPFilter, TwoHitVirtualIPQIFilter, RecoTrackStorer, ROIFinder, SpacePointLoaderAndPreparer, and TrackCandidateResultRefiner.

Definition at line 23 of file CompositeProcessingSignalListener.cc.

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

◆ endRun()

void endRun ( )
overridevirtualinherited

Receive and dispatch signal for the end of the run.

Reimplemented from ProcessingSignalListener.

Definition at line 39 of file CompositeProcessingSignalListener.cc.

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

◆ exposeParameters()

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

Expose the parameters of the sub findlets.

Reimplemented from Findlet< CDCCKFResult >.

Definition at line 40 of file CDCCKFDuplicateRemover.h.

41 {
42 m_filter_badTracks.exposeParameters(moduleParamList, TrackFindingCDC::prefixed("badTracks", prefix));
43 m_filter_duplicateTrack.exposeParameters(moduleParamList, TrackFindingCDC::prefixed("duplicateTrack", prefix));
44 m_filter_duplicateSeed.exposeParameters(moduleParamList, TrackFindingCDC::prefixed("duplicateSeed", prefix));
45
46 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "duplicateSeed_maxPhi"),
48 "Seeds within this dPhi can be considered as duplicates (-1 to neglect)",
50
51 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "duplicateSeed_maxTheta"),
53 "Seeds within this dTheta can be considered as duplicates (-1 to neglect)",
55 }

◆ getDescription()

virtual std::string getDescription ( )
inlinevirtualinherited

Brief description of the purpose of the concrete findlet.

Definition at line 60 of file Findlet.h.

61 {
62 return "(no description)";
63 }

◆ getNProcessingSignalListener()

int getNProcessingSignalListener ( )
protectedinherited

Get the number of currently registered listeners.

Definition at line 60 of file CompositeProcessingSignalListener.cc.

61{
63}

◆ initialize()

void initialize ( )
overridevirtualinherited

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

Reimplemented from ProcessingSignalListener.

Reimplemented in UnionVarSet< AObject >, UnionVarSet< Object >, VariadicUnionVarSet< AVarSets >, ResultStorer< Belle2::CKFToPXDResult >, ResultStorer< Belle2::CKFToSVDResult >, BaseEventTimeExtractor< RecoTrack * >, BaseEventTimeExtractor< TrackFindingCDC::CDCWireHit & >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >, OnVarSet< Filter< ATruthVarSet::Object > >, OnVarSet< Filter< AVarSet::Object > >, OnVarSet< BaseFacetFilter >, OnVarSet< BaseFacetRelationFilter >, OnVarSet< BaseAxialSegmentPairFilter >, OnVarSet< BaseSegmentRelationFilter >, OnVarSet< BaseTrackRelationFilter >, OnVarSet< BaseSegmentPairRelationFilter >, MCSymmetric< BaseAxialSegmentPairFilter >, MCSymmetric< BaseFacetFilter >, MCSymmetric< BaseFacetRelationFilter >, MCSymmetric< BaseSegmentPairFilter >, MCSymmetric< BaseSegmentPairRelationFilter >, MCSymmetric< BaseSegmentRelationFilter >, MCSymmetric< BaseSegmentTripleFilter >, MCSymmetric< BaseSegmentTripleRelationFilter >, MCSymmetric< BaseTrackRelationFilter >, StoreArrayLoader< const Belle2::SpacePoint >, StoreArrayLoader< DataStoreInputTypeRefType >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCFacet >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCWireHit, true >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegment2D >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCTrack >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentPair >, StoreVectorSwapper< Belle2::TrackFindingCDC::CDCSegmentTriple >, RelationVarSet< ABaseVarSet >, QualityIndicatorFilter, TwoHitVirtualIPQIFilter, MultiHoughSpaceFastInterceptFinder, RawTrackCandCleaner< AHit >, RawTrackCandCleaner< Belle2::vxdHoughTracking::VXDHoughState >, RecoTrackStorer, ROIFinder, SingleHoughSpaceFastInterceptFinder, SpacePointLoaderAndPreparer, TrackCandidateOverlapResolver, and TrackCandidateResultRefiner.

Definition at line 15 of file CompositeProcessingSignalListener.cc.

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

◆ terminate()

void terminate ( )
overridevirtualinherited

Receive and dispatch Signal for termination of the event processing.

Reimplemented from ProcessingSignalListener.

Reimplemented in StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::HyperHough >, StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::QuadraticLegendre >, and StereoHitTrackQuadTreeMatcher< Belle2::TrackFindingCDC::Z0TanLambdaLegendre >.

Definition at line 47 of file CompositeProcessingSignalListener.cc.

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

Member Data Documentation

◆ duplicateSeed_maxPhi

double duplicateSeed_maxPhi = 2.
private

Seeds within this dPhi can be considered as duplicates.

Definition at line 189 of file CDCCKFDuplicateRemover.h.

◆ duplicateSeed_maxTheta

double duplicateSeed_maxTheta = 0.1
private

Seeds within this dTheta can be considered as duplicates.

Definition at line 191 of file CDCCKFDuplicateRemover.h.

◆ m_filter_badTracks

Filter to remove badly reconstructed tracks (e.g. wrongly assigned charge)

Definition at line 182 of file CDCCKFDuplicateRemover.h.

◆ m_filter_duplicateSeed

Merge duplicate paths (mostly seeds from Bremstrahlung)

Definition at line 186 of file CDCCKFDuplicateRemover.h.

◆ m_filter_duplicateTrack

Filter to remove duplicates from helix extrapolation (2 charge assumptions)

Definition at line 184 of file CDCCKFDuplicateRemover.h.

◆ m_initialized

bool m_initialized = false
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_subordinaryProcessingSignalListeners

std::vector<ProcessingSignalListener*> m_subordinaryProcessingSignalListeners
privateinherited

References to subordinary signal processing listener contained in this findlet.

Definition at line 52 of file CompositeProcessingSignalListener.h.

◆ m_terminated

bool m_terminated = false
privateinherited

Flag to keep track whether termination happened before.

Definition at line 55 of file ProcessingSignalListener.h.


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