Belle II Software development
AxialStraightTrackCreator.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
9#include <tracking/trackFindingCDC/findlets/minimal/AxialStraightTrackCreator.h>
10
11#include <mdst/dataobjects/ECLCluster.h>
12#include <tracking/trackFindingCDC/geometry/Vector2D.h>
13#include <tracking/trackFindingCDC/geometry/UncertainPerigeeCircle.h>
14#include <tracking/trackFindingCDC/fitting/CDCRiemannFitter.h>
15#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
16#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
17#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
18#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
19
20#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
21
22#include <framework/core/ModuleParamList.templateDetails.h>
23
24using namespace Belle2;
25using namespace TrackFindingCDC;
26
28
30{
31 return "A findlet looking for straight tracks between IP and reconstructed ECL clusters.";
32}
33
35 const std::string& prefix)
36{
37 moduleParamList->addParameter(prefixed(prefix, "minEnergy"),
39 "Parameter to define minimal threshold of ECL cluster energy.",
41 moduleParamList->addParameter(prefixed(prefix, "minNHits"),
43 "Parameter to define minimal threshold of track number of hits.",
45 moduleParamList->addParameter(prefixed(prefix, "maxDistance"),
47 "Parameter to define maximal threshold of hit distance to a line IP - ECL cluster.",
49}
50
52{
54}
55
56void AxialStraightTrackCreator::apply(const std::vector<const ECLCluster*>& eclClusters,
57 const std::vector<const CDCWireHit*>& axialWireHits,
58 std::vector<CDCTrack>& tracks)
59{
60 for (const ECLCluster* cluster : eclClusters) {
61 if (!cluster->hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) continue;
62 if (cluster->getEnergy(ECLCluster::EHypothesisBit::c_nPhotons) < m_param_minEnergy) continue;
63 float phi = cluster->getPhi();
64 UncertainPerigeeCircle circle(0, Vector2D::Phi(phi), 0); //no covariance matrix (yet?)
65 CDCTrajectory2D guidingTrajectory2D(circle);
66 CDCTrack track;
67 guidingTrajectory2D.setLocalOrigin(Vector2D(0, 0));
68 std::vector<const CDCWireHit*> foundHits = search(axialWireHits, guidingTrajectory2D);
69 if (foundHits.size() < m_param_minNHits) continue;
70 // Fit trajectory
71 const CDCRiemannFitter& fitter = CDCRiemannFitter::getFitter(true, true);
72 CDCTrajectory2D trajectory2D = fitter.fit(foundHits);
73 track.setStartTrajectory3D(CDCTrajectory3D(trajectory2D, CDCTrajectorySZ::basicAssumption()));
74
75 // Reconstruct and add hits
76 for (const CDCWireHit* wireHit : foundHits) {
77 CDCRecoHit3D recoHit3D = CDCRecoHit3D::reconstructNearest(wireHit, trajectory2D);
78 track.push_back(std::move(recoHit3D));
79 }
80 track.sortByArcLength2D();
81 tracks.emplace_back(std::move(track));
82 }
83}
84
85std::vector<const CDCWireHit*> AxialStraightTrackCreator::search(const std::vector<const CDCWireHit*>& axialWireHits,
86 const CDCTrajectory2D& guidingTrajectory2D)
87{
88 std::vector<const CDCWireHit*> foundHits;
89 for (const CDCWireHit* hit : axialWireHits) {
90 const Vector2D point = hit->reconstruct2D(guidingTrajectory2D);
91 float arc = guidingTrajectory2D.calcArcLength2D(point);
92 if (arc < 0) continue; // No b2b tracks
93 float distance = guidingTrajectory2D.getDist2D(point);
94 if (std::fabs(distance) < m_param_maxDistance) {
95 foundHits.push_back(hit);
96 }
97 }
98 return foundHits;
99}
ECL cluster data.
Definition: ECLCluster.h:27
@ c_nPhotons
CR is split into n photons (N1)
The Module parameter list class.
void apply(const std::vector< const ECLCluster * > &eclClusters, const std::vector< const CDCWireHit * > &axialWireHits, std::vector< CDCTrack > &tracks) final
Execute one pass over given clusters and wirehits and create tracks.
void initialize() final
Initialisation before the event processing starts.
std::string getDescription() final
Short description of the findlet.
std::vector< const CDCWireHit * > search(const std::vector< const CDCWireHit * > &axialWireHits, const CDCTrajectory2D &guidingTrajectory2D)
Search for hits compatible with given trajectory.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
unsigned int m_param_minNHits
Track number of hits threshold.
float m_param_maxDistance
Maximum distance from hits to the track.
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.
double setLocalOrigin(const Vector2D &localOrigin)
Setter for the origin of the local coordinate system.
double calcArcLength2D(const Vector2D &point) const
Calculate the travel distance from the start position of the trajectory.
double getDist2D(const Vector2D &point) const
Calculates the distance from the point to the trajectory as seen from the xy projection.
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
void initialize() override
Receive and dispatch signal before the start of the event processing.
Adds an uncertainty matrix to the circle in perigee parameterisation.
A two dimensional vector which is equipped with functions for correct handling of orientation relate...
Definition: Vector2D.h:32
static Vector2D Phi(const double phi)
Constructs a unit vector with azimuth angle equal to phi.
Definition: Vector2D.h:62
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.