Back to home page

EIC code displayed by LXR

 
 

    


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

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 #include "ParticleChangeForPeriodic.hh"
0048 
0049 #include "G4DynamicParticle.hh"
0050 #include "G4Step.hh"
0051 #include "G4Track.hh"
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 
0055 ParticleChangeForPeriodic::ParticleChangeForPeriodic() : G4VParticleChange() {}
0056 
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0058 
0059 G4Step* ParticleChangeForPeriodic::UpdateStepForPostStep(G4Step* pStep)
0060 {
0061   G4StepPoint* pPostStepPoint = pStep->GetPostStepPoint();
0062   pPostStepPoint->SetMomentumDirection(fProposedMomentumDirection);
0063   pPostStepPoint->SetPolarization(fProposedPolarization);
0064   pPostStepPoint->SetPosition(fProposedPosition);
0065 
0066   if (isParentWeightProposed) {
0067     pPostStepPoint->SetWeight(theParentWeight);
0068   }
0069 
0070   pStep->AddTotalEnergyDeposit(theLocalEnergyDeposit);
0071   pStep->AddNonIonizingEnergyDeposit(theNonIonizingEnergyDeposit);
0072 
0073   return pStep;
0074 }
0075 
0076 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0077 
0078 void ParticleChangeForPeriodic::AddSecondary(G4DynamicParticle* aParticle)
0079 {
0080   auto* aTrack = new G4Track(aParticle, fTrack->GetGlobalTime(), fTrack->GetPosition());
0081 
0082   aTrack->SetTouchableHandle(fTrack->GetTouchableHandle());
0083 
0084   G4VParticleChange::AddSecondary(aTrack);
0085 }
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0088 
0089 void ParticleChangeForPeriodic::DumpInfo() const
0090 {
0091   G4VParticleChange::DumpInfo();
0092   G4int oldprc = G4cout.precision(3);
0093 
0094   G4cout << "        Momentum Direction: " << std::setw(20) << fProposedMomentumDirection << G4endl;
0095   G4cout << "        Polarization: " << std::setw(20) << fProposedPolarization << G4endl;
0096   G4cout << "        Position: " << std::setw(20) << fProposedPosition << G4endl;
0097   G4cout.precision(oldprc);
0098 }
0099 
0100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......