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