Problem with restG4 electron generation

System : Ubuntu 18.04
REST version : v2.2.18
REST commit : 6cfe483f

Hi,
I am generating 2.2 MeV electrons inside the basic setup volume that was defined for the 01.NLDBD-PandaX-III example which should correspond to the 200kg Xe+1%TMA mixture.

The problem is that there are not a lot of energy depositions inside the gas volume, as I would expect.


Also, I do not understand why I have such big tracks for gammas, which should have similar tracks to the electrons for this setup if I am not mistaken.

Changing maxTargetStepSize and subEventTimeDelay in my restG4 .rml configuration file has no effect on frequency of energy depositions.
A storage section was defined like this:
<storage sensitiveVolume=“gas”>
<parameter name=“energyRange” value=“(0,5)” units=“MeV” />
<activeVolume name=“gas” chance=“1” />
</storage>
Therefore, I do not understand the energy deposition problem.
This is my .rml file which I use for electron generation:

<restG4>
<globals>
<parameter name=“mainDataPath” value=“” />
<parameter name=“verboseLevel” value=“essential” />
<variable name=“NEVENTS” value=“20” overwrite=“false”/>
<variable name=“MAXTARGETSTEPSIZE” value=“10” overwrite=“false”/>
<variable name=“SUBEVENTTIMEDELAY” value=“10” overwrite=“false”/>
</globals>
<TRestRun name=“Gamma run” title=“REST Metadata run of Gamma 2.2MeV”>
<parameter name=“experiment” value=“particle_gen”/>
<parameter name=“runType” value=“simulation”/>
// Value “auto” can add simulation run into database ???
<parameter name=“runNumber” value=“auto”/>
// The runTag in a restG4 simulation will be replaced by the title of TRestG4Metadata
<parameter name=“runTag” value=“g4Tag”/>
// The output filename can be built using any member from TRestRun, fRunNumber, fRunTag, …, etc.
<parameter name=“outputFile” value=“Run[fRunNumber][fRunTag][fExperimentName].root” />
<parameter name=“runDescription” value=“We launch just 20 events to check everything is ok.”/>
<parameter name=“user” value=“${USER}”/>
<parameter name=“verboseLevel” value=“3”/>
<parameter name=“overwrite” value=“on” />
<parameter name=“readOnly” value=“false” />
</TRestRun>
<!–Electron events generation part (In case you want to generate .root file with electron events: restG4 “filename”.rml ElectronGen) →
<TRestG4Metadata name=“ElectronGen” title=“electron2_2MeV”>
<parameter name=“verboseLevel” value=“extreme”/>
<parameter name=“gdml_file” value=“geometry/mySetupTemplate.gdml”/>
<parameter name=“maxTargetStepSize” value=“${MAXTARGETSTEPSIZE}” units=“um” />
<parameter name=“subEventTimeDelay” value=“${SUBEVENTTIMEDELAY}” units=“us” />
<parameter name=“Nevents” value=“${NEVENTS}” />
///three types of source definition supported:
<!– →
<generator type=“point” position=“(0,0,150)” units=“mm”>
<source use=“geant4” particle=“e-”>
<angularDist type=“isotropic” />
<energyDist type=“flat” range=“(2100,2300)” units=“keV” />
</source>
</generator>
<biasing value=“off” type=“virtualBox”>
<biasingVolume size=“2850mm” position=“(0,0,0)mm” factor=“2” energyRange=“(0,5)MeV” />
<biasingVolume size=“2450mm” position=“(0,0,0)mm” factor=“2” energyRange=“(0,5)MeV” />
<biasingVolume size=“2050mm” position=“(0,0,0)mm” factor=“2” energyRange=“(0,5)MeV” />
</biasing>
<storage sensitiveVolume=“gas”>
<parameter name=“energyRange” value=“(0,5)” units=“MeV” />
<activeVolume name=“gas” chance=“1” />
</storage>
</TRestG4Metadata>
<TRestPhysicsLists name=“default” title=“First physics list implementation.” >
<parameter name=“cutForGamma” value=“1” units=“um” />
<parameter name=“cutForElectron” value=“1” units=“um” />
<parameter name=“cutForPositron” value=“1” units=“mm” />
<parameter name=“cutForMuon” value=“1” units=“mm” />
<parameter name=“cutForNeutron” value=“1” units=“mm” />
<parameter name=“minEnergyRangeProductionCuts” value=“10” units=“eV” />
<parameter name=“maxEnergyRangeProductionCuts” value=“1” units=“GeV” />
<!-- EM Physics lists →
<physicsList name=“G4EmLivermorePhysics”>
<!-- Hadron physics lists →
<physicsList name=“G4HadronElasticPhysicsHP”>
<physicsList name=“G4IonBinaryCascadePhysics”>
<physicsList name=“G4HadronPhysicsQGSP_BIC_HP”>
<physicsList name=“G4NeutronTrackingCut”>
<physicsList name=“G4EmExtraPhysics”>
</TRestPhysicsLists>
</restG4>

Am I defining a sensitive volume incorrectly? I am missing something and I do not understand what exactly. Thanks in advance for the help!

P.S.:
In the myGeometryTemplate.gdml the gas volume is defined like this:
<structure>
<!-- {{{ Volumes definition (material and solid assignment) →
<volume name=“gasVolume”>
<materialref ref=“Xenon_TMA”/>
<solidref ref=“gasSolid”/>
</volume>


</structure>

In the materials.xml:
<material name=“Xenon_TMA” state=“gas”>
<D unit=“mg/cm3” value=“targetGasDensity+quencherDensity” />
<P unit=“bar” value=“gasPressure” />
<T unit=“K” value=“gasTemperature” />
<fraction n=“quencherFraction” ref=“TMA” />
<fraction n=“1-quencherFraction” ref=“Xenon” />
</material>

And finally, in mySetupTemplate.gdml these variables were defined as follows:
<define>
<variable name=“targetGasDensity” value=“56.5884”/>
<variable name=“quencherDensity” value=“0.254”/>
<variable name=“quencherFraction” value=“0.01”/>
<variable name=“gasTemperature” value=“300”/>
<variable name=“gasPressure” value=“10”/>
</define>
Thus, everything should correspond to a proper Xe+1%TMA gas mixture during the Monte-Carlo simulation of the electrons inside the gas tank.
I have attached these files in addition to the materials.xml here, just in case.
materials.xml (9.9 KB) myGeometryTemplate.gdml (2.1 KB) mySetupTemplate.gdml (1.6 KB)

Hi @andriiL thanks for pointing out this issue.

I used the files you provided and experienced the same problem.

Then, I found out that the parameter fMaxTargetStepSize was taking as a value 12mm, and not 12um as it would be expected from the RML definition.

I found out looking inside the ROOT generated file.

If you do:

restRoot Run00003electron2_2MeVparticle_gen.root

The file will be open, and you will get pointers to the metadata structures inside the file.

Printing out the metadata information shows the real value it was considered for the simulation.

md0_ElectronGen->PrintMetadata()

The problem was at the implementation of the method GetDblParameterWithUnits( ). It seems it was only working for constructions like value="12um", and was not properly implemented for the case where units are defined as a separate field using value="12" units="um". As a consequence REST was not reading the real units given and assigning the default units, which are mm.

I have added a bug fix in the latest commit to development, and now both should be valid constructions.

Thanks for your post, it helped to fix a bug :slight_smile:

Regarding the gammas leaving the volume, if the energy of the gammas is at the energy range of hundreds of keV it is possible they travel a reasonable distance. But if you see any anomaly let us know!

Thank you very much, now it’s working fine!

Great!

BTW, we are now centralising materials file at a Git repository. Now it is possible to include http remote ENTITYs inside the GDML file.

Instead of propogating and modifying materials.xml file on local systems, as it was the case till recently, we should try now to maintain a common one, i.e. by using this in our GDML files:

<!ENTITY materials SYSTEM "https://sultan.unizar.es/materials/materials.xml">

That way, if there are issues/errors with any material definitions we fix those issues for anyone.

Sorry, I have not seen this message.
I have modified my Setup .gdml file accordingly and everything works fine for me.

Thanks!