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