Belle II Software development
RecoTrackUtil Struct Reference

Structure to summarize utility function to output a list of hits into a RecoTrack. More...

#include <RecoTrackUtil.h>

Static Public Member Functions

static RecoTrackstoreInto (const TrackingUtilities::CDCTrack &track, StoreArray< RecoTrack > &recoTracks, const double momentumSeedMagnitude)
 For magnetic monopoles; estimates charge sign from all stereo hits, momentum direction from hits in closest superlayer, fixing magnitude with given value. Ignores building CDCTrajectory3D since it is based on a helix.
 
static RecoTrackstoreInto (const TrackingUtilities::CDCTrack &track, StoreArray< RecoTrack > &recoTracks)
 Copies the track information to the RecoTrack.
 
static RecoTrackstoreInto (const TrackingUtilities::CDCTrajectory3D &traj3D, StoreArray< RecoTrack > &recoTracks)
 Copies the trajectory information to the RecoTrack.
 
static RecoTrackstoreInto (const TrackingUtilities::CDCTrajectory3D &traj3D, const double bZ, StoreArray< RecoTrack > &recoTracks)
 Copies the trajectory information to the RecoTrack.
 
template<class ARLHitHolderRange>
static void fill (const ARLHitHolderRange &rlWireHitHolders, RecoTrack &recoTrack)
 Translates a range of hits and inserts them in the reco track.
 

Detailed Description

Structure to summarize utility function to output a list of hits into a RecoTrack.

Definition at line 26 of file RecoTrackUtil.h.

Member Function Documentation

◆ fill()

template<class ARLHitHolderRange>
void fill ( const ARLHitHolderRange & rlWireHitHolders,
RecoTrack & recoTrack )
static

Translates a range of hits and inserts them in the reco track.

fill() specialisation for a class that holds right-left wire-hit information

List of explicit specialisations - at the moment only CDCTrack.

Currently only instantiated for RecoTrack.

Parameters
rlWireHitHoldersA range of hits, which elements support ->getRLWireHit() to access a wire hit including a right left passage hypotheses.
[out]recoTrackRecoTrack to be filled.

Definition at line 134 of file RecoTrackUtil.cc.

135{
136 int sortingParameter = -1;
137 for (const auto& rlWireHitHolder : rlWireHitHolders) {
138 ++sortingParameter;
139
140 const CDCRLWireHit rlWireHit = rlWireHitHolder.getRLWireHit();
141 const CDCWireHit& wireHit = rlWireHit.getWireHit();
142 const CDCHit* cdcHit = wireHit.getHit();
143
144 // Right left ambiguity resolution
145 ERightLeft rlInfo = rlWireHit.getRLInfo();
146 using RightLeftInformation = RecoHitInformation::RightLeftInformation;
147 if (rlInfo == ERightLeft::c_Left) {
148 recoTrack.addCDCHit(cdcHit,
149 sortingParameter,
150 RightLeftInformation::c_left,
151 RecoHitInformation::c_CDCTrackFinder);
152 } else if (rlInfo == ERightLeft::c_Right) {
153 recoTrack.addCDCHit(cdcHit,
154 sortingParameter,
155 RightLeftInformation::c_right,
156 RecoHitInformation::c_CDCTrackFinder);
157 } else if (rlInfo == ERightLeft::c_Invalid) {
158 recoTrack.addCDCHit(cdcHit,
159 sortingParameter,
160 RightLeftInformation::c_invalidRightLeftInformation,
161 RecoHitInformation::c_CDCTrackFinder);
162 } else {
163 recoTrack.addCDCHit(cdcHit,
164 sortingParameter,
165 RightLeftInformation::c_undefinedRightLeftInformation,
166 RecoHitInformation::c_CDCTrackFinder);
167 }
168 }
169}
RightLeftInformation
The RightLeft information of the hit which is only valid for CDC hits.
bool addCDCHit(const UsedCDCHit *cdcHit, const unsigned int sortingParameter, RightLeftInformation rightLeftInformation=RightLeftInformation::c_undefinedRightLeftInformation, OriginTrackFinder foundByTrackFinder=OriginTrackFinder::c_undefinedTrackFinder)
Adds a cdc hit with the given information to the reco track.
Definition RecoTrack.h:243
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
ERightLeft getRLInfo() const
Getter for the right left passage information.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:162
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition ERightLeft.h:25

◆ storeInto() [1/4]

RecoTrack * storeInto ( const TrackingUtilities::CDCTrack & track,
StoreArray< RecoTrack > & recoTracks )
static

Copies the track information to the RecoTrack.

Definition at line 86 of file RecoTrackUtil.cc.

87{
88 const CDCTrajectory3D& traj3D = track.getStartTrajectory3D();
89 RecoTrack* newRecoTrack = storeInto(traj3D, recoTracks);
90 if (not newRecoTrack) return nullptr;
91
92 RecoTrackUtil::fill(track, *newRecoTrack);
93 return newRecoTrack;
94}
static void fill(const ARLHitHolderRange &rlWireHitHolders, RecoTrack &recoTrack)
Translates a range of hits and inserts them in the reco track.
static RecoTrack * storeInto(const TrackingUtilities::CDCTrack &track, StoreArray< RecoTrack > &recoTracks, const double momentumSeedMagnitude)
For magnetic monopoles; estimates charge sign from all stereo hits, momentum direction from hits in c...

◆ storeInto() [2/4]

RecoTrack * storeInto ( const TrackingUtilities::CDCTrack & track,
StoreArray< RecoTrack > & recoTracks,
const double momentumSeedMagnitude )
static

For magnetic monopoles; estimates charge sign from all stereo hits, momentum direction from hits in closest superlayer, fixing magnitude with given value. Ignores building CDCTrajectory3D since it is based on a helix.

Definition at line 41 of file RecoTrackUtil.cc.

42{
43 CDCTrack firstHits;
44 ISuperLayer closestLayer = track.getStartISuperLayer();
45 if (ISuperLayerUtil::isAxial(closestLayer)) closestLayer = ISuperLayerUtil::getNextOutwards(closestLayer);
46
47 for (const CDCRecoHit3D hit : track) {
48 if (hit.isAxial()) continue;
49 firstHits.push_back(hit);
50 if ((hit.getISuperLayer() != closestLayer) and (firstHits.size() > 3)) break;
51 }
52
53 const CDCSZFitter& szFitter = CDCSZFitter::getFitter();
54 const CDCTrajectorySZ& szTrajectory = szFitter.fitWithStereoHits(firstHits);
55
56 Vector3D position(track.getStartTrajectory3D().getSupport().x(),
57 track.getStartTrajectory3D().getSupport().y(),
58 szTrajectory.getZ0());
59
60 Vector3D momentum(track.getStartTrajectory3D().getFlightDirection3DAtSupport());
61 const double z0 = szTrajectory.getZ0();
62 const double lambda = std::atan(szTrajectory.getTanLambda());
63 momentum.scale(std::cos(lambda));
64 momentum.setZ(std::sin(lambda));
65 momentum *= momentumSeedMagnitude;
66
67 ESign charge;
68 double votes(0);
69 int nHits(0);
70 closestLayer = track.getEndISuperLayer();
71 if (ISuperLayerUtil::isAxial(closestLayer)) closestLayer = ISuperLayerUtil::getNextInwards(closestLayer);
72 for (auto it = track.rbegin(); it != track.rend(); it++) {
73 CDCRecoHit3D hit = *it;
74 if (hit.isAxial()) continue;
75 votes += (hit.getRecoZ() - z0 - std::tan(lambda) * hit.getArcLength2D());
76 nHits++;
77 if ((hit.getISuperLayer() != closestLayer) and (nHits > 3)) break;
78 }
79 votes > 0 ? charge = ESign::c_Plus : charge = ESign::c_Minus;
80
81 RecoTrack* newRecoTrack = recoTracks.appendNew(position, momentum, charge);
82 RecoTrackUtil::fill(track, *newRecoTrack);
83 return newRecoTrack;
84}
T * appendNew()
Construct a new T object at the end of the array.
Definition StoreArray.h:246
TrackingUtilities::CDCTrajectorySZ fitWithStereoHits(const TrackingUtilities::CDCTrack &track) const
Returns the fitted sz trajectory of the track with the z-information of all stereo hits of the number...
static const CDCSZFitter & getFitter()
Getter for a standard sz line fitter instance.
bool isAxial() const
Indicator if the underlying wire is axial.
CDC::ISuperLayer getISuperLayer() const
Getter for the superlayer id.
double getRecoZ() const
Getter for the z coordinate of the reconstructed position.
double getArcLength2D() const
Getter for the travel distance in the xy projection.
double getTanLambda() const
Getter for the slope over the travel distance coordinate.
double getZ0() const
Getter for the z coordinate at zero travel distance.
HepGeom::Vector3D< double > Vector3D
3D Vector
Definition Cell.h:34
signed short ISuperLayer
The type of the layer and superlayer ids.
Definition ISuperLayer.h:24
ESign
Enumeration for the distinct sign values of floating point variables.
Definition ESign.h:27
static bool isAxial(ISuperLayer iSuperLayer)
Returns if the super layer with the given id is axial.
static ISuperLayer getNextInwards(ISuperLayer iSuperLayer)
Returns the super layer that is inside of the given super layer.
static ISuperLayer getNextOutwards(ISuperLayer iSuperLayer)
Returns the super layer that is outside of the given super layer.

◆ storeInto() [3/4]

RecoTrack * storeInto ( const TrackingUtilities::CDCTrajectory3D & traj3D,
const double bZ,
StoreArray< RecoTrack > & recoTracks )
static

Copies the trajectory information to the RecoTrack.

Definition at line 103 of file RecoTrackUtil.cc.

106{
107 // Set the start parameters
108 Vector3D position = traj3D.getSupport();
109 Vector3D momentum =
110 bZ == 0 ? traj3D.getFlightDirection3DAtSupport() : traj3D.getMom3DAtSupport(bZ);
111 ESign charge = traj3D.getChargeSign();
112
113 // Do not propagate invalid fits, signal that the fit is invalid to the caller.
114 if (not ESignUtil::isValid(charge) or momentum.hasNAN() or position.hasNAN()) {
115 return nullptr;
116 }
117
118 RecoTrack* newRecoTrack = recoTracks.appendNew(position, momentum, charge);
119 if (std::isfinite(traj3D.getFlightTime())) {
120 newRecoTrack->setTimeSeed(traj3D.getFlightTime());
121 }
122
123 const CovarianceMatrix<6>& cov6 = traj3D.getCartesianCovariance(bZ);
124 TMatrixDSym covSeed = TMatrixConversion::toTMatrix(cov6);
125 newRecoTrack->setSeedCovariance(covSeed);
126 return newRecoTrack;
127}
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
Definition RecoTrack.h:604
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Definition RecoTrack.h:614
bool hasNAN() const
Checks if one of the coordinates is NAN.
Definition Vector3D.h:166
bool isValid(ESign s)
Returns true if sign is ESign::c_Plus, ESign::c_Minus or ESign::c_Zero.
Definition ESign.h:46
static TMatrixDSym toTMatrix(const CovarianceMatrix< N > &cov)
Translate the covariance matrix to the TMatrix representation.

◆ storeInto() [4/4]

RecoTrack * storeInto ( const TrackingUtilities::CDCTrajectory3D & traj3D,
StoreArray< RecoTrack > & recoTracks )
static

Copies the trajectory information to the RecoTrack.

Definition at line 97 of file RecoTrackUtil.cc.

98{
99 Vector3D position = traj3D.getSupport();
100 return storeInto(traj3D, CDCBFieldUtil::getBFieldZ(position), recoTracks);
101}
static double getBFieldZ()
Getter for the signed magnetic field strength in z direction at the origin ( in Tesla )

The documentation for this struct was generated from the following files: