source: trunk/source/processes/hadronic/util/src/G4HadronicWhiteBoard.cc @ 1347

Last change on this file since 1347 was 1347, checked in by garnier, 13 years ago

geant4 tag 9.4

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