G4HadronicWhiteBoard.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 
00026 #include "G4HadronicWhiteBoard.hh"
00027 
00028 
00029 G4HadronicWhiteBoard::G4HadronicWhiteBoard()
00030  : theProjectile(0), theDef(0), theName(0), theE(0.0), thePx(0.0),
00031    thePy(0.0), thePz(0.0), theA(0), theZ(0)
00032 {}
00033 
00034 
00035 G4HadronicWhiteBoard & G4HadronicWhiteBoard::Instance()
00036 {
00037   static G4HadronicWhiteBoard theInstance;
00038   return theInstance;
00039 }
00040 
00041 const G4HadProjectile * G4HadronicWhiteBoard::GetProjectile() 
00042 {
00043   return theProjectile;
00044 }
00045 
00046 const G4Nucleus & G4HadronicWhiteBoard::GetTargetNucleus() 
00047 { 
00048   return theTarget;
00049 }
00050 
00051 G4ParticleDefinition * G4HadronicWhiteBoard::GetPDef() {return theDef;}
00052 G4String G4HadronicWhiteBoard::GetParticleName() {return theName;}
00053 G4double G4HadronicWhiteBoard::GetEnergy() {return theE;}
00054 G4double G4HadronicWhiteBoard::GetPx(){return thePx;}
00055 G4double G4HadronicWhiteBoard::GetPy(){return thePy;}
00056 G4double G4HadronicWhiteBoard::GetPz(){return thePz;}
00057 G4int G4HadronicWhiteBoard::GetA(){return theA;}
00058 G4int G4HadronicWhiteBoard::GetZ(){return theZ;}
00059 
00060   
00061 void G4HadronicWhiteBoard::SetProjectile(const G4HadProjectile & aProjectile)
00062 {
00063   theProjectile = const_cast<G4HadProjectile*>(& aProjectile);
00064   theDef = const_cast<G4ParticleDefinition*>(theProjectile->GetDefinition());
00065   theName = const_cast<char *>(theDef->GetParticleName().c_str() );
00066   theE = theProjectile->Get4Momentum().t();
00067   thePx = theProjectile->Get4Momentum().vect().x();
00068   thePy = theProjectile->Get4Momentum().vect().y();
00069   thePz = theProjectile->Get4Momentum().vect().z();
00070 }
00071 
00072     
00073 void G4HadronicWhiteBoard::SetTargetNucleus(const G4Nucleus & aTarget) 
00074 {
00075   theTarget = aTarget;
00076   theA = theTarget.GetA_asInt();
00077   theZ = theTarget.GetZ_asInt();
00078 }
00079 
00080 
00081 void G4HadronicWhiteBoard::SetProcessName(const G4String& aProcessName) 
00082 {
00083   theProcessName = aProcessName;
00084 }
00085 
00086 
00087 void G4HadronicWhiteBoard::SetModelName(const G4String& aModelName) 
00088 {
00089   theModelName = aModelName;
00090 }
00091 
00092 
00093 void G4HadronicWhiteBoard::Dump()
00094 {
00095   std::cerr << std::endl;
00096   std::cerr << "*** Geant4 Hadronic Reaction Information ***" 
00097             << std::endl;
00098   std::cerr << "    Process: " << theProcessName << " , Model: " 
00099             << theModelName << std::endl;
00100   std::cerr << "    Nucleus A, Z = " << theA << " " << theZ 
00101             << std::endl;
00102   std::cerr << "    Projectile was a " << theName 
00103             << std::endl;
00104   std::cerr << "    projectile momentum (px, py, pz) = (" << thePx << ", " 
00105             << thePy << ", " << thePz << ")" << std::endl;
00106   std::cerr << "    Projectile energy = "<< theE 
00107             << std::endl;
00108   std::cerr << "*** End of Geant4 Hadronic Reaction Information ***"
00109             << std::endl;
00110   G4Exception(theModelName, "001", FatalException, "segmentation fault");
00111 }

Generated on Mon May 27 17:48:26 2013 for Geant4 by  doxygen 1.4.7