-
Notifications
You must be signed in to change notification settings - Fork 2
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,3 @@ | ||||||||||
| #pragma once | ||||||||||
| /** | ||||||||||
| sn.h : minimal pointer based transient binary tree node | ||||||||||
|
|
@@ -450,6 +450,8 @@ | |||||||||
| double nz_nrm_z | ||||||||||
| ); | ||||||||||
|
|
||||||||||
|
|
||||||||||
| static sn* Trapezoid(double z, double y, double x, double ltx); | ||||||||||
| static sn* Cone(double r1, double z1, double r2, double z2); | ||||||||||
| static sn* Sphere(double radius); | ||||||||||
| static sn* ZSphere(double radius, double z1, double z2); | ||||||||||
|
|
@@ -2948,6 +2950,7 @@ | |||||||||
| } | ||||||||||
|
|
||||||||||
| /** | ||||||||||
|
|
||||||||||
| sn::CutCylinder | ||||||||||
| ---------------- | ||||||||||
|
|
||||||||||
|
|
@@ -3100,6 +3103,23 @@ | |||||||||
|
|
||||||||||
|
|
||||||||||
|
|
||||||||||
|
Comment on lines
3104
to
3105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestionPlease remove the line(s)
|
||||||||||
| /** | ||||||||||
| * Support right angular wedge from STEP. | ||||||||||
| * | ||||||||||
| * References: | ||||||||||
| * | ||||||||||
| * 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) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| { | ||||||||||
| assert( x > 0 && y > 0 && z > 0 && ltx > 0 && ltx < x ); | ||||||||||
| sn* nd = Create(CSG_TRAPEZOID); | ||||||||||
|
Comment on lines
+3116
to
+3117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| 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); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| return nd; | ||||||||||
| } | ||||||||||
|
|
||||||||||
| inline sn* sn::Cone(double r1, double z1, double r2, double z2) // static | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| { | ||||||||||
| assert( z2 > z1 ); | ||||||||||
|
|
@@ -5207,6 +5227,12 @@ | |||||||||
|
|
||||||||||
| setBB( -R, -R, zmin, +R, +R, zmax ); | ||||||||||
| } | ||||||||||
| else if( typecode == CSG_TRAPEZOID ) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| { | ||||||||||
| double x, y, z, unused1, ltx, unused2; | ||||||||||
| getParam_(x, y, z, unused1, ltx, unused2); | ||||||||||
| setBB(-0.5*x, -0.5*y, -0.5*z, +0.5*x, +0.5*y, +0.5*z); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| } | ||||||||||
| else if( typecode == CSG_DISC ) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||
| { | ||||||||||
| double px, py, ir, r, z1, z2 ; | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,3 @@ | ||||||||||||||||||
| #pragma once | ||||||||||||||||||
| /** | ||||||||||||||||||
| U4Solid.h : Convert G4VSolid CSG trees into sn.h trees | ||||||||||||||||||
|
|
@@ -43,6 +43,7 @@ | |||||||||||||||||
| #include "G4Box.hh" | ||||||||||||||||||
| #include "G4Tubs.hh" | ||||||||||||||||||
| #include "G4CutTubs.hh" | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| #include "G4Trap.hh" | ||||||||||||||||||
| #include "G4Polycone.hh" | ||||||||||||||||||
|
Comment on lines
44
to
47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestionPlease remove the line(s)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| #include "G4Cons.hh" | ||||||||||||||||||
| #include "G4Hype.hh" | ||||||||||||||||||
|
|
@@ -68,6 +69,7 @@ | |||||||||||||||||
| _G4Ellipsoid, | ||||||||||||||||||
| _G4Box, | ||||||||||||||||||
| _G4Tubs, | ||||||||||||||||||
| _G4Trap, | ||||||||||||||||||
| _G4Polycone, | ||||||||||||||||||
| _G4Cons, | ||||||||||||||||||
| _G4Hype, | ||||||||||||||||||
|
|
@@ -87,6 +89,7 @@ | |||||||||||||||||
| static constexpr const char* G4Ellipsoid_ = "Ell" ; | ||||||||||||||||||
| static constexpr const char* G4Box_ = "Box" ; | ||||||||||||||||||
| static constexpr const char* G4Tubs_ = "Tub" ; | ||||||||||||||||||
| static constexpr const char* G4Trap_ = "Trp" ; | ||||||||||||||||||
| static constexpr const char* G4Polycone_ = "Pol" ; | ||||||||||||||||||
|
Comment on lines
+92
to
93
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| static constexpr const char* G4Cons_ = "Con" ; | ||||||||||||||||||
| static constexpr const char* G4Hype_ = "Hyp" ; | ||||||||||||||||||
|
|
@@ -135,6 +138,7 @@ | |||||||||||||||||
| void init_Ellipsoid(); | ||||||||||||||||||
| void init_Box(); | ||||||||||||||||||
| void init_Tubs(); | ||||||||||||||||||
| void init_Trap(); | ||||||||||||||||||
| void init_Polycone(); | ||||||||||||||||||
| void init_Cons(); | ||||||||||||||||||
| void init_Hype(); | ||||||||||||||||||
|
|
@@ -283,6 +287,7 @@ | |||||||||||||||||
| if( strcmp(name, "G4Ellipsoid") == 0 ) type = _G4Ellipsoid ; | ||||||||||||||||||
| if( strcmp(name, "G4Box") == 0 ) type = _G4Box ; | ||||||||||||||||||
| if( strcmp(name, "G4Tubs") == 0 ) type = _G4Tubs ; | ||||||||||||||||||
| if( strcmp(name, "G4Trap") == 0 ) type = _G4Trap ; | ||||||||||||||||||
| if( strcmp(name, "G4Polycone") == 0 ) type = _G4Polycone ; | ||||||||||||||||||
|
Comment on lines
+290
to
291
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| if( strcmp(name, "G4Cons") == 0 ) type = _G4Cons ; | ||||||||||||||||||
| if( strcmp(name, "G4Hype") == 0 ) type = _G4Hype ; | ||||||||||||||||||
|
|
@@ -306,6 +311,7 @@ | |||||||||||||||||
| case _G4Ellipsoid: tag = G4Ellipsoid_ ; break ; | ||||||||||||||||||
| case _G4Box: tag = G4Box_ ; break ; | ||||||||||||||||||
| case _G4Tubs: tag = G4Tubs_ ; break ; | ||||||||||||||||||
| case _G4Trap: tag = G4Trap_ ; break ; | ||||||||||||||||||
| case _G4Polycone: tag = G4Polycone_ ; break ; | ||||||||||||||||||
|
Comment on lines
+314
to
315
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| case _G4Cons: tag = G4Cons_ ; break ; | ||||||||||||||||||
| case _G4Hype: tag = G4Hype_ ; break ; | ||||||||||||||||||
|
|
@@ -403,6 +409,7 @@ | |||||||||||||||||
| case _G4Ellipsoid : init_Ellipsoid() ; break ; | ||||||||||||||||||
| case _G4Box : init_Box() ; break ; | ||||||||||||||||||
| case _G4Tubs : init_Tubs() ; break ; | ||||||||||||||||||
| case _G4Trap : init_Trap() ; break ; | ||||||||||||||||||
| case _G4Polycone : init_Polycone() ; break ; | ||||||||||||||||||
|
Comment on lines
+412
to
413
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| case _G4Cons : init_Cons() ; break ; | ||||||||||||||||||
| case _G4Hype : init_Hype() ; break ; | ||||||||||||||||||
|
|
@@ -872,6 +879,20 @@ | |||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
|
Comment on lines
879
to
881
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestionPlease remove the line(s)
|
||||||||||||||||||
| inline void U4Solid::init_Trap() | ||||||||||||||||||
| { | ||||||||||||||||||
| const G4Trap* trap = dynamic_cast<const G4Trap*>(solid); | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
| assert(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; | ||||||||||||||||||
|
Comment on lines
+887
to
+890
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestion
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| root = sn::Trapezoid(z, y, x, ltx); | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-format suggestionPlease remove the line(s)
|
||||||||||||||||||
| inline void U4Solid::init_Polycone() | ||||||||||||||||||
| { | ||||||||||||||||||
| const G4Polycone* polycone = dynamic_cast<const G4Polycone*>(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