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/trackingUtilities/eventdata/hits/CDCRecoHit2D.h>
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCRLWireHit.h>
11
12#include <tracking/trackingUtilities/geometry/VectorUtil.h>
13
14#include <tracking/trackingUtilities/numerics/ESign.h>
15
16#include <cdc/dataobjects/CDCSimHit.h>
17
18#include <ostream>
19
20using namespace Belle2;
21using namespace TrackingUtilities;
22
24 m_rlWireHit(rlWireHit),
25 m_recoDisp2D(0.0, 0.0)
26{}
27
29 const ROOT::Math::XYVector& recoDisp2D) :
30 m_rlWireHit(rlWireHit),
31 m_recoDisp2D(recoDisp2D)
32{}
33
35 const CDCSimHit& simHit)
36{
37 // find out if the wire is right or left of the track ( view in flight direction )
38 ROOT::Math::XYZVector trackPosToWire{simHit.getPosWire() - simHit.getPosTrack()};
39 CDCRecoHit2D recoHit2D(CDCRLWireHit::fromSimHit(wireHit, simHit),
40 ROOT::Math::XYVector(-trackPosToWire.x(), -trackPosToWire.y()));
41
42 recoHit2D.snapToDriftCircle();
43 return recoHit2D;
44}
45
47 const CDCRecoHit2D& recoHit2)
48{
49 CDCRLWireHit rlWireHit =
51 recoHit2.getRLWireHit());
52
53 ROOT::Math::XYVector displacement =
54 VectorUtil::average(recoHit1.getRecoDisp2D(),
55 recoHit2.getRecoDisp2D());
56
57 CDCRecoHit2D result(rlWireHit, displacement);
58 result.snapToDriftCircle();
59
60 return result;
61}
62
64 const CDCRecoHit2D& recoHit2,
65 const CDCRecoHit2D& recoHit3)
66{
67 CDCRLWireHit rlWireHit =
69 recoHit2.getRLWireHit(),
70 recoHit3.getRLWireHit());
71
72 ROOT::Math::XYVector displacement =
73 VectorUtil::average(recoHit1.getRecoDisp2D(),
74 recoHit2.getRecoDisp2D(),
75 recoHit3.getRecoDisp2D());
76
77 CDCRecoHit2D result(rlWireHit, displacement);
78 result.snapToDriftCircle();
79
80 return result;
81}
82
84 const ROOT::Math::XYVector& recoPos2D,
85 bool snap)
86{
87 CDCRecoHit2D result(rlWireHit, recoPos2D - rlWireHit.getRefPos2D());
88 if (snap) result.snapToDriftCircle();
89 return result;
90}
91
93{
94 m_rlWireHit.reverse();
95}
96
98{
99 CDCRecoHit2D reversedRecoHit(*this);
100 reversedRecoHit.reverse();
101 return reversedRecoHit;
102}
103
108
109
110void CDCRecoHit2D::setRefDriftLength(double driftLength, bool snapRecoPos)
111{
112 double oldDriftLength = m_rlWireHit.getRefDriftLength();
113 m_rlWireHit.setRefDriftLength(driftLength);
114 if (snapRecoPos) {
115 bool switchSide = sign(oldDriftLength) != sign(driftLength);
116 snapToDriftCircle(switchSide);
117 }
118}
119
121{
122 if (m_recoDisp2D.R() != 0.0) {
124 }
125 if (switchSide) {
127 }
128}
129
130ROOT::Math::XYZVector CDCRecoHit2D::reconstruct3D(const CDCTrajectory2D& trajectory2D, double z) const
131{
132 return getRLWireHit().reconstruct3D(trajectory2D, z);
133}
134
135std::ostream& TrackingUtilities::operator<<(std::ostream& output, const CDCRecoHit2D& recohit)
136{
137 output << "CDCRecoHit2D(" << recohit.getRLWireHit() << ","
138 << recohit.getRecoDisp2D() << ")" ;
139 return output;
140}
Example Detector.
Definition CDCSimHit.h:21
B2Vector3D getPosWire() const
The method to get position on wire.
Definition CDCSimHit.h:198
B2Vector3D getPosTrack() const
The method to get position on the track.
Definition CDCSimHit.h:216
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
double getRefDriftLength() const
Getter for the drift length at the reference position of the wire.
const ROOT::Math::XYVector & getRefPos2D() const
The two dimensional reference position of the underlying wire.
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 information.
ROOT::Math::XYZVector 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.
void setRefDriftLength(double driftLength, bool snapRecoPos)
Setter for the drift length at the wire reference position.
const ROOT::Math::XYVector & getRecoDisp2D() const
Getter for the displacement from the wire reference position.
const CDCRLWireHit & getRLWireHit() const
Getter for the oriented wire hit associated with the reconstructed hit.
void reverse()
Turns the orientation in place.
CDCRecoHit2D()=default
Default constructor for ROOT.
CDCRecoHit2D getAlias() const
Getter for the alias version of the reco hit.
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.
void snapToDriftCircle(bool switchSide=false)
Scales the displacement vector in place to lie on the drift circle.
ROOT::Math::XYVector m_recoDisp2D
Memory for the displacement of the associated wire reference position.
static CDCRecoHit2D fromSimHit(const CDCWireHit *wireHit, const CDCSimHit &simHit)
Constructs a two dimensional reconstructed hit from a sim hit and the associated wirehit.
ROOT::Math::XYZVector reconstruct3D(const CDCTrajectory2D &trajectory2D, const double z=0) const
Reconstruct the three dimensional position (especially of stereo hits) by determining the z coordinat...
CDCRLWireHit m_rlWireHit
Memory for the reference to the associated wire hit.
static CDCRecoHit2D fromRecoPos2D(const CDCRLWireHit &rlWireHit, const ROOT::Math::XYVector &recoPos2D, bool snap=true)
Constructs a two dimensional reconstructed hit from an absolute position.
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:56
Abstract base class for different kinds of events.