Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tutor7pp error: Track 2026 has length -1717986918 < 2.Segmentation fault #745

Open
Vitigis opened this issue Jul 6, 2021 · 5 comments
Open
Assignees
Labels
Milestone

Comments

@Vitigis
Copy link

Vitigis commented Jul 6, 2021

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

test2.txt

@ftessier
Copy link
Member

ftessier commented Jul 6, 2021

Thank you for reporting this @Vitigis, we will try to reproduce this behaviour at our end!

@rtownson
Copy link
Collaborator

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!

@mxxo
Copy link
Contributor

mxxo commented Jul 15, 2021

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;

@rtownson rtownson reopened this Jul 15, 2021
@rtownson
Copy link
Collaborator

@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?

@mxxo
Copy link
Contributor

mxxo commented Jul 15, 2021

Sure thing, thanks Reid! :)

mxxo added a commit to mxxo/EGSnrc that referenced this issue Jul 15, 2021
As discussed in nrc-cnrc#745, ensure
that multiple EGS_TrackScoring objects are not defined as this can
lead to bugs at write time when the objects try to write to the same
file.
@rtownson rtownson added bug and removed invalid labels Jul 15, 2021
ftessier pushed a commit to mxxo/EGSnrc that referenced this issue Jun 30, 2022
As discussed in issue nrc-cnrc#745 ensure that one EGS_TrackScoring object is
define to prevent bugs at write time when multiple objects try to write
to the same file.
ftessier pushed a commit that referenced this issue Jun 30, 2022
As discussed in issue #745 ensure that one EGS_TrackScoring object is
define to prevent bugs at write time when multiple objects try to write
to the same file.
@ftessier ftessier modified the milestones: Release 2023, Release 2024 Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants