Belle II Software development
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/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
11
12#include <tracking/trackingUtilities/numerics/Angle.h>
13#include <tracking/trackingUtilities/utilities/StringManipulation.h>
14
15#include <framework/core/ModuleParamList.templateDetails.h>
16
17#include <Math/Vector2D.h>
18
19using namespace Belle2;
20using namespace TrackingUtilities;
21
23 const std::string& prefix)
24{
25 moduleParamList->addParameter(prefixed(prefix, "maximalPhiDistance"),
27 "Maximal Phi distance below to tracks should be merged.",
29}
30
32{
33 // Make sure we only have one relation out of A -> B and B -> A
34 if (fromTrack->getPositionSeed().Y() < toTrack->getPositionSeed().Y()) {
35 return NAN;
36 }
37
38 const CDCTrajectory2D fromTrajectory(VectorUtil::getXYVector(fromTrack->getPositionSeed()), 0,
39 VectorUtil::getXYVector(fromTrack->getMomentumSeed()), fromTrack->getChargeSeed());
40 const CDCTrajectory2D toTrajectory(VectorUtil::getXYVector(toTrack->getPositionSeed()), 0,
41 VectorUtil::getXYVector(toTrack->getMomentumSeed()), toTrack->getChargeSeed());
42
43 const ROOT::Math::XYVector origin;
44
45 const double fromPhi = fromTrajectory.getFlightDirection2D(origin).Phi();
46 const double toPhi = toTrajectory.getFlightDirection2D(origin).Phi();
47
48 const double phiDistance = std::fabs(AngleUtil::normalised(fromPhi - toPhi));
49
50 if (phiDistance > m_param_maximalPhiDistance) {
51 return NAN;
52 } else {
53 return phiDistance;
54 }
55}
The Module parameter list class.
double m_param_maximalPhiDistance
Parameter : The maximal deviation in phi between the trajectories of the track.
TrackingUtilities::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.
ROOT::Math::XYVector getFlightDirection2D(const ROOT::Math::XYVector &point) const
Get the unit direction of flight at the given point, where arcLength2D = 0.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
TrackingUtilities::WithAutomatonCell< const RecoTrack * > CellularRecoTrack
Type of a reco track with automaton cell.
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