Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 07:53: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 /// \file ParticleChangeForPeriodic.cc
0027 /// \brief Implementation of the ParticleChangeForPeriodic class
0028 
0029 /*
0030  * Based on 'G4pbc'.
0031  * Copyright (c) 2020 Amentum Pty Ltd
0032  * team@amentum.space
0033  * The original open-source version of this code
0034  * may be found at https://github.com/amentumspace/g4pbc
0035  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
0036  * associated documentation files (the "Software"), to deal in the Software without restriction,
0037  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
0038  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
0039  * is furnished to do so, subject to the following conditions:
0040  * The above copyright notice and this permission notice shall be included in all copies
0041  * or substantial portions of the Software.
0042  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
0043  * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
0044  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
0045  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0046  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0047  *
0048  *
0049  */
0050 #include "ParticleChangeForPeriodic.hh"
0051 
0052 #include "G4DynamicParticle.hh"
0053 #include "G4Step.hh"
0054 #include "G4Track.hh"
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0057 
0058 ParticleChangeForPeriodic::ParticleChangeForPeriodic() : G4VParticleChange() {}
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 
0062 G4Step* ParticleChangeForPeriodic::UpdateStepForPostStep(G4Step* pStep)
0063 {
0064   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
0065   pPostStepPoint->SetMomentumDirection(fProposedMomentumDirection);
0066   pPostStepPoint->SetPolarization(fProposedPolarization);
0067   pPostStepPoint->SetPosition(fProposedPosition);
0068 
0069   if (isParentWeightProposed) {
0070     pPostStepPoint->SetWeight(theParentWeight);
0071   }
0072 
0073   pStep->AddTotalEnergyDeposit(theLocalEnergyDeposit);
0074   pStep->AddNonIonizingEnergyDeposit(theNonIonizingEnergyDeposit);
0075 
0076   return pStep;
0077 }
0078 
0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0080 
0081 void ParticleChangeForPeriodic::AddSecondary(G4DynamicParticle* aParticle)
0082 {
0083   auto* aTrack = new G4Track(aParticle, fTrack->GetGlobalTime(), fTrack->GetPosition());
0084 
0085   aTrack->SetTouchableHandle(fTrack->GetTouchableHandle());
0086 
0087   G4VParticleChange::AddSecondary(aTrack);
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 void ParticleChangeForPeriodic::DumpInfo() const
0093 {
0094   G4VParticleChange::DumpInfo();
0095   G4int oldprc = G4cout.precision(3);
0096 
0097   G4cout << "        Momentum Direction: " << std::setw(20) << fProposedMomentumDirection << G4endl;
0098   G4cout << "        Polarization: " << std::setw(20) << fProposedPolarization << G4endl;
0099   G4cout << "        Position: " << std::setw(20) << fProposedPosition << G4endl;
0100   G4cout.precision(oldprc);
0101 }
0102 
0103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......