G4Step.icc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 //
00030 //---------------------------------------------------------------
00031 //
00032 //-----------------------------------------------------------------
00033 //  In-line definitions
00034 //-----------------------------------------------------------------
00035 
00036 // Get/Set functions 
00037 inline 
00038  G4StepPoint* G4Step::GetPreStepPoint() const 
00039  { 
00040    return fpPreStepPoint; 
00041  }
00042 
00043 inline 
00044  void G4Step::SetPreStepPoint(G4StepPoint* value)
00045  { 
00046    fpPreStepPoint = value; 
00047  }
00048 
00049 inline 
00050  G4StepPoint* G4Step::GetPostStepPoint() const
00051  { 
00052    return fpPostStepPoint; 
00053  }
00054    
00055 inline 
00056  void G4Step::SetPostStepPoint(G4StepPoint* value)
00057  { 
00058    fpPostStepPoint = value; 
00059  }
00060 
00061 inline 
00062  G4double G4Step::GetStepLength() const
00063  { 
00064    return fStepLength; 
00065  }
00066 
00067 inline 
00068  void G4Step::SetStepLength(G4double value)
00069  { 
00070    fStepLength = value; 
00071  }
00072 
00073 inline 
00074  G4ThreeVector G4Step::GetDeltaPosition() const
00075  { 
00076    return fpPostStepPoint->GetPosition()
00077             - fpPreStepPoint->GetPosition(); 
00078  }
00079 
00080 inline 
00081  G4double G4Step::GetDeltaTime() const
00082  { 
00083    return fpPostStepPoint->GetLocalTime()
00084             - fpPreStepPoint->GetLocalTime(); 
00085  }
00086 
00087 
00088 inline 
00089  G4double G4Step::GetTotalEnergyDeposit() const
00090  { 
00091    return fTotalEnergyDeposit; 
00092  }
00093 
00094 inline 
00095  void G4Step::SetTotalEnergyDeposit(G4double value)
00096  { 
00097    fTotalEnergyDeposit = value;   
00098  }
00099 
00100 inline 
00101  G4double G4Step::GetNonIonizingEnergyDeposit() const
00102  { 
00103    return fNonIonizingEnergyDeposit; 
00104  }
00105 
00106 inline 
00107  void G4Step::SetNonIonizingEnergyDeposit(G4double value)
00108  { 
00109    fNonIonizingEnergyDeposit = value;   
00110  }
00111 
00112 inline 
00113  void G4Step::AddTotalEnergyDeposit(G4double value)
00114  {
00115    fTotalEnergyDeposit += value;   
00116  }
00117 
00118 inline 
00119  void G4Step::ResetTotalEnergyDeposit()
00120  { 
00121    fTotalEnergyDeposit = 0.; 
00122    fNonIonizingEnergyDeposit = 0.;   
00123  }
00124 
00125 inline 
00126  void G4Step::AddNonIonizingEnergyDeposit(G4double value)
00127  { 
00128    fNonIonizingEnergyDeposit += value;   
00129  }
00130 
00131 inline 
00132  void G4Step::ResetNonIonizingEnergyDeposit()
00133  { 
00134    fNonIonizingEnergyDeposit = 0.; 
00135  }
00136 
00137 inline 
00138  void G4Step::SetControlFlag(G4SteppingControl value)
00139  {
00140    fpSteppingControlFlag = value;     
00141  }
00142 
00143 inline 
00144  G4SteppingControl G4Step::GetControlFlag() const
00145  {
00146    return fpSteppingControlFlag;     
00147  }
00148 
00149 inline 
00150  void G4Step::CopyPostToPreStepPoint( )
00151  {
00152    //This method is called at the beggining of each step 
00153    *(fpPreStepPoint) = *(fpPostStepPoint);
00154    fpPostStepPoint->SetStepStatus(fUndefined);
00155 
00156    // store number of secondaries
00157    nSecondaryByLastStep = fSecondary->size();
00158 }
00159 
00160 
00161 //-------------------------------------------------------------
00162 // To implement bi-directional association between G4Step and
00163 // and G4Track, a combined usage of 'forward declaration' and
00164 // 'include' is necessary.
00165 //-------------------------------------------------------------
00166 #include "G4Track.hh"
00167 
00168 inline 
00169  G4Track* G4Step::GetTrack() const
00170  { 
00171    return fpTrack; 
00172  }
00173    
00174 inline 
00175  void G4Step::SetTrack(G4Track* value)
00176  { 
00177    fpTrack = value; 
00178  }
00179 
00180 
00181 // Other member functions
00182 inline 
00183  void G4Step::InitializeStep( G4Track* aValue )
00184  {
00185    // Initialize G4Step attributes
00186    fStepLength = 0.;
00187    fTotalEnergyDeposit = 0.;
00188    fNonIonizingEnergyDeposit = 0.;
00189    fpTrack = aValue;
00190    fpTrack->SetStepLength(0.);
00191 
00192    nSecondaryByLastStep = 0;
00193    
00194    // Initialize G4StepPoint attributes.
00195    // To avoid the circular dependency between G4Track, G4Step
00196    // and G4StepPoint, G4Step has to manage the copy actions.
00197    fpPreStepPoint->SetPosition(fpTrack->GetPosition());
00198    fpPreStepPoint->SetGlobalTime(fpTrack->GetGlobalTime());
00199    fpPreStepPoint->SetLocalTime(fpTrack->GetLocalTime());
00200    fpPreStepPoint->SetProperTime(fpTrack->GetProperTime());
00201    fpPreStepPoint->SetMomentumDirection(fpTrack->GetMomentumDirection());
00202    fpPreStepPoint->SetKineticEnergy(fpTrack->GetKineticEnergy());
00203    fpPreStepPoint->SetTouchableHandle(fpTrack->GetTouchableHandle());
00204    fpPreStepPoint->SetMaterial( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterial());
00205    fpPreStepPoint->SetMaterialCutsCouple( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetMaterialCutsCouple());
00206    fpPreStepPoint->SetSensitiveDetector( fpTrack->GetTouchable()->GetVolume()->GetLogicalVolume()->GetSensitiveDetector());
00207    fpPreStepPoint->SetPolarization(fpTrack->GetPolarization());
00208    fpPreStepPoint->SetSafety(0.);
00209    fpPreStepPoint->SetStepStatus(fUndefined);
00210    fpPreStepPoint->SetProcessDefinedStep(0);
00211    fpPreStepPoint->SetMass(fpTrack->GetDynamicParticle()->GetMass());    
00212    fpPreStepPoint->SetCharge(fpTrack->GetDynamicParticle()->GetCharge()); 
00213    fpPreStepPoint->SetWeight(fpTrack->GetWeight());
00214 
00215    // Set Velocity
00216    //  should be placed after SetMaterial for preStep point     
00217     fpPreStepPoint->SetVelocity(fpTrack->CalculateVelocity());
00218   
00219    (*fpPostStepPoint) = (*fpPreStepPoint);
00220  }
00221 
00222 inline 
00223  void G4Step::UpdateTrack( )
00224  { 
00225    // To avoid the circular dependency between G4Track, G4Step
00226    // and G4StepPoint, G4Step has to manage the update actions.
00227    //  position, time
00228    fpTrack->SetPosition(fpPostStepPoint->GetPosition());
00229    fpTrack->SetGlobalTime(fpPostStepPoint->GetGlobalTime());
00230    fpTrack->SetLocalTime(fpPostStepPoint->GetLocalTime());
00231    fpTrack->SetProperTime(fpPostStepPoint->GetProperTime());
00232    //  energy, momentum, polarization
00233    fpTrack->SetMomentumDirection(fpPostStepPoint->GetMomentumDirection());
00234    fpTrack->SetKineticEnergy(fpPostStepPoint->GetKineticEnergy());
00235    fpTrack->SetPolarization(fpPostStepPoint->GetPolarization());
00236    //  mass charge
00237    G4DynamicParticle* pParticle = (G4DynamicParticle*)(fpTrack->GetDynamicParticle());
00238    pParticle->SetMass(fpPostStepPoint->GetMass());
00239    pParticle->SetCharge(fpPostStepPoint->GetCharge());
00240    //  step length
00241    fpTrack->SetStepLength(fStepLength);
00242    // NextTouchable is updated 
00243    // (G4Track::Touchable points touchable of Pre-StepPoint)
00244    fpTrack->SetNextTouchableHandle(fpPostStepPoint->GetTouchableHandle());
00245    fpTrack->SetWeight(fpPostStepPoint->GetWeight());
00246 
00247 
00248    // set velocity 
00249    fpTrack->SetVelocity(fpPostStepPoint->GetVelocity());
00250 }
00251 
00252 inline const G4TrackVector* G4Step::GetSecondary() const  
00253 {
00254    return fSecondary;
00255 }
00256 
00257 inline G4TrackVector* G4Step::GetfSecondary()  
00258 {
00259    return fSecondary;
00260 }
00261 
00262 inline void G4Step::SetSecondary(G4TrackVector* value)  
00263 {
00264    fSecondary=value;
00265 }
00266 
00267 inline 
00268  G4TrackVector* G4Step::NewSecondaryVector()  
00269 {
00270    fSecondary=new G4TrackVector();
00271    return fSecondary;
00272 }
00273 
00274 inline void G4Step::DeleteSecondaryVector()  
00275 {
00276    if (fSecondary !=0) {
00277      fSecondary->clear();
00278      delete fSecondary;
00279      fSecondary = 0;
00280    }
00281 }
00282 
00283 inline G4bool G4Step::IsFirstStepInVolume() const
00284 {
00285    return fFirstStepInVolume;
00286 }
00287 
00288 inline G4bool G4Step::IsLastStepInVolume() const
00289 {
00290    return fLastStepInVolume;
00291 }
00292 
00293 
00294  inline  void G4Step::SetFirstStepFlag()
00295 {
00296    fFirstStepInVolume = true;
00297 }
00298   
00299  inline  void G4Step::ClearFirstStepFlag()
00300 {
00301    fFirstStepInVolume = false;
00302 }
00303 
00304  inline  void G4Step::SetLastStepFlag()
00305 {
00306    fLastStepInVolume = true;
00307 }
00308   
00309  inline  void G4Step::ClearLastStepFlag()
00310 {
00311    fLastStepInVolume = false;
00312 }
00313 

Generated on Mon May 27 17:49:54 2013 for Geant4 by  doxygen 1.4.7