Skip to content
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

parent daughter relations in DDG4 #307

Closed
gaede opened this issue Feb 8, 2018 · 11 comments · Fixed by #315
Closed

parent daughter relations in DDG4 #307

gaede opened this issue Feb 8, 2018 · 11 comments · Fixed by #315
Labels

Comments

@gaede
Copy link
Contributor

gaede commented Feb 8, 2018

The parent daughter relationships for MCParticles are broken after running DDG4 with DDSim.
When simulating for example ttbar events, we find many MCParticles with genStat==1 that have two parents. This seems to happen in particular with heavy meson decays, B->D->pi,K,.. where the grand-daughters are also falsely added to the grand-mother (the B).
@MarkusFrankATcernch any idea where and why this happens ?
If needed, I can provide example scripts to run for reproducing this problem.

@gaede gaede added the bug label Feb 8, 2018
@gaede
Copy link
Contributor Author

gaede commented Feb 12, 2018

@MarkusFrankATcernch any chance that you can have a look at this ? If confirmed, this would be a show stopper for our MC production ...
@andresailer could you check, if you observe the same problem with CLIC simulation ?

@petricm
Copy link

petricm commented Feb 12, 2018

Please give example/instruction to reproduce and maybe a dump of the MCParticles table to better illustrate.

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Feb 12, 2018

Heavy mesons are added to the particle list "late" ie. way after the original particle list is added.
I suspect, that this adding somehow must go wrong.

This is done inside Geant4, when the heavy mesons are decayed. Does anyone knows where and how this is actually done?

@gaede
Copy link
Contributor Author

gaede commented Feb 12, 2018

@MarkusFrankATcernch we use pre-assigned decays for heavy mesons, i.e. the decay particles are already in the generator input file. Geant4 might only update the kinematics according to field stepping, energy loss etc but not change the particles and their parent daughter relationships.
My suspicion is that this is a problem with the algorithm in DDG4 that decides which MCParticles to store and which not....

@gaede
Copy link
Contributor Author

gaede commented Feb 12, 2018

The problem can be reproduced for example with:

source /cvmfs/clicdp.cern.ch/iLCSoft/builds/2018-02-08/x86_64-slc6-gcc62-opt/init_ilcsoft.sh 
git clone https://github.com/iLCSoft/ILDConfig.git
cd ILDConfig/StandardConfig/production
ddsim   --inputFiles Examples/bbudsc_3evt/bbudsc_3evt.stdhep   --outputFile bbudsc_3evt_SIM.slcio   --compactFile $lcgeo_DIR/ILD/compact/ILD_l5_v02/ILD_l5_v02.xml   --steeringFile ddsim_steer.py --numberOfEvents 1
wget http://www.desy.de/~/gaede/lcio_dumpmcpparents.py 
python lcio_dumpmcpparents.py bbudsc_3evt_SIM.slcio

This lists all particles with generator status ==1 and more than one parent, which should never happen.
For example:

Ooooops :  found stable particle with  2  parents - pdg:  22  id:  46990
        parent:  0 pdg:  -431 id= 46870  has daughters: 
                         0 pdg:  331 id= 46942
                         1 pdg:  -213 id= 46943
                         2 pdg:  22 id= 46990
                         3 pdg:  -211 id= 46992
                         4 pdg:  111 id= 46993
                         5 pdg:  211 id= 47006
                         6 pdg:  -211 id= 47007
        parent:  1 pdg:  331 id= 46942  has daughters: 
                         0 pdg:  22 id= 46990
                         1 pdg:  113 id= 46991

You can also use dumpevent and scroll down the MCParticle collection to look for particle with more than one parent.

dumpevent bbudsc_3evt_SIM.slcio 1 | less

@andresailer
Copy link
Member

The problem is most likely in the "rebaseSimulatedTracks function in the Geant4ParticleHandler

ParticleHandler  INFO  +++ Particle ID:      172          Ds-    153/0          YES YES     2 YES +4.939e+04  NO   NO      NO       1  [Primary] ..D. -- .....t.
ParticleHandler  INFO  +++ Recombined ID:    172          Ds-    153/0          YES YES     2 YES +4.939e+04  NO   NO      NO       1  [Primary] ..D. -- .....t.
ParticleHandler  INFO  +++ Rebased ID:       172          Ds-    153/0          YES YES     7 YES +4.939e+04  NO   NO      NO       1  [Primary] ..D. -- .....t.

The number after the YES YES columns is the number of daughters which goes from 2 to 7 after the above mentioned function was called

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Feb 13, 2018

Are we really sure the input record is properly entered?
If I look at these 3 records all from the same parent (48049), it looks to me like the
list of primary daughters is wrong.
e.g.

                         2 pdg:  22 id= 48108
                         3 pdg:  22 id= 48109
                         4 pdg:  211 id= 48110
                         5 pdg:  111 id= 48111

should NOT be daughters of 48049, but rather of 48094 and 48095.
(Actually in the printout one particle seems to be missing: 48111 should also have 2 parents!)

 Ooooops :  found stable particle with  2  parents - pdg:  22  id:  48108
        parent:  0 pdg:  431 id= 48049  has daughters: 
                         0 pdg:  221 id= 48094
                         1 pdg:  213 id= 48095
                         2 pdg:  22 id= 48108
                         3 pdg:  22 id= 48109
                         4 pdg:  211 id= 48110
                         5 pdg:  111 id= 48111
        parent:  1 pdg:  221 id= 48094  has daughters: 
                         0 pdg:  22 id= 48108
                         1 pdg:  22 id= 48109
 Ooooops :  found stable particle with  2  parents - pdg:  22  id:  48109
        parent:  0 pdg:  431 id= 48049  has daughters: 
                         0 pdg:  221 id= 48094
                         1 pdg:  213 id= 48095
                         2 pdg:  22 id= 48108
                         3 pdg:  22 id= 48109
                         4 pdg:  211 id= 48110
                         5 pdg:  111 id= 48111
        parent:  1 pdg:  221 id= 48094  has daughters: 
                         0 pdg:  22 id= 48108
                         1 pdg:  22 id= 48109
 Ooooops :  found stable particle with  2  parents - pdg:  211  id:  48110
        parent:  0 pdg:  431 id= 48049  has daughters: 
                         0 pdg:  221 id= 48094
                         1 pdg:  213 id= 48095
                         2 pdg:  22 id= 48108
                         3 pdg:  22 id= 48109
                         4 pdg:  211 id= 48110
                         5 pdg:  111 id= 48111
        parent:  1 pdg:  213 id= 48095  has daughters: 
                         0 pdg:  211 id= 48110
                         1 pdg:  111 id= 48111

@gaede
Copy link
Contributor Author

gaede commented Feb 13, 2018

The input generator file is correct, i.e. it does not have any particles with more than one parent (except for some 92 string objects but never for 'real' particles).
What seems to happen is that (in some cases ?) granddaughters are also added to their grandparents as daughters.
Whether this happens when we prepare the particles for Geant4 or after Geant4 is done with the simulation (as pointed out by @andresailer) I don't know.
I have updated the python script (http://www.desy.de/~/gaede/lcio_dumpmcpparents.py ) to print the indices in the collection rather than the internal runtime dependant id of the particles. With this you can compare more easily to the dump from dumpevent.

With this we get sth like:

 Ooooops :  found stable particle with  2  parents - pdg:  22  id:  292
        parent:  0 pdg:  -431 id= 172  has daughters: 
                         0 pdg:  331 id= 244
                         1 pdg:  -213 id= 245
                         2 pdg:  22 id= 292
                         3 pdg:  -211 id= 294
                         4 pdg:  111 id= 295
                         5 pdg:  211 id= 308
                         6 pdg:  -211 id= 309
        parent:  1 pdg:  331 id= 244  has daughters: 
                         0 pdg:  22 id= 292
                         1 pdg:  113 id= 293
 Ooooops :  found stable particle with  2  parents - pdg:  -211  id:  294
        parent:  0 pdg:  -431 id= 172  has daughters: 
                         0 pdg:  331 id= 244
                         1 pdg:  -213 id= 245
                         2 pdg:  22 id= 292
                         3 pdg:  -211 id= 294
                         4 pdg:  111 id= 295
                         5 pdg:  211 id= 308
                         6 pdg:  -211 id= 309
        parent:  1 pdg:  -213 id= 245  has daughters: 
                         0 pdg:  -211 id= 294
                         1 pdg:  111 id= 295
 Ooooops :  found stable particle with  2  parents - pdg:  211  id:  297
        parent:  0 pdg:  -511 id= 173  has daughters: 
                         0 pdg:  413 id= 246
                         1 pdg:  111 id= 247
                         2 pdg:  -321 id= 248
                         3 pdg:  323 id= 249
                         4 pdg:  -211 id= 250
                         5 pdg:  421 id= 296
                         6 pdg:  211 id= 297
                         7 pdg:  211 id= 301
                         8 pdg:  130 id= 315
        parent:  1 pdg:  413 id= 246  has daughters: 
                         0 pdg:  421 id= 296
                         1 pdg:  211 id= 297

corresponding lines from dumpevent:

[00000176]  172|      -431|-3.41e+01, 2.80e+01,-2.21e+01|-3.41e+01, 2.80e+01,-2.21e+01| 4.94e+01| 2 |[   t    ]| 0.00e+00, 0.00e+00, 0.00e+00|-6.28e-01, 5.15e-01,-4.06e-01| 1.97e+00|-1.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [153] - [244,245,292,294,295,308,309]

[00000248]  244|       331|-1.26e+01, 9.89e+00,-8.10e+00| 0.00e+00, 0.00e+00, 0.00e+00| 1.80e+01| 2 |[  v     ]|-6.27e-01, 5.15e-01,-4.06e-01|-6.33e-01, 5.15e-01,-4.06e-01| 9.58e-01| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [172] - [292,293]

[00000296]  292|        22|-3.15e+00, 2.53e+00,-1.94e+00|-0.00e+00, 0.00e+00,-0.00e+00| 4.49e+00| 1 |[    c s ]|-6.28e-01, 5.15e-01,-4.06e-01|-1.42e+03, 1.14e+03,-8.77e+02| 0.00e+00| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [172,244] - []

So here a D+s (172) decays to an eta' ( 244 ) + sth, and the eta'(244) decays to a photon (292) and a rho. The photon (292) lists its correct parent the eta' but also its grandmother the D+s (172) as parents.

PS: The 48111 in the above example is a pi0 ( here 292) with gen stat==2 and thus not listed in my script - but of course has the same problem ....

@MarkusFrankATcernch
Copy link
Contributor

MarkusFrankATcernch commented Feb 14, 2018

We should think of defining a couple of consistency checks to verify the MC truth records on demand.
Even if we do not immediately implement them, at least we should have some work-list about things to be done on the long term.

The issue is non trivial and may be - depending on the situation - error prone. Hence, such checks are quite vital.

@petricm
Copy link

petricm commented Feb 14, 2018

Every issue that has a tag enhancement is a feature that needs to be implemented and every issue with work in progress is something that we might need to discuss and take action or requires some minor fix, but does not represent new functionality.

@andresailer
Copy link
Member

I think #310 only fixed the symptom, but not the underlying issue. Look at the Vertex and Endpoint of the Particles from @gaede comment above:

[00000176]  172|      -431|-3.41e+01, 2.80e+01,-2.21e+01|-3.41e+01, 2.80e+01,-2.21e+01| 4.94e+01| 2 |[   t    ]| 0.00e+00, 0.00e+00, 0.00e+00|-6.28e-01, 5.15e-01,-4.06e-01| 1.97e+00|-1.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [153] - [244,245,292,294,295,308,309]

[00000248]  244|       331|-1.26e+01, 9.89e+00,-8.10e+00| 0.00e+00, 0.00e+00, 0.00e+00| 1.80e+01| 2 |[  v     ]|-6.27e-01, 5.15e-01,-4.06e-01|-6.33e-01, 5.15e-01,-4.06e-01| 9.58e-01| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [172] - [292,293]

[00000296]  292|        22|-3.15e+00, 2.53e+00,-1.94e+00|-0.00e+00, 0.00e+00,-0.00e+00| 4.49e+00| 1 |[    c s ]|-6.28e-01, 5.15e-01,-4.06e-01|-1.42e+03, 1.14e+03,-8.77e+02| 0.00e+00| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [172,244] - []

Focus on the X positions:

ID StartX EndX
172 0e0 -6.28e-01
244 -6.27e-01
292 -6.28e-01 -1.42e+03

Notice how the Start of 244 does not correspond to the end of 172, and the end of 244 does not correspond to the beginning of 292. However, the beginning of 292 does correspond to the end of 172. This is caused by the check for non-zero lifetime:

bool isProperTimeZero = ( proper_time <= proper_time_Precision ) ;
// -- remove original --- if (proper_time != 0) {
if ( !isProperTimeZero ) {

That means 244 is never actually passed on to geant to be simulated (and then immediately decayed), instead all the daughters of 244 are assigned to 172. Because 244 is not passed to geant its vertex and endpoint are not changed to the actual positions from the simulation. -6.33e-01 is the value in the stdhep file (I don't understand where its vertex position comes from at this point).

This can be seen when dumping the pre-assigned decays from the geant4 vertex
Here the Ds- has 5 daughters, none of which are the etaPrime (244)

==== PDGcode -431  Particle name Ds-
 Assigned charge : -1
     Momentum ( -34.114[GeV/c], 27.9986[GeV/c], -22.0834[GeV/c] )
     kinetic Energy : 47.4201 [GeV]
     Mass : 1.9685 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
     PreAssigned proper decay time : 0.000120708 [ns] 
>>>> Daughters
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -3.15321[GeV/c], 2.53054[GeV/c], -1.94457[GeV/c] )
     kinetic Energy : 4.48639 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 211  Particle name pi+
 Assigned charge : 1
     Momentum ( -7.04098[GeV/c], 5.52056[GeV/c], -4.95525[GeV/c] )
     kinetic Energy : 10.0891 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode -211  Particle name pi-
 Assigned charge : -1
     Momentum ( -2.39384[GeV/c], 1.83911[GeV/c], -1.19934[GeV/c] )
     kinetic Energy : 3.1117 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode -211  Particle name pi-
 Assigned charge : -1
     Momentum ( -2.09818[GeV/c], 1.69031[GeV/c], -1.17513[GeV/c] )
     kinetic Energy : 2.80321 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 111  Particle name pi0
 Assigned charge : 0
     Momentum ( -19.4277[GeV/c], 16.418[GeV/c], -12.809[GeV/c] )
     kinetic Energy : 28.3444 [GeV]
     Mass : 0.13498 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
     PreAssigned proper decay time : 2.88158e-08 [ns] 
>>>> Daughters
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -8.90325[GeV/c], 7.55909[GeV/c], -5.81242[GeV/c] )
     kinetic Energy : 13.0458 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -10.5244[GeV/c], 8.85888[GeV/c], -6.99656[GeV/c] )
     kinetic Energy : 15.4336 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
<<<< End of link
<<<< End of link

Following some hacks to replace the isProperTimeZero to just ignore quarks, gluons and "strings" I can pass all particles to geant4

==== PDGcode -431  Particle name Ds-
 Assigned charge : -1
     Momentum ( -34.114[GeV/c], 27.9986[GeV/c], -22.0834[GeV/c] )
     kinetic Energy : 47.4201 [GeV]
     Mass : 1.9685 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
     PreAssigned proper decay time : 0.000120708 [ns] 
>>>> Daughters
==== PDGcode 331  Particle name eta_prime
 Assigned charge : 0
     Momentum ( -12.5883[GeV/c], 9.89042[GeV/c], -8.09932[GeV/c] )
     kinetic Energy : 17.0085 [GeV]
     Mass : 0.958164 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
>>>> Daughters
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -3.15321[GeV/c], 2.53054[GeV/c], -1.94457[GeV/c] )
     kinetic Energy : 4.48639 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 113  Particle name rho0
 Assigned charge : 0
     Momentum ( -9.45502[GeV/c], 7.37544[GeV/c], -6.16777[GeV/c] )
     kinetic Energy : 12.7029 [GeV]
     Mass : 0.805805 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
>>>> Daughters
==== PDGcode 211  Particle name pi+
 Assigned charge : 1
     Momentum ( -7.04098[GeV/c], 5.52056[GeV/c], -4.95525[GeV/c] )
     kinetic Energy : 10.0891 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode -211  Particle name pi-
 Assigned charge : -1
     Momentum ( -2.39384[GeV/c], 1.83911[GeV/c], -1.19934[GeV/c] )
     kinetic Energy : 3.1117 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
<<<< End of link
<<<< End of link
==== PDGcode -213  Particle name rho-
 Assigned charge : -1
     Momentum ( -21.4899[GeV/c], 18.078[GeV/c], -13.9607[GeV/c] )
     kinetic Energy : 30.6476 [GeV]
     Mass : 0.722017 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
>>>> Daughters
==== PDGcode -211  Particle name pi-
 Assigned charge : -1
     Momentum ( -2.09818[GeV/c], 1.69031[GeV/c], -1.17513[GeV/c] )
     kinetic Energy : 2.80321 [GeV]
     Mass : 0.13957 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 111  Particle name pi0
 Assigned charge : 0
     Momentum ( -19.4277[GeV/c], 16.418[GeV/c], -12.809[GeV/c] )
     kinetic Energy : 28.3444 [GeV]
     Mass : 0.13498 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
     PreAssigned proper decay time : 2.88158e-08 [ns] 
>>>> Daughters
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -8.90325[GeV/c], 7.55909[GeV/c], -5.81242[GeV/c] )
     kinetic Energy : 13.0458 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
==== PDGcode 22  Particle name gamma
 Assigned charge : 0
     Momentum ( -10.5244[GeV/c], 8.85888[GeV/c], -6.99656[GeV/c] )
     kinetic Energy : 15.4336 [GeV]
     Mass : 0 [GeV]
     Polarization ( 0, 0, 0 )
     Weight : 1
<<<< End of link
<<<< End of link
<<<< End of link
<<<< End of link

Then I also get the correct positions for vertex and endpoints of particles and the correct parent daughter relationships, even without the changes from #310.

[00000176]  172|      -431|-3.41e+01, 2.80e+01,-2.21e+01|-3.41e+01, 2.80e+01,-2.21e+01| 4.94e+01| 2 |[   t    ]| 0.00e+00, 0.00e+00, 0.00e+00|-6.28e-01, 5.15e-01,-4.06e-01| 1.97e+00|-1.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [153] - [244,245]
[00000248]  244|       331|-1.26e+01, 9.89e+00,-8.10e+00|-1.26e+01, 9.89e+00,-8.10e+00| 1.80e+01| 2 |[   t    ]|-6.28e-01, 5.15e-01,-4.06e-01|-6.28e-01, 5.15e-01,-4.06e-01| 9.58e-01| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [172] - [292,293]
[00000296]  292|        22|-3.15e+00, 2.53e+00,-1.94e+00|-0.00e+00, 0.00e+00,-0.00e+00| 4.49e+00| 1 |[    c s ]|-6.28e-01, 5.15e-01,-4.06e-01|-1.42e+03, 1.14e+03,-8.75e+02| 0.00e+00| 0.00e+00| 0.00e+00, 0.00e+00, 0.00e+00|  (0, 0)   | [244] - []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants