Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/Geant4/G4Step.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4Step
0027 //
0028 // Class description:
0029 //
0030 // This class represents the Step of a particle being tracked.
0031 // It includes information of:
0032 //     1) List of Step points which compose the Step,
0033 //     2) static information of particle which generated the Step,
0034 //     3) trackID and parent particle ID of the Step,
0035 //     4) termination condition of the Step.
0036 
0037 // Authors:
0038 //   Katsuya Amako  (e-mail: Katsuya.Amako@kek.jp)
0039 //   Takashi Sasaki (e-mail: Takashi.Sasaki@kek.jp)
0040 // Revisions:
0041 //   Hisaya Kurashige, 1998-2007
0042 // --------------------------------------------------------------------
0043 #ifndef G4Step_hh
0044 #define G4Step_hh 1
0045 
0046 #include <cstdlib>               // Include from 'system'
0047 #include <cmath>                 // Include from 'system'
0048 #include "G4ios.hh"              // Include from 'system'
0049 #include <iomanip>               // Include from 'system'
0050 #include "globals.hh"            // Include from 'global'
0051 #include "G4ThreeVector.hh"      // Include from 'global'
0052 #include "G4VPhysicalVolume.hh"  // Include from 'geometry'
0053 #include "G4StepPoint.hh"        // Include from 'track'
0054 #include "G4StepStatus.hh"       // Include from 'track'
0055 #include "G4TrackVector.hh"      // Include from 'tracking'
0056 
0057 class G4Polyline;                // Forward declaration.
0058 class G4Track;                   // Forward declaration.
0059 
0060 class G4Step
0061 {
0062   public:
0063     G4Step();
0064    ~G4Step();
0065       // Constructor/Destructor
0066 
0067     G4Step(const G4Step&);
0068     G4Step& operator=(const G4Step&);
0069       // Copy Constructor and assignment operator
0070 
0071     inline G4Track* GetTrack() const;
0072     inline void SetTrack(G4Track* value);
0073       // Current track
0074 
0075     inline G4StepPoint* GetPreStepPoint() const;
0076     inline void SetPreStepPoint(G4StepPoint* value);
0077     inline G4StepPoint* ResetPreStepPoint(G4StepPoint* value=nullptr);
0078       // Pre-Step points
0079       // If Set method is invoked, the previous StepPoint object is deleted.
0080       // If Reset method is invoked, the previous StepPoint object is not deleted
0081       // but its pointer is returned. Thus it's the caller's responsibility to 
0082       // properly delete it.
0083 
0084     inline G4StepPoint* GetPostStepPoint() const;
0085     inline void SetPostStepPoint(G4StepPoint* value);
0086     inline G4StepPoint* ResetPostStepPoint(G4StepPoint* value=nullptr);
0087       // Post-Step points
0088       // If Set method is invoked, the previous StepPoint object is deleted.
0089       // If Reset method is invoked, the previous StepPoint object is not deleted
0090       // but its pointer is returned. Thus it's the caller's responsibility to 
0091       // properly delete it.
0092 
0093     inline G4double GetStepLength() const;
0094     inline void SetStepLength(G4double value);
0095       // Before the end of the AlongStepDoIt loop, StepLength keeps
0096       // the initial value which is determined by the shortest geometrical Step
0097       // proposed by a physics process. After finishing the AlongStepDoIt,
0098       // it will be set equal to 'StepLength' in G4Step
0099 
0100     inline G4double GetTotalEnergyDeposit() const;
0101     inline void SetTotalEnergyDeposit(G4double value);
0102       // Total energy deposit
0103 
0104     inline G4double GetNonIonizingEnergyDeposit() const;
0105     inline void SetNonIonizingEnergyDeposit(G4double value);
0106       // Total non-ionizing energy deposit
0107 
0108     inline G4SteppingControl GetControlFlag() const;
0109     inline void SetControlFlag(G4SteppingControl StepControlFlag);
0110       // Control flag for stepping
0111 
0112     inline void AddTotalEnergyDeposit(G4double value);
0113     inline void ResetTotalEnergyDeposit();
0114       // Manipulation of total energy deposit
0115 
0116     inline void AddNonIonizingEnergyDeposit(G4double value);
0117     inline void ResetNonIonizingEnergyDeposit();
0118       // Manipulation of non-ionizing energy deposit
0119 
0120     inline G4bool IsFirstStepInVolume() const;
0121     inline G4bool IsLastStepInVolume() const;
0122 
0123     inline void SetFirstStepFlag();
0124     inline void ClearFirstStepFlag();
0125     inline void SetLastStepFlag();
0126     inline void ClearLastStepFlag();
0127       // Get/Set/Clear flag for initial/last step
0128       // NOTE: flags are not used
0129 
0130     inline G4ThreeVector GetDeltaPosition() const;
0131     inline G4double GetDeltaTime() const;
0132       // Difference of position, time, momentum and energy
0133 
0134     inline G4ThreeVector GetDeltaMomentum() const;
0135     inline G4double GetDeltaEnergy() const;
0136       // These methods provide difference between track energy and momentum
0137       // at a step, it is incorrect to use these methods to compute energy
0138       // deposition in media during the step, because secondary particles may
0139       // be produced. For energy deposition use the method GetTotalEnergyDeposit()
0140 
0141     inline void InitializeStep(G4Track* aValue);
0142       // Initialize contents of G4Step
0143 
0144     inline void UpdateTrack();
0145       // Update track by using G4Step information
0146 
0147     inline void CopyPostToPreStepPoint();
0148       // Copy PostStepPoint to PreStepPoint
0149 
0150     inline void SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector>* vec);
0151     inline std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const;
0152       // Auxiliary points modifiers
0153 
0154   // --- Secondary buckets ---
0155 
0156     inline std::size_t GetNumberOfSecondariesInCurrentStep() const;
0157       // Secondaries in the current step
0158 
0159     const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const;
0160 
0161     inline const G4TrackVector* GetSecondary() const;
0162     inline G4TrackVector* GetfSecondary();
0163     inline G4TrackVector* NewSecondaryVector();
0164       // NOTE: Secondary bucket of the Step contains
0165       //       all secondaries during tracking the current track
0166       //       (i.e. NOT secondaries produced in the current step)
0167       // all these methods give same object (i.e. G4TrackVector  )
0168       // but 2nd one will create bucket in addition
0169 
0170     inline void DeleteSecondaryVector();
0171       // Just delete secondary bucket
0172       // NOTE: G4Track objects inside the bucket are not deleted
0173 
0174     inline void SetSecondary(G4TrackVector* value);
0175       // Add secondary tracks to the bucket
0176 
0177   protected:
0178 
0179     G4double fTotalEnergyDeposit = 0.0;
0180       // Accumulated total energy deposit in the current Step
0181 
0182     G4double fNonIonizingEnergyDeposit = 0.0;
0183      // Accumulated non-ionizing energy deposit in the current Step
0184 
0185   private:
0186 
0187     G4StepPoint* fpPreStepPoint = nullptr;
0188     G4StepPoint* fpPostStepPoint = nullptr;
0189     G4double fStepLength = 0.0;
0190       // Step length which may be updated at each invocation of
0191       // AlongStepDoIt and PostStepDoIt
0192 
0193     G4Track* fpTrack = nullptr;
0194 
0195     G4SteppingControl fpSteppingControlFlag = NormalCondition;
0196       // A flag to control SteppingManager behavior from process
0197 
0198     G4bool fFirstStepInVolume = false;
0199     G4bool fLastStepInVolume = false;
0200       // Flags for initial/last step
0201 
0202     G4TrackVector* fSecondary = nullptr;
0203       // Secondary bucket implemented by using  std::vector of G4Track*
0204 
0205     std::size_t nSecondaryByLastStep = 0;
0206       // number of secondaries which have been created by the last step
0207 
0208     std::vector<const G4Track*>* secondaryInCurrentStep = nullptr;
0209 
0210     std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer = nullptr;
0211 };
0212 
0213 #include "G4Step.icc"
0214 
0215 #endif