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

#include <G4TrajectoryDrawByCharge.hh>

Inheritance diagram for G4TrajectoryDrawByCharge:
Collaboration 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 43 of file G4TrajectoryDrawByCharge.hh.

Member Enumeration Documentation

Constructor & Destructor Documentation

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 }
G4VTrajectoryModel(const G4String &name, G4VisTrajContext *fpContext=0)
static G4Colour Green()
Definition: G4Colour.hh:149
static G4Colour Blue()
Definition: G4Colour.hh:150
static G4Colour Red()
Definition: G4Colour.hh:148

Here is the call graph for this function:

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

Definition at line 44 of file G4TrajectoryDrawByCharge.cc.

48  :G4VTrajectoryModel(name)
49 {
50  fMap[Positive] = positive;
51  fMap[Negative] = negative;
52  fMap[Neutral] = neutral;
53 }
G4VTrajectoryModel(const G4String &name, G4VisTrajContext *fpContext=0)
G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge ( )
virtual

Definition at line 55 of file G4TrajectoryDrawByCharge.cc.

55 {}

Member Function Documentation

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

Implements G4VTrajectoryModel.

Definition at line 58 of file G4TrajectoryDrawByCharge.cc.

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

Here is the call graph for this function:

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

Implements G4VTrajectoryModel.

Definition at line 84 of file G4TrajectoryDrawByCharge.cc.

85 {
86  ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
87  fMap.Print(ostr);
88  ostr<<"Default configuration:"<<G4endl;
90 }
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 G4TrajectoryDrawByCharge::Set ( const Charge charge,
const G4Colour colour 
)

Definition at line 99 of file G4TrajectoryDrawByCharge.cc.

100 {
101  fMap[charge] = colour;
102 }

Here is the caller graph for this function:

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

Definition at line 93 of file G4TrajectoryDrawByCharge.cc.

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

Here is the call graph for this function:

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

Definition at line 121 of file G4TrajectoryDrawByCharge.cc.

122 {
123  Charge myCharge;
124 
125  if (!ConvertToCharge(charge, myCharge)) {
127  ed << "Invalid charge "<<charge;
128  G4Exception
129  ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "modeling0122", JustWarning, ed);
130  }
131 
132  return Set(myCharge, colour);
133 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void Set(const Charge &charge, const G4Colour &colour)

Here is the call graph for this function:

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

Definition at line 105 of file G4TrajectoryDrawByCharge.cc.

106 {
107  Charge myCharge;
108 
109  if (!ConvertToCharge(charge, myCharge)) {
111  ed << "Invalid charge "<<charge;
112  G4Exception
113  ("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "modeling0121", JustWarning, ed);
114  return;
115  }
116 
117  return Set(myCharge, colour);
118 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void Set(const Charge &charge, const G4Colour &colour)

Here is the call graph for this function:


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