Belle II Software  release-05-01-25
PhiTrackRelationFilter.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/filters/trackRelation/PhiTrackRelationFilter.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 
14 #include <tracking/trackFindingCDC/numerics/Angle.h>
15 
16 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
17 
18 #include <framework/core/ModuleParamList.templateDetails.h>
19 
20 using namespace Belle2;
21 using namespace TrackFindingCDC;
22 
24  const std::string& prefix)
25 {
26  moduleParamList->addParameter(prefixed(prefix, "maximalPhiDistance"),
28  "Maximal Phi distance below to tracks should be merged.",
30 }
31 
32 Weight PhiTrackRelationFilter::operator()(const CDCTrack& fromTrack, const CDCTrack& toTrack)
33 {
34  // Make sure we only have one relation out of A -> B and B -> A
35  if (fromTrack.getStartRecoPos3D().y() < toTrack.getStartRecoPos3D().y()) {
36  return NAN;
37  }
38 
39  const double lhsPhi = fromTrack.getStartTrajectory3D().getFlightDirection3DAtSupport().phi();
40  const double rhsPhi = toTrack.getStartTrajectory3D().getFlightDirection3DAtSupport().phi();
41 
42  const double phiDistance = std::fabs(AngleUtil::normalised(lhsPhi - rhsPhi));
43 
44  if (phiDistance > m_param_maximalPhiDistance) {
45  return NAN;
46  } else {
47  return phiDistance;
48  }
49 }
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::CDCTrack::getStartTrajectory3D
const CDCTrajectory3D & getStartTrajectory3D() const
Getter for the two dimensional trajectory.
Definition: CDCTrack.h:122
Belle2::TrackFindingCDC::PhiTrackRelationFilter::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Export all parameters.
Definition: PhiTrackRelationFilter.cc:23
Belle2::ModuleParamList::addParameter
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Definition: ModuleParamList.templateDetails.h:38
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::PhiTrackRelationFilter::m_param_maximalPhiDistance
double m_param_maximalPhiDistance
Parameter : The maximal deviation in phi between the trajectories of the track.
Definition: PhiTrackRelationFilter.h:50
Belle2::TrackFindingCDC::CDCTrack::getStartRecoPos3D
const Vector3D & getStartRecoPos3D() const
Getter for the position of the first reconstructed hit.
Definition: CDCTrack.h:95
Belle2::TrackFindingCDC::Vector3D::y
double y() const
Getter for the y coordinate.
Definition: Vector3D.h:476
Belle2::TrackFindingCDC::PhiTrackRelationFilter::operator()
Weight operator()(const CDCTrack &fromTrack, const CDCTrack &toTrack) final
Implementation of the phi calculation.
Definition: PhiTrackRelationFilter.cc:32
Belle2::TrackFindingCDC::CDCTrajectory3D::getFlightDirection3DAtSupport
Vector3D getFlightDirection3DAtSupport() const
Get the unit momentum at the start point of the trajectory.
Definition: CDCTrajectory3D.h:222
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::TrackFindingCDC::AngleUtil::normalised
static double normalised(const double angle)
Normalise an angle to lie in the range from [-pi, pi].
Definition: Angle.h:43
Belle2::TrackFindingCDC::Vector3D::phi
double phi() const
Getter for the azimuth angle.
Definition: Vector3D.h:532