SHiP Data Model
Event data model for the SHiP experiment: C++ data classes with ROOT dictionary support.
Loading...
Searching...
No Matches
include
SHiP
LinkDef.h
Go to the documentation of this file.
1
// Dictionary selection for the SHiP data model.
2
//
3
// Every persistent class carries an explicit version via
4
// `options=version(N)`; RNTuple I/O customization rules misbehave for
5
// unversioned classes (root-project/root#23146). Declaring it here rather
6
// than with ClassDef keeps the data-model headers free of any ROOT
7
// dependency. Bump the version in the same change as any layout
8
// modification (member added/removed/renamed/retyped).
9
//
10
// Numbering starts at 2: rootcling already emits 1 for classes without
11
// ClassDef, and TClass reports that back as -1, so `version(1)` is
12
// indistinguishable from no version at all.
13
//
14
// Version history: 2 = the camelCase layout, released as v0.5.0; 3 = that
15
// layout plus `mothers` for MCParticle, also v0.5.0; 3 = the snake_case
16
// layout of every class with a renamed member, except MCParticle, which
17
// takes 4 because 3 is already spent on it. EventHeader and SimResult had
18
// no member renamed, keep their v0.5.0 layout and checksum, and stay at 2.
19
//
20
// The `#pragma read` rules below keep files written before the snake_case
21
// field renames (data-model <= v0.5.0) readable: each rule maps an on-disk
22
// camelCase member to its renamed in-memory member. The rules are scoped
23
// to the checksums of the historical class layouts (TClass::GetCheckSum,
24
// taken from tests/data/schema_snapshot.txt as of v0.5.0 and from the
25
// frozen reference files for earlier layouts) so they are only considered
26
// for matching on-disk data; version matching cannot be used because the
27
// pre-v0.5.0 structs were unversioned and report class version -1.
28
// Checksums do not depend on the class version, so one list of checksums
29
// per class covers every camelCase era of it, unversioned and versioned
30
// alike. If a class layout gains another era, append its checksum to the
31
// rule list. The compat suite (tests/data/README.md) catches a wrong or
32
// missing checksum only for layouts it can currently read: the v0.5.0
33
// ones, through compat_read_v0.5.0 and the reco fixture. The pre-v0.5.0
34
// checksums (MCParticle 0x1717705a, SimHit 0xcd9e29be, RecParticle
35
// 0x7abee759) are checked only by the WILL_FAIL tests described below, so
36
// a mistake in them stays hidden until those tests can pass.
37
//
38
// KNOWN ISSUE (root-project/root#23146): ROOT 6.40 misapplies these rules
39
// when reading RNTuple data written by UNVERSIONED classes. Per the
40
// workaround proposed upstream, all classes carry an explicit version
41
// (above) and readers must open files through TFile before attaching the
42
// RNTupleReader; rules then work for all data written from v0.5.0 on.
43
// Data written by the unversioned pre-v0.5.0 classes still cannot be
44
// rule-read: ROOT aborts on an internal assertion in RFieldMeta.cxx. The
45
// compat_read_v0.1.0..v0.4.0 tests are therefore marked WILL_FAIL in
46
// tests/CMakeLists.txt. They still run and still assert the true values,
47
// so ctest flips them to FAILED the moment a ROOT with the fix
48
// (root-project/root#23196) lands in pixi.lock. Do not "fix" those tests;
49
// remove the WILL_FAIL block instead. The test suite reads RNTuple only;
50
// no test covers reading camelCase data through TTree.
51
52
#ifdef __CLING__
53
#pragma link off all globals;
54
#pragma link off all classes;
55
#pragma link off all functions;
56
57
// Event metadata
58
#pragma link C++ options=version(3) class SHiP::EventHeader+;
59
60
// MC / generation
61
#pragma link C++ options=version(4) class SHiP::MCParticle+;
62
#pragma link C++ class std::vector<SHiP::MCParticle>+;
63
// MCParticle layout eras: v0.1.0-v0.4.0 = 387412058 (0x1717705a),
64
// v0.5.0 (adds mothers) = 1568762686 (0x5d816b3e)
65
#pragma read sourceClass="SHiP::MCParticle" targetClass="SHiP::MCParticle" checksum="[387412058,1568762686]" source="std::int32_t pdgCode; std::int32_t motherId" target="pdg_code,mother_id" code="{ pdg_code = onfile.pdgCode; mother_id = onfile.motherId; }"
66
67
// Simulation
68
#pragma link C++ options=version(3) class SHiP::SimHit+;
69
#pragma link C++ options=version(3) class SHiP::SimParticle+;
70
#pragma link C++ options=version(2) class SHiP::SimResult+;
71
#pragma link C++ class std::vector<SHiP::SimHit>+;
72
#pragma link C++ class std::vector<SHiP::SimParticle>+;
73
// SimHit layout eras: v0.1.0-v0.3.0 = 3449694654 (0xcd9e29be),
74
// v0.4.0-v0.5.0 (adds geometryNodeId) = 3911017334 (0xe91d6376)
75
#pragma read sourceClass="SHiP::SimHit" targetClass="SHiP::SimHit" checksum="[3449694654,3911017334]" source="std::int32_t detectorId; std::int32_t trackId; std::int32_t pdgCode; double energyDeposit; double pathLength" target="detector_id,track_id,pdg_code,energy_deposit,path_length" code="{ detector_id = onfile.detectorId; track_id = onfile.trackId; pdg_code = onfile.pdgCode; energy_deposit = onfile.energyDeposit; path_length = onfile.pathLength; }"
76
#pragma read sourceClass="SHiP::SimHit" targetClass="SHiP::SimHit" checksum="[3911017334]" source="std::int32_t geometryNodeId" target="geometry_node_id" code="{ geometry_node_id = onfile.geometryNodeId; }"
77
// SimParticle layout eras: v0.1.0-v0.5.0 = 4053157024 (0xf19644a0)
78
#pragma read sourceClass="SHiP::SimParticle" targetClass="SHiP::SimParticle" checksum="[4053157024]" source="std::int32_t trackId; std::int32_t parentId; std::int32_t pdgCode; std::int32_t creatorProcess" target="track_id,parent_id,pdg_code,creator_process" code="{ track_id = onfile.trackId; parent_id = onfile.parentId; pdg_code = onfile.pdgCode; creator_process = onfile.creatorProcess; }"
79
80
// Digitisation
81
#pragma link C++ options=version(3) class SHiP::RecHit+;
82
#pragma link C++ class std::vector<SHiP::RecHit>+;
83
// RecHit layout eras: v0.3.0-v0.5.0 = 3772464393 (0xe0db3d09)
84
#pragma read sourceClass="SHiP::RecHit" targetClass="SHiP::RecHit" checksum="[3772464393]" source="std::int32_t detectorId; std::int32_t trackId; std::int32_t pdgCode; double energyDeposit; double pathLength" target="detector_id,track_id,pdg_code,energy_deposit,path_length" code="{ detector_id = onfile.detectorId; track_id = onfile.trackId; pdg_code = onfile.pdgCode; energy_deposit = onfile.energyDeposit; path_length = onfile.pathLength; }"
85
// The detector wrappers' recHit -> rec_hit rename cannot be mapped: an
86
// object-typed rule source (SHiP::RecHit recHit) whose class itself has
87
// rules triggers a double free in ROOT 6.40.02 (TTree path; nested
88
// staging). No wrapper data has been persisted so far, but without a rule
89
// any that turns up would read back as a default-initialised rec_hit with
90
// no error. Each wrapper instead gets a rule with no source and no target,
91
// scoped to its camelCase checksum (v0.3.0-v0.5.0, unchanged since the
92
// wrappers were added), that stops the read with a Fatal error.
93
// compat_read_reco_wrappers_v0.5.0 checks for that message. Replace these
94
// rules with real mappings once ROOT handles nested-object rule sources.
95
#pragma link C++ options=version(3) class SHiP::UBTHit+;
96
#pragma link C++ class std::vector<SHiP::UBTHit>+;
97
#pragma read sourceClass="SHiP::UBTHit" targetClass="SHiP::UBTHit" checksum="[4172140978]" source="" target="" code="{ Fatal(\"SHiP::UBTHit\", \"camelCase recHit data (data-model <= v0.5.0) cannot be read into rec_hit\"); }"
98
#pragma link C++ options=version(3) class SHiP::SBTHit+;
99
#pragma link C++ class std::vector<SHiP::SBTHit>+;
100
#pragma read sourceClass="SHiP::SBTHit" targetClass="SHiP::SBTHit" checksum="[569377052]" source="" target="" code="{ Fatal(\"SHiP::SBTHit\", \"camelCase recHit data (data-model <= v0.5.0) cannot be read into rec_hit\"); }"
101
#pragma link C++ options=version(3) class SHiP::TimeDetHit+;
102
#pragma link C++ class std::vector<SHiP::TimeDetHit>+;
103
#pragma read sourceClass="SHiP::TimeDetHit" targetClass="SHiP::TimeDetHit" checksum="[3003753307]" source="" target="" code="{ Fatal(\"SHiP::TimeDetHit\", \"camelCase recHit data (data-model <= v0.5.0) cannot be read into rec_hit\"); }"
104
#pragma link C++ options=version(3) class SHiP::StrawTubesHit+;
105
#pragma link C++ class std::vector<SHiP::StrawTubesHit>+;
106
#pragma read sourceClass="SHiP::StrawTubesHit" targetClass="SHiP::StrawTubesHit" checksum="[763285781]" source="" target="" code="{ Fatal(\"SHiP::StrawTubesHit\", \"camelCase recHit data (data-model <= v0.5.0) cannot be read into rec_hit\"); }"
107
#pragma link C++ options=version(3) class SHiP::CaloHit+;
108
#pragma link C++ class std::vector<SHiP::CaloHit>+;
109
#pragma read sourceClass="SHiP::CaloHit" targetClass="SHiP::CaloHit" checksum="[4230172364]" source="" target="" code="{ Fatal(\"SHiP::CaloHit\", \"camelCase recHit data (data-model <= v0.5.0) cannot be read into rec_hit\"); }"
110
111
// Reconstruction
112
#pragma link C++ options=version(3) class SHiP::TrackFitResult+;
113
#pragma link C++ class std::vector<SHiP::TrackFitResult>+;
114
// TrackFitResult layout eras: v0.3.0-v0.5.0 = 3517659236 (0xd1ab3864)
115
#pragma read sourceClass="SHiP::TrackFitResult" targetClass="SHiP::TrackFitResult" checksum="[3517659236]" source="std::int32_t nMeas; std::int32_t fitStatus; double qoverp; std::array<double,3> refLoc; std::vector<double> inputMeasurementsX; std::vector<double> inputMeasurementsY; std::vector<double> fittedMeasurementsX; std::vector<double> fittedMeasurementsY; std::vector<double> residualsX; std::vector<double> residualsY" target="n_meas,fit_status,q_over_p,ref_loc,input_measurements_x,input_measurements_y,fitted_measurements_x,fitted_measurements_y,residuals_x,residuals_y" code="{ n_meas = onfile.nMeas; fit_status = onfile.fitStatus; q_over_p = onfile.qoverp; ref_loc = onfile.refLoc; input_measurements_x = onfile.inputMeasurementsX; input_measurements_y = onfile.inputMeasurementsY; fitted_measurements_x = onfile.fittedMeasurementsX; fitted_measurements_y = onfile.fittedMeasurementsY; residuals_x = onfile.residualsX; residuals_y = onfile.residualsY; }"
116
#pragma link C++ options=version(3) class SHiP::RecParticle+;
117
#pragma link C++ class std::vector<SHiP::RecParticle>+;
118
// RecParticle layout eras: v0.1.0-v0.2.0 = 2059331417 (0x7abee759),
119
// v0.3.0-v0.5.0 (adds hits) = 3910067879 (0xe90ee6a7)
120
#pragma read sourceClass="SHiP::RecParticle" targetClass="SHiP::RecParticle" checksum="[2059331417,3910067879]" source="std::int32_t trackId; std::int32_t parentId; std::int32_t pdgCode; std::int32_t creatorProcess; double ipPV" target="track_id,parent_id,pdg_code,creator_process,ip_pv" code="{ track_id = onfile.trackId; parent_id = onfile.parentId; pdg_code = onfile.pdgCode; creator_process = onfile.creatorProcess; ip_pv = onfile.ipPV; }"
121
#endif
Generated by
1.9.8