{ // ROOT/CINT includes some headerfiles automatically. //#include ifstream in("a.dat"); Int_t maxevent = 100000; Char_t dummy[1024]; Int_t counterID; Double_t x[maxevent], y[maxevent], z[maxevent]; Double_t edep[maxevent], time[maxevent]; Int_t nhits = 0; while (in >> dummy) { if (strncmp(dummy, "COUNTER:", 8) == 0) { in >> counterID >> x[nhits] >> y[nhits] >> z[nhits] >> time[nhits]; } else if (strncmp(dummy, "CAL:", 4) == 0) { in >> edep[nhits]; nhits++; if (nhits % 100 == 0) { cerr << " === " << nhits << " events finished === " << endl; } } } in.close(); // create and open a canvas TCanvas *c1 = new TCanvas( "c1", "edep", 10, 10, 800, 400 ); c1->Divide(2,1); // create histgrams TH1D *hedep = new TH1D("hedep", "Energy_Deposit", 201, 0., 200.); TH1D *htime = new TH1D("htime", "TOF", 21, 0.64, 0.66); // fill points for (Int_t i=0; iFill(edep[i]); htime->Fill(time[i]); } // Draw hist c1->cd(1); // The ID of devided canvas start from 1 hedep->Draw(); c1->cd(2); htime->Draw(); }