# gas.LoadGasFile() vs gas.Initialise(true)

**URL:** <https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925>\
**Category:** Garfield++\
**Created:** [May 17, 2021, 1:57pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925 "2021-05-17T13:57:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 17, 2021, 1:57pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/1 "2021-05-17T13:57:10Z")

</div>

Hi,

Thus far, I have been using gas.Initialise(true) to calculate the cross-section upfront (like this post suggested: [Is it possible to parallelize Garfield? - #16 by Pete](https://root-forum.cern.ch/t/is-it-possible-to-parallelize-garfield/41641/16)). However, s this the equivalent of gas.LoadGasFile(‘filename.gas’)?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 17, 2021, 2:29pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/2 "2021-05-17T14:29:02Z")

</div>

Hi,  
the two methods do different things. `LoadGasFile` prepares the tables of macroscopic transport parameters (drift velocity, diffusion coefficients, Townsend coefficient, etc.) while `Initialise` prepares the table of microscopic scattering rates.

---

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 17, 2021, 10:46pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/3 "2021-05-17T22:46:58Z")

</div>

Hi,

I see. When is the gas file necessary? Like what am I missing at the moment because I am not loading a gas file?

More specifically, what happened when a gas file is not provided? How does Garfield handle that?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 18, 2021, 9:18am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/4 "2021-05-18T09:18:27Z")

</div>

Hi,  
if you are using microscopic tracking for the electrons (`AvalancheMicroscopic`), then you don’t need the gas file at all. The only consequence of not having a gas file loaded is that the tables of macroscopic electron transport parameters will be empty (but `AvalancheMicroscopic` doesn’t need and doesn’t access them).  
You do need to load a gas file if you use `AvalancheMC` or `DriftLineRKF` for simulating electron drift lines ([Gas files |&nbsp;Garfield++](https://garfieldpp.web.cern.ch/garfieldpp/examples/gasfiles/)).

---

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 18, 2021, 10:04am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/5 "2021-05-18T10:04:17Z")

</div>

Hi,

Thank you for clarifying. For my case, I use both AvalancheMicroscopic and DriftLineRKF. To simulate the avalanche, I first call AvalancheElectron() and then retrieve the coordinates of the electrons in the avalanche by calling GetElectronEndpoint(). Next, I use those coordinates as the coordinates of the ions created in the avalanche and drift them by calling DriftIon(). Can you please let me know if this is the correct way to simulate an avalanche inside of a gas medium?

Also, based on your reply, it seems I may have been simulating things incorrectly since I have not provided a gas file for the DriftLineRKF class, right?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 18, 2021, 10:19am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/6 "2021-05-18T10:19:47Z")

</div>

> [@Henry\_Billiot](#):
>
> Also, based on your reply, it seems I may have been simulating things incorrectly since I have not provided a gas file for the DriftLineRKF class, right?

No, that’s absolutely fine. For simulating ion drift lines you need indeed a table of the relevant macroscopic ion transport parameters (specifically the ion mobility), but this table is typically imported using the function `LoadIonMobility`. I guess you have a line like that in your program?

---

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 18, 2021, 10:22am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/7 "2021-05-18T10:22:41Z")

</div>

Yes! I took some values based on a paper and imported it using LoadIonMobility.

---

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 18, 2021, 10:23am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/8 "2021-05-18T10:23:47Z")

</div>

Regarding my other question on how to simulate an avalanche, should I make a different post since it does not really relate to the topic of this thread?

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 18, 2021, 11:40am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/9 "2021-05-18T11:40:00Z")

</div>

As you prefer. We can also use this thread…

---

<div class="post-metadata">

**Author:** ![Henry\_Billiot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/henry_billiot/32/25659_2.png) [@Henry\_Billiot](https://root-forum.cern.ch/u/Henry_Billiot)\
**Post date:** [May 18, 2021, 11:49am UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/10 "2021-05-18T11:49:59Z")

</div>

At the moment, here are the steps that I take to simulate the avalanche process:

1. drift the primary and secondary electrons that were created by the incident particle using AvalancheElectron()
2. grab the coordinates of the electrons that were created inside of the avalanche using GetElectronEndpoint()
3. use those coordinates as the initial position of the positive ions that were created alongside the avalanche electrons and drift them using DriftIon()

Is this the correct approach? Please let me know if the above steps are not clear.

---

<div class="post-metadata">

**Author:** ![hschindl](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/977dab/32.png) [@hschindl](https://root-forum.cern.ch/u/hschindl)\
**Post date:** [May 18, 2021, 1:39pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/11 "2021-05-18T13:39:44Z")

</div>

Yes, that’s absolutely correct.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [June 1, 2021, 1:40pm UTC](https://root-forum.cern.ch/t/gas-loadgasfile-vs-gas-initialise-true/44925/12 "2021-06-01T13:40:38Z")

</div>

Closed on June 1, 2021, 1:40pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
