Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 G4ThreadLocal G4HadronicWhiteBoard * G4HadronicWhiteBoard::theInstance = 0;
29 
31  : theProjectile(0), theDef(0), theName(0), theE(0.0), thePx(0.0),
32  thePy(0.0), thePz(0.0), theA(0), theZ(0)
33 {}
34 
35 
37 {
38  if (!theInstance) theInstance = new G4HadronicWhiteBoard;
39  return *theInstance;
40 }
41 
43 {
44  return theProjectile;
45 }
46 
48 {
49  return theTarget;
50 }
51 
60 
61 
63 {
64  theProjectile = & aProjectile;
65  theDef = theProjectile->GetDefinition();
66  theName = theDef->GetParticleName().c_str();
67  theE = theProjectile->Get4Momentum().t();
68  thePx = theProjectile->Get4Momentum().vect().x();
69  thePy = theProjectile->Get4Momentum().vect().y();
70  thePz = theProjectile->Get4Momentum().vect().z();
71 }
72 
73 
75 {
76  theTarget = aTarget;
77  theA = theTarget.GetA_asInt();
78  theZ = theTarget.GetZ_asInt();
79 }
80 
81 
83 {
84  theProcessName = aProcessName;
85 }
86 
87 
89 {
90  theModelName = aModelName;
91 }
92 
93 
95 {
96  std::cerr << std::endl;
97  std::cerr << "*** Geant4 Hadronic Reaction Information ***"
98  << std::endl;
99  std::cerr << " Process: " << theProcessName << " , Model: "
100  << theModelName << std::endl;
101  std::cerr << " Nucleus A, Z = " << theA << " " << theZ
102  << std::endl;
103  std::cerr << " Projectile was a " << theName
104  << std::endl;
105  std::cerr << " projectile momentum (px, py, pz) = (" << thePx << ", "
106  << thePy << ", " << thePz << ")" << std::endl;
107  std::cerr << " Projectile energy = "<< theE
108  << std::endl;
109  std::cerr << "*** End of Geant4 Hadronic Reaction Information ***"
110  << std::endl;
111  G4Exception(theModelName, "001", FatalException, "segmentation fault");
112 }
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:89
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 G4ParticleDefinition * GetPDef()
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
double G4double
Definition: G4Types.hh:76
void SetProjectile(const G4HadProjectile &aProjectile)