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 | #include "G4HadronicWhiteBoard.hh" |
---|
27 | |
---|
28 | |
---|
29 | G4HadronicWhiteBoard & G4HadronicWhiteBoard::Instance() |
---|
30 | { |
---|
31 | static G4HadronicWhiteBoard theInstance; |
---|
32 | return theInstance; |
---|
33 | } |
---|
34 | |
---|
35 | const G4HadProjectile * G4HadronicWhiteBoard::GetProjectile() |
---|
36 | { |
---|
37 | return theProjectile; |
---|
38 | } |
---|
39 | |
---|
40 | const G4Nucleus & G4HadronicWhiteBoard::GetTargetNucleus() |
---|
41 | { |
---|
42 | return theTarget; |
---|
43 | } |
---|
44 | |
---|
45 | G4ParticleDefinition * G4HadronicWhiteBoard::GetPDef() {return theDef;} |
---|
46 | G4String G4HadronicWhiteBoard::GetParticleName() {return theName;} |
---|
47 | G4double G4HadronicWhiteBoard::GetEnergy() {return theE;} |
---|
48 | G4double G4HadronicWhiteBoard::GetPx(){return thePx;} |
---|
49 | G4double G4HadronicWhiteBoard::GetPy(){return thePy;} |
---|
50 | G4double G4HadronicWhiteBoard::GetPz(){return thePz;} |
---|
51 | G4double G4HadronicWhiteBoard::GetA(){return theA;} |
---|
52 | G4double G4HadronicWhiteBoard::GetZ(){return theZ;} |
---|
53 | |
---|
54 | |
---|
55 | void G4HadronicWhiteBoard::SetProjectile(const G4HadProjectile & aProjectile) |
---|
56 | { |
---|
57 | theProjectile = const_cast<G4HadProjectile*>(& aProjectile); |
---|
58 | theDef = const_cast<G4ParticleDefinition*>(theProjectile->GetDefinition()); |
---|
59 | theName = const_cast<char *>(theDef->GetParticleName().c_str() ); |
---|
60 | theE = theProjectile->Get4Momentum().t(); |
---|
61 | thePx = theProjectile->Get4Momentum().vect().x(); |
---|
62 | thePy = theProjectile->Get4Momentum().vect().y(); |
---|
63 | thePz = theProjectile->Get4Momentum().vect().z(); |
---|
64 | } |
---|
65 | |
---|
66 | |
---|
67 | void G4HadronicWhiteBoard::SetTargetNucleus(const G4Nucleus & aTarget) |
---|
68 | { |
---|
69 | theTarget = aTarget; |
---|
70 | theA = theTarget.GetN(); |
---|
71 | theZ = theTarget.GetZ(); |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | void G4HadronicWhiteBoard::SetProcessName(const G4String& aProcessName) |
---|
76 | { |
---|
77 | theProcessName = aProcessName; |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | void G4HadronicWhiteBoard::SetModelName(const G4String& aModelName) |
---|
82 | { |
---|
83 | theModelName = aModelName; |
---|
84 | } |
---|
85 | |
---|
86 | |
---|
87 | void G4HadronicWhiteBoard::Dump() |
---|
88 | { |
---|
89 | std::cerr << std::endl; |
---|
90 | std::cerr << "*** Geant4 Hadronic Reaction Information ***" |
---|
91 | << std::endl; |
---|
92 | std::cerr << " Process: " << theProcessName << " , Model: " |
---|
93 | << theModelName << std::endl; |
---|
94 | std::cerr << " Nucleus A, Z = " << theA << " " << theZ |
---|
95 | << std::endl; |
---|
96 | std::cerr << " Projectile was a " << theName |
---|
97 | << std::endl; |
---|
98 | std::cerr << " projectile momentum (px, py, pz) = (" << thePx << ", " |
---|
99 | << thePy << ", " << thePz << ")" << std::endl; |
---|
100 | std::cerr << " Projectile energy = "<< theE |
---|
101 | << std::endl; |
---|
102 | std::cerr << "*** End of Geant4 Hadronic Reaction Information ***" |
---|
103 | << std::endl; |
---|
104 | G4Exception(theModelName, "001", FatalException, "segmentation fault"); |
---|
105 | } |
---|