How can to print correctly

Dear ROOTers,
How can correct my mistakes in my program.It hasn’t compiled correctly.

{ 
  # define CHARGE 3       
  # define THETA1  10 
  # define THETA2  180  
  FILE *fp=fopen("probability1.data","w");
  long int step;
    int Z;
  Z=CHARGE;
  double P_{i},P_{j},v_{i},v1,v2,g,v3,v4,x,y;
  g=0.5418e-08;
   x=sin(THETA1);
   y=sin(THETA2 );
  ifstream in("vel_spec1.data");   
  for ( step=0;step<250000;step++) {
       in>>v1>>v2
       v_{i}=v1;     
      P_{i}=g*(x**2-y**2)*Z*(1./v_{i})**4;  
      P1=P1+P_{i};
     fprintf(fp,"%.4f\n",P_{i});
 }   
   ifstream in("vel_spec2.data")   
   for (step=0;step<250000;step++) {
        in>>v3>>v4;
        v_{j}=v3
        P_{j}=g*(x**2-y**2)*Z*(1./v_{j})**4;
        P2=P2+P_{j};
         fprintf(fp,"\n%.4f\n",P_{j});
}
    fclose(fp);
    printf("%.4f",2*(P1+P2));
}
I took group of v1,v2,v3,v4 into this:

{
TCanvas *c1=new TCanvas(“c1”,"",100,100,600,800);
c1->Divide(1,2);
c1->cd(1);
gPad->SetFillColor(42);
gPad->SetFrameFillColor(33);
TH2F *h = new TH2F(“h”,“Spectrum of velocity”,100,0.7,1.7,100,0.7,1.7);
FILE *fp=fopen(“vel_spec1.data”,“w”);
FILE *fs=fopen(“vel_spec2.data”,“w”);

TRandom r; 
   Int_t i; 
   double v1,v2,v3,v4;
    for (i=0;i<250000;i++) {
    v1=r.Gaus(0.987,.07);
    v2=r.Gaus(1.446,.07);
    h->Fill(v1,v2); 
    fprintf(fp,"%.4f\t%.4f\n",v1,v2);
}
    for (i=0;i<250000;i++)  {
    v3=r.Gaus(1.005,.05);
    v4=r.Gaus(1.421,.05);
    h->Fill(v4,v3); 
          fprintf(fs,"%.4f\t%.4f\n",v3,v4);

}
fclose(fp);
fclose(fs);
h->Draw(“lego2”);
c1->cd(2);
gPad->SetFillColor(42);
gPad->SetFrameFillColor(33);
h->Draw(“col1”);
h->GetXaxis()->SetTitle(“V1 (cm/ns)”);
h->GetYaxis()->SetTitle(“v2 (cm/ns)”);
h->GetZaxis()->SetTitle(“counts”);
h->GetXaxis()->CenterTitle();
h->GetYaxis()->CenterTitle();
h->GetZaxis()->CenterTitle();

}
Thanks.

I do not understand your code reading the data files. This is not C++

Rene