Belle II Software  release-06-02-00
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 <TVector3.h>
20 
21 #include <ostream>
22 
23 using namespace Belle2;
24 using namespace TrackFindingCDC;
25 
27  m_rlWireHit(rlWireHit),
28  m_recoDisp2D(Vector2D::getLowest())
29 {}
30 
32  const Vector2D& recoDisp2D) :
33  m_rlWireHit(rlWireHit),
34  m_recoDisp2D(recoDisp2D)
35 {}
36 
38  const CDCSimHit& simHit)
39 {
40  // find out if the wire is right or left of the track ( view in flight direction )
41  Vector3D trackPosToWire{simHit.getPosWire() - simHit.getPosTrack()};
42  CDCRecoHit2D recoHit2D(CDCRLWireHit::fromSimHit(wireHit, simHit),
43  Vector2D(-trackPosToWire.x(), -trackPosToWire.y()));
44 
45  recoHit2D.snapToDriftCircle();
46  return recoHit2D;
47 }
48 
50  const CDCRecoHit2D& recoHit2)
51 {
52  CDCRLWireHit rlWireHit =
54  recoHit2.getRLWireHit());
55 
56  Vector2D displacement =
58  recoHit2.getRecoDisp2D());
59 
60  CDCRecoHit2D result(rlWireHit, displacement);
61  result.snapToDriftCircle();
62 
63  return result;
64 }
65 
67  const CDCRecoHit2D& recoHit2,
68  const CDCRecoHit2D& recoHit3)
69 {
70  CDCRLWireHit rlWireHit =
72  recoHit2.getRLWireHit(),
73  recoHit3.getRLWireHit());
74 
75  Vector2D displacement =
77  recoHit2.getRecoDisp2D(),
78  recoHit3.getRecoDisp2D());
79 
80  CDCRecoHit2D result(rlWireHit, displacement);
81  result.snapToDriftCircle();
82 
83  return result;
84 }
85 
87  const Vector2D& recoPos2D,
88  bool snap)
89 {
90  CDCRecoHit2D result(rlWireHit, recoPos2D - rlWireHit.getRefPos2D());
91  if (snap) result.snapToDriftCircle();
92  return result;
93 }
94 
96 {
98 }
99 
101 {
102  CDCRecoHit2D reversedRecoHit(*this);
103  reversedRecoHit.reverse();
104  return reversedRecoHit;
105 }
106 
108 {
110 }
111 
112 
113 void CDCRecoHit2D::setRefDriftLength(double driftLength, bool snapRecoPos)
114 {
115  double oldDriftLength = m_rlWireHit.getRefDriftLength();
116  m_rlWireHit.setRefDriftLength(driftLength);
117  if (snapRecoPos) {
118  bool switchSide = sign(oldDriftLength) != sign(driftLength);
119  snapToDriftCircle(switchSide);
120  }
121 }
122 
123 void CDCRecoHit2D::snapToDriftCircle(bool switchSide)
124 {
126  if (switchSide) {
128  }
129 }
130 
131 Vector3D CDCRecoHit2D::reconstruct3D(const CDCTrajectory2D& trajectory2D, double z) const
132 {
133  return getRLWireHit().reconstruct3D(trajectory2D, z);
134 }
135 
136 std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const CDCRecoHit2D& recohit)
137 {
138  output << "CDCRecoHit2D(" << recohit.getRLWireHit() << ","
139  << recohit.getRecoDisp2D() << ")" ;
140  return output;
141 }
Example Detector.
Definition: CDCSimHit.h:22
TVector3 getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:205
TVector3 getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:223
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:61
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
void reverse()
Turns the orientation in place.
Definition: CDCRecoHit2D.cc:95
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:86
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.
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:49
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:281
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:37
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:35
double normalizeTo(const double toLength)
Normalizes the vector to the given length.
Definition: Vector2D.h:325
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:93
A three dimensional vector.
Definition: Vector3D.h:32
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Abstract base class for different kinds of events.