|
||||
File indexing completed on 2025-01-31 09:22:36
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 // Code developed by: 0027 // S.Larsson 0028 // 0029 // ******************************************** 0030 // * * 0031 // * PurgMagPrimaryGeneratorAction.cc * 0032 // * * 0033 // ******************************************** 0034 // 0035 // 0036 0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0038 0039 #include "PurgMagPrimaryGeneratorAction.hh" 0040 0041 #include "PurgMagDetectorConstruction.hh" 0042 0043 #include "G4SystemOfUnits.hh" 0044 #include "G4UnitsTable.hh" 0045 #include "G4Event.hh" 0046 #include "G4ParticleGun.hh" 0047 #include "G4ParticleTable.hh" 0048 #include "G4ParticleDefinition.hh" 0049 #include "G4Electron.hh" 0050 0051 0052 //Print position of primaries. 0053 #define POSITION 0 0054 0055 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0056 0057 PurgMagPrimaryGeneratorAction::PurgMagPrimaryGeneratorAction() 0058 :rndmVertex(false) 0059 { 0060 //default kinematic 0061 G4int n_particle = 1; 0062 particleGun = new G4ParticleGun(n_particle); 0063 0064 G4ParticleDefinition* particle 0065 = G4Electron::Definition(); 0066 0067 particleGun->SetParticleDefinition(particle); 0068 particleGun->SetParticleEnergy(50.*MeV); 0069 0070 //Momentum Direction 0071 particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.)); 0072 0073 } 0074 0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0076 0077 PurgMagPrimaryGeneratorAction::~PurgMagPrimaryGeneratorAction() 0078 { 0079 delete particleGun; 0080 } 0081 0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0083 0084 void PurgMagPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 0085 { 0086 //this function is called at the begining of event 0087 //Start position of primaries 0088 G4double z0 = 15.*cm; 0089 G4double x0 = 0.*cm; 0090 G4double y0 = 0.*cm; 0091 particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0)); 0092 particleGun->GeneratePrimaryVertex(anEvent); 0093 0094 #if POSITION 0095 G4cout << "\n----Particle Gun--------------------------------------------\n"; 0096 G4cout << "\n ---> SetParticlePosition(G4ThreeVector(x0,y0,z0)) "; 0097 G4cout << "\n ---> x0 = " << x0 << " "<< G4BestUnit(x0,"Length"); 0098 G4cout << "\n ---> y0 = " << y0 << " "<< G4BestUnit(y0,"Length"); 0099 G4cout << "\n ---> z0 = " << z0 << " "<< G4BestUnit(z0,"Length"); 0100 G4cout << "\n-----------------------------------------------------------\n"; 0101 #endif 0102 } 0103 0104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 0105 0106
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |