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/trackFindingCDC/eventdata/tracks/CDCTrack.h>
10#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
11#include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
12#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
13#include <tracking/trackFindingCDC/geometry/Vector3D.h>
14
15#include <tracking/trackFindingCDC/ca/AutomatonCell.h>
16
17using namespace Belle2;
18using namespace TrackFindingCDC;
19
20void StereoHitTrackAdder::add(CDCTrack& track, const CDCRLWireHit& hit, Weight weight __attribute__((unused)))
21{
22 const CDCTrajectory2D& trajectory2D = track.getStartTrajectory3D().getTrajectory2D();
23 const double radius = trajectory2D.getGlobalCircle().absRadius();
24 const bool isCurler = trajectory2D.isCurler();
25
26 Vector3D recoPos3D = hit.reconstruct3D(trajectory2D);
27 double arcLength2D = trajectory2D.calcArcLength2D(recoPos3D.xy());
28 if (isCurler and arcLength2D < 0) {
29 arcLength2D += 2 * TMath::Pi() * radius;
30 }
31
32 B2ASSERT("A stereo hit should not be added twice!", not hit.getWireHit().getAutomatonCell().hasTakenFlag());
33 track.emplace_back(hit, recoPos3D, arcLength2D);
34 hit.getWireHit().getAutomatonCell().setTakenFlag();
35}
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:41
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
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 Vector2D &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.
double absRadius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
void add(CDCTrack &track, const CDCRLWireHit &hit, Weight weight) override
Add the matched hits to the track and set the taken flag correctly.
A three dimensional vector.
Definition: Vector3D.h:33
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:508
Abstract base class for different kinds of events.