00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id: G4ErrorFreeTrajState.hh 69766 2013-05-14 14:33:55Z gcosmo $ 00028 // 00029 // Class Description: 00030 // 00031 // Represents a free G4ErrorTrajState 00032 // It can be represented by the 5 variables 00033 // 1/p, lambda, phi, y_perp, z_perp 00034 // where lambda and phi are the dip and azimuthal angles related 00035 // to the momentum components in the following way: 00036 // p_x = p cos(lambda) cos(phi) ! lambda = 90 - theta 00037 // p_y = p cos(lambda) sin(phi) 00038 // p_z = p sin(lambda) 00039 // y_perp and z_perp are the coordinates of the trajectory in a 00040 // local orthonormal reference frame with the x_perp axis along the 00041 // particle direction, the y_perp being parallel to the x-y plane. 00042 // 00043 // This class also takes care of propagating the error associated to 00044 // the trajectory 00045 00046 // History: 00047 // - Created: P. Arce 00048 // -------------------------------------------------------------------- 00049 00050 #ifndef G4ErrorFreeTrajState_hh 00051 #define G4ErrorFreeTrajState_hh 00052 00053 #include "globals.hh" 00054 00055 #include "G4ErrorMatrix.hh" 00056 00057 #include "G4ErrorTrajState.hh" 00058 #include "G4ErrorFreeTrajParam.hh" 00059 00060 #include "G4Point3D.hh" 00061 #include "G4Vector3D.hh" 00062 00063 class G4ErrorSurfaceTrajState; 00064 00065 class G4ErrorFreeTrajState : public G4ErrorTrajState 00066 { 00067 public: // with description 00068 00069 G4ErrorFreeTrajState() : theFirstStep(true) {} 00070 G4ErrorFreeTrajState( const G4String& partName, 00071 const G4Point3D& pos, 00072 const G4Vector3D& mom, 00073 const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5,0) ); 00074 // Constructor by providing particle, position and momentum 00075 00076 G4ErrorFreeTrajState( const G4ErrorSurfaceTrajState& tpOS ); 00077 // Constructor by providing G4ErrorSurfaceTrajState 00078 00079 ~G4ErrorFreeTrajState(){} 00080 00081 virtual G4int Update( const G4Track* aTrack ); 00082 // update parameters from G4Track 00083 00084 virtual G4int PropagateError( const G4Track* aTrack ); 00085 // propagate the error along the step 00086 00087 virtual void Dump( std::ostream& out = G4cout ) const; 00088 // dump TrajState parameters 00089 00090 friend 00091 std::ostream& operator<<(std::ostream&, const G4ErrorFreeTrajState& ts); 00092 00093 // Set and Get methods 00094 00095 virtual void SetPosition( const G4Point3D pos ) 00096 { SetParameters( pos, fMomentum ); } 00097 00098 virtual void SetMomentum( const G4Vector3D& mom ) 00099 { SetParameters( fPosition, mom ); } 00100 00101 void SetParameters( const G4Point3D& pos, const G4Vector3D& mom ) 00102 { 00103 fPosition = pos; 00104 fMomentum = mom; 00105 fTrajParam.SetParameters( pos, mom ); 00106 } 00107 00108 G4ErrorFreeTrajParam GetParameters() const 00109 { return fTrajParam; } 00110 00111 G4ErrorMatrix GetTransfMat() const 00112 { return theTransfMat; } 00113 00114 private: 00115 00116 void Init(); 00117 // define TrajState type and build charge 00118 00119 G4int PropagateErrorMSC( const G4Track* aTrack ); 00120 // add the error associated to multiple scattering 00121 00122 void CalculateEffectiveZandA( const G4Material* mate, double& effZ, double& effA ); 00123 // calculate effective Z and A (needed by PropagateErrorMSC) 00124 00125 G4int PropagateErrorIoni( const G4Track* aTrack ); 00126 // add the error associated to ionization energy loss 00127 00128 00129 private: 00130 00131 G4ErrorFreeTrajParam fTrajParam; 00132 00133 G4ErrorMatrix theTransfMat; 00134 00135 G4bool theFirstStep; // to count if transf mat is updated or initialized 00136 }; 00137 00138 #endif