Using HepMC3 as a generator for O2

Dear all,

I am trying to run o2sim with a file from hepmc3. I have a couple of questions about this
The command that I use for this is
o2-sim -j 5 -n 10 -g hepmc --configKeyValues "HepMC.fileName=JS_UPC.hepmc;HepMC.version=3;Diamond.position[2]=0.;Diamond.width[2]=0.0"

The hepmc file is filled with 2 electrons or 2 muons per event which I fill by doing

for(int i = 0; i < nEvents; i++){
  GenEvent evt(Units::GEV,Units::MM);
  GenParticlePtr p1 = std::make_shared<GenParticle>( FourVector( Px1, Py1, Pz1, E1), pdgid1, status1);
  GenParticlePtr p2 = std::make_shared<GenParticle>( FourVector( Px2, Py2, Pz2, E2), pdgid2, status2);
  evt.add_particle(p1);
  evt.add_particle(p2);
  output_file.write_event(evt);
}

in a seperate macro which reads the particles from a .root file.

Is this the correct way to do it?

The particles have to originate from 0., 0., 0.
How do I do this? Is it enough to set the interaction diamond to 0,0,0 with O2 as I did in the configKeyValues?

When accessed, the HepMC file looks like this for every event:
E 0 0 4
U GEV MM
P 1 0 -11 -1.2699084281921387e+00 -4.1446438431739807e-01 2.5651476383209229e+00 2.8921327590942383e+00 1.1610261048342575e-03 1
P 2 0 11 1.2312363386154175e+00 3.9473712444305420e-01 3.0055606365203857e-01 1.3274390697479248e+00 4.6642744074515039e-04 1

Which contains the following information in order:

  • P (particle)
  • The number of the particle
  • A 0? I don’t know what this is for
  • PDG code
  • Px
  • Py
  • Pz
  • E
  • Mass? But I entered only electrons in this example. Why is the mass not constant?
  • Status

For the GenEvent instance of HepMC3 I use “Units::MM” because I found this in an example (I suppose stands for millimeter?). Is this what I should use, or does O2 standard use other units (like cm or m)?

Any answer to these questions would be greatly appreciated!

Cheers,
Cas

Dear Casper,

the interaction diamond setup by the O2 scripts will add interaction vertex smearing accordingly.
the MC event generator is typically assumed to generate particles in (0,0,0) to have the vertex smearing taken care by the O2 to match the experimental conditions.
Use can do it differently if there is a good reason / control for that.
Generally, in the event generation have all vertices in (0,0,0) and set a diamond vertex for simulations.

if you are generating HepMC3 data files, make sure the O2 HepMC reader is instructed the data is HepMC v3. If the HepMC file is withing HepMC standards and the units are provided, the O2 HepMC reader should take care of unit conversion.

Best regards,
Robert o

1 Like