
please wait
vector< vector<double> > v1, v2;
created inside a function, I want to return these two vectors as something like this:
|
|
|
|
x, y, eror_x, error_y
from a function, so I did:
|
|
func()
returns me an array of four vectors and I can use them in my main
.
vector etc func(a,b,c,d)
is supposed to be doing and the nature of the parameters you are passing to it, I suggest you might not need vectors at all.TGraph
a ROOT object which accepts vectors as it's input parameters. There are 5 input parameters, size of the vector (in our case number of bins), the x-data, y-data, x-error and y-error, and they all must be c++ vectors. I could create those vectors separately but I needed to create a function and save it in a header that always return me those four vectors that I will need often.
|
|
|
|
|
|
|
|
10 -0.22 0.05 0.25 0.35 0.5 0.61 0.7 0.85 0.89 0.95 1 2.9 5.6 7.4 9 9.6 8.7 6.3 4.5 1 0.05 0.1 0.07 0.07 0.04 0.05 0.06 0.07 0.08 0.05 0.8 0.7 0.6 0.5 0.4 0.4 0.5 0.6 0.7 0.8 |
*** GET VECTORS FROM AN ARRAY *** Vector[0]: 10 Vector[1]: -0.22 0.05 0.25 0.35 0.5 0.61 0.7 0.85 0.89 0.95 Vector[2]: 1 2.9 5.6 7.4 9 9.6 8.7 6.3 4.5 1 Vector[3]: 0.05 0.1 0.07 0.07 0.04 0.05 0.06 0.07 0.08 0.05 Vector[4]: 0.8 0.7 0.6 0.5 0.4 0.4 0.5 0.6 0.7 0.8 *** GET VECTORS FROM A FILE *** Vector[0]: 10 Vector[1]: -0.22 0.05 0.25 0.35 0.5 0.61 0.7 0.85 0.89 0.95 Vector[2]: 1 2.9 5.6 7.4 9 9.6 8.7 6.3 4.5 1 Vector[3]: 0.05 0.1 0.07 0.07 0.04 0.05 0.06 0.07 0.08 0.05 Vector[4]: 0.8 0.7 0.6 0.5 0.4 0.4 0.5 0.6 0.7 0.8 Program ended with exit code: 0 |