Geant4 11.2.2
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 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 ()
 
G4String Name () const
 
const G4VisTrajContextGetContext () const
 
void SetVerbose (const G4bool &)
 
G4bool GetVerbose () const
 

Detailed Description

Definition at line 42 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 34 of file G4TrajectoryDrawByCharge.cc.

35 :G4VTrajectoryModel(name, context)
36{
37 // Default configuration
38 fMap[Positive] = G4Colour::Blue();
39 fMap[Negative] = G4Colour::Red();
40 fMap[Neutral] = G4Colour::Green();
41}
static G4Colour Green()
Definition G4Colour.hh:162
static G4Colour Red()
Definition G4Colour.hh:161
static G4Colour Blue()
Definition G4Colour.hh:163
G4VTrajectoryModel(const G4String &name, G4VisTrajContext *fpContext=0)

◆ G4TrajectoryDrawByCharge() [2/2]

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

Definition at line 43 of file G4TrajectoryDrawByCharge.cc.

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

◆ ~G4TrajectoryDrawByCharge()

G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge ( )
virtual

Definition at line 54 of file G4TrajectoryDrawByCharge.cc.

54{}

Member Function Documentation

◆ Draw()

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

Implements G4VTrajectoryModel.

Definition at line 57 of file G4TrajectoryDrawByCharge.cc.

58{
59 G4Colour colour;
60
61 const G4double charge = traj.GetCharge();
62
63 if(charge>0.) fMap.GetColour(Positive, colour);
64 else if(charge<0.) fMap.GetColour(Negative, colour);
65 else fMap.GetColour(Neutral, colour);
66
67 G4VisTrajContext myContext(GetContext());
68
69 myContext.SetLineColour(colour);
70
71 if (GetVerbose()) {
72 G4cout<<"G4TrajectoryDrawByCharge drawer named "<<Name();
73 G4cout<<", drawing trajectory with charge, "<<charge<<G4endl;
74 G4cout<<", with configuration:"<<G4endl;
75 myContext.Print(G4cout);
76 }
77
79}
double G4double
Definition G4Types.hh:83
#define G4endl
Definition G4ios.hh:67
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 G4TrajectoryDrawByCharge::Print ( std::ostream & ostr) const
virtual

Implements G4VTrajectoryModel.

Definition at line 82 of file G4TrajectoryDrawByCharge.cc.

83{
84 ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
85 fMap.Print(ostr);
86 ostr<<"Default configuration:"<<G4endl;
88}
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 97 of file G4TrajectoryDrawByCharge.cc.

98{
99 fMap[charge] = colour;
100}

Referenced by Set(), and Set().

◆ Set() [2/4]

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

Definition at line 91 of file G4TrajectoryDrawByCharge.cc.

92{
93 fMap.Set(charge, colour);
94}
void Set(const T &, const G4Colour &)

◆ Set() [3/4]

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

Definition at line 119 of file G4TrajectoryDrawByCharge.cc.

120{
121 Charge myCharge;
122
123 if (!ConvertToCharge(charge, myCharge)) {
125 ed << "Invalid charge "<<charge;
127 ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "modeling0122", JustWarning, ed);
128 }
129
130 return Set(myCharge, colour);
131}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
void Set(const Charge &charge, const G4Colour &colour)

◆ Set() [4/4]

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

Definition at line 103 of file G4TrajectoryDrawByCharge.cc.

104{
105 Charge myCharge;
106
107 if (!ConvertToCharge(charge, myCharge)) {
109 ed << "Invalid charge "<<charge;
111 ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "modeling0121", JustWarning, ed);
112 return;
113 }
114
115 return Set(myCharge, colour);
116}

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