Ignore:
Timestamp:
Apr 17, 2009, 12:17:14 PM (15 years ago)
Author:
garnier
Message:

update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/processes/electromagnetic/standard/src/G4WentzelVIModel.cc

    r968 r991  
    2424// ********************************************************************
    2525//
    26 // $Id: G4WentzelVIModel.cc,v 1.17 2009/02/19 19:17:15 vnivanch Exp $
    27 // GEANT4 tag $Name: geant4-09-02-ref-02 $
     26// $Id: G4WentzelVIModel.cc,v 1.16 2008/11/19 11:47:50 vnivanch Exp $
     27// GEANT4 tag $Name: geant4-09-02 $
    2828//
    2929// -------------------------------------------------------------------
     
    6060#include "G4LossTableManager.hh"
    6161#include "G4ParticleChangeForMSC.hh"
    62 //#include "G4TransportationManager.hh"
    63 //#include "G4SafetyHelper.hh"
     62#include "G4TransportationManager.hh"
     63#include "G4SafetyHelper.hh"
    6464#include "G4PhysicsTableHelper.hh"
    6565#include "G4ElementVector.hh"
     
    138138      fParticleChange = new G4ParticleChangeForMSC();
    139139
    140     InitialiseSafetyHelper();
     140    safetyHelper = G4TransportationManager::GetTransportationManager()
     141      ->GetSafetyHelper();
     142    safetyHelper->InitialiseHelper();
    141143  }
    142144}
     
    275277  // i.e. when it is needed for optimization purposes
    276278  if(stepStatus != fGeomBoundary && presafety < tlimitminfix)
    277     presafety = ComputeSafety(sp->GetPosition(), tlimit);
     279    presafety = safetyHelper->ComputeSafety(sp->GetPosition());
    278280  /*
    279281  G4cout << "G4WentzelVIModel::ComputeTruePathLengthLimit tlimit= "
     
    568570
    569571    if(r > tlimitminfix) {
    570       pos /= r;
    571       ComputeDisplacement(fParticleChange, pos, r, safety);
     572      G4ThreeVector Position = *(fParticleChange->GetProposedPosition());
     573      G4double fac= 1.;
     574      if(r >= safety) {
     575        //  ******* so safety is computed at boundary too ************
     576        G4double newsafety =
     577          safetyHelper->ComputeSafety(Position) - tlimitminfix;
     578        if(newsafety <= 0.0) fac = 0.0;
     579        else if(r > newsafety) fac = newsafety/r ;
     580        //G4cout << "NewSafety= " << newsafety << " fac= " << fac
     581        // << " r= " << r << " sint= " << sint << " pos " << Position << G4endl;
     582      } 
     583
     584      if(fac > 0.) {
     585        // compute new endpoint of the Step
     586        G4ThreeVector newPosition = Position + fac*pos;
     587
     588        // check safety after displacement
     589        G4double postsafety = safetyHelper->ComputeSafety(newPosition);
     590
     591        // displacement to boundary
     592        if(postsafety <= 0.0) {
     593          safetyHelper->Locate(newPosition, newDirection);
     594
     595          // not on the boundary
     596        } else {
     597          safetyHelper->ReLocateWithinVolume(newPosition);
     598          // if(fac < 1.0) G4cout << "NewPosition " << newPosition << G4endl;
     599        }
     600     
     601        fParticleChange->ProposePosition(newPosition);
     602      }
    572603    }
    573604  }
Note: See TracChangeset for help on using the changeset viewer.