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

#include <G4TrajectoriesModel.hh>

+ Inheritance diagram for G4TrajectoriesModel:

Public Member Functions

 G4TrajectoriesModel ()
 
virtual ~G4TrajectoriesModel ()
 
virtual void DescribeYourselfTo (G4VGraphicsScene &)
 
const G4VTrajectoryGetCurrentTrajectory () const
 
void SetCurrentTrajectory (const G4VTrajectory *pTraj)
 
void SetRunID (G4int runID)
 
void SetEventID (G4int eventID)
 
const std::map< G4String, G4AttDef > * GetAttDefs () const
 
std::vector< G4AttValue > * CreateCurrentAttValues () const
 
- Public Member Functions inherited from G4VModel
 G4VModel (const G4ModelingParameters *=0)
 
virtual ~G4VModel ()
 
virtual void DescribeYourselfTo (G4VGraphicsScene &)=0
 
const G4ModelingParametersGetModelingParameters () const
 
const G4StringGetType () const
 
virtual G4String GetCurrentDescription () const
 
virtual G4String GetCurrentTag () const
 
const G4VisExtentGetExtent () const
 
const G4StringGetGlobalDescription () const
 
const G4StringGetGlobalTag () const
 
void SetModelingParameters (const G4ModelingParameters *)
 
void SetExtent (const G4VisExtent &)
 
void SetType (const G4String &)
 
void SetGlobalDescription (const G4String &)
 
void SetGlobalTag (const G4String &)
 
virtual G4bool Validate (G4bool warn=true)
 

Additional Inherited Members

- Protected Attributes inherited from G4VModel
G4String fType
 
G4String fGlobalTag
 
G4String fGlobalDescription
 
G4VisExtent fExtent
 
const G4ModelingParametersfpMP
 

Detailed Description

Definition at line 51 of file G4TrajectoriesModel.hh.

Constructor & Destructor Documentation

◆ G4TrajectoriesModel()

G4TrajectoriesModel::G4TrajectoriesModel ( )

Definition at line 47 of file G4TrajectoriesModel.cc.

48:fpCurrentTrajectory(0)
49,fRunID(-1)
50,fEventID(-1)
51{
52 fType = "G4TrajectoriesModel";
53 fGlobalTag = "G4TrajectoriesModel for any type of trajectory";
55}
G4String fGlobalDescription
Definition: G4VModel.hh:100
G4String fType
Definition: G4VModel.hh:98
G4String fGlobalTag
Definition: G4VModel.hh:99

◆ ~G4TrajectoriesModel()

G4TrajectoriesModel::~G4TrajectoriesModel ( )
virtual

Definition at line 57 of file G4TrajectoriesModel.cc.

57{}

Member Function Documentation

◆ CreateCurrentAttValues()

std::vector< G4AttValue > * G4TrajectoriesModel::CreateCurrentAttValues ( ) const

Definition at line 120 of file G4TrajectoriesModel.cc.

121{
122 std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
123 values->push_back
124 (G4AttValue("RunID",G4UIcommand::ConvertToString(fRunID),""));
125 values->push_back
126 (G4AttValue("EventID",G4UIcommand::ConvertToString(fEventID),""));
127 return values;
128}
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:446

Referenced by G4VSceneHandler::LoadAtts().

◆ DescribeYourselfTo()

void G4TrajectoriesModel::DescribeYourselfTo ( G4VGraphicsScene sceneHandler)
virtual

Implements G4VModel.

Definition at line 61 of file G4TrajectoriesModel.cc.

62{
64 const G4Run* currentRun = runManager->GetCurrentRun();
65 if(currentRun)
66 {
67 fRunID = currentRun->GetRunID();
68 }
69 else
70 {
71 fRunID = -1;
72 return;
73 }
74
75 const G4Event* event = fpMP->GetEvent();
76 if (event) {
77 fEventID = event->GetEventID();
78 } else {
79 fEventID = -1;
80 return;
81 }
82
83 G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
84 if (!TC) return;
85
87 if (!pVVisManager) return;
88
89 pVVisManager->BeginDraw();
90 // The use of Begin/EndDraw (optional methods to improve drawing
91 // speed) assumes all trajectories are drawn with the same
92 // transformation. If not, a fatal exception with be raised in
93 // G4VisManager::DrawT.
94 for (std::size_t iT = 0; iT < TC->entries(); ++iT) {
95 fpCurrentTrajectory = (*TC) [iT];
96 // Debug trajectory:
97 // fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
98 // Debug G4AttValues:
99 // G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
100 if (fpCurrentTrajectory)
101 sceneHandler.AddCompound (*fpCurrentTrajectory);
102 }
103 pVVisManager->EndDraw();
104}
const G4Event * GetEvent() const
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
G4int GetRunID() const
Definition: G4Run.hh:78
std::size_t entries() const
virtual void AddCompound(const G4VTrajectory &)=0
const G4ModelingParameters * fpMP
Definition: G4VModel.hh:102
virtual void EndDraw()=0
static G4VVisManager * GetConcreteInstance()
virtual void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())=0

◆ GetAttDefs()

const std::map< G4String, G4AttDef > * G4TrajectoriesModel::GetAttDefs ( ) const

Definition at line 106 of file G4TrajectoriesModel.cc.

107{
108 G4bool isNew;
109 std::map<G4String,G4AttDef>* store
110 = G4AttDefStore::GetInstance("G4TrajectoriesModel", isNew);
111 if (isNew) {
112 (*store)["RunID"] =
113 G4AttDef("RunID","Run ID","Physics","","G4int");
114 (*store)["EventID"] =
115 G4AttDef("EventID","Event ID","Physics","","G4int");
116 }
117 return store;
118}
bool G4bool
Definition: G4Types.hh:86
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)

Referenced by G4VSceneHandler::LoadAtts(), G4VisCommandList::SetNewValue(), and G4VisCommandSceneAddTrajectories::SetNewValue().

◆ GetCurrentTrajectory()

const G4VTrajectory * G4TrajectoriesModel::GetCurrentTrajectory ( ) const
inline

Definition at line 62 of file G4TrajectoriesModel.hh.

63 {return fpCurrentTrajectory;}

Referenced by G4GMocrenFileSceneHandler::AddCompound(), and G4VSceneHandler::LoadAtts().

◆ SetCurrentTrajectory()

void G4TrajectoriesModel::SetCurrentTrajectory ( const G4VTrajectory pTraj)
inline

Definition at line 65 of file G4TrajectoriesModel.hh.

66 {fpCurrentTrajectory = pTraj;}

Referenced by G4VisManager::Draw().

◆ SetEventID()

void G4TrajectoriesModel::SetEventID ( G4int  eventID)
inline

Definition at line 71 of file G4TrajectoriesModel.hh.

72 {fEventID = eventID;}

Referenced by G4VisManager::Draw().

◆ SetRunID()

void G4TrajectoriesModel::SetRunID ( G4int  runID)
inline

Definition at line 68 of file G4TrajectoriesModel.hh.

69 {fRunID = runID;}

Referenced by G4VisManager::Draw().


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