ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
convert.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file convert.C
1 void ReadASCII(TString source_file_ascii, TString output_file_root)
2 {
3 
4 // This macro converts the results of the simulation stored in ASCII files to ROOT files.
5  ifstream in;
6  in.open(source_file_ascii);
7 
8  Float_t x,y,z, edep;
9  Int_t nlines = 0;
10  TFile *f = new TFile(output_file_root,"RECREATE");
11  TH2F *h20 = new TH2F("h20","h20",801,-100.125,100.125, 801, -100.125, 100.125);
12 
13  while (1) {
14  in >> x >> y >> z >> edep;
15  if (!in.good()) break;
16  // if (edep !=0.) printf("x=%8f, y=%8f, edep=%8f\n",x,y,edep);
17 
18  h20->Fill(x,y,edep);
19  nlines++;
20  }
21  printf(" found %d points\n",nlines);
22 
23  in.close();
24 
25  f->Write();
26 }