Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4TrajectoryDrawByParticleID Class Reference

#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 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)
 
- Public Member Functions inherited from G4VTrajectoryModel
 G4VTrajectoryModel (const G4String &name, G4VisTrajContext *fpContext=0)
 
virtual ~G4VTrajectoryModel ()
 
virtual void Draw (const G4VTrajectory &trajectory, const G4bool &visible=true) const =0
 
virtual void Print (std::ostream &ostr) const =0
 
G4String Name () const
 
const G4VisTrajContextGetContext () const
 
void SetVerbose (const G4bool &)
 
G4bool GetVerbose () const
 

Detailed Description

Definition at line 43 of file G4TrajectoryDrawByParticleID.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryDrawByParticleID()

G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID ( const G4String name = "Unspecified",
G4VisTrajContext context = 0 
)

Definition at line 34 of file G4TrajectoryDrawByParticleID.cc.

35 :G4VTrajectoryModel(name, context)
36 ,fDefault(G4Colour::Grey())
37{
38 Set("gamma", "green");
39 Set("e-", "red");
40 Set("e+", "blue");
41 Set("pi+", "magenta");
42 Set("pi-", "magenta");
43 Set("proton", "cyan");
44 Set("neutron", "yellow");
45}
static G4Colour Grey()
Definition: G4Colour.hh:158
void Set(const G4String &particle, const G4String &colour)

◆ ~G4TrajectoryDrawByParticleID()

G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID ( )
virtual

Definition at line 47 of file G4TrajectoryDrawByParticleID.cc.

47{}

Member Function Documentation

◆ Draw()

void G4TrajectoryDrawByParticleID::Draw ( const G4VTrajectory trajectory,
const G4bool visible = true 
) const
virtual

Implements G4VTrajectoryModel.

Definition at line 50 of file G4TrajectoryDrawByParticleID.cc.

51{
52 G4Colour colour(fDefault);
53 G4String particle = traj.GetParticleName();
54
55 fMap.GetColour(particle, colour);
56
57 G4VisTrajContext myContext(GetContext());
58
59 myContext.SetLineColour(colour);
60
61 if (GetVerbose()) {
62 G4cout<<"G4TrajectoryDrawByParticleID drawer named "<<Name();
63 G4cout<<", drawing trajectory with particle type, "<<particle<<G4endl;
64 G4cout<<", with configuration:"<<G4endl;
65 myContext.Print(G4cout);
66 }
67
69}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
bool GetColour(const T &, G4Colour &) const
G4String Name() const
const G4VisTrajContext & GetContext() const
G4bool GetVerbose() const
void DrawLineAndPoints(const G4VTrajectory &traj, const G4VisTrajContext &)

◆ Print()

void G4TrajectoryDrawByParticleID::Print ( std::ostream &  ostr) const
virtual

Implements G4VTrajectoryModel.

Definition at line 107 of file G4TrajectoryDrawByParticleID.cc.

108{
109 ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl;
110
111 ostr<<"Default colour: "<<fDefault<<G4endl;
112
113 fMap.Print(ostr);
114
115 ostr<<"Default configuration:"<<G4endl;
117}
void Print(std::ostream &ostr) const
void Print(std::ostream &ostr) const

◆ Set() [1/2]

void G4TrajectoryDrawByParticleID::Set ( const G4String particle,
const G4Colour colour 
)

Definition at line 101 of file G4TrajectoryDrawByParticleID.cc.

102{
103 fMap[particle] = colour;
104}

◆ Set() [2/2]

void G4TrajectoryDrawByParticleID::Set ( const G4String particle,
const G4String colour 
)

Definition at line 95 of file G4TrajectoryDrawByParticleID.cc.

96{
97 fMap.Set(particle, colour);
98}
void Set(const T &, const G4Colour &)

Referenced by G4TrajectoryDrawByParticleID().

◆ SetDefault() [1/2]

void G4TrajectoryDrawByParticleID::SetDefault ( const G4Colour colour)

Definition at line 89 of file G4TrajectoryDrawByParticleID.cc.

90{
91 fDefault = colour;
92}

◆ SetDefault() [2/2]

void G4TrajectoryDrawByParticleID::SetDefault ( const G4String colour)

Definition at line 72 of file G4TrajectoryDrawByParticleID.cc.

73{
74 G4Colour myColour(G4Colour::White());
75
76 // Will not modify myColour if colour key does not exist
77 if (!G4Colour::GetColour(colour, myColour)) {
79 ed << "G4Colour with key "<<colour<<" does not exist ";
81 ("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)",
82 "modeling0124", JustWarning, ed);
83 }
84
85 SetDefault(myColour);
86}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4Colour White()
Definition: G4Colour.hh:156
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:155

Referenced by SetDefault().


The documentation for this class was generated from the following files: