#include "PndTrkGlpkFits.h" #include "glpk.h" #include #include // Root includes #include "TROOT.h" using namespace std; #define PI 3.141592654 //----------begin of function PndTrkGlpkFits::FitHelixCylinder Short_t PndTrkGlpkFits::FitHelixCylinder( Short_t nHitsinTrack, Double_t *Xconformal, Double_t *Yconformal, Double_t *DriftRadiusconformal, Double_t *ErrorDriftRadiusconformal, Double_t rotationangle, Double_t trajectory_vertex[2], Short_t NMAX, Double_t *emme, Double_t *qu, Double_t *pAlfa, Double_t *pBeta, Double_t *pGamma, bool *Type, int istampa, int IVOLTE ) { // definition of variables for the glpsol solver // ROWS (for read_rows function) // Short_t NpointsInFit = nHitsinTrack-NMAX <0 ? nHitsinTrack : NMAX; bool mvdhit[NpointsInFit]; Double_t A, alfetta, angle, Delta[NpointsInFit], M = 1., m_result, offsety, Oxx[NpointsInFit], Oyy[NpointsInFit], q_result; Short_t i, j, ii, iii, nSttHits, nMvdHits; Short_t Status; float m1_result,m2_result, q1_result,q2_result, A1_result, A2_result; // -- //-------------- stampaggi if(istampa>=3){ cout<<"from FitHelixCylinder,prima di rotazione, Evento "<=4){ cout<<"n. punti nel fit "<=3 && IVOLTE <= 20){ sprintf(stringa, "/home/boca/panda/glpk/glpk-4.39/examples/glpsol --min -o soluztrack%dEvent%dstep%d GeneralParallelHitsConformeTraccia%dEvent%d.mcs", 0,IVOLTE,1,0,IVOLTE); } else { sprintf(stringa, "/home/boca/panda/glpk/glpk-4.39/examples/glpsol --min -o soluztrack%dEvent%dstep%d GeneralParallelHitsConformeTraccia%dEvent%d.mcs >& /dev/null", 0, IVOLTE,1,0,IVOLTE,1); } */ m1_result = final_values[0]; m2_result = final_values[1]; q1_result = final_values[2]; q2_result = final_values[3]; if(istampa>2) cout<<"Results : m1 = "< 1.e-10&& DriftRadius[ i ]>0.){ n++; ave += (S[ i ] - FInot)/Z[ i ]; avex += Z[ i ]; avey += (S[ i ] - FInot); } } if( n>0) { ave /=n; avex /=n; avey /=n; rotationangle = atan2(avey,avex); } else { rotationangle=PI/2.; } */ rotationangle = PI/2.; // cose = cos(rotationangle); // sine = sin(rotationangle); cose = 0.; sine = 1.; // Delta[i] is actually used in the fit, and also Drift Radius. nSttHits = nMvdHits = 0; for(i=0;i 1.e-10) { *emme=((*emme)*cose+sine)/(cose-(*emme)*sine); return 1; } else { // in this case the equation is 0 = U in the Conformal plane --> x=0 in the XY plane. return -99; } } //----------end of function PndTrkGlpkFits::FitSZspace ClassImp(PndTrkGlpkFits)