GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Monte Carlo Engines » Geant4: problem with set seed and cuts
Geant4: problem with set seed and cuts [message #9516] Tue, 06 October 2009 13:52 Go to next message
Jerome Boucher is currently offline  Jerome Boucher
Messages: 11
Registered: October 2008
Location: IPNO
occasional visitor
From: *zdv.Uni-Mainz.DE
Hi,

I would like to run the same simulation using different seeds. In case of Geant3, the function gRandom->SetSeed(seed) works fine. Concerning Geant4, this function has no effect.

The following method has been also tried. In the file gconfig/g4config.in, a line has been added:
/random/resetEngineFrom full_path/seed.rnd
The file seed.rnd contains the seed value.
If I put 200345, I obtain:

Geant4 has been created.
-I g4Config() using g4conf macro: /vol0/jerome/soft/pandaroot/trunk/gconfig/g4config.in

----- HepJamesRandom engine status -----
Initial seed = 200345
u[] = 0.174685 0.883674 0.958512 0.690013 0.0250537 0.142294 0.783649 0.356081 0.214774 0.69287 0.700302 0.465109 0.22215 0.768752 0.461089 0.397602 0.522215 0.121546 0.960227 0.510892 0.0116568 0.0286447 0.238777 0.585219 0.780612 0.709182 0.082106 0.828601 0.61446 0.0798209 0.688002 0.00978529 0.370831 0.376435 0.710184 0.864017 0.167338 0.21114 0.349235 0.522479 0.943713 0.0702708 0.778742 0.639458 0.506555 0.151751 0.990123 0.564688 0.430497 0.889832 0.995398 0.725368 0.710512 0.0550886 0.0540335 0.0159176 0.728379 0.947141 0.34922 0.20551 0.351029 0.672539 0.118976 0.655784 0.195375 0.0380308 0.293556 0.237497 0.79723 0.158375 0.029761 0.602215 0.616657 0.995638 0.734827 0.943425 0.130007 0.277064 0.306344 0.973337 0.183926 0.547536 0.914344 0.666572 0.210074 0.300351 0.83602 0.267525 0.248549 0.533332 0.1754 0.299529 0.538308 0.555472 0.283894 0.485254 0.222273
c = 0.0216029, cd = 0.456233, cm = 1
i97 = 96, u[i97] = 0.222273
j97 = 32, u[j97] = 0.370831

So the seed seems to be loaded. But, doing two simulations using different seeds, results are identical.


Concerning the cuts, I tried to modify the cut (gconfig/SetCut.C file) from 1 MeV to 100 KeV. But this new value is not taken into account.




Someone has an idea where I'm wrong?



best regards


Jerome



Re: Geant4: problem with set seed and cuts [message #9527 is a reply to message #9516] Wed, 07 October 2009 16:58 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

Can you try to use:

/random/setSeeds myseed myseed ((G4 setSeeds requires at least two long values))

where myseed is the seed number you like.

the other method is normally used to restore the status of the random generator and need an input file which should contain the about 98 numbers presenting the HepJamesRandom engine status (it is a CLHEp package).


With the cuts, did you change anything in the g4Config.C? because the cuts will be used if your configuration has the option "stepLimiter+specialCuts+specialControls" setted in the TG4RunConfiguration. I tested the trunk version and using the macro/qa/QAmacro_sim_G4.C and get the following:

as it is:

-I- PndStack: Number of primaries = 23
Total number of particles = 11514
Number of tracks in output = 1938


now set the cutb in SetCuts.C to 1.0E-5

-I- PndStack: Number of primaries = 23
Total number of particles = 22269
Number of tracks in output = 3967



so it seems to work! can you please control your g4Config.C ?

regards

Mohammad






Re: Geant4: problem with set seed and cuts [message #9535 is a reply to message #9516] Thu, 08 October 2009 10:54 Go to previous messageGo to next message
Jerome Boucher is currently offline  Jerome Boucher
Messages: 11
Registered: October 2008
Location: IPNO
occasional visitor
From: *kph.uni-mainz.de
Hello!

I've tried the setSeeds method and it works Very Happy

I checked the g4Config.C , the option "stepLimiter+specialCuts+specialControls" is setted. If I looked to:-I- PndStack: the Total number of particles is changing according to my cut.

But if I look to the output it's always the same.


Index : 0     used in the geometry : Yes     recalculation needed : No 
 Material : air
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 990 eV     e- 990 eV     e+ 990 eV 
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 1     used in the geometry : Yes     recalculation needed : No 
 Material : aluminium
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 6.88731 keV    e- 596.68 keV    e+ 568.011 keV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 2     used in the geometry : Yes     recalculation needed : No 
 Material : iron
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 20.8323 keV    e- 1.28002 MeV    e+ 1.21851 MeV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 3     used in the geometry : Yes     recalculation needed : No 
 Material : copper
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 24.6072 keV    e- 1.39521 MeV    e+ 1.31192 MeV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 4     used in the geometry : Yes     recalculation needed : No 
 Material : steel
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 20.8323 keV    e- 1.31192 MeV    e+ 1.23361 MeV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 5     used in the geometry : Yes     recalculation needed : No 
 Material : vacuum
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 990 eV     e- 990 eV     e+ 990 eV 
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 6     used in the geometry : Yes     recalculation needed : No 
 Material : Al+Be
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 4.45676 keV    e- 496.074 keV    e+ 478.087 keV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 7     used in the geometry : Yes     recalculation needed : No 
 Material : TPCmixture
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 990 eV     e- 990 eV     e+ 990 eV 
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 8     used in the geometry : Yes     recalculation needed : No 
 Material : silicon
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 6.88731 keV    e- 540.718 keV    e+ 521.113 keV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

Index : 9     used in the geometry : Yes     recalculation needed : No 
 Material : carbon
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm 
 Energy thresholds :  gamma 3.29462 keV    e- 568.011 keV    e+ 554.196 keV
 Region(s) which use this couple : 
    DefaultRegionForTheWorld

...



Could you explain me why?



best regards

jeorme
Re: Geant4: problem with set seed and cuts [message #9536 is a reply to message #9535] Thu, 08 October 2009 11:15 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

This comes because the concept of cuts in G3/G4 is different, in VMC these cuts are tracking cuts, they are there to make it possible to compare the results of G3/G4.

In the new release of VMC you can also apply them to G4 and they can behave more or less like the G3 one and then you will see also the difference in the output.


regards

Mohammad
Re: Geant4: problem with set seed and cuts [message #9539 is a reply to message #9516] Thu, 08 October 2009 17:22 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hallo,

I just modified the g4Config.C in a way that G4 use by default the values you set in gRandom in your simulation macro. (svn r 6707) so from this release it is not needed any more to change the g4config.in or use the previous way described in this forum. G4/G3 use the same seed from gRandom.

regards

Mohammad
Re: Geant4: problem with set seed and cuts [message #9552 is a reply to message #9539] Fri, 09 October 2009 13:47 Go to previous messageGo to next message
Dmitry Khaneft is currently offline  Dmitry Khaneft
Messages: 75
Registered: January 2009
continuous participant
From: *kph.uni-mainz.de
Thanks a lot!
Re: Geant4: problem with set seed and cuts [message #9580 is a reply to message #9516] Mon, 19 October 2009 12:29 Go to previous message
Jerome Boucher is currently offline  Jerome Boucher
Messages: 11
Registered: October 2008
Location: IPNO
occasional visitor
From: *kph.uni-mainz.de
Hi!

Sorry for the late answer, I was fighting with my laptop...


I tried the gRandom->SetSeed(seed) with the revision you specified but it seems that there is no effect.
I added a line in the g4Config.C to print out the buffer and it is correctly filled.



best regards
jerome


Previous Topic: GEANT3: of energy loss and delta rays
Next Topic: elastic neutron scattering in Geant3
Goto Forum:
  


Current Time: Thu Jun 20 07:32:22 CEST 2024

Total time taken to generate the page: 0.00850 seconds