// // exo_j2.c // // // Created by Conor McGee on 4/2/20. // #include "Riostream.h" #include "TFile.h" #include "TH1.h" #include "TH2.h" #include "TH3.h" #include "TNtuple.h" void exo_j2(const Char_t* fdata="exo_j2.txt", const Char_t* froot="exo_j2.root") { ifstream in; in.open(fdata, ios::in); Float_t x,y,z,e; Int_t nlines = 0; TFile *f = new TFile(froot); TH1F *hz = new TH1F("hz","z distribution",100,-10,10); TH2F *hy_hx = new TH2F("hy_hx","Y vs X",100,-25,25,100,-25,25); TH2F *hz_hx = new TH2F("hz_hx","Z vs X)",100,-10,10,100,-25,25); TH2F *hz_hy = new TH2F("hz_hy","Z vs X)",100,-10,10,100,-25,25); //TProfile *hxprof = new TProfile("profx"," vs X",100,-25,25); //TProfile *hyprof = new TProfile("profx"," vs X",100,-25,25); TH3F *hx_hy_hz = new TH3F("hx_hy_hz","Z vs Y vs X",100,-25,25,100,-25,25,100,-10,10); TNtuple *ntuple = new TNtuple("ntuple","data from ascii file","x:y:z:e"); while (in.good()) { in >> x >> y >> z >> e; if (in.good()) { hz->Fill(z); hy_hx->Fill(x,y); hz_hx->Fill(x,z); hz_hy->Fill(y,z); //hxprof->Fill(x,e,1); //hyprof->Fill(y,e,1); ntuple->Fill(x,y,z,e); nlines++; } }; in.close(); f->Write(); delete f; }