42 fRefreshAtEndOfEvent(true),
43 fRefreshAtEndOfRun(true),
44 fMaxNumberOfKeptEvents(0)
50 std::vector<Model>::const_iterator i;
51 for (i = fRunDurationModelList.begin ();
52 i != fRunDurationModelList.end (); ++i) {
53 if (pModel -> GetGlobalDescription () ==
56 if (i != fRunDurationModelList.end ()) {
58 G4cout <<
"G4Scene::AddRunDurationModel: model \""
59 << pModel -> GetGlobalDescription ()
60 <<
"\"\n is already in the run-duration list of scene \""
67 fRunDurationModelList.push_back (
Model(pModel));
76 for (
size_t i = 0; i < fRunDurationModelList.size(); i++) {
77 if (fRunDurationModelList[i].fActive) {
78 G4VModel* model = fRunDurationModelList[i].fpModel;
79 if (model -> Validate()) {
82 if (thisRadius > 0.) {
84 thisCentre.transform (model -> GetTransformation ());
90 <<
"\".\n Not included in extent calculation.";
92 (
"G4Scene::CalculateExtent",
98 for (
size_t i = 0; i < fEndOfEventModelList.size(); i++) {
99 if (fEndOfEventModelList[i].fActive) {
100 G4VModel* model = fEndOfEventModelList[i].fpModel;
101 if (model -> Validate()) {
104 if (thisRadius > 0.) {
106 thisCentre.transform (model -> GetTransformation ());
112 <<
"\".\n Not included in extent calculation.";
114 (
"G4Scene::CalculateExtent",
120 for (
size_t i = 0; i < fEndOfRunModelList.size(); i++) {
121 if (fEndOfRunModelList[i].fActive) {
122 G4VModel* model = fEndOfRunModelList[i].fpModel;
123 if (model -> Validate()) {
126 if (thisRadius > 0.) {
128 thisCentre.transform (model -> GetTransformation ());
134 <<
"\".\n Not included in extent calculation.";
136 (
"G4Scene::CalculateExtent",
146 (
"G4Scene::CalculateExtent",
148 "Scene has no extent. Please activate or add something."
149 "\nThe camera needs to have something to point at!"
150 "\n\"/vis/scene/list\" to see list of models.");
160 -> GetNavigatorForTracking () -> GetWorldVolume ();
163 pWorld -> GetLogicalVolume () -> GetVisAttributes ();
164 if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
167 "Your \"world\" has no vis attributes or is marked as visible."
168 "\n For a better view of the contents, mark the world as"
170 "\n myWorldLogicalVol ->"
171 " SetVisAttributes (G4VisAttributes::Invisible);"
180 "G4Scene::AddWorldIfEmpty: The scene was empty of run-duration models."
181 "\n \"world\" has been added.";
191 G4int i, nModels = fEndOfEventModelList.size ();
192 for (i = 0; i < nModels; i++) {
193 if (pModel -> GetGlobalDescription () ==
194 fEndOfEventModelList[i].fpModel -> GetGlobalDescription ())
break;
198 G4cout <<
"G4Scene::AddEndOfEventModel: a model \""
199 << pModel -> GetGlobalDescription ()
200 <<
"\"\n is already in the end-of-event list of scene \""
206 fEndOfEventModelList.push_back (
Model(pModel));
211 G4int i, nModels = fEndOfRunModelList.size ();
212 for (i = 0; i < nModels; i++) {
213 if (pModel -> GetGlobalDescription () ==
214 fEndOfRunModelList[i].fpModel -> GetGlobalDescription ())
break;
218 G4cout <<
"G4Scene::AddEndOfRunModel: a model \""
219 << pModel -> GetGlobalDescription ()
220 <<
"\"\n is already in the end-of-run list of scene \""
226 fEndOfRunModelList.push_back (pModel);
236 os <<
"\n Run-duration model list:";
237 for (i = 0; i < scene.fRunDurationModelList.size (); i++) {
238 if (scene.fRunDurationModelList[i].fActive) os <<
"\n Active: ";
239 else os <<
"\n Inactive: ";
240 os << *(scene.fRunDurationModelList[i].fpModel);
243 os <<
"\n End-of-event model list:";
244 for (i = 0; i < scene.fEndOfEventModelList.size (); i++) {
245 if (scene.fEndOfEventModelList[i].fActive) os <<
"\n Active: ";
246 else os <<
"\n Inactive: ";
247 os << *(scene.fEndOfEventModelList[i].fpModel);
250 os <<
"\n End-of-run model list:";
251 for (i = 0; i < scene.fEndOfRunModelList.size (); i++) {
252 if (scene.fEndOfRunModelList[i].fActive) os <<
"\n Active: ";
253 else os <<
"\n Inactive: ";
254 os << *(scene.fEndOfRunModelList[i].fpModel);
257 os <<
"\n Extent or bounding box: " << scene.fExtent;
259 os <<
"\n Standard target point: " << scene.fStandardTargetPoint;
261 os <<
"\n End of event action set to \"";
262 if (scene.fRefreshAtEndOfEvent) os <<
"refresh\"";
264 os <<
"accumulate (maximum number of kept events: ";
265 if (scene.fMaxNumberOfKeptEvents >= 0) os << scene.fMaxNumberOfKeptEvents;
266 else os <<
"unlimited";
270 os <<
"\n End of run action set to \"";
271 if (scene.fRefreshAtEndOfRun) os <<
"refresh";
272 else os <<
"accumulate";
280 (fRunDurationModelList.size () !=
281 scene.fRunDurationModelList.size ()) ||
282 (fEndOfEventModelList.size () !=
283 scene.fEndOfEventModelList.size ()) ||
284 (fEndOfRunModelList.size () !=
285 scene.fEndOfRunModelList.size ()) ||
286 (fExtent != scene.fExtent) ||
287 !(fStandardTargetPoint == scene.fStandardTargetPoint) ||
288 fRefreshAtEndOfEvent != scene.fRefreshAtEndOfEvent ||
289 fRefreshAtEndOfRun != scene.fRefreshAtEndOfRun ||
290 fMaxNumberOfKeptEvents != scene.fMaxNumberOfKeptEvents
std::ostream & operator<<(std::ostream &os, const G4Scene &scene)
G4DLLIMPORT std::ostream G4cout
void AccrueBoundingSphere(const G4Point3D ¢re, G4double radius)
G4VisExtent GetBoundingSphereExtent()
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
G4bool AddWorldIfEmpty(G4bool warn=false)
const G4VisExtent & GetExtent() const
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 & GetGlobalDescription() const
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription