G4Fragment.cc File Reference

#include "G4Fragment.hh"
#include "G4HadronicException.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4ios.hh"
#include <iomanip>

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &out, const G4Fragment *theFragment)
std::ostream & operator<< (std::ostream &out, const G4Fragment &theFragment)


Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const G4Fragment theFragment 
)

Definition at line 217 of file G4Fragment.cc.

00218 {
00219   out << &theFragment;
00220   return out; 
00221 }

std::ostream& operator<< ( std::ostream &  out,
const G4Fragment theFragment 
)

Definition at line 173 of file G4Fragment.cc.

References G4endl, G4Fragment::GetExcitationEnergy(), G4Fragment::GetNumberOfExcitons(), G4Fragment::IsStable(), G4Fragment::numberOfCharged, G4Fragment::numberOfChargedHoles, G4Fragment::numberOfHoles, G4Fragment::numberOfParticles, G4Fragment::theA, G4Fragment::theMomentum, and G4Fragment::theZ.

00174 {
00175   if (!theFragment) {
00176     out << "Fragment: null pointer ";
00177     return out;
00178   }
00179 
00180   std::ios::fmtflags old_floatfield = out.flags();
00181   out.setf(std::ios::floatfield);
00182 
00183   out << "Fragment: A = " << std::setw(3) << theFragment->theA 
00184       << ", Z = " << std::setw(3) << theFragment->theZ ;
00185   out.setf(std::ios::scientific,std::ios::floatfield);
00186 
00187   // Store user's precision setting and reset to (3) here: back-compatibility
00188   std::streamsize floatPrec = out.precision();
00189 
00190   out << std::setprecision(3)
00191       << ", U = " << theFragment->GetExcitationEnergy()/CLHEP::MeV 
00192       << " MeV  IsStable= " << theFragment->IsStable() << G4endl
00193       << "          P = (" 
00194       << theFragment->theMomentum.x()/CLHEP::MeV << ","
00195       << theFragment->theMomentum.y()/CLHEP::MeV << ","
00196       << theFragment->theMomentum.z()/CLHEP::MeV 
00197       << ") MeV   E = " 
00198       << theFragment->theMomentum.t()/CLHEP::MeV << " MeV"
00199       << G4endl;
00200        
00201   // What about Angular momentum???
00202 
00203   if (theFragment->GetNumberOfExcitons() != 0) {
00204     out << "          " 
00205         << "#Particles= " << theFragment->numberOfParticles 
00206         << ", #Charged= " << theFragment->numberOfCharged
00207         << ", #Holes= "   << theFragment->numberOfHoles
00208         << ", #ChargedHoles= " << theFragment->numberOfChargedHoles
00209         << G4endl;
00210   }
00211   out.setf(old_floatfield,std::ios::floatfield);
00212   out.precision(floatPrec);
00213 
00214   return out;
00215 }


Generated on Mon May 27 17:50:44 2013 for Geant4 by  doxygen 1.4.7