delphi-edm4hep
DELPHI SDST/FDST -> EDM4hep converter
Loading...
Searching...
No Matches
TeBank.h
Go to the documentation of this file.
1// TeBank.h
2//
3// Decoder for the PA.TE* sub-bank layout (DELPHI "TANAGRA" track-element
4// format), shared by all eight track-element modules:
5//
6// TEID 12 inner detector TEFB 16 forward chamber B
7// TETP 13 TPC TERF 21 forward RICH
8// TEOD 14 outer detector TEST 41 straw tubes
9// TEFA 15 forward chamber A TEVF 42 very forward tracker
10//
11// A module stores its label once, then one or more track-element records
12// (TERs). Word offsets are 1-based from the LPHPA address:
13//
14// +1 label + 0.1*stage
15// then per TER, the first starting at +2:
16// +0 descriptor (raw integer, bits 1..15)
17// +1..+3 coord1, coord2, coord3 (cm)
18// +4, +5, +6 theta, phi, (1/P or 1/Pt) at the TE reference point
19// +7..+6+m error matrix, lower-tri row-major over the n measured
20// fields; m = n*(n+1)/2
21// +7+m, +8+m, +9+m ndf, chi^2, track length (cm)
22//
23// so a TER occupies 10 + m words and a module 1 + sum over its TERs.
24//
25// Descriptor bit encoding (1-indexed):
26// bit 1 coord frame: 0 = (x,y,z), 1 = (R, R*phi, z) [cylindrical]
27// bit 2 non-standard (u,v,z) coords (not handled here)
28// bits 3-5 coord1/2/3 "measured" — ignored: the coordinates are always
29// present at +1..+3 and these bits do not size the cov
30// bit 6 t1 (= x or R) measured -> TE-basis idx 0 (c1)
31// bit 7 t2 (= y or z) measured -> idx 2 if cylindrical, else idx 1
32// bit 8 theta measured -> idx 3
33// bit 9 phi measured -> idx 4
34// bit 10 1/P measured -> idx 5
35// bit 11 1/Pt measured -> idx 5 (invPt flag set)
36// bits 12-15 E, beta, dE/dx, time — not in the 6-component helix
37// push-forward; ignored.
38//
39// A module may carry more than one record. Which modules do depends on the
40// detector and on the processing, so a caller must handle any count.
41//
42// Lengths stay in bank units (cm). Helix::fromTrackElement takes coordinates
43// in cm and converts internally, so callers convert only what they emit.
44
45#pragma once
46
48
49#include <vector>
50
52
53// One track-element record.
54struct Decoded {
55 int descriptor = 0;
56 int n_measured = 0;
57 int m_cov_entries = 0; // m = n(n+1)/2
58 bool is_cylindrical = false; // bit 1
59 bool invPt = false; // bit 11 (word +6 of the TER is 1/Pt)
60 bool has_meas[6] = {}; // per TE-basis field 0..5
61 float coord[3] = {}; // coordinates 1..3, cm
62 float theta = 0.f; // rad; zero where the descriptor says
63 float phi = 0.f; // rad; the field was not measured
64 float invP = 0.f; // 1/GeV, 1/Pt when invPt
65 CovMatrix6 cov{}; // zero outside measured rows/cols
66 float ndf = 0.f;
67 float chi2 = 0.f;
68 float length = 0.f; // cm
69};
70
71// One TE module: its label and every record it carries.
72struct Module {
73 int label = 0; // 12..16, 21, 41, 42
74 int stage = 0; // 0 before the label + 0.1*stage encoding
75 std::vector<Decoded> elements; // in bank order
76 bool ok = false; // the walk accounted for every bank word
77};
78
79// Decode the module at L-address `lte` with bank length `blen` (from
80// IPHREQ(1) immediately after the LPHPA call).
81Module decodeModule(int lte, int blen);
82
83} // namespace delphi_edm4hep::te_bank
Module decodeModule(int lte, int blen)
Definition TeBank.cpp:100
std::array< float, 21 > CovMatrix6
Definition Helix.h:36
std::vector< Decoded > elements
Definition TeBank.h:75