/*#if !defined (__CINT__) || defined (__MAKECINT__) #include "Rtypes.h" #endif*/ int NDATA=1000; int NMEAS=1000; double SIGMAVEL=1.; double WPEN=0.2; double Y[1000]; double T; double UBIAS; double TH; double YMEAS[1000],VELMEAS[1000]; double EFIT[1000]; double EFITINTERP[1000]; double VFIT[1000]; double vscale=0.; #include //#include #include #include /*extern "C" { Bool_t interp1spline(UInt_t,UInt_t, Double_t*, Double_t*, Double_t*, Double_t*); Double_t Mobility(Int_t,Double_t,Double_t); void fcn(int& , double*, double& , double* ,int); void calculateEfield(UInt_t, Double_t*, Double_t*, UInt_t, Double_t, Double_t, Double_t*, Double_t*, Double_t*, Double_t, Double_t, Double_t, UInt_t, UInt_t, Double_t*,Double_t , Double_t, Double_t ,Double_t); }*/ Bool_t interp1spline(UInt_t N1,UInt_t N2,Double_t *x1,Double_t *y1,Double_t *x2,Double_t *y2i){ /* -Introduction: * - Materials: * - N1,N2: arrays length. * - x1,y1: x,y of the curve to be interpolated on the points x2. x1,x2 ODERED!!! * - x2: point where to interpolate y1. * - y2i: output! output values of y1 on x2. */ std::vector X1; std::vector Y1; for (UInt_t i=0;ix1max) x1max=x1[i]; } for (UInt_t i=0;ix1max){ // printf("Warning: interp1spline: Extrapolation higher extreme.\n"); y2i[i]=inter.Eval(x1max)+inter.Deriv(x1max)*(x2[i]-x1min)+inter.Deriv2(x1max)*pow(x2[i]-x1min,2); continue; } y2i[i]=inter.Eval(x2[i]); } return true; } // Mobility Double_t Mobility(Int_t Charge,Double_t T,Double_t E){ Double_t lfm=0,hfm=0; Double_t vsatn,vsatp,vsat; Double_t betap,betan; Double_t alpha; Double_t bb,cc,E0; E=E*1e-2; if(Charge>0) { E0=2970*pow(T/300,5.63); bb=9.57e-8*pow(T/300,-0.155); cc=-3.24e-13; lfm=457*pow(T/300,-2.80); if(E>E0) hfm=1./(1/lfm+bb*(E-E0)+cc*pow(E-E0,2)); else hfm=lfm; } else { E0=2970*pow(T/300,5.63); lfm=1430*pow(T/300,-1.99); vsatn=1.05e7*pow(T/300,-3.02); if(E>E0) hfm=1./(1/lfm+1/vsatn*(E-E0)); else hfm=lfm; } return hfm/1e4; } ////////// Minuit void fcn(int &npar, double *gin, double &f, double *par,int iflag) { int k,i; double uk=0.; double chi2 = 0.0; double mue,muh; double Ei[NMEAS]; double dy=0.; for(k=0;kmnexcm("SET ERR", arglist ,1,ierflg); for (UInt_t i=0;imnexcm("CALL FCN", arglist ,1,ierflg); printf("\n Teste dich! \n"); // Now ready for minimization step arglist[0] = NITERFIT; arglist[1] = 1.; gMinuit->mnexcm("MIGRAD", arglist ,2,ierflg); printf("\n Teste dich! \n"); // Print results // Test interp interp1spline(NDATA,NMEAS,Y,EFIT,YMEAS,EFITINTERP); // Velocity for (UInt_t i=0;i