|
| 1 | +// Copyright 2019-2026 CERN and copyright holders of ALICE O2. |
| 2 | +// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. |
| 3 | +// All rights not expressly granted are reserved. |
| 4 | +// |
| 5 | +// This software is distributed under the terms of the GNU General Public |
| 6 | +// License v3 (GPL Version 3), copied verbatim in the file "COPYING". |
| 7 | +// |
| 8 | +// In applying this license CERN does not waive the privileges and immunities |
| 9 | +// granted to it by virtue of its status as an Intergovernmental Organization |
| 10 | +// or submit itself to any jurisdiction. |
| 11 | + |
| 12 | +/// \file CosmicTrack.h |
| 13 | +/// \brief Matched cosmic track with the raw clusters of its legs and of the road around them, for offline refits |
| 14 | + |
| 15 | +#ifndef ALICEO2_COSMIC_TRACK_H |
| 16 | +#define ALICEO2_COSMIC_TRACK_H |
| 17 | + |
| 18 | +#include <vector> |
| 19 | +#include <cstdint> |
| 20 | +#include <Rtypes.h> |
| 21 | +#include "ReconstructionDataFormats/TrackCosmics.h" |
| 22 | +#include "DataFormatsTPC/TrackTPC.h" |
| 23 | +#include "DataFormatsTPC/ClusterNative.h" |
| 24 | +#include "SimulationDataFormat/MCCompLabel.h" |
| 25 | + |
| 26 | +namespace o2::dataformats |
| 27 | +{ |
| 28 | + |
| 29 | +/// raw TPC cluster with its address; transformed coordinates are not stored (re-transform offline with the calibration of the TF) |
| 30 | +struct CosmicTPCCluster { |
| 31 | + enum Flags : uint8_t { |
| 32 | + Attached = 0x1, ///< attached to the TPC track of this leg |
| 33 | + Corridor = 0x2, ///< found in the road around the leg |
| 34 | + Used = 0x4, ///< attached to some TPC track (for corridor clusters: another track, e.g. a split piece of the leg) |
| 35 | + AbsTime = 0x8 ///< found on the other TPC side with the absolute time of the cosmic instead of the time0 of the leg: CosmicTrack::timeTOFMUS |
| 36 | + ///< if >= 0, else the time of CosmicTrack::cosmic |
| 37 | + }; |
| 38 | + o2::tpc::ClusterNative cl{}; ///< raw cluster: time, pad, widths, charges, flags |
| 39 | + uint8_t sector = 0; |
| 40 | + uint8_t row = 0; |
| 41 | + uint8_t flags = 0; |
| 42 | + bool isAttached() const { return flags & Attached; } |
| 43 | + bool isCorridor() const { return flags & Corridor; } |
| 44 | + bool isUsed() const { return flags & Used; } |
| 45 | + bool isAbsTime() const { return flags & AbsTime; } |
| 46 | + ClassDefNV(CosmicTPCCluster, 1); |
| 47 | +}; |
| 48 | + |
| 49 | +/// origin of the ITS / TOF / TRD hits of a cosmic |
| 50 | +enum CosmicHitFlags : uint8_t { |
| 51 | + HitMatched = 0x1, ///< part of the leg's matched global track |
| 52 | + HitRoad = 0x2, ///< found by the road search around the cosmic |
| 53 | + HitTOFFlight = 0x4 ///< TOF road hit of the top/bottom pair whose time difference matches the muon's flight (fixes the cosmic's time) |
| 54 | +}; |
| 55 | + |
| 56 | +/// ITS cluster of a leg: the raw compact cluster (chip, anchor pixel, pattern ID) and its ROF; no coordinates (the dictionary and the |
| 57 | +/// geometry are applied offline) |
| 58 | +struct CosmicITSCluster { |
| 59 | + uint16_t chipID = 0; |
| 60 | + uint16_t row = 0; |
| 61 | + uint16_t col = 0; |
| 62 | + uint16_t pattID = 0; |
| 63 | + int32_t pattEntry = -1; ///< start of the pattern bytes in CosmicTrack::itsPatterns (pattern not in the dictionary or group pattern), -1: none |
| 64 | + int32_t rofBC = 0; ///< start of the cluster's ROF in BCs since the start of the TF |
| 65 | + uint8_t leg = 0; ///< 0 bottom, 1 top |
| 66 | + uint8_t flags = 0; ///< CosmicHitFlags |
| 67 | + ClassDefNV(CosmicITSCluster, 1); |
| 68 | +}; |
| 69 | + |
| 70 | +/// TOF cluster of a leg: matched to its track or found on the road |
| 71 | +struct CosmicTOFCluster { |
| 72 | + double timeRaw = 0.; ///< raw TOF time [ps] (the calibration is applied offline) |
| 73 | + float tot = 0.f; ///< time over threshold |
| 74 | + int32_t channel = -1; |
| 75 | + uint8_t leg = 0; |
| 76 | + uint8_t flags = 0; ///< CosmicHitFlags |
| 77 | + ClassDefNV(CosmicTOFCluster, 1); |
| 78 | +}; |
| 79 | + |
| 80 | +/// TRD tracklet of a leg: attached to its track or found on the road |
| 81 | +struct CosmicTRDTracklet { |
| 82 | + uint64_t word = 0; ///< raw Tracklet64 word |
| 83 | + int32_t trigBC = 0; ///< BC of its trigger since the start of the TF |
| 84 | + uint8_t layer = 0; |
| 85 | + uint8_t leg = 0; |
| 86 | + uint8_t flags = 0; ///< CosmicHitFlags |
| 87 | + ClassDefNV(CosmicTRDTracklet, 1); |
| 88 | +}; |
| 89 | + |
| 90 | +/// matched cosmic with everything needed for an offline refit |
| 91 | +struct CosmicTrack { |
| 92 | + o2::dataformats::TrackCosmics cosmic{}; ///< matcher output (time in mus; the leg references are only valid within the TF) |
| 93 | + o2::tpc::TrackTPC tpcBottom{}; ///< TPC part of the bottom leg (default if none); z refers to its time0; its cluster |
| 94 | + ///< references are only valid within the TF: the clusters are in clTPCBottom |
| 95 | + o2::tpc::TrackTPC tpcTop{}; ///< TPC part of the top leg |
| 96 | + std::vector<CosmicTPCCluster> clTPCBottom; ///< attached + corridor TPC clusters of the bottom leg |
| 97 | + std::vector<CosmicTPCCluster> clTPCTop; ///< same for the top leg |
| 98 | + std::vector<CosmicITSCluster> clITS; ///< ITS clusters of the legs' matched tracks and on the road |
| 99 | + std::vector<uint8_t> itsPatterns; ///< pattern bytes (row span, column span, bitmap) of the ITS clusters that need them |
| 100 | + std::vector<CosmicTOFCluster> clTOF; ///< TOF clusters of the legs' matched tracks and on the road |
| 101 | + std::vector<CosmicTRDTracklet> trdTracklets; ///< TRD tracklets of the legs' matched tracks and on the road |
| 102 | + float timeTOFMUS = -1.f; ///< time of the cosmic [mus since the TF start, negative before it] from its HitTOFFlight pair (valid if hasTOFTime()) |
| 103 | + float scoreTOFPair = -1.f; ///< score of the HitTOFFlight pair: road and flight-time residuals squared in units of the cuts (< 0: none) |
| 104 | + float scoreTOFReversed = -1.f; ///< same for the best pair in the impossible order (bottom hit first) = an accidental coincidence: |
| 105 | + ///< QA of the flag's background; comparable to scoreTOFPair = ambiguous TOF time (< 0: none) |
| 106 | + int duplicateOf = -1; ///< entry (in the TF) of the cosmic this one duplicates: the same muon matched twice (e.g. a leg split |
| 107 | + ///< into two TPC tracks): >= 30 % of the smaller one's TPC clusters shared with a better one (TOF time, |
| 108 | + ///< more attached clusters) (-1: none) |
| 109 | + o2::track::TrackParCov polished{}; ///< refit at the TOF time (TPC-only legs, muon mass, energy loss along the flight), at the closest |
| 110 | + ///< approach to the beam line; valid if chi2MatchPolished >= 0 |
| 111 | + float chi2MatchPolished = -1.f; ///< chi2 of the polished bottom and top halves at the closest approach (< 0: not polished) |
| 112 | + o2::MCCompLabel label{}; ///< MC label of the cosmic (MC only) |
| 113 | + |
| 114 | + bool hasTOFTime() const { return scoreTOFPair >= 0.f; } ///< a HitTOFFlight pair gave the cosmic its time timeTOFMUS |
| 115 | + ClassDefNV(CosmicTrack, 1); |
| 116 | +}; |
| 117 | + |
| 118 | +/// per-TF quantities of the TPC transformation used in the reconstruction |
| 119 | +struct CosmicsTFInfo { |
| 120 | + float vDrift = 0.f; ///< drift velocity of the transformation [cm/time bin] |
| 121 | + float t0 = 0.f; ///< time offset of the transformation [time bins] |
| 122 | + ClassDefNV(CosmicsTFInfo, 1); |
| 123 | +}; |
| 124 | + |
| 125 | +} // namespace o2::dataformats |
| 126 | + |
| 127 | +#endif |
0 commit comments