Hello
My root program is not able to read a text file of 1 GB (about 145000 lines). Is there any way of reading such large files? My code is given below:
#include "TAxis.h"
#include "TH2.h"
#include "TStyle.h"
#include "TCanvas.h"
#include "TNtupleD.h"
#include <stdio.h>
#include <stdlib.h>
#include <vector.h>
analyse(){
TFile *temp=new TFile("analyse.root", "RECREATE");
ntuple = new TNtuple("ntuple","NTUPLE","p:px:py:pz:x:y:z");
ifstream fromfile("pions05.txt");
double p,xp,yp,zp,x0,y0,z0;
char rubish[20],usefull[20];;
// for (Int_t i=0; i<=100000000; i++){
while (!fromfile.eof()) {
fromfile>>rubish>>rubish>>p>>rubish>>rubish>>xp>>rubish>>rubish>>yp>>rubish>>rubish>>zp>>rubish>>rubish>>x0>>rubish>>rubish>>y0>>rubish>>rubish>>z0;
ntuple->Fill(p,xp,yp,zp,x0,y0,z0);
}
TCanvas *c1_2 = new TCanvas("c1_2","momentum background",200,200,500,500);
ntuple->Draw("p");
temp->Write();
}
Thank you
Adriana