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

update ti head

Location:
trunk/source/track/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/track/src/CVS/Entries

    r1337 r1340  
    1 /G4FieldTrackUpdator.cc/1.2/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    2 /G4ParticleChange.cc/1.31/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    3 /G4ParticleChangeForDecay.cc/1.11/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    4 /G4ParticleChangeForGamma.cc/1.3/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    5 /G4ParticleChangeForLoss.cc/1.17/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    6 /G4ParticleChangeForMSC.cc/1.14/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    7 /G4ParticleChangeForTransport.cc/1.19/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    8 /G4Step.cc/1.7/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    9 /G4StepPoint.cc/1.13/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    10 /G4Track.cc/1.32/Thu Sep 30 06:16:10 2010//Tgeant4-09-04-beta-01
    11 /G4VParticleChange.cc/1.21/Thu Sep 30 06:16:11 2010//Tgeant4-09-04-beta-01
    12 /G4VUserTrackInformation.cc/1.4/Thu Sep 30 06:16:11 2010//Tgeant4-09-04-beta-01
     1/G4FieldTrackUpdator.cc/1.2/Thu Sep 30 06:16:10 2010//Ttrack-V09-03-09
     2/G4VUserTrackInformation.cc/1.4/Thu Sep 30 06:16:11 2010//Ttrack-V09-03-09
     3/G4ParticleChange.cc/1.32/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     4/G4ParticleChangeForDecay.cc/1.12/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     5/G4ParticleChangeForGamma.cc/1.4/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     6/G4ParticleChangeForLoss.cc/1.18/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     7/G4ParticleChangeForMSC.cc/1.15/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     8/G4ParticleChangeForTransport.cc/1.20/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     9/G4Step.cc/1.11/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     10/G4StepPoint.cc/1.15/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     11/G4Track.cc/1.35/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
     12/G4VParticleChange.cc/1.22/Fri Nov  5 10:05:20 2010//Ttrack-V09-03-09
    1313D
  • trunk/source/track/src/CVS/Tag

    r1331 r1340  
    1 Ngeant4-09-04-beta-01
     1Ntrack-V09-03-09
  • trunk/source/track/src/G4ParticleChange.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChange.cc,v 1.31 2009/04/02 02:22:30 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChange.cc,v 1.32 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    5151#include "G4ExceptionSeverity.hh"
    5252
    53 
    54 G4ParticleChange::G4ParticleChange():G4VParticleChange()
     53G4ParticleChange::G4ParticleChange()
     54  : G4VParticleChange(), theEnergyChange(0.), theTimeChange(0.),
     55    theProperTimeChange(0.), theMassChange(0.), theChargeChange(0.),
     56    theMagneticMomentChange(0.), theCurrentTrack(0)
    5557{
    5658  G4VParticleChange::SetSecondaryWeightByProcess(false);
    5759  G4VParticleChange::SetParentWeightByProcess(false);
    58 
    5960}
    6061
     
    389390  G4VParticleChange::DumpInfo();
    390391
    391   G4cout.precision(3);
     392  G4int oldprc = G4cout.precision(3);
    392393
    393394  G4cout << "        Mass (GeV)   : "
     
    439440       << std::setw(20) <<  thePolarizationChange.z()
    440441       << G4endl;
     442  G4cout.precision(oldprc);
    441443}
    442444
  • trunk/source/track/src/G4ParticleChangeForDecay.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChangeForDecay.cc,v 1.11 2006/06/29 21:15:03 gunter Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChangeForDecay.cc,v 1.12 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4646#include "G4ExceptionSeverity.hh"
    4747
    48 G4ParticleChangeForDecay::G4ParticleChangeForDecay():G4VParticleChange()
     48G4ParticleChangeForDecay::G4ParticleChangeForDecay()
     49  : G4VParticleChange(), theTimeChange(0.)
    4950{
    5051#ifdef G4VERBOSE
     
    159160  G4VParticleChange::DumpInfo();
    160161
    161   G4cout.precision(3);
     162  G4int oldprc = G4cout.precision(3);
    162163  G4cout << "        Time (ns)           : "
    163        << std::setw(20) << theTimeChange/ns
    164        << G4endl;
     164         << std::setw(20) << theTimeChange/ns << G4endl;
     165  G4cout.precision(oldprc);
    165166}
    166167
  • trunk/source/track/src/G4ParticleChangeForGamma.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChangeForGamma.cc,v 1.3 2006/08/28 16:10:29 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChangeForGamma.cc,v 1.4 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4747#include "G4ExceptionSeverity.hh"
    4848
    49 G4ParticleChangeForGamma::G4ParticleChangeForGamma():G4VParticleChange()
     49G4ParticleChangeForGamma::G4ParticleChangeForGamma()
     50 : G4VParticleChange(), currentTrack(0), proposedKinEnergy(0.)
    5051{
    5152  theSteppingControlFlag = NormalCondition;
     
    112113  G4VParticleChange::DumpInfo();
    113114
    114   G4cout.precision(3);
     115  G4int oldprc = G4cout.precision(3);
    115116  G4cout << "        Kinetic Energy (MeV): "
    116117       << std::setw(20) << proposedKinEnergy/MeV
     
    122123       << std::setw(20) << proposedPolarization
    123124       << G4endl;
     125  G4cout.precision(oldprc);
    124126}
    125127
  • trunk/source/track/src/G4ParticleChangeForLoss.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChangeForLoss.cc,v 1.17 2009/05/26 13:19:41 vnivanch Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChangeForLoss.cc,v 1.18 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    5050
    5151G4ParticleChangeForLoss::G4ParticleChangeForLoss()
    52   :G4VParticleChange(), lowEnergyLimit(1.0*eV)
     52  : G4VParticleChange(), currentTrack(0), proposedKinEnergy(0.),
     53    lowEnergyLimit(1.0*eV), currentCharge(0.)
    5354{
    5455  theSteppingControlFlag = NormalCondition;
     
    7071}
    7172
    72 G4ParticleChangeForLoss::G4ParticleChangeForLoss(
    73              const G4ParticleChangeForLoss &right): G4VParticleChange(right)
     73G4ParticleChangeForLoss::
     74G4ParticleChangeForLoss(const G4ParticleChangeForLoss &right)
     75  : G4VParticleChange(right)
    7476{
    7577  if (verboseLevel>1) {
     
    7880  currentTrack = right.currentTrack;
    7981  proposedKinEnergy = right.proposedKinEnergy;
     82  lowEnergyLimit = right.lowEnergyLimit;
    8083  currentCharge = right.currentCharge;
    8184  proposedMomentumDirection = right.proposedMomentumDirection;
     
    115118  G4VParticleChange::DumpInfo();
    116119
    117   G4cout.precision(3);
     120  G4int oldprc = G4cout.precision(3);
    118121  G4cout << "        Charge (eplus)   : "
    119122       << std::setw(20) << currentCharge/eplus
     
    131134       << std::setw(20) << proposedMomentumDirection.z()
    132135       << G4endl;
     136  G4cout.precision(oldprc);
    133137}
    134138
  • trunk/source/track/src/G4ParticleChangeForMSC.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChangeForMSC.cc,v 1.14 2009/04/02 02:22:30 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChangeForMSC.cc,v 1.15 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4545#include "G4ExceptionSeverity.hh"
    4646
    47 G4ParticleChangeForMSC::G4ParticleChangeForMSC():G4VParticleChange()
     47G4ParticleChangeForMSC::G4ParticleChangeForMSC()
     48  : G4VParticleChange()
    4849{
    4950#ifdef G4VERBOSE
     
    6364}
    6465
    65 G4ParticleChangeForMSC::G4ParticleChangeForMSC(
    66              const G4ParticleChangeForMSC &right): G4VParticleChange(right)
     66G4ParticleChangeForMSC::
     67G4ParticleChangeForMSC(const G4ParticleChangeForMSC &right)
     68  : G4VParticleChange(right)
    6769{
    6870   if (verboseLevel>1) {
     
    133135  G4VParticleChange::DumpInfo();
    134136
    135   G4cout.precision(3);
     137  G4int oldprc = G4cout.precision(3);
    136138  G4cout << "        Position - x (mm)   : "
    137139       << std::setw(20) << thePosition.x()/mm
     
    152154       << std::setw(20) << theMomentumDirection.z()
    153155       << G4endl;
     156  G4cout.precision(oldprc);
    154157}
    155158
  • trunk/source/track/src/G4ParticleChangeForTransport.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4ParticleChangeForTransport.cc,v 1.19 2006/11/03 17:45:04 japost Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4ParticleChangeForTransport.cc,v 1.20 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4747#include "G4DynamicParticle.hh"
    4848
    49 G4ParticleChangeForTransport::G4ParticleChangeForTransport():G4ParticleChange()
     49G4ParticleChangeForTransport::G4ParticleChangeForTransport()
     50  : G4ParticleChange(), isMomentumChanged(false), theMaterialChange(0),
     51    theMaterialCutsCoupleChange(0), theSensitiveDetectorChange(0)
    5052{
    5153  if (verboseLevel>2) {
    52     G4cout << "G4ParticleChangeForTransport::G4ParticleChangeForTransport() " << G4endl;
     54    G4cout << "G4ParticleChangeForTransport::G4ParticleChangeForTransport() "
     55           << G4endl;
    5356  }
    5457}
     
    5760{
    5861  if (verboseLevel>2) {
    59     G4cout << "G4ParticleChangeForTransport::~G4ParticleChangeForTransport() " << G4endl;
    60   }
    61 }
    62 
    63 
    64 G4ParticleChangeForTransport::G4ParticleChangeForTransport(const G4ParticleChangeForTransport &right):G4ParticleChange(right)
     62    G4cout << "G4ParticleChangeForTransport::~G4ParticleChangeForTransport() "
     63           << G4endl;
     64  }
     65}
     66
     67G4ParticleChangeForTransport::
     68G4ParticleChangeForTransport(const G4ParticleChangeForTransport &r)
     69  : G4ParticleChange(r)
    6570{
    6671  if (verboseLevel>0) {
    67     G4cout << "G4ParticleChangeForTransport::  copy constructor is called " << G4endl;
    68   }
    69   theTouchableHandle = right.theTouchableHandle;
     72    G4cout << "G4ParticleChangeForTransport::  copy constructor is called "
     73           << G4endl;
     74  }
     75  theTouchableHandle = r.theTouchableHandle;
     76  isMomentumChanged = r.isMomentumChanged;
     77  theMaterialChange = r.theMaterialChange;
     78  theMaterialCutsCoupleChange = r.theMaterialCutsCoupleChange;
     79  theSensitiveDetectorChange = r.theSensitiveDetectorChange;
    7080}
    7181
    7282// assignemnt operator
    73 G4ParticleChangeForTransport & G4ParticleChangeForTransport::operator=(const G4ParticleChangeForTransport &right)
     83G4ParticleChangeForTransport &
     84G4ParticleChangeForTransport::operator=(const G4ParticleChangeForTransport &r)
    7485{
    7586   if (verboseLevel>1) {
    76     G4cout << "G4ParticleChangeForTransport:: assignment operator is called " << G4endl;
     87    G4cout << "G4ParticleChangeForTransport:: assignment operator is called "
     88           << G4endl;
    7789   }
    78    if (this != &right)
     90   if (this != &r)
    7991   {
    80       theListOfSecondaries = right.theListOfSecondaries;
    81       theSizeOftheListOfSecondaries = right.theSizeOftheListOfSecondaries;
    82       theNumberOfSecondaries = right.theNumberOfSecondaries;
    83       theStatusChange = right.theStatusChange;
    84       theTouchableHandle = right.theTouchableHandle;
    85       theMaterialChange = right.theMaterialChange;
    86       theMaterialCutsCoupleChange = right.theMaterialCutsCoupleChange;
    87       theSensitiveDetectorChange = right.theSensitiveDetectorChange;
    88       theMomentumDirectionChange = right.theMomentumDirectionChange;
    89       thePolarizationChange = right.thePolarizationChange;
    90       thePositionChange = right.thePositionChange;
    91       theTimeChange = right.theTimeChange;
    92       theEnergyChange = right.theEnergyChange;
    93       theTrueStepLength = right.theTrueStepLength;
    94       theLocalEnergyDeposit = right.theLocalEnergyDeposit;
    95       theSteppingControlFlag = right.theSteppingControlFlag;
     92      theListOfSecondaries = r.theListOfSecondaries;
     93      theSizeOftheListOfSecondaries = r.theSizeOftheListOfSecondaries;
     94      theNumberOfSecondaries = r.theNumberOfSecondaries;
     95      theStatusChange = r.theStatusChange;
     96      theTouchableHandle = r.theTouchableHandle;
     97      theMaterialChange = r.theMaterialChange;
     98      theMaterialCutsCoupleChange = r.theMaterialCutsCoupleChange;
     99      theSensitiveDetectorChange = r.theSensitiveDetectorChange;
     100      theMomentumDirectionChange = r.theMomentumDirectionChange;
     101      thePolarizationChange = r.thePolarizationChange;
     102      thePositionChange = r.thePositionChange;
     103      theTimeChange = r.theTimeChange;
     104      theEnergyChange = r.theEnergyChange;
     105      theTrueStepLength = r.theTrueStepLength;
     106      theLocalEnergyDeposit = r.theLocalEnergyDeposit;
     107      theSteppingControlFlag = r.theSteppingControlFlag;
    96108   }
    97109   return *this;
     
    106118  // Nothing happens for AtRestDoIt
    107119  if (verboseLevel>0) {
    108     G4cout << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called" << G4endl;
     120    G4cout << "G4ParticleChangeForTransport::UpdateStepForAtRest() is called"
     121           << G4endl;
    109122    G4cout << " Nothing happens for this method " << G4endl;
    110123  }
     
    236249  G4ParticleChange::DumpInfo();
    237250
    238   G4cout.precision(3);
     251  G4int oldprc = G4cout.precision(3);
    239252  G4cout << "        Touchable (pointer) : "
    240        << std::setw(20) << theTouchableHandle()
    241        << G4endl;
    242 }
    243 
    244 
    245 
    246 
    247 
    248 
    249 
    250 
     253         << std::setw(20) << theTouchableHandle() << G4endl;
     254  G4cout.precision(oldprc);
     255}
  • trunk/source/track/src/G4Step.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4Step.cc,v 1.7 2006/10/30 09:50:13 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4Step.cc,v 1.11 2010/10/30 07:49:08 kurasige Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    5454G4Step::G4Step()
    5555////////////////
     56  :  fTotalEnergyDeposit(0.0),fNonIonizingEnergyDeposit(0.0),
     57     fStepLength(0.), fpTrack(0),
     58     fpSteppingControlFlag(NormalCondition),fSecondary(0),
     59     fpVectorOfAuxiliaryPointsPointer(0)
    5660{
    5761  fpPreStepPoint  = new G4StepPoint();
     
    6973  delete fpPostStepPoint;
    7074}
     75
     76
     77/////////////////
     78G4ThreeVector G4Step::GetDeltaMomentum() const
     79/////////////////
     80{
     81  static G4bool isFirstTime = true;
     82  if (isFirstTime) {
     83    isFirstTime = false;
     84#ifdef G4VERBOSE
     85    G4Exception( "G4Step::GetDeltaMomentum()","Warning", JustWarning,
     86                 "This method is obsolete and will be removed soon");
     87#endif
     88  }
     89
     90  return fpPostStepPoint->GetMomentum()
     91    - fpPreStepPoint->GetMomentum();
     92}
     93
     94/////////////////
     95G4double G4Step::GetDeltaEnergy() const
     96  /////////////////
     97{
     98  static G4bool isFirstTime = true;
     99  if (isFirstTime) {
     100    isFirstTime = false;
     101#ifdef G4VERBOSE
     102    G4Exception( "G4Step::GetDeltaEnergy()","Warning", JustWarning,
     103                 "This method is obsolete and will be removed soon");
     104#endif
     105  }
     106
     107  return fpPostStepPoint->GetKineticEnergy()
     108    - fpPreStepPoint->GetKineticEnergy();
     109}
  • trunk/source/track/src/G4StepPoint.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4StepPoint.cc,v 1.13 2007/03/11 07:19:06 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4StepPoint.cc,v 1.15 2010/10/30 07:49:09 kurasige Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4747
    4848//////////////////////////
    49 G4StepPoint::G4StepPoint():
     49G4StepPoint::G4StepPoint()
    5050//////////////////////////
    51   fpTouchable(0), fpMaterial(0), fpMaterialCutsCouple(0), fpSensitiveDetector(0),
    52   fpProcessDefinedStep(0), fCharge(0.)
     51  : fGlobalTime(0.), fLocalTime(0.), fProperTime(0.),
     52    fKineticEnergy(0.), fVelocity(0.), fpTouchable(0), fpMaterial(0),
     53    fpMaterialCutsCouple(0), fpSensitiveDetector(0), fSafety(0.),
     54    fStepStatus(fUndefined),fpProcessDefinedStep(0),
     55    fMass(0.), fCharge(0.), fMagneticMoment(0.),
     56    fWeight(0.)
    5357{
    5458}
  • trunk/source/track/src/G4Track.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4Track.cc,v 1.32 2009/04/08 08:07:24 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4Track.cc,v 1.35 2010/09/21 00:33:05 kurasige Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    4141
    4242#include "G4Track.hh"
     43#include "G4ParticleTable.hh"
    4344
    4445G4Allocator<G4Track> aTrackAllocator;
     46
     47G4PhysicsLogVector* G4Track::velTable = 0;
     48
     49const G4double G4Track::maxT = 100.0;
     50const G4double G4Track::minT = 0.0001;
    4551
    4652///////////////////////////////////////////////////////////
     
    6066    fVtxKineticEnergy(0.0),
    6167    fpLVAtVertex(0),          fpCreatorProcess(0),
    62     fpUserInformation(0)
     68    fpUserInformation(0),
     69    prev_mat(0),  groupvel(0),
     70    prev_velocity(0.0), prev_momentum(0.0),
     71    is_OpticalPhoton(false)
    6372{   
     73  static G4bool isFirstTime = true;
     74  static G4ParticleDefinition* fOpticalPhoton =0;
     75  if ( isFirstTime ) {
     76    isFirstTime = false;
     77    // set  fOpticalPhoton
     78    fOpticalPhoton = G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
     79  }
     80  // check if the particle type is Optical Photon
     81  is_OpticalPhoton = (fpDynamicParticle->GetDefinition() == fOpticalPhoton);
     82
     83  if (velTable==0) PrepareVelocityTable();
    6484}
    6585
     
    7898    fVtxKineticEnergy(0.0),
    7999    fpLVAtVertex(0),          fpCreatorProcess(0),
    80     fpUserInformation(0)
     100    fpUserInformation(0),
     101    prev_mat(0),  groupvel(0),
     102    prev_velocity(0.0), prev_momentum(0.0),
     103    is_OpticalPhoton(false)
    81104{
    82105}
     
    84107G4Track::G4Track(const G4Track& right)
    85108//////////////////
     109  : fCurrentStepNumber(0),   
     110    fGlobalTime(0),           fLocalTime(0.),
     111    fTrackLength(0.),
     112    fParentID(0),             fTrackID(0),
     113    fpDynamicParticle(0),
     114    fTrackStatus(fAlive),
     115    fBelowThreshold(false),   fGoodForTracking(false),
     116    fStepLength(0.0),         fWeight(1.0),
     117    fpStep(0),
     118    fVtxKineticEnergy(0.0),
     119    fpLVAtVertex(0),          fpCreatorProcess(0),
     120    fpUserInformation(0),
     121    prev_mat(0),  groupvel(0),
     122    prev_velocity(0.0), prev_momentum(0.0),
     123    is_OpticalPhoton(false)
    86124{
    87125  *this = right;
     
    136174   fpCreatorProcess = 0;
    137175   fpUserInformation = 0;
     176
     177   prev_mat = right.prev_mat;
     178   groupvel = right.groupvel;
     179   prev_velocity = right.prev_velocity;
     180   prev_momentum = right.prev_momentum;
     181
     182   is_OpticalPhoton = right.is_OpticalPhoton;
     183
    138184  }
    139185  return *this;
     
    147193}
    148194
    149 #include "G4ParticleTable.hh"
    150195///////////////////
    151196G4double G4Track::GetVelocity() const
    152197///////////////////
    153198{
    154   static G4bool isFirstTime = true;
    155   static G4ParticleDefinition* fOpticalPhoton =0;
    156  
    157   static G4Material*               prev_mat =0;
    158   static G4MaterialPropertyVector* groupvel =0;
    159   static G4double                  prev_velocity =0;
    160   static G4double                  prev_momentum =0;
    161  
    162 
    163   if ( isFirstTime ) {
    164     isFirstTime = false;
    165     // set  fOpticalPhoton
    166     fOpticalPhoton = G4ParticleTable::GetParticleTable()->FindParticle("opticalphoton");
    167   }
    168 
    169   G4double velocity ;
     199   
     200  G4double velocity = c_light ;
    170201 
    171202  G4double mass = fpDynamicParticle->GetMass();
    172203
    173   velocity = c_light ;
    174 
    175204  // special case for photons
    176   if (  (fOpticalPhoton !=0)  &&
    177         (fpDynamicParticle->GetDefinition()==fOpticalPhoton) ){
     205  if ( is_OpticalPhoton ) {
    178206
    179207    G4Material* mat=0;
     
    187215    }
    188216    // check if previous step is in the same volume
    189     //  and get new GROUPVELOVITY table if necessary
    190     if ((mat != prev_mat)||(groupvel==0)) {
     217    //  and get new GROUPVELOCITY table if necessary
     218    if ((mat != 0) && ((mat != prev_mat)||(groupvel==0))) {
    191219        groupvel = 0;
    192220        if(mat->GetMaterialPropertiesTable() != 0)
     
    203231        // check if momentum is same as in the previous step
    204232        //  and calculate group velocity if necessary
    205         if( update_groupvel || (fpDynamicParticle->GetTotalMomentum() != prev_momentum) ) {
     233        G4double current_momentum = fpDynamicParticle->GetTotalMomentum();
     234        if( update_groupvel || (current_momentum != prev_momentum) ) {
    206235          velocity =
    207             groupvel->GetProperty(fpDynamicParticle->GetTotalMomentum());
    208            prev_velocity = velocity;
    209           prev_momentum = fpDynamicParticle->GetTotalMomentum();
     236            groupvel->GetProperty(current_momentum);
     237          prev_velocity = velocity;
     238          prev_momentum = current_momentum;
    210239        }
    211240    }
    212241
    213242  } else {
     243    // particles other than optical photon
    214244    if (mass<DBL_MIN) {
     245      // Zero Mass
    215246      velocity = c_light;
    216247    } else {
    217       G4double T = fpDynamicParticle->GetKineticEnergy();
    218       velocity = c_light*std::sqrt(T*(T+2.*mass))/(T+mass);
    219     }
     248      G4double T = (fpDynamicParticle->GetKineticEnergy())/mass;
     249      if (T > maxT) {
     250        velocity = c_light;
     251      } else if (T<DBL_MIN) {
     252        velocity =0.;
     253      } else if (T<minT) {
     254        velocity = c_light*std::sqrt(T*(T+2.))/(T+1.0);
     255      } else { 
     256        velocity = velTable->Value(T);
     257      }
     258    }
     259     
    220260  }
    221261                                                                               
    222262  return velocity ;
    223263}
     264
     265///////////////////
     266void G4Track::PrepareVelocityTable()
     267///////////////////
     268{
     269  const G4int NBIN=300;
     270  velTable = new G4PhysicsLogVector(minT, maxT, NBIN);
     271  for (G4int i=0; i<=NBIN; i++){
     272    G4double T = velTable->Energy(i);
     273    velTable->PutValue(i, c_light*std::sqrt(T*(T+2.))/(T+1.0) );
     274  }
     275  return;
     276}
  • trunk/source/track/src/G4VParticleChange.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4VParticleChange.cc,v 1.21 2009/04/02 02:22:30 kurasige Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4VParticleChange.cc,v 1.22 2010/07/21 09:30:15 gcosmo Exp $
     28// GEANT4 tag $Name: track-V09-03-09 $
    2929//
    3030//
     
    5353   theLocalEnergyDeposit(0.0),
    5454   theNonIonizingEnergyDeposit(0.0),
     55   theTrueStepLength(0.0),
    5556   theFirstStepInVolume(false),
    5657   theLastStepInVolume(false),
     
    163164
    164165// Show header
    165   G4cout.precision(3);
     166  G4int olprc = G4cout.precision(3);
    166167  G4cout << "      -----------------------------------------------"
    167168       << G4endl;
     
    220221    G4cout << "    Last Step In the voulme  : "  << G4endl;
    221222  }
     223  G4cout.precision(olprc);
    222224}
    223225
Note: See TracChangeset for help on using the changeset viewer.