Hello,
I’m trying to create multiple graphs from one data file. Data is in form
time amplitude
…
2e-010,0.653698
4e-010,0.650884
6e-010,0.645658
8e-010,0.644854
1e-009,0.649276
1.2e-009,0.653296
1.4e-009,0.65008
1.6e-009,0.64204
1.8e-009,0.637216
2e-009,0.64003
…
I succesfully created code that creates a Graph for first 50 pairs (time,amplitude). Every 50 steps there is a new series for total 20 series (1000 lines). My code for one series is:
{
double t[50];/* there are 50 points for each series*/
double v[50];
int N = 50;
int count = 0;/when it’s 50 I have all points in the series/
int series = 0;/*there are 20 series */
TGraph *grpreamp = new TGraph();
fstream file;
file.open(“hg_preamp_mod.txt”,ios::in);
//while (!file.eof())
while (series<1) /* checking for one series*/
{
series++;
cout << series;
while(count < N )
{
double t,v;
file >> t >> v;
grpreamp->SetPoint(grpreamp->GetN(),t,v);
count++;
if (file.eof()) break;
}
count = 0;
}
file.close();
grpreamp->SetTitle(“PlaceHolder”);
grpreamp->SetMarkerStyle(3);
grpreamp->SetMarkerSize(1);
grpreamp->Draw(“APC”);
}
I want to create 20 separate graphs and save them all separately (not shown in 1 canvas). Is there a way to code it in a few lines?
Thanks,
Gabe