Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/geometry/magneticfield/src/G4ExactHelixStepper.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ExactHelixStepper.cc,v 1.9 2008/10/29 14:34:35 gcosmo Exp $
    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 $
    2929//
    3030//  Helix a-la-Explicity Euler: x_1 = x_0 + helix(h)
     
    4343#include "G4LineSection.hh"
    4444
    45 
    4645G4ExactHelixStepper::G4ExactHelixStepper(G4Mag_EqRhs *EqRhs)
    4746  : 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)
    5049{
    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  ;
    5751}
    5852
     
    6155void
    6256G4ExactHelixStepper::Stepper( const G4double yInput[],
    63                               const G4double*,
    64                                     G4double hstep,
    65                                     G4double yOut[],
    66                                     G4double yErr[]      )
     57                              const G4double*,
     58                                    G4double hstep,
     59                                    G4double yOut[],
     60                                    G4double yErr[]      )
    6761
    68    const G4int nvar = 6 ;
     62   const G4int nvar = 6;
    6963
    7064   G4int i;
    71    // G4double      yTemp[7], yIn[7] ;
    7265   G4ThreeVector Bfld_value;
    7366
    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);       
    8268   AdvanceHelix(yInput, Bfld_value, hstep, yOut);
    8369
    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  }
    8876
    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;
    9378}
    9479
    9580void
    9681G4ExactHelixStepper::DumbStepper( const G4double  yIn[],
    97                                    G4ThreeVector   Bfld,
    98                                    G4double  h,
    99                                    G4double  yOut[])
     82                                        G4ThreeVector   Bfld,
     83                                        G4double  h,
     84                                        G4double  yOut[])
    10085{
    10186  // Assuming a constant field: solution is a helix
     87
    10288  AdvanceHelix(yIn, Bfld, h, yOut);
    10389
    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." );
    10693
    10794
     
    10996// ---------------------------------------------------------------------------
    11097
    111 G4double G4ExactHelixStepper::DistChord()   const
     98G4double
     99G4ExactHelixStepper::DistChord() const
    112100{
    113101  // Implementation : must check whether h/R >  pi  !!
    114102  //   If( h/R <  pi)   DistChord=h/2*std::tan(Ang_curve/4)
    115103  //   Else             DistChord=R_helix
    116   //
     104
    117105  G4double distChord;
    118106  G4double Ang_curve=GetAngCurve();
    119107
    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  }
    133120
    134121  return distChord;
    135  
    136122}   
    137123
Note: See TracChangeset for help on using the changeset viewer.