Bug1021 Class Reference

List of all members.


Detailed Description

class Bug1021 applies the workaround for Geant4 bug 1021

Public Member Functions

 Bug1021 (G4double _minStep)
void StartTracking (G4Track *track)
virtual G4double PostStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4ForceCondition *condition)
G4VParticleChange * PostStepDoIt (const G4Track &track, const G4Step &stepData)
virtual G4double AlongStepGetPhysicalInteractionLength (const G4Track &track, G4double previousStepSize, G4double currentMinimumStep, G4double &proposedSafety, G4GPILSelection *selection)
virtual G4VParticleChange * AlongStepDoIt (const G4Track &track, const G4Step &stepData)
virtual G4double AtRestGetPhysicalInteractionLength (const G4Track &track, G4ForceCondition *condition)
virtual G4VParticleChange * AtRestDoIt (const G4Track &track, const G4Step &stepData)

Private Attributes

G4double minStep
bool reflect
ParticleChange change

Classes

class  ParticleChange

Constructor & Destructor Documentation

Bug1021::Bug1021 ( G4double  _minStep  )  [inline]

References minStep, and reflect.

00065                                    :
00066                                 G4VProcess("Bug1021",fUserDefined), change() {
00067             minStep = _minStep;
00068             reflect = false;
00069             G4ParticleTable::G4PTblDicIterator *theParticleIterator =
00070                         G4ParticleTable::GetParticleTable()->GetIterator();
00071             theParticleIterator->reset();
00072             while((*theParticleIterator)()) {
00073                 G4ParticleDefinition *pd = theParticleIterator->value();
00074                 G4ProcessManager *pmgr = pd->GetProcessManager();
00075                 if(!pmgr) continue;
00076                 pmgr->AddProcess(this,ordDefault,-1,ordDefault);
00077             }
00078         }


Member Function Documentation

void Bug1021::StartTracking ( G4Track *  track  )  [inline]

References reflect.

00080 { reflect = false; }

virtual G4double Bug1021::PostStepGetPhysicalInteractionLength ( const G4Track &  track,
G4double  previousStepSize,
G4ForceCondition *  condition 
) [inline, virtual]

References E, BLGlobalField::GetFieldValue(), BLGlobalField::getObject(), minStep, and reflect.

00085                 { *condition = NotForced;
00086                   G4double q = track.GetDefinition()->GetPDGCharge();
00087                   if(q == 0.0) return DBL_MAX;
00088                   const G4ThreeVector &pos = track.GetPosition();
00089                   G4double point[4], field[6];
00090                   point[0] = pos[0];
00091                   point[1] = pos[1];
00092                   point[2] = pos[2];
00093                   point[3] = track.GetGlobalTime();
00094                   BLGlobalField::getObject()->GetFieldValue(point,field);
00095                   G4ThreeVector E(field[3],field[4],field[5]);
00096                   G4double Etot = E.mag();
00097                   if(Etot < 100*volt/meter) return DBL_MAX;
00098                   G4ThreeVector dir = track.GetMomentumDirection();
00099                   if((q>0.0?1.0:-1.0)*dir.dot(E.unit()) > -0.99) return DBL_MAX;
00100                   double distanceToStop = track.GetKineticEnergy()/Etot;
00101                   double step = distanceToStop / 2.0;
00102                   if(distanceToStop < minStep) {
00103                         step = 0.0;
00104                         reflect = true;
00105                   }
00106                   return step;
00107                 }

G4VParticleChange* Bug1021::PostStepDoIt ( const G4Track &  track,
const G4Step &  stepData 
) [inline]

References change, minStep, and reflect.

00110                 { change.Initialize(track);
00111                   if(reflect) {
00112                         G4ThreeVector dir=track.GetMomentumDirection();
00113                         //@@ need to reflect dir in plane perpendicular to E
00114                         // but dir || E, so this is good enough
00115                         dir[0] = -dir[0];
00116                         dir[1] = -dir[1];
00117                         dir[2] = -dir[2];
00118                         //@@ approximation for elapsed time
00119                         G4double time = track.GetGlobalTime();
00120                         time += minStep/track.GetVelocity();
00121                         change.ProposeGlobalTime(time);
00122                         change.ProposeMomentumDirection(dir);
00123                         reflect = false;
00124                   }
00125                   return &change;
00126                 }

virtual G4double Bug1021::AlongStepGetPhysicalInteractionLength ( const G4Track &  track,
G4double  previousStepSize,
G4double  currentMinimumStep,
G4double &  proposedSafety,
G4GPILSelection *  selection 
) [inline, virtual]

00131                 { return -1.0; }

virtual G4VParticleChange* Bug1021::AlongStepDoIt ( const G4Track &  track,
const G4Step &  stepData 
) [inline, virtual]

References change.

00134                 { change.Initialize(track);
00135                   return &change;
00136                 }

virtual G4double Bug1021::AtRestGetPhysicalInteractionLength ( const G4Track &  track,
G4ForceCondition *  condition 
) [inline, virtual]

00139                 { return -1.0; }

virtual G4VParticleChange* Bug1021::AtRestDoIt ( const G4Track &  track,
const G4Step &  stepData 
) [inline, virtual]

References change.

00142                 { change.Initialize(track);
00143                   return &change;
00144                 }


Member Data Documentation

G4double Bug1021::minStep [private]

bool Bug1021::reflect [private]


The documentation for this class was generated from the following file:
g4beamline