Belle II Software  release-08-01-10
PhiRecoTrackRelationFilter.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/modules/cosmicsTrackMerger/PhiRecoTrackRelationFilter.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
11 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
12 
13 #include <tracking/trackFindingCDC/numerics/Angle.h>
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"),
25  m_param_maximalPhiDistance,
26  "Maximal Phi distance below to tracks should be merged.",
27  m_param_maximalPhiDistance);
28 }
29 
31 {
32  // Make sure we only have one relation out of A -> B and B -> A
33  if (fromTrack->getPositionSeed().Y() < toTrack->getPositionSeed().Y()) {
34  return NAN;
35  }
36 
37  const CDCTrajectory2D fromTrajectory(Vector3D(fromTrack->getPositionSeed()).xy(), 0,
38  Vector3D(fromTrack->getMomentumSeed()).xy(), fromTrack->getChargeSeed());
39  const CDCTrajectory2D toTrajectory(Vector3D(toTrack->getPositionSeed()).xy(), 0,
40  Vector3D(toTrack->getMomentumSeed()).xy(), toTrack->getChargeSeed());
41 
42  const Vector2D origin;
43 
44  const double fromPhi = fromTrajectory.getFlightDirection2D(origin).phi();
45  const double toPhi = toTrajectory.getFlightDirection2D(origin).phi();
46 
47  const double phiDistance = std::fabs(AngleUtil::normalised(fromPhi - toPhi));
48 
49  if (phiDistance > m_param_maximalPhiDistance) {
50  return NAN;
51  } else {
52  return phiDistance;
53  }
54 }
The Module parameter list class.
TrackFindingCDC::Weight operator()(const CellularRecoTrack &fromTrack, const CellularRecoTrack &toTrack) final
Implementation of the phi calculation.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Export all parameters.
Particle trajectory as it is seen in xy projection represented as a circle.
Vector2D getFlightDirection2D(const Vector2D &point) const
Get the unit direction of flight at the given point, where arcLength2D = 0.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:35
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:581
Mixin class to attach an automaton cell to an object or pointer.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition: Cell.h:34
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