Belle II Software development
CDCRecoHit2D.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/eventdata/hits/CDCRecoHit2D.h>
9
10#include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
11
12#include <tracking/trackFindingCDC/geometry/Vector3D.h>
13#include <tracking/trackFindingCDC/geometry/Vector2D.h>
14
15#include <tracking/trackFindingCDC/numerics/ESign.h>
16
17#include <cdc/dataobjects/CDCSimHit.h>
18
19#include <ostream>
20
21using namespace Belle2;
22using namespace TrackFindingCDC;
23
25 m_rlWireHit(rlWireHit),
26 m_recoDisp2D(Vector2D::getLowest())
27{}
28
30 const Vector2D& recoDisp2D) :
31 m_rlWireHit(rlWireHit),
32 m_recoDisp2D(recoDisp2D)
33{}
34
36 const CDCSimHit& simHit)
37{
38 // find out if the wire is right or left of the track ( view in flight direction )
39 Vector3D trackPosToWire{simHit.getPosWire() - simHit.getPosTrack()};
40 CDCRecoHit2D recoHit2D(CDCRLWireHit::fromSimHit(wireHit, simHit),
41 Vector2D(-trackPosToWire.x(), -trackPosToWire.y()));
42
43 recoHit2D.snapToDriftCircle();
44 return recoHit2D;
45}
46
48 const CDCRecoHit2D& recoHit2)
49{
50 CDCRLWireHit rlWireHit =
52 recoHit2.getRLWireHit());
53
54 Vector2D displacement =
56 recoHit2.getRecoDisp2D());
57
58 CDCRecoHit2D result(rlWireHit, displacement);
59 result.snapToDriftCircle();
60
61 return result;
62}
63
65 const CDCRecoHit2D& recoHit2,
66 const CDCRecoHit2D& recoHit3)
67{
68 CDCRLWireHit rlWireHit =
70 recoHit2.getRLWireHit(),
71 recoHit3.getRLWireHit());
72
73 Vector2D displacement =
75 recoHit2.getRecoDisp2D(),
76 recoHit3.getRecoDisp2D());
77
78 CDCRecoHit2D result(rlWireHit, displacement);
79 result.snapToDriftCircle();
80
81 return result;
82}
83
85 const Vector2D& recoPos2D,
86 bool snap)
87{
88 CDCRecoHit2D result(rlWireHit, recoPos2D - rlWireHit.getRefPos2D());
89 if (snap) result.snapToDriftCircle();
90 return result;
91}
92
94{
96}
97
99{
100 CDCRecoHit2D reversedRecoHit(*this);
101 reversedRecoHit.reverse();
102 return reversedRecoHit;
103}
104
106{
108}
109
110
111void CDCRecoHit2D::setRefDriftLength(double driftLength, bool snapRecoPos)
112{
113 double oldDriftLength = m_rlWireHit.getRefDriftLength();
114 m_rlWireHit.setRefDriftLength(driftLength);
115 if (snapRecoPos) {
116 bool switchSide = sign(oldDriftLength) != sign(driftLength);
117 snapToDriftCircle(switchSide);
118 }
119}
120
122{
124 if (switchSide) {
126 }
127}
128
129Vector3D CDCRecoHit2D::reconstruct3D(const CDCTrajectory2D& trajectory2D, double z) const
130{
131 return getRLWireHit().reconstruct3D(trajectory2D, z);
132}
133
134std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const CDCRecoHit2D& recohit)
135{
136 output << "CDCRecoHit2D(" << recohit.getRLWireHit() << ","
137 << recohit.getRecoDisp2D() << ")" ;
138 return output;
139}
Example Detector.
Definition: CDCSimHit.h:21
B2Vector3D getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:199
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:217
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
void reverse()
Swiches the right left passage to its opposite inplace.
Definition: CDCRLWireHit.h:98
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:204
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:210
static CDCRLWireHit fromSimHit(const CDCWireHit *wirehit, const CDCSimHit &simhit)
Constructs an oriented wire hit from a CDCSimHit and the associated wirehit.
static CDCRLWireHit average(const CDCRLWireHit &rlWireHit1, const CDCRLWireHit &rlWireHit2)
Constructs the average of two wire hits with right left passage informations.
Definition: CDCRLWireHit.cc:59
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:47
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
Vector2D m_recoDisp2D
Memory for the displacement fo the assoziated wire reference position.
Definition: CDCRecoHit2D.h:297
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:281
void reverse()
Turns the orientation in place.
Definition: CDCRecoHit2D.cc:93
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:217
CDCRecoHit2D()=default
Default constructor for ROOT.
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
static CDCRecoHit2D fromRecoPos2D(const CDCRLWireHit &rlWireHit, const Vector2D &recoPos2D, bool snap=true)
Constructs a two dimensional reconstructed hit from an absolute position.
Definition: CDCRecoHit2D.cc:84
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determinating the z coordin...
CDCRecoHit2D reversed() const
Returns the recohit with the opposite right left information.
Definition: CDCRecoHit2D.cc:98
static CDCRecoHit2D average(const CDCRecoHit2D &recoHit1, const CDCRecoHit2D &recoHit2)
Constructs the average of two reconstructed hit positions and snaps it to the drift circle.
Definition: CDCRecoHit2D.cc:47
const Vector2D & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
Definition: CDCRecoHit2D.h:250
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the dirft circle.
static CDCRecoHit2D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a two dimensional reconstructed hit from a sim hit and the assoziated wirehit.
Definition: CDCRecoHit2D.cc:35
CDCRLWireHit m_rlWireHit
Memory for the reference to the assiziated wire hit.
Definition: CDCRecoHit2D.h:294
Particle trajectory as it is seen in xy projection represented as a circle.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double normalizeTo(const double toLength)
Normalizes the vector to the given length.
Definition: Vector2D.h:313
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:84
A three dimensional vector.
Definition: Vector3D.h:33
Abstract base class for different kinds of events.