Belle II Software development
LowHitsAxialTrackUtil.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/processing/LowHitsAxialTrackUtil.h>
9
10#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
11#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
12
13#include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
14#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectorySZ.h>
15#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
16
17using namespace Belle2;
18using namespace TrackFindingCDC;
19using namespace TrackingUtilities;
20
21void LowHitsAxialTrackUtil::addCandidateFromHits(const std::vector<const CDCWireHit*>& foundAxialWireHits,
22 const std::vector<const CDCWireHit*>& allAxialWireHits,
23 std::vector<CDCTrack>& axialTracks,
24 bool fromOrigin,
25 bool straight,
26 bool withPostprocessing)
27{
28 if (foundAxialWireHits.empty()) return;
29
30 // New track
31 CDCTrack track;
32
33 // Fit trajectory
34 const CDCRiemannFitter& fitter = CDCRiemannFitter::getFitter(fromOrigin, straight);
35 CDCTrajectory2D trajectory2D = fitter.fit(foundAxialWireHits);
36 track.setStartTrajectory3D(CDCTrajectory3D(trajectory2D, CDCTrajectorySZ::basicAssumption()));
37
38 // Reconstruct and add hits
39 for (const CDCWireHit* wireHit : foundAxialWireHits) {
40 AutomatonCell& automatonCell = wireHit->getAutomatonCell();
41 if (automatonCell.hasTakenFlag()) continue;
42 CDCRecoHit3D recoHit3D = CDCRecoHit3D::reconstructNearest(wireHit, trajectory2D);
43 track.push_back(std::move(recoHit3D));
44
45 automatonCell.setTakenFlag(true);
46 }
47 track.sortByArcLength2D();
48
49 // Change everything again in the postprocessing, if desired
50 bool success = withPostprocessing ? postprocessTrack(track, allAxialWireHits) : true;
51 if (success) {
53 for (const CDCRecoHit3D& recoHit3D : track) {
54 recoHit3D.getWireHit().getAutomatonCell().setTakenFlag(true);
55 }
56 axialTracks.emplace_back(std::move(track));
57 } else {
59 for (const CDCRecoHit3D& recoHit3D : track) {
60 recoHit3D.getWireHit().getAutomatonCell().setMaskedFlag(true);
61 recoHit3D.getWireHit().getAutomatonCell().setTakenFlag(false);
62 }
63 }
64}
65
66bool LowHitsAxialTrackUtil::postprocessTrack([[maybe_unused]] CDCTrack& track, [[maybe_unused]] const
67 std::vector<const CDCWireHit*>& allAxialWireHits)
68{
69 // No postprocessing yet
70 return true;
71}
Class implementing the Riemann fit for two dimensional trajectory circle.
static const CDCRiemannFitter & getFitter()
Static getter for a general Riemann fitter.
Cell used by the cellular automata.
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 a three dimensional reconstructed hit.
static CDCRecoHit3D reconstructNearest(const CDCWireHit *axialWireHit, const CDCTrajectory2D &trajectory2D)
Reconstruct a three dimensional hit from a wire hit (as in reconstruct(rlWireHit, trajectory2D)),...
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:39
Particle trajectory as it is seen in xy projection represented as a circle.
Particle full three dimensional trajectory.
static CDCTrajectorySZ basicAssumption()
Constructs a basic assumption, what the z0 start position and the sz slope are, including some broad ...
Class representing a hit wire in the central drift chamber.
Definition CDCWireHit.h:58
Abstract base class for different kinds of events.
static void addCandidateFromHits(const std::vector< const TrackingUtilities::CDCWireHit * > &foundAxialWireHits, const std::vector< const TrackingUtilities::CDCWireHit * > &allAxialWireHits, std::vector< TrackingUtilities::CDCTrack > &axialTracks, bool fromOrigin=true, bool straight=true, bool withPostprocessing=true)
Create CDCTrack using CDCWireHit hits and store it in the list.
static bool postprocessTrack(TrackingUtilities::CDCTrack &track, const std::vector< const TrackingUtilities::CDCWireHit * > &allAxialWireHits)
Perform all track postprocessing - return whether the track is considered good after the postprocessi...