53 : _eqm(eqm), _acc(1E-2), _adaptive(
true)
58 const TVectorT<double>& par,
59 TVectorT<double>& newu, TVectorT<double>& newuprime,
63 double sign= h > 0 ? 1. : -1.;
68 TVectorT<double>
k2=
_eqm->
eval(u+hh*uprime+h2/8.*k1,uprime+hh*k1,par);
69 TVectorT<double> k3=
_eqm->
eval(u+hh*uprime+h2/8.*k2,uprime+hh*k2,par);
70 TVectorT<double> k4=
_eqm->
eval(u+habs*uprime+h2/2.*k3,uprime+habs*k3,par);
72 TVectorT<double> ksum=k1+k2+k3;
73 newu=u+h*uprime+h2/6.*ksum;
74 newuprime=uprime+(h/6.)*(ksum+k4+k2+k3);
75 assert(TMath::Abs(newuprime[2]-1.)<1E-4);
82 const TVectorT<double>& uprime,
83 const TVectorT<double>& par,
84 TVectorT<double>& newu,
85 TVectorT<double>& newuprime,
87 double h,
double sign,
double reststep)
99 TVectorT<double> newu1(u);
100 TVectorT<double> newuprime1(uprime);
101 TVectorT<double> newu2(u);
102 TVectorT<double> newuprime2(uprime);
103 TVectorT<double> utmp(u);
104 TVectorT<double> uprimetmp(uprime);
105 TVectorT<double>
delta(u);
107 int n=delta.GetNrows();
110 if(newh>=reststep)newh=reststep;
115 newu1,newuprime1,newh*sign);
120 utmp,uprimetmp,newh*0.5*sign);
121 step(utmp,uprimetmp,par,
122 newu2,newuprime2,newh*0.5*sign);
133 for(
int i=0; i<
n; ++i){
134 if(TMath::Abs(delta[i])>d){
135 d=TMath::Abs(delta[i]);
139 d0=TMath::Abs(
_acc*h*uprime[index]);
147 double frac=TMath::Abs(d0/d);
148 newh=0.9*TMath::Abs(newh*(TMath::Power(frac,0.25)));
153 if(newh>_maxstep)newh=_maxstep;
158 if(newh>_maxstep)newh=_maxstep;
169 newuprime=newuprime1;
178 const TVectorT<double>&
u,
179 const TVectorT<double>& uprime,
180 const TVectorT<double>& par,
181 TVectorT<double>& newu, TVectorT<double>& newuprime)
183 if(TMath::Abs(start-end)<1E-8){
191 double sign= start < end ? 1. : -1.;
194 TVectorT<double> utmp(u);
195 TVectorT<double> uprimetmp(uprime);
196 unsigned int steps=0;
197 unsigned int maxsteps=1000000;
200 assert(fabs(z0-start)<1E-8);
202 while(TMath::Abs(s-end)>h && steps<maxsteps){
206 double reststep=TMath::Abs(s-end);
208 double stepdone=sign*
h;
211 newu,newuprime,stepdone,h,sign,reststep);
214 step(utmp,uprimetmp,par,
215 newu,newuprime,sign*h);
218 double dx=h*uprimetmp[0];
219 double dy=h*uprimetmp[1];
221 length+=sqrt(dx*dx+dy*dy+h*h);
232 if(fabs(utmp[0])>1000 || fabs(utmp[1])>1000){
233 std::cerr<<
"Nystrom:: outside of range (-1000,1000)!"<<std::endl;
242 if(steps>=maxsteps)std::cerr<<
"Nystrom:: too many steps (>"<<maxsteps<<
") aborting."<<std::endl;
246 step(utmp,uprimetmp,par,
249 double dx=h*uprimetmp[0];
250 double dy=h*uprimetmp[1];
252 length+=sqrt(dx*dx+dy*dy+h*h);