Hi all,
I am trying to store obtained values into an array, for this I thought it’s better to use vector, however when I call it, just to check - cout << digitArray[0] << endl; I get “-nan” output. The value I want to fill this array with is there and is “double_t” .
So, I am doing following. I am filling two histograms and taking the fraction of their integrals, then I have a number and I want to store that number in an array (or vector). Why isn’t my solution working?..
Thanks @yus! It worked perfectly fine! So, now if I want to build a TGraph with these numbers, I can’t do it since I used a vector, not an array, right? Or is it possible to build TGraph from vector entries?
std::vector<double> x = {...};
std::vector<double> y = {...};
assert(x.size() == y.size() && "x and y vectors must have the same size!");
TGraph g(TGraph(x.size(),&x[0],&y[0]);
Hi,
Thanks for your reply. This will build TGraph with only first numbers of the vector, right ? How can I make so that it builds with all numbers in the vector?
I tried something like : for(Double_t x : myFirstVec && Double_t y : mySecondVec) {
TGraph g(TGraph(x.size(), x, y);
}
but well, it does not really work. Since i cannot draw it outside the for loop