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