Belle II Software  release-05-01-25
AxialTrackUtil.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Viktor Trusov, Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/topology/ISuperLayer.h>
13 #include <tracking/trackFindingCDC/numerics/ESign.h>
14 
15 #include <array>
16 #include <vector>
17 
18 namespace Belle2 {
23  namespace TrackFindingCDC {
24 
25  class CDCTrack;
26  class CDCRecoHit3D;
27  class CDCTrajectory2D;
28  class CDCWireHit;
29  class Vector2D;
30 
34  struct AxialTrackUtil {
35 
36  public:
38  static void addCandidateFromHits(const std::vector<const CDCWireHit*>& foundAxialWireHits,
39  const std::vector<const CDCWireHit*>& allAxialWireHits,
40  std::vector<CDCTrack>& axialTracks,
41  bool withPostprocessing = true);
42 
44  static bool postprocessTrack(CDCTrack& track, const std::vector<const CDCWireHit*>& allAxialWireHits);
45 
46  private:
48  static bool checkTrackQuality(const CDCTrack& track);
49 
50  public:
52  static void normalizeTrack(CDCTrack& track);
53 
55  static void updateRecoHit3D(const CDCTrajectory2D& trajectory2D, CDCRecoHit3D& hit);
56 
65  static void deleteHitsFarAwayFromTrajectory(CDCTrack& track, double maximumDistance = 0.2);
66 
68  static void assignNewHitsToTrack(CDCTrack& track,
69  const std::vector<const CDCWireHit*>& allAxialWireHits,
70  double minimalDistance = 0.2);
71 
73  static std::vector<CDCRecoHit3D> splitBack2BackTrack(CDCTrack& track);
74 
76  static bool isBack2BackTrack(CDCTrack& track);
77 
87  static ESign getMajorArmSign(const CDCTrack& track, const Vector2D& center);
88 
93  static int getArmSignVote(const CDCTrack& track, const Vector2D& center);
94 
95 
97  static void removeHitsAfterSuperLayerBreak(CDCTrack& track);
98 
108  static ESign getArmSign(const CDCRecoHit3D& hit, const Vector2D& center);
109 
110  public:
112  static void deleteTracksWithLowFitProbability(std::vector<CDCTrack>& axialTracks,
113  double minimal_probability_for_good_fit = 0.4);
114 
116  static void deleteShortTracks(std::vector<CDCTrack>& axialTracks, double minimal_size = 5);
117 
118  private:
120  static std::vector<ISuperLayer> getSLayerHoles(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer); // return 0;
121 
123  static ISuperLayer getFirstOccupiedISuperLayer(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer);
124 
126  static ISuperLayer getLastOccupiedISuperLayer(const std::array<int, ISuperLayerUtil::c_N>& nHitsBySLayer);
127  };
128  }
130 }
Belle2::TrackFindingCDC::AxialTrackUtil::getArmSignVote
static int getArmSignVote(const CDCTrack &track, const Vector2D &center)
Calculate the sum of right and left votes for the hits relative to the center.
Definition: AxialTrackUtil.cc:258
Belle2::TrackFindingCDC::CDCRecoHit3D
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:62
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::AxialTrackUtil::splitBack2BackTrack
static std::vector< CDCRecoHit3D > splitBack2BackTrack(CDCTrack &track)
Tries to split back-to-back tracks into two different tracks.
Definition: AxialTrackUtil.cc:211
Belle2::TrackFindingCDC::AxialTrackUtil::deleteTracksWithLowFitProbability
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 ...
Definition: AxialTrackUtil.cc:159
Belle2::TrackFindingCDC::AxialTrackUtil::isBack2BackTrack
static bool isBack2BackTrack(CDCTrack &track)
Checks whether the track has hits on both arms as seen from the origin.
Definition: AxialTrackUtil.cc:238
Belle2::TrackFindingCDC::AxialTrackUtil::getArmSign
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...
Definition: AxialTrackUtil.cc:283
Belle2::TrackFindingCDC::ESignUtil::ESign
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:37
Belle2::TrackFindingCDC::AxialTrackUtil::removeHitsAfterSuperLayerBreak
static void removeHitsAfterSuperLayerBreak(CDCTrack &track)
Searches for a break in the super layer chain and remove all hits that come after that.
Definition: AxialTrackUtil.cc:288
Belle2::TrackFindingCDC::AxialTrackUtil::postprocessTrack
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...
Definition: AxialTrackUtil.cc:69
Belle2::TrackFindingCDC::AxialTrackUtil::getFirstOccupiedISuperLayer
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...
Definition: AxialTrackUtil.cc:359
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::AxialTrackUtil::assignNewHitsToTrack
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.
Definition: AxialTrackUtil.cc:177
Belle2::TrackFindingCDC::AxialTrackUtil::getSLayerHoles
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...
Definition: AxialTrackUtil.cc:339
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
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::AxialTrackUtil::checkTrackQuality
static bool checkTrackQuality(const CDCTrack &track)
Check track quality – currently based on number of hits only.
Definition: AxialTrackUtil.cc:90
Belle2::TrackFindingCDC::AxialTrackUtil::deleteHitsFarAwayFromTrajectory
static void deleteHitsFarAwayFromTrajectory(CDCTrack &track, double maximumDistance=0.2)
Postprocessing: Delete axial hits that do not "match" to the given track.
Definition: AxialTrackUtil.cc:142
Belle2::TrackFindingCDC::AxialTrackUtil::deleteShortTracks
static void deleteShortTracks(std::vector< CDCTrack > &axialTracks, double minimal_size=5)
Remove tracks that are shorter than the given number of hits.
Definition: AxialTrackUtil.cc:198
Belle2::TrackFindingCDC::AxialTrackUtil::updateRecoHit3D
static void updateRecoHit3D(const CDCTrajectory2D &trajectory2D, CDCRecoHit3D &hit)
update given CDCRecoHit3D with given trajectory
Definition: AxialTrackUtil.cc:130
Belle2::TrackFindingCDC::AxialTrackUtil::getMajorArmSign
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...
Definition: AxialTrackUtil.cc:248
Belle2::TrackFindingCDC::AxialTrackUtil::normalizeTrack
static void normalizeTrack(CDCTrack &track)
Refit and resort the track. Unmask all hits.
Definition: AxialTrackUtil.cc:95
Belle2::TrackFindingCDC::AxialTrackUtil::getLastOccupiedISuperLayer
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...
Definition: AxialTrackUtil.cc:367