Geant4_10
G4HadronicWhiteBoard.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 #include "G4HadronicWhiteBoard.hh"
27 
28 
30  : theProjectile(0), theDef(0), theName(0), theE(0.0), thePx(0.0),
31  thePy(0.0), thePz(0.0), theA(0), theZ(0)
32 {}
33 
34 
36 {
37  static G4ThreadLocal G4HadronicWhiteBoard *theInstance_G4MT_TLS_ = 0 ; if (!theInstance_G4MT_TLS_) theInstance_G4MT_TLS_ = new G4HadronicWhiteBoard ; G4HadronicWhiteBoard &theInstance = *theInstance_G4MT_TLS_;
38  return theInstance;
39 }
40 
42 {
43  return theProjectile;
44 }
45 
47 {
48  return theTarget;
49 }
50 
59 
60 
62 {
63  theProjectile = const_cast<G4HadProjectile*>(& aProjectile);
64  theDef = const_cast<G4ParticleDefinition*>(theProjectile->GetDefinition());
65  theName = const_cast<char *>(theDef->GetParticleName().c_str() );
66  theE = theProjectile->Get4Momentum().t();
67  thePx = theProjectile->Get4Momentum().vect().x();
68  thePy = theProjectile->Get4Momentum().vect().y();
69  thePz = theProjectile->Get4Momentum().vect().z();
70 }
71 
72 
74 {
75  theTarget = aTarget;
76  theA = theTarget.GetA_asInt();
77  theZ = theTarget.GetZ_asInt();
78 }
79 
80 
82 {
83  theProcessName = aProcessName;
84 }
85 
86 
88 {
89  theModelName = aModelName;
90 }
91 
92 
94 {
95  std::cerr << std::endl;
96  std::cerr << "*** Geant4 Hadronic Reaction Information ***"
97  << std::endl;
98  std::cerr << " Process: " << theProcessName << " , Model: "
99  << theModelName << std::endl;
100  std::cerr << " Nucleus A, Z = " << theA << " " << theZ
101  << std::endl;
102  std::cerr << " Projectile was a " << theName
103  << std::endl;
104  std::cerr << " projectile momentum (px, py, pz) = (" << thePx << ", "
105  << thePy << ", " << thePz << ")" << std::endl;
106  std::cerr << " Projectile energy = "<< theE
107  << std::endl;
108  std::cerr << "*** End of Geant4 Hadronic Reaction Information ***"
109  << std::endl;
110  G4Exception(theModelName, "001", FatalException, "segmentation fault");
111 }
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
double x() const
void SetProcessName(const G4String &aProcessName)
void SetTargetNucleus(const G4Nucleus &aTarget)
void SetModelName(const G4String &aModelName)
#define G4ThreadLocal
Definition: tls.hh:52
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
double z() const
const G4Nucleus & GetTargetNucleus()
const G4HadProjectile * GetProjectile()
Hep3Vector vect() const
const G4ParticleDefinition * GetDefinition() const
const G4LorentzVector & Get4Momentum() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4HadronicWhiteBoard & Instance()
double y() const
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
G4ParticleDefinition * GetPDef()
double G4double
Definition: G4Types.hh:76
void SetProjectile(const G4HadProjectile &aProjectile)