00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "G4ErrorSurfaceTrajParam.hh"
00034 #include <iomanip>
00035
00036 #include "G4ThreeVector.hh"
00037 #include "G4GeometryTolerance.hh"
00038
00039
00040 G4ErrorSurfaceTrajParam::
00041 G4ErrorSurfaceTrajParam( const G4Point3D& pos, const G4Vector3D& mom,
00042 const G4Vector3D& vecV, const G4Vector3D& vecW )
00043 {
00044 SetParameters( pos, mom, vecV, vecW );
00045 }
00046
00047
00048
00049 G4ErrorSurfaceTrajParam::
00050 G4ErrorSurfaceTrajParam( const G4Point3D& pos, const G4Vector3D& mom,
00051 const G4Plane3D& plane )
00052 {
00053 SetParameters( pos, mom, plane );
00054 }
00055
00056
00057 void G4ErrorSurfaceTrajParam::
00058 SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
00059 const G4Plane3D& plane )
00060 {
00061
00062
00063
00064 G4double kCarTolerance =
00065 G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
00066
00067 G4ThreeVector Xvec(1.,0.,0.);
00068 G4Vector3D vecV = -Xvec.cross(plane.normal());
00069 if( vecV.mag() < kCarTolerance )
00070 {
00071 G4ThreeVector Zvec(0.,0.,1.);
00072 vecV = Zvec.cross(plane.normal());
00073 }
00074
00075 G4Vector3D vecW = plane.normal().cross( vecV );
00076
00077 SetParameters( pos, mom, vecV, vecW );
00078 }
00079
00080
00081
00082 void G4ErrorSurfaceTrajParam::
00083 SetParameters( const G4Point3D& pos, const G4Vector3D& mom,
00084 const G4Vector3D& vecV, const G4Vector3D& vecW )
00085 {
00086 if( mom.mag() > 0. ) {
00087 fDir = mom;
00088 fDir /= mom.mag();
00089 } else {
00090 fDir = G4Vector3D(0.,0.,0.);
00091 }
00092 fVectorV = vecV / vecV.mag();
00093 fVectorW = vecW / vecW.mag();
00094 fInvP = 1./mom.mag();
00095 G4ThreeVector momv(mom);
00096
00097
00098
00099
00100
00101 fPV = momv.dot( vecV );
00102 fPW = momv.dot( vecW );
00103
00104
00105 G4ThreeVector posv(pos);
00106
00107
00108 fV = posv.dot( vecV );
00109 fW = posv.dot( vecW );
00110 }
00111
00112
00113
00114 std::ostream& operator<<(std::ostream& out, const G4ErrorSurfaceTrajParam& tp)
00115 {
00116
00117
00118
00119
00120 out << " InvP= " << tp.fInvP << " PV= " << tp.fPV
00121 << " PW= " << tp.fPW << " V= " << tp.fV << " W= " << tp.fW << G4endl;
00122 out << " vectorV direction= " << tp.fVectorV
00123 << " vectorW direction= " << tp.fVectorW << G4endl;
00124
00125 return out;
00126 }