Skip to content

Conversation

@yra242
Copy link
Contributor

@yra242 yra242 commented Jun 26, 2023

edm4hep.txt
lcio.txt
please, check output files

@bartosik-hep
Copy link
Collaborator

It looks suspicious that exactly the same particle is created in both output files, specifically the momentum [x,y,z] coordinates. @yra242 which exactly command-line options did you use when running the pgun_lcio.py and pgun_edm4hep.pyscripts? The script is designed to generate a particle with random polar angle, resulting in a different momentum vector each time. Try to run the script adding the -p 5 -e 2 option, to generate 2 events with 5 muon particles in each.

@yra242
Copy link
Contributor Author

yra242 commented Jun 27, 2023

it is not true because random has the same code "12345" in rng = np.random.default_rng(12345) it is the reason why result is the same

@yra242
Copy link
Contributor Author

yra242 commented Jun 27, 2023

I have an error when I use -e 2
but it is working with -e 1
I have investigated that if value more than 1, I have that error

@jmcarcell
Copy link

Can you paste here what error you get?

@yra242
Copy link
Contributor Author

yra242 commented Jun 27, 2023

Traceback (most recent call last):
  File "/afs/[cern.ch/work/y/ykhrabat/pgun/mucoll-benchmarks/generation/pgun/pgun_edm4hep.py](http://cern.ch/work/y/ykhrabat/pgun/mucoll-benchmarks/generation/pgun/pgun_edm4hep.py)", line 145, in <module>
    frame.put(cppyy.gbl.std.move(col), "MCParticles")
TypeError: Template method resolution failed:
  const edm4hep::MCParticleCollection& podio::Frame::put(edm4hep::MCParticleCollection&& coll, const string& name) =>
    invalid_argument: An object with key MCParticles already exists in the frame
  void podio::Frame::put(unique_ptr<podio::CollectionBase,default_delete<podio::CollectionBase> > coll, const string& name) =>
    TypeError: could not convert argument 1
  const edm4hep::MCParticleCollection& podio::Frame::put(edm4hep::MCParticleCollection&& coll, const string& name) =>
    ValueError: could not convert argument 1 (object is not an rvalue)
  Failed to instantiate "put(edm4hep::MCParticleCollection&,std::string)"
  Failed to instantiate "put(edm4hep::MCParticleCollection*,std::string)"
  const edm4hep::MCParticleCollection& podio::Frame::put(edm4hep::MCParticleCollection&& coll, const string& name) =>
    ValueError: could not convert argument 1 (object is not an rvalue)

@bartosik-hep
Copy link
Collaborator

it is not true because random has the same code "12345" in rng = np.random.default_rng(12345) it is the reason why result is the same

Good catch. Let's keep it for now for debugging, but then we can remove the 12345 argument, to make it actually random.

@bartosik-hep
Copy link
Collaborator

Concerning the -e 2 error, briefly looking at the code I see an inconsistency between two variables:

  • frame, which should represent a run from the old LCIO format, where we store global parameters;
  • evt, which should represent an event from the old LCIO format, where we store MCParticles collections.

You're adding MCParticles collection to the wrong frame, which is why it complaints once you reach the second iteration of the loop over events.

And then you only write the frame to the file, but never the evt. You should also check if you have the same issues in your other PR: MuonColliderSoft/detector-simulation#6

@yra242
Copy link
Contributor Author

yra242 commented Jun 28, 2023

I investigated the problem with lunching scripts with -e 2. I changed the output frame. I thing now it is working fine.

@jmcarcell
Copy link

Can you show the output so we can compare?

@yra242
Copy link
Contributor Author

yra242 commented Jun 29, 2023

edm4hep.txt

@bartosik-hep bartosik-hep merged commit 41f6395 into MuonColliderSoft:main Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants