Backward compatibility broken
Hi,
When reading older HepMC::Version 2.06.09 files, one get different event structures back.
I attach a number of files to illustrate this
-
testHepMC.cc is a small program that either uses HepMC3 compatibility layer or HepMC2 directly. This should be compiled with
g++ tests/testHepMC.cc \ `HepMC3-config --cflags --libs` -lHepMC \ -Wl,-rpath,`HepMC3-config --libdir` -o testHepMC
or equivalent. The program accepts a few options:
$ ./testHepMC -h -d ARG Debug level (only HepMC3) 0 -h This help 1 -i ARG Input file event1.hepmc -n ARG Number of events (<0 means all) -1 -v ARG HepMC version (2 or 3) 2
-
event1.hepmc A single EPOS-LHC event generated via CRMC.
-
event2.hepmc A single Pythia(8) event
-
event1.out3, event1.out2, event2.out2, and event2.out3 are outputs of the above
testHepMC
program (see below).
Both data files have version HepMC::Version 2.06.09.
Reading event1.hepmc
with HepMC2 produces a single event with 120 particles.
$ ./testHepMC -v 2 -i event1.hepmc | tee event1.out2
________________________________________________________________________
GenEvent: #1
Momentum units: GEV Position units: CM
Entries in this event: 1 vertices, 120 particles, 0 weights.
...
However, reading the same file with the HepMC3 compatibility layer yields and empty event
$ ./testHepMC -v 3 -i event1.hepmc | tee event1.out3
________________________________________________________________________
GenEvent: #1
Momentum units: GEV Position units: CM
Entries in this event: 0 vertices, 0 particles, 0 weights.
The reason being, that the compatibility layer prunes the event for particles that are not attached to a production vertex. Since CRMC didn't set this information, we get back an empty event.
Consider the Pythia event in event2.hepmc
$ ./testHepMC -v 2 -i event2.hepmc | tee event2.out2
________________________________________________________________________
GenEvent: #1
Momentum units: GEV Position units: CM
Entries in this event: 90 vertices, 246 particles, 0 weights.
$ ./testHepMC -v 3 -i event2.hepmc | tee event2.out3
________________________________________________________________________
GenEvent: #1
Momentum units: GEV Position units: CM
Entries in this event: 89 vertices, 246 particles, 0 weights.
As is evident from the above, HepMC2 gives 90 vertices, while the compatibility layer of HepMC3 gives only 89. A closer inspection of the output likewise reveals more differences. For example, the first three verteces read by HepMC2 are
Vtx: -1 stat: 0 (X,cT): -0.0071 0.0024 0 0
O: 1 2212 +0.00e+00,+0.00e+00,+2.51e+03,+2.51e+03 4 -1
2 2212 +0.00e+00,+0.00e+00,-2.51e+03,+2.51e+03 4 -1
7 21 -1.30e+00,-4.89e-01,-2.37e+00,+2.74e+00 21 -1
8 1 +1.14e+00,+2.44e+00,-7.69e+01,+7.70e+01 21 -1
16 1 -2.63e-01,+5.46e-02,-1.67e+01,+1.67e+01 12 -1
17 -1 +2.63e-01,-5.46e-02,+8.68e+00,+8.69e+00 11 -1
24 21 -1.76e-01,-1.52e-01,-1.70e+02,+1.70e+02 12 -1
25 21 +1.76e-01,+1.52e-01,+3.87e+00,+3.87e+00 11 -1
Vtx: -2 stat: 0 (X,cT): -0.0071 0.0024 0 0
I: 1 2212 +0.00e+00,+0.00e+00,+2.51e+03,+2.51e+03 4 -1
O: 3 21 +2.67e-01,+9.02e-01,+7.94e+02,+7.94e+02 21 -2
15 2101 -3.82e-01,-3.01e-01,+1.34e+03,+1.34e+03 11 -2
18 2 +1.15e-01,-6.01e-01,+3.69e+02,+3.69e+02 12 -2
Vtx: -3 stat: 0 (X,cT): -0.0071 0.0024 0 0
I: 2 2212 +0.00e+00,+0.00e+00,-2.51e+03,+2.51e+03 4 -1
O: 4 1 -2.42e-01,+7.68e-01,-8.83e+01,+8.83e+01 21 -3
23 2203 +2.42e-01,-7.68e-01,-2.24e+03,+2.24e+03 11 -3
while the equivalent from the HepMC3 reader are the 2 first vertices
Vtx: -1 stat: 0 (X,cT): -0.0071 0.0024 0 0
I: 1 2212 +0.00e+00,+0.00e+00,+2.51e+03,+2.51e+03 4 0
O: 2 21 +2.67e-01,+9.02e-01,+7.94e+02,+7.94e+02 21 -1
3 2101 -3.82e-01,-3.01e-01,+1.34e+03,+1.34e+03 11 -1
4 2 +1.15e-01,-6.01e-01,+3.69e+02,+3.69e+02 12 -1
Vtx: -2 stat: 0 (X,cT): -0.0071 0.0024 0 0
I: 5 2212 +0.00e+00,+0.00e+00,-2.51e+03,+2.51e+03 4 0
O: 6 1 -2.42e-01,+7.68e-01,-8.83e+01,+8.83e+01 21 -2
7 2203 +2.42e-01,-7.68e-01,-2.24e+03,+2.24e+03 11 -2
In both cases (event1.hepmc
and event2.hepmc
) the output of the compatibility layer are not consistent with the old HepMC2 output. In the latter case (event2.hepmc
) the output of HepMC3 seems more correct, while in the first case (event1.hepmc
) it seems that HepMC2 is correct.
Thanks.
Yours,
Christian