# How to get the time of the electrons drifting to collecting plate

**URL:** <https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482>\
**Category:** Garfield++\
**Created:** [September 26, 2023, 2:22am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482 "2023-09-26T02:22:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [September 26, 2023, 2:22am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/1 "2023-09-26T02:22:57Z")

</div>

I want to calculate the time of the electrons drifting to the collecting plate when proton passing through the gas ionization chamber, which function I should use and how to confirm the coordinates of the collecting plate because the model is imported from the ansys.

---

<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:** [September 26, 2023, 10:15am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/2 "2023-09-26T10:15:00Z")

</div>

It depends on the class that you are using for simulating the electron drift.  
With `AvalancheMicroscopic` and `AvalancheMC` you can do something like this:

```auto
for (const auto& electron : aval.GetElectrons()) {
  const auto& endPoint = electron.path.back();
  const double driftTime = endPoint.t;
}

```

See also [Examples/Gem/gem.C · master · garfield / garfieldpp · GitLab](https://gitlab.cern.ch/garfield/garfieldpp/-/blob/master/Examples/Gem/gem.C#L112)

With `DriftLineRKF` you can use the function `GetDriftTime`.

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [September 27, 2023, 3:17am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/3 "2023-09-27T03:17:04Z")

</div>

Hi,  
Thanks for your help. I have used the DriftLineRKF in my code, so I choose to use the GetDriftTime, however there must be something wrong like the code used below

```auto
 DriftLineRKF drift;
  drift.SetSensor(&sensor);
  drift.SetMaximumStepSize(0.01);
  drift.GetDriftTime();

```

I can’t get the result of the drifttime

---

<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:** [September 27, 2023, 7:08am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/4 "2023-09-27T07:08:49Z")

</div>

You first need to simulate a drift line (`drift.DriftElectron(...)`).

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [September 28, 2023, 1:53am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/5 "2023-09-28T01:53:32Z")

</div>

Thanks for your help  
I add the code like this`DriftLineRKF drift; drift.SetSensor(&sensor); drift.SetMaximumStepSize(0.01); drift.DriftElectron(-11.7, 20.42, -7.53, 0.); drift.GetDriftTime();`  
and the result is like this

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/d/9/d96b9a4c97824e99a46fa2441de368c3c24761c1.png)  
I still can’t get the result

---

<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:** [September 28, 2023, 7:47am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/6 "2023-09-28T07:47:10Z")

</div>

`GetDriftTime` returns a `double`; if you want to print out the drift time you need to do something like

```auto
std::cout << "Drift time: " << drift.GetDriftTime(); << " ns\n";

```

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [October 9, 2023, 1:24am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/7 "2023-10-09T01:24:51Z")

</div>

Hi,  
Thanks a lot for your reply and kindly help.  
I have got the results like this:  
 ![image](https://root-forum.cern.ch/uploads/default/original/3X/f/3/f3629edc879524154ee910c75fb1f63a4d222934.png)  
But the other plot shows the collecting time is nearly about 450ns to the balance

 ![image](https://root-forum.cern.ch/uploads/default/original/3X/a/6/a6212cd2e4300c3dfa1d577c24fc55262d0394db.png)  
So would you please explain the different results for me ? Thanks a lot.

---

<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:** [October 9, 2023, 5:16am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/8 "2023-10-09T05:16:55Z")

</div>

What exactly does the plot show? The signal from a single electron? Or from all electrons on a charged-particle track?

---

<div class="post-metadata">

**Author:** ![XiCheng](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/aca169/32.png) [@XiCheng](https://root-forum.cern.ch/u/XiCheng)\
**Post date:** [October 10, 2023, 6:59am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/9 "2023-10-10T06:59:40Z")

</div>

it’s the IntegrateSignals, looks like all lectrons on a charged-particle track and then normalized.

---

<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:** [October 10, 2023, 9:18am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/10 "2023-10-10T09:18:03Z")

</div>

Ok. So to what starting point does the drift time (239 ns) correspond to? If it’s for an electron that has to drift all the way through the chamber then I would indeed expect it to be identical to the duration of the signal; but maybe it’s an electron released somewhere in the middle of the gap?

---

<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:** [October 24, 2023, 9:18am UTC](https://root-forum.cern.ch/t/how-to-get-the-time-of-the-electrons-drifting-to-collecting-plate/56482/11 "2023-10-24T09:18:39Z")

</div>

Closed on October 24, 2023, 9:18am UTC

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