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

#include <G4TrajectoryDrawByCharge.hh>

+ Inheritance diagram for G4TrajectoryDrawByCharge:

Public Types

enum  Charge { Negative =-1 , Neutral =0 , Positive =1 }
 

Public Member Functions

 G4TrajectoryDrawByCharge (const G4String &name="Unspecified", G4VisTrajContext *context=0)
 
 G4TrajectoryDrawByCharge (const G4String &name, const G4Colour &positive, const G4Colour &negative, const G4Colour &neutral)
 
virtual ~G4TrajectoryDrawByCharge ()
 
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 Set (const Charge &charge, const G4Colour &colour)
 
void Set (const Charge &charge, const G4String &colour)
 
void Set (const G4String &charge, const G4Colour &colour)
 
void Set (const G4String &charge, const G4String &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 43 of file G4TrajectoryDrawByCharge.hh.

Member Enumeration Documentation

◆ Charge

Constructor & Destructor Documentation

◆ G4TrajectoryDrawByCharge() [1/2]

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

Definition at line 35 of file G4TrajectoryDrawByCharge.cc.

36 :G4VTrajectoryModel(name, context)
37{
38 // Default configuration
39 fMap[Positive] = G4Colour::Blue();
40 fMap[Negative] = G4Colour::Red();
41 fMap[Neutral] = G4Colour::Green();
42}
static G4Colour Green()
Definition: G4Colour.hh:148
static G4Colour Red()
Definition: G4Colour.hh:147
static G4Colour Blue()
Definition: G4Colour.hh:149

◆ G4TrajectoryDrawByCharge() [2/2]

G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge ( const G4String name,
const G4Colour positive,
const G4Colour negative,
const G4Colour neutral 
)

Definition at line 44 of file G4TrajectoryDrawByCharge.cc.

49{
50 fMap[Positive] = positive;
51 fMap[Negative] = negative;
52 fMap[Neutral] = neutral;
53}

◆ ~G4TrajectoryDrawByCharge()

G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge ( )
virtual

Definition at line 55 of file G4TrajectoryDrawByCharge.cc.

55{}

Member Function Documentation

◆ Draw() [1/2]

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

Implements G4VTrajectoryModel.

Definition at line 66 of file G4TrajectoryDrawByCharge.cc.

67{
68 G4Colour colour;
69
70 const G4double charge = traj.GetCharge();
71
72 if(charge>0.) fMap.GetColour(Positive, colour);
73 else if(charge<0.) fMap.GetColour(Negative, colour);
74 else fMap.GetColour(Neutral, colour);
75
76 G4VisTrajContext myContext(GetContext());
77
78 myContext.SetLineColour(colour);
79 myContext.SetVisible(visible);
80
81 if (GetVerbose()) {
82 G4cout<<"G4TrajectoryDrawByCharge drawer named "<<Name();
83 G4cout<<", drawing trajectory with charge, "<<charge<<G4endl;
84 G4cout<<", with configuration:"<<G4endl;
85 myContext.Print(G4cout);
86 }
87
89}
double G4double
Definition: G4Types.hh:64
#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 G4TrajectoryDrawByCharge::Draw ( const G4VTrajectory trajectory,
const G4int i_mode = 0,
const G4bool visible = true 
) const
virtual

Implements G4VTrajectoryModel.

Definition at line 58 of file G4TrajectoryDrawByCharge.cc.

61{
62 Draw(object, visible);
63}
virtual void Draw(const G4VTrajectory &trajectory, const G4int &i_mode=0, const G4bool &visible=true) const

Referenced by Draw().

◆ Print()

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

Implements G4VTrajectoryModel.

Definition at line 92 of file G4TrajectoryDrawByCharge.cc.

93{
94 ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
95 fMap.Print(ostr);
96 ostr<<"Default configuration:"<<G4endl;
98}
void Print(std::ostream &ostr) const
void Print(std::ostream &ostr) const

◆ Set() [1/4]

void G4TrajectoryDrawByCharge::Set ( const Charge charge,
const G4Colour colour 
)

Definition at line 107 of file G4TrajectoryDrawByCharge.cc.

108{
109 fMap[charge] = colour;
110}

Referenced by Set().

◆ Set() [2/4]

void G4TrajectoryDrawByCharge::Set ( const Charge charge,
const G4String colour 
)

Definition at line 101 of file G4TrajectoryDrawByCharge.cc.

102{
103 fMap.Set(charge, colour);
104}
void Set(const T &, const G4Colour &)

◆ Set() [3/4]

void G4TrajectoryDrawByCharge::Set ( const G4String charge,
const G4Colour colour 
)

Definition at line 129 of file G4TrajectoryDrawByCharge.cc.

130{
131 Charge myCharge;
132
133 if (!ConvertToCharge(charge, myCharge)) {
135 ed << "Invalid charge "<<charge;
137 ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "modeling0122", JustWarning, ed);
138 }
139
140 return Set(myCharge, colour);
141}
@ JustWarning
void Set(const Charge &charge, const G4Colour &colour)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

◆ Set() [4/4]

void G4TrajectoryDrawByCharge::Set ( const G4String charge,
const G4String colour 
)

Definition at line 113 of file G4TrajectoryDrawByCharge.cc.

114{
115 Charge myCharge;
116
117 if (!ConvertToCharge(charge, myCharge)) {
119 ed << "Invalid charge "<<charge;
121 ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "modeling0121", JustWarning, ed);
122 return;
123 }
124
125 return Set(myCharge, colour);
126}

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