# What seems to be the problem with this macro for plotting data points from two arrays?

**URL:** <https://root-forum.cern.ch/t/what-seems-to-be-the-problem-with-this-macro-for-plotting-data-points-from-two-arrays/37482>\
**Category:** Newbie\
**Created:** [January 8, 2020, 4:11pm UTC](https://root-forum.cern.ch/t/what-seems-to-be-the-problem-with-this-macro-for-plotting-data-points-from-two-arrays/37482 "2020-01-08T16:11:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hep\_1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hep_1/32/21930_2.png) [@hep\_1](https://root-forum.cern.ch/u/hep_1)\
**Post date:** [January 8, 2020, 4:11pm UTC](https://root-forum.cern.ch/t/what-seems-to-be-the-problem-with-this-macro-for-plotting-data-points-from-two-arrays/37482/1 "2020-01-08T16:11:35Z")

</div>

In the macro I have attached below, what I intend to do is calculate value of pi using monte-carlo simulation for various values of “n”. Currently, I have five different values of n and it will give me five different values of pi. I want to store those values of pi in an array called Pi\_val and then plot nTotal against Pi\_val. It does not work and gives me

> Can’t call TGraph::TGraph(5,nTotal,Pi\_val) in current scope montecarloforum2.C:

Could anyone help me figure this out? I honestly think that it might be just a mistake in coding than my inability to understand ROOT TGraph or maybe both. Any help would be very much appreciated.

_ROOT Version:_ 5.34/38  
_Platform:_ Ubuntu  
_Compiler:_ Not Provided

[montecarloforum2.C](https://root-forum.cern.ch/uploads/short-url/rVMeFnbaXs4abr6up3vwIA7UP6r.C) (863 Bytes)

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 8, 2020, 4:16pm UTC](https://root-forum.cern.ch/t/what-seems-to-be-the-problem-with-this-macro-for-plotting-data-points-from-two-arrays/37482/2 "2020-01-08T16:16:36Z")

</div>

`double nTotal[5] = {100,1000,10000,100000,1000000}; //array`

---

<div class="post-metadata">

**Author:** ![hep\_1](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hep_1/32/21930_2.png) [@hep\_1](https://root-forum.cern.ch/u/hep_1)\
**Post date:** [January 8, 2020, 4:21pm UTC](https://root-forum.cern.ch/t/what-seems-to-be-the-problem-with-this-macro-for-plotting-data-points-from-two-arrays/37482/3 "2020-01-08T16:21:18Z")

</div>

@Wile_E_Coyote, oh okay, both the sets should have the same data types.
