20#include <fmt/format.h>
39 mDirection = {xDir, yDir, zDir};
44 mPosition = {xPos, yPos, zPos};
49 if (chamber < 0 || chamber > 3) {
50 std::cerr <<
"Error: chamber must be in range [0, 3]\n";
53 return mClusterMatched[chamber];
58 if (chamber < 0 || chamber > 3) {
59 std::cerr <<
"Error: chamber must be in range [0, 3]\n";
62 mClusterMatched[chamber] =
id;
71 if (mPosition[2] == zPosition) {
76 float dZ = zPosition - mPosition[2];
77 float newX = mPosition[0] + mDirection[0] * dZ;
78 float newY = mPosition[1] + mDirection[1] * dZ;
82 std::array<float, 6> newCovParams;
84 for (
int idx = 0; idx < 2; ++idx) {
85 int slopeIdx = idx + 2;
89 mCovarianceParameters[idx] + 2. * mCovarianceParameters[covIdx] * dZ + mCovarianceParameters[slopeIdx] * dZ2;
91 newCovParams[covIdx] = mCovarianceParameters[covIdx] + mCovarianceParameters[slopeIdx] * dZ;
93 newCovParams[slopeIdx] = mCovarianceParameters[slopeIdx];
96 mCovarianceParameters.swap(newCovParams);
103 if (track.mPosition[2] != mPosition[2]) {
104 Track copyTrack(track);
148 for (
int icoor = 0; icoor < 2; ++icoor) {
149 double diffPos = mPosition[icoor] - track.mPosition[icoor];
150 double diffSlope = mDirection[icoor] - track.mDirection[icoor];
151 double varPos = mCovarianceParameters[icoor] + track.mCovarianceParameters[icoor];
152 double varSlope = mCovarianceParameters[icoor + 2] + track.mCovarianceParameters[icoor + 2];
153 double cov = mCovarianceParameters[icoor + 4] + track.mCovarianceParameters[icoor + 4];
154 double chi2 = (diffPos * diffPos * varSlope + diffSlope * diffSlope * varPos - 2. * diffPos * diffSlope * cov) /
155 (varPos * varSlope - cov * cov);
166 mEfficiencyWord &= ~(
mask <<
pos);
172 stream <<
"Position: (" << track.mPosition[0] <<
", " << track.mPosition[1] <<
", " << track.mPosition[2] <<
")";
173 stream <<
" Direction: (" << track.mDirection[0] <<
", " << track.mDirection[1] <<
", " << track.mDirection[2] <<
")";
174 stream <<
" Covariance (X, Y, SlopeX, SlopeY, X-SlopeX, Y-SlopeY): (";
175 for (
int ival = 0; ival < 6; ++ival) {
176 stream << track.mCovarianceParameters[ival];
177 stream << ((ival == 5) ?
")" :
", ");
179 stream << fmt::format(
" chi2/ndf: {:g}/{:d}", track.getChi2(), track.getNDF());
180 stream << fmt::format(
" hitMap: 0x{:x} deId: {:d} columnId: {:d} lineId: {:d} effFlag {:d}", track.getHitMap(), track.getFiredDEId(), track.getFiredColumnId(), track.getFiredLineId(), track.getEfficiencyFlag());
This class defines the MID track.
void setClusterMatched(int chamber, int id)
bool propagateToZ(float zPosition)
int getClusterMatched(int chamber) const
bool isCompatible(const Track &track, float chi2Cut) const
void setDirection(float xDir, float yDir, float zDir)
void setCovarianceParameters(float xErr2, float yErr2, float slopeXErr2, float slopeYErr2, float covXSlopeX, float covYSlopeY)
@ VarX
Variance on X position.
@ VarSlopeX
Variance on X slope.
@ VarY
Variance on Y position.
@ CovXSlopeX
Covariance on X position and slope.
@ CovYSlopeY
Covariance on Y position and slope.
@ VarSlopeY
Variance on Y slope.
void setPosition(float xPos, float yPos, float zPos)
void setEfficiencyWord(uint32_t efficiencyWord)
set efficiency word (public function)
GLsizei const GLfloat * value
std::ostream & operator<<(std::ostream &os, const Cluster &data)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...