ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4Scene.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4Scene.hh
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 //
28 //
29 // Scene John Allison 19th July 1996.
30 //
31 // Class Description:
32 //
33 // Defines the viewable scene.
34 
35 #ifndef G4SCENE_HH
36 #define G4SCENE_HH
37 
38 #include "globals.hh"
39 #include "G4ios.hh"
40 
41 class G4VPhysicalVolume;
42 
43 #include "G4VisExtent.hh"
44 #include "G4Point3D.hh"
45 #include "G4VModel.hh"
46 #include <vector>
47 
48 class G4Scene {
49 
50 public: // With description
51 
52  friend std::ostream& operator << (std::ostream& os, const G4Scene& d);
53 
54  enum {UNLIMITED = -1};
55 
56  G4Scene (const G4String& name = "scene-with-unspecified-name");
57  ~G4Scene ();
58 
59  // Makes use of default (compiler generated) copy constructor and
60  // assignment operator.
61 
62  G4bool operator == (const G4Scene&) const;
63  G4bool operator != (const G4Scene&) const;
64 
66  // Get functions...
67 
68  const G4String& GetName () const;
69 
70  G4bool IsEmpty () const;
71 
72  struct Model {
73  Model(G4VModel* pModel): fActive(true), fpModel(pModel) {}
76  };
77 
78  const std::vector<Model>& GetRunDurationModelList () const;
79  // Contains models which are expected to last for the duration of
80  // the run, for example geometry volumes.
81 
82  const std::vector<Model>& GetEndOfEventModelList () const;
83  // Contains models which are described at the end of event when the
84  // scene is current.
85 
86  const std::vector<Model>& GetEndOfRunModelList () const;
87  // Contains models which are described at the end of event when the
88  // scene is current.
89 
90  const G4VisExtent& GetExtent () const;
91  // Overall extent of all objects in the scene.
92 
93  const G4Point3D& GetStandardTargetPoint () const;
94  // Usually centre of extent. See G4ViewParameters for definition.
95 
97  // If true, the visualization manager will request viewer to refresh
98  // "transient" objects, such as hits, at end of event. Otherwise
99  // they will be accumulated.
100 
102  // If RefreshAtEndOfEvent is false, events of the current run are
103  // kept up to this maximum number. A negative value means all
104  // events of current run are kept. The events are available for
105  // viewing at the end of run, but are deleted just before the start
106  // of the next run.
107 
108  G4bool GetRefreshAtEndOfRun () const;
109  // If true, the visualization manager will request viewer to refresh
110  // "transient" objects, such as hits, at end of run. Otherwise
111  // they will be accumulated.
112 
114  // Add and Set functions...
115 
116  G4bool AddRunDurationModel (G4VModel*, G4bool warn = false);
117  // Adds models of type which are expected to last for the duration
118  // of the run, for example geometry volumes.
119  // Returns false if model is already in the list.
120  // Prints warnings if warn is true.
121 
122  G4bool AddWorldIfEmpty (G4bool warn = false);
123  // In some situations, if the user asks for a drawing and has not
124  // yet set any run duration models it makes sense to put the "world"
125  // in there by default.
126  // Returns false if model is already in the list.
127  // Prints warnings if warn is true.
128 
129  G4bool AddEndOfEventModel (G4VModel*, G4bool warn = false);
130  // Adds models of type which are described at the end of event when
131  // the scene is current.
132  // Returns false if model is already in the list.
133  // Prints warnings if warn is true.
134 
135  G4bool AddEndOfRunModel (G4VModel*, G4bool warn = false);
136  // Adds models of type which are described at the end of run when
137  // the scene is current.
138  // Returns false if model is already in the list.
139  // Prints warnings if warn is true.
140 
141  void SetName (const G4String&);
142  // Use with care. User normally sets scene name by vis commands.
143 
144  std::vector<Model>& SetRunDurationModelList ();
145  // Allows you to change the model list - do with care!
146 
147  std::vector<Model>& SetEndOfEventModelList ();
148  // Allows you to change the model list - do with care!
149 
150  std::vector<Model>& SetEndOfRunModelList ();
151  // Allows you to change the model list - do with care!
152 
154  // If set true, the visualization manager will request viewer to
155  // refresh "transient" objects, such as hits, at end of event.
156  // Otherwise they will be accumulated.
157 
159  // If RefreshAtEndOfEvent is false, events of the current run are
160  // kept up to this maximum number. A negative value means all
161  // events of current run are kept. The events are available for
162  // viewing at the end of run, but are deleted just before the start
163  // of the next run.
164 
166  // If set true, the visualization manager will request viewer to
167  // refresh "transient" objects, such as hits, at end of run.
168  // Otherwise they will be accumulated.
169 
171  // Other functions...
172 
173  void CalculateExtent();
174  // (Re-)calculates the extent from the extents of its models.
175 
176 private:
178  std::vector<Model> fRunDurationModelList;
179  std::vector<Model> fEndOfEventModelList;
180  std::vector<Model> fEndOfRunModelList;
186 };
187 
188 #include "G4Scene.icc"
189 
190 #endif