Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:07

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 #include "G4Profiler.hh"         // Include from 'global'
0057 
0058 class G4Polyline;                // Forward declaration.
0059 class G4Track;                   // Forward declaration.
0060 
0061 class G4Step
0062 {
0063   public:
0064    // the profiler aliases are only used when compiled with GEANT4_USE_TIMEMORY
0065    using ProfilerConfig = G4ProfilerConfig<G4ProfileType::Step>;
0066 
0067     G4Step();
0068    ~G4Step();
0069       // Constructor/Destructor
0070 
0071     G4Step(const G4Step&);
0072     G4Step& operator=(const G4Step&);
0073       // Copy Constructor and assignment operator
0074 
0075     G4Track* GetTrack() const;
0076     void SetTrack(G4Track* value);
0077       // Current track
0078 
0079     G4StepPoint* GetPreStepPoint() const;
0080     void SetPreStepPoint(G4StepPoint* value);
0081     G4StepPoint* ResetPreStepPoint(G4StepPoint* value=nullptr);
0082       // Pre-Step points
0083       // If Set method is invoked, the previous StepPoint object is deleted.
0084       // If Reset method is invoked, the previous StepPoint object is not deleted
0085       // but its pointer is returned. Thus it's the caller's responsibility to 
0086       // properly delete it.
0087 
0088     G4StepPoint* GetPostStepPoint() const;
0089     void SetPostStepPoint(G4StepPoint* value);
0090     G4StepPoint* ResetPostStepPoint(G4StepPoint* value=nullptr);
0091       // Post-Step points
0092       // If Set method is invoked, the previous StepPoint object is deleted.
0093       // If Reset method is invoked, the previous StepPoint object is not deleted
0094       // but its pointer is returned. Thus it's the caller's responsibility to 
0095       // properly delete it.
0096 
0097     G4double GetStepLength() const;
0098     void SetStepLength(G4double value);
0099       // Before the end of the AlongStepDoIt loop, StepLength keeps
0100       // the initial value which is determined by the shortest geometrical Step
0101       // proposed by a physics process. After finishing the AlongStepDoIt,
0102       // it will be set equal to 'StepLength' in G4Step
0103 
0104     G4double GetTotalEnergyDeposit() const;
0105     void SetTotalEnergyDeposit(G4double value);
0106       // Total energy deposit
0107 
0108     G4double GetNonIonizingEnergyDeposit() const;
0109     void SetNonIonizingEnergyDeposit(G4double value);
0110       // Total non-ionizing energy deposit
0111 
0112     G4SteppingControl GetControlFlag() const;
0113     void SetControlFlag(G4SteppingControl StepControlFlag);
0114       // Control flag for stepping
0115 
0116     void AddTotalEnergyDeposit(G4double value);
0117     void ResetTotalEnergyDeposit();
0118       // Manipulation of total energy deposit
0119 
0120     void AddNonIonizingEnergyDeposit(G4double value);
0121     void ResetNonIonizingEnergyDeposit();
0122       // Manipulation of non-ionizing energy deposit
0123 
0124     G4bool IsFirstStepInVolume() const;
0125     G4bool IsLastStepInVolume() const;
0126 
0127     void SetFirstStepFlag();
0128     void ClearFirstStepFlag();
0129     void SetLastStepFlag();
0130     void ClearLastStepFlag();
0131       // Get/Set/Clear flag for initial/last step
0132       // NOTE: flags are not used
0133 
0134     G4ThreeVector GetDeltaPosition() const;
0135     G4double GetDeltaTime() const;
0136       // Difference of position, time, momentum and energy
0137 
0138     G4ThreeVector GetDeltaMomentum() const;
0139     G4double GetDeltaEnergy() const;
0140       // These methods will be deleted
0141       // NOTE: use  GetTotalEnergyDeposit() to obtain energy loss in material
0142 
0143     void InitializeStep(G4Track* aValue);
0144       // Initialize contents of G4Step
0145 
0146     void UpdateTrack();
0147       // Update track by using G4Step information
0148 
0149     void CopyPostToPreStepPoint();
0150       // Copy PostStepPoint to PreStepPoint
0151 
0152     G4Polyline* CreatePolyline() const;
0153       // For visualization
0154 
0155     inline void SetPointerToVectorOfAuxiliaryPoints(std::vector<G4ThreeVector>* vec);
0156     inline std::vector<G4ThreeVector>* GetPointerToVectorOfAuxiliaryPoints() const;
0157       // Auxiliary points modifiers
0158 
0159   // --- Secondary buckets ---
0160 
0161     std::size_t GetNumberOfSecondariesInCurrentStep() const;
0162       // Secondaries in the current step
0163 
0164     const std::vector<const G4Track*>* GetSecondaryInCurrentStep() const;
0165 
0166     const G4TrackVector* GetSecondary() const;
0167     G4TrackVector* GetfSecondary();
0168     G4TrackVector* NewSecondaryVector();
0169       // NOTE: Secondary bucket of the Step contains
0170       //       all secondaries during tracking the current track
0171       //       (i.e. NOT secondaries produced in the current step)
0172       // all these methods give same object (i.e. G4TrackVector  )
0173       // but 2nd one will create bucket in addition
0174 
0175     void DeleteSecondaryVector();
0176       // Just delete secondary bucket
0177       // NOTE: G4Track objects inside the bucket are not deleted
0178 
0179     void SetSecondary(G4TrackVector* value);
0180       // Add secondary tracks to the bucket
0181 
0182   protected:
0183 
0184     G4double fTotalEnergyDeposit = 0.0;
0185       // Accumulated total energy deposit in the current Step
0186 
0187     G4double fNonIonizingEnergyDeposit = 0.0;
0188      // Accumulated non-ionizing energy deposit in the current Step
0189 
0190   private:
0191 
0192     G4StepPoint* fpPreStepPoint = nullptr;
0193     G4StepPoint* fpPostStepPoint = nullptr;
0194     G4double fStepLength = 0.0;
0195       // Step length which may be updated at each invocation of
0196       // AlongStepDoIt and PostStepDoIt
0197 
0198     G4Track* fpTrack = nullptr;
0199 
0200     G4SteppingControl fpSteppingControlFlag = NormalCondition;
0201       // A flag to control SteppingManager behavior from process
0202 
0203     G4bool fFirstStepInVolume = false;
0204     G4bool fLastStepInVolume = false;
0205       // Flags for initial/last step
0206 
0207     G4TrackVector* fSecondary = nullptr;
0208       // Secondary bucket implemented by using  std::vector of G4Track*
0209 
0210     std::size_t nSecondaryByLastStep = 0;
0211       // number of secondaries which have been created by the last step
0212 
0213     std::vector<const G4Track*>* secondaryInCurrentStep = nullptr;
0214 
0215     std::vector<G4ThreeVector>* fpVectorOfAuxiliaryPointsPointer = nullptr;
0216 };
0217 
0218 #include "G4Step.icc"
0219 
0220 #endif