@@ -28,45 +28,46 @@ event files in the HepMC format.
2828
2929To make a simulation reading from the file ` events.hepmc ` , do
3030
31- o2-sim -g hepmc --configKeyValues "FileOrCmd .fileNames=events.hepmc" ...
31+ o2-sim -g hepmc --configKeyValues "GeneratorFileOrCmd .fileNames=events.hepmc" ...
3232
3333See also [ ` read.sh ` ] ( read.sh ) .
3434
3535## Reading HepMC events from child process
36+
3637` GeneratorHepMC ` can not only read HepMC events from a file, but can
3738also spawn an child EG to produce events. Suppose we have a program
3839named ` eg ` which is some EG that writes HepMC event records to the
3940standard output. Then we can execute a simulation using this external
4041EG by
4142
42- o2-sim -g hepmc --configKeyValues "FileOrCmd .cmd=eg"
43+ o2-sim -g hepmc --configKeyValues "GeneratorFileOrCmd .cmd=eg"
4344
4445See also [ ` child.sh ` ] ( child.sh ) .
4546
4647There are some requirements on the program ` eg ` :
4748
4849- The EG program _ must_ be able to write the HepMC event structures to
4950 a specified file. The option passed to the program is specified via
50- the key ` FileOrCmd .outputSwitch` . This defaults to ` > ` which means
51- the EG program is assumed to write the HepMC event structures to
52- standard output, _ and_ that nothing else is printed on standard
53- output.
51+ the key ` GeneratorFileOrCmd .outputSwitch` . This defaults to ` > `
52+ which means the EG program is assumed to write the HepMC event
53+ structures to standard output, _ and_ that nothing else is printed on
54+ standard output.
5455- It _ must_ accept an option to set the number of events to generate.
5556 This is controlled by the configuration key
56- ` FileOrCmd .nEventsSwitch` and defaults to ` -n ` . Thus, the EG
57- application should accept ` -n 10 ` to mean that it should generate
57+ ` GeneratorFileOrCmd .nEventsSwitch` and defaults to ` -n ` . Thus, the
58+ EG application should accept ` -n 10 ` to mean that it should generate
5859 ` 10 ` events, for example.
5960- The EG application should accept a command line switch to set the
60- random number generator seed. This option is specified via the
61- configuration key ` FileOrCmd .seedSwitch` and defaults to ` -s ` .
62- Thus, the EG application must accept ` -s 123456 ` to mean to set the
63- random number seed to ` 123456 ` for example.
61+ random number generator seed. This option is specified via the
62+ configuration key ` GeneratorFileOrCmd .seedSwitch` and defaults to
63+ ` -s ` . Thus, the EG application must accept ` -s 123456 ` to mean to
64+ set the random number seed to ` 123456 ` for example.
6465- The EG application should accept a command line switch to set the
6566 maximum impact parameter (in Fermi-metre) sampled. This is set via
66- the configuration key ` FileOrCmd .bMaxSwithc` and defaults to ` -b ` .
67- Thus, the EG application should take the command line argument `-b
68- 10` to mean that it should only generate events with an impact
69- parameter between 0fm and 10fm.
67+ the configuration key ` GeneratorFileOrCmd .bMaxSwithc` and defaults
68+ to ` -b ` . Thus, the EG application should take the command line
69+ argument ` -b 10` to mean that it should only generate events with an
70+ impact parameter between 0fm and 10fm.
7071
7172If a program does not adhere to these requirements, it will often be
7273simple enough to make a small wrapper script that enforce this. For
@@ -76,8 +77,8 @@ We can filter that out via a shell script ([`crmc.sh`](crmc.sh)) like
7677 #!/bin/sh
7778 crmc $@ -o hepmc3 -f /dev/stdout | sed -n 's/^\(HepMC::\|[EAUWVP] \)/\1/p'
7879
79- The ` sed ` command selects lines that begin with ` HepMC:: ` , or one
80- of single characters ` E ` (event), ` A ` (attribute), ` U ` (units), ` W `
80+ The ` sed ` command selects lines that begin with ` HepMC:: ` , or one of
81+ single characters ` E ` (event), ` A ` (attribute), ` U ` (units), ` W `
8182(weight), ` V ` (vertex), or ` P ` (particle) followed by a space. This
8283should in most cases be enough to filter out extra stuff written on
8384standard output.
@@ -87,7 +88,7 @@ The script above also passes any additional command line options on to
8788the CRMC suite. For example, if we want to simulate p-Pb collisions
8889using DpmJET, we can do
8990
90- o2-sim -g hepmc --configKeyValues "FileOrCmd .cmd=crmc.sh -m 12 -i2212 -I 1002080820"
91+ o2-sim -g hepmc --configKeyValues "GeneratorFileOrCmd .cmd=crmc.sh -m 12 -i2212 -I 1002080820"
9192
9293
9394### Implementation details
@@ -109,46 +110,50 @@ The `GeneratorHepMC` (and sister generator `GeneratorTParticle`)
109110allows customisation of the execution via configuration keys passed
110111via ` --configKeyValues `
111112
112- - ` HepMC.eventsToSkip=number ` a number events to skip at the
113- beginning of each file read.
113+ - ` HepMC.eventsToSkip=number ` a number events to skip at the beginning
114+ of each file read.
115+
116+ - ` HepMC.version ` - when reading the events from files, this option is
117+ no longer needed. The code itself figures out which format version
118+ the input file is in. If executing a child process through
119+ ` GeneratorFileOrCmd.cmd ` and the EG writes out HepMC2 format, then
120+ this _ must_ be set to ` 2 ` . Otherwise, HepMC3 is assumed.
114121
115- - ` FileOrCmd .fileNames=list` a comma separated list of HepMC files
116- to read.
122+ - ` GeneratorFileOrCmd .fileNames=list` a comma separated list of HepMC
123+ files to read.
117124
118- - ` FileOrCmd .cmd=command line` a command line to execute as a
125+ - ` GeneratorFileOrCmd .cmd=command line` a command line to execute as a
119126 background child process. If this is set (not the empty string),
120- then ` FileOrCmd .fileNames` is ignored.
127+ then ` GeneratorFileOrCmd .fileNames` is ignored.
121128
122- - A number of keys that specifies the command line option switch
123- that the child program accepts for certain things. If any of
124- these are set to the empty string, then that switch and
125- corresponding option value is not passed to the child program.
129+ - A number of keys that specifies the command line option switch that
130+ the child program accepts for certain things. If any of these are
131+ set to the empty string, then that switch and corresponding option
132+ value is not passed to the child program.
126133
127- - ` FileOrCmd .outputSwitch=switch` (default ` > ` ) to specify output
128- file. The default of ` > ` assumes that the program write HepMC
129- events, and _ only_ those, to standard output.
134+ - ` GeneratorFileOrCmd .outputSwitch=switch` (default ` > ` ) to specify
135+ output file. The default of ` > ` assumes that the program write
136+ HepMC events, and _ only_ those, to standard output.
130137
131- - ` FileOrCmd .seedSwitch=switch` (default ` -s ` ) to specify the
132- random number generator seed. The value passed is selected by
138+ - ` GeneratorFileOrCmd .seedSwitch=switch` (default ` -s ` ) to specify
139+ the random number generator seed. The value passed is selected by
133140 the ` o2-sim ` option ` --seed `
134141
135- - ` FileOrCmd .bMaxSwitch=switch` (default ` -b ` ) to specify the
136- upper limit on the impact parameters sampled. The value passed
137- is selected by the ` o2-sim ` option ` --bMax `
142+ - ` GeneratorFileOrCmd .bMaxSwitch=switch` (default ` -b ` ) to specify
143+ the upper limit on the impact parameters sampled. The value
144+ passed is selected by the ` o2-sim ` option ` --bMax `
138145
139- - ` FileOrCmd .nEventsSwitch=switch` (default ` -n ` ) to specify the
140- number of events to generate. The value passed is selected by
141- the ` o2-sim ` option ` --nEvents ` or (` -n ` )
146+ - ` GeneratorFileOrCmd .nEventsSwitch=switch` (default ` -n ` ) to
147+ specify the number of events to generate. The value passed is
148+ selected by the ` o2-sim ` option ` --nEvents ` or (` -n ` )
142149
143- - ` FileOrCmd .backgroundSwitch=switch` (default ` & ` ) to specify how
144- the program is put in the background. Typically this should be
145- ` & ` , but a program may itself fork to the background.
150+ - ` GeneratorFileOrCmd .backgroundSwitch=switch` (default ` & ` ) to
151+ specify how the program is put in the background. Typically this
152+ should be ` & ` , but a program may itself fork to the background.
146153
147- - Some options are no longer available
154+ - Some options are deprecated
148155
149- - ` HepMC.fileName ` - use ` FileOrCmd.fileNames `
150- - ` HepMC.version ` - now the code itself figures out which format
151- version the input file is in.
156+ - ` HepMC.fileName ` - use ` GeneratorFileOrCmd.fileNames `
152157
153158The command line build will now be
154159
0 commit comments