Geant4  10.02.p03
G4Fragment.cc File Reference
#include "G4Fragment.hh"
#include "G4HadronicException.hh"
#include "G4ios.hh"
#include <iomanip>
Include dependency graph for G4Fragment.cc:

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)
 

Variables

G4ThreadLocal G4Allocator< G4Fragment > * pFragmentAllocator = nullptr
 

Function Documentation

◆ operator<<() [1/2]

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

Definition at line 181 of file G4Fragment.cc.

182 {
183  if (!theFragment) {
184  out << "Fragment: null pointer ";
185  return out;
186  }
187 
188  std::ios::fmtflags old_floatfield = out.flags();
189  out.setf(std::ios::floatfield);
190 
191  out << "Fragment: A = " << std::setw(3) << theFragment->theA
192  << ", Z = " << std::setw(3) << theFragment->theZ ;
193  out.setf(std::ios::scientific,std::ios::floatfield);
194 
195  // Store user's precision setting and reset to (3) here: back-compatibility
196  std::streamsize floatPrec = out.precision();
197 
198  out << std::setprecision(3)
199  << ", U = " << theFragment->GetExcitationEnergy()/CLHEP::MeV
200  << " MeV ";
201  if(theFragment->GetCreatorModelType() >= 0) {
202  out << " creatorModelType= " << theFragment->GetCreatorModelType();
203  }
204  if(theFragment->GetCreationTime() > 0.0) {
205  out << " Time= " << theFragment->GetCreationTime()/CLHEP::ns << " ns";
206  }
207  out << G4endl
208  << " P = ("
209  << theFragment->GetMomentum().x()/CLHEP::MeV << ","
210  << theFragment->GetMomentum().y()/CLHEP::MeV << ","
211  << theFragment->GetMomentum().z()/CLHEP::MeV
212  << ") MeV E = "
213  << theFragment->GetMomentum().t()/CLHEP::MeV << " MeV"
214  << G4endl;
215 
216  if(theFragment->GetNuclearPolarization()) {
217  out << theFragment->GetNuclearPolarization();
218  }
219 
220  if (theFragment->GetNumberOfExcitons() != 0) {
221  out << " "
222  << "#Particles= " << theFragment->GetNumberOfParticles()
223  << ", #Charged= " << theFragment->GetNumberOfCharged()
224  << ", #Holes= " << theFragment->GetNumberOfHoles()
225  << ", #ChargedHoles= " << theFragment->GetNumberOfChargedHoles()
226  << ", #spin= " << theFragment->GetSpin()
227  << G4endl;
228  }
229  out.setf(old_floatfield,std::ios::floatfield);
230  out.precision(floatPrec);
231 
232  return out;
233 }
G4int GetNumberOfExcitons() const
Definition: G4Fragment.hh:322
G4int theZ
Definition: G4Fragment.hh:182
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:273
G4int GetNumberOfHoles() const
Definition: G4Fragment.hh:347
G4int GetCreatorModelType() const
Definition: G4Fragment.hh:389
G4int theA
Definition: G4Fragment.hh:180
G4int GetNumberOfParticles() const
Definition: G4Fragment.hh:327
const G4LorentzVector & GetMomentum() const
Definition: G4Fragment.hh:289
G4NuclearPolarization * GetNuclearPolarization() const
Definition: G4Fragment.hh:430
G4double GetSpin() const
Definition: G4Fragment.hh:399
#define G4endl
Definition: G4ios.hh:61
static const double ns
G4double GetCreationTime() const
Definition: G4Fragment.hh:420
static const double MeV
G4int GetNumberOfChargedHoles() const
Definition: G4Fragment.hh:352
G4int GetNumberOfCharged() const
Definition: G4Fragment.hh:332
Here is the call graph for this function:

◆ operator<<() [2/2]

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

Definition at line 235 of file G4Fragment.cc.

236 {
237  out << &theFragment;
238  return out;
239 }

Variable Documentation

◆ pFragmentAllocator

G4ThreadLocal G4Allocator<G4Fragment>* pFragmentAllocator = nullptr

Definition at line 48 of file G4Fragment.cc.