-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Final state particles in HepMC are forced to vertex 0,0,0 #1013
Comments
Hi @kkauder, As far as I can tell it already goes wrong here DD4hep/DDG4/hepmc/HepMC3EventReader.cpp Lines 132 to 142 in cc4c4c5
I tried printing also auto pos = hepevt.event_pos();
auto* g4vtx = new G4PrimaryVertex(pos.x()*mm, pos.y()*mm, pos.z()*mm, 0); But that also gives me 0 0 0. There is nothing in dd4hep that manipulates the genEvent, so the information is not (yet) in the |
That part shouldn't be the one that matters. It only kicks in for parent-less particles, i.e. the first virtual gamma. I care about the one that does have a parent, and thus a proper production vertex. |
What about the |
Good question, I don't think event_pos() is quite appropriate for this fragment of an event. I'd probably define that as the vertex where the beam particles meet. |
What does HepMC define as the |
I have to admit I don't know. The way I described it in the comments, event_pos() should have picked up the only vertex in the event, not 0, 0, 0 |
From https://gitlab.cern.ch/hepmc/HepMC3/-/blob/master/src/GenEvent.cc
Default ctor sets it to 0. Lookin g further, it seems to be a strange beast that is not written out. Can be manipulated with That said, assuming I'd create the event by using this root vertex, that would mean |
|
After discussing in person with @andresailer, his proposed solution works!
|
I'm working on putting this into a PR but there's a snag. If a particle has no parent and no end vertex (such as a particle gun),
the code doesn't break but also doesn't do the right thing, instead falling back to 0,0,0 again. |
We are trying to originate particles from a specific vertex (for background studies). Since HepMC needs an incoming particle in every vertex, we set this minimal test up like so:
g (13) g(1)
----> v --->
All particles are gammas, the number in parentheses is their status. 13 is arbitrary to signify "virtual", anything above 10 is ok for HepMC. v is at (30,0,100,100). In the example below I add a second out-going gamma with status 13 to demonstrate that it has the correct vertex.
Make an input file
Then run with
Result:
Both out-going particles, but especially the final one that I actually care about, should start from the vertex. I.e.
Notes:
https://github.com/eic/east/blob/main/PrimGenInterface/src/eASTHepMC3Interface.cc
I'll be happy to help if you point me in the right direction
The text was updated successfully, but these errors were encountered: