Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VTwistSurface.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29//
30// --------------------------------------------------------------------
31// GEANT 4 class source file
32//
33//
34// G4VTwistSurface.cc
35//
36// Author:
37// 01-Aug-2002 - Kotoyo Hoshina ([email protected])
38//
39// History:
40// 13-Nov-2003 - O.Link ([email protected]), Integration in Geant4
41// from original version in Jupiter-2.5.02 application.
42// --------------------------------------------------------------------
43
44#include <iomanip>
45
46#include "G4VTwistSurface.hh"
48
49const G4int G4VTwistSurface::sOutside = 0x00000000;
50const G4int G4VTwistSurface::sInside = 0x10000000;
51const G4int G4VTwistSurface::sBoundary = 0x20000000;
52const G4int G4VTwistSurface::sCorner = 0x40000000;
53const G4int G4VTwistSurface::sC0Min1Min = 0x40000101;
54const G4int G4VTwistSurface::sC0Max1Min = 0x40000201;
55const G4int G4VTwistSurface::sC0Max1Max = 0x40000202;
56const G4int G4VTwistSurface::sC0Min1Max = 0x40000102;
57const G4int G4VTwistSurface::sAxisMin = 0x00000101;
58const G4int G4VTwistSurface::sAxisMax = 0x00000202;
59const G4int G4VTwistSurface::sAxisX = 0x00000404;
60const G4int G4VTwistSurface::sAxisY = 0x00000808;
61const G4int G4VTwistSurface::sAxisZ = 0x00000C0C;
62const G4int G4VTwistSurface::sAxisRho = 0x00001010;
63const G4int G4VTwistSurface::sAxisPhi = 0x00001414;
64
65// mask
66const G4int G4VTwistSurface::sAxis0 = 0x0000FF00;
67const G4int G4VTwistSurface::sAxis1 = 0x000000FF;
68const G4int G4VTwistSurface::sSizeMask = 0x00000303;
69const G4int G4VTwistSurface::sAxisMask = 0x0000FCFC;
70const G4int G4VTwistSurface::sAreaMask = 0XF0000000;
71
72//=====================================================================
73//* constructors ------------------------------------------------------
74
76 : fIsValidNorm(false), fName(name)
77{
78
79 fAxis[0] = kUndefined;
80 fAxis[1] = kUndefined;
81 fAxisMin[0] = kInfinity;
82 fAxisMin[1] = kInfinity;
83 fAxisMax[0] = kInfinity;
84 fAxisMax[1] = kInfinity;
85 fHandedness = 1;
86
87 for (G4int i=0; i<4; i++)
88 {
89 fCorners[i].set(kInfinity, kInfinity, kInfinity);
90 fNeighbours[i] = 0;
91 }
92
93 fCurrentNormal.p.set(kInfinity, kInfinity, kInfinity);
94
95 fAmIOnLeftSide.me.set(kInfinity, kInfinity, kInfinity);
96 fAmIOnLeftSide.vec.set(kInfinity, kInfinity, kInfinity);
98}
99
101 const G4RotationMatrix &rot,
102 const G4ThreeVector &tlate,
103 G4int handedness,
104 const EAxis axis0 ,
105 const EAxis axis1 ,
106 G4double axis0min,
107 G4double axis1min,
108 G4double axis0max,
109 G4double axis1max )
110 : fIsValidNorm(false), fName(name)
111{
112 fAxis[0] = axis0;
113 fAxis[1] = axis1;
114 fAxisMin[0] = axis0min;
115 fAxisMin[1] = axis1min;
116 fAxisMax[0] = axis0max;
117 fAxisMax[1] = axis1max;
118 fHandedness = handedness;
119 fRot = rot;
120 fTrans = tlate;
121
122 for (G4int i=0; i<4; i++)
123 {
124 fCorners[i].set(kInfinity, kInfinity, kInfinity);
125 fNeighbours[i] = 0;
126 }
127
128 fCurrentNormal.p.set(kInfinity, kInfinity, kInfinity);
129
130 fAmIOnLeftSide.me.set(kInfinity, kInfinity, kInfinity);
131 fAmIOnLeftSide.vec.set(kInfinity, kInfinity, kInfinity);
133}
134
135//=====================================================================
136//* Fake default constructor ------------------------------------------
137
139 : fHandedness(0), fIsValidNorm(false), kCarTolerance(0.),
140 fName("")
141{
142 fAxis[0] = fAxis[1] = kXAxis;
143 fAxisMin[0] = fAxisMin[1] = 0.;
144 fAxisMax[0] = fAxisMax[1] = 0.;
145 fNeighbours[0] = fNeighbours[1] = fNeighbours[2] = fNeighbours[3] = 0;
146}
147
148//=====================================================================
149//* destructor --------------------------------------------------------
150
152{
153}
154
155//=====================================================================
156//* AmIOnLeftSide -----------------------------------------------------
157
159 const G4ThreeVector &vec,
160 G4bool withtol)
161{
162 // AmIOnLeftSide returns phi-location of "me"
163 // (phi relation between me and vec projected on z=0 plane).
164 // If "me" is on -ve-phi-side of "vec", it returns 1.
165 // On the other hand, if "me" is on +ve-phi-side of "vec",
166 // it returns -1.
167 // (The return value represents z-coordinate of normal vector
168 // of me.cross(vec).)
169 // If me is on boundary of vec, return 0.
170
171 static const G4double kAngTolerance
173
174 static G4RotationMatrix unitrot; // unit matrix
175 static const G4RotationMatrix rottol = unitrot.rotateZ(0.5*kAngTolerance);
176 static const G4RotationMatrix invrottol = unitrot.rotateZ(-1.*kAngTolerance);
177
178 if (fAmIOnLeftSide.me == me
179 && fAmIOnLeftSide.vec == vec
180 && fAmIOnLeftSide.withTol == withtol) {
181 return fAmIOnLeftSide.amIOnLeftSide;
182 }
183
184 fAmIOnLeftSide.me = me;
185 fAmIOnLeftSide.vec = vec;
186 fAmIOnLeftSide.withTol = withtol;
187
188 G4ThreeVector met = (G4ThreeVector(me.x(), me.y(), 0.)).unit();
189 G4ThreeVector vect = (G4ThreeVector(vec.x(), vec.y(), 0.)).unit();
190
191 G4ThreeVector ivect = invrottol * vect;
192 G4ThreeVector rvect = rottol * vect;
193
194 G4double metcrossvect = met.x() * vect.y() - met.y() * vect.x();
195
196 if (withtol) {
197 if (met.x() * ivect.y() - met.y() * ivect.x() > 0 &&
198 metcrossvect >= 0) {
199 fAmIOnLeftSide.amIOnLeftSide = 1;
200 } else if (met.x() * rvect.y() - met.y() * rvect.x() < 0 &&
201 metcrossvect <= 0) {
202 fAmIOnLeftSide.amIOnLeftSide = -1;
203 } else {
204 fAmIOnLeftSide.amIOnLeftSide = 0;
205 }
206 } else {
207 if (metcrossvect > 0) {
208 fAmIOnLeftSide.amIOnLeftSide = 1;
209 } else if (metcrossvect < 0 ) {
210 fAmIOnLeftSide.amIOnLeftSide = -1;
211 } else {
212 fAmIOnLeftSide.amIOnLeftSide = 0;
213 }
214 }
215
216#ifdef G4TWISTDEBUG
217 G4cout << " === G4VTwistSurface::AmIOnLeftSide() =============="
218 << G4endl;
219 G4cout << " Name , returncode : " << fName << " "
220 << fAmIOnLeftSide.amIOnLeftSide << G4endl;
221 G4cout << " me, vec : " << std::setprecision(14) << me
222 << " " << vec << G4endl;
223 G4cout << " met, vect : " << met << " " << vect << G4endl;
224 G4cout << " ivec, rvec : " << ivect << " " << rvect << G4endl;
225 G4cout << " met x vect : " << metcrossvect << G4endl;
226 G4cout << " met x ivec : " << met.cross(ivect) << G4endl;
227 G4cout << " met x rvec : " << met.cross(rvect) << G4endl;
228 G4cout << " =============================================="
229 << G4endl;
230#endif
231
232 return fAmIOnLeftSide.amIOnLeftSide;
233}
234
235//=====================================================================
236//* DistanceToBoundary ------------------------------------------------
237
239 G4ThreeVector &xx,
240 const G4ThreeVector &p)
241{
242 // DistanceToBoundary
243 //
244 // return distance to nearest boundary from arbitrary point p
245 // in local coodinate.
246 // Argument areacode must be one of them:
247 // sAxis0 & sAxisMin, sAxis0 & sAxisMax,
248 // sAxis1 & sAxisMin, sAxis1 & sAxisMax.
249 //
250
251 G4ThreeVector d; // direction vector of the boundary
252 G4ThreeVector x0; // reference point of the boundary
253 G4double dist = kInfinity;
254 G4int boundarytype;
255
256 if (IsAxis0(areacode) && IsAxis1(areacode)) {
257 std::ostringstream message;
258 message << "Point is in the corner area." << G4endl
259 << " Point is in the corner area. This function returns"
260 << G4endl
261 << " a direction vector of a boundary line." << G4endl
262 << " areacode = " << areacode;
263 G4Exception("G4VTwistSurface::DistanceToBoundary()", "GeomSolids0003",
264 FatalException, message);
265 } else if (IsAxis0(areacode) || IsAxis1(areacode)) {
266 GetBoundaryParameters(areacode, d, x0, boundarytype);
267 if (boundarytype == sAxisPhi) {
268 G4double t = x0.getRho() / p.getRho();
269 xx.set(t*p.x(), t*p.y(), x0.z());
270 dist = (xx - p).mag();
271 } else {
272 // linear boundary
273 // sAxisX, sAxisY, sAxisZ, sAxisRho
274 dist = DistanceToLine(p, x0, d, xx);
275 }
276 } else {
277 std::ostringstream message;
278 message << "Bad areacode of boundary." << G4endl
279 << " areacode = " << areacode;
280 G4Exception("G4VTwistSurface::DistanceToBoundary()", "GeomSolids0003",
281 FatalException, message);
282 }
283 return dist;
284}
285
286//=====================================================================
287//* DistanceToIn ------------------------------------------------------
288
290 const G4ThreeVector &gv,
291 G4ThreeVector &gxxbest)
292{
293#ifdef G4TWISTDEBUG
294 G4cout << " ~~~~~ G4VTwistSurface::DistanceToIn(p,v) - Start ~~~~~" << G4endl;
295 G4cout << " Name : " << fName << G4endl;
296 G4cout << " gp : " << gp << G4endl;
297 G4cout << " gv : " << gv << G4endl;
298 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
299#endif
300
302 G4double distance[G4VSURFACENXX] ;
303 G4int areacode[G4VSURFACENXX] ;
304 G4bool isvalid[G4VSURFACENXX] ;
305
306 for (G4int i = 0 ; i<G4VSURFACENXX ; i++ ) {
307 distance[i] = kInfinity ;
308 areacode[i] = sOutside ;
309 isvalid[i] = false ;
310 }
311
312 G4double bestdistance = kInfinity;
313#ifdef G4TWISTDEBUG
314 G4int besti = -1;
315#endif
316 G4ThreeVector bestgxx(kInfinity, kInfinity, kInfinity);
317
318 G4int nxx = DistanceToSurface(gp, gv, gxx, distance, areacode,
319 isvalid, kValidateWithTol);
320
321 for (G4int i=0; i< nxx; i++) {
322
323 // skip this intersection if:
324 // - invalid intersection
325 // - particle goes outword the surface
326
327 if (!isvalid[i]) {
328 // xx[i] is sOutside or distance[i] < 0
329 continue;
330 }
331
332 G4ThreeVector normal = GetNormal(gxx[i], true);
333
334 if ((normal * gv) >= 0) {
335
336#ifdef G4TWISTDEBUG
337 G4cout << " G4VTwistSurface::DistanceToIn(p,v): "
338 << "particle goes outword the surface." << G4endl;
339#endif
340 continue;
341 }
342
343 //
344 // accept this intersection if the intersection is inside.
345 //
346
347 if (IsInside(areacode[i])) {
348 if (distance[i] < bestdistance) {
349 bestdistance = distance[i];
350 bestgxx = gxx[i];
351#ifdef G4TWISTDEBUG
352 besti = i;
353 G4cout << " G4VTwistSurface::DistanceToIn(p,v): "
354 << " areacode sInside name, distance = "
355 << fName << " "<< bestdistance << G4endl;
356#endif
357 }
358
359 //
360 // else, the intersection is on boundary or corner.
361 //
362
363 } else {
364
365 G4VTwistSurface *neighbours[2];
366 G4bool isaccepted[2] = {false, false};
367 G4int nneighbours = GetNeighbours(areacode[i], neighbours);
368
369 for (G4int j=0; j< nneighbours; j++) {
370 // if on corner, nneighbours = 2.
371 // if on boundary, nneighbours = 1.
372
374 G4double tmpdist[G4VSURFACENXX] ;
375 G4int tmpareacode[G4VSURFACENXX] ;
376 G4bool tmpisvalid[G4VSURFACENXX] ;
377
378 for (G4int l = 0 ; l<G4VSURFACENXX ; l++ ) {
379 tmpdist[l] = kInfinity ;
380 tmpareacode[l] = sOutside ;
381 tmpisvalid[l] = false ;
382 }
383
384 G4int tmpnxx = neighbours[j]->DistanceToSurface(
385 gp, gv, tmpgxx, tmpdist,
386 tmpareacode, tmpisvalid,
388 G4ThreeVector neighbournormal;
389
390 for (G4int k=0; k< tmpnxx; k++) {
391
392 //
393 // if tmpxx[k] is valid && sInside, the final winner must
394 // be neighbour surface. return kInfinity.
395 // else , choose tmpxx on same boundary of xx, then check normal
396 //
397
398 if (IsInside(tmpareacode[k])) {
399
400#ifdef G4TWISTDEBUG
401 G4cout << " G4VTwistSurface:DistanceToIn(p,v): "
402 << " intersection "<< tmpgxx[k] << G4endl
403 << " is inside of neighbour surface of " << fName
404 << " . returning kInfinity." << G4endl;
405 G4cout << "~~~~~ G4VTwistSurface::DistanceToIn(p,v) - return ~~~~"
406 << G4endl;
407 G4cout << " No intersections " << G4endl;
408 G4cout << " Name : " << fName << G4endl;
409 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
410 << G4endl;
411#endif
412 if (tmpisvalid[k]) return kInfinity;
413 continue;
414
415 //
416 // if tmpxx[k] is valid && sInside, the final winner must
417 // be neighbour surface. return .
418 //
419
420 } else if (IsSameBoundary(this,areacode[i],
421 neighbours[j], tmpareacode[k])) {
422 // tmpxx[k] is same boundary (or corner) of xx.
423
424 neighbournormal = neighbours[j]->GetNormal(tmpgxx[k], true);
425 if (neighbournormal * gv < 0) isaccepted[j] = true;
426 }
427 }
428
429 // if nneighbours = 1, chabge isaccepted[1] before
430 // exiting neighboursurface loop.
431
432 if (nneighbours == 1) isaccepted[1] = true;
433
434 } // neighboursurface loop end
435
436 // now, we can accept xx intersection
437
438 if (isaccepted[0] == true && isaccepted[1] == true) {
439 if (distance[i] < bestdistance) {
440 bestdistance = distance[i];
441 gxxbest = gxx[i];
442#ifdef G4TWISTDEBUG
443 besti = i;
444 G4cout << " G4VTwistSurface::DistanceToIn(p,v): "
445 << " areacode sBoundary & sBoundary distance = "
446 << fName << " " << distance[i] << G4endl;
447#endif
448 }
449 }
450
451 } // else end
452 } // intersection loop end
453
454 gxxbest = bestgxx;
455
456#ifdef G4TWISTDEBUG
457 if (besti < 0) {
458 G4cout << "~~~~~ G4VTwistSurface::DistanceToIn(p,v) - return ~~~~" << G4endl;
459 G4cout << " No intersections " << G4endl;
460 G4cout << " Name : " << fName << G4endl;
461 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
462 } else {
463 G4cout << "~~~~~ G4VTwistSurface::DistanceToIn(p,v) : return ~~~~" << G4endl;
464 G4cout << " Name, i : " << fName << " , " << besti << G4endl;
465 G4cout << " gxx[i] : " << gxxbest << G4endl;
466 G4cout << " bestdist : " << bestdistance << G4endl;
467 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
468 }
469
470#endif
471
472 return bestdistance;
473}
474
475//=====================================================================
476//* DistanceToOut(p, v) -----------------------------------------------
477
479 const G4ThreeVector &gv,
480 G4ThreeVector &gxxbest)
481{
482#ifdef G4TWISTDEBUG
483 G4cout << "~~~~~ G4VTwistSurface::DistanceToOut(p,v) - Start ~~~~" << G4endl;
484 G4cout << " Name : " << fName << G4endl;
485 G4cout << " gp : " << gp << G4endl;
486 G4cout << " gv : " << gv << G4endl;
487 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
488#endif
489
491 G4double distance[G4VSURFACENXX] ;
492 G4int areacode[G4VSURFACENXX] ;
493 G4bool isvalid[G4VSURFACENXX] ;
494 G4int i;
495
496 for ( i = 0 ; i<G4VSURFACENXX ; i++ )
497 {
498 distance[i] = kInfinity ;
499 areacode[i] = sOutside ;
500 isvalid[i] = false ;
501 }
502
503 G4int nxx;
504 G4double bestdistance = kInfinity;
505
506 nxx = DistanceToSurface(gp, gv, gxx, distance, areacode,
507 isvalid, kValidateWithTol);
508
509 for (i=0; i<nxx; i++) {
510 if (!(isvalid[i])) {
511 continue;
512 }
513
514 G4ThreeVector normal = GetNormal(gxx[i], true);
515 if (normal * gv <= 0) {
516 // particle goes toword inside of solid, return kInfinity
517#ifdef G4TWISTDEBUG
518 G4cout << " G4VTwistSurface::DistanceToOut(p,v): normal*gv < 0, normal "
519 << fName << " " << normal
520 << G4endl;
521#endif
522 } else {
523 // gxx[i] is accepted.
524 if (distance[i] < bestdistance) {
525 bestdistance = distance[i];
526 gxxbest = gxx[i];
527 }
528 }
529 }
530
531#ifdef G4TWISTDEBUG
532 if (besti < 0) {
533 G4cout << "~~~~~ G4VTwistSurface::DistanceToOut(p,v) - return ~~~" << G4endl;
534 G4cout << " No intersections " << G4endl;
535 G4cout << " Name : " << fName << G4endl;
536 G4cout << " bestdist : " << bestdistance << G4endl;
537 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
538 } else {
539 G4cout << "~~~~~ G4VTwistSurface::DistanceToOut(p,v) : return ~~~" << G4endl;
540 G4cout << " Name, i : " << fName << " , " << i << G4endl;
541 G4cout << " gxx[i] : " << gxxbest << G4endl;
542 G4cout << " bestdist : " << bestdistance << G4endl;
543 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
544 }
545#endif
546
547 return bestdistance;
548}
549
550//=====================================================================
551//* DistanceTo(p) -----------------------------------------------------
552
554 G4ThreeVector &gxxbest)
555{
556#ifdef G4TWISTDEBUG
557 G4cout << "~~~~~ G4VTwistSurface::DistanceTo(p) - Start ~~~~~~~~~" << G4endl;
558 G4cout << " Name : " << fName << G4endl;
559 G4cout << " gp : " << gp << G4endl;
560 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
561#endif
562
563
565 G4double distance[G4VSURFACENXX] ;
566 G4int areacode[G4VSURFACENXX] ;
567
568 for (G4int i = 0 ; i<G4VSURFACENXX ; i++ ) {
569 distance[i] = kInfinity ;
570 areacode[i] = sOutside ;
571 }
572
573
574 DistanceToSurface(gp, gxx, distance, areacode);
575 gxxbest = gxx[0];
576
577#ifdef G4TWISTDEBUG
578 G4cout << "~~~~~ G4VTwistSurface::DistanceTo(p) - return ~~~~~~~~" << G4endl;
579 G4cout << " Name : " << fName << G4endl;
580 G4cout << " gxx : " << gxxbest << G4endl;
581 G4cout << " bestdist : " << distance[0] << G4endl;
582 G4cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << G4endl;
583#endif
584
585 return distance[0];
586}
587
588//=====================================================================
589//* IsSameBoundary ----------------------------------------------------
590
592 G4VTwistSurface *surface2, G4int areacode2 ) const
593{
594 //
595 // IsSameBoundary
596 //
597 // checking tool whether two boundaries on different surfaces are same or not.
598 //
599
600 G4bool testbitmode = true;
601 G4bool iscorner[2] = {IsCorner(areacode1, testbitmode),
602 IsCorner(areacode2, testbitmode)};
603
604 if (iscorner[0] && iscorner[1]) {
605 // on corner
606 G4ThreeVector corner1 =
607 surface1->ComputeGlobalPoint(surface1->GetCorner(areacode1));
608 G4ThreeVector corner2 =
609 surface2->ComputeGlobalPoint(surface2->GetCorner(areacode2));
610
611 if ((corner1 - corner2).mag() < kCarTolerance) {
612 return true;
613 } else {
614 return false;
615 }
616
617 } else if ((IsBoundary(areacode1, testbitmode) && (!iscorner[0])) &&
618 (IsBoundary(areacode2, testbitmode) && (!iscorner[1]))) {
619 // on boundary
620 G4ThreeVector d1, d2, ld1, ld2;
621 G4ThreeVector x01, x02, lx01, lx02;
622 G4int type1, type2;
623 surface1->GetBoundaryParameters(areacode1, ld1, lx01, type1);
624 surface2->GetBoundaryParameters(areacode2, ld2, lx02, type2);
625
626 x01 = surface1->ComputeGlobalPoint(lx01);
627 x02 = surface2->ComputeGlobalPoint(lx02);
628 d1 = surface1->ComputeGlobalDirection(ld1);
629 d2 = surface2->ComputeGlobalDirection(ld2);
630
631 if ((x01 - x02).mag() < kCarTolerance &&
632 (d1 - d2).mag() < kCarTolerance) {
633 return true;
634 } else {
635 return false;
636 }
637
638 } else {
639 return false;
640 }
641}
642
643//=====================================================================
644//* GetBoundaryParameters ---------------------------------------------
645
647 G4ThreeVector &d,
648 G4ThreeVector &x0,
649 G4int &boundarytype) const
650{
651 // areacode must be one of them:
652 // sAxis0 & sAxisMin, sAxis0 & sAxisMax,
653 // sAxis1 & sAxisMin, sAxis1 & sAxisMax.
654
655 G4int i;
656 for (i=0; i<4; i++) {
657 if (fBoundaries[i].GetBoundaryParameters(areacode, d, x0,
658 boundarytype)) {
659 return;
660 }
661 }
662
663 std::ostringstream message;
664 message << "Not registered boundary." << G4endl
665 << " Boundary at areacode " << std::hex << areacode
666 << std::dec << G4endl
667 << " is not registered.";
668 G4Exception("G4VTwistSurface::GetBoundaryParameters()", "GeomSolids0002",
669 FatalException, message);
670}
671
672//=====================================================================
673//* GetBoundaryAtPZ ---------------------------------------------------
674
676 const G4ThreeVector &p) const
677{
678 // areacode must be one of them:
679 // sAxis0 & sAxisMin, sAxis0 & sAxisMax,
680 // sAxis1 & sAxisMin, sAxis1 & sAxisMax.
681
682 if (areacode & sAxis0 && areacode & sAxis1) {
683 std::ostringstream message;
684 message << "Point is in the corner area." << G4endl
685 << " This function returns "
686 << "a direction vector of a boundary line." << G4endl
687 << " areacode = " << areacode;
688 G4Exception("G4VTwistSurface::GetBoundaryAtPZ()", "GeomSolids0003",
689 FatalException, message);
690 }
691
693 G4ThreeVector x0;
694 G4int boundarytype;
695 G4bool found = false;
696
697 for (G4int i=0; i<4; i++) {
698 if (fBoundaries[i].GetBoundaryParameters(areacode, d, x0,
699 boundarytype)){
700 found = true;
701 continue;
702 }
703 }
704
705 if (!found) {
706 std::ostringstream message;
707 message << "Not registered boundary." << G4endl
708 << " Boundary at areacode " << areacode << G4endl
709 << " is not registered.";
710 G4Exception("G4VTwistSurface::GetBoundaryAtPZ()", "GeomSolids0002",
711 FatalException, message);
712 }
713
714 if (((boundarytype & sAxisPhi) == sAxisPhi) ||
715 ((boundarytype & sAxisRho) == sAxisRho)) {
716 std::ostringstream message;
717 message << "Not a z-depended line boundary." << G4endl
718 << " Boundary at areacode " << areacode << G4endl
719 << " is not a z-depended line.";
720 G4Exception("G4VTwistSurface::GetBoundaryAtPZ()", "GeomSolids0002",
721 FatalException, message);
722 }
723 return ((p.z() - x0.z()) / d.z()) * d + x0;
724}
725
726//=====================================================================
727//* SetCorner ---------------------------------------------------------
728
730{
731 if ((areacode & sCorner) != sCorner){
732 std::ostringstream message;
733 message << "Area code must represents corner." << G4endl
734 << " areacode " << areacode;
735 G4Exception("G4VTwistSurface::SetCorner()", "GeomSolids0002",
736 FatalException, message);
737 }
738
739 if ((areacode & sC0Min1Min) == sC0Min1Min) {
740 fCorners[0].set(x, y, z);
741 } else if ((areacode & sC0Max1Min) == sC0Max1Min) {
742 fCorners[1].set(x, y, z);
743 } else if ((areacode & sC0Max1Max) == sC0Max1Max) {
744 fCorners[2].set(x, y, z);
745 } else if ((areacode & sC0Min1Max) == sC0Min1Max) {
746 fCorners[3].set(x, y, z);
747 }
748}
749
750//=====================================================================
751//* SetBoundaryAxis ---------------------------------------------------
752
753void G4VTwistSurface::GetBoundaryAxis(G4int areacode, EAxis axis[]) const
754{
755 if ((areacode & sBoundary) != sBoundary) {
756 G4Exception("G4VTwistSurface::GetBoundaryAxis()", "GeomSolids0003",
757 FatalException, "Not located on a boundary!");
758 }
759 G4int i;
760 for (i=0; i<2; i++) {
761
762 G4int whichaxis = 0 ;
763 if (i == 0) {
764 whichaxis = sAxis0;
765 } else if (i == 1) {
766 whichaxis = sAxis1;
767 }
768
769 // extracted axiscode of whichaxis
770 G4int axiscode = whichaxis & sAxisMask & areacode ;
771 if (axiscode) {
772 if (axiscode == (whichaxis & sAxisX)) {
773 axis[i] = kXAxis;
774 } else if (axiscode == (whichaxis & sAxisY)) {
775 axis[i] = kYAxis;
776 } else if (axiscode == (whichaxis & sAxisZ)) {
777 axis[i] = kZAxis;
778 } else if (axiscode == (whichaxis & sAxisRho)) {
779 axis[i] = kRho;
780 } else if (axiscode == (whichaxis & sAxisPhi)) {
781 axis[i] = kPhi;
782 } else {
783 std::ostringstream message;
784 message << "Not supported areacode." << G4endl
785 << " areacode " << areacode;
786 G4Exception("G4VTwistSurface::GetBoundaryAxis()", "GeomSolids0001",
787 FatalException, message);
788 }
789 }
790 }
791}
792
793//=====================================================================
794//* SetBoundaryLimit --------------------------------------------------
795
797{
798 if (areacode & sCorner) {
799 if (areacode & sC0Min1Max) {
800 limit[0] = fAxisMin[0];
801 limit[1] = fAxisMin[1];
802 } else if (areacode & sC0Max1Min) {
803 limit[0] = fAxisMax[0];
804 limit[1] = fAxisMin[1];
805 } else if (areacode & sC0Max1Max) {
806 limit[0] = fAxisMax[0];
807 limit[1] = fAxisMax[1];
808 } else if (areacode & sC0Min1Max) {
809 limit[0] = fAxisMin[0];
810 limit[1] = fAxisMax[1];
811 }
812 } else if (areacode & sBoundary) {
813 if (areacode & (sAxis0 | sAxisMin)) {
814 limit[0] = fAxisMin[0];
815 } else if (areacode & (sAxis1 | sAxisMin)) {
816 limit[0] = fAxisMin[1];
817 } else if (areacode & (sAxis0 | sAxisMax)) {
818 limit[0] = fAxisMax[0];
819 } else if (areacode & (sAxis1 | sAxisMax)) {
820 limit[0] = fAxisMax[1];
821 }
822 } else {
823 std::ostringstream message;
824 message << "Not located on a boundary!" << G4endl
825 << " areacode " << areacode;
826 G4Exception("G4VTwistSurface::GetBoundaryLimit()", "GeomSolids1002",
827 JustWarning, message);
828 }
829}
830
831//=====================================================================
832//* SetBoundary -------------------------------------------------------
833
835 const G4ThreeVector &direction,
836 const G4ThreeVector &x0,
837 const G4int &boundarytype)
838{
839 G4int code = (~sAxisMask) & axiscode;
840 if ((code == (sAxis0 & sAxisMin)) ||
841 (code == (sAxis0 & sAxisMax)) ||
842 (code == (sAxis1 & sAxisMin)) ||
843 (code == (sAxis1 & sAxisMax))) {
844
845 G4int i;
846 G4bool done = false;
847 for (i=0; i<4; i++) {
848 if (fBoundaries[i].IsEmpty()) {
849 fBoundaries[i].SetFields(axiscode, direction,
850 x0, boundarytype);
851 done = true;
852 break;
853 }
854 }
855
856 if (!done) {
857 G4Exception("G4VTwistSurface::SetBoundary()", "GeomSolids0003",
858 FatalException, "Number of boundary exceeding 4!");
859 }
860 } else {
861 std::ostringstream message;
862 message << "Invalid axis-code." << G4endl
863 << " axiscode = "
864 << std::hex << axiscode << std::dec;
865 G4Exception("G4VTwistSurface::SetBoundary()", "GeomSolids0003",
866 FatalException, message);
867 }
868}
869
870//=====================================================================
871//* GetFace -----------------------------------------------------------
872
874 G4int n, G4int iside )
875{
876 // this is the face mapping function
877 // (i,j) -> face number
878
879 if ( iside == 0 ) {
880 return i * ( k - 1 ) + j ;
881 }
882
883 else if ( iside == 1 ) {
884 return (k-1)*(k-1) + i*(k-1) + j ;
885 }
886
887 else if ( iside == 2 ) {
888 return 2*(k-1)*(k-1) + i*(k-1) + j ;
889 }
890
891 else if ( iside == 3 ) {
892 return 2*(k-1)*(k-1) + (n-1)*(k-1) + i*(k-1) + j ;
893 }
894
895 else if ( iside == 4 ) {
896 return 2*(k-1)*(k-1) + 2*(n-1)*(k-1) + i*(k-1) + j ;
897 }
898
899 else if ( iside == 5 ) {
900 return 2*(k-1)*(k-1) + 3*(n-1)*(k-1) + i*(k-1) + j ;
901 }
902
903 else {
904
905 std::ostringstream message;
906 message << "Not correct side number: "
907 << GetName() << G4endl
908 << "iside is " << iside << " but should be "
909 << "0,1,2,3,4 or 5" << ".";
910 G4Exception("G4TwistSurface::G4GetFace()", "GeomSolids0002",
911 FatalException, message);
912
913
914 }
915
916 return -1 ; // wrong face
917}
918
919//=====================================================================
920//* GetNode -----------------------------------------------------------
921
923 G4int n, G4int iside )
924{
925 // this is the node mapping function
926 // (i,j) -> node number
927 // Depends on the side iside and the used meshing of the surface
928
929 if ( iside == 0 ) {
930 // lower endcap is kxk squared.
931 // n = k
932 return i * k + j ;
933 }
934
935 if ( iside == 1 ) {
936 // upper endcap is kxk squared. Shift by k*k
937 // n = k
938 return k*k + i*k + j ;
939 }
940
941 else if ( iside == 2 ) {
942 // front side.
943 if ( i == 0 ) { return j ; }
944 else if ( i == n-1 ) { return k*k + j ; }
945 else { return 2*k*k + 4*(i-1)*(k-1) + j ; }
946 }
947
948 else if ( iside == 3 ) {
949 // right side
950 if ( i == 0 ) { return (j+1)*k - 1 ; }
951 else if ( i == n-1 ) { return k*k + (j+1)*k - 1 ; }
952 else { return 2*k*k + 4*(i-1)*(k-1) + (k-1) + j ; }
953 }
954 else if ( iside == 4 ) {
955 // back side.
956 if ( i == 0 ) { return k*k - 1 - j ; } // reversed order
957 else if ( i == n-1 ) { return 2*k*k - 1 - j ; } // reversed order
958 else { return 2*k*k + 4*(i-1)*(k-1) + 2*(k-1) + j ; // normal order
959 }
960 }
961 else if ( iside == 5 ) {
962 // left side
963 if ( i == 0 ) { return k*k - (j+1)*k ; } // reversed order
964 else if ( i == n-1) { return 2*k*k - (j+1)*k ; } // reverded order
965 else {
966 if ( j == k-1 ) { return 2*k*k + 4*(i-1)*(k-1) ; } // special case
967 else { return 2*k*k + 4*(i-1)*(k-1) + 3*(k-1) + j ; } // normal order
968 }
969 }
970
971 else {
972
973 std::ostringstream message;
974 message << "Not correct side number: "
975 << GetName() << G4endl
976 << "iside is " << iside << " but should be "
977 << "0,1,2,3,4 or 5" << ".";
978 G4Exception("G4TwistSurface::G4GetNode()", "GeomSolids0002",
979 FatalException, message);
980 }
981 return -1 ; // wrong node
982}
983
984//=====================================================================
985//* GetEdgeVisiblility ------------------------------------------------
986
988{
989
990 // clockwise filling -> positive orientation
991 // counter clockwise filling -> negative orientation
992
993 //
994 // d C c
995 // +------+
996 // | |
997 // | |
998 // | |
999 // D | |B
1000 // | |
1001 // | |
1002 // | |
1003 // +------+
1004 // a A b
1005 //
1006 // a = +--+ A = ---+
1007 // b = --++ B = --+-
1008 // c = -++- C = -+--
1009 // d = ++-- D = +---
1010
1011
1012 // check first invisible faces
1013
1014 if ( ( i>0 && i<n-2 ) && ( j>0 && j<k-2 ) ) {
1015 return -1 ; // always invisible, signs: ----
1016 }
1017
1018 // change first the vertex number (depends on the orientation)
1019 // 0,1,2,3 -> 3,2,1,0
1020 if ( orientation < 0 ) { number = ( 3 - number ) ; }
1021
1022 // check true edges
1023 if ( ( j>=1 && j<=k-3 ) ) {
1024
1025 if ( i == 0 ) { // signs (A): ---+
1026 return ( number == 3 ) ? 1 : -1 ;
1027 }
1028
1029 else if ( i == n-2 ) { // signs (C): -+--
1030 return ( number == 1 ) ? 1 : -1 ;
1031 }
1032
1033 else {
1034 std::ostringstream message;
1035 message << "Not correct face number: " << GetName() << " !";
1036 G4Exception("G4TwistSurface::G4GetEdgeVisibility()",
1037 "GeomSolids0003", FatalException, message);
1038 }
1039 }
1040
1041 if ( ( i>=1 && i<=n-3 ) ) {
1042
1043 if ( j == 0 ) { // signs (D): +---
1044 return ( number == 0 ) ? 1 : -1 ;
1045 }
1046
1047 else if ( j == k-2 ) { // signs (B): --+-
1048 return ( number == 2 ) ? 1 : -1 ;
1049 }
1050
1051 else {
1052 std::ostringstream message;
1053 message << "Not correct face number: " << GetName() << " !";
1054 G4Exception("G4TwistSurface::G4GetEdgeVisibility()",
1055 "GeomSolids0003", FatalException, message);
1056 }
1057 }
1058
1059 // now the corners
1060 if ( i == 0 && j == 0 ) { // signs (a) : +--+
1061 return ( number == 0 || number == 3 ) ? 1 : -1 ;
1062 }
1063 else if ( i == 0 && j == k-2 ) { // signs (b) : --++
1064 return ( number == 2 || number == 3 ) ? 1 : -1 ;
1065 }
1066 else if ( i == n-2 && j == k-2 ) { // signs (c) : -++-
1067 return ( number == 1 || number == 2 ) ? 1 : -1 ;
1068 }
1069 else if ( i == n-2 && j == 0 ) { // signs (d) : ++--
1070 return ( number == 0 || number == 1 ) ? 1 : -1 ;
1071 }
1072 else {
1073 std::ostringstream message;
1074 message << "Not correct face number: " << GetName() << " !";
1075 G4Exception("G4TwistSurface::G4GetEdgeVisibility()",
1076 "GeomSolids0003", FatalException, message);
1077 }
1078
1079 std::ostringstream message;
1080 message << "Not correct face number: " << GetName() << " !";
1081 G4Exception("G4TwistSurface::G4GetEdgeVisibility()", "GeomSolids0003",
1082 FatalException, message);
1083
1084 return 0 ;
1085}
1086
1087
1088//=====================================================================
1089//* DebugPrint --------------------------------------------------------
1090
1092{
1097
1098 G4cout << "/* G4VTwistSurface::DebugPrint():-------------------------------"
1099 << G4endl;
1100 G4cout << "/* Name = " << fName << G4endl;
1101 G4cout << "/* Axis = " << std::hex << fAxis[0] << " "
1102 << std::hex << fAxis[1]
1103 << " (0,1,2,3,5 = kXAxis,kYAxis,kZAxis,kRho,kPhi)"
1104 << std::dec << G4endl;
1105 G4cout << "/* BoundaryLimit(in local) fAxis0(min, max) = ("<<fAxisMin[0]
1106 << ", " << fAxisMax[0] << ")" << G4endl;
1107 G4cout << "/* BoundaryLimit(in local) fAxis1(min, max) = ("<<fAxisMin[1]
1108 << ", " << fAxisMax[1] << ")" << G4endl;
1109 G4cout << "/* Cornar point sC0Min1Min = " << A << G4endl;
1110 G4cout << "/* Cornar point sC0Max1Min = " << B << G4endl;
1111 G4cout << "/* Cornar point sC0Max1Max = " << C << G4endl;
1112 G4cout << "/* Cornar point sC0Min1Max = " << D << G4endl;
1113 G4cout << "/*---------------------------------------------------------"
1114 << G4endl;
1115}
1116
1117//=====================================================================
1118// G4VTwistSurface::CurrentStatus class
1119//=====================================================================
1120
1121//=====================================================================
1122//* CurrentStatus::CurrentStatus --------------------------------------
1123
1125{
1126 for (size_t i=0; i<G4VSURFACENXX; i++)
1127 {
1128 fDistance[i] = kInfinity;
1129 fAreacode[i] = sOutside;
1130 fIsValid[i] = false;
1131 fXX[i].set(kInfinity, kInfinity, kInfinity);
1132 }
1133 fNXX = 0;
1134 fLastp.set(kInfinity, kInfinity, kInfinity);
1135 fLastv.set(kInfinity, kInfinity, kInfinity);
1136 fLastValidate = kUninitialized;
1137 fDone = false;
1138}
1139
1140//=====================================================================
1141//* CurrentStatus::~CurrentStatus -------------------------------------
1142
1144{
1145}
1146
1147//=====================================================================
1148//* CurrentStatus::SetCurrentStatus -----------------------------------
1149
1150void
1152 G4ThreeVector &xx,
1153 G4double &dist,
1154 G4int &areacode,
1155 G4bool &isvalid,
1156 G4int nxx,
1157 EValidate validate,
1158 const G4ThreeVector *p,
1159 const G4ThreeVector *v)
1160{
1161 fDistance[i] = dist;
1162 fAreacode[i] = areacode;
1163 fIsValid[i] = isvalid;
1164 fXX[i] = xx;
1165 fNXX = nxx;
1166 fLastValidate = validate;
1167 if (p)
1168 {
1169 fLastp = *p;
1170 }
1171 else
1172 {
1173 G4Exception("G4VTwistSurface::CurrentStatus::SetCurrentStatus()",
1174 "GeomSolids0003", FatalException, "SetCurrentStatus: p = 0!");
1175 }
1176 if (v)
1177 {
1178 fLastv = *v;
1179 }
1180 else
1181 {
1182 fLastv.set(kInfinity, kInfinity, kInfinity);
1183 }
1184 fDone = true;
1185}
1186
1187//=====================================================================
1188//* CurrentStatus::ResetfDone -----------------------------------------
1189
1190void
1192 const G4ThreeVector *p,
1193 const G4ThreeVector *v)
1194
1195{
1196 if (validate == fLastValidate && p && *p == fLastp)
1197 {
1198 if (!v || (v && *v == fLastv)) return;
1199 }
1200 G4ThreeVector xx(kInfinity, kInfinity, kInfinity);
1201 for (size_t i=0; i<G4VSURFACENXX; i++)
1202 {
1203 fDistance[i] = kInfinity;
1204 fAreacode[i] = sOutside;
1205 fIsValid[i] = false;
1206 fXX[i] = xx; // bug in old code ( was fXX[i] = xx[i] )
1207 }
1208 fNXX = 0;
1209 fLastp.set(kInfinity, kInfinity, kInfinity);
1210 fLastv.set(kInfinity, kInfinity, kInfinity);
1211 fLastValidate = kUninitialized;
1212 fDone = false;
1213}
1214
1215//=====================================================================
1216//* CurrentStatus::DebugPrint -----------------------------------------
1217
1218void
1220{
1221 G4cout << "CurrentStatus::Dist0,1= " << fDistance[0]
1222 << " " << fDistance[1] << " areacode = " << fAreacode[0]
1223 << " " << fAreacode[1] << G4endl;
1224}
1225
1226//=====================================================================
1227// G4VTwistSurface::Boundary class
1228//=====================================================================
1229
1230//=====================================================================
1231//* Boundary::Boundary ------------------------------------------------
1232
1234 : fBoundaryAcode(-1), fBoundaryType(0)
1235{
1236}
1237
1238//=====================================================================
1239//* Boundary::~Boundary -----------------------------------------------
1240
1242{
1243}
1244
1245//=====================================================================
1246//* Boundary::SetFields -----------------------------------------------
1247
1248void
1250 const G4ThreeVector &d,
1251 const G4ThreeVector &x0,
1252 const G4int &boundarytype)
1253{
1254 fBoundaryAcode = areacode;
1255 fBoundaryDirection = d;
1256 fBoundaryX0 = x0;
1257 fBoundaryType = boundarytype;
1258}
1259
1260//=====================================================================
1261//* Boundary::IsEmpty -------------------------------------------------
1262
1264{
1265 if (fBoundaryAcode == -1) return true;
1266 return false;
1267}
1268
1269//=====================================================================
1270//* Boundary::GetBoundaryParameters -----------------------------------
1271
1272G4bool
1274 G4ThreeVector &d,
1275 G4ThreeVector &x0,
1276 G4int &boundarytype) const
1277{
1278 // areacode must be one of them:
1279 // sAxis0 & sAxisMin, sAxis0 & sAxisMax,
1280 // sAxis1 & sAxisMin, sAxis1 & sAxisMax
1281 if ((areacode & sAxis0) && (areacode & sAxis1))
1282 {
1283 std::ostringstream message;
1284 message << "Located in the corner area." << G4endl
1285 << " This function returns a direction vector of "
1286 << "a boundary line." << G4endl
1287 << " areacode = " << areacode;
1288 G4Exception("G4VTwistSurface::Boundary::GetBoundaryParameters()",
1289 "GeomSolids0003", FatalException, message);
1290 }
1291 if ((areacode & sSizeMask) != (fBoundaryAcode & sSizeMask))
1292 {
1293 return false;
1294 }
1295 d = fBoundaryDirection;
1296 x0 = fBoundaryX0;
1297 boundarytype = fBoundaryType;
1298 return true;
1299}
@ JustWarning
@ FatalException
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4VSURFACENXX
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
double z() const
double x() const
double y() const
Hep3Vector cross(const Hep3Vector &) const
double getRho() const
void set(double x, double y, double z)
HepRotation & rotateZ(double delta)
Definition: Rotation.cc:92
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4double GetAngularTolerance() const
void SetFields(const G4int &areacode, const G4ThreeVector &d, const G4ThreeVector &x0, const G4int &boundarytype)
G4bool GetBoundaryParameters(const G4int &areacode, G4ThreeVector &d, G4ThreeVector &x0, G4int &boundarytype) const
void SetCurrentStatus(G4int i, G4ThreeVector &xx, G4double &dist, G4int &areacode, G4bool &isvalid, G4int nxx, EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
void ResetfDone(EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
virtual G4int AmIOnLeftSide(const G4ThreeVector &me, const G4ThreeVector &vec, G4bool withTol=true)
static const G4int sAxisMask
static const G4int sC0Min1Min
static const G4int sC0Min1Max
G4VTwistSurface(const G4String &name)
G4bool IsAxis1(G4int areacode) const
G4int GetNode(G4int i, G4int j, G4int m, G4int n, G4int iside)
static const G4int sOutside
virtual ~G4VTwistSurface()
G4ThreeVector ComputeGlobalDirection(const G4ThreeVector &lp) const
G4bool IsCorner(G4int areacode, G4bool testbitmode=false) const
static const G4int sAxisMax
static const G4int sAxis0
G4int GetFace(G4int i, G4int j, G4int m, G4int n, G4int iside)
G4double fAxisMax[2]
void GetBoundaryAxis(G4int areacode, EAxis axis[]) const
virtual G4double DistanceTo(const G4ThreeVector &gp, G4ThreeVector &gxx)
G4bool IsAxis0(G4int areacode) const
G4RotationMatrix fRot
G4int GetEdgeVisibility(G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)
virtual G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol)=0
G4VTwistSurface ** GetNeighbours()
G4double DistanceToLine(const G4ThreeVector &p, const G4ThreeVector &x0, const G4ThreeVector &d, G4ThreeVector &xx)
void GetBoundaryLimit(G4int areacode, G4double limit[]) const
void DebugPrint() const
static const G4int sAxisPhi
static const G4int sAxisMin
static const G4int sC0Max1Max
virtual G4double DistanceToOut(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
virtual G4double DistanceToIn(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
static const G4int sAxis1
virtual G4ThreeVector GetBoundaryAtPZ(G4int areacode, const G4ThreeVector &p) const
G4bool IsInside(G4int areacode, G4bool testbitmode=false) const
G4ThreeVector fTrans
virtual void SetBoundary(const G4int &axiscode, const G4ThreeVector &direction, const G4ThreeVector &x0, const G4int &boundarytype)
static const G4int sAxisRho
void SetCorner(G4int areacode, G4double x, G4double y, G4double z)
G4ThreeVector GetCorner(G4int areacode) const
static const G4int sBoundary
static const G4int sAxisZ
virtual G4double DistanceToBoundary(G4int areacode, G4ThreeVector &xx, const G4ThreeVector &p)
G4double fAxisMin[2]
static const G4int sCorner
static const G4int sC0Max1Min
static const G4int sInside
G4bool IsSameBoundary(G4VTwistSurface *surface1, G4int areacode1, G4VTwistSurface *surface2, G4int areacode2) const
virtual G4String GetName() const
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal)=0
static const G4int sAxisY
static const G4int sSizeMask
static const G4int sAxisX
static const G4int sAreaMask
G4bool IsBoundary(G4int areacode, G4bool testbitmode=false) const
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const
G4SurfCurNormal fCurrentNormal
virtual void GetBoundaryParameters(const G4int &areacode, G4ThreeVector &d, G4ThreeVector &x0, G4int &boundarytype) const
EAxis
Definition: geomdefs.hh:54
@ kPhi
Definition: geomdefs.hh:54
@ kYAxis
Definition: geomdefs.hh:54
@ kXAxis
Definition: geomdefs.hh:54
@ kZAxis
Definition: geomdefs.hh:54
@ kUndefined
Definition: geomdefs.hh:54
@ kRho
Definition: geomdefs.hh:54
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41