# I want to calculate the gas gain for gem

**URL:** <https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546>\
**Category:** Garfield++\
**Tags:** root\
**Created:** [April 18, 2023, 2:18pm UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546 "2023-04-18T14:18:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ferangiz\_Ata\_Kurban](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f4b2a3/32.png) [@Ferangiz\_Ata\_Kurban](https://root-forum.cern.ch/u/Ferangiz_Ata_Kurban)\
**Post date:** [April 18, 2023, 2:18pm UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546/1 "2023-04-18T14:18:45Z")

</div>

Hello! I’m new user to Garfield++. Please tell me, I want to calculate the gas gain for gem, I have a couple of questions and clarifications.

1. To calculate the gas gain, I run the code that was given on the website ([Examples/Gem/gem.C · master · garfield / garfieldpp · GitLab](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/Gem/gem.C) ), here the primary electrons are written as: nEvents, and the sum of the number of electrons formed in the avalanche using: std::cout " " total electron: " " netot " endl; ?

2. Then I need to change the voltage at the cathode and anode  
const double width = 2.;  
comp-\> AddPlaneY(-width / 2, 0., “Cathode”);  
AddPlaneY(width / 2, 1000., “Anode”);  
comp-\>SetMagneticField(0.5, 0., 0);  
also on the gem plates above and below, in order to get the dependence of the gas gain on the voltage. Unfortunately, no matter how I change the values at the cathode and anode, the number of electrons does not change from this in any way, maybe I have an error in the code?

3. Do I understand correctly, in order to change the voltage on the gem top and bottom, also on the cathode and anode, I have to re-download the files from ansys and change the voltage there, or am I wrong?

I will be grateful for any help!

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 18, 2023, 2:26pm UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546/2 "2023-04-18T14:26:06Z")

</div>

Welcome to the ROOT forum.

I guess @hschindl can help.

---

<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:** [April 19, 2023, 8:56am UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546/3 "2023-04-19T08:56:19Z")

</div>

Hi,

1. Yes, you can calculate the gas gain by retrieving the avalanche size (`GetAvalancheSize`) for each “event” (i. e. primary electron) and filling a histogram. You could also calculate an “effective gain” by counting/histogramming the number of electrons that make it into the induction gap (for practical purposes you can limit the drift area to a few tens of micron below the lower metal).

2./3. If you are using a field map imported from a finite-element field solver, you need to re-run the field solver (e. g. Ansys) for each configuration of voltage settings that you want to simulate. `AddPlaneY` is a member function of `ComponentAnalyticField` (which is a class that you can use for calculating the two-dimensional electric field in a detector made of wires, planes and tubes); it does not affect the finite-element field map.

---

<div class="post-metadata">

**Author:** ![Ferangiz\_Ata\_Kurban](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/f/f4b2a3/32.png) [@Ferangiz\_Ata\_Kurban](https://root-forum.cern.ch/u/Ferangiz_Ata_Kurban)\
**Post date:** [April 19, 2023, 10:40am UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546/4 "2023-04-19T10:40:47Z")

</div>

Thank you very much for the answer, I will try to fix it taking into account your recommendations. I’ll let you know the results.

---

<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:** [May 3, 2023, 10:41am UTC](https://root-forum.cern.ch/t/i-want-to-calculate-the-gas-gain-for-gem/54546/5 "2023-05-03T10:41:07Z")

</div>

Closed on May 3, 2023, 10:41am UTC

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