EGSnrc
EGSnrc copied to clipboard
tutor7pp error: Track 2026 has length -1717986918 < 2.Segmentation fault
Hello Everyone,
I´m new to EGSnrc and I´m trying to recreate the task of the "getting started"-PDF. In Chapter 5.4 "Generate particles tracks" there is a task where you simulate ptracks in an air box with an water cylinder in it (tutor7pp -i test2.egsinp -p 521icru). When I want to see the result in egs_view i get the error message: "Track 2025 has length 0 < 2.Track 2026 has length -1717986918 < 2.Segmentation fault". When I change the material of the air box to water instead it works properly. So does anyone has a clue why the ptrack-lenght is negative and how to fix it? The .egsinp-File is attached.
Greetings and thanks for help
Thank you for reporting this @Vitigis, we will try to reproduce this behaviour at our end!
Hi @Vitigis, it looks like the problem is that you have included two egs_track_scoring
ausgab objects. Even though they have different names this actually isn't supported. So they both tried to output to the same ptracks file and corrupted it. Just comment one out and you should find that it works!
Hi @rtownson, sorry to barge in on this issue. Is this the case for all ausgab objects or just tracks? Maybe we could add a check in EGS_Application::addAusgabObject
to catch this?
diff --git a/HEN_HOUSE/egs++/egs_application.cpp b/HEN_HOUSE/egs++/egs_application.cpp
index c4159c3d..bc840ef9 100644
--- a/HEN_HOUSE/egs++/egs_application.cpp
+++ b/HEN_HOUSE/egs++/egs_application.cpp
@@ -929,6 +929,12 @@ void EGS_Application::addAusgabObject(EGS_AusgabObject *o) {
if (!o) {
return;
}
+ for (int j=0; j<a_objects_list.size(); ++j) {
+ if (a_objects_list[j]->getObjectType() == o->getObjectType()) {
+ egsFatal("error: only one ausgab object of type '%s' is allowed\n",
+ o->getObjectType().c_str());
+ }
+ }
o->setApplication(this);
a_objects_list.add(o);
//int ncall = 1 + (int)AugerEvent;
@mxxo barge in any time! Actually this is only the case for EGS_trackScoring (I believe all other ausgab objects are allowed to have multiple and good reasons to do so), but you're right that we should add a catch. I don't see a reason to allow multiple ptrack files since there really aren't any important options that would make them different, other than particle type which you can already filter in egs_view. Would you like to submit a PR for it?
Sure thing, thanks Reid! :)