Sum all the data from a GetV1()

Dear all,

I have Tree (Sampler0) and I would like to sum all the data from a branch (E).
I do :
int n = Sampler0->Draw(“E”,“E>0”);
double *b = Sampler0->GetV1();
and I can make a loop on b to sum all the elements.
My question is : is there a way to retrieve from GetV1() a std::vector to be able to
use accumulate function ?

By advance thank you
cheers
Olivier

Hi,

In this case, there is a simpler solution by using the generated histogram,:int n = Sampler0->Draw("E","E>0"); double sum = htemp->GetMean() * htemp->GetEntries();.

Cheers,
Philippe.

Hi Philippe,

this is a very elegant and simple way to proceed. =D>
Thanks you very much
cheers
Olivier