# Is it right for getting the gas gain?

**URL:** <https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045>\
**Category:** Garfield++\
**Created:** [April 18, 2024, 5:49am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045 "2024-04-18T05:49:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![newconcept1979](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/newconcept1979/32/26349_2.png) [@newconcept1979](https://root-forum.cern.ch/u/newconcept1979)\
**Post date:** [April 18, 2024, 5:49am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/1 "2024-04-18T05:49:14Z")

</div>

The key codes are:

```auto
  int ElectronNumber=0;
 
    aval.AddElectron(0.3,0.3,0,0,1.); 

  if(!aval.GetElectrons().empty())
    {
      aval.ResumeAvalanche();
     for(const auto& electron:aval.GetElectrons())
      {
        ElectronNumber+=1;
      }     
    }

```

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [April 18, 2024, 6:37am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/2 "2024-04-18T06:37:10Z")

</div>

Dear @newconcept1979,

Instead of aval.AddElectron you should use aval.AvalancheElectron. In addition you can retrieve the resulting avalanche size using aval.GetAvalancheSize.

Kind regards,

Djunes

---

<div class="post-metadata">

**Author:** ![newconcept1979](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/newconcept1979/32/26349_2.png) [@newconcept1979](https://root-forum.cern.ch/u/newconcept1979)\
**Post date:** [April 18, 2024, 7:44am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/3 "2024-04-18T07:44:19Z")

</div>

@djjansse , the electron by code aval.AvalancheElectron was used as a projectile, and the result by aval.GetAvalancheSize(ni,ne) is same as mine.

---

<div class="post-metadata">

**Author:** ![djjansse](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/d/8baadc/32.png) [@djjansse](https://root-forum.cern.ch/u/djjansse)\
**Post date:** [April 18, 2024, 1:25pm UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/4 "2024-04-18T13:25:21Z")

</div>

Hi @newconcept1979,

Then it workings as intended 🙂

Kind regards,

Djunes

---

<div class="post-metadata">

**Author:** ![newconcept1979](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/newconcept1979/32/26349_2.png) [@newconcept1979](https://root-forum.cern.ch/u/newconcept1979)\
**Post date:** [April 19, 2024, 7:03am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/5 "2024-04-19T07:03:24Z")

</div>

The weird gas gain was obtained when revised the example “/Garfield/Examples/DriftTube” with this solution, the results are:

* * *

Potential Gain  
2730 661  
2830 1468  
2930 1348  
3030 1  
3130 820  
3230 1  
3330 1046  
3430 672  
3530 1  
3630 656

* * *

what are the probable reasons?

---

<div class="post-metadata">

**Author:** ![Piet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/piet/32/12536_2.png) [@Piet](https://root-forum.cern.ch/u/Piet)\
**Post date:** [April 19, 2024, 7:20am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/6 "2024-04-19T07:20:53Z")

</div>

Dear @newconcept1979  
The gain is subject to fluctuations and cannot be evaluated based on a single event. You can only draw conclusions from distributions. So run the simulation 1000 times for each potential point and make a distribution of the gain. What we consider gain at that point is the average or most probable value of that distribution. If in individual cases you see gain is 1 then that means that your electron has been attached. You could have found this out by making an event display yourself.  
Kind regards  
Piet

---

<div class="post-metadata">

**Author:** ![newconcept1979](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/newconcept1979/32/26349_2.png) [@newconcept1979](https://root-forum.cern.ch/u/newconcept1979)\
**Post date:** [April 19, 2024, 7:23am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/7 "2024-04-19T07:23:42Z")

</div>

@Piet , thank you, i will try!

---

<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, 2024, 7:24am UTC](https://root-forum.cern.ch/t/is-it-right-for-getting-the-gas-gain/59045/8 "2024-05-03T07:24:12Z")

</div>

Closed on May 3, 2024, 7:24am UTC

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