8#include <tracking/trackFindingCDC/eventdata/utils/RecoTrackUtil.h>
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
12#include <tracking/trackFindingCDC/eventdata/hits/CDCRLWireHit.h>
13#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15#include <tracking/trackFindingCDC/topology/ISuperLayer.h>
16#include <tracking/trackFindingCDC/fitting/CDCSZFitter.h>
17#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectorySZ.h>
19#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory3D.h>
20#include <tracking/trackFindingCDC/eventdata/trajectories/CDCBFieldUtil.h>
22#include <tracking/trackFindingCDC/numerics/TMatrixConversion.h>
23#include <tracking/trackFindingCDC/geometry/Vector3D.h>
24#include <tracking/trackFindingCDC/numerics/ERightLeft.h>
25#include <tracking/trackFindingCDC/numerics/ESign.h>
27#include <tracking/dataobjects/RecoTrack.h>
28#include <tracking/dataobjects/RecoHitInformation.h>
30#include <framework/datastore/StoreArray.h>
32#include <TMatrixDSymfwd.h>
33#include <TMatrixTSym.h>
37using namespace TrackFindingCDC;
42 ISuperLayer closestLayer = track.getStartISuperLayer();
46 if (hit.isAxial())
continue;
47 firstHits.push_back(hit);
48 if ((hit.getISuperLayer() != closestLayer) and (firstHits.size() > 3))
break;
54 Vector3D position(track.getStartTrajectory3D().getSupport().x(),
55 track.getStartTrajectory3D().getSupport().y(),
56 szTrajectory.
getZ0());
58 Vector3D momentum(track.getStartTrajectory3D().getFlightDirection3DAtSupport());
59 const double z0 = szTrajectory.
getZ0();
60 const double lambda = std::atan(szTrajectory.
getTanLambda());
61 momentum.scale(std::cos(lambda));
62 momentum.setZ(std::sin(lambda));
63 momentum *= momentumSeedMagnitude;
68 closestLayer = track.getEndISuperLayer();
70 for (
auto it = track.rbegin(); it != track.rend(); it++) {
72 if (hit.isAxial())
continue;
73 votes += (hit.getRecoZ() - z0 - std::tan(lambda) * hit.getArcLength2D());
75 if ((hit.getISuperLayer() != closestLayer) and (nHits > 3))
break;
77 votes > 0 ? charge = ESign::c_Plus : charge = ESign::c_Minus;
88 if (not newRecoTrack)
return nullptr;
131template <
class ARLHitHolderRange>
134 int sortingParameter = -1;
135 for (
const auto& rlWireHitHolder : rlWireHitHolders) {
138 const CDCRLWireHit rlWireHit = rlWireHitHolder.getRLWireHit();
145 if (rlInfo == ERightLeft::c_Left) {
148 RightLeftInformation::c_left,
149 RecoHitInformation::c_CDCTrackFinder);
150 }
else if (rlInfo == ERightLeft::c_Right) {
153 RightLeftInformation::c_right,
154 RecoHitInformation::c_CDCTrackFinder);
155 }
else if (rlInfo == ERightLeft::c_Invalid) {
158 RightLeftInformation::c_invalidRightLeftInformation,
159 RecoHitInformation::c_CDCTrackFinder);
163 RightLeftInformation::c_undefinedRightLeftInformation,
164 RecoHitInformation::c_CDCTrackFinder);
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
This is the Reconstruction Event-Data Model Track.
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.
void setTimeSeed(const double timeSeed)
Set the time seed. ATTENTION: This is not the fitted time.
void setSeedCovariance(const TMatrixDSym &seedCovariance)
Set the covariance of the seed. ATTENTION: This is not the fitted covariance.
Accessor to arrays stored in the data store.
T * appendNew()
Construct a new T object at the end of the array.
static double getBFieldZ()
Getter for the signed magnetic field strength in z direction at the origin ( in Tesla )
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Class representing a three dimensional reconstructed hit.
Class implementing the z coordinate over travel distance line fit.
static const CDCSZFitter & getFitter()
Getter for a standard sz line fitter instance.
CDCTrajectorySZ fitWithStereoHits(const CDCTrack &track) const
Returns the fitted sz trajectory of the track with the z-information of all stereo hits of the number...
Class representing a sequence of three dimensional reconstructed hits.
Particle full three dimensional trajectory.
Vector3D getMom3DAtSupport(const double bZ) const
Get the momentum at the start point of the trajectory.
CovarianceMatrix< 6 > getCartesianCovariance(double bZ) const
Convert the helix parameters to the cartesian coordinates x,y,z,px,py,pz.
double getFlightTime() const
Getter for the time when the particle reached the support point position.
ESign getChargeSign() const
Gets the charge sign of the trajectory.
Vector3D getFlightDirection3DAtSupport() const
Get the unit momentum at the start point of the trajectory.
Vector3D getSupport() const
Getter for the support point of the trajectory in global coordinates, where arcLength2D = 0.
Linear trajectory in sz space.
double getTanLambda() const
Getter for the slope over the travel distance coordinate.
double getZ0() const
Getter for the z coordinate at zero travel distance.
Class representing a hit wire in the central drift chamber.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
A matrix implementation to be used as an interface typ through out the track finder.
A three dimensional vector.
bool hasNAN() const
Checks if one of the coordinates is NAN.
ESign
Enumeration for the distinct sign values of floating point variables.
bool isValid(ESign s)
Returns true if sign is ESign::c_Plus, ESign::c_Minus or ESign::c_Zero.
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Abstract base class for different kinds of events.
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.
static void fill(const ARLHitHolderRange &rlWireHitHolders, RecoTrack &recoTrack)
Translates a range of hits and inserts them in the reco track.
static RecoTrack * storeInto(const CDCTrack &track, StoreArray< RecoTrack > &recoTracks, const double momentumSeedMagnitude)
For magnetic monopoles; estimates charge sign from all stereo hits, momentum direction from hits in c...
static TMatrixDSym toTMatrix(const CovarianceMatrix< N > &cov)
Translate the covariance matrix to the TMatrix representation.