Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4Scene.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// Scene John Allison 19th July 1996.
31//
32// Class Description:
33//
34// Defines the viewable scene.
35
36#ifndef G4SCENE_HH
37#define G4SCENE_HH
38
39#include "globals.hh"
40#include "G4ios.hh"
41
43
44#include "G4VisExtent.hh"
45#include "G4Point3D.hh"
46#include "G4VModel.hh"
47#include <vector>
48
49class G4Scene {
50
51public: // With description
52
53 friend std::ostream& operator << (std::ostream& os, const G4Scene& d);
54
55 enum {UNLIMITED = -1};
56
57 G4Scene (const G4String& name = "scene-with-unspecified-name");
58 ~G4Scene ();
59
60 // Makes use of default (compiler generated) copy constructor and
61 // assignment operator.
62
64 G4bool operator != (const G4Scene&) const;
65
66 //////////////////////////////////////////////////////
67 // Get functions...
68
69 const G4String& GetName () const;
70
71 G4bool IsEmpty () const;
72
73 struct Model {
74 Model(G4VModel* pModel): fActive(true), fpModel(pModel) {}
77 };
78
79 const std::vector<Model>& GetRunDurationModelList () const;
80 // Contains models which are expected to last for the duration of
81 // the run, for example geometry volumes.
82
83 const std::vector<Model>& GetEndOfEventModelList () const;
84 // Contains models which are described at the end of event when the
85 // scene is current.
86
87 const std::vector<Model>& GetEndOfRunModelList () const;
88 // Contains models which are described at the end of event when the
89 // scene is current.
90
91 const G4VisExtent& GetExtent () const;
92 // Overall extent of all objects in the scene.
93
95 // Usually centre of extent. See G4ViewParameters for definition.
96
98 // If true, the visualization manager will request viewer to refresh
99 // "transient" objects, such as hits, at end of event. Otherwise
100 // they will be accumulated.
101
103 // If RefreshAtEndOfEvent is false, events of the current run are
104 // kept up to this maximum number. A negative value means all
105 // events of current run are kept. The events are available for
106 // viewing at the end of run, but are deleted just before the start
107 // of the next run.
108
110 // If true, the visualization manager will request viewer to refresh
111 // "transient" objects, such as hits, at end of run. Otherwise
112 // they will be accumulated.
113
114 //////////////////////////////////////////////
115 // Add and Set functions...
116
117 G4bool AddRunDurationModel (G4VModel*, G4bool warn = false);
118 // Adds models of type which are expected to last for the duration
119 // of the run, for example geometry volumes.
120 // Returns false if model is already in the list.
121 // Prints warnings if warn is true.
122
123 G4bool AddWorldIfEmpty (G4bool warn = false);
124 // In some situations, if the user asks for a drawing and has not
125 // yet set any run duration models it makes sense to put the "world"
126 // in there by default.
127 // Returns false if model is already in the list.
128 // Prints warnings if warn is true.
129
130 G4bool AddEndOfEventModel (G4VModel*, G4bool warn = false);
131 // Adds models of type which are described at the end of event when
132 // the scene is current.
133 // Returns false if model is already in the list.
134 // Prints warnings if warn is true.
135
136 G4bool AddEndOfRunModel (G4VModel*, G4bool warn = false);
137 // Adds models of type which are described at the end of run when
138 // the scene is current.
139 // Returns false if model is already in the list.
140 // Prints warnings if warn is true.
141
142 void SetName (const G4String&);
143 // Use with care. User normally sets scene name by vis commands.
144
145 std::vector<Model>& SetRunDurationModelList ();
146 // Allows you to change the model list - do with care!
147
148 std::vector<Model>& SetEndOfEventModelList ();
149 // Allows you to change the model list - do with care!
150
151 std::vector<Model>& SetEndOfRunModelList ();
152 // Allows you to change the model list - do with care!
153
155 // If set true, the visualization manager will request viewer to
156 // refresh "transient" objects, such as hits, at end of event.
157 // Otherwise they will be accumulated.
158
160 // If RefreshAtEndOfEvent is false, events of the current run are
161 // kept up to this maximum number. A negative value means all
162 // events of current run are kept. The events are available for
163 // viewing at the end of run, but are deleted just before the start
164 // of the next run.
165
167 // If set true, the visualization manager will request viewer to
168 // refresh "transient" objects, such as hits, at end of run.
169 // Otherwise they will be accumulated.
170
171 //////////////////////////////////////////////
172 // Other functions...
173
174 void CalculateExtent();
175 // (Re-)calculates the extent from the extents of its models.
176
177private:
178 G4String fName;
179 std::vector<Model> fRunDurationModelList;
180 std::vector<Model> fEndOfEventModelList;
181 std::vector<Model> fEndOfRunModelList;
182 G4VisExtent fExtent;
183 G4Point3D fStandardTargetPoint;
184 G4bool fRefreshAtEndOfEvent;
185 G4bool fRefreshAtEndOfRun;
186 G4int fMaxNumberOfKeptEvents;
187};
188
189#include "G4Scene.icc"
190
191#endif
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
std::vector< Model > & SetEndOfRunModelList()
@ UNLIMITED
Definition: G4Scene.hh:55
void CalculateExtent()
Definition: G4Scene.cc:72
const std::vector< Model > & GetEndOfRunModelList() const
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
Definition: G4Scene.cc:49
G4bool AddWorldIfEmpty(G4bool warn=false)
Definition: G4Scene.cc:154
const std::vector< Model > & GetRunDurationModelList() const
G4bool GetRefreshAtEndOfEvent() const
void SetRefreshAtEndOfEvent(G4bool)
const G4VisExtent & GetExtent() const
G4bool operator!=(const G4Scene &) const
Definition: G4Scene.cc:278
const G4Point3D & GetStandardTargetPoint() const
friend std::ostream & operator<<(std::ostream &os, const G4Scene &d)
Definition: G4Scene.cc:230
G4bool AddEndOfRunModel(G4VModel *, G4bool warn=false)
Definition: G4Scene.cc:210
void SetName(const G4String &)
const G4String & GetName() const
G4bool operator==(const G4Scene &) const
const std::vector< Model > & GetEndOfEventModelList() const
std::vector< Model > & SetRunDurationModelList()
std::vector< Model > & SetEndOfEventModelList()
void SetRefreshAtEndOfRun(G4bool)
~G4Scene()
Definition: G4Scene.cc:47
void SetMaxNumberOfKeptEvents(G4int)
G4bool GetRefreshAtEndOfRun() const
G4bool AddEndOfEventModel(G4VModel *, G4bool warn=false)
Definition: G4Scene.cc:190
G4bool IsEmpty() const
G4int GetMaxNumberOfKeptEvents() const
G4bool fActive
Definition: G4Scene.hh:75
G4VModel * fpModel
Definition: G4Scene.hh:76
Model(G4VModel *pModel)
Definition: G4Scene.hh:74