Debian Codegraph @

DESIGN

raw
1 /**
2 @page design Design
3
4 HEPMC3 interface design
5 =======================
6
7
8 This document is for recording the motivations for (re)design features in the
9 HepMC3 API. It should be written in Markdown notation so we can embed it into
10 the Doxygen code documentation.
11
12
13 Naming convention
14 -----------------
15
16 Previous inconsistency, e.g. Gen prefixes on several core objects, but then
17 WeightContainer, PdfInfo, HeavyIon, etc. which did not have it. All API objects
18 in HepMC3 have a Gen prefix. This is useful because "Event", "Particle",
19 "Vertex", etc. are very common concepts in HEP code, and it is often nice to be able to drop the explicit HepMC::
20
21
22 Code standard
23 -------------
24
25 The decision was made to base HepMC3 on the C++11 standard. This provides
26 powerful smart pointers, improved iteration machinery (the range-based for
27 loop), and constructs such as lambda functions which may be useful for compact
28 testing of event constituent properties.
29
30
31 Memory management and ownership
32 -------------------------------
33
34 @TODO Tomasz! Explain issues with HepMC object ownership, motivation for the
35 shared pointer design, veiled pointer nature of new GenParticle, GenEvent's
36 holding of the canonical particle & vertex lists as simple vectors, etc.
37
38 @TODO Closed directed cycles are forbidden and may produce undefined behaviour.
39
40 @TODO Links between particles and iteration. "Parents", "children" links and
41 "all" iteration (from the event) are efficient. "Descendents" and "ancestors"
42 are not -- they will explicitly return a whole list, rather than allowing early
43 exit. If efficient access to such sets is needed, e.g. "test each descendent
44 until a photon is found", write a recursive function, perhaps a C++11 lambda.
45
46
47 Search engine
48 -------------
49
50 @TODO Tomasz
51
52
53 Generalised attributes
54 ----------------------
55
56 @TODO describe system. Leif?
57
58
59 Compatibility with HepMC2
60 -------------------------
61
62 Avoid changes to the _bulk_ of user code. This typically means event
63 interrogation, as opposed to event building and modification; the former
64 occupies thousands of lines of LHC code, while building and reading truth
65 events occurs only in a relatively few places.
66
67 The result is that the naming has generally been kept the same as in HepMC2, and
68 where changes to the canonical names have been made for improved consistency or
69 otherwise, backward compatibility aliases are provided. This includes the
70 iterator design of HepMC2, whose use is strongly discouraged in HepMC3, and the
71 STL-like IO_* classes of HepMC2 which have been replaced by the Reader/Writer
72 hierarchy. The aliases are provided if the HEPMC_NO_DEPRECATION preprocessor
73 macro is not defined; this is the default in version 3.0.x, but we anticipate
74 that in future releases (perhaps 3.1.x) the use of HepMC2 features will by
75 default first produce compilation warnings, and will eventually be disabled
76 entirely.
77
78 Forward compatibility aliases and features will be added to final releases of
79 HepMC2 to ease transition to version 3.
80
81
82 Removal of 'barcode'
83 --------------------
84
85 The "barcode" integer in HepMC2 was an uncomfortable object, simultaneously
86 declared in the code documentation to be a meaningless unique identifier for
87 vertex and particle objects, and set to specific ranges by experiments'
88 production systems to encode information about a particle's origins. It proved
89 impossible to satisfactorily reconcile these twin uses, and experiments' demands
90 for particle provenance information have exceeded the capacity of an int (or
91 even a long int).
92
93 Hence in HepMC3, the two concepts have been separated. Particles and vertices
94 have a unique identifier, the ID, and arbitrary provenance information may be
95 encoded in attached attributes. Since analysis procedures are accustomed to the
96 concept of a barcode which encodes e.g. primary vs. secondary physical
97 particles, the name has been entirely removed from HepMC3 such that it may be
98 used without fear of clashes in constructing analysis data formats -- in this
99 context the barcode will be defined by the user, perhaps combining the ID and
100 the provenance attributes in a scheme to meet the specific analysis needs.
101
102
103 Removal of 'Flow'
104 -----------------
105
106 The Flow class has been removed, since it was unused by any widespread event
107 generator, and to our knowledge the only active use-case is an abuse of it to
108 provide more ints in which to encode provenance information. As this is now done
109 via attributes, there is no case for Flow's continued existence. No backward
110 compatibility Flow class is provided since this usage is extremely localised in
111 one piece of user code and migration to the newer scheme should be simple.
112
113
114 Status schemes
115 --------------
116
117 We continue with the standard status scheme for particles, and adopt the vertex
118 'id' scheme as a new vertex status, so named for consistency with the particles.
119
120 PARTICLE STATUS:
121 0 = null particle, do not use
122 1 = a stable physical particle, according to the latest stage of processing
123 2 = a decayed physical particle, post-hadronization
124 3 = documentation particle, typically meaning a hard process particle but not guaranteed physical
125 4 = a beam particle
126
127 VERTEX STATUS:
128 1 = TODO
129 2 = TODO
130 3 = TODO
131 4 = TODO
132 5 = hadronization vertex, with incoming final partons and outgoing hadrons
133
134 */