From 8b6cb213353939e69c9594725d8997073e2b27b1 Mon Sep 17 00:00:00 2001 From: shahoian Date: Wed, 2 Dec 2026 17:41:03 +0100 Subject: [PATCH] MCTrackStudy output documentation+SV rejections vector->map --- .../DecayNBodyIndex.h | 18 + .../Reconstruction/src/DecayNBodyIndex.cxx | 11 + .../src/SecondaryVertexingSpec.cxx | 7 +- .../study/MCTrackStudyOutput.md | 327 ++++++++++++++++++ .../GlobalTrackingStudy/TrackMCStudyTypes.h | 2 +- .../include/DetectorsVertexing/SVertexer.h | 19 +- 6 files changed, 359 insertions(+), 25 deletions(-) create mode 100644 Detectors/GlobalTrackingWorkflow/study/MCTrackStudyOutput.md diff --git a/DataFormats/Reconstruction/include/ReconstructionDataFormats/DecayNBodyIndex.h b/DataFormats/Reconstruction/include/ReconstructionDataFormats/DecayNBodyIndex.h index 001d54db1832b..f038589c619c1 100644 --- a/DataFormats/Reconstruction/include/ReconstructionDataFormats/DecayNBodyIndex.h +++ b/DataFormats/Reconstruction/include/ReconstructionDataFormats/DecayNBodyIndex.h @@ -13,6 +13,9 @@ #define ALICEO2_NBODY_INDEX_H #include "ReconstructionDataFormats/VtxTrackIndex.h" +#include +#include +#include namespace o2::dataformats { @@ -109,6 +112,21 @@ struct PoolRejRecord { int vtID = 0; // primary vertex ID for which the track was considered uint16_t rej = 0; // rejection bits + // key of the rejection map: (vertexID << 32) | GlobalTrackID.getRaw() + static uint64_t getPoolRejectionKey(o2::dataformats::GlobalTrackID gid, int iv) + { + return (uint64_t(iv) << 32) | uint64_t(gid.getRaw()); + } + + // inverse of getPoolRejectionKey: returns the track GID and the vertex ID + static std::pair rejectionKey2GidIv(uint64_t k) + { + o2::dataformats::GlobalTrackID gid; + gid.setRaw(static_cast(k & 0xffffffff)); + return {gid, int(k >> 32)}; + } + + static std::unordered_map vector2map(const std::vector& v); ClassDefNV(PoolRejRecord, 1); }; diff --git a/DataFormats/Reconstruction/src/DecayNBodyIndex.cxx b/DataFormats/Reconstruction/src/DecayNBodyIndex.cxx index bd012091aad3f..af7dab46dfe32 100644 --- a/DataFormats/Reconstruction/src/DecayNBodyIndex.cxx +++ b/DataFormats/Reconstruction/src/DecayNBodyIndex.cxx @@ -15,4 +15,15 @@ namespace o2::dataformats { template class DecayNBodyIndex<2>; template class DecayNBodyIndex<3>; + +std::unordered_map PoolRejRecord::vector2map(const std::vector& v) +{ + std::unordered_map mp; + mp.reserve(v.size()); + for (const auto& r : v) { + mp[getPoolRejectionKey(r.gid, r.vtID)] |= r.rej; + } + return mp; +} + } // namespace o2::dataformats diff --git a/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx b/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx index ade43a3c443cd..0a59aa6653939 100644 --- a/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx +++ b/Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx @@ -18,14 +18,9 @@ #include "Framework/CCDBParamSpec.h" #include "ReconstructionDataFormats/Decay3Body.h" #include "DataFormatsGlobalTracking/RecoContainer.h" -#include "ReconstructionDataFormats/TrackTPCITS.h" #include "ReconstructionDataFormats/GlobalTrackID.h" -#include "DataFormatsTPC/TrackTPC.h" -#include "DataFormatsITS/TrackITS.h" #include "DetectorsBase/Propagator.h" -#include "DetectorsBase/GeometryManager.h" #include "GlobalTrackingWorkflow/SecondaryVertexingSpec.h" -#include "SimulationDataFormat/MCEventLabel.h" #include "CommonUtils/NameConf.h" #include "DetectorsVertexing/SVertexer.h" #include "StrangenessTracking/StrangenessTracker.h" @@ -122,7 +117,7 @@ void SecondaryVertexingSpec::run(ProcessingContext& pc) auto& poolRej = pc.outputs().make>(Output{"GLO", "SVREJPOOL", 0}, rejMap.size()); size_t irec = 0; for (const auto& [key, rej] : rejMap) { - auto [gid, iv] = o2::vertexing::SVertexer::rejectionKey2GidIv(key); + auto [gid, iv] = o2d::PoolRejRecord::rejectionKey2GidIv(key); auto& rec = poolRej[irec++]; rec.gid = gid; rec.vtID = iv; diff --git a/Detectors/GlobalTrackingWorkflow/study/MCTrackStudyOutput.md b/Detectors/GlobalTrackingWorkflow/study/MCTrackStudyOutput.md new file mode 100644 index 0000000000000..4a5766de41cfe --- /dev/null +++ b/Detectors/GlobalTrackingWorkflow/study/MCTrackStudyOutput.md @@ -0,0 +1,327 @@ +# TrackMCStudy output (`trackMCStudy.root`) + +The `TrackMCStudy` workflow (`src/TrackMCStudy.cxx`, types in `include/GlobalTrackingStudy/TrackMCStudyTypes.h`, +options in `TrackMCStudyConfig.h`, prefix `trmcconf`) writes the trees below into `trackMCStudy.root`. +All objects live in namespace `o2::trackstudy` unless stated otherwise. + +| Tree | One entry per | Needs | +|---|---|---| +| `tracks` | selected charged MC track | always | +| `dec` | MC decay of a watched particle | `trmcconf.decayPDG` list (default 310, 3122, 411, 421, 3312, 3334) | +| `mcVtxTree` | MC collision (digitization-context event) | always | +| `clres` | TPC cluster with a usable MC reference | `trmcconf.minTPCRefsToExtractClRes > 0` | +| `itsTree` | well-reconstructed ITS track | `trmcconf.storeITSInfo` (default true) | + +## 1. `tracks` + +Branch `tr` of type `TrackFamily` (written once per entry of `mSelMCTracks`). +A **family** is the complete record of one selected MC track: its MC truth plus every reconstructed track +that carries its label. Everything else in the output refers to families. + +### Which MC tracks get a family + +* MC scan: charged, passing `acceptMCCharged` (`minPtMC`, `maxTglMC`, `maxRMC`, `maxPosTglMC`; with + `requireITSorTPCTrackRefs` it must also have ITS or TPC track references). Daughters of watched decays are + added through the same function, so they are guaranteed to be present. +* Reconstruction stage: a reconstructed track with a valid MC label whose MC particle was not selected before + is passed through `acceptMCCharged` and added if it passes. Such families have `mcTrackInfo` flag + `AddedAtRecStage` set. +* Families with an empty `recTracks` are still written (an unreconstructed MC track is the denominator of any + efficiency). + +### `TrackFamily` content and how the parts relate + +``` +TrackFamily + ├─ mcTrackInfo (MCTrackInfo) MC truth + MC-derived detector response + ├─ recTracks (vector) all reconstructed tracks with this label, grouped by type + │ [ ITS-TPC group | ITS-standalone | TPC-standalone | others ] + ├─ entITSTPC/nEntITSTPC, entITS/nEntITS, entTPC/nEntTPC -> index ranges inside recTracks + ├─ entITSFound -> index of the ITS track whose own label equals this MC track + ├─ trackITSProp, trackTPCProp standalone ITS and TPC tracks propagated to the ITS-TPC matching reference X + └─ tpcT0 TPC time0 of the first TPC contributor +``` + +**`mcTrackInfo` (`MCTrackInfo`)** + +* Truth: `label`, `pdg`, `pdgParent` (signed PDG of the MC mother, 0 if none), `track` (`TrackPar` built at the + MC start vertex), flags (`Primary`, `AddedAtRecStage`). +* Decay bookkeeping: `parentDecID` (index of the decay type in `decayPDG`) and `parentEntry` (entry in that + decay's list) are set if the track is a charged prong of a watched decay, else -1. This is the link from a + family to the `dec` trees: the entry number in the tree equals `parentEntry` (up to decays dropped by + the consistency check, see section 2). +* Event info: `bcInTF` (collision BC wrt TF start), `occTPC` and `occITS` (TPC cluster / ITS cluster occupancy + for that collision), `occTPCV` (TPC occupancy profile over the drift time starting at the collision). +* MC-cluster counters (from the cluster MC labels, independent of any tracking): + * ITS: `nITSCl`, `pattITSCl` (bit i = cluster on layer i). Helpers: `getNITSClusCont()` (longest run of + consecutive layers), `getNITSClusForAB()` (consecutive layers from layer 6 down, as seen by the ITS-TPC + afterburner), `getLowestITSLayer()`, `getHighestITSLayer()`. + * TPC: `nTPCCl`, `nTPCClASide` (sector < 18), `nTPCClShared` (cluster with more than one valid label), + `minTPCRow`/`maxTPCRow` and their sectors `minTPCRowSect`/`maxTPCRowSect`, `nUsedPadRows`, + `maxTPCRowInner` (highest row in the sector of the lowest row). +* `trackRefsTPC`: the MC TPC track references (only with `storeTPCTrackRefs`). + +**`recTracks` (`RecTrack`)**: one element per reconstructed track found with this label. + +* Collection: loop over the tracks attached to every primary vertex (including the unassigned slot) from the + global sources that contain ITS or TPC, with `minPt`, `maxTgl` cuts. A track attached to several vertices + is stored once (first vertex), so `pvID` is the first vertex it was seen with. +* Extra entries added by the loop, so that the family always contains the pieces of its global tracks: + * for a global track (ITS-TPC, ITS-TPC-TRD, ... TPC-TOF, ...) its standalone ITS and TPC contributors are + appended as separate `RecTrack` entries if not yet present (their `pvID`/`pvLabel` are copied); + * if the ITS part of an ITS-TPC track carries a **different** MC label, that standalone ITS track is + appended to the family of its own MC label (the mismatch is thereby visible from both sides). Such an + appended entry has no `pvID` (-1). +* Ordering (this defines `entITSTPC`, `entITS`, `entTPC`): group 0 = tracks with both ITS and TPC in their + GID (ITS-TPC, ITS-TPC-TRD, ITS-TPC-TOF, ...), group 1 = standalone ITS, group 2 = standalone TPC, group 3 = the rest. Within a group, sorted by decreasing GID source + (the more complete global tracks first). `entX` is the first index of the group, `nEntX` its size; a group + with `nEntX == 0` has `entX == -1`. `getTrackWithITSTPC(i)`, `getTrackWithITS(i)`, `getTrackWithTPC(i)` + return the i-th element of each group (a dummy track if absent). +* `entITSFound`: index (in group 1) of the first standalone ITS track whose own ITS label equals the family's + label. Because standalone ITS contributors of global tracks are appended as group-1 entries (see above), it is + set even if that ITS track was matched to the TPC track of another particle: it answers "did the ITS tracker + find this MC track", independently of the matching. +* Per-`RecTrack` content: + * `gid` (`VtxTrackIndex`, raw GID incl. ambiguity/PV-contributor flags, **same raw value that the + SVertexer uses**), `track` (`TrackParCov`), `ts` (time and error; for standalone ITS, ROF bracket mean and + width), `pvID` (index of the attached primary vertex, -1 if unassigned), `pvLabel` (MC event label of that + vertex, to be compared with the track's own `label.getEventID()` for PV-association correctness); + * ITS: `nClITS`, `pattITS` (layer pattern; bit 7 flags an ITS-AB tracklet); + * TPC: `nClTPC`, `nClTPCShared`, `lowestPadRow`, `rowMaxTPC`, `rowCountTPC` (number of distinct rows), + `padFromEdge` (distance of the innermost cluster from the pad-row edge); + * `flags`: `FakeITS`, `FakeTPC`, `FakeTRD`, `FakeTOF`, `FakeITSTPC`, `FakeITSTPCTRD`, `FakeGLO` (the + label of the corresponding part / the whole global track is fake, i.e. disagrees with the family's MC + track), `HASACSides` (TPC track has clusters on both sides, effectively constrained). +* `trackITSProp` / `trackTPCProp`: filled only if the family has both standalone ITS and TPC tracks + (`nEntITS > 0 && nEntTPC > 0`, taken from `getTrackWithITS()`/`getTrackWithTPC()`), propagated to the + ITS-TPC matching reference X (`MatchTPCITSParams::XMatchingRef`). Invalidated otherwise. Together they allow + studying the ITS-TPC matching quality independently of the matcher decision. + +### Typical selections + +* ITS-TPC efficiency: `nEntITSTPC > 0` over all families passing MC cuts (use `mcTrackInfo.nITSCl`, + `nTPCCl`, `maxTPCRow - minTPCRow`). +* ITS-TPC fake matches: `recTracks[entITSTPC].flags & FakeITSTPC`; clones: `nEntITSTPC > 1`. +* "ITS and TPC found but not matched": `nEntITS > 0 && nEntTPC > 0 && nEntITSTPC == 0`. + +## 2. `dec` (e.g. `dec310`, `dec3122`, `dec3312`, ...) + +One tree per PDG code in `trmcconf.decayPDG`; the PDG in the name is positive, while the particle charge +conjugate is stored in the same tree (sign in `pdgPar`). One entry = one MC decay of the watched particle that +was registered at the MC scan. The entry is written whether or not anything was reconstructed. + +### Purpose: analysis of V0s whose prongs exist but the secondary vertex was not found + +The trees record, for every MC decay, the prongs as full `TrackFamily` objects (see section 1), the matched +reconstructed V0/cascade if the SVertexer found it, and a refit of the matched object. For decays where the +prongs were reconstructed but `found == -1`, the question is **why the SVertexer did not make a V0 of them**. +This is what the new SVertexer pool-rejection records answer. + +#### SVertexer pool-rejection records + +Commit `459eabdcea1b0df15880e7c4e653bb2d77833a8a` ("SVertexer records pools entry rejections") lets the +SVertexer record, for every track that was considered but **did not enter the positive/negative seed pools** +used for V0 pairing, the reason(s) why. + +* **Compile-time switch**: the recording is compiled in only if `_FILL_SV_POOL_REJECTIONS_` is defined in + `Detectors/Vertexing/include/DetectorsVertexing/SVertexer.h` (currently the line + `// #define _FILL_SV_POOL_REJECTIONS_` is commented out). Without it `flagPoolRejection()` is empty, the map + stays empty, and the output branch is present but has empty vectors. Rebuild the SVertexer (and everything + depending on the header) after enabling it. +* **Where it is written**: `SecondaryVertexingSpec` publishes `GLO/SVREJPOOL` and the secondary-vertex writer + stores it as branch `PoolRejections` (`std::vector`) of tree `o2sim` in + `o2_secondary_vertex.root`. The reader republishes it (empty if the branch is absent in older files). +* **Record** `o2::dataformats::PoolRejRecord` (DataFormats/Reconstruction, `DecayNBodyIndex.h`): + + | Member | Meaning | + |---|---| + | `gid` | `GlobalTrackID` of the track, raw value including the ambiguity / PV-contributor flags | + | `vtID` | primary vertex ID for which the track was considered by the SVertexer | + | `rej` | bit mask, bit `i` set = rejected for reason `SVertexer::PoolRejection` `i` (several bits possible) | + +* **Rejection reasons** (`SVertexer::PoolRejection`, bit = `0x1 << reason`): + + | Bit | Name | Reason | + |---|---|---| + | 0 | `RejTPCExcluded` | TPC-only tracks excluded by `mExcludeTPCtracks` | + | 1 | `RejTPCMaxX` | TPC track X larger than `mTPCTrackMaxX` | + | 2 | `RejTPCTimeCorr` | `correctTPCTrack` failed for the clone of an unconstrained TPC track | + | 3 | `RejTPCPhotonNCls` | photon tune: too few TPC clusters | + | 4 | `RejTPCPhotonDPV` | photon tune: Z too far from the vertex | + | 5 | `RejTPCPhotonRD2` | photon tune: circle too far from the beam line | + | 6 | `RejPVContributor` | PV contributor while `maxPVContributors < 1` | + | 7 | `RejMinDCAToPV` | `|DCA|` to the mean vertex below `minDCAToPV` (and not a heavy ionizing particle) | + | 8 | `RejShortITSOnly` | short ITS-only track (`mITSSAminNclu`, `mRejectITSonlyOBtrack`) | + + Only these cuts are recorded. A track that is **absent** from the records but did not enter a V0 was rejected + later, in the pairing (`checkV0`: DCA-fitter failure, chi2, cos(PA), mass window, radius, `minDCAToPV` + of the pair, ...), which is not recorded. +* **Vector to map**: the vector is a flat list (one record per (track, vertex) written from the SVertexer's + `unordered_map`). The just-added `PoolRejRecord::vector2map(const std::vector&)` converts it + back into the `unordered_map` keyed by + `PoolRejRecord::getPoolRejectionKey(gid, vtID) = (uint64_t(vtID) << 32) | gid.getRaw()` with the reason mask + as value (records with the same key are OR-ed). `PoolRejRecord::rejectionKey2GidIv(key)` is the inverse + (returns `{GlobalTrackID, vertexID}`). These helpers were moved from `SVertexer` into `PoolRejRecord` so that + analysis code does not need the Vertexing library. (Status: these edits are in the working tree, not yet + committed.) + +#### How to use it with the `dec` trees + +`TrackMCStudy` does **not** read `PoolRejections` itself; the join is done offline. The `dec` trees carry the +two quantities that form the key: for each prong family `prod[i]`, take a `RecTrack` from the ITS-TPC group +(or whichever global track the SVertexer used) and form +`key = PoolRejRecord::getPoolRejectionKey(rec.gid, rec.pvID)`; look it up in the map built from the +`PoolRejections` branch of the same TF (`o2_secondary_vertex.root`; you must match TFs yourself, `trackMCStudy.root` has no TF index). Interpretation for a decay with `found < 0`: + +1. All prongs have a reconstructed global track, none of them is in the rejection map: both prongs entered + the pools, the loss happened in the pair finding/fit/cuts. Compare against `sv` of a refit of the true pair + if needed (the V0 can be refit offline from the prong `TrackParCov`). +2. A prong has a rejection record: the bits say which pool cut removed it (e.g. bit 7 `RejMinDCAToPV` for + short-lived or low-DCA prongs, bit 8 for short ITS-only tracks). +3. A prong has no global track in `recTracks` (`nEntITSTPC == 0`, ...): the loss is in tracking/matching, not + in the SVertexer. + +Caveats: (a) the key uses the raw GID *with flags*, so use the `RecTrack.gid` of the global track as stored in +`recTracks`, not a standalone contributor; (b) a track attached to several vertices is stored once in the +family (with its first `pvID`), while the SVertexer processes it once per vertex, so the key for other +vertices must be built by hand; (c) tracks of the unassigned slot are not considered by the SVertexer and have +no records; (d) for an ambiguous track rejected by `acceptTrack` the SVertexer remembers the rejection and +does not record it again for later vertices. + +### Branches + +| Branch | Type | Content | +|---|---|---| +| `pdgPar` | int | signed PDG code of the MC parent | +| `trPar` | `TrackPar` | MC parent kinematics at its production vertex (not at the decay point) | +| `prod` | `vector` | one family per **charged** prong, exactly the objects of the `tracks` tree (including `recTracks`, `flags`, MC cluster counters, ...) | +| `found` | int | index of the reconstructed V0 whose prongs all come from this MC decay (-1 if none). For a cascade this is the V0 index of the neutral sub-decay | +| `sv` | `o2::dataformats::V0` | the V0 `found` refitted with the study's DCA fitter; invalid if `found < 0` or refit failed | +| `pdgMother` | int | PDG of the mother decay if this decay is a sub-decay (e.g. 3312 for a Λ from Ξ), else 0 | +| `pdgSub` | int | PDG of the neutral daughter if it also decays in the watched list (e.g. Λ from Ξ/Ω), else 0 | +| `trSub` | `TrackPar` | MC kinematics of that neutral daughter at its production vertex; default-constructed if none | +| `prodSub` | `vector` | families of the charged prongs of the sub-decay; empty if none | +| `foundSub` | int | reconstructed V0 matched to the sub-decay, -1 if none | +| `svSub` | `V0` | the sub-decay V0 (for a cascade: the V0 refitted together with the cascade); invalid if absent | +| `foundCasc` | int | index of the reconstructed cascade matched to this decay, -1 if none | +| `casc` | `o2::dataformats::Cascade` | the cascade refitted from `svSub` and the bachelor; invalid if absent | + +Relation to the other trees: + +* Every element of `prod` and `prodSub` is the same `TrackFamily` that appears in `tracks`; its + `mcTrackInfo.parentDecID` / `parentEntry` point back to this tree and entry, and `mcTrackInfo.pdgParent` + equals `pdgPar` (or the sub-decay's PDG for `prodSub`). +* For Ξ/Ω: `trPar` = cascade, `trSub` = Λ, `prod` = bachelor, `prodSub` = proton and pion of the Λ. + A Λ produced by a Ξ also appears as its own entry in `dec3122` (with `pdgMother` != 0). +* Matching rule: a V0 is "found" if every prong's MC label belongs to the same registered decay (same + `parentDecID` and `parentEntry`). A cascade is "found" if its bachelor belongs to the mother decay and both + V0 prongs belong to its registered sub-decay. +* A decay is not written if its prong-pool range is inconsistent (a prong's `pdgParent` differs from `pdgPar`). + This is a bookkeeping check (an error is logged) and should never trigger. +* Decay selection: all charged prongs must pass `acceptMCCharged`; a neutral prong is allowed only if its + decay is itself in the watched list, and only one neutral prong is allowed. + +## 3. `mcVtxTree` + +Branch `mcVtx` of type `MCVertex`, one entry per MC event of the digitization context (all MC collisions of the +TF, reconstructed or not), written at the end of the TF processing. + +| Member | Content | +|---|---| +| `pos` | MC vertex position (x, y, z) | +| `ts` | collision time in µs wrt the TF start | +| `ID` | index of the MC event in the TF (equals `label.getEventID()` of its tracks) | +| `nTrackSel` | selected charged primary MC tracks of this event (the `tracks` tree families with `Primary`) | +| `nTrackSel100` | same with pT > 100 MeV | +| `nTrackSelRCBL0` | selected tracks reconstructable by ITS: cluster on layer 0 and at least 4 consecutive ITS layers | +| `nTrackSelRCBL0P` | same, primaries only | +| `nTrackSelRCBL1` | RCBL0 and TPC row span `maxTPCRow - minTPCRow >= nMinTPCRowSpan` (reconstructable in ITS and TPC) | +| `nTrackSelRCBL1P` | same, primaries only | +| `nTrackRecRCBL0` | RCBL0 tracks for which a standalone ITS track with the right label exists (`entITSFound >= 0`) | +| `nTrackRecRCBL1` | RCBL1 tracks that have an ITS-TPC track (`entITSTPC >= 0`) | +| `recVtx` | `vector`: reconstructed primary vertices whose MC label is this event, sorted by decreasing number of contributors. `RecPV` = `PrimaryVertex pv` + `MCEventLabel mcEvLbl` (label with purity/weight). Several entries mean split vertices, none means unreconstructed | +| `occTPCV` | TPC cluster-occupancy profile in `nOccBinsDrift` consecutive windows (each `nTBPerOccBin` TPC time bins) starting at the collision time | + +Used for vertexing efficiency / purity vs. multiplicity (`nTrackSel*`), and for normalizing track efficiencies: +`nTrackRecRCBL1 / nTrackSelRCBL1` per event is the ITS-TPC efficiency of the tracks that could have been +reconstructed. Note that the counters use the family information, so they are filled before this tree is +written but after all `recTracks` have been collected. + +## 4. `clres` + +Branch `clr` of type `ClResTPC`. One entry per **TPC cluster** that has at least one MC-label contributor +among the selected MC tracks **and** for which an "ideal" track position could be built from MC TPC +track references. Meant for TPC space-charge / distortion-correction residual studies with MC truth. + +How the entry is built (`fillMCClusterInfo`): + +* TPC clusters are looped in increasing pad row, then sector. For each cluster the MC labels are read; a + `ClResTPC` is written only for a random fraction `rejectClustersResStat` (default 10%) of the clusters + (`1 - rejectClustersResStat` is dropped to limit the output size) and only if + `minTPCRefsToExtractClRes > 0`. +* For each selected contributor, the track references of that MC track in the cluster's sector (kept only + if the track has at least `minTPCRefsToExtractClRes` usable references, pT > 50 MeV, not running parallel + to the pad rows) are searched for the nearest one **below** and **above** the cluster X (within + `maxTPCRefExtrap`; with `requireTopBottomRefs` both must exist). They are propagated to the cluster X + (Bz-aware, no material) to obtain the true position of the particle at the cluster plane. +* The cluster position `xyz` is the one obtained by transforming (pad, time) with the correction maps at the + **nominal time of the MC track** (`bcInTF / 8`), i.e. including the distortion/ drift-velocity correction + but with the true time. + +`ClResTPC` members: + +| Member | Content | +|---|---| +| `sect`, `row` | sector (0-35) and pad row (0-151) of the cluster | +| `ncont` | number of valid (non-noise) MC labels on the cluster, regardless of selection | +| `flags`, `sigmaTimePacked`, `sigmaPadPacked`, `qmax`, `qtot` | cluster properties from `ClusterNative`; `getSigmaTime()`, `getSigmaPad()` unpack (1/32 units) | +| `occ` | integrated TPC cluster occupancy around the time of the first contributor (nominal time) | +| `occBin` | instantaneous cluster density at the cluster's time bin | +| `contTracks` | `vector`, one per selected contributor with a valid reference; sorted by increasing `dy^2 + dz^2` so element 0 is the closest to the cluster | + +`ClResTPCCont` members (one MC track contributing to the cluster): + +| Member | Content | +|---|---| +| `xyz` | corrected cluster position in sector coordinates {x, y, z} | +| `below`, `above` | `{X of the reference point, Y, Z}` of the track reference below / above, with Y, Z propagated to the cluster X; `below[0] <= 1` means the reference does not exist | +| `snp`, `tgl`, `q2pt` | MC track parameters at the cluster, the mean of the available (`below`, `above`) values | +| `corrAttach` | the cluster was attached to this MC track by a reconstructed TPC track of the **same** MC label (set by `flagTPCClusters` when a track is processed), i.e. the attachment was correct | + +Derived quantities (member functions): `getNExt()` (number of references used, 0-2), `getYRef()`, `getZRef()` +(true position at the cluster X; mean of the two references, or the single one), `getDY()`, `getDZ()` +(cluster minus truth), `getEY()`, `getEZ()` (Y, Z difference between the two references, an estimate of the +interpolation uncertainty; -999 if one reference only), `getDXMin()`, `getDXMax()` (distance of the cluster in X +to the nearest / furthest reference). `ClResTPC` has `getDY(i)`, ... wrappers for the i-th contributor returning +-999 if absent. + +## 5. `itsTree` + +One entry per **ITS track** of the TF, written by `processITSTracks` (only if `storeITSInfo`). Meant for ITS +alignment / material studies with MC truth. + +Selection of the track: non-fake MC label, at least `minITSClForITSoutput` (default 7) clusters, MC particle +among the selected MC tracks. Entries are written in the order of ascending MC label (all tracks of one MC +particle are adjacent). + +| Branch | Type | Content | +|---|---|---| +| `hits` | `vector` | one element per cluster of the track, ordered from the innermost to the outermost layer used | +| `trIn` | `TrackParCov` | the ITS track (`TrackITS` base) parameters | +| `trOut` | `TrackParCov` | the ITS track parameters at the outer end (`getParamOut()`) | +| `mcTr` | `TrackPar` | MC track parameters at its start vertex, same as `mcTrackInfo.track` in the family | +| `mcPDG` | int | PDG of the MC particle | +| `nTrefs` | int | number of clusters of `hits` for which an MC ITS track reference was found | + +`ITSHitInfo` (one hit): + +| Member | Content | +|---|---| +| `clus` | `BaseCluster` in the tracking frame; the "count" field is overwritten by the ITS **layer** of the cluster. Position is after the cluster-pattern / dictionary conversion | +| `chipX`, `chipAlpha` | tracking-frame X and alpha of the reference plane of the sensor | +| `tref` | the MC `TrackReference` on the same layer closest in X to the sensor reference plane (default-constructed if none) | +| `trefXT`, `trefYT` | tracking-frame coordinates of `tref` rotated by `chipAlpha` (0 if no reference was found) | + +The residual of the cluster wrt. truth is `clus.getY() - trefYT` (same for Z with `tref.Z()`), valid where +`trefXT >= 1`; `trIn`/`trOut` allow comparing the reconstruction with `mcTr` at the track ends. The family of +the same MC track in the `tracks` tree contains the same ITS track as a standalone ITS `RecTrack`. diff --git a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h index 4547f8649c604..33ea35dbea397 100644 --- a/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h +++ b/Detectors/GlobalTrackingWorkflow/study/include/GlobalTrackingStudy/TrackMCStudyTypes.h @@ -237,7 +237,7 @@ struct ClResTPCCont { adxA = xyz[0] - above[0]; } if (below[0] > 1.) { - adxB = xyz[1] - below[0]; + adxB = xyz[0] - below[0]; } return std::abs(adxA) < std::abs(adxB) ? adxA : adxB; } diff --git a/Detectors/Vertexing/include/DetectorsVertexing/SVertexer.h b/Detectors/Vertexing/include/DetectorsVertexing/SVertexer.h index 5a10273f1a3e8..7622fc75c741a 100644 --- a/Detectors/Vertexing/include/DetectorsVertexing/SVertexer.h +++ b/Detectors/Vertexing/include/DetectorsVertexing/SVertexer.h @@ -26,15 +26,12 @@ #include "ReconstructionDataFormats/VtxTrackIndex.h" #include "ReconstructionDataFormats/VtxTrackRef.h" #include "CommonDataFormat/RangeReference.h" -#include "DataFormatsTPC/ClusterNativeHelper.h" #include "DCAFitter/DCAFitterN.h" #include "DetectorsVertexing/SVertexerParams.h" #include "DetectorsVertexing/SVertexHypothesis.h" #include "StrangenessTracking/StrangenessTracker.h" #include "DataFormatsTPC/TrackTPC.h" -#include #include -#include #include "GPUO2InterfaceRefit.h" #include "DataFormatsTPC/PIDResponse.h" @@ -95,20 +92,6 @@ class SVertexer NPoolRejections }; - // key of the mPoolRejections map: (vertexID << 32) | GIndex.getRaw() - static uint64_t getPoolRejectionKey(GIndex gid, int iv) - { - return (uint64_t(iv) << 32) | uint64_t(gid.getRaw()); - } - - // inverse of getPoolRejectionKey: returns the track GIndex and the vertex ID - static std::pair rejectionKey2GidIv(uint64_t k) - { - GIndex gid; - gid.setRaw(static_cast(k & 0xffffffff)); - return {gid, int(k >> 32)}; - } - enum HypCascade { XiMinus, OmegaMinus, @@ -196,7 +179,7 @@ class SVertexer void flagPoolRejection(GIndex gid, int iv, PoolRejection reason) { #ifdef _FILL_SV_POOL_REJECTIONS_ - mPoolRejections[getPoolRejectionKey(gid, iv)] |= uint16_t(0x1 << reason); + mPoolRejections[o2::dataformats::PoolRejRecord::getPoolRejectionKey(gid, iv)] |= uint16_t(0x1 << reason); #endif } bool processTPCTrack(const o2::tpc::TrackTPC& trTPC, GIndex gid, int vtxid);