- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/magneticfield/src/G4ExactHelixStepper.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4ExactHelixStepper.cc,v 1. 9 2008/10/29 14:34:35 gcosmoExp $28 // GEANT4 tag $Name: geant4-09-04-beta-01$27 // $Id: G4ExactHelixStepper.cc,v 1.11 2010/07/21 13:46:01 tnikitin Exp $ 28 // GEANT4 tag $Name: field-V09-03-03 $ 29 29 // 30 30 // Helix a-la-Explicity Euler: x_1 = x_0 + helix(h) … … 43 43 #include "G4LineSection.hh" 44 44 45 46 45 G4ExactHelixStepper::G4ExactHelixStepper(G4Mag_EqRhs *EqRhs) 47 46 : G4MagHelicalStepper(EqRhs), 48 fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), yInitialEHS(DBL_MAX), yFinalEHS(-DBL_MAX)49 47 fBfieldValue(DBL_MAX, DBL_MAX, DBL_MAX), 48 fPtrMagEqOfMot(EqRhs) 50 49 { 51 const G4int nvar = 6 ; 52 G4int i; 53 for(i=0;i<nvar;i++) { 54 fYInSav[i]= DBL_MAX; 55 } 56 fPtrMagEqOfMot=EqRhs; 50 ; 57 51 } 58 52 … … 61 55 void 62 56 G4ExactHelixStepper::Stepper( const G4double yInput[], 63 64 65 66 57 const G4double*, 58 G4double hstep, 59 G4double yOut[], 60 G4double yErr[] ) 67 61 { 68 const G4int nvar = 6 62 const G4int nvar = 6; 69 63 70 64 G4int i; 71 // G4double yTemp[7], yIn[7] ;72 65 G4ThreeVector Bfld_value; 73 66 74 for(i=0;i<nvar;i++) { 75 // yIn[i]= yInput[i]; 76 fYInSav[i]= yInput[i]; 77 } 78 79 MagFieldEvaluate(yInput, Bfld_value) ; 80 81 // DumbStepper(yIn, Bfld_value, hstep, yTemp); 67 MagFieldEvaluate(yInput, Bfld_value); 82 68 AdvanceHelix(yInput, Bfld_value, hstep, yOut); 83 69 84 // We are assuming a constant field: helix is exact. 85 for(i=0;i<nvar;i++) { 86 yErr[i] = 0.0 ; 87 } 70 // We are assuming a constant field: helix is exact 71 // 72 for(i=0;i<nvar;i++) 73 { 74 yErr[i] = 0.0 ; 75 } 88 76 89 yInitialEHS = G4ThreeVector( yInput[0], yInput[1], yInput[2]); 90 yFinalEHS = G4ThreeVector( yOut[0], yOut[1], yOut[2]); 91 fBfieldValue=Bfld_value; 92 77 fBfieldValue=Bfld_value; 93 78 } 94 79 95 80 void 96 81 G4ExactHelixStepper::DumbStepper( const G4double yIn[], 97 98 99 82 G4ThreeVector Bfld, 83 G4double h, 84 G4double yOut[]) 100 85 { 101 86 // Assuming a constant field: solution is a helix 87 102 88 AdvanceHelix(yIn, Bfld, h, yOut); 103 89 104 G4Exception("G4ExactHelixStepper::DumbStepper should not be called.", 105 "EHS:NoDumbStepper", FatalException, "Stepper must do all the work." ); 90 G4Exception("G4ExactHelixStepper::DumbStepper", 91 "EHS:NoDumbStepper", FatalException, 92 "Should not be called. Stepper must do all the work." ); 106 93 } 107 94 … … 109 96 // --------------------------------------------------------------------------- 110 97 111 G4double G4ExactHelixStepper::DistChord() const 98 G4double 99 G4ExactHelixStepper::DistChord() const 112 100 { 113 101 // Implementation : must check whether h/R > pi !! 114 102 // If( h/R < pi) DistChord=h/2*std::tan(Ang_curve/4) 115 103 // Else DistChord=R_helix 116 // 104 117 105 G4double distChord; 118 106 G4double Ang_curve=GetAngCurve(); 119 107 120 121 if(Ang_curve<=pi){ 122 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve)); 123 } 124 else 125 if(Ang_curve<twopi){ 126 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve))); 127 } 128 else{ 129 distChord=2.*GetRadHelix(); 130 } 131 132 108 if (Ang_curve<=pi) 109 { 110 distChord=GetRadHelix()*(1-std::cos(0.5*Ang_curve)); 111 } 112 else if(Ang_curve<twopi) 113 { 114 distChord=GetRadHelix()*(1+std::cos(0.5*(twopi-Ang_curve))); 115 } 116 else 117 { 118 distChord=2.*GetRadHelix(); 119 } 133 120 134 121 return distChord; 135 136 122 } 137 123
Note: See TracChangeset
for help on using the changeset viewer.