# Question about signal function arguments

**URL:** <https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786>\
**Category:** Garfield++\
**Created:** [June 23, 2025, 1:43pm UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786 "2025-06-23T13:43:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carored](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e95f7d/32.png) [@carored](https://root-forum.cern.ch/u/carored)\
**Post date:** [June 23, 2025, 1:43pm UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/1 "2025-06-23T13:43:51Z")

</div>

Hi! I’m fairly new to Garfield++. I’ve been working with some previously written code, but haven’t been able to find much documentation on what arguments are used in these two functions, (sensor.ComputeThresholdCrossings & sensor.GetThresholdCrossing) as well as units of each argument. Thanks!

`sensor.ConvoluteSignals(); int nt = 0; if (!sensor.ComputeThresholdCrossings(-2., "s", nt)) continue;`

```
double drift_time = 0., level = -1;
bool rise = 0;
sensor.GetThresholdCrossing(0, drift_time, level, rise);

```

---

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [June 24, 2025, 7:40am UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/2 "2025-06-24T07:40:42Z")

</div>

Hi! Maybe @hschindl can help with this question?

---

<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:** [June 24, 2025, 1:22pm UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/3 "2025-06-24T13:22:42Z")

</div>

Dear @carored

`sensor.ConvoluteSignals();` is covered in the userguide. it allows you to convolute the signal as picked up by the readout electrode with a transferfunction of your readout electronics.

`sensor.ComputeThresholdCrossings(thr, "s", nt)` computes the threshold crossings (kept in internal memory) for the signal on readout electrode `"s"` for a threshold `thr` (standard unit fC/ns). After calling this function you can print out `nt`, which gives you the number of threshold crossings. Readout electrode `"s"` should have been added earlier by `sensor.AddElectrode(&cmp, "s")`.

`sensor.GetThresholdCrossing(i,time, level, rise)` allows you to get the time (in ns) of the `i`-th threshold crossing. `rise` will tell you whether it is rising-edge or falling-edge. `level` will tell you again what was the threshold you set (fC/ns).

If you would like to work with integrated charge (fC), and not with instantaneous current (fC/ns), then you have to integrate your signal over time, which you can do with this function: `sensor.IntegrateSignal("s")`, to be called before you call `ComputeThresholdCrossings`.

---

<div class="post-metadata">

**Author:** ![carored](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/c/e95f7d/32.png) [@carored](https://root-forum.cern.ch/u/carored)\
**Post date:** [June 26, 2025, 8:59pm UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/4 "2025-06-26T20:59:30Z")

</div>

So, should “level” and “thr” be input as the same value? In other words, are they representing the same thing?

---

<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 27, 2025, 5:04am UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/5 "2025-06-27T05:04:11Z")

</div>

Yes, they should be the same.

---

<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:** [July 1, 2025, 9:21am UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/6 "2025-07-01T09:21:37Z")

</div>

As far as I understood:  
in `sensor.ComputeThresholdCrossings(thr, "s", nt)` you _set_ the threshold, while in `sensor.GetThresholdCrossing(i,time, level, rise)` you _obtain_ the threshold. In the latter case you just give an empty `double level` as argument, and it should give you back your original `thr`.

---

<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 15, 2025, 9:22am UTC](https://root-forum.cern.ch/t/question-about-signal-function-arguments/63786/7 "2025-07-15T09:22:13Z")

</div>

Closed on July 15, 2025, 9:22am UTC

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