-
Notifications
You must be signed in to change notification settings - Fork 1
add support for G4Trap volumes #13
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
ed35d46 to
f91f8cc
Compare
f91f8cc to
5a712ad
Compare
Cpp-Linter Report
|
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
Only 20 out of 24 clang-format concerns fit within this pull request's diff.
Click here for the full clang-format patch
diff --git a/sysrap/sn.h b/sysrap/sn.h
index 8b74e4a..bcb1b18 100644
--- a/sysrap/sn.h
+++ b/sysrap/sn.h
@@ -453,3 +453,2 @@ struct SYSRAP_API sn
-
- static sn* Trapezoid(double z, double y, double x, double ltx);
- static sn* Cone(double r1, double z1, double r2, double z2);
+ static sn *Trapezoid(double z, double y, double x, double ltx);
+ static sn *Cone(double r1, double z1, double r2, double z2);
@@ -3104,2 +3102,0 @@ inline void sn::CutCylinderZRange(
-
-
@@ -3114 +3111 @@ inline void sn::CutCylinderZRange(
-inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
+inline sn *sn::Trapezoid(double z, double y, double x, double ltx)
@@ -3116,2 +3113,2 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
- assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x );
- sn* nd = Create(CSG_TRAPEZOID);
+ assert(x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x);
+ sn *nd = Create(CSG_TRAPEZOID);
@@ -3119 +3116 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
- nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
+ nd->setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z);
@@ -3123 +3120 @@ inline sn* sn::Trapezoid(double z, double y, double x, double ltx)
-inline sn* sn::Cone(double r1, double z1, double r2, double z2) // static
+inline sn *sn::Cone(double r1, double z1, double r2, double z2) // static
@@ -5230 +5227 @@ inline void sn::setAABB_LeafFrame()
- else if( typecode == CSG_TRAPEZOID )
+ else if (typecode == CSG_TRAPEZOID)
@@ -5234 +5231 @@ inline void sn::setAABB_LeafFrame()
- setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z);
+ setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z);
@@ -5236 +5233 @@ inline void sn::setAABB_LeafFrame()
- else if( typecode == CSG_DISC )
+ else if (typecode == CSG_DISC)
diff --git a/u4/U4Solid.h b/u4/U4Solid.h
index af4873e..0bddbaf 100644
--- a/u4/U4Solid.h
+++ b/u4/U4Solid.h
@@ -40,3 +39,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4Orb.hh"
-#include "G4Sphere.hh"
-#include "G4Ellipsoid.hh"
@@ -44,4 +40,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4Tubs.hh"
-#include "G4CutTubs.hh"
-#include "G4Trap.hh"
-#include "G4Polycone.hh"
@@ -48,0 +42,2 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4CutTubs.hh"
+#include "G4Ellipsoid.hh"
@@ -49,0 +45 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4IntersectionSolid.hh"
@@ -50,0 +47,4 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4Orb.hh"
+#include "G4Polycone.hh"
+#include "G4Sphere.hh"
+#include "G4SubtractionSolid.hh"
@@ -51,0 +52,2 @@ npy/NNodeUncoincide npy/NNodeNudger
+#include "G4Trap.hh"
+#include "G4Tubs.hh"
@@ -53,2 +54,0 @@ npy/NNodeUncoincide npy/NNodeNudger
-#include "G4IntersectionSolid.hh"
-#include "G4SubtractionSolid.hh"
@@ -92,2 +92,2 @@ struct U4Solid
- static constexpr const char* G4Trap_ = "Trp" ;
- static constexpr const char* G4Polycone_ = "Pol" ;
+ static constexpr const char *G4Trap_ = "Trp";
+ static constexpr const char *G4Polycone_ = "Pol";
@@ -290,2 +290,4 @@ inline int U4Solid::Type(const char* name) // static
- if( strcmp(name, "G4Trap") == 0 ) type = _G4Trap ;
- if( strcmp(name, "G4Polycone") == 0 ) type = _G4Polycone ;
+ if (strcmp(name, "G4Trap") == 0)
+ type = _G4Trap;
+ if (strcmp(name, "G4Polycone") == 0)
+ type = _G4Polycone;
@@ -314,2 +316,6 @@ inline const char* U4Solid::Tag(int type) // static
- case _G4Trap: tag = G4Trap_ ; break ;
- case _G4Polycone: tag = G4Polycone_ ; break ;
+ case _G4Trap:
+ tag = G4Trap_;
+ break;
+ case _G4Polycone:
+ tag = G4Polycone_;
+ break;
@@ -412,2 +418,6 @@ inline void U4Solid::init_Constituents()
- case _G4Trap : init_Trap() ; break ;
- case _G4Polycone : init_Polycone() ; break ;
+ case _G4Trap:
+ init_Trap();
+ break;
+ case _G4Polycone:
+ init_Polycone();
+ break;
@@ -879,3 +888,0 @@ inline void U4Solid::init_CutTubs()
-
-
-
@@ -884 +891 @@ inline void U4Solid::init_Trap()
- const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
+ const G4Trap *trap = dynamic_cast<const G4Trap *>(solid);
@@ -887,4 +894,4 @@ inline void U4Solid::init_Trap()
- double z = 2*trap->GetZHalfLength()/CLHEP::mm;
- double y = 2*trap->GetYHalfLength1()/CLHEP::mm;
- double x = 2*trap->GetXHalfLength1()/CLHEP::mm;
- double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm;
+ double z = 2 * trap->GetZHalfLength() / CLHEP::mm;
+ double y = 2 * trap->GetYHalfLength1() / CLHEP::mm;
+ double x = 2 * trap->GetXHalfLength1() / CLHEP::mm;
+ double ltx = 2 * trap->GetXHalfLength2() / CLHEP::mm;
@@ -895 +901,0 @@ inline void U4Solid::init_Trap()
-
Have any feedback or feature suggestions? Share it here.
|
|
||
| static sn* Trapezoid(double z, double y, double x, double ltx); | ||
| static sn* Cone(double r1, double z1, double r2, double z2); |
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.
clang-format suggestion
| static sn* Trapezoid(double z, double y, double x, double ltx); | |
| static sn* Cone(double r1, double z1, double r2, double z2); | |
| static sn *Trapezoid(double z, double y, double x, double ltx); | |
| static sn *Cone(double r1, double z1, double r2, double z2); |
|
|
||
|
|
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.
clang-format suggestion
Please remove the line(s)
- 3104
- 3105
| * https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomSolids.html#constructed-solid-geometry-csg-solids | ||
| * https://github.com/Geant4/geant4/blob/master/source/geometry/solids/CSG/include/G4Trap.hh | ||
| */ | ||
| inline sn* sn::Trapezoid(double z, double y, double x, double ltx) |
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.
clang-format suggestion
| inline sn* sn::Trapezoid(double z, double y, double x, double ltx) | |
| inline sn *sn::Trapezoid(double z, double y, double x, double ltx) |
| assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x ); | ||
| sn* nd = Create(CSG_TRAPEZOID); |
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.
clang-format suggestion
| assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x ); | |
| sn* nd = Create(CSG_TRAPEZOID); | |
| assert(x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x); | |
| sn *nd = Create(CSG_TRAPEZOID); |
| assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x ); | ||
| sn* nd = Create(CSG_TRAPEZOID); | ||
| nd->setPA(x, y, z, 0.f, ltx, 0.f); | ||
| nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z); |
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.
clang-format suggestion
| nd->setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z); | |
| nd->setBB(-0.5 * x, -0.5 * y, -0.5 * z, +0.5 * x, +0.5 * y, +0.5 * z); |
| case _G4Trap : init_Trap() ; break ; | ||
| case _G4Polycone : init_Polycone() ; break ; |
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.
clang-format suggestion
| case _G4Trap : init_Trap() ; break ; | |
| case _G4Polycone : init_Polycone() ; break ; | |
| case _G4Trap: | |
| init_Trap(); | |
| break; | |
| case _G4Polycone: | |
| init_Polycone(); | |
| break; |
|
|
||
|
|
||
|
|
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.
clang-format suggestion
Please remove the line(s)
- 879
- 880
- 881
|
|
||
| inline void U4Solid::init_Trap() | ||
| { | ||
| const G4Trap* trap = dynamic_cast<const G4Trap*>(solid); |
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.
clang-format suggestion
| const G4Trap* trap = dynamic_cast<const G4Trap*>(solid); | |
| const G4Trap *trap = dynamic_cast<const G4Trap *>(solid); |
| double z = 2*trap->GetZHalfLength()/CLHEP::mm; | ||
| double y = 2*trap->GetYHalfLength1()/CLHEP::mm; | ||
| double x = 2*trap->GetXHalfLength1()/CLHEP::mm; | ||
| double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm; |
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.
clang-format suggestion
| double z = 2*trap->GetZHalfLength()/CLHEP::mm; | |
| double y = 2*trap->GetYHalfLength1()/CLHEP::mm; | |
| double x = 2*trap->GetXHalfLength1()/CLHEP::mm; | |
| double ltx = 2*trap->GetXHalfLength2()/CLHEP::mm; | |
| double z = 2 * trap->GetZHalfLength() / CLHEP::mm; | |
| double y = 2 * trap->GetYHalfLength1() / CLHEP::mm; | |
| double x = 2 * trap->GetXHalfLength1() / CLHEP::mm; | |
| double ltx = 2 * trap->GetXHalfLength2() / CLHEP::mm; |
| root = sn::Trapezoid(z, y, x, ltx); | ||
| } | ||
|
|
||
|
|
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.
clang-format suggestion
Please remove the line(s)
- 895
Uh oh!
There was an error while loading. Please reload this page.