// ---------------------------------------------------- // This file belongs to the ray tracing framework // for the use with Cherenkov detectors // // created 2007 //----------------------------------------------------- #include "PndDrcConicSection.h" //#include "TVector3.h" //#include "TRotation.h" //#include "TRandom.h" #include "TMatrixD.h" #include "TVectorD.h" #include "TDecompSVD.h" // //#include "Math/Vector3D.h" //using ROOT::Math::XYZVector; // //#include "Math/Point3D.h" //using ROOT::Math::XYZPoint; // //#include "Math/Transform3D.h" //using ROOT::Math::Transform3D; // //#include "Math/RotationX.h" //using ROOT::Math::RotationX; //#include "Math/RotationY.h" //using ROOT::Math::RotationY; //#include "Math/RotationZ.h" //using ROOT::Math::RotationZ; //#include "Math/Rotation3D.h" //using ROOT::Math::Rotation3D; // #include using std::cout; //using std::cerr; //using std::cin; using std::endl; // //#include //using std::valarray; // //#include //using std::fstream; // //#include //using std::string; // //#include //using std::list; // //#include //using std::vector; #include //#include #include "assert.h" //using std::assert; //---------------------------------------------------------------------- PndDrcConicSection::PndDrcConicSection() { fVerbosity = 0; fZ_plane = 0.0; fTheta = 0; fPhi = 0; fPsi = 0; fX0 = 0; fY0 = 0; } //---------------------------------------------------------------------- void PndDrcConicSection::Copy(const PndDrcConicSection& s) { fVerbosity = s.fVerbosity; fZ_plane = s.fZ_plane; fTheta = s.fTheta; fPhi = s.fPhi; fPsi = s.fPsi; fX0 = s.fX0; fY0 = s.fY0; } //---------------------------------------------------------------------- PndDrcConicSection::PndDrcConicSection(const PndDrcConicSection& s) { if (s.fVerbosity>=1) cout<<" PndDrcConicSection::PndDrcConicSection(const PndDrcConicSection&)"<=1) cout<<" PndDrcConicSection::PndDrcConicSection& operator=(const PndDrcConicSection&)" <& x, vector& y) { assert(x.size()==5); assert(y.size()==5); static const double kPi=3.1415926535; double a,b,c,d,e,f,lam2; double phi1; { TMatrixD mat_a(5,5); TVectorD vec_b(5); for (int i=0; i<5; i++) { mat_a(i,0) = x[i]*x[i]; mat_a(i,1) = x[i]*y[i]; mat_a(i,2) = x[i]; mat_a(i,3) = y[i]; mat_a(i,4) = 1; vec_b(i) = -y[i]*y[i]; } TDecompSVD svd(mat_a); bool ok; TVectorD s = svd.Solve(vec_b,ok); if (ok) { a = s[0]; b = 0.5*s[1]; c = 1; //y*y d = 0.5*s[2]; e = 0.5*s[3]; f = s[4]; phi1 = 0.5*atan2(-2*b,-(a-c));//+1*pi/2; if (fVerbosity>0) { cout<0) { cout<<" ellipse "<<" "<0) cout<<" d/a = "<0) cout<<" e/c = "<0) cout<<" correction: "<0) // ellipse { if (d/a>0) { phi1+=kPi; for (int i=0; i<5; i++) Rotate(x[i],y[i],-kPi); if (fVerbosity>0) cout<<" changed phi by to "<0) cout<<" changed phi to "<0) { phi1+=kPi/2; for (int i=0; i<5; i++) Rotate(x[i],y[i],-kPi/2); if (fVerbosity>0) cout<<" changed phi to "<0) cout<<" changed phi to "<0) cout<<" d/a = "<0) cout<<" e/c = "<0) cout<0) cout<<" -f/a -f/c "<<-f/a<<" "<<-f/c<0) cout<0) cout<<" Halbachsen="<0) cout<<" BB/AA "<0) cout<<" BB/A "<0) cout<<" psi = "<0) cout<<" theta = "<0) cout<<" x0 = "<0) cout<<" y0 = "<0) cout<<" shift old x= "<0) cout<<" shift old y= "<0) cout<<" x0 = "<0) cout<<" y0 = "<0) cout<<" phi = "<0) cout<<" x0 = "<0) cout<<" y0 = "<