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

#include <G4TrajectoryDrawByOriginVolume.hh>

+ Inheritance diagram for G4TrajectoryDrawByOriginVolume:

Public Member Functions

 G4TrajectoryDrawByOriginVolume (const G4String &name="Unspecified", G4VisTrajContext *context=0)
 
virtual ~G4TrajectoryDrawByOriginVolume ()
 
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 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 42 of file G4TrajectoryDrawByOriginVolume.hh.

Constructor & Destructor Documentation

◆ G4TrajectoryDrawByOriginVolume()

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

Definition at line 36 of file G4TrajectoryDrawByOriginVolume.cc.

37 :G4VTrajectoryModel(name, context)
38 ,fDefault(G4Colour::Grey())
39{}
static G4Colour Grey()
Definition: G4Colour.hh:158

◆ ~G4TrajectoryDrawByOriginVolume()

G4TrajectoryDrawByOriginVolume::~G4TrajectoryDrawByOriginVolume ( )
virtual

Definition at line 41 of file G4TrajectoryDrawByOriginVolume.cc.

41{}

Member Function Documentation

◆ Draw()

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

Implements G4VTrajectoryModel.

Definition at line 44 of file G4TrajectoryDrawByOriginVolume.cc.

45{
46 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
47 assert (0 != aTrajectoryPoint);
48
49 G4Colour colour(fDefault);
50
51 G4Navigator* navigator =
53
55 (aTrajectoryPoint->GetPosition(), nullptr,false,true);
56
57 // Logical volumes form basis.
58 G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
59 assert (0 != logicalVolume);
60
61 G4String logicalName = logicalVolume->GetName();
62 fMap.GetColour(logicalName, colour);
63
64 // Override with physical volume colouring if it exists
65 G4String physicalName = volume->GetName();
66 fMap.GetColour(physicalName, colour);
67
68 G4VisTrajContext myContext(GetContext());
69
70 myContext.SetLineColour(colour);
71
72 if (GetVerbose()) {
73 G4cout<<"G4TrajectoryDrawByOriginVolume drawer named "<<Name();
74 G4cout<<", drawing trajectory originating in logical volume, "<<logicalName;
75 G4cout<<", physical volume "<<physicalName<<", with configuration:"<<G4endl;
76 myContext.Print(G4cout);
77 }
78
80}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool GetColour(const T &, G4Colour &) const
virtual G4VPhysicalVolume * LocateGlobalPointAndSetup(const G4ThreeVector &point, const G4ThreeVector *direction=nullptr, const G4bool pRelativeSearch=true, const G4bool ignoreDirection=true)
Definition: G4Navigator.cc:132
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4String Name() const
const G4VisTrajContext & GetContext() const
G4bool GetVerbose() const
virtual const G4ThreeVector GetPosition() const =0
void DrawLineAndPoints(const G4VTrajectory &traj, const G4VisTrajContext &)

◆ Print()

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

Implements G4VTrajectoryModel.

Definition at line 118 of file G4TrajectoryDrawByOriginVolume.cc.

119{
120 ostr
121 << "G4TrajectoryDrawByOriginVolume model "<< Name()
122 << ", colour scheme: "
123 << ", Default " << fDefault
124 << std::endl;
125
126 fMap.Print(ostr);
127
128 ostr << "Default configuration:" << std::endl;
129 GetContext().Print(ostr);
130}
void Print(std::ostream &ostr) const
void Print(std::ostream &ostr) const

◆ Set() [1/2]

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

Definition at line 112 of file G4TrajectoryDrawByOriginVolume.cc.

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

◆ Set() [2/2]

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

Definition at line 106 of file G4TrajectoryDrawByOriginVolume.cc.

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

◆ SetDefault() [1/2]

void G4TrajectoryDrawByOriginVolume::SetDefault ( const G4Colour colour)

Definition at line 100 of file G4TrajectoryDrawByOriginVolume.cc.

101{
102 fDefault = colour;
103}

◆ SetDefault() [2/2]

void G4TrajectoryDrawByOriginVolume::SetDefault ( const G4String colour)

Definition at line 83 of file G4TrajectoryDrawByOriginVolume.cc.

84{
85 G4Colour myColour;
86
87 // Will not modify default colour if colour key does not exist
88 if (!G4Colour::GetColour(colour, myColour)) {
90 ed << "G4Colour with key "<<colour<<" does not exist ";
92 ("G4TrajectoryDrawByOriginParticleID::SetDefault(const G4String& colour)", "modeling0123", JustWarning, ed);
93 return;
94 }
95
96 SetDefault(myColour);
97}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:155

Referenced by SetDefault().


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