Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
CexmcTrackPointInfo.cc File Reference
#include <iostream>
#include "CexmcTrackPointInfo.hh"

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &out, const CexmcTrackPointInfo &trackPointInfo)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const CexmcTrackPointInfo trackPointInfo 
)

Definition at line 48 of file CexmcTrackPointInfo.cc.

References CexmcBeamParticleTrack, CexmcNucleusParticleTrack, CexmcOutputParticleDecayProductTrack, CexmcOutputParticleTrack, CexmcTrackPointInfo::directionLocal, CexmcTrackPointInfo::directionWorld, G4BestUnit, G4ParticleDefinition::GetParticleName(), CexmcTrackPointInfo::IsValid(), CexmcTrackPointInfo::momentumAmp, CexmcTrackPointInfo::particle, CexmcTrackPointInfo::positionLocal, CexmcTrackPointInfo::positionWorld, CexmcTrackPointInfo::trackId, CexmcTrackPointInfo::trackType, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

50 {
51  if ( ! trackPointInfo.IsValid() )
52  return out << "tp is not valid";
53 
54  const char * trackTypeInfo = "???";
55 
56  switch ( trackPointInfo.trackType )
57  {
59  trackTypeInfo = "bp";
60  break;
62  trackTypeInfo = "op";
63  break;
65  trackTypeInfo = "np";
66  break;
68  trackTypeInfo = "opdp";
69  break;
70  default :
71  break;
72  }
73 
74  std::ostream::fmtflags savedFlags( out.flags() );
75  std::streamsize prec( out.precision() );
76 
77  out.precision( 4 );
78 
79  out << trackPointInfo.particle->GetParticleName() << " [" <<
80  trackPointInfo.trackId << "," << trackTypeInfo << "] " <<
81  G4BestUnit( trackPointInfo.momentumAmp, "Energy" ) << " : " <<
82  G4BestUnit( trackPointInfo.positionLocal, "Length" ) << " [" <<
83  trackPointInfo.directionLocal.x() << ", " <<
84  trackPointInfo.directionLocal.y() << ", " <<
85  trackPointInfo.directionLocal.z() << "]";
86 #ifdef CEXMC_DEBUG_TP
87  out << std::endl << " < in world: " <<
88  G4BestUnit( trackPointInfo.positionWorld, "Length" ) << " [" <<
89  trackPointInfo.directionWorld.x() << ", " <<
90  trackPointInfo.directionWorld.y() << ", " <<
91  trackPointInfo.directionWorld.z() << "] >";
92 #endif
93 
94  out.precision( prec );
95  out.flags( savedFlags );
96 
97  return out;
98 }
double x() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
const G4String & GetParticleName() const
double z() const
double y() const
G4bool IsValid(void) const
G4ThreeVector directionLocal
G4ThreeVector directionWorld
const G4ParticleDefinition * particle