Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields | Protected Member Functions
G4TwistTubsFlatSide Class Reference

#include <G4TwistTubsFlatSide.hh>

Inheritance diagram for G4TwistTubsFlatSide:
G4VTwistSurface

Public Member Functions

 G4TwistTubsFlatSide (const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, const G4ThreeVector &n, const EAxis axis1=kRho, const EAxis axis2=kPhi, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
 
 G4TwistTubsFlatSide (const G4String &name, G4double EndInnerRadius[2], G4double EndOuterRadius[2], G4double DPhi, G4double EndPhi[2], G4double EndZ[2], G4int handedness)
 
virtual ~G4TwistTubsFlatSide ()
 
virtual G4ThreeVector GetNormal (const G4ThreeVector &, G4bool isGlobal=false)
 
virtual G4int DistanceToSurface (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol)
 
virtual G4int DistanceToSurface (const G4ThreeVector &gp, G4ThreeVector gxx[], G4double distance[], G4int areacode[])
 
virtual G4ThreeVector SurfacePoint (G4double, G4double, G4bool isGlobal=false)
 
virtual G4double GetBoundaryMin (G4double phi)
 
virtual G4double GetBoundaryMax (G4double phi)
 
virtual G4double GetSurfaceArea ()
 
virtual void GetFacets (G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)
 
 G4TwistTubsFlatSide (__void__ &)
 
- Public Member Functions inherited from G4VTwistSurface
 G4VTwistSurface (const G4String &name)
 
 G4VTwistSurface (const G4String &name, const G4RotationMatrix &rot, const G4ThreeVector &tlate, G4int handedness, const EAxis axis1, const EAxis axis2, G4double axis0min=-kInfinity, G4double axis1min=-kInfinity, G4double axis0max=kInfinity, G4double axis1max=kInfinity)
 
virtual ~G4VTwistSurface ()
 
virtual G4int AmIOnLeftSide (const G4ThreeVector &me, const G4ThreeVector &vec, G4bool withTol=true)
 
virtual G4double DistanceToBoundary (G4int areacode, G4ThreeVector &xx, const G4ThreeVector &p)
 
virtual G4double DistanceToIn (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
 
virtual G4double DistanceToOut (const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
 
virtual G4double DistanceTo (const G4ThreeVector &gp, G4ThreeVector &gxx)
 
void DebugPrint () const
 
virtual G4String GetName () const
 
virtual void GetBoundaryParameters (const G4int &areacode, G4ThreeVector &d, G4ThreeVector &x0, G4int &boundarytype) const
 
virtual G4ThreeVector GetBoundaryAtPZ (G4int areacode, const G4ThreeVector &p) const
 
G4double DistanceToPlaneWithV (const G4ThreeVector &p, const G4ThreeVector &v, const G4ThreeVector &x0, const G4ThreeVector &n0, G4ThreeVector &xx)
 
G4double DistanceToPlane (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &n0, G4ThreeVector &xx)
 
G4double DistanceToPlane (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &t1, const G4ThreeVector &t2, G4ThreeVector &xx, G4ThreeVector &n)
 
G4double DistanceToLine (const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &d, G4ThreeVector &xx)
 
G4bool IsAxis0 (G4int areacode) const
 
G4bool IsAxis1 (G4int areacode) const
 
G4bool IsOutside (G4int areacode) const
 
G4bool IsInside (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsBoundary (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsCorner (G4int areacode, G4bool testbitmode=false) const
 
G4bool IsValidNorm () const
 
G4bool IsSameBoundary (G4VTwistSurface *surface1, G4int areacode1, G4VTwistSurface *surface2, G4int areacode2) const
 
G4int GetAxisType (G4int areacode, G4int whichaxis) const
 
G4ThreeVector ComputeGlobalPoint (const G4ThreeVector &lp) const
 
G4ThreeVector ComputeLocalPoint (const G4ThreeVector &gp) const
 
G4ThreeVector ComputeGlobalDirection (const G4ThreeVector &lp) const
 
G4ThreeVector ComputeLocalDirection (const G4ThreeVector &gp) const
 
void SetAxis (G4int i, const EAxis axis)
 
void SetNeighbours (G4VTwistSurface *axis0min, G4VTwistSurface *axis1min, G4VTwistSurface *axis0max, G4VTwistSurface *axis1max)
 
G4int GetNode (G4int i, G4int j, G4int m, G4int n, G4int iside)
 
G4int GetFace (G4int i, G4int j, G4int m, G4int n, G4int iside)
 
G4int GetEdgeVisibility (G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)
 
 G4VTwistSurface (__void__ &)
 

Data Fields

G4double fSurfaceArea
 

Protected Member Functions

virtual G4int GetAreaCode (const G4ThreeVector &xx, G4bool withTol=true)
 
- Protected Member Functions inherited from G4VTwistSurface
G4VTwistSurface ** GetNeighbours ()
 
G4int GetNeighbours (G4int areacode, G4VTwistSurface *surfaces[])
 
G4ThreeVector GetCorner (G4int areacode) const
 
void GetBoundaryAxis (G4int areacode, EAxis axis[]) const
 
void GetBoundaryLimit (G4int areacode, G4double limit[]) const
 
virtual void SetBoundary (const G4int &axiscode, const G4ThreeVector &direction, const G4ThreeVector &x0, const G4int &boundarytype)
 
void SetCorner (G4int areacode, G4double x, G4double y, G4double z)
 

Additional Inherited Members

- Public Types inherited from G4VTwistSurface
enum  EValidate { kDontValidate = 0, kValidateWithTol = 1, kValidateWithoutTol = 2, kUninitialized = 3 }
 
- Static Public Attributes inherited from G4VTwistSurface
static const G4int sOutside = 0x00000000
 
static const G4int sInside = 0x10000000
 
static const G4int sBoundary = 0x20000000
 
static const G4int sCorner = 0x40000000
 
static const G4int sC0Min1Min = 0x40000101
 
static const G4int sC0Max1Min = 0x40000201
 
static const G4int sC0Max1Max = 0x40000202
 
static const G4int sC0Min1Max = 0x40000102
 
static const G4int sAxisMin = 0x00000101
 
static const G4int sAxisMax = 0x00000202
 
static const G4int sAxisX = 0x00000404
 
static const G4int sAxisY = 0x00000808
 
static const G4int sAxisZ = 0x00000C0C
 
static const G4int sAxisRho = 0x00001010
 
static const G4int sAxisPhi = 0x00001414
 
static const G4int sAxis0 = 0x0000FF00
 
static const G4int sAxis1 = 0x000000FF
 
static const G4int sSizeMask = 0x00000303
 
static const G4int sAxisMask = 0x0000FCFC
 
static const G4int sAreaMask = 0XF0000000
 
- Protected Attributes inherited from G4VTwistSurface
EAxis fAxis [2]
 
G4double fAxisMin [2]
 
G4double fAxisMax [2]
 
CurrentStatus fCurStatWithV
 
CurrentStatus fCurStat
 
G4RotationMatrix fRot
 
G4ThreeVector fTrans
 
G4int fHandedness
 
G4SurfCurNormal fCurrentNormal
 
G4bool fIsValidNorm
 
G4double kCarTolerance
 

Detailed Description

Definition at line 52 of file G4TwistTubsFlatSide.hh.

Constructor & Destructor Documentation

G4TwistTubsFlatSide::G4TwistTubsFlatSide ( const G4String name,
const G4RotationMatrix rot,
const G4ThreeVector tlate,
const G4ThreeVector n,
const EAxis  axis1 = kRho,
const EAxis  axis2 = kPhi,
G4double  axis0min = -kInfinity,
G4double  axis1min = -kInfinity,
G4double  axis0max = kInfinity,
G4double  axis1max = kInfinity 
)

Definition at line 50 of file G4TwistTubsFlatSide.cc.

References FatalErrorInArgument, G4VTwistSurface::fCurrentNormal, G4VTwistSurface::fIsValidNorm, fSurfaceArea, G4Exception(), CLHEP::HepRotation::inverse(), kPhi, kRho, n, G4VTwistSurface::G4SurfCurNormal::normal, and CLHEP::Hep3Vector::unit().

60  : G4VTwistSurface(name, rot, tlate, 0, axis0, axis1,
61  axis0min, axis1min, axis0max, axis1max)
62 {
63  if (axis0 == kPhi && axis1 == kRho) {
64  G4Exception("G4TwistTubsFlatSide::G4TwistTubsFlatSide()",
65  "GeomSolids0002", FatalErrorInArgument,
66  "Should swap axis0 and axis1!");
67  }
68 
69  G4ThreeVector normal = rot.inverse()*n;
70  fCurrentNormal.normal = normal.unit(); // in local coordinate system
71  fIsValidNorm = true;
72 
73  SetCorners();
74  SetBoundaries();
75 
76  fSurfaceArea = 1 ; // not yet implemented. This is NOT a problem for tracking
77 
78 }
Definition: geomdefs.hh:54
G4SurfCurNormal fCurrentNormal
HepRotation inverse() const
const G4int n
G4VTwistSurface(const G4String &name)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Hep3Vector unit() const
Definition: geomdefs.hh:54
G4TwistTubsFlatSide::G4TwistTubsFlatSide ( const G4String name,
G4double  EndInnerRadius[2],
G4double  EndOuterRadius[2],
G4double  DPhi,
G4double  EndPhi[2],
G4double  EndZ[2],
G4int  handedness 
)

Definition at line 82 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::fAxis, G4VTwistSurface::fAxisMax, G4VTwistSurface::fAxisMin, G4VTwistSurface::fCurrentNormal, G4VTwistSurface::fHandedness, G4VTwistSurface::fIsValidNorm, G4VTwistSurface::fRot, fSurfaceArea, G4VTwistSurface::fTrans, kPhi, kRho, G4VTwistSurface::G4SurfCurNormal::normal, CLHEP::HepRotation::rotateZ(), and CLHEP::Hep3Vector::set().

89  : G4VTwistSurface(name)
90 {
91  fHandedness = handedness; // +z = +ve, -z = -ve
92  fAxis[0] = kRho; // in local coordinate system
93  fAxis[1] = kPhi;
94  G4int i = (handedness < 0 ? 0 : 1);
95  fAxisMin[0] = EndInnerRadius[i]; // Inner-hype radius at z=0
96  fAxisMax[0] = EndOuterRadius[i]; // Outer-hype radius at z=0
97  fAxisMin[1] = -0.5*DPhi;
98  fAxisMax[1] = -fAxisMin[1];
99  fCurrentNormal.normal.set(0, 0, (fHandedness < 0 ? -1 : 1));
100  // Unit vector, in local coordinate system
101  fRot.rotateZ(EndPhi[i]);
102  fTrans.set(0, 0, EndZ[i]);
103  fIsValidNorm = true;
104 
105  SetCorners();
106  SetBoundaries();
107 
108  fSurfaceArea = 0.5*DPhi * (EndOuterRadius[i]*EndOuterRadius[i]
109  - EndInnerRadius[i]*EndInnerRadius[i] ) ;
110 
111 }
void set(double x, double y, double z)
Definition: geomdefs.hh:54
G4SurfCurNormal fCurrentNormal
G4double fAxisMax[2]
int G4int
Definition: G4Types.hh:78
G4RotationMatrix fRot
G4ThreeVector fTrans
G4double fAxisMin[2]
G4VTwistSurface(const G4String &name)
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
Definition: geomdefs.hh:54
G4TwistTubsFlatSide::~G4TwistTubsFlatSide ( )
virtual

Definition at line 126 of file G4TwistTubsFlatSide.cc.

127 {
128 }
G4TwistTubsFlatSide::G4TwistTubsFlatSide ( __void__ &  a)

Definition at line 117 of file G4TwistTubsFlatSide.cc.

119 {
120 }
G4VTwistSurface(const G4String &name)

Member Function Documentation

G4int G4TwistTubsFlatSide::DistanceToSurface ( const G4ThreeVector gp,
const G4ThreeVector gv,
G4ThreeVector  gxx[],
G4double  distance[],
G4int  areacode[],
G4bool  isvalid[],
EValidate  validate = kValidateWithTol 
)
virtual

Implements G4VTwistSurface.

Definition at line 146 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::ComputeGlobalPoint(), G4VTwistSurface::ComputeLocalDirection(), G4VTwistSurface::ComputeLocalPoint(), G4VTwistSurface::fCurStatWithV, G4cerr, G4endl, GetAreaCode(), G4VTwistSurface::CurrentStatus::GetAreacode(), G4VTwistSurface::CurrentStatus::GetDistance(), G4VTwistSurface::GetName(), G4VTwistSurface::CurrentStatus::GetNXX(), G4VTwistSurface::CurrentStatus::GetXX(), G4VTwistSurface::CurrentStatus::IsDone(), G4VTwistSurface::IsInside(), G4VTwistSurface::IsOutside(), G4VTwistSurface::CurrentStatus::IsValid(), G4VTwistSurface::kValidateWithoutTol, G4VTwistSurface::kValidateWithTol, G4VTwistSurface::CurrentStatus::ResetfDone(), CLHEP::Hep3Vector::set(), G4VTwistSurface::CurrentStatus::SetCurrentStatus(), G4VTwistSurface::sInside, G4VTwistSurface::sOutside, test::v, and CLHEP::Hep3Vector::z().

153 {
154  fCurStatWithV.ResetfDone(validate, &gp, &gv);
155 
156  if (fCurStatWithV.IsDone()) {
157  G4int i;
158  for (i=0; i<fCurStatWithV.GetNXX(); i++) {
159  gxx[i] = fCurStatWithV.GetXX(i);
160  distance[i] = fCurStatWithV.GetDistance(i);
161  areacode[i] = fCurStatWithV.GetAreacode(i);
162  isvalid[i] = fCurStatWithV.IsValid(i);
163  }
164  return fCurStatWithV.GetNXX();
165  } else {
166  // initialize
167  G4int i;
168  for (i=0; i<2; i++) {
169  distance[i] = kInfinity;
170  areacode[i] = sOutside;
171  isvalid[i] = false;
172  gxx[i].set(kInfinity, kInfinity, kInfinity);
173  }
174  }
175 
178 
179  //
180  // special case!
181  // if p is on surface, distance = 0.
182  //
183 
184  if (std::fabs(p.z()) == 0.) { // if p is on the plane
185  distance[0] = 0;
186  G4ThreeVector xx = p;
187  gxx[0] = ComputeGlobalPoint(xx);
188 
189  if (validate == kValidateWithTol) {
190  areacode[0] = GetAreaCode(xx);
191  if (!IsOutside(areacode[0])) {
192  isvalid[0] = true;
193  }
194  } else if (validate == kValidateWithoutTol) {
195  areacode[0] = GetAreaCode(xx, false);
196  if (IsInside(areacode[0])) {
197  isvalid[0] = true;
198  }
199  } else { // kDontValidate
200  areacode[0] = sInside;
201  isvalid[0] = true;
202  }
203 
204  return 1;
205  }
206  //
207  // special case end
208  //
209 
210  if (v.z() == 0) {
211 
212  fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
213  isvalid[0], 0, validate, &gp, &gv);
214  return 0;
215  }
216 
217  distance[0] = - (p.z() / v.z());
218 
219  G4ThreeVector xx = p + distance[0]*v;
220  gxx[0] = ComputeGlobalPoint(xx);
221 
222  if (validate == kValidateWithTol) {
223  areacode[0] = GetAreaCode(xx);
224  if (!IsOutside(areacode[0])) {
225  if (distance[0] >= 0) isvalid[0] = true;
226  }
227  } else if (validate == kValidateWithoutTol) {
228  areacode[0] = GetAreaCode(xx, false);
229  if (IsInside(areacode[0])) {
230  if (distance[0] >= 0) isvalid[0] = true;
231  }
232  } else { // kDontValidate
233  areacode[0] = sInside;
234  if (distance[0] >= 0) isvalid[0] = true;
235  }
236 
237  fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
238  isvalid[0], 1, validate, &gp, &gv);
239 
240 #ifdef G4TWISTDEBUG
241  G4cerr << "ERROR - G4TwistTubsFlatSide::DistanceToSurface(p,v)" << G4endl;
242  G4cerr << " Name : " << GetName() << G4endl;
243  G4cerr << " xx : " << xx << G4endl;
244  G4cerr << " gxx[0] : " << gxx[0] << G4endl;
245  G4cerr << " dist[0] : " << distance[0] << G4endl;
246  G4cerr << " areacode[0] : " << areacode[0] << G4endl;
247  G4cerr << " isvalid[0] : " << isvalid[0] << G4endl;
248 #endif
249  return 1;
250 }
void set(double x, double y, double z)
G4int GetAreacode(G4int i) const
G4ThreeVector ComputeLocalDirection(const G4ThreeVector &gp) const
const char * p
Definition: xmltok.h:285
static const G4int sOutside
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const
int G4int
Definition: G4Types.hh:78
double z() const
G4bool IsOutside(G4int areacode) const
G4double GetDistance(G4int i) const
void SetCurrentStatus(G4int i, G4ThreeVector &xx, G4double &dist, G4int &areacode, G4bool &isvalid, G4int nxx, EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
G4bool IsValid(G4int i) const
G4bool IsInside(G4int areacode, G4bool testbitmode=false) const
virtual G4int GetAreaCode(const G4ThreeVector &xx, G4bool withTol=true)
static const G4int sInside
G4ThreeVector GetXX(G4int i) const
virtual G4String GetName() const
#define G4endl
Definition: G4ios.hh:61
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &gp) const
CurrentStatus fCurStatWithV
G4GLOB_DLL std::ostream G4cerr
void ResetfDone(EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
G4int G4TwistTubsFlatSide::DistanceToSurface ( const G4ThreeVector gp,
G4ThreeVector  gxx[],
G4double  distance[],
G4int  areacode[] 
)
virtual

Implements G4VTwistSurface.

Definition at line 255 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::ComputeGlobalPoint(), G4VTwistSurface::ComputeLocalPoint(), G4VTwistSurface::fCurStat, G4VTwistSurface::CurrentStatus::GetAreacode(), G4VTwistSurface::CurrentStatus::GetDistance(), G4VTwistSurface::CurrentStatus::GetNXX(), G4VTwistSurface::CurrentStatus::GetXX(), G4VTwistSurface::CurrentStatus::IsDone(), G4VTwistSurface::kCarTolerance, G4VTwistSurface::kDontValidate, G4VTwistSurface::CurrentStatus::ResetfDone(), CLHEP::Hep3Vector::set(), G4VTwistSurface::CurrentStatus::SetCurrentStatus(), G4VTwistSurface::sInside, G4VTwistSurface::sOutside, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

259 {
260  // Calculate distance to plane in local coordinate,
261  // then return distance and global intersection points.
262  //
263 
265 
266  if (fCurStat.IsDone()) {
267  G4int i;
268  for (i=0; i<fCurStat.GetNXX(); i++) {
269  gxx[i] = fCurStat.GetXX(i);
270  distance[i] = fCurStat.GetDistance(i);
271  areacode[i] = fCurStat.GetAreacode(i);
272  }
273  return fCurStat.GetNXX();
274  } else {
275  // initialize
276  G4int i;
277  for (i=0; i<2; i++) {
278  distance[i] = kInfinity;
279  areacode[i] = sOutside;
280  gxx[i].set(kInfinity, kInfinity, kInfinity);
281  }
282  }
283 
285  G4ThreeVector xx;
286 
287  // The plane is placed on origin with making its normal
288  // parallel to z-axis.
289  if (std::fabs(p.z()) <= 0.5 * kCarTolerance) { // if p is on the plane, return 1
290  distance[0] = 0;
291  xx = p;
292  } else {
293  distance[0] = std::fabs(p.z());
294  xx.set(p.x(), p.y(), 0);
295  }
296 
297  gxx[0] = ComputeGlobalPoint(xx);
298  areacode[0] = sInside;
299  G4bool isvalid = true;
300  fCurStat.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
301  isvalid, 1, kDontValidate, &gp);
302  return 1;
303 
304 }
void set(double x, double y, double z)
G4int GetAreacode(G4int i) const
double x() const
const char * p
Definition: xmltok.h:285
static const G4int sOutside
CurrentStatus fCurStat
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const
int G4int
Definition: G4Types.hh:78
double z() const
G4double GetDistance(G4int i) const
bool G4bool
Definition: G4Types.hh:79
void SetCurrentStatus(G4int i, G4ThreeVector &xx, G4double &dist, G4int &areacode, G4bool &isvalid, G4int nxx, EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
static const G4int sInside
double y() const
G4ThreeVector GetXX(G4int i) const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &gp) const
void ResetfDone(EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
G4int G4TwistTubsFlatSide::GetAreaCode ( const G4ThreeVector xx,
G4bool  withTol = true 
)
protectedvirtual

Implements G4VTwistSurface.

Definition at line 309 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::AmIOnLeftSide(), FatalException, G4VTwistSurface::fAxis, G4VTwistSurface::fAxisMax, G4VTwistSurface::fAxisMin, G4endl, G4Exception(), G4VTwistSurface::GetCorner(), G4GeometryTolerance::GetInstance(), G4GeometryTolerance::GetRadialTolerance(), CLHEP::Hep3Vector::getRho(), kPhi, kRho, G4VTwistSurface::sAxis0, G4VTwistSurface::sAxis1, G4VTwistSurface::sAxisMax, G4VTwistSurface::sAxisMin, G4VTwistSurface::sAxisPhi, G4VTwistSurface::sAxisRho, G4VTwistSurface::sBoundary, G4VTwistSurface::sC0Max1Max, G4VTwistSurface::sC0Max1Min, G4VTwistSurface::sCorner, and G4VTwistSurface::sInside.

Referenced by DistanceToSurface().

311 {
312  const G4double rtol
314 
315  G4int areacode = sInside;
316 
317  if (fAxis[0] == kRho && fAxis[1] == kPhi) {
318  G4int rhoaxis = 0;
319  // G4int phiaxis = 0;
320 
321  G4ThreeVector dphimin; // direction of phi-minimum boundary
322  G4ThreeVector dphimax; // direction of phi-maximum boundary
323  dphimin = GetCorner(sC0Max1Min);
324  dphimax = GetCorner(sC0Max1Max);
325 
326  if (withTol) {
327 
328  G4bool isoutside = false;
329 
330  // test boundary of rho-axis
331 
332  if (xx.getRho() <= fAxisMin[rhoaxis] + rtol) {
333 
334  areacode |= (sAxis0 & (sAxisRho | sAxisMin)) | sBoundary; // rho-min
335  if (xx.getRho() < fAxisMin[rhoaxis] - rtol) isoutside = true;
336 
337  } else if (xx.getRho() >= fAxisMax[rhoaxis] - rtol) {
338 
339  areacode |= (sAxis0 & (sAxisRho | sAxisMax)) | sBoundary; // rho-max
340  if (xx.getRho() > fAxisMax[rhoaxis] + rtol) isoutside = true;
341 
342  }
343 
344  // test boundary of phi-axis
345 
346  if (AmIOnLeftSide(xx, dphimin) >= 0) { // xx is on dphimin
347 
348  areacode |= (sAxis1 & (sAxisPhi | sAxisMin));
349  if (areacode & sBoundary) areacode |= sCorner; // xx is on the corner.
350  else areacode |= sBoundary;
351 
352  if (AmIOnLeftSide(xx, dphimin) > 0) isoutside = true;
353 
354  } else if (AmIOnLeftSide(xx, dphimax) <= 0) { // xx is on dphimax
355 
356  areacode |= (sAxis1 & (sAxisPhi | sAxisMax));
357  if (areacode & sBoundary) areacode |= sCorner; // xx is on the corner.
358  else areacode |= sBoundary;
359 
360  if (AmIOnLeftSide(xx, dphimax) < 0) isoutside = true;
361 
362  }
363 
364  // if isoutside = true, clear inside bit.
365  // if not on boundary, add axis information.
366 
367  if (isoutside) {
368  G4int tmpareacode = areacode & (~sInside);
369  areacode = tmpareacode;
370  } else if ((areacode & sBoundary) != sBoundary) {
371  areacode |= (sAxis0 & sAxisRho) | (sAxis1 & sAxisPhi);
372  }
373 
374  } else {
375 
376  // out of boundary of rho-axis
377 
378  if (xx.getRho() < fAxisMin[rhoaxis]) {
379  areacode |= (sAxis0 & (sAxisRho | sAxisMin)) | sBoundary;
380  } else if (xx.getRho() > fAxisMax[rhoaxis]) {
381  areacode |= (sAxis0 & (sAxisRho | sAxisMax)) | sBoundary;
382  }
383 
384  // out of boundary of phi-axis
385 
386  if (AmIOnLeftSide(xx, dphimin, false) >= 0) { // xx is leftside or
387  areacode |= (sAxis1 & (sAxisPhi | sAxisMin)) ; // boundary of dphimin
388  if (areacode & sBoundary) areacode |= sCorner; // xx is on the corner.
389  else areacode |= sBoundary;
390 
391  } else if (AmIOnLeftSide(xx, dphimax, false) <= 0) { // xx is rightside or
392  areacode |= (sAxis1 & (sAxisPhi | sAxisMax)) ; // boundary of dphimax
393  if (areacode & sBoundary) areacode |= sCorner; // xx is on the corner.
394  else areacode |= sBoundary;
395 
396  }
397 
398  if ((areacode & sBoundary) != sBoundary) {
399  areacode |= (sAxis0 & sAxisRho) | (sAxis1 & sAxisPhi);
400  }
401 
402  }
403  return areacode;
404  } else {
405 
406  std::ostringstream message;
407  message << "Feature NOT implemented !" << G4endl
408  << " fAxis[0] = " << fAxis[0] << G4endl
409  << " fAxis[1] = " << fAxis[1];
410  G4Exception("G4TwistTubsFlatSide::GetAreaCode()", "GeomSolids0001",
411  FatalException, message);
412  }
413  return areacode;
414 }
Definition: geomdefs.hh:54
static const G4int sAxisPhi
G4double fAxisMax[2]
G4ThreeVector GetCorner(G4int areacode) const
double getRho() const
int G4int
Definition: G4Types.hh:78
G4double fAxisMin[2]
static const G4int sAxis1
static const G4int sC0Max1Max
static const G4int sBoundary
G4double GetRadialTolerance() const
bool G4bool
Definition: G4Types.hh:79
static const G4int sAxis0
static const G4int sAxisMin
static const G4int sInside
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static const G4int sCorner
static const G4int sAxisMax
virtual G4int AmIOnLeftSide(const G4ThreeVector &me, const G4ThreeVector &vec, G4bool withTol=true)
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Definition: geomdefs.hh:54
static const G4int sC0Max1Min
static G4GeometryTolerance * GetInstance()
static const G4int sAxisRho
G4double G4TwistTubsFlatSide::GetBoundaryMax ( G4double  phi)
inlinevirtual

Implements G4VTwistSurface.

Definition at line 137 of file G4TwistTubsFlatSide.hh.

References G4VTwistSurface::GetCorner(), G4VTwistSurface::sC0Max1Max, CLHEP::Hep3Vector::x(), and CLHEP::Hep3Vector::y().

Referenced by GetFacets().

138 {
139  G4ThreeVector dphimax = GetCorner(sC0Max1Max);
140  return std::atan2( dphimax.y(), dphimax.x() );
141 }
double x() const
G4ThreeVector GetCorner(G4int areacode) const
static const G4int sC0Max1Max
double y() const
G4double G4TwistTubsFlatSide::GetBoundaryMin ( G4double  phi)
inlinevirtual

Implements G4VTwistSurface.

Definition at line 130 of file G4TwistTubsFlatSide.hh.

References G4VTwistSurface::GetCorner(), G4VTwistSurface::sC0Max1Min, CLHEP::Hep3Vector::x(), and CLHEP::Hep3Vector::y().

Referenced by GetFacets().

131 {
133  return std::atan2( dphimin.y(), dphimin.x() );
134 }
double x() const
G4ThreeVector GetCorner(G4int areacode) const
double y() const
static const G4int sC0Max1Min
void G4TwistTubsFlatSide::GetFacets ( G4int  m,
G4int  n,
G4double  xyz[][3],
G4int  faces[][4],
G4int  iside 
)
virtual

Implements G4VTwistSurface.

Definition at line 508 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::fAxisMax, G4VTwistSurface::fAxisMin, G4VTwistSurface::fHandedness, GetBoundaryMax(), GetBoundaryMin(), G4VTwistSurface::GetEdgeVisibility(), G4VTwistSurface::GetFace(), G4VTwistSurface::GetNode(), n, SurfacePoint(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

510 {
511 
512  G4ThreeVector p ;
513 
514  G4double rmin = fAxisMin[0] ;
515  G4double rmax = fAxisMax[0] ;
516  G4double phimin, phimax ;
517 
518  G4double r,phi ;
519 
520  G4int i,j ;
521 
522  G4int nnode,nface ;
523 
524  for ( i = 0 ; i<n ; i++ ) {
525 
526  r = rmin + i*(rmax-rmin)/(n-1) ;
527 
528  phimin = GetBoundaryMin(r) ;
529  phimax = GetBoundaryMax(r) ;
530 
531  for ( j = 0 ; j<k ; j++ )
532  {
533  phi = phimin + j*(phimax-phimin)/(k-1) ;
534 
535  nnode = GetNode(i,j,k,n,iside) ;
536  p = SurfacePoint(phi,r,true) ; // surface point in global coord.system
537 
538  xyz[nnode][0] = p.x() ;
539  xyz[nnode][1] = p.y() ;
540  xyz[nnode][2] = p.z() ;
541 
542  if ( i<n-1 && j<k-1 ) { // conterclock wise filling
543 
544  nface = GetFace(i,j,k,n,iside) ;
545 
546  if (fHandedness < 0) { // lower side
547  faces[nface][0] = GetEdgeVisibility(i,j,k,n,0,-1) * ( GetNode(i ,j ,k,n,iside)+1) ;
548  faces[nface][1] = GetEdgeVisibility(i,j,k,n,1,-1) * ( GetNode(i ,j+1,k,n,iside)+1) ;
549  faces[nface][2] = GetEdgeVisibility(i,j,k,n,2,-1) * ( GetNode(i+1,j+1,k,n,iside)+1) ;
550  faces[nface][3] = GetEdgeVisibility(i,j,k,n,3,-1) * ( GetNode(i+1,j ,k,n,iside)+1) ;
551  } else { // upper side
552  faces[nface][0] = GetEdgeVisibility(i,j,k,n,0,1) * ( GetNode(i ,j ,k,n,iside)+1) ;
553  faces[nface][1] = GetEdgeVisibility(i,j,k,n,1,1) * ( GetNode(i+1,j ,k,n,iside)+1) ;
554  faces[nface][2] = GetEdgeVisibility(i,j,k,n,2,1) * ( GetNode(i+1,j+1,k,n,iside)+1) ;
555  faces[nface][3] = GetEdgeVisibility(i,j,k,n,3,1) * ( GetNode(i ,j+1,k,n,iside)+1) ;
556 
557  }
558 
559 
560 
561  }
562  }
563  }
564 }
double x() const
const char * p
Definition: xmltok.h:285
G4double fAxisMax[2]
virtual G4double GetBoundaryMin(G4double phi)
int G4int
Definition: G4Types.hh:78
double z() const
G4double fAxisMin[2]
virtual G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false)
const G4int n
G4int GetNode(G4int i, G4int j, G4int m, G4int n, G4int iside)
double y() const
G4int GetFace(G4int i, G4int j, G4int m, G4int n, G4int iside)
virtual G4double GetBoundaryMax(G4double phi)
double G4double
Definition: G4Types.hh:76
G4int GetEdgeVisibility(G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)
G4ThreeVector G4TwistTubsFlatSide::GetNormal ( const G4ThreeVector ,
G4bool  isGlobal = false 
)
virtual

Implements G4VTwistSurface.

Definition at line 133 of file G4TwistTubsFlatSide.cc.

References G4VTwistSurface::ComputeGlobalDirection(), G4VTwistSurface::fCurrentNormal, and G4VTwistSurface::G4SurfCurNormal::normal.

135 {
136  if (isGlobal) {
138  } else {
139  return fCurrentNormal.normal;
140  }
141 }
G4ThreeVector ComputeGlobalDirection(const G4ThreeVector &lp) const
G4SurfCurNormal fCurrentNormal
virtual G4double G4TwistTubsFlatSide::GetSurfaceArea ( )
inlinevirtual

Implements G4VTwistSurface.

Definition at line 95 of file G4TwistTubsFlatSide.hh.

References fSurfaceArea.

95 { return fSurfaceArea ; }
G4ThreeVector G4TwistTubsFlatSide::SurfacePoint ( G4double  phi,
G4double  rho,
G4bool  isGlobal = false 
)
inlinevirtual

Implements G4VTwistSurface.

Definition at line 121 of file G4TwistTubsFlatSide.hh.

References G4VTwistSurface::fRot, and G4VTwistSurface::fTrans.

Referenced by GetFacets().

122 {
123  G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0);
124 
125  if (isGlobal) { return (fRot * SurfPoint + fTrans); }
126  return SurfPoint;
127 }
G4RotationMatrix fRot
G4ThreeVector fTrans

Field Documentation

G4double G4TwistTubsFlatSide::fSurfaceArea

Definition at line 99 of file G4TwistTubsFlatSide.hh.

Referenced by G4TwistTubsFlatSide(), and GetSurfaceArea().


The documentation for this class was generated from the following files: