[831] | 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 | // $Id: G4MagIntegratorDriver.icc,v 1.13 2007/05/10 10:10:48 japost Exp $ |
---|
[1231] | 28 | // GEANT4 tag $Name: $ |
---|
[831] | 29 | // |
---|
| 30 | // -------------------------------------------------------------------- |
---|
| 31 | |
---|
| 32 | inline |
---|
| 33 | G4double G4MagInt_Driver::GetHmin() const |
---|
| 34 | { |
---|
| 35 | return fMinimumStep; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | inline |
---|
| 39 | G4double G4MagInt_Driver::Hmin() const |
---|
| 40 | { |
---|
| 41 | return fMinimumStep; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | inline |
---|
| 45 | G4double G4MagInt_Driver::GetSafety() const |
---|
| 46 | { |
---|
| 47 | return safety; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | inline |
---|
| 51 | G4double G4MagInt_Driver::GetPshrnk() const |
---|
| 52 | { |
---|
| 53 | return pshrnk; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | inline |
---|
| 57 | G4double G4MagInt_Driver::GetPgrow() const |
---|
| 58 | { |
---|
| 59 | return pgrow; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | inline |
---|
| 63 | G4double G4MagInt_Driver::GetErrcon() const |
---|
| 64 | { |
---|
| 65 | return errcon; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | inline |
---|
| 69 | void G4MagInt_Driver::SetHmin(G4double newval) |
---|
| 70 | { |
---|
| 71 | fMinimumStep = newval; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | inline |
---|
| 75 | G4double G4MagInt_Driver::ComputeAndSetErrcon() |
---|
| 76 | { |
---|
| 77 | errcon = std::pow(max_stepping_increase/GetSafety(),1.0/GetPgrow()); |
---|
| 78 | return errcon; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | inline |
---|
| 82 | void G4MagInt_Driver::ReSetParameters(G4double new_safety) |
---|
| 83 | { |
---|
| 84 | safety = new_safety; |
---|
| 85 | pshrnk = -1.0 / pIntStepper->IntegratorOrder(); |
---|
| 86 | pgrow = -1.0 / (1.0 + pIntStepper->IntegratorOrder()); |
---|
| 87 | ComputeAndSetErrcon(); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | inline |
---|
| 91 | void G4MagInt_Driver::SetSafety(G4double val) |
---|
| 92 | { |
---|
| 93 | safety=val; |
---|
| 94 | ComputeAndSetErrcon(); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | inline |
---|
| 98 | void G4MagInt_Driver::SetPgrow(G4double val) |
---|
| 99 | { |
---|
| 100 | pgrow=val; |
---|
| 101 | ComputeAndSetErrcon(); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | inline |
---|
| 105 | void G4MagInt_Driver::SetErrcon(G4double val) |
---|
| 106 | { |
---|
| 107 | errcon=val; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | inline |
---|
| 111 | void G4MagInt_Driver::RenewStepperAndAdjust(G4MagIntegratorStepper *pItsStepper) |
---|
| 112 | { |
---|
| 113 | pIntStepper = pItsStepper; |
---|
| 114 | ReSetParameters(); |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | inline |
---|
| 118 | void G4MagInt_Driver::SetChargeMomentumMass(G4double particleCharge, // e+ |
---|
| 119 | G4double MomentumXc, |
---|
| 120 | G4double Mass ) |
---|
| 121 | { |
---|
| 122 | pIntStepper->GetEquationOfMotion() |
---|
| 123 | ->SetChargeMomentumMass(particleCharge, MomentumXc, Mass); |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | inline |
---|
| 127 | const G4MagIntegratorStepper* G4MagInt_Driver::GetStepper() const |
---|
| 128 | { |
---|
| 129 | return pIntStepper; |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | inline |
---|
| 133 | G4int G4MagInt_Driver::GetMaxNoSteps() const |
---|
| 134 | { |
---|
| 135 | return fMaxNoSteps; |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | inline |
---|
| 139 | void G4MagInt_Driver::SetMaxNoSteps(G4int val) |
---|
| 140 | { |
---|
| 141 | fMaxNoSteps= val; |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | inline |
---|
| 145 | void G4MagInt_Driver::GetDerivatives(const G4FieldTrack &y_curr, // const, INput |
---|
| 146 | G4double dydx[]) // OUTput |
---|
| 147 | { |
---|
| 148 | G4double tmpValArr[G4FieldTrack::ncompSVEC]; |
---|
| 149 | y_curr.DumpToArray( tmpValArr ); |
---|
| 150 | pIntStepper -> RightHandSide( tmpValArr , dydx ); |
---|
| 151 | } |
---|
| 152 | |
---|
| 153 | inline |
---|
| 154 | G4double G4MagInt_Driver::GetVerboseLevel() const |
---|
| 155 | { |
---|
| 156 | return fVerboseLevel; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | inline |
---|
| 160 | void G4MagInt_Driver::SetVerboseLevel(G4int newLevel) |
---|
| 161 | { |
---|
| 162 | fVerboseLevel= newLevel; |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | inline |
---|
| 166 | G4double G4MagInt_Driver::GetSmallestFraction() const |
---|
| 167 | { |
---|
| 168 | return fSmallestFraction; |
---|
| 169 | } |
---|