45 fRefreshAtEndOfEvent(true),
46 fRefreshAtEndOfRun(true),
47 fMaxNumberOfKeptEvents(100)
53 void PrintInvalidModel(
const G4VModel* model)
57 <<
"\".\n Not included in extent calculation.";
59 (
"G4Scene::CalculateExtent",
68 for (
size_t i = 0; i < fRunDurationModelList.size(); i++) {
69 if (fRunDurationModelList[i].fActive) {
70 G4VModel* model = fRunDurationModelList[i].fpModel;
71 if (model -> Validate()) {
77 PrintInvalidModel(model);
82 for (
size_t i = 0; i < fEndOfEventModelList.size(); i++) {
83 if (fEndOfEventModelList[i].fActive) {
84 G4VModel* model = fEndOfEventModelList[i].fpModel;
85 if (model -> Validate()) {
91 PrintInvalidModel(model);
96 for (
size_t i = 0; i < fEndOfRunModelList.size(); i++) {
97 if (fEndOfRunModelList[i].fActive) {
98 G4VModel* model = fEndOfRunModelList[i].fpModel;
99 if (model -> Validate()) {
105 PrintInvalidModel(model);
114 (
"G4Scene::CalculateExtent",
116 "Scene has no extent. Please activate or add something."
117 "\nThe camera needs to have something to point at!"
118 "\nAdd a volume. (You may need \"/run/initialize\".)"
119 "\nOr use \"/vis/scene/add/extent\"."
120 "\n\"/vis/scene/list\" to see list of models.");
130 -> GetNavigatorForTracking () -> GetWorldVolume ();
133 pWorld -> GetLogicalVolume () -> GetVisAttributes ();
134 if (!pVisAttribs || pVisAttribs -> IsVisible ()) {
137 "Your \"world\" has no vis attributes or is marked as visible."
138 "\n For a better view of the contents, mark the world as"
140 "\n myWorldLogicalVol ->"
141 " SetVisAttributes (G4VisAttributes::GetInvisible());"
150 "G4Scene::AddWorldIfEmpty: The scene had no extent."
151 "\n \"world\" has been added.";
162 std::vector<Model>::const_iterator i;
163 for (i = fRunDurationModelList.begin ();
164 i != fRunDurationModelList.end (); ++i) {
165 if (pModel -> GetGlobalDescription () ==
168 if (i != fRunDurationModelList.end ()) {
170 G4warn <<
"G4Scene::AddRunDurationModel: model \""
171 << pModel -> GetGlobalDescription ()
172 <<
"\"\n is already in the run-duration list of scene \""
179 fRunDurationModelList.push_back (
Model(pModel));
185 std::size_t i, nModels = fEndOfEventModelList.size ();
186 for (i = 0; i < nModels; ++i) {
187 if (pModel -> GetGlobalDescription () ==
188 fEndOfEventModelList[i].fpModel -> GetGlobalDescription ())
break;
192 G4warn <<
"G4Scene::AddEndOfEventModel: a model \""
193 << pModel -> GetGlobalDescription ()
194 <<
"\"\n is already in the end-of-event list of scene \""
200 fEndOfEventModelList.push_back (
Model(pModel));
206 std::size_t i, nModels = fEndOfRunModelList.size ();
207 for (i = 0; i < nModels; ++i) {
208 if (pModel -> GetGlobalDescription () ==
209 fEndOfRunModelList[i].fpModel -> GetGlobalDescription ())
break;
213 G4warn <<
"G4Scene::AddEndOfRunModel: a model \""
214 << pModel -> GetGlobalDescription ()
215 <<
"\"\n is already in the end-of-run list of scene \""
221 fEndOfRunModelList.push_back (pModel);
232 os <<
"\n Run-duration model list:";
233 if (scene.fRunDurationModelList.size () == 0) {
236 for (i = 0; i < scene.fRunDurationModelList.size (); i++) {
237 if (scene.fRunDurationModelList[i].fActive) os <<
"\n Active: ";
238 else os <<
"\n Inactive: ";
239 os << *(scene.fRunDurationModelList[i].fpModel);
242 os <<
"\n End-of-event model list:";
243 if (scene.fEndOfEventModelList.size () == 0) {
246 for (i = 0; i < scene.fEndOfEventModelList.size (); i++) {
247 if (scene.fEndOfEventModelList[i].fActive) os <<
"\n Active: ";
248 else os <<
"\n Inactive: ";
249 os << *(scene.fEndOfEventModelList[i].fpModel);
252 os <<
"\n End-of-run model list:";
253 if (scene.fEndOfRunModelList.size () == 0) {
256 for (i = 0; i < scene.fEndOfRunModelList.size (); i++) {
257 if (scene.fEndOfRunModelList[i].fActive) os <<
"\n Active: ";
258 else os <<
"\n Inactive: ";
259 os << *(scene.fEndOfRunModelList[i].fpModel);
262 os <<
"\n Overall extent or bounding box: " << scene.fExtent;
264 os <<
"\n Standard target point: " << scene.fStandardTargetPoint;
266 os <<
"\n End of event action set to \"";
267 if (scene.fRefreshAtEndOfEvent) os <<
"refresh\"";
269 os <<
"accumulate (maximum number of kept events: ";
270 if (scene.fMaxNumberOfKeptEvents >= 0) os << scene.fMaxNumberOfKeptEvents;
271 else os <<
"unlimited";
275 os <<
"\n End of run action set to \"";
276 if (scene.fRefreshAtEndOfRun) os <<
"refresh";
277 else os <<
"accumulate";
285 (fRunDurationModelList.size () !=
286 scene.fRunDurationModelList.size ()) ||
287 (fEndOfEventModelList.size () !=
288 scene.fEndOfEventModelList.size ()) ||
289 (fEndOfRunModelList.size () !=
290 scene.fEndOfRunModelList.size ()) ||
291 (fExtent != scene.fExtent) ||
292 !(fStandardTargetPoint == scene.fStandardTargetPoint) ||
293 fRefreshAtEndOfEvent != scene.fRefreshAtEndOfEvent ||
294 fRefreshAtEndOfRun != scene.fRefreshAtEndOfRun ||
295 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)
void AccrueBoundingExtent(const G4VisExtent &)
const G4VisExtent & GetBoundingExtent() const
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
static const G4VisExtent & GetNullExtent()
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const