TRestHitsToSignalProcess does not provide a correct output

REST version : v2.2.21
REST commit : 9d6255eb

Hi,

I was processing a simulation chain:G4 generationG4ToHitsHitsToSignalSignalToHits.
On the last step, I have found that Z coordinate is not recognized for the XZ&YZ projections of HitsEvents:

TRestGeant4AnalysisProcess works as usual for me and the problem should be in the TRestSignalToHitsProcess as when I read SignalEvents through the TRestBrowser an errors appear for each entry:

Entry : 0
> Event ID : 0
> Event Time : 0
> Event Tag : 
-----------------------------------------
Observable : g4Ana_gasEDep                                    Value : 0                                                                                                
Observable : g4Ana_vesselEDep                                 Value : 0                                                                                                
Observable : g4Ana_totalEdep                                  Value : 2200                                                                                             
Observable : g4Ana_photoelectric                              Value : 1                                                                                                
Observable : g4Ana_compton                                    Value : 0                                                                                                
Observable : g4Ana_bremstralung                               Value : 1                                                                                                
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146

Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146
Error in <TPad::Range>: illegal world coordinates range: x1=-107374184.000000, y1=-30.101917, x2=-107374184.000000, y2=306.490378
Error in <TPad::RangeAxis>: illegal axis coordinates range: xmin=-107374184.000000, ymin=3.557314, xmax=-107374184.000000, ymax=272.831146

and TRestBrowser shows nothing in the output. I have mentioned this problem before:


When I process only one entry with verboseLevel = 4 I receive this output, but I am not sure that I can find a source of a problem. runOutput.txt (179.0 KB)

May I ask if you could hint me where to look for?
Thanks in advance!

Hi Andrii, from your output I see

Process : TRestHitsToSignalProcess
Name: hitsToSignal  Title: A hits to signal template  VerboseLevel: info
 ----------------------------------------------- 
 
Sampling : 0.05 us
Electric field : 1000 V/cm
Gas pressure : 10 atm
Drift velocity : 0 mm/us

The drift velocity is set to 0. You have two options, use a TRestGas definition inside TRestRun or write the drift velocity by hand, you could test first the second.

<parameter name="driftVelocity" value="2cm/us" />

Instead of verbose level debug you can set TRestProcessRunner to info. This should show you the parameters you have at each process.

<TRestProcessRunner .... versboseLevel="info" >
...
...
...

Hi Javier,

This cured the problem with Signal events reconstruction. But I am already using TRestGas definition inside TRestRun:

<TRestGas name="Xenon-TMA 1Pct 10-10E3Vcm"
        file="/local/home/al264242/Documents/Soft/REST_v2/install/master/data/definitions/gases.rml"
        pressure="10" value="ON" overwrite="false" />

And it is loaded from my local directory:

Despite all of this, the output of the SignalToHitsProcess remains the same.
Z coordinate is not recognized.

So, TRestHitsToSignalProcess is properly recognising the TRestGas object but TRestSignalToHitsProcess is not?

Could you attach the output from processes metadata coming out on screen with info verbose Level at TRestProcessRunner?

The following code isside void TRestSignalToHitsProcess::InitProcess() is responsible to retrieve the drift velocity. Could you cout few outputs to understand if fGas it is properly initialised, electric field, etc?

It seems at TRestElectronDiffusionProcess those parameters are properly initialised.

    fGas = GetMetadata<TRestGas>();
    if (fGas != NULL) {
#ifndef USE_Garfield
        ferr << "A TRestGas definition was found but REST was not linked to Garfield libraries." << endl;
        ferr << "Please, remove the TRestGas definition, and add gas parameters inside the process "
                "TRestSignalToHitsProcess"
             << endl;
        exit(-1);
#endif
        if (fGasPressure <= 0) fGasPressure = fGas->GetPressure();
        if (fElectricField <= 0) fElectricField = fGas->GetElectricField();

        fGas->SetPressure(fGasPressure);
        fGas->SetElectricField(fElectricField);

        if (fDriftVelocity <= 0) fDriftVelocity = fGas->GetDriftVelocity();
    } else {
        warning << "No TRestGas found in TRestRun." << endl;
        if (fDriftVelocity == -1) {
            ferr << "TRestHitsToSignalProcess: drift velocity is undefined in the rml file!" << endl;
            exit(-1);
        }
    }

Hi again,

using FullResponse.rml at the following git project

The drift velocity are properly retrieved. You may compare the process definitions with yours.

              ====================================================================================================              
              ||                               Process : TRestHitsToSignalProcess                               ||              
              ||             Name: hitsToSignal  Title: A TREXDM hits to signal  VerboseLevel: info             ||              
              ||                        -----------------------------------------------                         ||              
              ||                                                                                                ||              
              ||                                       Sampling : 0.04 us                                       ||              
              ||                                   Electric field : 640 V/cm                                    ||              
              ||                                      Gas pressure : 4 atm                                      ||              
              ||                                 Drift velocity : 21.3776 mm/us                                 ||              
              ||                                                                                                ||              
              ====================================================================================================              
                            

              ====================================================================================================              
              ||                               Process : TRestSignalToHitsProcess                               ||              
              ||        Name: signalToHits  Title: A Signal To Hits reconstruction.  VerboseLevel: info         ||              
              ||                        -----------------------------------------------                         ||              
              ||                                                                                                ||              
              ||                                   Electric field : 640 V/cm                                    ||              
              ||                                      Gas pressure : 4 atm                                      ||              
              ||                                 Drift velocity : 21.3776 mm/us                                 ||              
              ||                                    Signal to hits method :                                     ||              
              ||                                                                                                ||              
              ====================================================================================================  

Let me know how that goes

Hi again,

I have added several cout-s in the TRestSignalToHitsProcess::InitProcess() and TRestHitsToSignalProcess::InitProcess() and it looks like neither of them could retrieve a non-zero value for the driftVelocity parameter from the TRestGas:

Getting the TRestGas : 0x563c34b19d20

TRestHitsToSignalProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0

Getting the TRestGas : 0x563c34b19d20

TRestSignalToHitsProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0

The full output of the restManager command with info verbose Level at TRestProcessRunner is there: sig_output.txt (3.4 KB)
(Just in case: I have changed electricField to the value of 500 V/cm)

In addition, I am not sure why TRestProcessRunner is running through the processes two times, as it is visible by the output of TRestSignalToHitsProcess and TRestHitsToSignalProcess.

I see that you are using 500V/cm at TRestElectronDiffusionProcess and 50V/cm at TRestHitsToSignalProcess?

Perhaps the gas is outside the calculated range?

From the gas name

xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas.

That gas mixture was calculated for the field/pressure (E_vs_P) range between 10V/cm/bar and 1000V/cm/bar.

If you have 50V/cm at 10bar, it means you are at 5V/cm/bar. Perhaps that’s the reason?
You should define also <parameter name="electricField" value="500V/cm" /> at those processes.

Please, notice that by defining the parameters at the globals section, it will propagate to all processes.

<globals>
    <parameter name="electricField" value="500V/cm" />
</globals>

Ok, I see at the output you have 500V/cm at all processes. Could you share the RML you are using?

Could you try with the following gas?

<TRestGas name="Neon-Isobutane 2Pct 10-10E3Vcm" pressure="10" file="server"/> 

I have changed the gas mixture, but the output is the same:

Process : TRestHitsToSignalProcess
Name: hitsToSignal  Title: A hits to signal template  VerboseLevel: warning
 ----------------------------------------------- 
 
Sampling : 0.05 us
Electric field : 500 V/cm
Gas pressure : 10 atm
Drift velocity : 0 mm/us
 
=


=
Process : TRestSignalToHitsProcess
Name: simulation  Title: A hit reconstruction template.  VerboseLevel: warning
 ----------------------------------------------- 
 
Electric field : 500 V/cm
Gas pressure : 10 atm
Drift velocity : 0 mm/us
Signal to hits method : all

signal_output_Ne_Iso.txt (3.4 KB)

This is my config.rml file that I am using configFile_G4Hits_To_Signal_test.rml (4.0 KB) and a processes.rml file processFile_general.rml (36.0 KB) , where TRestHitsToSignalProcess and TRestSignalToHitsProcess are defined as follows:

<TRestHitsToSignalProcess name="hitsToSignal" title="A hits to signal template" >

        <parameter name="sampling" value="50ns" />
        <!--<parameter name="electricField" value="1000" units="V/cm" />-->
        <parameter name="electricField" value="500" units="V/cm" />

        <!-- If specified, the following parameters will modify the properties of the gas found in TRestGas -->
        <parameter name="gasPressure" value="" />
        <parameter name="driftVelocity" value="" />

    </TRestHitsToSignalProcess>
~~~~~~~~~~~~~
<TRestSignalToHitsProcess name="simulation" title="A hit reconstruction template." >

        <parameter name="sampling" value="50ns" /> <!-- 1us -->
        <parameter name="threshold" value="0" />
        <parameter name="electricField" value="500" units="V/cm" />

        <!-- If not specified, the following values will be taken from TRestGas properties -->
        <parameter name="gasPressure" value="" /> <!-- in atm -->
        <parameter name="driftVelocity" value="" /> <!-- in cm/us -->

    </TRestSignalToHitsProcess>

Hi Andrii,

if I use the RMLs you gave to me (where I just modify the readout and STORAGE_PATH) and I run it with one of my restG4 files I get a value for the drift velocity.

output
-- Info : thread 0: validating process chain

-- Info : TRestProcessRunner : preparing threads...
                                   TRestProcessRunner: 5 processes loaded, 1 threads prepared!                                   

                                   ====================================================================================================                                   
                                   ||                                 Process : TRestG4toHitsProcess                                 ||                                   
                                   ||              Name: G4ToHits  Title: G4Hits to Hits process  VerboseLevel: warning              ||                                   
                                   ||                        -----------------------------------------------                         ||                                   
                                   ||                                                                                                ||                                   
                                   ||                                                                                                ||                                   
                                   ====================================================================================================                                   
                                                                      

                                   ====================================================================================================                                   
                                   ||                            Process : TRestElectronDiffusionProcess                             ||                                   
                                   ||                  Name: eDiff_1kVcm_10atm  Title: eDiff  VerboseLevel: warning                  ||                                   
                                   ||                        -----------------------------------------------                         ||                                   
                                   ||                                                                                                ||                                   
                                   ||                                        eField : 500 V/cm                                       ||                                   
                                   ||                                 attachment coeficient : 0 V/cm                                 ||                                   
                                   ||                                      gas pressure : 10 atm                                     ||                                   
                                   ||                      longitudinal diffusion coefficient : 0.0145284 cm^1/2                     ||                                   
                                   ||                      transversal diffusion coefficient : 0.0192074 cm^1/2                      ||                                   
                                   ||                                      W value : 21.3485 eV                                      ||                                   
                                   ||                                  Maximum number of hits : 1000                                 ||                                   
                                   ||                                            seed : 0                                            ||                                   
                                   ||                                                                                                ||                                   
                                   ====================================================================================================                                   
                                                                      

                                   ====================================================================================================                                   
                                   ||                                 Process : TRestSmearingProcess                                 ||                                   
                                   ||               Name: smear_3FWHM  Title: Smearing template  VerboseLevel: warning               ||                                   
                                   ||                        -----------------------------------------------                         ||                                   
                                   ||                                                                                                ||                                   
                                   ||                                reference energy (Eref): 2457.83                                ||                                   
                                   ||                                     resolution at Eref : 3                                     ||                                   
                                   ||                                                                                                ||                                   
                                   ====================================================================================================                                   
                                                                      

                                   ====================================================================================================                                   
                                   ||                               Process : TRestHitsToSignalProcess                               ||                                   
                                   ||          Name: hitsToSignal  Title: A hits to signal template  VerboseLevel: warning           ||                                   
                                   ||                        -----------------------------------------------                         ||                                   
                                   ||                                                                                                ||                                   
                                   ||                                       Sampling : 0.05 us                                       ||                                   
                                   ||                                   Electric field : 500 V/cm                                    ||                                   
                                   ||                                     Gas pressure : 10 atm                                      ||                                   
                                   ||                                 Drift velocity : 13.7625 mm/us                                 ||                                   
                                   ||                                                                                                ||                                   
                                   ====================================================================================================                                   
                                                                      

                                   ====================================================================================================                                   
                                   ||                               Process : TRestSignalToHitsProcess                               ||                                   
                                   ||         Name: simulation  Title: A hit reconstruction template.  VerboseLevel: warning         ||                                   
                                   ||                        -----------------------------------------------                         ||                                   
                                   ||                                                                                                ||                                   
                                   ||                                   Electric field : 500 V/cm                                    ||                                   
                                   ||                                     Gas pressure : 10 atm                                      ||                                   
                                   ||                                 Drift velocity : 13.7625 mm/us                                 ||                                   
                                   ||                                  Signal to hits method : all                                   ||                                   
                                   ||                                                                                                ||                                   
                                   ====================================================================================================                                   
                                                                      
                                   ====================================================================================================                                   
                                   [==                          TRestProcessRunner: Starting the Process..                          ==]                                   
                                   Waiting for processes to finish ...                                   
-- Info : TRestThread : Writing temp file. Thread id : 0
                                   [==                           TRestProcessRunner: 100 processed events                           ==]                                   
-- Info : Total processing time : 509.144 ms
-- Info : Average read time from disk (per event) : 1.34021 ms
-- Info : Average process time (per event) : 3.46857 ms
-- Info : Average write time to disk (per event) : 0.28266 ms
====================================================================================================
                                   Configuring output file, merging thread files together                                   
                                   [==                      DataBase Entry Added! Run Number: 6000, File ID: 0                      ==]                                   
                                   [==                                     TRestRun Created ...                                     ==]                                   
                                   [==                                         - Path : ./                                          ==]                                   
                                   [==            - Filename : XXG4Hits_To_Signal_uncut_06000_G4_energy_cut_Nev100.root             ==]                                   
                                   [==                                            Done!                                             ==]                                   
galan-gifna:Downloads javi$ vim main.rml 
galan-gifna:Downloads javi$ rest-config --version
v2.2.21
galan-gifna:Downloads javi$ rest-config --commit
9fc9be45

As you see I am on commit 9fc9be45 There is no big difference with the commit you reported …

In your output, when you introduce couts it gets to GetDriftVelocity?

        fGas->SetPressure(fGasPressure);
        fGas->SetElectricField(fElectricField);

        if (fDriftVelocity <= 0) {
               fDriftVelocity = fGas->GetDriftVelocity();
               cout << "fDriftVelocity: " << fDriftVelocity << endl;

What is the value of drift velocity there?

Also, could you test the following?

restRoot
[0] TRestGas *gas = new TRestGas("server", "Neon-Isobutane 2Pct 10-10E3Vcm");
[1] gas->SetPressure(10);
[2] gas->GetDriftVelocity(1000)
[3] gas->GetDriftVelocity()

When I put such lines

        fGas->SetPressure(fGasPressure);
        fGas->SetElectricField(fElectricField);
if (fDriftVelocity <= 0) fDriftVelocity = fGas->GetDriftVelocity();
        //debug
        cout << "TRestSignalToHitsProcess:\nfGasPressure = " << fGasPressure << endl << "fElectricField = " << fElectricField << endl << "fDriftVelocity = " << fDriftVelocity << "\n\n";
    }

in TRestHitsToSignalProcess and TRestSignalToHitsProcess I get an output:

TRestHitsToSignalProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0

TRestSignalToHitsProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0


However, these lines working fine for me:

root [7] TRestGas *gas = new TRestGas("server", "Neon-Isobutane 2Pct 10-10E3Vcm");
MediumMagboltz::LoadGasFile: Reading /local/home/al264242/.rest/download/ne_98.0-iC4H10_2.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas.
MediumMagboltz::LoadGasFile: Version 12
MediumMagboltz::LoadGasFile:
    Gas composition set to Ne/iC4H10 (98/2)
root [8] gas->SetPressure(10);
root [9] gas->GetDriftVelocity(1000)
(double) 1.8721212
root [10] gas->GetDriftVelocity()
(double) 0.0000000

I have compiled the latest commit 4f6b50a5, but the problem remains the same.

Also, I recompiled Garfield by executing installGarfield.sh script and further recompiled the REST itself, but it hasn’t helped to resolve the problem.

Hi,

I really don’t know how to reproduce the problem. You see that when using the processing chain I got from your RML file the result was just fine to me.

Perhaps @nkx do you have any idea how to spot the error?

Also, what you observe in the restRoot session seems normal to me. The last command is returning zero because the electric field has not been defined.

This is another topic, I found a bit confusing that the argument of Double_t GetDriftField( Double_t field ); default units are in V/cm, however, TRestDriftVolume::fElectricField is defined in V/mm.

It is confusing because if I do

gas->SetElectricField(100);
gas->GetDriftVelocity();
gas->GetDriftVelocity(100)

I do not get the same result. For me, here, V/cm are more confortable units, I would prefer both methods to receive the argument in V/cm. In any case I do not mind if they are expressed in V/mm, but both should be coherent.

Furthermore GetDriftVelocity() returns the velocity in cm/us and GetDriftVelocity(E) returns the velocity in mm/us.

All this should be coherent, @nkx how do you think this should be done to make it coherent? Which standard units do we adopt for TRestGas and TRestDriftVolume methods?

Hi Andrii, was this problem finally solved?

I think we should prevent using gas->GetDriftVelocity(100). This method should be regareded as private.

Actually it is GetDriftVelocity() that returns value in REST standard unit mm/us. Method GetDriftVelocity(100) is returning cm/us as garfield standard unit. For me GetDriftVelocity(100) is a “internal” method that is only called in TRestGas. Somehow we kept the accessibility to this method for backward compatibility. As discussed in TRestGas GetDriftVelocity is not accessible anymore - #5 by nkx

Ok, I just made them private, I guess that does not solve the problem from @andriiL. Not sure what is the source of those problems…

@andriiL perhaps you could add here as output fGas->PrintMetadata() to see if everything looks normal.

Hi again,

I still have a problem with TRestHitsToSignalProcess and TRestSignalToHitsProcess as they are not always able to get driftVelocity from the TRestGas.

Right now, if I am processing G4Events, applying TRestG4toHitsProcess/TRestElectronDiffusionProcess/TRestSmearingProcess/TRestHitsToSignalProcess chain, I DO get the driftVelocity for the TRestHitsToSignalProcess.
If I apply TRestSignalToHitsProcess at the same .rml file, the driftVelocity is being restored from the TRestGas.
I am using such a configuration.rml file for G4Events processing (configFile_G4Hits_To_Signal_test.rml (4.3 KB) ) and this general processes .rml file which I use in my configuration files (processFile_general.rml (36.1 KB) ).
Also, this is my G4Events file which I am using: Run00265_g4Tag_isotropic_fVolume_Nev5.root (201.3 KB) .
The output I get for the configfile.rml g4ToSigHits.txt (6.1 KB) shows something like this:

TRestSignalToHitsProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0.740318

+++++++++++++++++++++++++++++++++++++++++++++
TRestGas content
Config file : null
+++++++++++++++++++++++++++++++++++++++++++++
Name : Xenon-TMA 1Pct 10-10E3Vcm
Title : Xenon-TMA Mixture (1Pct TMA)
REST Version : 2.2.22
REST Commit : 4f6b50a5
REST Library version : 0
---------------------------------------
Status : Gasfile loaded
Gas filename : xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas
Pressure : 10 atm
Temperature : 293.15 K
Electric Field : 500 V/cm 
W-value : 21.9 eV
Max. Electron energy : 400 eV
Field grid nodes : 20
Efield range : ( 10 , 1000 ) V/cm 
Number of Gases : 2
Gas id : 0, Name : xe, Fraction : 0.99
Gas id : 1, Name : n(ch3)3, Fraction : 0.01
******************************************


Getting the TRestGas : 0x555b1f8b91b0

TRestHitsToSignalProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0.740318

+++++++++++++++++++++++++++++++++++++++++++++
TRestGas content
Config file : null
+++++++++++++++++++++++++++++++++++++++++++++
Name : Xenon-TMA 1Pct 10-10E3Vcm
Title : Xenon-TMA Mixture (1Pct TMA)
REST Version : 2.2.22
REST Commit : 4f6b50a5
REST Library version : 0
---------------------------------------
Status : Gasfile loaded
Gas filename : xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas
Pressure : 10 atm
Temperature : 293.15 K
Electric Field : 500 V/cm 
W-value : 21.9 eV
Max. Electron energy : 400 eV
Field grid nodes : 20
Efield range : ( 10 , 1000 ) V/cm 
Number of Gases : 2
Gas id : 0, Name : xe, Fraction : 0.99
Gas id : 1, Name : n(ch3)3, Fraction : 0.01
******************************************

The problems start when I am trying to generate a signalEvents file and then process it with another configuration.rml file.
Steps I am using are as follows:

  1. Process G4Events with configfile.rml I already uploaded with TRestG4toHitsProcess/TRestElectronDiffusionProcess/TRestSmearingProcess/TRestHitsToSignalProcess chain. The output I get is a signalEvents file.

  2. Using the same .rml file but only with TRestSignalToHitsProcess turned on. As an input, I am using previously generated signalEvents file.
    That is the .rml file configFile_Signal_To_Hits_test.rml (4.2 KB) and the output output_sigTohits.txt (2.9 KB).
    Right now driftVelocity is set to zero:

TRestSignalToHitsProcess:
fGasPressure = 10
fElectricField = 50
fDriftVelocity = 0

+++++++++++++++++++++++++++++++++++++++++++++
TRestGas content
Config file : null
+++++++++++++++++++++++++++++++++++++++++++++
Name : Xenon-TMA 1Pct 10-10E3Vcm
Title : Xenon-TMA Mixture (1Pct TMA)
REST Version : 2.2.22
REST Commit : 4f6b50a5
REST Library version : 0
---------------------------------------
Status : Gasfile loaded
Gas filename : xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas
Pressure : 10 atm
Temperature : 293.15 K
Electric Field : 500 V/cm 
W-value : 21.9 eV
Max. Electron energy : 400 eV
Field grid nodes : 20
Efield range : ( 10 , 1000 ) V/cm 
Number of Gases : 2
Gas id : 0, Name : xe, Fraction : 0.99
Gas id : 1, Name : n(ch3)3, Fraction : 0.01
******************************************

I am getting this result in any case if I am adding TRestGas metadata to my last configfile.rml or not.

Also, when I print TRestSignalToHitsProcess and TRestHitsToSignalProcess metadata stored in the .root file, generated by this configFile_Signal_To_Hits_test.rml (4.2 KB)
image

I get this:


This confuses me a lot and I don’t know why something like this is happening. The driftVelocity is being stored as a metadata inside the .root file. But, why it’s not being transferred to the TRestSignalToHitsProcess?

Ok, I think we are spotting the problem. I have used your RML files to generate the first ROOT file.

When I open the file using restRoot, the TRestGas class loads as another md0_ metadata class, but it is not behaving properly. I cannot retrieve the drift velocity from it, as you see in the following output:

root [0] md0_Xenon_TMA1Pct10_10E3Vcm->PrintMetadata()
              ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++              
              ||                                        TRestGas content                                        ||              
              ||                                       Config file : null                                       ||              
              ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++              
              ||                                Name : Xenon-TMA 1Pct 10-10E3Vcm                                ||              
              ||                              Title : Xenon-TMA Mixture (1Pct TMA)                              ||              
              ||                                     REST Version : 2.2.23                                      ||              
              ||                                     REST Commit : cd4150c2                                     ||              
              ||                                    REST Library version : 0                                    ||              
              ----------------------------------------------------------------------------------------------------              
              ||                                    Status : Gasfile loaded                                     ||              
              ||      Gas filename : xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas       ||              
              ||                                       Pressure : 10 atm                                        ||              
              ||                                     Temperature : 293.15 K                                     ||              
              ||                                   Electric Field : 500 V/cm                                    ||              
              ||                                       W-value : 21.9 eV                                        ||              
              ||                                 Max. Electron energy : 400 eV                                  ||              
              ||                                     Field grid nodes : 20                                      ||              
              ||                               Efield range : ( 10 , 1000 ) V/cm                                ||              
              ||                                      Number of Gases : 2                                       ||              
              ||                             Gas id : 0, Name : xe, Fraction : 0.99                             ||              
              ||                          Gas id : 1, Name : n(ch3)3, Fraction : 0.01                           ||              
              ****************************************************************************************************              
                            
                            
root [1] md0_Xenon_TMA1Pct10_10E3Vcm->GetDriftVelocity()
(double) 0.0000000
root [2] md0_Xenon_TMA1Pct10_10E3Vcm->SetPressure(10)
root [3] md0_Xenon_TMA1Pct10_10E3Vcm->SetElectricField(100)
root [4] md0_Xenon_TMA1Pct10_10E3Vcm->GetDriftVelocity()
(double) 0.0000000

Although, as usual, it does if I just use a TRestGas instance directly

root [5] TRestGas *gas = new TRestGas("server", "Xenon-TMA 1Pct 10-10E3Vcm");
MediumMagboltz::LoadGasFile: Reading /Users/javi/.rest/download/xe_99.0-n(ch3)3_1.0-E_vs_P_10.0_1000.0_nodes_20-nCol_10-maxE_400.gas.
MediumMagboltz::LoadGasFile: Version 12
MediumMagboltz::LoadGasFile:
    Gas composition set to Xe/TMA (99/1)
root [6] gas->SetPressure(10)
root [7] gas->SetElectricField(100);
root [8] gas->GetDriftVelocity()
(double) 1.8641766

The problem is that in the case of md0_ the TRestGas contains all the metadata members properly initialised, but somehow they are not linked to the Magboltz gas file.

In order to initialise the gas we need to call the method TRestGas::LoadGasFile which is actually called from InitFromConfigFile, i.e. when we load the gas from RML, but not when calling the default constructor.

I have updated restRoot.cxx so that it calls that method just after loading md0_gasXXX.

After that commit, when you open the file using restRoot you will be able to retrieve the drift velocity at the conditions you used in your processing:

md0_Xenon_TMA1Pct10_10E3Vcm->GetDriftVelocity()

Now, I bet that if in the process where you are experiencing problems you add after fGas = GetMetadata<TRestGas>(); a line as fGas->LoadGasFile() your problems will disappear.

I believe we have no a better way than adding that line to each process that uses fGas. If after testing it works, could you prepare the commit and upload to development?

1 Like