13a14
> #include <gsl/gsl_multifit.h>
30a32,34
> double **xsplit,**ysplit;
> double **dtxsplit,**dtysplit;
> 
57,58c61,65
< const int LIMITS=1024;
< const int MAXL=1024;
---
> //const int LIMITS=1024;
> const int LIMITS=5024;
> const int POLYORD=18;
> //const int MAXL=1024;
> const int MAXV=3; //only accurate up to v4
62c69,73
< const int PHIPASIZE=8;   // how many grid points in PHIP
---
> const int PHIPASIZE=12;   // how many grid points in PHIP
> 
> double XVector[MAXV][POLYORD];
> double YVector[MAXV][POLYORD];
> 
65a77
> int reducednum;
99c111
< 	      break;
---
> 	      exit(-1);
104a117
>   reducednum=totalnum;
118a132,145
>   xsplit=new double*[totalnum];
>   ysplit=new double*[totalnum];
> 
>   dtxsplit=new double*[totalnum];
>   dtysplit=new double*[totalnum];
> 
>   for (int i=0;i<totalnum;i++)
>     {
>       xsplit[i]=new double[MAXV];
>       ysplit[i]=new double[MAXV];
>       dtxsplit[i]=new double[MAXV];
>       dtysplit[i]=new double[MAXV];
>     }
> 
159a187,191
>       delete [] xsplit[i];
>       delete [] ysplit[i];
>       delete [] dtxsplit[i];
>       delete [] dtysplit[i];
>       
219c251
< 	  //printf("END for t= %f \n",taus[setpos]);
---
> 	  //printf("END for i=%i t= %f \n",setpos,taus[setpos]);
303a336,465
> //Smoothing data (new) --
> //remove any sin component from x
> //and any cos component from y
> void newsmoothdata(double *datax,double *data1y,double *data2y, int L,int thisset)
> {
>   gsl_spline * workspline1=gsl_spline_alloc (gsl_interp_cspline_periodic, L);
>   gsl_interp_accel * workacc1=gsl_interp_accel_alloc ();
>   gsl_spline * workspline2=gsl_spline_alloc (gsl_interp_cspline_periodic, L);
>   gsl_interp_accel * workacc2=gsl_interp_accel_alloc ();
> 
>   gsl_spline_init (workspline1, datax, data1y, L);
>   gsl_spline_init (workspline2, datax, data2y, L);
>   
>   //for (int i=0;i<L;i++)
>   //  {
>   //    printf("{%f,%f},\n",datax[i],datay[i]);
>   //  }
> 
> 
>   for (int i=0;i<(L-1);i++)
>     {
>       datax[i]=i*2*M_PI/(L-1);
>       data1y[i]=gsl_spline_eval(workspline1,datax[i],workacc1);
>       data2y[i]=gsl_spline_eval(workspline2,datax[i],workacc2);
>         //datax[i]=2*M_PI/L*i;
>       //datay[i]=sin(datax[i]);
>     }
> 
>   gsl_fft_real_wavetable * real;
>   gsl_fft_halfcomplex_wavetable * hc;
>   gsl_fft_real_workspace * work;
> 
> 
>   work = gsl_fft_real_workspace_alloc (L-1);
>   real = gsl_fft_real_wavetable_alloc (L-1);
>   hc = gsl_fft_halfcomplex_wavetable_alloc (L-1);    
>   //first set
>   
>   gsl_fft_real_transform (data1y, 1, L-1, real, work);
> 
>   //smoothing:
>   //remove constant (should be centered)
>   data1y[0]=0;
>   
> 
>   if ((L-1)<4*MAXV)
>     {
>       reducednum=thisset;
>     }
>   
> 
>   //remove sin components
>   if ((L-1)>4*MAXV)
>     for (int i=0;i<MAXV;i++)
>     {
>       xsplit[thisset][i]=data1y[1+4*i];
>     }
> 
>   for (int i=0;i<L-1;i++)
>     {
>       if ((((i-1)%4)==0)&&(((i-1)/4)<MAXV))
> 	data1y[i]=xsplit[thisset][(i-1)/4];
>       else
> 	data1y[i]=0;
>       //printf("%i %f",i,a[i]);
>     }
>   
> 
>   gsl_fft_halfcomplex_inverse (data1y, 1, L-1, hc, work);
>   
>   //second set
>   
>   
>   gsl_fft_real_transform (data2y, 1, L-1, real, work);
> 
>   
>   data2y[0]=0;
> 
>   
> 
> 
> 
>   //remove cos components
> 
>   if ((L-1)>4*MAXV)
>     for (int i=0;i<MAXV;i++)
>       {
> 	ysplit[thisset][i]=data2y[2+4*i];
>       }
> 
> 
>   for (int i=0;i<L-1;i++)
>     {
>       if ((((i-1)%4)==0)&&(((i-1)/4)<MAXV))
> 	data2y[i]=ysplit[thisset][(i-1)/4];
>       else
> 	data2y[i]=0;
>       //printf("%i %f",i,a[i]);
>     }
> 
>   //printf("%i\n",(L-1));
> 
>   //if (L>15)
>   //  for (int i=cut;i<L-1;i++)
>   //   data2y[i]=0;
>  
>   gsl_fft_halfcomplex_inverse (data2y, 1, L-1, hc, work);
> 
> 
>   //clean up
>   gsl_fft_halfcomplex_wavetable_free (hc);
>   gsl_fft_real_wavetable_free (real);
>   gsl_fft_real_workspace_free (work);
> 
>   gsl_spline_free (workspline1);
>   gsl_interp_accel_free (workacc1);
>   gsl_spline_free (workspline2);
>   gsl_interp_accel_free (workacc2);
> 
>   for (int i=0;i<MAXV;i++)
>     {
>       xsplit[thisset][i]/=(L-1.);
>       //for some reason the sin part
>       //is defined with an extra minus!
>       ysplit[thisset][i]/=-(L-1.);
>     }
>   
> 
> }
> 
310c472
<   for (int i=0;i<totalnum;i++)
---
>   for (int i=0;i<reducednum;i++)
345a508,509
>       //double tt=0;
>   
349c513
< 	  tempy[j]=yp[start+j];
---
> 	  tempy[j]=yp[start+j];	  
355a520
> 	  //tt+=ux[start+j]*ux[start+j];
357c522,524
<             
---
>          
>       //printf("%i %f\n",i,tt/(length-1));
>    
377,378c544,545
< 
<       smoothdata(tempp,tempx,tempy,length,(int) length/4);
---
>       
>       //smoothdata(tempp,tempx,tempy,length,(int) length/4);
379a547,550
>       //printf("%i  ",i);
> 
>       newsmoothdata(tempp,tempx,tempy,length,i);
>       //newsmoothdata(tempp,tempx,tempy,length,3);
380a552
>       
399a572,593
>       /*
>       for (int j=0;j<100;j++)
> 	{
> 	  if (i==100)
> 	    {
> 	      printf("%f %f\n",2*M_PI*j/100,gsl_spline_eval(yspline[i],2*M_PI*j/100,xacc[i]));
> 	    }
> 	}
>       */
> 
>       /*
>       double tt=0;
>       for (int j=0;j<100;j++)
> 	{
> 	  tt+=gsl_spline_eval(piyyspline[i],2*M_PI*j/100,piyyacc[i]);
> 	}
> 	printf("%i %.12g\n",i,tt/100);
>       */
> 
> 
> 
>       
420d613
< }
421a615
>   //get dtdx and so on
423,485d616
< void getdtsplines(int thisset,double tphi)
< {
<   double tempxarr[3];
<   double tempyarr[3];
<   double temptarr[3];
<   if (thisset==0)
<     {
<       for (int i=0;i<3;i++)
< 	{
< 	  tempxarr[i]=gsl_spline_eval (xspline[thisset+i], tphi, xacc[thisset+i]);
< 	  tempyarr[i]=gsl_spline_eval (yspline[thisset+i], tphi, yacc[thisset+i]);
< 	  temptarr[i]=taus[thisset+i];
< 	}
< 
<     }
<   else if (thisset<totalnum-1)
<     {
<       for (int i=0;i<3;i++)
< 	{
< 	  tempxarr[i]=gsl_spline_eval (xspline[thisset+i-1], tphi, xacc[thisset+i-1]);
< 	  tempyarr[i]=gsl_spline_eval (yspline[thisset+i-1], tphi, yacc[thisset+i-1]);
< 	  temptarr[i]=taus[thisset+i-1];
< 	}
<     }
<   if (thisset==totalnum-1)
<     {
<       for (int i=0;i<3;i++)
< 	{
< 	  tempxarr[i]=gsl_spline_eval (xspline[thisset+i-2], tphi, xacc[thisset+i-2]);
< 	  tempyarr[i]=gsl_spline_eval (yspline[thisset+i-2], tphi, yacc[thisset+i-2]);
< 	  temptarr[i]=taus[thisset+i-2];
< 	}
<     }
< 
<   gsl_spline_init (dtxspline,temptarr,tempxarr,3);
<   gsl_spline_init (dtyspline,temptarr,tempyarr,3);
< 
< }
< 
< double firstintegrand(double tphi,void * params)
< {
<   double *par= (double *) params;
<   //cout << "par1= " << par[0] << "\t";
<   //cout << "par2= " << par[1] << "\n";
<   //par[0]=Temperature
<   //par[1]=particle rest-mass
<   //par[2]=p_T
<   //par[3]=phi_p
<   //par[4]=setnumber eqiv tau
<   double px=par[2]*cos(par[3]);
<   double py=par[2]*sin(par[3]);
<   double mt=sqrt(par[2]*par[2]+par[1]*par[1]);
<   int thisset=(int) par[4];
< 
<   double mux=gsl_spline_eval (uxspline[thisset], tphi, uxacc[thisset]);
<   double muy=gsl_spline_eval (uyspline[thisset], tphi, uyacc[thisset]);
< 
<   double ut=sqrt(1+mux*mux+muy*muy);
< 
<   double dpmx=gsl_spline_eval_deriv (xspline[thisset], tphi, xacc[thisset]);
<   double dpmy=gsl_spline_eval_deriv (yspline[thisset], tphi, yacc[thisset]);
<   double dtmx,dtmy;
<   //nice but slow?
487,490c618,620
<   //getdtsplines(thisset,phi);
< 
<   //dtmx=gsl_spline_eval_deriv(dtxspline,taus[thisset],dtxacc);
<   //dtmy=gsl_spline_eval_deriv(dtyspline,taus[thisset],dtyacc);
---
>   double chisq;
>   gsl_matrix *X, *cov;
>   gsl_vector *y1, *c1, *y2, *c2;
492,493c622
<   dtmx=(gsl_spline_eval (xspline[thisset+1], tphi, xacc[thisset+1])-gsl_spline_eval (xspline[thisset], tphi, xacc[thisset]))/(taus[thisset+1]-taus[thisset]);
<   dtmy=(gsl_spline_eval (yspline[thisset+1], tphi, yacc[thisset+1])-gsl_spline_eval (yspline[thisset], tphi, yacc[thisset]))/(taus[thisset+1]-taus[thisset]);
---
>   //reducednum=100;
495c624,626
<   //printf("dtmx=%f \t dtmy=%f\t dpmx=%f\t dpmy=%f\n",dtmx,dtmy,dpmx,dpmy);
---
>   X=gsl_matrix_alloc (reducednum, POLYORD);
>   y1 = gsl_vector_alloc (reducednum);
>   y2 = gsl_vector_alloc (reducednum);
497,501c628,630
<   double temp;
<   
<   //printf("get %f with dtmy=%f and dtmx=%f\n",(dtmx*dpmy-dtmy*dpmx),dtmy/sin(tphi),dtmx/cos(tphi));
<   //printf("{%f,%f},",tphi,gsl_spline_eval (xspline[thisset], tphi, xacc[thisset]));
<   //printf("{%f,%f},",tphi,gsl_spline_eval (xspline[thisset+1], tphi, xacc[thisset+1]));
---
>   c1 = gsl_vector_alloc (POLYORD);
>   c2 = gsl_vector_alloc (POLYORD);
>   cov = gsl_matrix_alloc (POLYORD, POLYORD);
503,509c632
<   //temp=1;
<   temp=(dtmx*dpmy-dtmy*dpmx)*mt;
<   temp*=exp((px*mux+py*muy)/par[0]);
<   temp*=gsl_sf_bessel_K1(mt/par[0]*ut);
<   //printf("firsti: %f %f %f %f %i\n",par[0],par[1],par[2],par[3],thisset);
< 
<   
---
>   gsl_multifit_linear_workspace * fwork = gsl_multifit_linear_alloc (reducednum, POLYORD);
511,512d633
<   return temp;
< }
514,530c635,640
< double secondintegrand(double phip,void * params)
< {
<   double *par= (double *) params;
<   //cout << "par1= " << par[0] << "\t";
<   //cout << "par2= " << par[1] << "\n";
<   //par[0]=Temperature
<   //par[1]=particle rest-mass
<   //par[2]=p_T
<   //par[3]=phi_p
<   //par[4]=setnumber eqiv tau
<   double px=par[2]*cos(par[3]);
<   double py=par[2]*sin(par[3]);
<   double mt=sqrt(par[2]*par[2]+par[1]*par[1]);
<   int thisset=(int) par[4];
< 
<   double mux=gsl_spline_eval (uxspline[thisset], phip, uxacc[thisset]);
<   double muy=gsl_spline_eval (uyspline[thisset], phip, uyacc[thisset]);
---
>   for (int i=0;i<reducednum;i++)
>     {
>       gsl_matrix_set (X, i, 0, 1.0);
>       for (int j=1;j<POLYORD;j++)
> 	gsl_matrix_set (X, i, j, pow(taus[i],j));
>     }
532,533d641
<   
<   double ut=sqrt(1+mux*mux+muy*muy);
535,536c643,650
<   double dpmx=gsl_spline_eval_deriv (xspline[thisset], phip, xacc[thisset]);
<   double dpmy=gsl_spline_eval_deriv (yspline[thisset], phip, yacc[thisset]);
---
>   for (int j=0;j<MAXV;j++)
>     {
>       for (int i=0;i<reducednum;i++)
> 	{
> 	  //if (i==0)
> 	  //  printf("from %i %f\n",j,xsplit[i][j]);
>       	  gsl_vector_set (y1, i, xsplit[i][j]);
> 	  gsl_vector_set (y2, i, ysplit[i][j]);
537a652,664
> 	  //dtxsplit[i][j]=(xsplit[i+1][j]-xsplit[i-1][j])/(taus[i+1]-taus[i-1]);
> 	  //dtysplit[i][j]=(xsplit[i+1][j]-xsplit[i-1][j])/(taus[i+1]-taus[i-1]);
> 	}
>       //printf("%i %f\n",i,xsplit[i][0]);
>       gsl_multifit_linear (X, y1, c1, cov,&chisq, fwork);
>       for (int k=0;k<POLYORD;k++)
> 	XVector[j][k]=gsl_vector_get(c1,k);
>       gsl_multifit_linear (X, y2, c2, cov,&chisq, fwork);
>       for (int k=0;k<POLYORD;k++)
> 	YVector[j][k]=gsl_vector_get(c2,k);
>       //printf("x: %g %g %g %g\n",gsl_vector_get(c1,0),gsl_vector_get(c1,1),gsl_vector_get(c1,2),gsl_vector_get(c1,3));
>       //printf("x: %g %g\n",gsl_vector_get(c1,0),gsl_vector_get(c1,1));
>     }
539,540d665
<   double temp=1;
<   
541a667,684
>   /*
>   for (int k=0;k<MAXV;k++)
>     {
>       double temp=0;
>       for (int j=0;j<POLYORD;j++)
> 	temp+=pow(taus[0],j)*XVector[k][j];
>       printf("got %i %f\n",k,temp);
>     }
>   */ 
>   /*
>   for (double tt=1.0;tt<taus[reducednum];tt+=0.1)
>     {
>       double temp=0;
>       for (int j=0;j<POLYORD;j++)
> 	temp+=pow(tt,j)*YVector[0][j];
>       printf("%f %f\n",tt,temp);
>     }
>   */
543,548c686
<   //cout << "temp =" << temp << endl;
<   //printf("firsti: %f %f %f %f %i\n",par[0],par[1],par[2],par[3],thisset);
< 
<   temp=px*dpmy-py*dpmx;
<   temp*=exp((px*mux+py*muy)/par[0]);
<   temp*=gsl_sf_bessel_K0(mt/par[0]*ut);
---
>   gsl_multifit_linear_free (fwork);
550c688,693
<   //printf("sign: %f %f\n",temp,cos(phi-par[3]));
---
>   gsl_matrix_free (X);
>   gsl_vector_free (y1);
>   gsl_vector_free (y2);
>   gsl_vector_free (c1);
>   gsl_vector_free (c2);
>   gsl_matrix_free (cov);
552d694
<   return temp;
555,556d696
< double viscintegrand(double phip,void * params)
< {
558,576c698,701
<   double result;
<   double *par= (double *) params;
<   //par[0]=Temperature
<   //par[1]=particle rest-mass
<   //par[2]=p_T
<   //par[3]=phi_p
<   //par[4]=setnumber eqiv tau
<   double px=par[2]*cos(par[3]);
<   double py=par[2]*sin(par[3]);
<   double mt=sqrt(par[2]*par[2]+par[1]*par[1]);
<   int thisset=(int) par[4];
< 
<   double mux=gsl_spline_eval (uxspline[thisset], phip, uxacc[thisset]);
<   double muy=gsl_spline_eval (uyspline[thisset], phip, uyacc[thisset]);
<   
<   double ut=sqrt(1+mux*mux+muy*muy);
< 
<   double dpmx=gsl_spline_eval_deriv (xspline[thisset], phip, xacc[thisset]);
<   double dpmy=gsl_spline_eval_deriv (yspline[thisset], phip, yacc[thisset]);
---
> double justx(int thisset,double tphi)
> {
>   double temp=0;
>   double tt=taus[thisset];
578,581c703,707
<   double dtmx,dtmy;
<   //nice but slow?
<   
<   //getdtsplines(thisset,phi);
---
>   for (int j=0;j<MAXV;j++)
>     for (int k=0;k<POLYORD;k++)
>       temp+=pow(tt,k)*XVector[j][k]*cos((2*j+1)*tphi);
>   return 2*temp;
> }
583,587d708
<   //dtmx=gsl_spline_eval_deriv(dtxspline,taus[thisset],dtxacc);
<   //dtmy=gsl_spline_eval_deriv(dtyspline,taus[thisset],dtyacc);
<   
<   dtmx=(gsl_spline_eval (xspline[thisset+1], phip, xacc[thisset+1])-gsl_spline_eval (xspline[thisset], phip, xacc[thisset]))/(taus[thisset+1]-taus[thisset]);
<   dtmy=(gsl_spline_eval (yspline[thisset+1], phip, yacc[thisset+1])-gsl_spline_eval (yspline[thisset], phip, yacc[thisset]))/(taus[thisset+1]-taus[thisset]);
588a710,711
> double dpx(int thisset,double tphi)
> {
590,592c713,714
<   double temp1=(dtmx*dpmy-dtmy*dpmx)*mt;
<   double temp2=px*dpmy-py*dpmx;
<   
---
>   double temp=0;
>   double tt=taus[thisset];
593a716,720
>   for (int j=0;j<MAXV;j++)
>     for (int k=0;k<POLYORD;k++)
>       temp-=pow(tt,k)*XVector[j][k]*(2*j+1)*sin((2*j+1)*tphi);;
>   return 2*temp;
> }
595,597c722,725
<   double mpixx=gsl_spline_eval (pixxspline[thisset], phip, pixxacc[thisset])/(TF*TF*2);
<   double mpixy=gsl_spline_eval (pixyspline[thisset], phip, pixyacc[thisset])/(TF*TF*2);
<   double mpiyy=gsl_spline_eval (piyyspline[thisset], phip, piyyacc[thisset])/(TF*TF*2);
---
> double dpy(int thisset,double tphi)
> {
>   double temp=0;
>   double tt=taus[thisset];
599,604c727,736
<   double vx=mux/ut;
<   double vy=muy/ut;
<   double mpitt=vx*vx*mpixx+2*vx*vy*mpixy+vy*vy*mpiyy;
<   double mpiee=mpixx+mpiyy-mpitt;
<   double mpitx=vx*mpixx+vy*mpixy;
<   double mpity=vx*mpixy+vy*mpiyy;
---
>   for (int j=0;j<MAXV;j++)
>     for (int k=0;k<POLYORD;k++)
>       temp+=pow(tt,k)*YVector[j][k]*(2*j+1)*cos((2*j+1)*tphi);;
>   return 2*temp;
> 
>   //  double temp=0;
>   //for (int j=0;j<MAXV;j++)
>   // temp+=ysplit[thisset][j]*(2*j+1)*cos((2*j+1)*tphi);
>   //return 2*temp;
> }
606,608c738,739
<   double one=mt*mt*mpiee+px*px*mpixx+py*py*mpiyy+2*px*py*mpixy;
<   double two=-2*mt*(px*mpitx+py*mpity);
<   double three=mt*mt*(mpitt-mpiee);
---
> double dtx(int thisset,double tphi)
> {
610,613c741,742
<   double d0k0=gsl_sf_bessel_K0(mt/par[0]*ut);
<   double d1k0=gsl_sf_bessel_K1(mt/par[0]*ut);
<   double d2k0=(gsl_sf_bessel_Kn(2,mt/par[0]*ut)+d0k0)/2;
<   double d3k0=(gsl_sf_bessel_Kn(3,mt/par[0]*ut)+3*d1k0)/4;
---
>   double temp=0;
>   double tt=taus[thisset];
614a744,753
>   for (int j=0;j<MAXV;j++)
>     for (int k=1;k<POLYORD;k++)
>       temp+=k*pow(tt,k-1)*XVector[j][k]*cos((2*j+1)*tphi);
>   return 2*temp;
> 
>   //  double temp=0;
>   //for (int j=0;j<MAXV;j++)
>   //  temp+=dtxsplit[thisset][j]*cos((2*j+1)*tphi);
>   //return 2*temp;
> }
616,617c755,756
<   temp1*=(one*d1k0+two*d2k0+three*d3k0);
<   temp2*=(one*d0k0+two*d1k0+three*d2k0);
---
> double dty(int thisset,double tphi)
> {
619c758,759
<   result=temp1-temp2;
---
>   double temp=0;
>   double tt=taus[thisset];
621,622c761,764
<   result*=exp((px*mux+py*muy)/par[0]);
<   return result;
---
>   for (int j=0;j<MAXV;j++)
>     for (int k=1;k<POLYORD;k++)
>       temp+=k*pow(tt,k-1)*YVector[j][k]*sin((2*j+1)*tphi);
>   return 2*temp;
645,647c787,807
<   double dpmx=gsl_spline_eval_deriv (xspline[thisset], tphi, xacc[thisset]);
<   double dpmy=gsl_spline_eval_deriv (yspline[thisset], tphi, yacc[thisset]);
<   double dtmx,dtmy;
---
>   double dpmx=dpx(thisset,tphi);
>   double dpmy=dpy(thisset,tphi);
> 
>   //if (thisset==0)
>   // {
>       //printf("%f %f\n",tphi,gsl_spline_eval (xspline[thisset], tphi, xacc[thisset]));
>       //printf("%f %f\n",tphi,justx(thisset,tphi));
>   //}
>   //printf("%f ",dpmx);
> 
>   //dpmx=gsl_spline_eval_deriv (xspline[thisset], tphi, xacc[thisset]);
> 
>   //printf("%f\n",dpmx);
>   //dpmy=gsl_spline_eval_deriv (yspline[thisset], tphi, yacc[thisset]);
>   
>   double dtmx=dtx(thisset,tphi);
>   double dtmy=dty(thisset,tphi);
>   
> 
> 
>  
650c810
<   //getdtsplines(thisset,phi);
---
>   //getdtsplines(thisset,tphi);
655,656c815,819
<   dtmx=(gsl_spline_eval (xspline[thisset+1], tphi, xacc[thisset+1])-gsl_spline_eval (xspline[thisset], tphi, xacc[thisset]))/(taus[thisset+1]-taus[thisset]);
<   dtmy=(gsl_spline_eval (yspline[thisset+1], tphi, yacc[thisset+1])-gsl_spline_eval (yspline[thisset], tphi, yacc[thisset]))/(taus[thisset+1]-taus[thisset]);
---
>   //dtmx=(gsl_spline_eval (xspline[thisset+1], tphi, xacc[thisset+1])-gsl_spline_eval (xspline[thisset], tphi, xacc[thisset]))/(taus[thisset+1]-taus[thisset]);
>   //dtmy=(gsl_spline_eval (yspline[thisset+1], tphi, yacc[thisset+1])-gsl_spline_eval (yspline[thisset], tphi, yacc[thisset]))/(taus[thisset+1]-taus[thisset]);
> 
>   //dtmx=(gsl_spline_eval (xspline[thisset+1], tphi, xacc[thisset+1])-gsl_spline_eval (xspline[thisset-1], tphi, xacc[thisset-1]))/(taus[thisset+1]-taus[thisset-1]);
>   //dtmy=(gsl_spline_eval (yspline[thisset+1], tphi, yacc[thisset+1])-gsl_spline_eval (yspline[thisset-1], tphi, yacc[thisset-1]))/(taus[thisset+1]-taus[thisset-1]);
657a821,822
>    
> 
672c837
<   //temp=1;
---
>   //temp1=1;
673a839,849
> 
>   //temp1=sqrt(gsl_spline_eval (xspline[thisset], tphi, xacc[thisset])*gsl_spline_eval (xspline[thisset], tphi, xacc[thisset])+gsl_spline_eval (yspline[thisset], tphi, yacc[thisset])*gsl_spline_eval (yspline[thisset], tphi, yacc[thisset]));
>   //temp1=(gsl_spline_eval (xspline[thisset], tphi, xacc[thisset])*dpmy-gsl_spline_eval (yspline[thisset], tphi, yacc[thisset])*dpmx);
> 
> 
>   //  temp1=(dtmx*dpmy-dtmy*dpmx);
> 
>   //return temp1;
> 
>   //printf("not here\n");
> 
676c852,858
< 
---
>   /*
>   if (thisset==300)
>     {
>       //printf("%f %f\n",tphi,gsl_spline_eval_deriv (yspline[thisset], tphi, yacc[thisset]));
>       printf("%f %f\n",tphi,temp1);
>     }
>   */
678a861
>   //if (ETAOS>1.0)
714,728d896
<   result*=exp((px*mux+py*muy)/par[0]);
<   //printf("result %f comp %f\n",result,firstintegrand(tphi,params)-secondintegrand(tphi,params));
<   return result;
< 
< }
< 
< // deprecated
< 
< double integrate1(double T,double m0,double pt, double phip, int thisset)
< {
<   double result1,error1;
<   double result2,error2;
<   size_t neval;
<   double parameters[5];
< 
731,763d898
<   parameters[0]=T;
<   parameters[1]=m0;
<   parameters[2]=pt;
<   parameters[3]=phip;
<   parameters[4]=(double) thisset;
< 
<   double mux=gsl_spline_eval (uxspline[thisset], phip, uxacc[thisset]);
<   double muy=gsl_spline_eval (uyspline[thisset], phip, uyacc[thisset]);
< 
<   double mt=sqrt(pt*pt+m0*m0);
<   double ut=sqrt(1+mux*mux+muy*muy);
<  
<   
<   //firstintegrand(0.5,&parameters);
<   
<   gsl_function F1,F2;
<   F1.function = &firstintegrand;
<   F1.params = &parameters;
<   
<   F2.function = &secondintegrand;
<   F2.params = &parameters;
< 
<   //printf("hello %f\n",firstintegrand(0.5,&parameters));
<   //printf("hello %f\n",secondintegrand(0.5,&parameters));
< 
<   gsl_integration_qag(&F1,0,2*M_PI,1e-5,1e-4,2000,3,w,&result1,&error1);
<   //gsl_integration_qng(&F1,0,2*M_PI,1e-8,10.0,&result1,&error1,&neval);
<   //printf("res1 %f err %f\t",result1,error1);
<   //gsl_integration_qng(&F2,0,2*M_PI,0,1.0,&result2,&error2,&neval); 
<   gsl_integration_qag(&F2,0,2*M_PI,error1,1e-3,2000,3,w,&result2,&error2);
<   //printf("res2 %f err %f\n",result2,error2);
< 
<    
765,788c900,902
<   double temp;
<   if (ETAOS<0.001)
<     {
<       
<       //then it's essentially ideal hydro
<       //and no need to calc viscous corrections
<       //temp=result1*gsl_sf_bessel_K1(mt/T*ut);
<       //temp-=result2*gsl_sf_bessel_K0(mt/T*ut);
<       temp=result1-result2;
<       temp*=taus[thisset];
< 
<       
<       return temp;
<     }
<   else
<     {      
<       temp=result1-result2;
<       F1.function = &viscintegrand;
<       F1.params = &parameters;
<      
<       gsl_integration_qag(&F1,0,2*M_PI,1e-5,1e-3,2000,3,w,&result1,&error1);
<       printf("res3 %f err %f\n",result1,error1);
<       
<       temp*=taus[thisset];
---
>   result*=exp((px*mux+py*muy)/par[0]);
>   //printf("result %f comp %f\n",result,firstintegrand(tphi,params)-secondintegrand(tphi,params));
>   return result;
790,791d903
<       return temp;
<     }
813a926,936
>   // double impo=0;
>   // for (int k=0;k<100;k++)
>   //{
>   //impo+=allintegrand(2*M_PI*k/100,parameters);
>       //if (thisset==200)
>       //	printf("%f %f\n",2*M_PI*k/100,allintegrand(2*M_PI*k/100,parameters));
>   //}
>   //if (thisset==200)
>   //printf("\n\n\n");
> 
>   //printf("%i  %f\n",thisset,impo/100);
814a938,941
>   gsl_error_handler_t * new_handler;
> 
>   new_handler=gsl_set_error_handler_off();
>     
816c943,964
<   gsl_integration_qag(&F,0,2*M_PI,1e-10,1e-2,2000,3,w,&result,&error);
---
>   int bad=3;
>   int code=gsl_integration_qag(&F,0,2*M_PI,1e-10,1e-3,2000,bad,w,&result,&error);
> 
> 
>   while(code==GSL_EROUND)
>     {
>       bad++;
>       //printf("Roundoff error, badness %i, set %i\n",bad-1,thisset);
>       code=gsl_integration_qag(&F,0,2*M_PI,1e-10,1e-3,2000,bad,w,&result,&error);
>       
>       if (bad==7)
> 	{
> 	  printf("Unrecoverable roundoff error detected. Aborting\n");
> 	  printf("result=%.12g error=%.12g pt=%f, phip=%f set=%i\n",result,error,pt,phip,thisset);
> 	  exit(1);
> 	}
>     }
>  
> 
>   /* restore original handler */
>   gsl_set_error_handler (new_handler);
> 
843c991,992
<   for (int i=0;i<totalnum-1;i++)
---
> 
>   for (int i=0;i<reducednum;i++)
846a996
>       printf("%i %.12g\n",i,tarr[i]);
1067a1218,1219
>     for (int k=0;k<PHIPASIZE;k++)
>       printf(" phibuf %i %f\n",k,phipbuff[k]);
1122a1275,1276
> 		  //printf("still running\n");
> 		  double rt=0;
1129c1283
< 		      
---
> 		      //rt+=resbuff[j][k];
1130a1285
> 		      
1131a1287
> 		  //printf("%f %.12g\n",pt,rt/PHIPASIZE);
