# Some trouble in setting transfer function

**URL:** <https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414>\
**Category:** Garfield++\
**Created:** [March 31, 2022, 1:52am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414 "2022-03-31T01:52:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecc23a/32.png) [@lyp](https://root-forum.cern.ch/u/lyp)\
**Post date:** [March 31, 2022, 1:52am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/1 "2022-03-31T01:52:59Z")

</div>

Hi,everyone. I am simulating the relationship between the drift-time and position of drifttube. I set the threshold=-1 pf and output the time of ThresholdCrossings. I found that when I didn’t set the transfer fuction ,the output is normal but when I use

```auto
         double transfer(double t) {
                  constexpr double tau = 25.;
                  return (t / tau) * exp(1 - t / tau);
                  }

```

the time of ThresholdCrossings is wrong(almost hundreds ns when 1mm distance of wire). What is the reason meeting this problem.

---

<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:** [March 31, 2022, 5:34am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/2 "2022-03-31T05:34:08Z")

</div>

I think @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:** [April 3, 2022, 2:36pm UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/3 "2022-04-03T14:36:30Z")

</div>

Apologies for the late response. I’m not 100% sure I understand the question.  
Can you provide a minimal working example illustrating what you mean? In particular, what do you compare to when you say that the threshold crossing times after convoluting with the transfer function are wrong?

---

<div class="post-metadata">

**Author:** ![lyp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecc23a/32.png) [@lyp](https://root-forum.cern.ch/u/lyp)\
**Post date:** [April 6, 2022, 12:44am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/4 "2022-04-06T00:44:15Z")

</div>

Hello, I might haven’t expressed my question explicitly, sorry.  
I should better deliver you my source file.Here is my code with transfer function.  
[set\_transfer\_function.C](https://root-forum.cern.ch/uploads/short-url/gOc9nOOY0VUvVxHOsdrxkJNsEHu.C) (3.7 KB)

And then here is the output, which is obvious wrong. The threshold-crossing time couldn’t be so long when the muon passes through the center of the tube (the wire position)

 ![2022-04-06 08-37-41 的屏幕截图](https://root-forum.cern.ch/uploads/default/original/3X/e/5/e549ff73347ba6fdf4984ec53cb1b5975281722a.png)

When I Annotate the transfer function  
[unset\_transfer\_function.C](https://root-forum.cern.ch/uploads/short-url/b7IhRxbqNLFi3nNfxgpeASCfU0.C) (3.7 KB)

the output is like here

 ![2022-04-06 08-41-22 的屏幕截图](https://root-forum.cern.ch/uploads/default/original/3X/a/0/a0237e8da3dd52d127f932e2ac8c9720f6751c27.png)

Although the program output a warning, the drift\_time is reasonable.

---

<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:** [April 6, 2022, 10:00am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/5 "2022-04-06T10:00:44Z")

</div>

If you don’t call `IntegrateSignals` or `ConvoluteSignals` the signal calculated by your program is the induced current in units of fC / ns (μA). Calculating threshold crossings is probably not very meaningful in this case (hence the warning).

But to answer your question: there are two threshold crossings in your case, one at the rising edge of your signal and one at the falling edge. I don’t recall why it’s numbered this way, but the one you are looking at (the one with index `i = 0`) is the “falling” one. To get the rising one, take the one with index `i = 1`:

```auto
unsigned int i = 1; 
double time, level;
bool rise;
sensor.GetThresholdCrossing(i, time, level, rise);

```

---

<div class="post-metadata">

**Author:** ![lyp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecc23a/32.png) [@lyp](https://root-forum.cern.ch/u/lyp)\
**Post date:** [April 7, 2022, 2:32am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/6 "2022-04-07T02:32:12Z")

</div>

So,you mean the wire produce a current signal, and I should use transfer function to convert it a charge signal? I have little knowledge about circuit, what is transfer function exactly？

Actually, my teacher tell me when induced current arrive the preamp’s resistor, it will produce a voltage signal, and we use threshold 60mv to get the crossing-time in practical. We get the shape of signal is also in unit of voltage. I am not sure what transfer fuction used in this proceduce… How should i simulate my practical experiment?

---

<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:** [April 7, 2022, 5:07am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/7 "2022-04-07T05:07:50Z")

</div>

If you want to apply a threshold in mV to the convoluted signal in Garfield++ you need to know the conversion factor from charge (fC) to voltage (mV) of your amplifier.  
You can either include this factor in your transfer function or you convert the 60 mV threshold to a charge (fC).

---

<div class="post-metadata">

**Author:** ![lyp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecc23a/32.png) [@lyp](https://root-forum.cern.ch/u/lyp)\
**Post date:** [April 7, 2022, 6:01am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/8 "2022-04-07T06:01:12Z")

</div>

OK. One more question, for one gas, when i increase the pressure, the voltage should also increase, and whether the gas gain change? Should i use SetGainFluctuationsPolya() to set a new value?

---

<div class="post-metadata">

**Author:** ![lyp](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/ecc23a/32.png) [@lyp](https://root-forum.cern.ch/u/lyp)\
**Post date:** [April 7, 2022, 6:57am UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/9 "2022-04-07T06:57:43Z")

</div>

Sir, It seems 60mV convert to 60fC, I should integrate the induced current and then use 60fC as a threshold, is it right? By the way, in which situation the transfer functions should be used?

---

<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:** [April 7, 2022, 12:26pm UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/10 "2022-04-07T12:26:44Z")

</div>

The transfer function represents the response of your front-end electronics to a delta pulse. By convoluting the induced current with the transfer function you obtain the signal at the output of your front-end electronics.

---

<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:** [April 21, 2022, 12:27pm UTC](https://root-forum.cern.ch/t/some-trouble-in-setting-transfer-function/49414/11 "2022-04-21T12:27:23Z")

</div>

Closed on April 21, 2022, 12:27pm UTC

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