Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4TrajectoryDrawByParticleID Class Reference

#include <G4TrajectoryDrawByParticleID.hh>

Inheritance diagram for G4TrajectoryDrawByParticleID:
Collaboration 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 ()
 
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 ( 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 }
G4VTrajectoryModel(const G4String &name, G4VisTrajContext *fpContext=0)
static G4Colour Grey()
Definition: G4Colour.hh:145
void Set(const G4String &particle, const G4String &colour)

Here is the call graph for this function:

G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID ( )
virtual

Definition at line 48 of file G4TrajectoryDrawByParticleID.cc.

48 {}

Member Function Documentation

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

Implements G4VTrajectoryModel.

Definition at line 51 of file G4TrajectoryDrawByParticleID.cc.

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

Here is the call graph for this function:

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

Implements G4VTrajectoryModel.

Definition at line 109 of file G4TrajectoryDrawByParticleID.cc.

110 {
111  ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl;
112 
113  ostr<<"Default colour: "<<fDefault<<G4endl;
114 
115  fMap.Print(ostr);
116 
117  ostr<<"Default configuration:"<<G4endl;
119 }
G4String Name() const
const G4VisTrajContext & GetContext() const
G4GLOB_DLL std::ostream G4cout
void Print(std::ostream &ostr) const
#define G4endl
Definition: G4ios.hh:61
void Print(std::ostream &ostr) const

Here is the call graph for this function:

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

Definition at line 97 of file G4TrajectoryDrawByParticleID.cc.

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 103 of file G4TrajectoryDrawByParticleID.cc.

104 {
105  fMap[particle] = colour;
106 }
void G4TrajectoryDrawByParticleID::SetDefault ( const G4String colour)

Definition at line 74 of file G4TrajectoryDrawByParticleID.cc.

75 {
76  G4Colour myColour(G4Colour::White());
77 
78  // Will not modify myColour if colour key does not exist
79  if (!G4Colour::GetColour(colour, myColour)) {
81  ed << "G4Colour with key "<<colour<<" does not exist ";
83  ("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)",
84  "modeling0124", JustWarning, ed);
85  }
86 
87  SetDefault(myColour);
88 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:126
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4Colour White()
Definition: G4Colour.hh:143

Here is the call graph for this function:

void G4TrajectoryDrawByParticleID::SetDefault ( const G4Colour colour)

Definition at line 91 of file G4TrajectoryDrawByParticleID.cc.

92 {
93  fDefault = colour;
94 }

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