Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:13

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 exoticphysics/phonon/src/XPhononStackingAction.cc
0027 /// \brief Implementation of the XPhononStackingAction class
0028 ///     This stacking action is necessary to ensure that velocity and
0029 ///     propagation direction are set properly for phonons created with
0030 ///     G4ParticleGun
0031 //
0032 //
0033 
0034 #include "XPhononStackingAction.hh"
0035 
0036 #include "G4LatticeManager.hh"
0037 #include "G4PhononLong.hh"
0038 #include "G4PhononPolarization.hh"
0039 #include "G4PhononTrackMap.hh"
0040 #include "G4PhononTransFast.hh"
0041 #include "G4PhononTransSlow.hh"
0042 #include "G4RandomDirection.hh"
0043 #include "G4SystemOfUnits.hh"
0044 #include "G4ThreeVector.hh"
0045 #include "G4Track.hh"
0046 #include "G4TrackStatus.hh"
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0049 
0050 XPhononStackingAction::XPhononStackingAction()
0051 {
0052   ;
0053 }
0054 
0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0056 
0057 XPhononStackingAction::~XPhononStackingAction()
0058 {
0059   ;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0063 
0064 G4ClassificationOfNewTrack XPhononStackingAction::ClassifyNewTrack(const G4Track* aTrack)
0065 {
0066   G4ClassificationOfNewTrack classification = fUrgent;
0067 
0068   if (aTrack->GetParentID() == 0) {
0069     // Obtain LatticeManager for phonon dynamics
0070     G4LatticeManager* LM = G4LatticeManager::GetLatticeManager();
0071 
0072     G4int pol = G4PhononPolarization::Get(aTrack->GetDefinition());
0073 
0074     // Compute random wave-vector (override whatever ParticleGun did)
0075     G4ThreeVector Ran = G4RandomDirection();
0076 
0077     // Store wave-vector as track information
0078     G4PhononTrackMap* theKmap = G4PhononTrackMap::GetPhononTrackMap();
0079     theKmap->SetK(aTrack, Ran);
0080 
0081     // Compute direction of propagation from wave vector
0082     G4ThreeVector momentumDir = LM->MapKtoVDir(aTrack->GetVolume(), pol, Ran);
0083 
0084     // Compute true velocity of propagation
0085     G4double velocity = LM->MapKtoV(aTrack->GetVolume(), pol, Ran);
0086 
0087     // cast to non-const pointer so we can set the velocity
0088     G4Track* theTrack = const_cast<G4Track*>(aTrack);
0089 
0090     theTrack->SetMomentumDirection(momentumDir);
0091     theTrack->SetVelocity(velocity);
0092     theTrack->UseGivenVelocity(true);
0093   }
0094 
0095   return classification;
0096 }
0097 
0098 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....