17#include "TGeoGlobalMagField.h"
18#include <fmt/format.h>
27 static bool isInitialized{
false};
29 if (!TGeoGlobalMagField::Instance()->GetField()) {
30 throw std::runtime_error(
"Magnetic field should have been initialized before this call to trackFitter()");
41 double x,
double y,
double z)
46 mClusters.assign(begin(
s),
end(
s));
47 for (
const auto& cluster : mClusters) {
52 extrapToVertex(
x,
y,
z);
55void ExtendedTrack::extrapToVertex(
double x,
double y,
double z)
62 mMomentum4D.SetPx(trackParamAtVertex.px());
63 mMomentum4D.SetPy(trackParamAtVertex.py());
64 mMomentum4D.SetPz(trackParamAtVertex.pz());
70 double dcaX = trackParamAtDCA.getNonBendingCoor() -
x;
71 double dcaY = trackParamAtDCA.getBendingCoor() -
y;
72 mDCA = std::sqrt(dcaX * dcaX + dcaY * dcaY);
77 double xAbs = trackParam.getNonBendingCoor();
78 double yAbs = trackParam.getBendingCoor();
79 mRabs = std::sqrt(xAbs * xAbs + yAbs * yAbs);
89 return mTrack.
first();
104 const auto& clusters1 =
t1.getClusters();
106 if (clusters1.size() != clusters2.size()) {
109 for (
size_t iCl = 0; iCl != clusters1.size(); ++iCl) {
110 const auto& cl1 = clusters1[iCl];
111 const auto& cl2 = clusters2[iCl];
112 if (cl1.getDEId() != cl2.getDEId()) {
115 double dx = cl1.getX() - cl2.getX();
116 double dy = cl1.getY() - cl2.getY();
117 double chi2 = dx * dx / (cl1.getEx2() + cl2.getEx2()) + dy * dy / (cl1.getEy2() + cl2.getEy2());
118 if (
chi2 > chi2Max) {
127 size_t nMatchClusters(0);
128 bool matchCluster[10] = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
false};
130 const auto& clusters1 =
t1.getClusters();
133 for (
const auto& cl1 : clusters1) {
134 for (
const auto& cl2 : clusters2) {
135 if (cl1.getDEId() == cl2.getDEId()) {
136 double dx = cl1.getX() - cl2.getX();
137 double dy = cl1.getY() - cl2.getY();
138 double chi2 = dx * dx / (cl1.getEx2() + cl2.getEx2()) + dy * dy / (cl1.getEy2() + cl2.getEy2());
139 if (
chi2 <= chi2Max) {
140 matchCluster[cl1.getChamberId()] =
true;
148 return ((matchCluster[0] || matchCluster[1] || matchCluster[2] || matchCluster[3]) &&
149 (matchCluster[6] || matchCluster[7] || matchCluster[8] || matchCluster[9]) &&
150 (2 * nMatchClusters > clusters1.size() || 2 * nMatchClusters > clusters2.size()));
155 out <<
"{" << track.asString() <<
"}";
162 double ndf = 2.0 * mClusters.size() - 6;
169 return fmt::format(
"x = {:7.2f}, y = {:7.2f}, z = {:7.2f}, px = {:7.2f}, py = {:7.2f}, pz = {:7.2f}, sign = {}",
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Definition of a class to fit a track to a set of clusters.
Definition of the MCH track.
Class to fit a track to a set of clusters.
void smoothTracks(bool smooth)
Enable/disable the smoother (and the saving of related parameters)
void fit(Track &track, bool smooth=true, bool finalize=true, std::list< TrackParam >::reverse_iterator *itStartingParam=nullptr, bool skipLocalChi2Calculation=false)
MCH track external format.
track parameters for internal use
Double_t getTrackChi2() const
return the chi2 of the track when the associated cluster was attached
TrackParam & createParamAtCluster(const Cluster &cluster)
int getNClusters() const
Return the number of attached clusters.
const TrackParam & first() const
Return a reference to the track parameters at first cluster.
double getNormalizedChi2() const
const TrackParam & param() const
std::string asString() const
bool isMatching(const ExtendedTrack &track) const
bool operator==(const ExtendedTrack &track) const
const std::vector< Cluster > & getClusters() const
ExtendedTrack(const TrackMCH &track, gsl::span< const Cluster > &clusters, double x, double y, double z)
const Track & track() const
GLdouble GLdouble GLdouble z
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
bool areMatching(const ExtendedTrack &t1, const ExtendedTrack &t2, double chi2Max)
bool areEqual(const ExtendedTrack &t1, const ExtendedTrack &t2, double chi2Max)
TrackFitter & trackFitter()
std::ostream & operator<<(std::ostream &out, const ExtendedTrack &track)
std::vector< Cluster > clusters