Belle II Software  release-05-01-25
StereoHitTrackAdder.cc
1 #include <tracking/trackFindingCDC/collectors/adders/StereoHitTrackAdder.h>
2 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
3 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
4 #include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
5 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
6 #include <tracking/trackFindingCDC/geometry/Vector3D.h>
7 
8 #include <tracking/trackFindingCDC/ca/AutomatonCell.h>
9 
10 using namespace Belle2;
11 using namespace TrackFindingCDC;
12 
13 void StereoHitTrackAdder::add(CDCTrack& track, const CDCRLWireHit& hit, Weight weight __attribute__((unused)))
14 {
15  const CDCTrajectory2D& trajectory2D = track.getStartTrajectory3D().getTrajectory2D();
16  const double radius = trajectory2D.getGlobalCircle().absRadius();
17  const bool isCurler = trajectory2D.isCurler();
18 
19  Vector3D recoPos3D = hit.reconstruct3D(trajectory2D);
20  double arcLength2D = trajectory2D.calcArcLength2D(recoPos3D.xy());
21  if (isCurler and arcLength2D < 0) {
22  arcLength2D += 2 * TMath::Pi() * radius;
23  }
24 
25  B2ASSERT("A stereo hit should not be added twice!", not hit.getWireHit().getAutomatonCell().hasTakenFlag());
26  track.emplace_back(hit, recoPos3D, arcLength2D);
27  hit.getWireHit().getAutomatonCell().setTakenFlag();
28 }
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::CDCTrajectory2D::isCurler
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
Definition: CDCTrajectory2D.cc:267
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
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::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::Vector3D::xy
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:500
Belle2::TrackFindingCDC::StereoHitTrackAdder::add
void add(CDCTrack &track, const CDCRLWireHit &hit, Weight weight) override
Add the matched hits to the track and set the taken flag correctly.
Definition: StereoHitTrackAdder.cc:13
Belle2::TrackFindingCDC::CDCTrajectory2D::calcArcLength2D
double calcArcLength2D(const Vector2D &point) const
Calculate the travel distance from the start position of the trajectory.
Definition: CDCTrajectory2D.h:270
Belle2::TrackFindingCDC::PerigeeCircle::absRadius
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
Definition: PerigeeCircle.h:350
Belle2::TrackFindingCDC::CDCTrajectory2D::getGlobalCircle
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
Definition: CDCTrajectory2D.h:451