Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4ParticleChange
0027 //
0028 // Class description:
0029 //
0030 // Concrete class for ParticleChange containing the results after
0031 // invocation of a physics process.
0032 // This includes final states of parent particle (momentum, energy,
0033 // etc) and secondary particles generated by the interaction.
0034 // The tracking assumes that all the values of energy and momentum
0035 // are in global reference system, therefore all the needed Lorentz
0036 // transformations must have been already computed when filling the
0037 // data-members of this class.
0038 //
0039 // IMPORTANT NOTE: Despite the name, what this class stores/returns
0040 // through its methods, are the "FINAL" values of the Position,
0041 // Momentum, etc.
0042 
0043 // Author: Hisaya Kurashige, 23 March 1998  
0044 // --------------------------------------------------------------------
0045 #ifndef G4ParticleChange_hh
0046 #define G4ParticleChange_hh 1
0047 
0048 #include "globals.hh"
0049 #include "G4ios.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4VParticleChange.hh"
0052 
0053 class G4DynamicParticle;
0054 
0055 class G4ParticleChange : public G4VParticleChange
0056 {
0057   public:
0058 
0059     G4ParticleChange();
0060       // Default constructor
0061 
0062     ~G4ParticleChange() override = default;
0063       // Destructor
0064 
0065     G4ParticleChange(const G4ParticleChange& right) = delete;
0066     G4ParticleChange& operator=(const G4ParticleChange& right) = delete;
0067 
0068   // --- the following methods are for updating G4Step -----
0069   // Return the pointer to G4Step after updating the Step information
0070   // by using final state of the track given by a physics process
0071 
0072     G4Step* UpdateStepForAlongStep(G4Step* Step) override;
0073       // A physics process gives the final state of the particle
0074       // relative to the initial state at the beginning of the Step,
0075       // i.e., based on information of G4Track (or equivalently
0076       // the PreStepPoint).
0077       // In this method, the differences (delta) between these two states
0078       // are calculated, and are accumulated in PostStepPoint.
0079       // Take note that the return type of GetMomentumChange() is a
0080       // pointer to G4ParticleMomentum. Also it is a normalized
0081       // momentum vector
0082 
0083     G4Step* UpdateStepForAtRest(G4Step* Step) override;
0084     G4Step* UpdateStepForPostStep(G4Step* Step) override;
0085       // A physics process gives the final state of the particle
0086       // based on information of G4Track (or equivalently the PreStepPoint)
0087 
0088     void Initialize(const G4Track&) override;
0089       // Initialize all propoerties by using G4Track information
0090 
0091   // --- methods to keep information of the final state ---
0092   //
0093   //  The ProposeXXX methods store (and return in GetXXX methods)
0094   //  the "FINAL" values of the Position, Momentum, etc.
0095 
0096     inline const G4ThreeVector* GetMomentumDirection() const;
0097     inline void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz);
0098     inline void ProposeMomentumDirection(const G4ThreeVector& Pfinal);
0099       // Get/Propose the MomentumDirection vector: it is the final momentum
0100       // direction
0101 
0102     inline const G4ThreeVector* GetPolarization() const;
0103     inline void ProposePolarization(G4double Px, G4double Py, G4double Pz);
0104     inline void ProposePolarization(const G4ThreeVector& finalPoralization);
0105       // Get/Propose the final Polarization vector
0106 
0107     inline G4double GetEnergy() const;
0108     inline void ProposeEnergy(G4double finalEnergy);
0109       // Get/Propose the final kinetic energy of the current particle
0110 
0111     inline G4double GetVelocity() const;
0112     inline void ProposeVelocity(G4double finalVelocity);
0113       // Get/Propose the final velocity of the current particle
0114 
0115     inline G4double GetProperTime() const;
0116     inline void ProposeProperTime(G4double finalProperTime);
0117       // Get/Propose the final ProperTime
0118 
0119     inline const G4ThreeVector* GetPosition() const;
0120     inline void ProposePosition(G4double x, G4double y, G4double z);
0121     inline void ProposePosition(const G4ThreeVector& finalPosition);
0122       // Get/Propose the final position of the current particle
0123 
0124     inline void ProposeGlobalTime(G4double t);
0125     inline void ProposeLocalTime(G4double t);
0126       // Get/Propose the final global/local Time.
0127       // NOTE: DO NOT INVOKE both methods in a step
0128       //       Each method affects both local and global time
0129 
0130     inline G4double GetGlobalTime(G4double timeDelay = 0.0) const;
0131     inline G4double GetLocalTime(G4double timeDelay = 0.0) const;
0132       // Convert the time delay to the glocbal/local time.
0133       // Can get the final global/local time without argument
0134 
0135     inline G4double GetMass() const;
0136     inline void ProposeMass(G4double finalMass);
0137       // Get/Propose the final dynamical mass in G4DynamicParticle
0138 
0139     inline G4double GetCharge() const;
0140     inline void ProposeCharge(G4double finalCharge);
0141       // Get/Propose the final dynamical charge in G4DynamicParticle
0142 
0143     inline G4double GetMagneticMoment() const;
0144     inline void ProposeMagneticMoment(G4double finalMagneticMoment);
0145       // Get/Propose the final MagneticMoment in G4DynamicParticle
0146 
0147     inline G4ThreeVector
0148     GetGlobalPosition(const G4ThreeVector& displacement) const;
0149       // Convert the position displacement to the global position
0150 
0151     inline G4ThreeVector CalcMomentum(G4double energy, G4ThreeVector direction,
0152                                       G4double mass) const;
0153       // Calculate momentum by using Energy, Momentum Direction, and Mass
0154 
0155   // --- methods for adding secondaries ---
0156 
0157     void AddSecondary(G4Track* aSecondary);
0158       // Add a secondary particle to theListOfSecondaries
0159 
0160     void AddSecondary(G4DynamicParticle* aSecondary,
0161                       G4bool IsGoodForTracking = false);
0162       // Add a secondary particle to theListOfSecondaries.
0163       // Position and time are same as thePositionChange and theTimeChange
0164 
0165     void AddSecondary(G4DynamicParticle* aSecondary, G4ThreeVector position,
0166                       G4bool IsGoodForTracking = false);
0167       // Add a secondary particle to theListOfSecondaries.
0168       // Global time are same as theTimeChange and theTimeChange
0169 
0170     void AddSecondary(G4DynamicParticle* aSecondary, G4double time,
0171                       G4bool IsGoodForTracking = false);
0172       // Add a secondary particle to theListOfSecondaries.
0173       // Position and are same as thePositionChange
0174 
0175   // --- Dump and debug methods ---
0176 
0177     void DumpInfo() const override;
0178 
0179   protected:
0180 
0181     G4Step* UpdateStepInfo(G4Step* Step);
0182       // Update the G4Step specific attributes
0183       // (i.e. SteppingControl, LocalEnergyDeposit, and TrueStepLength)
0184 
0185     G4ThreeVector theMomentumDirectionChange;
0186       // It is the vector containing the final momentum direction
0187       // after the invoked process. The application of the change
0188       // of the momentum direction of the particle is not done here.
0189       // The responsibility to apply the change is up to the entity
0190       // which invoked the process
0191 
0192     G4ThreeVector thePolarizationChange;
0193       // The changed (final) polarization of a given track
0194 
0195     G4double theEnergyChange = 0.0;
0196       // The final kinetic energy of the current track
0197 
0198     G4double theVelocityChange = 0.0;
0199     G4bool isVelocityChanged = false;
0200       // The final velocity of the current track
0201 
0202     G4ThreeVector thePositionChange;
0203       // The changed (final) position of a given track
0204 
0205     G4double theGlobalTime0 = 0.0;
0206       // The global time at Initial
0207     G4double theLocalTime0 = 0.0;
0208       // The local time at Initial
0209 
0210     G4double theTimeChange = 0.0;
0211       // The change of local time of a given particle
0212 
0213     G4double theProperTimeChange = 0.0;
0214       // The changed (final) proper time of a given track
0215 
0216     G4double theMassChange = 0.0;
0217       // The Changed (final) mass of a given track
0218 
0219     G4double theChargeChange = 0.0;
0220      // The Changed (final) charge of a given track
0221 
0222     G4double theMagneticMomentChange = 0.0;
0223      // The Changed (final) MagneticMoment of a given track
0224 };
0225 
0226 #include "G4ParticleChange.icc"
0227 
0228 #endif