-
Notifications
You must be signed in to change notification settings - Fork 1
Safeguard for Opticks binary tree size #141
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
base: main
Are you sure you want to change the base?
Conversation
Stop Opticks geometry read-in if geometry size blows up. Warn user and suggest solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-format v16.0.6
Click here for the full clang-format patch
diff --git a/CSG/CSGImport.cc b/CSG/CSGImport.cc
index bad78b6..eeeed9a 100644
--- a/CSG/CSGImport.cc
+++ b/CSG/CSGImport.cc
@@ -311 +311 @@ CSGPrim* CSGImport::importPrim(int primIdx, const snode& node )
-
+
@@ -313,2 +313,5 @@ CSGPrim* CSGImport::importPrim(int primIdx, const snode& node )
- {
- std::cerr << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested subtraction/union solid that Opticks turns into a full binary tree. Check your geometry as described in: https://github.com/BNLNPPS/esi-g4ox/issues/127" << std::endl;
+ {
+ std::cerr << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested "
+ "subtraction/union solid that Opticks turns into a full binary tree. Check your geometry as "
+ "described in: https://github.com/BNLNPPS/esi-g4ox/issues/127"
+ << std::endl;
@@ -316 +319 @@ CSGPrim* CSGImport::importPrim(int primIdx, const snode& node )
- }
+ }
Have any feedback or feature suggestions? Share it here.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-format v16.0.6
Click here for the full clang-format patch
diff --git a/CSG/CSGImport.cc b/CSG/CSGImport.cc
index 7015a7e..6c75da1 100644
--- a/CSG/CSGImport.cc
+++ b/CSG/CSGImport.cc
@@ -311,7 +311,7 @@ CSGPrim* CSGImport::importPrim(int primIdx, const snode& node )
-
- if (bn > 100000) // Check if binary tree blows up and warn user
- LOG(WARNING) << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested "
- "subtraction/union solid that Opticks turns into a full binary tree. Check your geometry as "
- "described in: https://github.com/BNLNPPS/esi-g4ox/issues/127";
-
- // 2. count total subs for any listnodes of this lvid
+
+ if (bn > 100000) // Check if binary tree blows up and warn user
+ LOG(WARNING) << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested "
+ "subtraction/union solid that Opticks turns into a full binary tree. Check your geometry as "
+ "described in: https://github.com/BNLNPPS/esi-g4ox/issues/127";
+
+ // 2. count total subs for any listnodes of this lvid
Have any feedback or feature suggestions? Share it here.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
CSG/CSGImport.cc
Outdated
| if (bn > 100000) // Check if binary tree blows up and warn user | ||
| { | ||
| std::cerr << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested " | ||
| LOG(WARNING) << "Too many nodes in binary tree (more than a 100 000) built by Opticks. Likely a nested " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s actually lowercase ‘warning’. you shouldn’t have trusted me on that.
|
@plexoos is there anything else needed to merge this feature? |
|
It’s probably a stretch to call this a feature :) but if you’d like to include the warning with the hard-coded condition on the number of volumes, let’s go ahead and merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-format v18.1.3
Click here for the full clang-format patch
diff --git a/CSG/CSGImport.cc b/CSG/CSGImport.cc
index aeca179..38acdde 100644
--- a/CSG/CSGImport.cc
+++ b/CSG/CSGImport.cc
@@ -320,3 +320,3 @@ CSGPrim* CSGImport::importPrim(int primIdx, const snode& node )
- std::vector<const sn*> lns ;
- sn::GetLVListnodes( lns, lvid );
- int num_sub_total = sn::GetChildTotal( lns );
+ std::vector<const sn *> lns;
+ sn::GetLVListnodes(lns, lvid);
+ int num_sub_total = sn::GetChildTotal(lns);
Have any feedback or feature suggestions? Share it here.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
@plexoos please review the change (had to move one space due to clang) |
Stop Opticks geometry read-in if binary tree size blows up. Warn user and suggest solution.
Solves #77
Test:
./build/src/simg4ox -g dune_forward_geometry_2025_april_replaced_elliptical_tubes.gdml -m esi-g4ox/run.mac
Exits with error as expected:
Fixed DUNE geometry works fine, no exit:
./build/src/simg4ox -g duneforwarddetector3.gdml -m esi-g4ox/run.mac