Geant4  10.01.p03
ExExChUserActionInitialization.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 #ifdef G4MULTITHREADED
30 #include "ExExChTrackingAction.hh"
31 #include "ExExChStackingAction.hh"
32 #include "ExExChEventAction.hh"
33 #include "ExExChRunAction.hh"
35 #include "G4ParticleTable.hh"
36 
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
38 ExExChUserActionInitialization::ExExChUserActionInitialization() {
39  //GPS is special: it is thread-private,
40  //but underlying parameters and objects governing
41  //the distributions are shared among threads.
42  //We need to be sure that the defaults are set only once by master
43  masterGPS = new G4GeneralParticleSource();
44  masterGPS->SetParticleDefinition(G4ParticleTable::
45  GetParticleTable()->FindParticle("proton"));
46 
47  // Position distribution
48  G4SPSPosDistribution *vPosDist =
49  masterGPS->GetCurrentSource()->GetPosDist();
50  vPosDist->SetPosDisType("Beam");
51  vPosDist->SetPosDisShape("Circle");
52  vPosDist->SetCentreCoords(G4ThreeVector(0.,0.,-1.05 * CLHEP::meter));
53  vPosDist->SetBeamSigmaInR(0.0 * CLHEP::mm);
54 
55  // Angular distribution
56  G4SPSAngDistribution *vAngDist =
57  masterGPS->GetCurrentSource()->GetAngDist();
58  vAngDist->DefineAngRefAxes("angref1",G4ThreeVector(1.,0.,0));
59  vAngDist->DefineAngRefAxes("angref2",G4ThreeVector(0.,-1.,0));
60  vAngDist->SetAngDistType("beam2d");
61  vAngDist->SetBeamSigmaInAngX(13.36E-6 * CLHEP::rad);
62  vAngDist->SetBeamSigmaInAngY(11.25E-6 * CLHEP::rad);
63 
64  // Energy distribution
65  G4SPSEneDistribution *vEneDist =
66  masterGPS->GetCurrentSource()->GetEneDist();
67  vEneDist->SetEnergyDisType("Mono");
68  vEneDist->SetMonoEnergy(400. * CLHEP::GeV);
69 
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
74 ExExChUserActionInitialization::~ExExChUserActionInitialization() {
75  delete masterGPS;
76 }
77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78 
79 void ExExChUserActionInitialization::Build() const {
80  SetUserAction(new ExExChPrimaryGeneratorAction());
81  SetUserAction(new ExExChEventAction());
82  SetUserAction(new ExExChStackingAction());
83  SetUserAction(new ExExChTrackingAction());
84  SetUserAction(new ExExChRunAction());
85 }
86 
87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
88 
89 void ExExChUserActionInitialization::BuildForMaster() const {
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93 #endif
void SetPosDisType(G4String)
Important: This is a shared class between threads.
CLHEP::Hep3Vector G4ThreeVector
Andrea Dotti Feb 2015 Important: This is a shared class between threads.
Andrea Dotti Feb 2015 Important: This is a shared class between threads.
Andrea Dotti Feb 2015 GPS messenger design requires some explanation for what distributions parameter...
void SetBeamSigmaInAngY(G4double)
Andrea Dotti Feb 2015 Important: This is a shared class between threads.
void SetCentreCoords(G4ThreeVector)
static const double meter
Definition: G4SIunits.hh:72
void DefineAngRefAxes(G4String, G4ThreeVector)
static const double GeV
Definition: G4SIunits.hh:196
static const double rad
Definition: G4SIunits.hh:130
static const double mm
Definition: G4SIunits.hh:102
void SetBeamSigmaInAngX(G4double)