Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:51

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 // G4ParticleChangeForGamma
0027 //
0028 // Class description:
0029 //
0030 // Concrete class for ParticleChange for gamma processes.
0031 
0032 // Author: Hisaya Kurashige, 23 March 1998  
0033 // Revision: Vladimir Ivantchenko, 15 April 2005
0034 //                                 24 August 2022
0035 // --------------------------------------------------------------------
0036 #ifndef G4ParticleChangeForGamma_hh
0037 #define G4ParticleChangeForGamma_hh 1
0038 
0039 #include "globals.hh"
0040 #include "G4ios.hh"
0041 #include "G4VParticleChange.hh"
0042 
0043 class G4DynamicParticle;
0044 
0045 class G4ParticleChangeForGamma final : public G4VParticleChange
0046 {
0047 public:
0048 
0049   G4ParticleChangeForGamma();
0050 
0051   ~G4ParticleChangeForGamma() override = default;
0052 
0053   G4ParticleChangeForGamma(const G4ParticleChangeForGamma& right) = delete;
0054   G4ParticleChangeForGamma& operator=(const G4ParticleChangeForGamma& right) = delete;
0055 
0056   // --- the following methods are for updating G4Step -----
0057 
0058   G4Step* UpdateStepForAtRest(G4Step* pStep) final;
0059   G4Step* UpdateStepForPostStep(G4Step* Step) final;
0060       // A physics process gives the final state of the particle
0061       // based on information of G4Track
0062 
0063   inline void InitializeForPostStep(const G4Track&);
0064       // Initialize all properties by using G4Track information
0065 
0066   void AddSecondary(G4DynamicParticle* aParticle);
0067       // Add next secondary
0068 
0069   inline G4double GetProposedKineticEnergy() const;
0070   inline void SetProposedKineticEnergy(G4double proposedKinEnergy);
0071       // Get/Set the final kinetic energy of the current particle
0072 
0073   inline const G4ThreeVector& GetProposedMomentumDirection() const;
0074   inline void ProposeMomentumDirection(const G4ThreeVector& Pfinal);
0075       // Get/Set the final momentum direction
0076 
0077   inline const G4ThreeVector& GetProposedPolarization() const;
0078   inline void ProposePolarization(const G4ThreeVector& dir);
0079   inline void ProposePolarization(G4double Px, G4double Py, G4double Pz);
0080 
0081   void DumpInfo() const override;
0082 
0083 private:
0084 
0085   G4double proposedKinEnergy = 0.0;
0086       // The final kinetic energy of the current particle
0087 
0088   G4ThreeVector proposedMomentumDirection;
0089       // The final momentum direction of the current particle
0090 
0091   G4ThreeVector proposedPolarization;
0092       // The final polarization of the current particle
0093 };
0094 
0095 // ----------------------
0096 // Inline methods
0097 // ----------------------
0098 
0099 inline
0100 G4double G4ParticleChangeForGamma::GetProposedKineticEnergy() const
0101 {
0102   return proposedKinEnergy;
0103 }
0104 
0105 inline
0106 void G4ParticleChangeForGamma::SetProposedKineticEnergy(G4double energy)
0107 {
0108   proposedKinEnergy = energy;
0109 }
0110 
0111 inline
0112 const G4ThreeVector& G4ParticleChangeForGamma::
0113 GetProposedMomentumDirection() const
0114 {
0115   return proposedMomentumDirection;
0116 }
0117 
0118 inline
0119 void G4ParticleChangeForGamma::
0120 ProposeMomentumDirection(const G4ThreeVector& dir)
0121 {
0122   proposedMomentumDirection = dir;
0123 }
0124 
0125 inline
0126 const G4ThreeVector& G4ParticleChangeForGamma::GetProposedPolarization() const
0127 {
0128   return proposedPolarization;
0129 }
0130 
0131 inline
0132 void G4ParticleChangeForGamma::ProposePolarization(const G4ThreeVector& dir)
0133 {
0134   proposedPolarization = dir;
0135 }
0136 
0137 inline
0138 void G4ParticleChangeForGamma::ProposePolarization(G4double Px,
0139                                                    G4double Py,
0140                                                    G4double Pz)
0141 {
0142   proposedPolarization.setX(Px);
0143   proposedPolarization.setY(Py);
0144   proposedPolarization.setZ(Pz);
0145 }
0146 
0147 inline
0148 void G4ParticleChangeForGamma::InitializeForPostStep(const G4Track& track)
0149 {
0150   InitializeSecondaries();
0151   InitializeLocalEnergyDeposit();
0152   InitializeParentWeight(track);
0153   InitializeStatusChange(track);
0154   proposedKinEnergy         = track.GetKineticEnergy();
0155   proposedMomentumDirection = track.GetMomentumDirection();
0156   proposedPolarization      = track.GetPolarization();
0157 }
0158 
0159 #endif