# About Avalanche Settings in Garfield++

**URL:** <https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316>\
**Category:** Garfield++\
**Created:** [June 15, 2023, 3:59pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316 "2023-06-15T15:59:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hua-Zhen\_Li](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hua-zhen_li/32/27088_2.png) [@Hua-Zhen\_Li](https://root-forum.cern.ch/u/Hua-Zhen_Li)\
**Post date:** [June 15, 2023, 3:59pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/1 "2023-06-15T15:59:09Z")

</div>

Hi experts,

Recently I am trying to using Garfield++ to simulate a diamond detector response to an incident pion. I came across some confusing things while using AvalancheMC to simulate the avalanche generation. Here is the core part of my code:

```
for (const auto& cluster : track.GetClusters()) {
  ++nc;
  nesum += cluster.electrons.size();
  for (const auto& electron : cluster.electrons) {
    drift.DriftElectron(electron.x, electron.y, electron.z, electron.t);
    drift.AvalancheElectron(electron.x, electron.y, electron.z, electron.t, true);
  }
  for (const auto& hole : cluster.ions) {
    drift.DriftHole(hole.x, hole.y, hole.z, hole.t);
    drift.AvalancheHole(hole.x, hole.y, hole.z, hole.t, true);
  }
}

```

So I want to simulate the whole process after the pion pass through the detector, including the drift and diffusion of electrons and holes generated by incident pion, and also the secondary electrons and holes from avalanche generation, then get the signal (induced current).

My questions are:

1. Is this part of the code written correctly? It seems that with or without the “drift.AvalancheElectron” and “drift.AvalancheHole” lines, the induced currents are really different. (the one with avalanche rows is 2~3 times higher) which should not be with such a difference…
2. How does the AvalancheElectron simulate the Avalanche generation of carriers exactly, and how to control it? I have a avalanche simulation result from sentaurus TCAD and it uses Chynoweth’s equation for avalanche calculation, the results are quite different… I am trying to understander the reason…

Thank you very much for your time!

Huazhen

---

<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:** [June 15, 2023, 4:05pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/2 "2023-06-15T16:05:39Z")

</div>

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:** [June 16, 2023, 5:24am UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/3 "2023-06-16T05:24:58Z")

</div>

To simulate an avalanche from every electron-hole pair produced along the track you can do something like this

```auto
for (const auto& cluster : track.GetClusters()) {
  ++nc;
  nesum += cluster.electrons.size();
  for (const auto& electron : cluster.electrons) {
    drift.AvalancheElectronHole(electron.x, electron.y, electron.z, electron.t, true);
  }
}

```

For diamond, impact ionisation is not taken into account at the moment. Do you have an expression for the impact ionisation coefficients αe, αh? If yes, it should be straightforward to implement them in `MediumDiamond`.

---

<div class="post-metadata">

**Author:** ![Hua-Zhen\_Li](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hua-zhen_li/32/27088_2.png) [@Hua-Zhen\_Li](https://root-forum.cern.ch/u/Hua-Zhen_Li)\
**Post date:** [June 16, 2023, 3:46pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/5 "2023-06-16T15:46:10Z")

</div>

Hi,

Thanks for your reply, that’s really helpful!

Yes, I have an expression for alpha\_e and alpha\_h, and I guess I need to use the SetElectronTownsend() and SetHoleTownsend() functions to implement them? And here the input “alpha” in SetElectronTownsend(ie, ib, ia, alpha) is actually the natural log value of ionisation coefficients with a unit cm^(-1), is that correct?

Cheers  
Huazhen

---

<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:** [June 17, 2023, 1:48pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/6 "2023-06-17T13:48:41Z")

</div>

Hi,  
if you have an analytic expression for alpha\_e and alpha\_h it’s probably easier to implement them directly in `MediumDiamond`. Can you post the expressions? And ideally the source from where you got the expression?

---

<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:** [July 1, 2023, 1:49pm UTC](https://root-forum.cern.ch/t/about-avalanche-settings-in-garfield/55316/7 "2023-07-01T13:49:10Z")

</div>

Closed on July 1, 2023, 1:49pm UTC

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