Belle II Software development
HitGapAxialSegmentPairVarSet.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/axialSegmentPair/HitGapAxialSegmentPairVarSet.h>
9
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCAxialSegmentPair.h>
11#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
12#include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
13
14#include <tracking/trackFindingCDC/numerics/Angle.h>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18
20{
21 if (not ptrAxialSegmentPair) return false;
22
23 const CDCAxialSegmentPair& axialSegmentPair = *ptrAxialSegmentPair;
24
25 const CDCSegment2D* ptrFromSegment = axialSegmentPair.getStartSegment();
26 const CDCSegment2D* ptrToSegment = axialSegmentPair.getEndSegment();
27
28 const CDCSegment2D& fromSegment = *ptrFromSegment;
29 const CDCSegment2D& toSegment = *ptrToSegment;
30
31 const CDCRecoHit2D& fromFirstHit = fromSegment.front();
32 const CDCRecoHit2D& fromLastHit = fromSegment.back();
33
34 const CDCRecoHit2D& toFirstHit = toSegment.front();
35 const CDCRecoHit2D& toLastHit = toSegment.back();
36
37 const Vector2D fromLastHitPos = fromLastHit.getRecoPos2D();
38 const Vector2D fromFirstHitPos = fromFirstHit.getRecoPos2D();
39
40 const Vector2D toFirstHitPos = toFirstHit.getRecoPos2D();
41 const Vector2D toLastHitPos = toLastHit.getRecoPos2D();
42
43 const Vector2D hitPosGap = toFirstHitPos - fromLastHitPos;
44 const Vector2D longHitPosGap = toLastHitPos - fromFirstHitPos;
45
46 const double hitDistance = hitPosGap.norm();
47 const double longHitDistance = longHitPosGap.norm();
48
49 const Vector2D fromLastHitMom = fromLastHit.getFlightDirection2D();
50 const Vector2D toFirstHitMom = toFirstHit.getFlightDirection2D();
51
52 finitevar<named("delta_hit_pos_phi")>() = fromLastHitPos.angleWith(toFirstHitPos);
53 finitevar<named("delta_hit_mom_phi")>() = fromLastHitMom.angleWith(toFirstHitMom);
54
55 double fromLastHitAlpha = fromLastHit.getAlpha();
56 double toFirstHitAlpha = toFirstHit.getAlpha();
57 finitevar<named("delta_hit_alpha")>() = AngleUtil::normalised(toFirstHitAlpha - fromLastHitAlpha);
58
59 finitevar<named("hit_distance")>() = hitDistance;
60 finitevar<named("hit_long_distance")>() = longHitDistance;
61
62 finitevar<named("delta_hit_distance")>() = longHitDistance - hitDistance;
63
64 finitevar<named("from_hit_forward")>() = hitPosGap.dot(fromLastHitMom);
65 finitevar<named("to_hit_forward")>() = hitPosGap.dot(toFirstHitMom);
66 finitevar<named("hit_forward")>() = hitPosGap.dot(Vector2D::average(fromLastHitMom, toFirstHitMom));
67
68 const Vector2D fromStretch = fromLastHitPos - fromFirstHitPos;
69 const Vector2D toStretch = toLastHitPos - toFirstHitPos;
70
71 const double fromLength = fromStretch.norm();
72 const double toLength = toStretch.norm();
73
74 const Vector2D firstPosGap = toFirstHitPos - fromFirstHitPos;
75 const Vector2D lastPosGap = toLastHitPos - fromLastHitPos;
76
77 const double firstOffset = firstPosGap.norm();
78 const double lastOffset = lastPosGap.norm();
79
80 finitevar<named("hit_ptolemy")>() =
81 firstOffset * lastOffset - longHitDistance * hitDistance - fromLength * toLength;
82
83 return true;
84}
Class representing a pair of reconstructed axial segments in adjacent superlayer.
const CDCAxialSegment2D * getEndSegment() const
Getter for the end segment.
const CDCAxialSegment2D * getStartSegment() const
Getter for the start segment.
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
double getAlpha() const
Getter for the direction of flight relative to the position.
Definition: CDCRecoHit2D.h:263
Vector2D getFlightDirection2D() const
Getter for the direction of flight.
Definition: CDCRecoHit2D.h:256
Vector2D getRecoPos2D() const
Getter for the position in the reference plane.
Definition: CDCRecoHit2D.h:238
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
bool extract(const CDCAxialSegmentPair *ptrAxialSegmentPair) override
Generate and assign the contained variables.
AssignFinite< Float_t > finitevar()
Reference getter for the value of the ith variable. Transforms non-finite values to finite value.
Definition: VarSet.h:130
static constexpr int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:78
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
double dot(const Vector2D &rhs) const
Calculates the two dimensional dot product.
Definition: Vector2D.h:158
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:84
double angleWith(const Vector2D &rhs) const
The angle between this and rhs.
Definition: Vector2D.h:197
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:175
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