Closed saraheno closed 1 year ago
Which version of dd4hep are you using? To make sure you have this fix #949
I pulled it from the hub just a few days ago, so I should have this fix.
I think my problem is that the electron is producing optical photons in the air before it reaches my detector, and so the first particle doesn't get "marked" to be saved in the MCparticles folder? Maybe I need some way to ensure it is marked right at the start? I think I know that this line https://github.com/saraheno/SingleDualCrystal/blob/565d4e7bc096620106ceaabd20e49af5b6758c55/src/DualCrystalCalorimeterSDAction.cpp#L256 is what puts particles into the MCparticles folder once it reaches my detector?
This is somehow related to the Cerenkov and Scintillation physics treatment. When I change to
scint.TrackSecondariesFirst = False
cerenkov.TrackSecondariesFirst = False
I get the primary energy of the electrons in the root output files. Somehow treating the optical photons before the electron is finished causes its values to be changed.
Is there someway/places I can access the particle just as first read from the gun, and force it to be stored in MCParticles?
I hope we can find a general solution to this problem.
Please try with the change from #1046
Hi, Perhaps I have a misunderstanding about what is supposed to be in the MCParticles folder. I am running single particles and I want to get the energy of the incident particle. I thought that would be the first particle in this folder, and that seems to work when I run muons. But when I run electrons, there is usually no particle in the list that corresponds to the gun energy.
I am running https://github.com/saraheno/SingleDualCrystal with the command
ddsim --compactFile=./DRSingleCrystal.xml --runType=batch -G --steeringFile SCEPCALsteering.py --outputFile=out.root --part.userParticleHandler='' -G --gun.position="0.,30.,0." --gun.direction "0 -1 0" --gun.energy "10*GeV" --gun.particle="e-" -N 5
and am looking at MCParticles in out.root
(the actually code I use to look at out.root is https://github.com/saraheno/SingleDualCrystal/blob/main/compact/CrystalAna.C
Should I not expect to find the initial gun particle in this list? If not, is there any thing I can add to get this information into the output root file or do I need to code this myself?
thanks Sarah Eno