43 fRefreshAtEndOfEvent(true),
44 fRefreshAtEndOfRun(true),
45 fMaxNumberOfKeptEvents(100)
52 std::vector<Model>::const_iterator i;
53 for (i = fRunDurationModelList.begin ();
54 i != fRunDurationModelList.end (); ++i) {
55 if (pModel -> GetGlobalDescription () ==
58 if (i != fRunDurationModelList.end ()) {
60 G4cout <<
"G4Scene::AddRunDurationModel: model \""
61 << pModel -> GetGlobalDescription ()
62 <<
"\"\n is already in the run-duration list of scene \""
70 for (i = fRunDurationModelList.begin ();
71 i != fRunDurationModelList.end (); ++i) {
72 if (pModel -> GetGlobalTag () ==
75 if (i != fRunDurationModelList.end ()) {
78 <<
"G4Scene::AddRunDurationModel: The tag \""
80 <<
"\"\n duplicates one already in scene \""
83 "\".\n This may be intended but if not, you may inspect the scene with"
84 "\n \"/vis/scene/list\" and deactivate unwanted models with"
85 "\n \"/vis/scene/activateModel\". Or create a new scene."
90 fRunDurationModelList.push_back (
Model(pModel));
98 void PrintInvalidModel(
const G4VModel* model)
102 <<
"\".\n Not included in extent calculation.";
104 (
"G4Scene::CalculateExtent",
113 for (
size_t i = 0; i < fRunDurationModelList.size(); i++) {
114 if (fRunDurationModelList[i].fActive) {
115 G4VModel* model = fRunDurationModelList[i].fpModel;
116 if (model -> Validate()) {
117 const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
122 PrintInvalidModel(model);
127 for (
size_t i = 0; i < fEndOfEventModelList.size(); i++) {
128 if (fEndOfEventModelList[i].fActive) {
129 G4VModel* model = fEndOfEventModelList[i].fpModel;
130 if (model -> Validate()) {
131 const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
136 PrintInvalidModel(model);
141 for (
size_t i = 0; i < fEndOfRunModelList.size(); i++) {
142 if (fEndOfRunModelList[i].fActive) {
143 G4VModel* model = fEndOfRunModelList[i].fpModel;
144 if (model -> Validate()) {
145 const G4VisExtent& thisExtent = model -> GetTransformedExtent ();
150 PrintInvalidModel(model);
159 (
"G4Scene::CalculateExtent",
161 "Scene has no extent. Please activate or add something."
162 "\nThe camera needs to have something to point at!"
163 "\nAdd a volume. (You may need \"/run/initialize\".)"
164 "\nOr use \"/vis/scene/add/extent\"."
165 "\n\"/vis/scene/list\" to see list of models.");
175 -> GetNavigatorForTracking () -> GetWorldVolume ();
178 pWorld -> GetLogicalVolume () -> GetVisAttributes ();
179 if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
182 "Your \"world\" has no vis attributes or is marked as visible."
183 "\n For a better view of the contents, mark the world as"
185 "\n myWorldLogicalVol ->"
186 " SetVisAttributes (G4VisAttributes::GetInvisible());"
195 "G4Scene::AddWorldIfEmpty: The scene was empty of run-duration models."
196 "\n \"world\" has been added.";
206 G4int i, nModels = fEndOfEventModelList.size ();
207 for (i = 0; i < nModels; i++) {
208 if (pModel -> GetGlobalDescription () ==
209 fEndOfEventModelList[i].fpModel -> GetGlobalDescription ())
break;
213 G4cout <<
"G4Scene::AddEndOfEventModel: a model \""
214 << pModel -> GetGlobalDescription ()
215 <<
"\"\n is already in the end-of-event list of scene \""
221 fEndOfEventModelList.push_back (
Model(pModel));
226 G4int i, nModels = fEndOfRunModelList.size ();
227 for (i = 0; i < nModels; i++) {
228 if (pModel -> GetGlobalDescription () ==
229 fEndOfRunModelList[i].fpModel -> GetGlobalDescription ())
break;
233 G4cout <<
"G4Scene::AddEndOfRunModel: a model \""
234 << pModel -> GetGlobalDescription ()
235 <<
"\"\n is already in the end-of-run list of scene \""
241 fEndOfRunModelList.push_back (pModel);
251 os <<
"\n Run-duration model list:";
252 if (scene.fRunDurationModelList.size () == 0) {
255 for (i = 0; i < scene.fRunDurationModelList.size (); i++) {
256 if (scene.fRunDurationModelList[i].fActive) os <<
"\n Active: ";
257 else os <<
"\n Inactive: ";
258 os << *(scene.fRunDurationModelList[i].fpModel);
261 os <<
"\n End-of-event model list:";
262 if (scene.fEndOfEventModelList.size () == 0) {
265 for (i = 0; i < scene.fEndOfEventModelList.size (); i++) {
266 if (scene.fEndOfEventModelList[i].fActive) os <<
"\n Active: ";
267 else os <<
"\n Inactive: ";
268 os << *(scene.fEndOfEventModelList[i].fpModel);
271 os <<
"\n End-of-run model list:";
272 if (scene.fEndOfRunModelList.size () == 0) {
275 for (i = 0; i < scene.fEndOfRunModelList.size (); i++) {
276 if (scene.fEndOfRunModelList[i].fActive) os <<
"\n Active: ";
277 else os <<
"\n Inactive: ";
278 os << *(scene.fEndOfRunModelList[i].fpModel);
281 os <<
"\n Overall extent or bounding box: " << scene.fExtent;
283 os <<
"\n Standard target point: " << scene.fStandardTargetPoint;
285 os <<
"\n End of event action set to \"";
286 if (scene.fRefreshAtEndOfEvent) os <<
"refresh\"";
288 os <<
"accumulate (maximum number of kept events: ";
289 if (scene.fMaxNumberOfKeptEvents >= 0) os << scene.fMaxNumberOfKeptEvents;
290 else os <<
"unlimited";
294 os <<
"\n End of run action set to \"";
295 if (scene.fRefreshAtEndOfRun) os <<
"refresh";
296 else os <<
"accumulate";
304 (fRunDurationModelList.size () !=
305 scene.fRunDurationModelList.size ()) ||
306 (fEndOfEventModelList.size () !=
307 scene.fEndOfEventModelList.size ()) ||
308 (fEndOfRunModelList.size () !=
309 scene.fEndOfRunModelList.size ()) ||
310 (fExtent != scene.fExtent) ||
311 !(fStandardTargetPoint == scene.fStandardTargetPoint) ||
312 fRefreshAtEndOfEvent != scene.fRefreshAtEndOfEvent ||
313 fRefreshAtEndOfRun != scene.fRefreshAtEndOfRun ||
314 fMaxNumberOfKeptEvents != scene.fMaxNumberOfKeptEvents
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::ostream & operator<<(std::ostream &os, const G4Scene &scene)
G4GLOB_DLL std::ostream G4cout
void AccrueBoundingExtent(const G4VisExtent &)
const G4VisExtent & GetBoundingExtent() const
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
G4bool AddWorldIfEmpty(G4bool warn=false)
G4bool operator!=(const G4Scene &) const
G4bool AddEndOfRunModel(G4VModel *, G4bool warn=false)
G4Scene(const G4String &name="scene-with-unspecified-name")
G4bool AddEndOfEventModel(G4VModel *, G4bool warn=false)
static G4TransportationManager * GetTransportationManager()
const G4String & GetGlobalTag() const
const G4String & GetGlobalDescription() const
static const G4VisExtent & GetNullExtent()
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const