# ROOT Convolution with .txt file of data values

**URL:** <https://root-forum.cern.ch/t/root-convolution-with-txt-file-of-data-values/47842>\
**Category:** Newbie\
**Created:** [November 27, 2021, 6:17am UTC](https://root-forum.cern.ch/t/root-convolution-with-txt-file-of-data-values/47842 "2021-11-27T06:17:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![obitter16](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/obitter16/32/26442_2.png) [@obitter16](https://root-forum.cern.ch/u/obitter16)\
**Post date:** [November 27, 2021, 6:17am UTC](https://root-forum.cern.ch/t/root-convolution-with-txt-file-of-data-values/47842/1 "2021-11-27T06:17:53Z")

</div>

Dear Experts,

I am new to using a lot of the functions in ROOT and I’m having trouble performing a convolution of a graph generated from a .txt file with a Gaussian. I looked up and checked the ROOT tutorial:  
fitConvolution.C, but I’m a little confused about how to substitute my graph for the exponential in said example. Maybe I’m missing something but I don’t know what it would be. Any help or advice would be greatly appreciated. Thank you!

_ROOT Version:_ 6.14/04  
Built for macosx64  
From tags/v6-14-04@v6-14-04  
(I use MacBookAir.)

---

<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:** [November 29, 2021, 6:28am UTC](https://root-forum.cern.ch/t/root-convolution-with-txt-file-of-data-values/47842/2 "2021-11-29T06:28:48Z")

</div>

> [@obitter16](#):
>
> fitConvolution.C

I think @moneta can help.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [December 3, 2021, 10:10am UTC](https://root-forum.cern.ch/t/root-convolution-with-txt-file-of-data-values/47842/3 "2021-12-03T10:10:13Z")

</div>

Hi,  
The code shown in the tutorial works for a function describing your true signal. You can easily create a TF1 from a TGraph as in the example code I attached here

[test\_GraphConv.C](https://root-forum.cern.ch/uploads/short-url/s4TYQK3HzG2lyOIRbEIAIbMpXA.C) (621 Bytes)

Cheers

Lorenzo
