Belle II Software  release-05-01-25
CDCRecoHit2D.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit2D.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
13 
14 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
15 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
16 
17 #include <tracking/trackFindingCDC/numerics/ESign.h>
18 
19 #include <cdc/dataobjects/CDCSimHit.h>
20 
21 #include <TVector3.h>
22 
23 #include <ostream>
24 
25 using namespace Belle2;
26 using namespace TrackFindingCDC;
27 
29  m_rlWireHit(rlWireHit),
30  m_recoDisp2D(Vector2D::getLowest())
31 {}
32 
34  const Vector2D& recoDisp2D) :
35  m_rlWireHit(rlWireHit),
36  m_recoDisp2D(recoDisp2D)
37 {}
38 
40  const CDCSimHit& simHit)
41 {
42  // find out if the wire is right or left of the track ( view in flight direction )
43  Vector3D trackPosToWire{simHit.getPosWire() - simHit.getPosTrack()};
44  CDCRecoHit2D recoHit2D(CDCRLWireHit::fromSimHit(wireHit, simHit),
45  Vector2D(-trackPosToWire.x(), -trackPosToWire.y()));
46 
47  recoHit2D.snapToDriftCircle();
48  return recoHit2D;
49 }
50 
52  const CDCRecoHit2D& recoHit2)
53 {
54  CDCRLWireHit rlWireHit =
56  recoHit2.getRLWireHit());
57 
58  Vector2D displacement =
60  recoHit2.getRecoDisp2D());
61 
62  CDCRecoHit2D result(rlWireHit, displacement);
63  result.snapToDriftCircle();
64 
65  return result;
66 }
67 
69  const CDCRecoHit2D& recoHit2,
70  const CDCRecoHit2D& recoHit3)
71 {
72  CDCRLWireHit rlWireHit =
74  recoHit2.getRLWireHit(),
75  recoHit3.getRLWireHit());
76 
77  Vector2D displacement =
79  recoHit2.getRecoDisp2D(),
80  recoHit3.getRecoDisp2D());
81 
82  CDCRecoHit2D result(rlWireHit, displacement);
83  result.snapToDriftCircle();
84 
85  return result;
86 }
87 
89  const Vector2D& recoPos2D,
90  bool snap)
91 {
92  CDCRecoHit2D result(rlWireHit, recoPos2D - rlWireHit.getRefPos2D());
93  if (snap) result.snapToDriftCircle();
94  return result;
95 }
96 
98 {
100 }
101 
103 {
104  CDCRecoHit2D reversedRecoHit(*this);
105  reversedRecoHit.reverse();
106  return reversedRecoHit;
107 }
108 
110 {
112 }
113 
114 
115 void CDCRecoHit2D::setRefDriftLength(double driftLength, bool snapRecoPos)
116 {
117  double oldDriftLength = m_rlWireHit.getRefDriftLength();
118  m_rlWireHit.setRefDriftLength(driftLength);
119  if (snapRecoPos) {
120  bool switchSide = sign(oldDriftLength) != sign(driftLength);
121  snapToDriftCircle(switchSide);
122  }
123 }
124 
125 void CDCRecoHit2D::snapToDriftCircle(bool switchSide)
126 {
128  if (switchSide) {
130  }
131 }
132 
133 Vector3D CDCRecoHit2D::reconstruct3D(const CDCTrajectory2D& trajectory2D, double z) const
134 {
135  return getRLWireHit().reconstruct3D(trajectory2D, z);
136 }
137 
138 std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const CDCRecoHit2D& recohit)
139 {
140  output << "CDCRecoHit2D(" << recohit.getRLWireHit() << ","
141  << recohit.getRecoDisp2D() << ")" ;
142  return output;
143 }
Belle2::TrackFindingCDC::CDCRLWireHit::average
static CDCRLWireHit average(const CDCRLWireHit &rlWireHit1, const CDCRLWireHit &rlWireHit2)
Constructs the average of two wire hits with right left passage informations.
Definition: CDCRLWireHit.cc:63
Belle2::operator<<
std::ostream & operator<<(std::ostream &output, const IntervalOfValidity &iov)
Definition: IntervalOfValidity.cc:196
Belle2::TrackFindingCDC::Vector2D::normalizeTo
double normalizeTo(const double toLength)
Normalizes the vector to the given length.
Definition: Vector2D.h:327
Belle2::CDCSimHit::getPosTrack
TVector3 getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:234
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCRecoHit2D::fromRecoPos2D
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:88
Belle2::TrackFindingCDC::CDCRecoHit2D::getRLWireHit
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit assoziated with the reconstructed hit.
Definition: CDCRecoHit2D.h:291
Belle2::TrackFindingCDC::CDCRLWireHit::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:214
Belle2::TrackFindingCDC::CDCRecoHit2D::getRefDriftLength
double getRefDriftLength() const
Getter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.h:227
Belle2::TrackFindingCDC::CDCRecoHit2D::getRecoDisp2D
const Vector2D & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
Definition: CDCRecoHit2D.h:260
Belle2::TrackFindingCDC::CDCRecoHit2D::fromSimHit
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:39
Belle2::CDCSimHit
Example Detector.
Definition: CDCSimHit.h:33
Belle2::TrackFindingCDC::CDCRecoHit2D::setRefDriftLength
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
Definition: CDCRecoHit2D.cc:115
Belle2::TrackFindingCDC::CDCRecoHit2D::average
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:51
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::CDCRecoHit2D::reversed
CDCRecoHit2D reversed() const
Returns the recohit with the opposite right left information.
Definition: CDCRecoHit2D.cc:102
Belle2::TrackFindingCDC::CDCRecoHit2D::m_rlWireHit
CDCRLWireHit m_rlWireHit
Memory for the reference to the assiziated wire hit.
Definition: CDCRecoHit2D.h:304
Belle2::TrackFindingCDC::CDCRecoHit2D
Class representing a two dimensional reconstructed hit in the central drift chamber.
Definition: CDCRecoHit2D.h:57
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::CDCRecoHit2D::CDCRecoHit2D
CDCRecoHit2D()=default
Default constructor for ROOT.
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::CDCRLWireHit::reverse
void reverse()
Swiches the right left passage to its opposite inplace.
Definition: CDCRLWireHit.h:108
Belle2::TrackFindingCDC::CDCRecoHit2D::m_recoDisp2D
Vector2D m_recoDisp2D
Memory for the displacement fo the assoziated wire reference position.
Definition: CDCRecoHit2D.h:307
Belle2::TrackFindingCDC::CDCRecoHit2D::reverse
void reverse()
Turns the orientation in place.
Definition: CDCRecoHit2D.cc:97
Belle2::TrackFindingCDC::CDCRLWireHit::setRefDriftLength
void setRefDriftLength(double driftLength)
Setter for the drift length at the reference position of the wire.
Definition: CDCRLWireHit.h:220
Belle2::CDCSimHit::getPosWire
TVector3 getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:216
Belle2::TrackFindingCDC::CDCRecoHit2D::getAlias
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
Definition: CDCRecoHit2D.cc:109
Belle2::TrackFindingCDC::CDCRLWireHit::getRefPos2D
const Vector2D & getRefPos2D() const
The two dimensional reference position of the underlying wire.
Definition: CDCRLWireHit.cc:158
Belle2::TrackFindingCDC::CDCRecoHit2D::snapToDriftCircle
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the dirft circle.
Definition: CDCRecoHit2D.cc:125
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65
Belle2::TrackFindingCDC::CDCRLWireHit::reconstruct3D
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, double z=0) const
Attempts to reconstruct a three dimensional position (especially of stereo hits).
Definition: CDCRLWireHit.cc:183
Belle2::TrackFindingCDC::CDCRecoHit2D::reconstruct3D
Vector3D reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determinating the z coordin...
Definition: CDCRecoHit2D.cc:133
Belle2::TrackFindingCDC::CDCRLWireHit::fromSimHit
static CDCRLWireHit fromSimHit(const CDCWireHit *wirehit, const CDCSimHit &simhit)
Constructs an oriented wire hit from a CDCSimHit and the associated wirehit.
Definition: CDCRLWireHit.cc:114
Belle2::TrackFindingCDC::Vector2D::average
static Vector2D average(const Vector2D &one, const Vector2D &two)
Constructs the average of two vectors.
Definition: Vector2D.h:95