Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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

◆ operator<<() [1/2]

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

Definition at line 217 of file G4Fragment.cc.

218{
219 out << &theFragment;
220 return out;
221}

◆ operator<<() [2/2]

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

Definition at line 173 of file G4Fragment.cc.

174{
175 if (!theFragment) {
176 out << "Fragment: null pointer ";
177 return out;
178 }
179
180 std::ios::fmtflags old_floatfield = out.flags();
181 out.setf(std::ios::floatfield);
182
183 out << "Fragment: A = " << std::setw(3) << theFragment->theA
184 << ", Z = " << std::setw(3) << theFragment->theZ ;
185 out.setf(std::ios::scientific,std::ios::floatfield);
186
187 // Store user's precision setting and reset to (3) here: back-compatibility
188 std::streamsize floatPrec = out.precision();
189
190 out << std::setprecision(3)
191 << ", U = " << theFragment->GetExcitationEnergy()/CLHEP::MeV
192 << " MeV IsStable= " << theFragment->IsStable() << G4endl
193 << " P = ("
194 << theFragment->theMomentum.x()/CLHEP::MeV << ","
195 << theFragment->theMomentum.y()/CLHEP::MeV << ","
196 << theFragment->theMomentum.z()/CLHEP::MeV
197 << ") MeV E = "
198 << theFragment->theMomentum.t()/CLHEP::MeV << " MeV"
199 << G4endl;
200
201 // What about Angular momentum???
202
203 if (theFragment->GetNumberOfExcitons() != 0) {
204 out << " "
205 << "#Particles= " << theFragment->numberOfParticles
206 << ", #Charged= " << theFragment->numberOfCharged
207 << ", #Holes= " << theFragment->numberOfHoles
208 << ", #ChargedHoles= " << theFragment->numberOfChargedHoles
209 << G4endl;
210 }
211 out.setf(old_floatfield,std::ios::floatfield);
212 out.precision(floatPrec);
213
214 return out;
215}
#define G4endl
Definition: G4ios.hh:52
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:235
G4bool IsStable() const
Definition: G4Fragment.hh:388
G4int GetNumberOfExcitons() const
Definition: G4Fragment.hh:300