Belle II Software  release-05-02-19
AxialLegendreLeafProcessor< ANode > Class Template Reference

Predicate class that is feed the nodes in a WeightedHoughTree walk It decides if a node should be further expanded and extracts items from nodes that are considered as leafs to build tracks. More...

#include <AxialLegendreLeafProcessor.h>

Collaboration diagram for AxialLegendreLeafProcessor< ANode >:

Public Types

using Candidate = std::pair< CDCTrajectory2D, std::vector< CDCRLWireHit > >
 Preliminary structure to save found hits and trajectory information.
 

Public Member Functions

 AxialLegendreLeafProcessor (int maxLevel)
 Initialize a new processor with the maximum level.
 
bool operator() (ANode *node)
 Entry point for the WeightedHoughTree walk to ask if a node is a leaf that should not be further divided into sub nodes.
 
bool skip (const ANode *node)
 Decide if the node should be expanded further or marks an end point of the depth search.
 
bool isLeaf (const ANode *node)
 Decide when a leaf node is reached that should be processed further.
 
void processLeaf (ANode *leaf)
 A valuable leaf has been found in the hough tree walk. More...
 
std::vector< WithSharedMark< CDCRLWireHit > > searchRoad (const ANode &node, const CDCTrajectory2D &trajectory2D)
 Look for more hits near a ftted trajectory from hits available in the give node.
 
std::vector< CandidategetCandidates () const
 Getter for the candidates structure still used in some tests.
 
const std::vector< CDCTrack > & getTracks () const
 Getter for the tracks.
 
void clear ()
 Clear the found candidates.
 
void setAxialWireHits (std::vector< const CDCWireHit * > axialWireHits)
 Set the pool of all axial wire hits to be used in the postprocessing.
 
void exposeParameters (ModuleParamList *moduleParamList, const std::string &prefix)
 Expose the parameters as a module parameter list.
 
void beginWalk ()
 Function to notify the leaf processor about changes in parameters before a new walk.
 

Public Attributes

int m_nNodes = 0
 Statistic: Number received node.
 
int m_nSkippedNodes = 0
 Statistic: Number of skipped nodes.
 
int m_nLeafs = 0
 Statistic: Number processed leaf.
 

Private Attributes

int m_param_maxLevel = 1
 Memory for the maximal level of the tree.
 
double m_param_minWeight = 0
 Memory for the minimal weight threshold for following the children of a node.
 
double m_param_maxCurv = NAN
 Memory for the maximal curvature that should be searched in the current walk.
 
double m_param_curlCurv = 0.018
 Memory for the curvature of a curler in the CDC.
 
int m_param_nRoadSearches = 0
 Memory for the number of repeated road searches.
 
int m_param_roadLevel = 0
 Memory for the tree node level which should be the source of hits for the road searches. Defaults to the top most node.
 
std::string m_param_curvResolution = "const"
 Memory for the name of the resolution function to be used. Valid values are 'none', 'const', 'basic', 'origin', 'offOrigin'.
 
std::vector< CDCTrackm_tracks
 Memory for found trajectories.
 
std::vector< const CDCWireHit * > m_axialWireHits
 Memory for the pool of axial wire hits to can be used in the post processing.
 
std::function< double(double)> m_curvResolution
 Memory for the freely defined curvature resolution function.
 

Detailed Description

template<class ANode>
class Belle2::TrackFindingCDC::AxialLegendreLeafProcessor< ANode >

Predicate class that is feed the nodes in a WeightedHoughTree walk It decides if a node should be further expanded and extracts items from nodes that are considered as leafs to build tracks.

It accumulates the tracks in a member vector from where they can be taken after the walk over the tree has been completed.

Definition at line 48 of file AxialLegendreLeafProcessor.h.

Member Function Documentation

◆ processLeaf()

void processLeaf ( ANode *  leaf)

A valuable leaf has been found in the hough tree walk.

Extract its content! It may pull more hits from the whole tree by looking at the top node.

Definition at line 49 of file AxialLegendreLeafProcessor.icc.h.

62  {
63  const double curv = trajectory2D.getCurvature();
64  std::array<DiscreteCurv, 2> curvs = leaf->template getBounds<DiscreteCurv>();
65 
66  float lowerCurv = *(curvs[0]);
67  float upperCurv = *(curvs[1]);
68  if (ESignUtil::common(lowerCurv, upperCurv) * curv < 0) {
69  trajectory2D.reverse();
70  }
71  }
72  trajectory2D.setLocalOrigin(Vector2D(0, 0));
73 
74  // Look for more hits near the found trajectory
76  if (m_param_nRoadSearches > 0) {
77  // Acquire all available items in some parent node for the road search
78  // Somewhat bypasses the logic of the tree walk - Must handle with care!
79  ANode* roadNode = leaf;
80  while (roadNode->getParent() and roadNode->getLevel() > m_param_roadLevel) {
81  roadNode = roadNode->getParent();
82  }
83 
84  for (int iRoadSearch = 0; iRoadSearch < m_param_nRoadSearches; ++iRoadSearch) {
85  // Use a road search to find new hits from the trajectory
86  // hits = this->searchRoad(*roadNode, trajectory2D); // In case you only want the road hits
87  // if (hits.size() < 5) return;
88 
89  // Second version always holding on to the originally found hits
90  int nHitsBefore = hits.size();
91  std::vector<WithSharedMark<CDCRLWireHit>> roadHits = this->searchRoad(*roadNode, trajectory2D);
92  std::sort(roadHits.begin(), roadHits.end());
93  hits.insert(hits.end(), roadHits.begin(), roadHits.end());
94  std::inplace_merge(hits.begin(), hits.begin() + nHitsBefore, hits.end());
95  hits.erase(std::unique(hits.begin(), hits.end()), hits.end());
96 
97  // Update the current fit
98  observations2D.clear();
99  observations2D.appendRange(hits);
100  trajectory2D = fitter.fit(observations2D);
101  trajectory2D.setLocalOrigin(Vector2D(0.0, 0.0));
102  }
103  }
104 
105  // Mark found hit as used and safe them with the trajectory
107  std::vector<const CDCWireHit*> foundWireHits;
108  for (CDCRLWireHit& rlWireHit : hits) {
109  foundWireHits.push_back(&rlWireHit.getWireHit());
110  }
111 
113 
114  // Sync up the marks with the used hits
115  for (WithSharedMark<CDCRLWireHit>& markableRLWireHit : leaf->getTree()->getTopNode()) {
116  const AutomatonCell& automatonCell = markableRLWireHit.getWireHit().getAutomatonCell();
117  if (automatonCell.hasTakenFlag() or automatonCell.hasMaskedFlag()) {
118  markableRLWireHit.mark();
119  } else {
120  markableRLWireHit.unmark();
121  }
122  }
123  }
124 
125  template <class ANode>
126  std::vector<WithSharedMark<CDCRLWireHit> >
127  AxialLegendreLeafProcessor<ANode>::searchRoad(const ANode& node, const CDCTrajectory2D& trajectory2D)
128  {
129  PerigeeCircle circle = trajectory2D.getGlobalCircle();
130  Vector2D support = trajectory2D.getGlobalPerigee();
131  const float curv = circle.curvature();
132  const float phi0 = circle.phi0();

The documentation for this class was generated from the following files:
Belle2::TrackFindingCDC::ESignUtil::common
static ESign common(ESign n1, ESign n2)
Check if two values have a common sign.
Definition: ESign.h:67
Belle2::TrackFindingCDC::AxialLegendreLeafProcessor::m_axialWireHits
std::vector< const CDCWireHit * > m_axialWireHits
Memory for the pool of axial wire hits to can be used in the post processing.
Definition: AxialLegendreLeafProcessor.h:192
Belle2::TrackFindingCDC::AxialLegendreLeafProcessor::searchRoad
std::vector< WithSharedMark< CDCRLWireHit > > searchRoad(const ANode &node, const CDCTrajectory2D &trajectory2D)
Look for more hits near a ftted trajectory from hits available in the give node.
Definition: AxialLegendreLeafProcessor.icc.h:136
Belle2::TrackFindingCDC::AxialLegendreLeafProcessor::m_param_roadLevel
int m_param_roadLevel
Memory for the tree node level which should be the source of hits for the road searches....
Definition: AxialLegendreLeafProcessor.h:175
Belle2::TrackFindingCDC::AxialTrackUtil::addCandidateFromHits
static void addCandidateFromHits(const std::vector< const CDCWireHit * > &foundAxialWireHits, const std::vector< const CDCWireHit * > &allAxialWireHits, std::vector< CDCTrack > &axialTracks, bool withPostprocessing=true)
Create CDCTrack using CDCWireHit hits and store it in the list. Then call the postprocessing on it.
Definition: AxialTrackUtil.cc:26
Belle2::TrackFindingCDC::AxialLegendreLeafProcessor::m_tracks
std::vector< CDCTrack > m_tracks
Memory for found trajectories.
Definition: AxialLegendreLeafProcessor.h:189
Belle2::TrackFindingCDC::AxialLegendreLeafProcessor::m_param_nRoadSearches
int m_param_nRoadSearches
Memory for the number of repeated road searches.
Definition: AxialLegendreLeafProcessor.h:172