10 #include <tracking/trackFindingCDC/findlets/base/Findlet.h>
11 #include <tracking/ckf/cdc/entities/CDCCKFResult.h>
13 #include <ecl/dataobjects/ECLShower.h>
15 #include <tracking/trackFindingCDC/filters/base/ChooseableFilter.h>
16 #include <tracking/ckf/cdc/filters/paths/CDCPathFilterFactory.h>
18 #include <tracking/ckf/cdc/filters/pathPairs/CDCPathPairFilterFactory.h>
19 #include <tracking/trackFindingCDC/filters/base/ChooseableFilter.icc.h>
41 m_filter_badTracks.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"badTracks", prefix));
43 m_filter_duplicateSeed.exposeParameters(moduleParamList, TrackFindingCDC::prefixed(
"duplicateSeed", prefix));
45 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"duplicateSeed_maxPhi"),
47 "Seeds within this dPhi can be considered as duplicates (-1 to neglect)",
50 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"duplicateSeed_maxTheta"),
52 "Seeds within this dTheta can be considered as duplicates (-1 to neglect)",
57 void apply(std::vector<CDCCKFResult>& results)
override
59 B2DEBUG(29,
"CDCCKFDuplicateRemover: " << results.size() <<
" paths created (might be without any hits)");
61 std::vector<CDCCKFResult> goodResults;
64 TrackFindingCDC::Weight weight;
65 std::unordered_map<double, CDCCKFResult> resultToWeightList;
66 for (
const auto& result : results) {
68 if (not std::isnan(weight)) {
69 goodResults.push_back(result);
73 int n_goodresults = goodResults.size();
75 B2DEBUG(29,
"CDCCKFDuplicateRemover: " << goodResults.size() <<
" paths created (after filtering)");
77 if (n_goodresults > 1) {
78 for (
const auto& result : goodResults) {
79 B2DEBUG(29,
"charge = " << result.front().getSeed()->getChargeSeed() <<
"; "
80 <<
"theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI <<
"; "
81 << (result.size() - 1) <<
" hits (" << result.at(1).getWireHit()->getWire().getICLayer() <<
"->" <<
82 result.back().getWireHit()->getWire().getICLayer() <<
"); "
83 <<
"r/z = " << result.front().getSeed()->getPositionSeed().Perp() <<
"; " << result.front().getSeed()->getPositionSeed().Z());
88 auto iter = goodResults.begin();
89 while (iter < goodResults.end()) {
90 auto iter2 = iter + 1;
91 bool increaseIter =
true;
92 while (iter2 < goodResults.end()) {
98 iter2 = goodResults.erase(iter2);
100 iter = goodResults.erase(iter);
101 increaseIter =
false;
113 B2DEBUG(29,
"CDCCKFDuplicateRemover: " << goodResults.size() <<
" paths created (after duplicates)");
115 if (n_goodresults > 1) {
116 for (
const auto& result : goodResults) {
117 B2DEBUG(29,
"charge = " << result.front().getSeed()->getChargeSeed() <<
"; "
118 <<
"theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI <<
"; "
119 << (result.size() - 1) <<
" hits (" << result.at(1).getWireHit()->getWire().getICLayer() <<
"->" <<
120 result.back().getWireHit()->getWire().getICLayer() <<
"); "
121 <<
"r/z = " << result.front().getSeed()->getPositionSeed().Perp() <<
"; " << result.front().getSeed()->getPositionSeed().Z());
127 iter = goodResults.begin();
128 while (iter < goodResults.end()) {
129 double phiClus = iter->front().getSeed()->getPositionSeed().Phi();
130 double thetaClus = iter->front().getSeed()->getPositionSeed().Theta();
132 auto iter2 = iter + 1;
133 bool increaseIter =
true;
134 while (iter2 < goodResults.end()) {
137 if (std::abs(TVector2::Phi_mpi_pi(iter2->front().getSeed()->getPositionSeed().Phi() - phiClus)) <
duplicateSeed_maxPhi
142 B2DEBUG(29,
"Keeping both tracks");
145 B2DEBUG(29,
"Duplicate hits found");
148 iter2 = goodResults.erase(iter2);
150 iter = goodResults.erase(iter);
151 increaseIter =
false;
164 results = goodResults;
166 B2DEBUG(29,
"CDCCKFDuplicateRemover: " << results.size() <<
" paths created (after merging)");
168 if (n_goodresults > 1) {
169 for (
const auto& result : results) {
170 B2DEBUG(29,
"charge = " << result.front().getSeed()->getChargeSeed() <<
"; "
171 <<
"theta = " << result.front().getSeed()->getPositionSeed().Theta() * 180. / M_PI <<
"; "
172 << (result.size() - 1) <<
" hits (" << result.at(1).getWireHit()->getWire().getICLayer() <<
"->" <<
173 result.back().getWireHit()->getWire().getICLayer() <<
"); "
174 <<
"r/z = " << result.front().getSeed()->getPositionSeed().Perp() <<
"; " << result.front().getSeed()->getPositionSeed().Z());
Remove duplicate paths created from ECLShowers These typically come from the seeding with two charge ...
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)
double duplicateSeed_maxPhi
Seeds within this dPhi can be considered as duplicates.
void apply(std::vector< CDCCKFResult > &results) override
main method of the findlet, merges and filters paths
double duplicateSeed_maxTheta
Seeds within this dTheta can be considered as duplicates.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Class to store ECL Showers.
The Module parameter list class.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Convenvience wrapper to setup a Chooseable filter from a specific factory object.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
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.