Re: read file from ASCII file with vector

From: Axel Naumann <>
Date: Wed, 03 May 2006 11:45:32 +0200


a vector's elements have to be consecutive in memory; you can convert

std::vector<Double_t> values;
Double_t* pValues = &(values[0]);

and pass that pValues to the TGraphErrors constructor. Cheers, Axel.

Marco Calviani wrote:
> Hi rooters,
> i've tried to build a small C++ macro to read data from an ASCII
> file to be later used to build a TGraphErrors. I've decided to use
> vector object insted of the traditional array because vector objects
> can grow dynamically un size at runtime while traditional array have a
> fixed size.
> The data are correctly read by the macro but TGraphErrors is not able
> to accept a vector as a input. I've seen that it could accept
> TVectorT: how is it possible (and if) to transform a vector into a
> TVectorT?
> Regards,
> Marco
Received on Wed May 03 2006 - 11:45:37 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:58 MET