Geant4 9.6.0
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 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)
 
- Public Member Functions inherited from G4VTrajectoryModel
 G4VTrajectoryModel (const G4String &name, G4VisTrajContext *fpContext=0)
 
virtual ~G4VTrajectoryModel ()
 
virtual void Draw (const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) const =0
 
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 44 of file G4TrajectoryDrawByParticleID.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryDrawByParticleID()

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

Definition at line 35 of file G4TrajectoryDrawByParticleID.cc.

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

◆ ~G4TrajectoryDrawByParticleID()

G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID ( )
virtual

Definition at line 48 of file G4TrajectoryDrawByParticleID.cc.

48{}

Member Function Documentation

◆ Draw() [1/2]

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

Implements G4VTrajectoryModel.

Definition at line 59 of file G4TrajectoryDrawByParticleID.cc.

60{
61 G4Colour colour(fDefault);
62 G4String particle = traj.GetParticleName();
63
64 fMap.GetColour(particle, colour);
65
66 G4VisTrajContext myContext(GetContext());
67
68 myContext.SetLineColour(colour);
69 myContext.SetVisible(visible);
70
71 if (GetVerbose()) {
72 G4cout<<"G4TrajectoryDrawByParticleID drawer named "<<Name();
73 G4cout<<", drawing trajectory with particle type, "<<particle<<G4endl;
74 G4cout<<", with configuration:"<<G4endl;
75 myContext.Print(G4cout);
76 }
77
79}
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT 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 &, const G4int &i_mode)

◆ Draw() [2/2]

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.

54{
55 Draw(object, visible);
56}
virtual void Draw(const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) const

Referenced by Draw().

◆ Print()

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

Implements G4VTrajectoryModel.

Definition at line 117 of file G4TrajectoryDrawByParticleID.cc.

118{
119 ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl;
120
121 ostr<<"Default colour: "<<fDefault<<G4endl;
122
123 fMap.Print(ostr);
124
125 ostr<<"Default configuration:"<<G4endl;
127}
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 111 of file G4TrajectoryDrawByParticleID.cc.

112{
113 fMap[particle] = colour;
114}

◆ Set() [2/2]

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

Definition at line 105 of file G4TrajectoryDrawByParticleID.cc.

106{
107 fMap.Set(particle, colour);
108}
void Set(const T &, const G4Colour &)

Referenced by G4TrajectoryDrawByParticleID().

◆ SetDefault() [1/2]

void G4TrajectoryDrawByParticleID::SetDefault ( const G4Colour colour)

Definition at line 99 of file G4TrajectoryDrawByParticleID.cc.

100{
101 fDefault = colour;
102}

◆ SetDefault() [2/2]

void G4TrajectoryDrawByParticleID::SetDefault ( const G4String colour)

Definition at line 82 of file G4TrajectoryDrawByParticleID.cc.

83{
84 G4Colour myColour(G4Colour::White());
85
86 // Will not modify myColour if colour key does not exist
87 if (!G4Colour::GetColour(colour, myColour)) {
89 ed << "G4Colour with key "<<colour<<" does not exist ";
91 ("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)",
92 "modeling0124", JustWarning, ed);
93 }
94
95 SetDefault(myColour);
96}
@ JustWarning
static G4Colour White()
Definition: G4Colour.hh:142
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:123
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

Referenced by SetDefault().


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