#include <TSystem.h>
#include <TProfile.h>
#include <TBrowser.h>
#include <TROOT.h>
#include <TGraph.h>
#include <TNtuple.h>
#include <TString.h>
#include <TH1D.h>
#include <TFile.h>
#include <TH1D.h>
#include <TF1.h>
#include <TMath.h>
#include <TH2D.h>
#include <TCanvas.h>
#include <TLegend.h>
#include <TStyle.h>
#include <TLatex.h>
#include <TInterpreter.h>
#include <TGraphAsymmErrors.h>
#include <TGraphErrors.h>
void readTxT() {
TFile *pfOutput; ifstream in; in.open("example.txt"); pfOutput = new TFile("out.root","RECREATE"); cout<<"!!!!!!!!!!!Got the input files!!!!"<<endl; double x[18]; double aaa[300], bbb[300], ccc[300], ddd[300]; int nline = 0;
TH1F *hTest = new TH1F("hTest",";Temp;A.U",1000, 0, 10000);
string tmpstring; getline(in,tmpstring); getline(in,tmpstring); if( !in.good() ) cout<< "!!!!! You have a problem, the input file is not good" <<endl; while (in.good()) { in >> x[0] >> x[1] >> x[2] >> x[3] >> x[4] >> x[5] >> x[6] >> x[7] >> x[8] ; aaa[nline] = x[0]; bbb[nline] = x[1]; ccc[nline] = x[2]; ddd[nline] = x[3]; cout<<"nline= "<<nline<<" y= " <<x[0] <<"-"<< x[1] << "\t pt= "<<x[2] <<"-"<<x[3] <<endl; hTest->Fill(x[0]); nline++; }// while printf(" found %d points\n",nline); cout<<"####### Done reading the input dat file!"<<endl; pfOutput->cd();
TH1::SetDefaultSumw2();
hTest->Write();
in.close(); pfOutput->Write(); cout<<"####### Wrote hists to file, and closed file! Good luck!"<<endl;
}