Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:10

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 /*
0027  * Based on 'G4pbc'.
0028  * Copyright (c) 2020 Amentum Pty Ltd
0029  * team@amentum.space
0030  * The original open-source version of this code
0031  * may be found at https://github.com/amentumspace/g4pbc
0032  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
0033  * associated documentation files (the "Software"), to deal in the Software without restriction,
0034  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
0035  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
0036  * is furnished to do so, subject to the following conditions:
0037  * The above copyright notice and this permission notice shall be included in all copies
0038  * or substantial portions of the Software.
0039  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
0040  * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0041  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
0042  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0043  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0044  *
0045  *
0046  */
0047 #ifndef ParticleChangeForPeriodic_hh
0048 #define ParticleChangeForPeriodic_hh 1
0049 
0050 #include "G4VParticleChange.hh"
0051 #include "globals.hh"
0052 
0053 class G4DynamicParticle;
0054 
0055 class ParticleChangeForPeriodic : public G4VParticleChange
0056 {
0057   public:
0058     ParticleChangeForPeriodic();
0059 
0060     ~ParticleChangeForPeriodic() override = default;
0061 
0062     G4Step* UpdateStepForPostStep(G4Step* Step) override;
0063 
0064     void InitializeForPostStep(const G4Track&);
0065 
0066     void AddSecondary(G4DynamicParticle* aParticle);
0067 
0068     const G4ThreeVector& GetProposedMomentumDirection() const;
0069 
0070     void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz);
0071 
0072     void ProposeMomentumDirection(const G4ThreeVector& Pfinal);
0073 
0074     const G4ThreeVector& GetProposedPolarization() const;
0075 
0076     void ProposePolarization(const G4ThreeVector& dir);
0077 
0078     void ProposePolarization(G4double Px, G4double Py, G4double Pz);
0079 
0080     const G4ThreeVector& GetProposedPosition() const;
0081 
0082     void ProposePosition(const G4ThreeVector& pos);
0083 
0084     void ProposePosition(G4double x, G4double y, G4double z);
0085 
0086     const G4Track* GetCurrentTrack() const;
0087 
0088     void DumpInfo() const override;
0089 
0090     ParticleChangeForPeriodic(const ParticleChangeForPeriodic& right) = delete;
0091 
0092     ParticleChangeForPeriodic& operator=(const ParticleChangeForPeriodic& right) = delete;
0093 
0094   private:
0095     const G4Track* fTrack{};
0096     G4ThreeVector fProposedMomentumDirection;
0097     G4ThreeVector fProposedPolarization;
0098     G4ThreeVector fProposedPosition;
0099 };
0100 
0101 inline const G4ThreeVector& ParticleChangeForPeriodic::GetProposedMomentumDirection() const
0102 {
0103   return fProposedMomentumDirection;
0104 }
0105 
0106 inline void ParticleChangeForPeriodic::ProposeMomentumDirection(const G4ThreeVector& dir)
0107 {
0108   fProposedMomentumDirection = dir;
0109 }
0110 
0111 inline void ParticleChangeForPeriodic::ProposeMomentumDirection(G4double Px, G4double Py,
0112                                                                 G4double Pz)
0113 {
0114   fProposedMomentumDirection.setX(Px);
0115   fProposedMomentumDirection.setY(Py);
0116   fProposedMomentumDirection.setZ(Pz);
0117 }
0118 
0119 inline const G4ThreeVector& ParticleChangeForPeriodic::GetProposedPolarization() const
0120 {
0121   return fProposedPolarization;
0122 }
0123 
0124 inline void ParticleChangeForPeriodic::ProposePolarization(const G4ThreeVector& dir)
0125 {
0126   fProposedPolarization = dir;
0127 }
0128 
0129 inline void ParticleChangeForPeriodic::ProposePolarization(G4double Px, G4double Py, G4double Pz)
0130 {
0131   fProposedPolarization.setX(Px);
0132   fProposedPolarization.setY(Py);
0133   fProposedPolarization.setZ(Pz);
0134 }
0135 
0136 inline const G4ThreeVector& ParticleChangeForPeriodic::GetProposedPosition() const
0137 {
0138   return fProposedPosition;
0139 }
0140 
0141 inline void ParticleChangeForPeriodic::ProposePosition(const G4ThreeVector& dir)
0142 {
0143   fProposedPosition = dir;
0144 }
0145 
0146 inline void ParticleChangeForPeriodic::ProposePosition(G4double Px, G4double Py, G4double Pz)
0147 {
0148   fProposedPosition.setX(Px);
0149   fProposedPosition.setY(Py);
0150   fProposedPosition.setZ(Pz);
0151 }
0152 
0153 inline void ParticleChangeForPeriodic::InitializeForPostStep(const G4Track& track)
0154 {
0155   theStatusChange = track.GetTrackStatus();
0156   theLocalEnergyDeposit = 0.0;
0157   theNonIonizingEnergyDeposit = 0.0;
0158   InitializeSecondaries();
0159   theParentWeight = track.GetWeight();
0160   isParentWeightProposed = false;
0161   fProposedMomentumDirection = track.GetMomentumDirection();
0162   fProposedPolarization = track.GetPolarization();
0163   fProposedPosition = track.GetPosition();
0164   fTrack = &track;
0165 }
0166 
0167 inline const G4Track* ParticleChangeForPeriodic::GetCurrentTrack() const
0168 {
0169   return fTrack;
0170 }
0171 #endif