Dear Rooters I am doing some analysis with hijing .But getting problem in reading file Event by event . datas are in the following form 0 79098 79098 203 204 223 20 0 11 0.268047571 -1.55888879 -1.77346098 2.50215292 -213 20 0 11 -0.664192021 -1.85106111 -2.61550784 3.35128593 -2112 20 0 1 -0.416042089 -1.45593178 -3.45689988 3.88919425 2212 20 0 1 -1.44502556 -2.73994589 -5.99282503 6.81100416 then 2nd event . How we write in the program that first event is over and now second event . I am attaching my program. please suggest me . with regrds sudhir bhardwaj /.//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void dist_shi() { ifstream in,infile; in.open("fort.11",ios::in); ofstream outfile("sum_sin_cos_phi.dat"); ofstream outfile1("sum_sin_cos_phi_charged_pions.dat"); Int_t n; Float_t a,b,c,d,P_x,P_y,P_z,E,P_t,phi,sum_cos_phi,cos_phi,sin_phi,sum_sin_phi,shi_1; c1 = new TCanvas("c1"," ",200,10,700,900); c1->SetFillColor(19); TH1F *h1 = new TH1F("h1","for photon",360,0,360); while (1){ in >> a >> b >> c >> d >> P_x >> P_y >> P_z >> E; if(!in.good()) break; //////////////////////////FOR PHOTONS////////////////////////// if(a == 22){ P_t = sqrt(P_x*P_x+P_y*P_y); cos_phi = (P_x/P_t); sin_phi=sqrt(1.0 - (cos_phi*cos_phi)); sum_sin_phi += sin_phi; sum_cos_phi += cos_phi; } outfile << sum_sin_phi<<"\t"<< sum_cos_phi << endl; Float_t sum_phi = (sum_sin_phi/sum_cos_phi); shi_1 = atan(sum_phi)*(180/3.14);//CONVERT RADIAN INTO DIGREE h1->Fill(shi_1); } h1->SetXTitle("SHI"); h1->SetYTitle("dN/dSHI"); h1->Draw(); c1->Update(); in.close(); }
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET