Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // 28 // Class Description: 29 // 30 // Represents a free G4ErrorTrajState 31 // It can be represented by the 5 variables 32 // 1/p, lambda, phi, y_perp, z_perp 33 // where lambda and phi are the dip and azimuthal angles related 34 // to the momentum components in the following way: 35 // p_x = p cos(lambda) cos(phi) ! lambda = 90 - theta 36 // p_y = p cos(lambda) sin(phi) 37 // p_z = p sin(lambda) 38 // y_perp and z_perp are the coordinates of the trajectory in a 39 // local orthonormal reference frame with the x_perp axis along the 40 // particle direction, the y_perp being parallel to the x-y plane. 41 // 42 // This class also takes care of propagating the error associated to 43 // the trajectory 44 45 // History: 46 // - Created: P. Arce 47 // -------------------------------------------------------------------- 48 49 #ifndef G4ErrorFreeTrajState_hh 50 #define G4ErrorFreeTrajState_hh 51 52 #include "globals.hh" 53 54 #include "G4ErrorMatrix.hh" 55 56 #include "G4ErrorTrajState.hh" 57 #include "G4ErrorFreeTrajParam.hh" 58 59 #include "G4Point3D.hh" 60 #include "G4Vector3D.hh" 61 62 class G4ErrorSurfaceTrajState; 63 64 class G4ErrorFreeTrajState : public G4ErrorTrajState 65 { 66 public: // with description 67 G4ErrorFreeTrajState() 68 : theFirstStep(true) 69 {} 70 G4ErrorFreeTrajState(const G4String& partName, const G4Point3D& pos, 71 const G4Vector3D& mom, 72 const G4ErrorTrajErr& errmat = G4ErrorTrajErr(5, 0)); 73 // Constructor by providing particle, position and momentum 74 75 G4ErrorFreeTrajState(const G4ErrorSurfaceTrajState& tpOS); 76 // Constructor by providing G4ErrorSurfaceTrajState 77 78 ~G4ErrorFreeTrajState() {} 79 80 virtual G4int Update(const G4Track* aTrack); 81 // update parameters from G4Track 82 83 virtual G4int PropagateError(const G4Track* aTrack); 84 // propagate the error along the step 85 86 virtual void Dump(std::ostream& out = G4cout) const; 87 // dump TrajState parameters 88 89 friend std::ostream& operator<<(std::ostream&, 90 const G4ErrorFreeTrajState& ts); 91 92 // Set and Get methods 93 94 virtual void SetPosition(const G4Point3D pos) 95 { 96 SetParameters(pos, fMomentum); 97 } 98 99 virtual void SetMomentum(const G4Vector3D& mom) 100 { 101 SetParameters(fPosition, mom); 102 } 103 104 void SetParameters(const G4Point3D& pos, const G4Vector3D& mom) 105 { 106 fPosition = pos; 107 fMomentum = mom; 108 fTrajParam.SetParameters(pos, mom); 109 } 110 111 G4ErrorFreeTrajParam GetParameters() const { return fTrajParam; } 112 113 G4ErrorMatrix GetTransfMat() const { return theTransfMat; } 114 115 private: 116 void Init(); 117 // define TrajState type and build charge 118 119 G4int PropagateErrorMSC(const G4Track* aTrack); 120 // add the error associated to multiple scattering 121 122 void CalculateEffectiveZandA(const G4Material* mate, double& effZ, 123 double& effA); 124 // calculate effective Z and A (needed by PropagateErrorMSC) 125 126 G4int PropagateErrorIoni(const G4Track* aTrack); 127 // add the error associated to ionization energy loss 128 129 private: 130 G4ErrorFreeTrajParam fTrajParam; 131 132 G4ErrorMatrix theTransfMat; 133 134 G4bool theFirstStep; // to count if transf mat is updated or initialized 135 }; 136 137 #endif 138