G4Step.cc

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 //  G4Step.cc
00033 //
00034 //  Description:
00035 //    This class represents the Step of a particle tracked.
00036 //    It includes information of 
00037 //      1) List of Step points which compose the Step,
00038 //      2) static information of particle which generated the 
00039 //         Step, 
00040 //      3) trackID and parent particle ID of the Step,
00041 //      4) termination condition of the Step,
00042 //
00043 // Contact:
00044 //   Questions and comments to this code should be sent to
00045 //     Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
00046 //     Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
00047 //
00048 // ---------------------------------------------------------------
00049 
00050 #include "G4Step.hh"
00051 
00053 G4Step::G4Step()
00055   :  fTotalEnergyDeposit(0.0),fNonIonizingEnergyDeposit(0.0),
00056      fStepLength(0.), fpTrack(0), 
00057      fpSteppingControlFlag(NormalCondition),
00058      fFirstStepInVolume(false),
00059      fLastStepInVolume(false),
00060      fSecondary(0),
00061      nSecondaryByLastStep(0), secondaryInCurrentStep(),
00062      fpVectorOfAuxiliaryPointsPointer(0)
00063 {
00064   fpPreStepPoint  = new G4StepPoint();
00065   fpPostStepPoint = new G4StepPoint();
00066 
00067   secondaryInCurrentStep = new std::vector<CT>;
00068 }
00069 
00071 G4Step::~G4Step()
00073 {
00074   delete fpPreStepPoint;
00075   delete fpPostStepPoint;
00076 
00077   secondaryInCurrentStep->clear();
00078   delete secondaryInCurrentStep;
00079 
00080   if (fSecondary !=0 ) {
00081     fSecondary->clear();
00082     delete fSecondary;
00083   }
00084 }
00085 
00086 // Copy Counstructor and assignment operator
00087 
00089 G4Step::G4Step(const G4Step& right)
00091   :  fTotalEnergyDeposit(right.fTotalEnergyDeposit),
00092      fNonIonizingEnergyDeposit(right.fNonIonizingEnergyDeposit),
00093      fStepLength(right.fStepLength), 
00094      fpTrack(right.fpTrack), 
00095      fpSteppingControlFlag(right.fpSteppingControlFlag),
00096      fFirstStepInVolume(right.fFirstStepInVolume),
00097      fLastStepInVolume(right.fLastStepInVolume),
00098      nSecondaryByLastStep(right.nSecondaryByLastStep), 
00099      secondaryInCurrentStep(right.secondaryInCurrentStep),
00100      fpVectorOfAuxiliaryPointsPointer(right.fpVectorOfAuxiliaryPointsPointer)
00101 {
00102   if (right.fpPreStepPoint !=0) {
00103     fpPreStepPoint  = new G4StepPoint(*(right.fpPreStepPoint));
00104   } else {
00105     fpPreStepPoint  = new G4StepPoint();
00106   }
00107   if (right.fpPostStepPoint !=0) {
00108     fpPostStepPoint  = new G4StepPoint(*(right.fpPostStepPoint));
00109   } else {
00110     fpPostStepPoint  = new G4StepPoint();
00111   }
00112 
00113   if (right.fSecondary !=0) {
00114     fSecondary = new G4TrackVector(*(right.fSecondary));
00115   } else {
00116     fSecondary = new G4TrackVector();
00117   }
00118   secondaryInCurrentStep = new std::vector<CT>;
00119 }
00120 
00122 G4Step& G4Step::operator=(const G4Step & right)   
00123 
00124 {
00125   if (this != &right){
00126     fTotalEnergyDeposit  = right.fTotalEnergyDeposit;
00127     fNonIonizingEnergyDeposit = right.fNonIonizingEnergyDeposit;
00128     fStepLength            = right.fStepLength; 
00129     fpTrack                = right.fpTrack; 
00130     fpSteppingControlFlag  = right.fpSteppingControlFlag;
00131     fFirstStepInVolume     = right.fFirstStepInVolume;
00132     fLastStepInVolume      = right.fLastStepInVolume;
00133     nSecondaryByLastStep   = right.nSecondaryByLastStep; 
00134     secondaryInCurrentStep = right.secondaryInCurrentStep;
00135     fpVectorOfAuxiliaryPointsPointer = right.fpVectorOfAuxiliaryPointsPointer;
00136 
00137     if (fpPreStepPoint !=0 ) delete fpPreStepPoint;
00138     if (right.fpPreStepPoint !=0) {
00139       fpPreStepPoint  = new G4StepPoint(*(right.fpPreStepPoint));
00140     } else {
00141       fpPreStepPoint  = new G4StepPoint();
00142     }
00143     if (fpPostStepPoint !=0 ) delete fpPostStepPoint;
00144     if (right.fpPostStepPoint !=0) {
00145       fpPostStepPoint  = new G4StepPoint(*(right.fpPostStepPoint));
00146     } else {
00147       fpPostStepPoint  = new G4StepPoint();
00148     }
00149     if (right.fSecondary !=0) {
00150       fSecondary = new G4TrackVector(*(right.fSecondary));
00151     } else {
00152       fSecondary = new G4TrackVector();
00153     }
00154   }
00155   return *this;
00156 }
00157 
00159 G4ThreeVector G4Step::GetDeltaMomentum() const
00161 { 
00162   static G4bool isFirstTime = true;
00163   if (isFirstTime) {
00164     isFirstTime = false;
00165 #ifdef G4VERBOSE
00166     G4Exception( "G4Step::GetDeltaMomentum()","Warning", JustWarning, 
00167                  "This method is obsolete and will be removed soon");
00168 #endif
00169   }
00170 
00171   return fpPostStepPoint->GetMomentum()
00172     - fpPreStepPoint->GetMomentum(); 
00173 }
00174 
00176 G4double G4Step::GetDeltaEnergy() const
00178 { 
00179   static G4bool isFirstTime = true;
00180   if (isFirstTime) {
00181     isFirstTime = false;
00182 #ifdef G4VERBOSE
00183     G4Exception( "G4Step::GetDeltaEnergy()","Warning", JustWarning, 
00184                  "This method is obsolete and will be removed soon");
00185 #endif
00186   }
00187 
00188   return fpPostStepPoint->GetKineticEnergy()
00189     - fpPreStepPoint->GetKineticEnergy(); 
00190 }
00191 
00193 const std::vector<const G4Track*>* G4Step::GetSecondaryInCurrentStep() const 
00195 {
00196   secondaryInCurrentStep->clear();
00197   G4int nSecondary = fSecondary->size();
00198   for (G4int i=nSecondaryByLastStep; i<nSecondary; i++) {
00199     secondaryInCurrentStep->push_back((*fSecondary)[i]);
00200   }
00201   return  secondaryInCurrentStep;
00202 }
00203 

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