# Strange ion trajectory

**URL:** <https://root-forum.cern.ch/t/strange-ion-trajectory/51217>\
**Category:** Garfield++\
**Created:** [August 16, 2022, 2:44pm UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217 "2022-08-16T14:44:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [August 16, 2022, 2:44pm UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/1 "2022-08-16T14:44:49Z")

</div>

Hello,I generated some ions inside the detector, but there were some ions with strange trajectories. According to the direction of the electric field, the ions should move from the bottom of the detector to the top. But there are some ions whose trajectories are deflected and at a large angle. I’m not sure why this is, but it didn’t appear in the previous simulation results.  
The first picture shows the voltage distribution.

 ![电压分布](https://root-forum.cern.ch/uploads/default/original/3X/f/f/ff7251410ee89d884d1184ddee036060d290f787.png)  
 ![离子轨迹](https://root-forum.cern.ch/uploads/default/original/3X/3/e/3e349cb3a417daac5f720c3d700c81636ccb43f2.jpeg)

---

<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:** [August 16, 2022, 3:59pm UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/2 "2022-08-16T15:59:52Z")

</div>

Hi,  
can you provide a **minimal** working example that reproduces this issue?  
Many thanks

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [August 17, 2022, 1:14am UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/3 "2022-08-17T01:14:20Z")

</div>

ok，I uploaded my own program, thanks!  
[SW3-0.5.zip](https://root-forum.cern.ch/uploads/short-url/foBM4357sJCGjKyLVXuLpNxoJoM.zip) (7.7 KB)

---

<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:** [August 17, 2022, 7:00am UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/4 "2022-08-17T07:00:55Z")

</div>

Thanks, I’ll take a look.

But just for the record: what you sent is **not** a minimal working example. A large fraction of the lines of code in your program are commented out or not relevant for the issue you want to illustrate.

---

<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:** [August 27, 2022, 11:50am UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/5 "2022-08-27T11:50:28Z")

</div>

Sorry for the very long delay in getting back to you.

In order to fix this issue you can impose a maximum allowable step size by adding a line like this:

```auto
driftline.SetMaximumStepSize(0.02);

```

---

<div class="post-metadata">

**Author:** ![changjh12](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/cc9497/32.png) [@changjh12](https://root-forum.cern.ch/u/changjh12)\
**Post date:** [August 30, 2022, 2:53am UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/6 "2022-08-30T02:53:24Z")

</div>

Thank you very much for the suggestion, 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:** [September 13, 2022, 2:53am UTC](https://root-forum.cern.ch/t/strange-ion-trajectory/51217/7 "2022-09-13T02:53:54Z")

</div>

Closed on September 13, 2022, 2:53am UTC

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