19 xpu::push_timer(
"V0Trigger");
25 size_t numTracksUsed = 0;
26 for (
auto trackIter1 =
tracks.begin(); trackIter1 !=
tracks.end(); trackIter1++) {
27 if (!
Select(*trackIter1, config))
continue;
29 for (
auto trackIter2 = std::next(trackIter1); trackIter2 !=
tracks.end(); trackIter2++) {
30 if (!
Select(*trackIter2, config))
continue;
33 float time1 = trackIter1->fParPV.GetTime();
34 float time2 = trackIter2->fParPV.GetTime();
36 result.second.errTracksUnsorted++;
39 result.second.numTrackPairs++;
41 result.second.numTrackPairsAfterTimeCut++;
44 auto [zVertex, dist] =
CalcPCA(trackIter1->fParPV, trackIter2->fParPV);
46 result.second.numTrackPairsAfterDistCut++;
48 result.second.numTrackPairsAfterZCut++;
49 double tVertex = 0.5 * (time1 + time2);
50 result.first.push_back(tVertex);
56 result.second.time = xpu::pop_timer();
57 L_(info) <<
"V0Trigger: tracks " <<
tracks.size() <<
", unsorted " << result.second.errTracksUnsorted
58 <<
", used tracks " << numTracksUsed <<
", track pairs " << result.second.numTrackPairs
59 <<
", after time cut " << result.second.numTrackPairsAfterTimeCut <<
", after dist cut "
60 << result.second.numTrackPairsAfterDistCut <<
", after z cut " << result.second.numTrackPairsAfterZCut;
69 const double ax = track1.
GetX() - track1.
GetTx() * track1.
GetZ();
70 const double ay = track1.
GetY() - track1.
GetTy() * track1.
GetZ();
71 const double ux = track1.
GetTx();
72 const double uy = track1.
GetTy();
75 const double bx = track2.
GetX() - track2.
GetTx() * track2.
GetZ();
76 const double by = track2.
GetY() - track2.
GetTy() * track2.
GetZ();
77 const double vx = track2.
GetTx();
78 const double vy = track2.
GetTy();
81 const double cx = ax - bx;
82 const double cy = ay - by;
83 const double wx = ux - vx;
84 const double wy = uy - vy;
87 const double z = -1. * (cx * wx + cy * wy) / (wx * wx + wy * wy);
90 const double dx = cx + z * wx;
91 const double dy = cy + z * wy;
92 const double dist =
sqrt(dx * dx + dy * dy);
94 return std::make_pair(z, dist);
133 std::stringstream out;
134 out <<
"--- Using V0Trigger ---";
friend fvec sqrt(const fvec &a)
Class representing an output track in the CA tracking algorithm.
cbm::algo::kf::TrackParamS fParLast
Track parameters on the last station.
cbm::algo::kf::TrackParamS fParPV
Track parameters in the primary vertex.
cbm::algo::kf::TrackParamS fParFirst
Track parameters on the first station.
Configuration of the V0 trigger class (trigger on displaced vertices)
double TrackImpactY_min() const
Minimum y of track impact in target plane.
double TrackImpactX_max() const
Maximum x of track impact in target plane.
double PairDist_max() const
Maximum distance at closest approach.
double TrackImpactY_max() const
Maximum y of track impact in target plane.
double PairDeltaT_max() const
Maximum time difference of tracks.
double PairZ_max() const
Maximum z of PCA.
double TrackEndZ_min() const
Minimum z at last track measurement.
double TrackStartZ_min() const
Minimum z at first track measurement.
double TrackStartZ_max() const
Maximum z at first track measurement.
double PairZ_min() const
Minimum z of PCA.
double TrackImpactX_min() const
Minimum x of track impact in target plane.
std::pair< std::vector< double >, V0TriggerMoniData > Result
bool Select(const Track &track, const V0TriggerConfig &config) const
Check track cuts.
std::pair< double, double > CalcPCA(const TrackParam &track1, const TrackParam &track2) const
Calculation of closest approach of two tracks (straight lines)
Result operator()(const TrackVector &tracks, const V0TriggerConfig &config) const
Execution.
bool IsPrimary(const TrackParam &track, const V0TriggerConfig &config) const
Check if track is a priomary.
std::string ToString() const
Info to string.
T GetTy() const
Gets slope along y-axis.
T GetZ() const
Gets z position [cm].
T X() const
Gets x position [cm].
T GetTx() const
Gets slope along x-axis.
T Y() const
Gets y position [cm].
T Z() const
Gets z position [cm].
T GetY() const
Gets y position [cm].
T GetX() const
Gets x position [cm].