Belle II Software  release-08-01-10
AxialTrackUtil.h
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 #pragma once
9 
10 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
11 #include <tracking/trackFindingCDC/numerics/ESign.h>
12 
13 #include <array>
14 #include <vector>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22 
23  class CDCTrack;
24  class CDCRecoHit3D;
25  class CDCTrajectory2D;
26  class CDCWireHit;
27  class Vector2D;
28 
32  struct AxialTrackUtil {
33 
34  public:
36  static void addCandidateFromHits(const std::vector<const CDCWireHit*>& foundAxialWireHits,
37  const std::vector<const CDCWireHit*>& allAxialWireHits,
38  std::vector<CDCTrack>& axialTracks,
39  bool withPostprocessing = true);
40 
42  static bool postprocessTrack(CDCTrack& track, const std::vector<const CDCWireHit*>& allAxialWireHits);
43 
44  private:
46  static bool checkTrackQuality(const CDCTrack& track);
47 
48  public:
50  static void normalizeTrack(CDCTrack& track);
51 
53  static void updateRecoHit3D(const CDCTrajectory2D& trajectory2D, CDCRecoHit3D& hit);
54 
63  static void deleteHitsFarAwayFromTrajectory(CDCTrack& track, double maximumDistance = 0.2);
64 
66  static void assignNewHitsToTrack(CDCTrack& track,
67  const std::vector<const CDCWireHit*>& allAxialWireHits,
68  double minimalDistance = 0.2);
69 
71  static std::vector<CDCRecoHit3D> splitBack2BackTrack(CDCTrack& track);
72 
74  static bool isBack2BackTrack(CDCTrack& track);
75 
85  static ESign getMajorArmSign(const CDCTrack& track, const Vector2D& center);
86 
91  static int getArmSignVote(const CDCTrack& track, const Vector2D& center);
92 
93 
95  static void removeHitsAfterSuperLayerBreak(CDCTrack& track);
96 
106  static ESign getArmSign(const CDCRecoHit3D& hit, const Vector2D& center);
107 
108  public:
110  static void deleteTracksWithLowFitProbability(std::vector<CDCTrack>& axialTracks,
111  double minimal_probability_for_good_fit = 0.4);
112 
114  static void deleteShortTracks(std::vector<CDCTrack>& axialTracks, double minimal_size = 5);
115 
116  private:
118  static std::vector<ISuperLayer> getSLayerHoles(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer); // return 0;
119 
121  static ISuperLayer getFirstOccupiedISuperLayer(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer);
122 
124  static ISuperLayer getLastOccupiedISuperLayer(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer);
125  };
126  }
128 }
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:52
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Particle trajectory as it is seen in xy projection represented as a circle.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:27
Abstract base class for different kinds of events.
Utility structure gathering heuristic functions used during the axial track finding.
static void deleteShortTracks(std::vector< CDCTrack > &axialTracks, double minimal_size=5)
Remove tracks that are shorter than the given number of hits.
static void assignNewHitsToTrack(CDCTrack &track, const std::vector< const CDCWireHit * > &allAxialWireHits, double minimalDistance=0.2)
Assign new hits to the track basing on the distance from the hit to the track.
static void normalizeTrack(CDCTrack &track)
Refit and resort the track. Unmask all hits.
static ESign getArmSign(const CDCRecoHit3D &hit, const Vector2D &center)
Calculate whether the hits is to the right or to the left relative to the line from origin to the giv...
static std::vector< ISuperLayer > getSLayerHoles(const std::array< int, ISuperLayerUtil::c_N > &nHitsBySLayer)
Helper function getting the empty axial! super layers that appear in the chain of super layers that i...
static bool checkTrackQuality(const CDCTrack &track)
Check track quality – currently based on number of hits only.
static void updateRecoHit3D(const CDCTrajectory2D &trajectory2D, CDCRecoHit3D &hit)
update given CDCRecoHit3D with given trajectory
static void removeHitsAfterSuperLayerBreak(CDCTrack &track)
Searches for a break in the super layer chain and remove all hits that come after that.
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.
static void deleteHitsFarAwayFromTrajectory(CDCTrack &track, double maximumDistance=0.2)
Postprocessing: Delete axial hits that do not "match" to the given track.
static int getArmSignVote(const CDCTrack &track, const Vector2D &center)
Calculate the sum of right and left votes for the hits relative to the center.
static ISuperLayer getFirstOccupiedISuperLayer(const std::array< int, ISuperLayerUtil::c_N > &nHitsBySLayer)
Helper function to extract the first filled entry in the array of super layers ( = the start superlay...
static bool isBack2BackTrack(CDCTrack &track)
Checks whether the track has hits on both arms as seen from the origin.
static bool postprocessTrack(CDCTrack &track, const std::vector< const CDCWireHit * > &allAxialWireHits)
Perform all track postprocessing - return whether the track is considered good after the postprocessi...
static ISuperLayer getLastOccupiedISuperLayer(const std::array< int, ISuperLayerUtil::c_N > &nHitsBySLayer)
Helper function to extract the last filled entry in the array of super layers ( = the final superlaye...
static std::vector< CDCRecoHit3D > splitBack2BackTrack(CDCTrack &track)
Tries to split back-to-back tracks into two different tracks.
static ESign getMajorArmSign(const CDCTrack &track, const Vector2D &center)
Calculate whether the majority of hits is to the right or to the left relative to the line from origi...
static void deleteTracksWithLowFitProbability(std::vector< CDCTrack > &axialTracks, double minimal_probability_for_good_fit=0.4)
Check an (improper) p-values of the tracks. If they are below the given value, delete the track from ...