#include <G4TrajectoryDrawByParticleID.hh>
Inheritance diagram for G4TrajectoryDrawByParticleID:
Public Member Functions | |
G4TrajectoryDrawByParticleID (const G4String &name="Unspecified", G4VisTrajContext *context=0) | |
virtual | ~G4TrajectoryDrawByParticleID () |
virtual void | Draw (const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) const |
virtual void | Draw (const G4VTrajectory &trajectory, const G4bool &visible=true) const |
virtual void | Print (std::ostream &ostr) const |
void | SetDefault (const G4String &) |
void | SetDefault (const G4Colour &) |
void | Set (const G4String &particle, const G4String &colour) |
void | Set (const G4String &particle, const G4Colour &colour) |
Definition at line 44 of file G4TrajectoryDrawByParticleID.hh.
G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID | ( | const G4String & | name = "Unspecified" , |
|
G4VisTrajContext * | context = 0 | |||
) |
Definition at line 35 of file G4TrajectoryDrawByParticleID.cc.
References Set().
00036 :G4VTrajectoryModel(name, context) 00037 ,fDefault(G4Colour::Grey()) 00038 { 00039 Set("gamma", "green"); 00040 Set("e-", "red"); 00041 Set("e+", "blue"); 00042 Set("pi+", "magenta"); 00043 Set("pi-", "magenta"); 00044 Set("proton", "cyan"); 00045 Set("neutron", "yellow"); 00046 }
G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID | ( | ) | [virtual] |
void G4TrajectoryDrawByParticleID::Draw | ( | const G4VTrajectory & | trajectory, | |
const G4bool & | visible = true | |||
) | const [virtual] |
Implements G4VTrajectoryModel.
Definition at line 59 of file G4TrajectoryDrawByParticleID.cc.
References G4TrajectoryDrawerUtils::DrawLineAndPoints(), G4cout, G4endl, G4ModelColourMap< T >::GetColour(), G4VTrajectoryModel::GetContext(), G4VTrajectory::GetParticleName(), G4VTrajectoryModel::GetVerbose(), G4VTrajectoryModel::Name(), G4VisTrajContext::Print(), G4VisTrajContext::SetLineColour(), and G4VisTrajContext::SetVisible().
00060 { 00061 G4Colour colour(fDefault); 00062 G4String particle = traj.GetParticleName(); 00063 00064 fMap.GetColour(particle, colour); 00065 00066 G4VisTrajContext myContext(GetContext()); 00067 00068 myContext.SetLineColour(colour); 00069 myContext.SetVisible(visible); 00070 00071 if (GetVerbose()) { 00072 G4cout<<"G4TrajectoryDrawByParticleID drawer named "<<Name(); 00073 G4cout<<", drawing trajectory with particle type, "<<particle<<G4endl; 00074 G4cout<<", with configuration:"<<G4endl; 00075 myContext.Print(G4cout); 00076 } 00077 00078 G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext); 00079 }
void G4TrajectoryDrawByParticleID::Draw | ( | const G4VTrajectory & | trajectory, | |
const G4int & | i_mode = 0 , |
|||
const G4bool & | visible = true | |||
) | const [virtual] |
Implements G4VTrajectoryModel.
Definition at line 51 of file G4TrajectoryDrawByParticleID.cc.
00054 { 00055 Draw(object, visible); 00056 }
void G4TrajectoryDrawByParticleID::Print | ( | std::ostream & | ostr | ) | const [virtual] |
Implements G4VTrajectoryModel.
Definition at line 117 of file G4TrajectoryDrawByParticleID.cc.
References G4cout, G4endl, G4VTrajectoryModel::GetContext(), G4VTrajectoryModel::Name(), G4VisTrajContext::Print(), and G4ModelColourMap< T >::Print().
00118 { 00119 ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl; 00120 00121 ostr<<"Default colour: "<<fDefault<<G4endl; 00122 00123 fMap.Print(ostr); 00124 00125 ostr<<"Default configuration:"<<G4endl; 00126 GetContext().Print(G4cout); 00127 }
Definition at line 105 of file G4TrajectoryDrawByParticleID.cc.
References G4ModelColourMap< T >::Set().
Referenced by G4TrajectoryDrawByParticleID().
00106 { 00107 fMap.Set(particle, colour); 00108 }
void G4TrajectoryDrawByParticleID::SetDefault | ( | const G4Colour & | ) |
void G4TrajectoryDrawByParticleID::SetDefault | ( | const G4String & | ) |
Definition at line 82 of file G4TrajectoryDrawByParticleID.cc.
References G4Exception(), G4Colour::GetColour(), JustWarning, and G4Colour::White().
00083 { 00084 G4Colour myColour(G4Colour::White()); 00085 00086 // Will not modify myColour if colour key does not exist 00087 if (!G4Colour::GetColour(colour, myColour)) { 00088 G4ExceptionDescription ed; 00089 ed << "G4Colour with key "<<colour<<" does not exist "; 00090 G4Exception 00091 ("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)", 00092 "modeling0124", JustWarning, ed); 00093 } 00094 00095 SetDefault(myColour); 00096 }