Belle II Software development
StereoHitTrackAdder.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/collectors/adders/StereoHitTrackAdder.h>
9#include <tracking/trackingUtilities/eventdata/hits/CDCRLWireHit.h>
10#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
11#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
12#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
13
14#include <tracking/trackingUtilities/ca/AutomatonCell.h>
15
16#include <Math/Vector3D.h>
17
18using namespace Belle2;
19using namespace TrackFindingCDC;
20using namespace TrackingUtilities;
21
22void StereoHitTrackAdder::add(CDCTrack& track, const CDCRLWireHit& hit, Weight weight __attribute__((unused)))
23{
24 const CDCTrajectory2D& trajectory2D = track.getStartTrajectory3D().getTrajectory2D();
25 const double radius = trajectory2D.getGlobalCircle().absRadius();
26 const bool isCurler = trajectory2D.isCurler();
27
28 ROOT::Math::XYZVector recoPos3D = hit.reconstruct3D(trajectory2D);
29 double arcLength2D = trajectory2D.calcArcLength2D(VectorUtil::getXYVector(recoPos3D));
30 if (isCurler and arcLength2D < 0) {
31 arcLength2D += 2 * TMath::Pi() * radius;
32 }
33
34 B2ASSERT("A stereo hit should not be added twice!", not hit.getWireHit().getAutomatonCell().hasTakenFlag());
35 track.emplace_back(hit, recoPos3D, arcLength2D);
37}
void add(TrackingUtilities::CDCTrack &track, const TrackingUtilities::CDCRLWireHit &hit, TrackingUtilities::Weight weight) override
Add the matched hits to the track and set the taken flag correctly.
void setTakenFlag(bool setTo=true)
Sets the taken flag to the given value. Default value true.
bool hasTakenFlag() const
Gets the current state of the taken marker flag.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
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 sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:37
Particle trajectory as it is seen in xy projection represented as a circle.
PerigeeCircle getGlobalCircle() const
Getter for the circle in global coordinates.
double calcArcLength2D(const ROOT::Math::XYVector &point) const
Calculate the travel distance from the start position of the trajectory.
bool isCurler(double factor=1) const
Checks if the trajectory leaves the outer radius of the CDC times the given tolerance factor.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
Definition CDCWireHit.h:287
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
Abstract base class for different kinds of events.