Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions sysrap/sn.h
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
Expand Down Expand Up @@ -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);
Comment on lines +453 to 455
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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);

static sn* Sphere(double radius);
static sn* ZSphere(double radius, double z1, double z2);
Expand Down Expand Up @@ -2948,6 +2950,7 @@
}

/**

sn::CutCylinder
----------------

Expand Down Expand Up @@ -3100,6 +3103,23 @@



Comment on lines 3104 to 3105
Copy link
Contributor

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

/**
* 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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);
Comment on lines +3116 to +3117
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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);

return nd;
}

inline sn* sn::Cone(double r1, double z1, double r2, double z2) // static
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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

{
assert( z2 > z1 );
Expand Down Expand Up @@ -5207,6 +5227,12 @@

setBB( -R, -R, zmin, +R, +R, zmax );
}
else if( typecode == CSG_TRAPEZOID )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
else if( typecode == CSG_TRAPEZOID )
else if (typecode == CSG_TRAPEZOID)

{
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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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);

}
else if( typecode == CSG_DISC )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
else if( typecode == CSG_DISC )
else if (typecode == CSG_DISC)

{
double px, py, ir, r, z1, z2 ;
Expand Down
21 changes: 21 additions & 0 deletions u4/U4Solid.h
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
Expand Down Expand Up @@ -43,6 +43,7 @@
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4CutTubs.hh"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
#include "G4CutTubs.hh"
#include "G4IntersectionSolid.hh"

#include "G4Trap.hh"
#include "G4Polycone.hh"
Comment on lines 44 to 47
Copy link
Contributor

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)

  • 44
  • 45
  • 46
  • 47

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
#include "G4Polycone.hh"
#include "G4Orb.hh"
#include "G4Polycone.hh"
#include "G4Sphere.hh"
#include "G4SubtractionSolid.hh"

#include "G4Cons.hh"
#include "G4Hype.hh"
Expand All @@ -68,6 +69,7 @@
_G4Ellipsoid,
_G4Box,
_G4Tubs,
_G4Trap,
_G4Polycone,
_G4Cons,
_G4Hype,
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
static constexpr const char* G4Trap_ = "Trp" ;
static constexpr const char* G4Polycone_ = "Pol" ;
static constexpr const char *G4Trap_ = "Trp";
static constexpr const char *G4Polycone_ = "Pol";

static constexpr const char* G4Cons_ = "Con" ;
static constexpr const char* G4Hype_ = "Hyp" ;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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;

if( strcmp(name, "G4Cons") == 0 ) type = _G4Cons ;
if( strcmp(name, "G4Hype") == 0 ) type = _G4Hype ;
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
case _G4Trap: tag = G4Trap_ ; break ;
case _G4Polycone: tag = G4Polycone_ ; break ;
case _G4Trap:
tag = G4Trap_;
break;
case _G4Polycone:
tag = G4Polycone_;
break;

case _G4Cons: tag = G4Cons_ ; break ;
case _G4Hype: tag = G4Hype_ ; break ;
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
case _G4Trap : init_Trap() ; break ;
case _G4Polycone : init_Polycone() ; break ;
case _G4Trap:
init_Trap();
break;
case _G4Polycone:
init_Polycone();
break;

case _G4Cons : init_Cons() ; break ;
case _G4Hype : init_Hype() ; break ;
Expand Down Expand Up @@ -872,6 +879,20 @@



Comment on lines 879 to 881
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
const G4Trap *trap = dynamic_cast<const G4Trap *>(solid);

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-format suggestion

Suggested change
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);
}


Copy link
Contributor

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

inline void U4Solid::init_Polycone()
{
const G4Polycone* polycone = dynamic_cast<const G4Polycone*>(solid);
Expand Down
Loading