#include #include #include #include "TObject.h" #include "TROOT.h" #include "TCanvas.h" #include "TSystem.h" #include "TFile.h" #include "TString.h" #include "TTree.h" #include "TBranch.h" #include "TH1F.h" #include "TH2F.h" #include "RootInput.h" #include "TH1D.h" #include "Riostream.h" using namespace std; void gs_data(){ Float_t dE_a1,dE_a2,dE_p,E_p,E_a1,E_a2,totE_a1,totE_a2,totE_p,Th_a1,Th_a2,Th_p; Int_t EventNbr; ifstream in; in.open(Form("gs_out.txt")); TFile *file = new TFile("gs_data.root","RECREATE"); TTree *tree = new TTree("tree","gs_data"); tree->Branch("EventNbr",&EventNbr,"EventNbr/I"); tree->Branch("dE_a1",&dE_a1,"dE_a1/F"); tree->Branch("dE_a2",&dE_a2,"dE_a2/F"); tree->Branch("dE_p",&dE_a2,"dE_p/F"); tree->Branch("E_a1",&E_a1,"E_a1/F"); tree->Branch("E_a2",&E_a2,"E_a2/F"); tree->Branch("E_p",&E_a2,"E_p/F"); tree->Branch("totE_a1",&totE_a1,"totE_a1/F"); tree->Branch("totE_a2",&totE_a2,"totE_a2/F"); tree->Branch("totE_p",&totE_a2,"totE_p/F"); tree->Branch("Th_a1",&Th_a1,"Th_a1/F"); tree->Branch("Th_a2",&Th_a2,"Th_a2/F"); tree->Branch("Th_p",&Th_a2,"Th_p/F"); while(1) { in >> EventNbr>>dE_a1>>E_a1>>totE_a1>>Th_a1>>dE_a2>>E_a2>>totE_a2>>Th_a2>>dE_p>>E_p>>totE_p>>Th_p; if (!in.good()) break; tree->Fill(); } in.close(); file->Write(); }