Question about signal function arguments

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);

Hi! Maybe @hschindl can help with this question?

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.

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

Yes, they should be the same.

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.