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

MCTruth link broken in multisegmentation/collection simulation #141

Closed
gaede opened this Issue Mar 31, 2017 · 9 comments

Comments

Projects
None yet
2 participants
@gaede
Contributor

gaede commented Mar 31, 2017

The MCTruth link for the simulated hits seems to be broken when simulating with two different segmentations and collections.
The example we used is defined here:
https://github.com/iLCSoft/lcgeo/blob/master/ILD/compact/ILD_o4_v01/HCalBarrel_o4_v01_01.xml#L25-L40
This nicely produces two collections with different segmentations from the same shower.

However, when visualizing the Hcal barrel hits - color-coded by particle we get:
pion_multisegcol
whereas from a normal simulation it looks like this:
pion_ahcal

Are we missing something in the configuration (definition of the sensitive Actions) - or is this a bug ?

@MarkusFrankATcernch

This comment has been minimized.

Contributor

MarkusFrankATcernch commented Mar 31, 2017

Difficult to say if this is a bug or a feature.....
Can this be reproduced using only stuff from DDDetectors - ie without lcgeo?
Then I could debug it....

@gaede

This comment has been minimized.

Contributor

gaede commented Mar 31, 2017

I knew that you were going to say this ;-)
Can you remind me of what the easiest way is to run a simulation in python w/o the ddsim script from lcgeo ?

@MarkusFrankATcernch

This comment has been minimized.

Contributor

MarkusFrankATcernch commented Mar 31, 2017

Examples are here:
examples/ClientTests/scripts and
examples/CLICSiD/scripts/CLICSid.py

You should be able to do it simply in python.

@gaede

This comment has been minimized.

Contributor

gaede commented Mar 31, 2017

Could you also try and run our actual code on lxplus ( and also debug it there) ?

  • init iLCSoft

  • copy a steering file

      mkdir testdir ; cd testdir
      . /cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc62-opt/init_ilcsoft.sh 
      cp $lcgeo_DIR/example/steeringFile.py  .
    
  • add the following line to the steering file to simulate a single pion

      SIM.gun.particle = "pi+"
    
  • run the simulation with a 'normal' ILD simulation:

      ddsim --steeringFile=./steeringFile.py --compactFile=/cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc62-opt/lcgeo/HEAD/ILD/compact/ILD_o1_v05/ILD_o1_v05.xml --outputFile=sim_o1_v05.slcio
    
  • and then run it with the multiple segmentation model:

      ddsim --steeringFile=./steeringFile.py --compactFile=/cvmfs/clicdp.cern.ch/iLCSoft/builds/nightly/x86_64-slc6-gcc62-opt/lcgeo/HEAD/ILD/compact/ILD_o4_v01/ILD_o4_v01.xml --outputFile=sim_o4_v01.slcio
    
  • you can look at the first event for each output file with

      dumpevent sim_o1_v05.slcio 1 | less
      dumpevent sim_o4_v01.slcio 1 | less
    
  • in the first case - greping for 'HcalB' we get sth. like:

 collection name : HcalBarrelRegCollection
 parameters: 

--------------- print out of SimCalorimeterHit collection --------------- 

  flag:  0xa0000000
 parameter CellIDEncoding [string]: system:0:5,module:5:3,stave:8:4,tower:12:5,layer:17:6,x:32:-16,y:48:-16, 
  -> LCIO::CHBIT_LONG   : 1
     LCIO::CHBIT_BARREL : 0
     LCIO::CHBIT_ID1    : 1
     LCIO::CHBIT_STEP   : 0

 [   id   ] |cellId0 |cellId1 |  energy  |        position (x,y,z)          | nMCParticles 
           -> MC contribution: prim. PDG |  energy  |   time   | sec. PDG | stepPosition (x,y,z) 
------------|--------|--------|----------|----------------------------------|--------------
 [00000079] |00660054|00917499|+1.293e-02|+1.770e+03, +1.321e+03, +1.577e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:5,x:-5,y:13)
           ->                        +211|+1.293e-02|+2.677e+01| no PDG
 [00000080] |00528982|00917502|+1.349e-05|+1.811e+03, +1.243e+03, +1.577e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:4,x:-2,y:13)
           ->                        +211|+1.349e-05|+1.408e+02| no PDG
 [00000081] |00528982|00851967|+7.734e-07|+1.832e+03, +1.221e+03, +1.546e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:4,x:-1,y:12)
           ->                        +211|+7.734e-07|+2.501e+02| no PDG
 [00000082] |00266838|00786423|+6.255e-05|+1.606e+03, +1.372e+03, +1.516e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:2,x:-9,y:11)
           ->                        +211|+6.255e-05|+6.018e+01| no PDG
 [00000083] |00266838|00851959|+9.147e-08|+1.606e+03, +1.372e+03, +1.546e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:2,x:-9,y:12)
           ->                        +211|+9.147e-08|+2.529e+02| no PDG
 [00000084] |00397910|00720886|+2.955e-09|+1.608e+03, +1.408e+03, +1.486e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:3,x:-10,y:10)
           ->                        +211|+2.955e-09|+7.115e+03| no PDG
 [00000085] |00922198|00851965|+9.680e-05|+1.847e+03, +1.319e+03, +1.546e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:7,x:-3,y:12)
           ->                        +211|+9.680e-05|+1.811e+01| no PDG
 [00000086] |00922198|00917500|+3.261e-03|+1.826e+03, +1.340e+03, +1.577e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:7,x:-4,y:13)
           ->                        +211|+3.261e-03|+8.806e+01| no PDG
 [00000087] |00791126|00786428|+1.945e-03|+1.803e+03, +1.325e+03, +1.516e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:6,x:-4,y:11)
           ->                        +211|+1.945e-03|+3.745e+02| no PDG
 [00000088] |00791126|00786427|+1.034e-07|+1.782e+03, +1.346e+03, +1.516e+03|          +1
        id-fields: (system:22,module:2,stave:2,tower:1,layer:6,x:-5,y:11)
           ->                        +211|+1.034e-07|+3.871e+02| no PDG
 [00000089] |00791126|00851965|+1.034e-07|+1.824e+03, +1.304e+03, +1.546e+03|          +1
:

  • => all hits are form a pion - actually the one pion that we simulated ( not directly visible form this)

  • looking into the other file - grep for 'Sci' we see:

 collection name : HCalBarrelSciHits
 parameters: 

--------------- print out of SimCalorimeterHit collection --------------- 

  flag:  0xa0000000
 parameter CellIDEncoding [string]: system:0:5,barrel:5:2,module:7:4,stave:11:6,layer:17:6,slice:23:4,x:32:-16,y:48:-16, 
  -> LCIO::CHBIT_LONG   : 1
     LCIO::CHBIT_BARREL : 0
     LCIO::CHBIT_ID1    : 1
     LCIO::CHBIT_STEP   : 0

 [   id   ] |cellId0 |cellId1 |  energy  |        position (x,y,z)          | nMCParticles 
           -> MC contribution: prim. PDG |  energy  |   time   | sec. PDG | stepPosition (x,y,z) 
------------|--------|--------|----------|----------------------------------|--------------
 [00000106] |50463626|03342327|+8.834e-04|+1.663e+03, +1.281e+03, +1.500e+03|          +2
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:1,slice:6,x:-9,y:50)
           ->                        +211|+8.151e-04|+8.618e+00| no PDG
           ->                       +2112|+6.833e-05|+1.020e+01| no PDG
 [00000107] |50725770|03211256|+5.780e-06|+1.679e+03, +1.340e+03, +1.440e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:3,slice:6,x:-8,y:48)
           ->                       +2112|+5.780e-06|+3.585e+01| no PDG
 [00000108] |50856842|03276792|+1.728e-07|+1.698e+03, +1.359e+03, +1.470e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:4,slice:6,x:-8,y:49)
           ->                       +2112|+1.728e-07|+2.788e+02| no PDG
 [00000109] |50987914|03342329|+2.180e-10|+1.696e+03, +1.399e+03, +1.500e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:5,slice:6,x:-7,y:50)
           ->                       +2112|+2.180e-10|+2.395e+03| no PDG
 [00000110] |51118986|03211257|+1.679e-09|+1.714e+03, +1.417e+03, +1.440e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:6,slice:6,x:-7,y:48)
           ->                       +2112|+1.679e-09|+6.619e+03| no PDG
 [00000111] |50725770|03407866|+1.176e-04|+1.637e+03, +1.382e+03, +1.530e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:3,slice:6,x:-6,y:51)
           ->                       +2112|+1.176e-04|+1.834e+01| no PDG
 [00000112] |50725770|03342330|+5.698e-05|+1.637e+03, +1.382e+03, +1.500e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:3,slice:6,x:-6,y:50)
           ->                       +2112|+5.698e-05|+4.384e+01| no PDG
 [00000113] |50725770|03342329|+4.781e-05|+1.658e+03, +1.361e+03, +1.500e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:3,slice:6,x:-7,y:50)
           ->                       +2112|+4.781e-05|+4.480e+01| no PDG
 [00000114] |50594698|03407866|+1.123e-05|+1.618e+03, +1.364e+03, +1.530e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:2,slice:6,x:-6,y:51)
           ->                       +2112|+1.123e-05|+8.520e+01| no PDG
 [00000115] |50987914|03276794|+4.495e-05|+1.674e+03, +1.420e+03, +1.470e+03|          +1
        id-fields: (system:10,barrel:0,module:7,stave:0,layer:5,slice:6,x:-6,y:49)
           ->                       +2112|+4.495e-05|+4.952e+01| no PDG
:
  • => all hits are from different particles other than the one pion we simulated
@MarkusFrankATcernch

This comment has been minimized.

Contributor

MarkusFrankATcernch commented Mar 31, 2017

Is there some data pattern in the hits I can trigger the debugger on?

@gaede

This comment has been minimized.

Contributor

gaede commented Mar 31, 2017

ILD_o4_v01.xml has nothing but the Hcal barrel with the two readouts - so every hit that gets created is one that needs debugging.

@MarkusFrankATcernch

This comment has been minimized.

Contributor

MarkusFrankATcernch commented Mar 31, 2017

Hallo Frank,

I think the problem is not in the truth handler, but somewhere in the lcio output writer.
If I look at the raw data from a gun shooting 50 GeV pi- I get:

First the gun:

Gun              INFO  Particle [0] pi- 50.000 GeV direction:( 0.141  0.426  0.894)
Gun              INFO  Shoot [2] 50.000 GeV pi- pos:(0.000 0.000 0.000)[mm] dir:( 0.141  0.426  0.894)
Gun              INFO  +-> Interaction [0] 50.000 GeV pi- pos:(0.000 0.000 0.000)[mm]
Gun              INFO  +++   +-> ID:  0 pi-          status:00000002 PDG:  -211 Vtx:(+0.00e+00,+0.00e+00,+0.00e+00)[mm] time: +0.00e+00 [ns] #Dau:  0 #Par:0      
Gun              INFO  +++++ G4PrimaryVertex at (+0.00e+00,+0.00e+00,+0.00e+00) [mm] +0.00e+00 [ns]
ParticleHandler  INFO  +++ Event 2 Begin event action. Access event related information.

This leaves us with the reduced particle set (2 tracks) after the MC truth handling:

ParticleDump           +++ Geant4 Particle map                    --------------- Track KEEP reasoning ---------------
ParticleDump           +++ # of Tracks:     2          PDG Parent Primary Secondary Energy in [MeV] Calo Tracker Process/Par
ParticleDump              +++ TrackID:      0         -211     -1 YES     YES     1    YES    5e+04 YES  NO      NO         
ParticleDump              +++ TrackID:      1           11      0 NO      YES     0    YES     2.64 YES  NO      NO         

During the simulation however, there were many more tracks in use

Note: RawDump.
Watch out for TrackID, this is the Geant4 track ID during the simulation phase.

RawDump                +++ Hit Collection: TestCallInnerLayerHits  # Calorimeter hits 1
RawDump                   +++ Hit: Cell: 03B9013C0008090D Pos:(      316,      953,    2e+03) [mm] E:    0.165 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.165 MeV      7.47 ns
RawDump                +++ Hit Collection: TestCallMiddleLayerHits  # Calorimeter hits 2
RawDump                   +++ Hit: Cell: 03BA013D0038190D Pos:(      317,      954,    2e+03) [mm] E:    0.227 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.227 MeV      7.47 ns
RawDump                   +++ Hit: Cell: 01DD009E0068290D Pos:(      316,      954,    2e+03) [mm] E:    0.425 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.425 MeV      7.48 ns
RawDump                +++ Hit Collection: TestCallOuterLayerHits  # Calorimeter hits 8
RawDump                   +++ Hit: Cell: 013E006A0098390D Pos:(      318,      954,    2e+03) [mm] E:    0.209 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.209 MeV      7.48 ns
RawDump                   +++ Hit: Cell: 013F006A00C8490D Pos:(      318,      957, 2.01e+03) [mm] E:    0.229 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.229 MeV      7.49 ns
RawDump                   +++ Hit: Cell: 013F006A00F8590D Pos:(      318,      957, 2.01e+03) [mm] E:    0.242 MeV #Contributions:  3
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211      0.16 MeV      7.49 ns
RawDump                       Contribution #  1 TrackID:     1 PDG:        -211    0.0375 MeV      7.49 ns
RawDump                       Contribution #  2 TrackID:    22 PDG:          11     0.045 MeV      7.49 ns
RawDump                   +++ Hit: Cell: 013F006A0128690D Pos:(      318,      957, 2.01e+03) [mm] E:    0.616 MeV #Contributions:  3
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.247 MeV       7.5 ns
RawDump                       Contribution #  1 TrackID:    22 PDG:          11     0.266 MeV       7.5 ns
RawDump                       Contribution #  2 TrackID:    22 PDG:          11     0.103 MeV       7.5 ns
RawDump                   +++ Hit: Cell: 013F006A0158790D Pos:(      318,      957, 2.01e+03) [mm] E:    0.325 MeV #Contributions:  2
RawDump                       Contribution #  0 TrackID:     1 PDG:        -211     0.189 MeV       7.5 ns
RawDump                       Contribution #  1 TrackID:    22 PDG:          11     0.135 MeV       7.5 ns
RawDump                   +++ Hit: Cell: 013E006A0158790D Pos:(      318,      954, 2.01e+03) [mm] E:     1.11 MeV #Contributions: 20
RawDump                       Contribution #  0 TrackID:    22 PDG:          11    0.0998 MeV       7.5 ns
RawDump                       Contribution #  1 TrackID:    22 PDG:          11    0.0792 MeV       7.5 ns
RawDump                       Contribution #  2 TrackID:    22 PDG:          11    0.0417 MeV       7.5 ns
RawDump                       Contribution #  3 TrackID:    22 PDG:          11    0.0904 MeV      7.51 ns
RawDump                       Contribution #  4 TrackID:    22 PDG:          11     0.129 MeV      7.51 ns
RawDump                       Contribution #  5 TrackID:    22 PDG:          11    0.0973 MeV      7.51 ns
RawDump                       Contribution #  6 TrackID:    22 PDG:          11    0.0511 MeV      7.51 ns
RawDump                       Contribution #  7 TrackID:   421 PDG:          11    0.0552 MeV      7.51 ns
RawDump                       Contribution #  8 TrackID:   421 PDG:          11    0.0424 MeV      7.51 ns
RawDump                       Contribution #  9 TrackID:   421 PDG:          11    0.0417 MeV      7.51 ns
RawDump                       Contribution # 10 TrackID:   421 PDG:          11    0.0456 MeV      7.51 ns
RawDump                       Contribution # 11 TrackID:   421 PDG:          11    0.0556 MeV      7.51 ns
RawDump                       Contribution # 12 TrackID:   421 PDG:          11    0.0349 MeV      7.51 ns
RawDump                       Contribution # 13 TrackID:   421 PDG:          11    0.0161 MeV      7.51 ns
RawDump                       Contribution # 14 TrackID:   421 PDG:          11    0.0179 MeV      7.51 ns
RawDump                       Contribution # 15 TrackID:   421 PDG:          11    0.0115 MeV      7.51 ns
RawDump                       Contribution # 16 TrackID:   421 PDG:          11    0.0184 MeV      7.51 ns
RawDump                       Contribution # 17 TrackID:   421 PDG:          11    0.0321 MeV      7.51 ns
RawDump                       Contribution # 18 TrackID:   421 PDG:          11     0.041 MeV      7.51 ns
RawDump                       Contribution # 19 TrackID:   421 PDG:          11     0.107 MeV      7.51 ns
RawDump                   +++ Hit: Cell: 013F006A0140710D Pos:(      318,      957, 2.01e+03) [mm] E:    0.428 MeV #Contributions:  3
RawDump                       Contribution #  0 TrackID:    22 PDG:          11    0.0376 MeV      7.51 ns
RawDump                       Contribution #  1 TrackID:    22 PDG:          11     0.196 MeV      7.51 ns
RawDump                       Contribution #  2 TrackID:    22 PDG:          11     0.194 MeV      7.51 ns
RawDump                   +++ Hit: Cell: 013E00690158790D Pos:(      315,      954, 2.01e+03) [mm] E:        0 MeV #Contributions:  1
RawDump                       Contribution #  0 TrackID:   422 PDG:          22         0 MeV      7.53 ns

After the hit truth fixing,

which should happen either in the lcio handler or in a seperate module, all not saved track IDs are rebased to the 2 surving tracks of the output record.
Watch again out for TrackID, this is now the track identifier of the output record ie. the id of the 2 tracks printed above.

HitDump                +++ Hit Collection: TestCallInnerLayerHits  # Calorimeter hits 1
HitDump                   +++ Hit: Cell: 03B9013C0008090D Pos:(      316,      953,    2e+03) [mm] E:    0.165 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.165 MeV      7.47 ns
HitDump                +++ Hit Collection: TestCallMiddleLayerHits  # Calorimeter hits 2
HitDump                   +++ Hit: Cell: 03BA013D0038190D Pos:(      317,      954,    2e+03) [mm] E:    0.227 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.227 MeV      7.47 ns
HitDump                   +++ Hit: Cell: 01DD009E0068290D Pos:(      316,      954,    2e+03) [mm] E:    0.425 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.425 MeV      7.48 ns
HitDump                +++ Hit Collection: TestCallOuterLayerHits  # Calorimeter hits 8
HitDump                   +++ Hit: Cell: 013E006A0098390D Pos:(      318,      954,    2e+03) [mm] E:    0.209 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.209 MeV      7.48 ns
HitDump                   +++ Hit: Cell: 013F006A00C8490D Pos:(      318,      957, 2.01e+03) [mm] E:    0.229 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.229 MeV      7.49 ns
HitDump                   +++ Hit: Cell: 013F006A00F8590D Pos:(      318,      957, 2.01e+03) [mm] E:    0.242 MeV #Contributions:  3
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211      0.16 MeV      7.49 ns
HitDump                       Contribution #  1 TrackID:     0 PDG:        -211    0.0375 MeV      7.49 ns
HitDump                       Contribution #  2 TrackID:     1 PDG:          11     0.045 MeV      7.49 ns
HitDump                   +++ Hit: Cell: 013F006A0128690D Pos:(      318,      957, 2.01e+03) [mm] E:    0.616 MeV #Contributions:  3
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.247 MeV       7.5 ns
HitDump                       Contribution #  1 TrackID:     1 PDG:          11     0.266 MeV       7.5 ns
HitDump                       Contribution #  2 TrackID:     1 PDG:          11     0.103 MeV       7.5 ns
HitDump                   +++ Hit: Cell: 013F006A0158790D Pos:(      318,      957, 2.01e+03) [mm] E:    0.325 MeV #Contributions:  2
HitDump                       Contribution #  0 TrackID:     0 PDG:        -211     0.189 MeV       7.5 ns
HitDump                       Contribution #  1 TrackID:     1 PDG:          11     0.135 MeV       7.5 ns
HitDump                   +++ Hit: Cell: 013E006A0158790D Pos:(      318,      954, 2.01e+03) [mm] E:     1.11 MeV #Contributions: 20
HitDump                       Contribution #  0 TrackID:     1 PDG:          11    0.0998 MeV       7.5 ns
HitDump                       Contribution #  1 TrackID:     1 PDG:          11    0.0792 MeV       7.5 ns
HitDump                       Contribution #  2 TrackID:     1 PDG:          11    0.0417 MeV       7.5 ns
HitDump                       Contribution #  3 TrackID:     1 PDG:          11    0.0904 MeV      7.51 ns
HitDump                       Contribution #  4 TrackID:     1 PDG:          11     0.129 MeV      7.51 ns
HitDump                       Contribution #  5 TrackID:     1 PDG:          11    0.0973 MeV      7.51 ns
HitDump                       Contribution #  6 TrackID:     1 PDG:          11    0.0511 MeV      7.51 ns
HitDump                       Contribution #  7 TrackID:     1 PDG:          11    0.0552 MeV      7.51 ns
HitDump                       Contribution #  8 TrackID:     1 PDG:          11    0.0424 MeV      7.51 ns
HitDump                       Contribution #  9 TrackID:     1 PDG:          11    0.0417 MeV      7.51 ns
HitDump                       Contribution # 10 TrackID:     1 PDG:          11    0.0456 MeV      7.51 ns
HitDump                       Contribution # 11 TrackID:     1 PDG:          11    0.0556 MeV      7.51 ns
HitDump                       Contribution # 12 TrackID:     1 PDG:          11    0.0349 MeV      7.51 ns
HitDump                       Contribution # 13 TrackID:     1 PDG:          11    0.0161 MeV      7.51 ns
HitDump                       Contribution # 14 TrackID:     1 PDG:          11    0.0179 MeV      7.51 ns
HitDump                       Contribution # 15 TrackID:     1 PDG:          11    0.0115 MeV      7.51 ns
HitDump                       Contribution # 16 TrackID:     1 PDG:          11    0.0184 MeV      7.51 ns
HitDump                       Contribution # 17 TrackID:     1 PDG:          11    0.0321 MeV      7.51 ns
HitDump                       Contribution # 18 TrackID:     1 PDG:          11     0.041 MeV      7.51 ns
HitDump                       Contribution # 19 TrackID:     1 PDG:          11     0.107 MeV      7.51 ns
HitDump                   +++ Hit: Cell: 013F006A0140710D Pos:(      318,      957, 2.01e+03) [mm] E:    0.428 MeV #Contributions:  3
HitDump                       Contribution #  0 TrackID:     1 PDG:          11    0.0376 MeV      7.51 ns
HitDump                       Contribution #  1 TrackID:     1 PDG:          11     0.196 MeV      7.51 ns
HitDump                       Contribution #  2 TrackID:     1 PDG:          11     0.194 MeV      7.51 ns
HitDump                   +++ Hit: Cell: 013E00690158790D Pos:(      315,      954, 2.01e+03) [mm] E:        0 MeV #Contributions:  1
HitDump                       Contribution #  0 TrackID:     1 PDG:          22         0 MeV      7.53 ns

Conclusion

I think you should have a look in the lcio conversion. I anyhow noted, that there may be some room for improvement to do the "truth fixing" somewhere centrally in a separate action.
However, I do not know if this is intrusive or not....

MarkusFrankATcernch added a commit to MarkusFrankATcernch/DD4hep that referenced this issue Mar 31, 2017

MarkusFrankATcernch added a commit to MarkusFrankATcernch/DD4hep that referenced this issue Mar 31, 2017

MarkusFrankATcernch added a commit that referenced this issue Mar 31, 2017

MarkusFrankATcernch added a commit that referenced this issue Mar 31, 2017

@MarkusFrankATcernch

This comment has been minimized.

Contributor

MarkusFrankATcernch commented Mar 31, 2017

Could you try to add AFTER the particle truth handler:

  # Add the particle dumper to associate the MC truth
  evt = DDG4.EventAction(kernel,"Geant4ParticleDumpAction/ParticleDump")
  kernel.eventAction().adopt(evt)
  evt.enableUI()

The following plugins:

  # Add the hit dumper BEFORE any hit truth is fixed
  evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/RawDump")
  kernel.eventAction().adopt(evt)
  evt.enableUI()

  # Add the hit dumper to the event action sequence
  evt = DDG4.EventAction(kernel,"Geant4HitTruthHandler/HitTruth")
  kernel.eventAction().adopt(evt)
  evt.enableUI()

  # Add the hit dumper AFTER any hit truth is fixed. We should see the reduced track references
  evt = DDG4.EventAction(kernel,"Geant4HitDumpAction/HitDump")
  kernel.eventAction().adopt(evt)
  evt.enableUI()

You must disable the lcio and ROOT output if you do this. You should then get during the simulation the same output as above. This should allow to check if things go wrong the same way.
Note: Requires the master branch!

@gaede

This comment has been minimized.

Contributor

gaede commented Apr 3, 2017

@MarkusFrankATcernch Thanks a lot for your help in debugging this. In the end the problem was not in DD4hep at all, but in our model that did not define the tracker region - which of course caused all MCParticles created in the simulation to survive the cuts and the hits correctly assigned to them. I actually only found this with the help of your debugging actions - so at least the work was not in vain ;-}
Will fix ddsim to exit if no tracker region is defined ...

@gaede gaede closed this Apr 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment