LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
convert.C
Go to the documentation of this file.
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 }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
TFile f
Definition: plotHisto.C:6
nlines
printf("%d Experimental points found\n", nlines)
void ReadASCII(TString source_file_ascii, TString output_file_root)
Definition: convert.C:1
Double_t edep
Definition: macro.C:13
ifstream in
Definition: comparison.C:7
TH1F * h20
Definition: plot.C:45