Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:27

0001 void ReadASCII(TString source_file_ascii, TString output_file_root)
0002 {
0003 
0004 // This macro converts the results of the simulation stored in ASCII files to ROOT files. 
0005   ifstream in;
0006   in.open(source_file_ascii);
0007 
0008   Float_t x,y,z, edep;
0009   Int_t nlines = 0;
0010   TFile *f = new TFile(output_file_root,"RECREATE");
0011   TH2F *h20 = new TH2F("h20","h20",801,-100.125,100.125, 801, -100.125, 100.125);
0012 
0013    while (1) {
0014       in >> x >> y >> z >> edep;
0015       if (!in.good()) break;
0016     //  if (edep !=0.) printf("x=%8f, y=%8f, edep=%8f\n",x,y,edep);
0017 
0018       h20->Fill(x,y,edep);
0019       nlines++;
0020    }
0021    printf(" found %d points\n",nlines);
0022 
0023    in.close();
0024 
0025    f->Write();
0026 }