# About AddWhiteNoise() not working

**URL:** <https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986>\
**Category:** Garfield++\
**Created:** [November 4, 2023, 3:16am UTC](https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986 "2023-11-04T03:16:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hua-Zhen\_Li](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hua-zhen_li/32/27088_2.png) [@Hua-Zhen\_Li](https://root-forum.cern.ch/u/Hua-Zhen_Li)\
**Post date:** [November 4, 2023, 3:16am UTC](https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986/1 "2023-11-04T03:16:38Z")

</div>

Hi experts,

I have a question about AddWhiteNoise() function. In my code I am trying to add a white noise to the induced current signal of sense wire in a diamond detector. The core code is like this:

for (const auto& cluster : track.GetClusters()) {  
++nc;  
nesum += cluster.electrons.size();  
drift.DisablePlotting();

```
  for (const auto& electron : cluster.electrons) {
    drift.DriftElectron(electron.x, electron.y, electron.z, electron.t);
  }
  for (const auto& hole : cluster.ions) {
    drift.DriftHole(hole.x, hole.y, hole.z, hole.t);
  }
}
std::cout << nesum << " electrons, " 
          << nesum * ElementaryCharge << " fC.\n";

sensor.AddWhiteNoise("sign",100.,true,1.0);
//sensor.ConvoluteSignals();

outfile << "x0 = " << x0 << " " << "y0 = " << y0 <<"\n";
outfile << " ********************************************" << "\n";

```

I didn’t convolute the signal with transfer function, and I hope to see some fuzzing shape in the signal… but I didn’t, here is the signal I got, it is smooth, and I tried to change ENC and q0, also not working.

 ![signal](https://root-forum.cern.ch/uploads/default/original/3X/5/a/5a9a25818ba91b143863413ff316626a35dabc83.png)  
Do you know what could be wrong with it?

Thanks!  
Huazhen

---

<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:** [November 6, 2023, 6:14am UTC](https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986/2 "2023-11-06T06:14:09Z")

</div>

Hi,  
`AddWhiteNoise` calculates the frequency with which it adds noise pulses to the induced current such that it reproduces a given RMS equivalent-noise charge after convoluting the induced current with the transfer function. So you indeed need to specify a transfer function first.

---

<div class="post-metadata">

**Author:** ![Hua-Zhen\_Li](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hua-zhen_li/32/27088_2.png) [@Hua-Zhen\_Li](https://root-forum.cern.ch/u/Hua-Zhen_Li)\
**Post date:** [November 7, 2023, 1:56pm UTC](https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986/3 "2023-11-07T13:56:07Z")

</div>

Hi,

Thank you so much for help. It works after I set the transfer function first. The add-noise function is really convenient.

Cheers  
Huazhen

---

<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:** [November 21, 2023, 1:56pm UTC](https://root-forum.cern.ch/t/about-addwhitenoise-not-working/56986/4 "2023-11-21T13:56:49Z")

</div>

Closed on November 21, 2023, 1:56pm UTC

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