Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoPatternFinder.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 30/10/01
3
4/** \class TGeoPatternFinder
5\ingroup Geometry_classes
6
7Base finder class for patterns.
8
9 A pattern is specifying a division type which applies only to a given
10shape type. The implemented patterns are for the moment equidistant slices
11on different axis. Implemented patterns are:
12
13 - TGeoPatternX - a X axis divison pattern
14 - TGeoPatternY - a Y axis divison pattern
15 - TGeoPatternZ - a Z axis divison pattern
16 - TGeoPatternParaX - a X axis divison pattern for PARA shape
17 - TGeoPatternParaY - a Y axis divison pattern for PARA shape
18 - TGeoPatternParaZ - a Z axis divison pattern for PARA shape
19 - TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
20 - TGeoPatternCylR - a cylindrical R divison pattern
21 - TGeoPatternCylPhi - a cylindrical phi divison pattern
22 - TGeoPatternSphR - a spherical R divison pattern
23 - TGeoPatternSphTheta - a spherical theta divison pattern
24 - TGeoPatternSphPhi - a spherical phi divison pattern
25 - TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
26*/
27
28#include "TGeoPatternFinder.h"
29
30#include "TBuffer.h"
31#include "TObject.h"
32#include "TGeoMatrix.h"
33#include "TGeoPara.h"
34#include "TGeoArb8.h"
35#include "TGeoNode.h"
36#include "TGeoManager.h"
37#include "TMath.h"
38
39
40////////////////////////////////////////////////////////////////////////////////
41/// Constructor.
42
43TGeoPatternFinder::ThreadData_t::ThreadData_t() : fMatrix(nullptr), fCurrent(-1), fNextIndex(-1) {}
44
45////////////////////////////////////////////////////////////////////////////////
46/// Destructor.
47
49{
50 // if (fMatrix != gGeoIdentity) delete fMatrix;
51}
52
53////////////////////////////////////////////////////////////////////////////////
54
60
61////////////////////////////////////////////////////////////////////////////////
62
64{
65 std::lock_guard<std::mutex> guard(fMutex);
66 std::vector<ThreadData_t *>::iterator i = fThreadData.begin();
67 while (i != fThreadData.end()) {
68 delete *i;
69 ++i;
70 }
71 fThreadData.clear();
72 fThreadSize = 0;
73}
74
75////////////////////////////////////////////////////////////////////////////////
76/// Create thread data for n threads max.
77
79{
80 std::lock_guard<std::mutex> guard(fMutex);
81 fThreadData.resize(nthreads);
83 for (Int_t tid = 0; tid < nthreads; tid++) {
84 if (fThreadData[tid] == nullptr) {
87 }
88 }
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Default constructor
93
95{
96 fNdivisions = 0;
97 fDivIndex = 0;
98 fStep = 0;
99 fStart = 0;
100 fEnd = 0;
101 fVolume = nullptr;
102 fThreadSize = 0;
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Default constructor
107
109{
110 fVolume = vol;
111 fNdivisions = ndiv;
112 fDivIndex = 0;
113 fStep = 0;
114 fStart = 0;
115 fEnd = 0;
116 fThreadSize = 0;
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// copy constructor
121
132
133////////////////////////////////////////////////////////////////////////////////
134/// assignment operator
135
137{
138 if (this != &pf) {
140 fStep = pf.fStep;
141 fStart = pf.fStart;
142 fEnd = pf.fEnd;
143 fNdivisions = pf.fNdivisions;
144 fDivIndex = pf.fDivIndex;
145 fVolume = pf.fVolume;
146 }
147 return *this;
148}
149
150////////////////////////////////////////////////////////////////////////////////
151/// Destructor
152
157
158////////////////////////////////////////////////////////////////////////////////
159/// Return current index.
160
165
166////////////////////////////////////////////////////////////////////////////////
167/// Return current matrix.
168
173
174////////////////////////////////////////////////////////////////////////////////
175/// Get index of next division.
176
181
182////////////////////////////////////////////////////////////////////////////////
183/// Set index of next division.
184
189
190////////////////////////////////////////////////////////////////////////////////
191/// Make next node (if any) current.
192
194{
196 if (td.fNextIndex < 0)
197 return nullptr;
198 cd(td.fNextIndex);
199 return GetNodeOffset(td.fCurrent);
200}
201
202////////////////////////////////////////////////////////////////////////////////
203/// Set division range. Use this method only when dividing an assembly.
204
206{
207 fStart = start;
208 fEnd = fStart + ndivisions * step;
209 fStep = step;
211}
212
213//______________________________________________________________________________
214// TGeoPatternX - a X axis divison pattern
215//______________________________________________________________________________
216
217////////////////////////////////////////////////////////////////////////////////
218/// Default constructor
219
224
225////////////////////////////////////////////////////////////////////////////////
226/// constructor
227
229{
230 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
231 fStart = -dx;
232 fEnd = dx;
233 fStep = 2 * dx / ndivisions;
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// constructor
239
241{
242 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
243 fStart = -dx;
244 fEnd = fStart + ndivisions * step;
245 fStep = step;
247}
248
249////////////////////////////////////////////////////////////////////////////////
250/// constructor
251
254{
255 fStart = start;
256 fEnd = end;
257 fStep = (end - start) / ndivisions;
259}
260
261////////////////////////////////////////////////////////////////////////////////
262/// copy constructor
263
268
269////////////////////////////////////////////////////////////////////////////////
270/// assignment operator
271
273{
274 if (this != &pf) {
277 }
278 return *this;
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Destructor
283
285
286////////////////////////////////////////////////////////////////////////////////
287/// Update current division index and global matrix to point to a given slice.
288
290{
292 td.fCurrent = idiv;
293 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
294}
295
296////////////////////////////////////////////////////////////////////////////////
297/// Return new matrix of type used by this finder.
298
300{
301 if (!IsReflected()) {
302 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
303 matrix->RegisterYourself();
304 return matrix;
305 }
307 combi->RegisterYourself();
308 combi->ReflectZ(kTRUE);
309 combi->ReflectZ(kFALSE);
310 return combi;
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Fills external matrix with the local one corresponding to the given division
315/// index.
316
318{
319 matrix.Clear();
320 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
321}
322
323////////////////////////////////////////////////////////////////////////////////
324/// Checks if the current point is on division boundary
325
327{
328 Double_t seg = (point[0] - fStart) / fStep;
330 if (diff > 0.5)
331 diff = 1. - diff;
332 if (diff < 1e-8)
333 return kTRUE;
334 return kFALSE;
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Find the cell corresponding to point and next cell along dir (if asked)
339
341{
343 TGeoNode *node = nullptr;
344 Int_t ind = (Int_t)(1. + (point[0] - fStart) / fStep) - 1;
345 if (dir) {
346 td.fNextIndex = ind;
347 if (dir[0] > 0)
348 td.fNextIndex++;
349 else
350 td.fNextIndex--;
351 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
352 td.fNextIndex = -1;
353 }
354 if ((ind < 0) || (ind >= fNdivisions))
355 return node;
356 node = GetNodeOffset(ind);
357 cd(ind);
358 return node;
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Compute distance to next division layer returning the index of next section.
363/// Point is in the frame of the divided volume.
364
366{
368 indnext = -1;
369 Double_t dist = TGeoShape::Big();
370 if (TMath::Abs(dir[0]) < TGeoShape::Tolerance())
371 return dist;
372 if (td.fCurrent < 0) {
373 Error("FindNextBoundary", "Must call FindNode first");
374 return dist;
375 }
376 Int_t inc = (dir[0] > 0) ? 1 : 0;
377 dist = (fStep * (td.fCurrent + inc) - point[0]) / dir[0];
378 if (dist < 0.)
379 Error("FindNextBoundary", "Negative distance d=%g", dist);
380 if (!inc)
381 inc = -1;
382 indnext = td.fCurrent + inc;
383 return dist;
384}
385
386////////////////////////////////////////////////////////////////////////////////
387/// Make a copy of this finder. Reflect by Z if required.
388
390{
391 TGeoPatternX *finder = new TGeoPatternX(*this);
392 if (!reflect)
393 return finder;
394 finder->Reflect();
395 return finder;
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Save a primitive as a C++ statement(s) on output stream "out".
400
401void TGeoPatternX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
402{
403 Int_t iaxis = 1;
404 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
405}
406
407//______________________________________________________________________________
408// TGeoPatternY - a Y axis divison pattern
409//______________________________________________________________________________
410
411////////////////////////////////////////////////////////////////////////////////
412/// Default constructor
413
418
419////////////////////////////////////////////////////////////////////////////////
420/// constructor
421
423{
424 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
425 fStart = -dy;
426 fEnd = dy;
427 fStep = 2 * dy / ndivisions;
429}
430
431////////////////////////////////////////////////////////////////////////////////
432/// constructor
433
435{
436 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
437 fStart = -dy;
438 fEnd = fStart + ndivisions * step;
439 fStep = step;
441}
442
443////////////////////////////////////////////////////////////////////////////////
444/// constructor
445
448{
449 fStart = start;
450 fEnd = end;
451 fStep = (end - start) / ndivisions;
453}
454
455////////////////////////////////////////////////////////////////////////////////
456/// copy constructor
457
462
463////////////////////////////////////////////////////////////////////////////////
464/// assignment operator
465
467{
468 if (this != &pf) {
471 }
472 return *this;
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Destructor
477
479
480////////////////////////////////////////////////////////////////////////////////
481/// Update current division index and global matrix to point to a given slice.
482
484{
486 td.fCurrent = idiv;
487 td.fMatrix->SetDy(fStart + idiv * fStep + 0.5 * fStep);
488}
489
490////////////////////////////////////////////////////////////////////////////////
491/// Return new matrix of type used by this finder.
492
494{
495 if (!IsReflected()) {
496 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
497 matrix->RegisterYourself();
498 return matrix;
499 }
501 combi->RegisterYourself();
502 combi->ReflectZ(kTRUE);
503 combi->ReflectZ(kFALSE);
504 return combi;
505}
506
507////////////////////////////////////////////////////////////////////////////////
508/// Fills external matrix with the local one corresponding to the given division
509/// index.
510
512{
513 matrix.Clear();
514 matrix.SetDy(fStart + idiv * fStep + 0.5 * fStep);
515}
516
517////////////////////////////////////////////////////////////////////////////////
518/// Checks if the current point is on division boundary
519
521{
522 Double_t seg = (point[1] - fStart) / fStep;
524 if (diff > 0.5)
525 diff = 1. - diff;
526 if (diff < 1e-8)
527 return kTRUE;
528 return kFALSE;
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Find the cell corresponding to point and next cell along dir (if asked)
533
535{
537 TGeoNode *node = nullptr;
538 Int_t ind = (Int_t)(1. + (point[1] - fStart) / fStep) - 1;
539 if (dir) {
540 td.fNextIndex = ind;
541 if (dir[1] > 0)
542 td.fNextIndex++;
543 else
544 td.fNextIndex--;
545 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
546 td.fNextIndex = -1;
547 }
548 if ((ind < 0) || (ind >= fNdivisions))
549 return node;
550 node = GetNodeOffset(ind);
551 cd(ind);
552 return node;
553}
554
555////////////////////////////////////////////////////////////////////////////////
556/// Compute distance to next division layer returning the index of next section.
557/// Point is in the frame of the divided volume.
558
560{
562 indnext = -1;
563 Double_t dist = TGeoShape::Big();
564 if (TMath::Abs(dir[1]) < TGeoShape::Tolerance())
565 return dist;
566 if (td.fCurrent < 0) {
567 Error("FindNextBoundary", "Must call FindNode first");
568 return dist;
569 }
570 Int_t inc = (dir[1] > 0) ? 1 : 0;
571 dist = (fStep * (td.fCurrent + inc) - point[1]) / dir[1];
572 if (dist < 0.)
573 Error("FindNextBoundary", "Negative distance d=%g", dist);
574 if (!inc)
575 inc = -1;
576 indnext = td.fCurrent + inc;
577 return dist;
578}
579
580////////////////////////////////////////////////////////////////////////////////
581/// Make a copy of this finder. Reflect by Z if required.
582
584{
585 TGeoPatternY *finder = new TGeoPatternY(*this);
586 if (!reflect)
587 return finder;
588 finder->Reflect();
589 return finder;
590}
591
592////////////////////////////////////////////////////////////////////////////////
593/// Save a primitive as a C++ statement(s) on output stream "out".
594
595void TGeoPatternY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
596{
597 Int_t iaxis = 2;
598 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
599}
600
601//______________________________________________________________________________
602// TGeoPatternZ - a Z axis divison pattern
603//______________________________________________________________________________
604
605////////////////////////////////////////////////////////////////////////////////
606/// Default constructor
607
612////////////////////////////////////////////////////////////////////////////////
613/// constructor
614
616{
617 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
618 fStart = -dz;
619 fEnd = dz;
620 fStep = 2 * dz / ndivisions;
622}
623////////////////////////////////////////////////////////////////////////////////
624/// constructor
625
627{
628 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
629 fStart = -dz;
630 fEnd = fStart + ndivisions * step;
631 fStep = step;
633}
634////////////////////////////////////////////////////////////////////////////////
635/// constructor
636
639{
640 fStart = start;
641 fEnd = end;
642 fStep = (end - start) / ndivisions;
644}
645
646////////////////////////////////////////////////////////////////////////////////
647/// copy constructor
648
653
654////////////////////////////////////////////////////////////////////////////////
655/// assignment operator
656
658{
659 if (this != &pf) {
662 }
663 return *this;
664}
665
666////////////////////////////////////////////////////////////////////////////////
667/// Destructor
668
670////////////////////////////////////////////////////////////////////////////////
671/// Update current division index and global matrix to point to a given slice.
672
674{
676 td.fCurrent = idiv;
677 td.fMatrix->SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Return new matrix of type used by this finder.
682
684{
685 if (!IsReflected()) {
686 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
687 matrix->RegisterYourself();
688 return matrix;
689 }
691 combi->RegisterYourself();
692 combi->ReflectZ(kTRUE);
693 combi->ReflectZ(kFALSE);
694 return combi;
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Fills external matrix with the local one corresponding to the given division
699/// index.
700
702{
703 matrix.Clear();
704 matrix.SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
705}
706
707////////////////////////////////////////////////////////////////////////////////
708/// Checks if the current point is on division boundary
709
711{
712 Double_t seg = (point[2] - fStart) / fStep;
714 if (diff > 0.5)
715 diff = 1. - diff;
716 if (diff < 1e-8)
717 return kTRUE;
718 return kFALSE;
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Find the cell corresponding to point and next cell along dir (if asked)
723
725{
727 TGeoNode *node = nullptr;
728 Int_t ind = (Int_t)(1. + (point[2] - fStart) / fStep) - 1;
729 if (dir) {
730 td.fNextIndex = ind;
731 if (dir[2] > 0)
732 td.fNextIndex++;
733 else
734 td.fNextIndex--;
735 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
736 td.fNextIndex = -1;
737 }
738 if ((ind < 0) || (ind >= fNdivisions))
739 return node;
740 node = GetNodeOffset(ind);
741 cd(ind);
742 return node;
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Compute distance to next division layer returning the index of next section.
747/// Point is in the frame of the divided volume.
748
750{
751 indnext = -1;
753 Double_t dist = TGeoShape::Big();
754 if (TMath::Abs(dir[2]) < TGeoShape::Tolerance())
755 return dist;
756 if (td.fCurrent < 0) {
757 Error("FindNextBoundary", "Must call FindNode first");
758 return dist;
759 }
760 Int_t inc = (dir[2] > 0) ? 1 : 0;
761 dist = (fStep * (td.fCurrent + inc) - point[2]) / dir[2];
762 if (dist < 0.)
763 Error("FindNextBoundary", "Negative distance d=%g", dist);
764 if (!inc)
765 inc = -1;
766 indnext = td.fCurrent + inc;
767 return dist;
768}
769
770////////////////////////////////////////////////////////////////////////////////
771/// Make a copy of this finder. Reflect by Z if required.
772
774{
775 TGeoPatternZ *finder = new TGeoPatternZ(*this);
776 if (!reflect)
777 return finder;
778 finder->Reflect();
779 return finder;
780}
781
782////////////////////////////////////////////////////////////////////////////////
783/// Save a primitive as a C++ statement(s) on output stream "out".
784
785void TGeoPatternZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
786{
787 Int_t iaxis = 3;
788 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
789}
790
791//______________________________________________________________________________
792// TGeoPatternParaX - a X axis divison pattern for PARA shape
793//______________________________________________________________________________
794
795////////////////////////////////////////////////////////////////////////////////
796/// Default constructor
797
802////////////////////////////////////////////////////////////////////////////////
803/// constructor
804
813////////////////////////////////////////////////////////////////////////////////
814/// constructor
815
818{
819 Double_t dx = ((TGeoPara *)vol->GetShape())->GetX();
820 fStart = -dx;
821 fEnd = fStart + ndivisions * step;
822 fStep = step;
824}
825////////////////////////////////////////////////////////////////////////////////
826/// constructor
827
830{
831 fStart = start;
832 fEnd = end;
833 fStep = (end - start) / ndivisions;
835}
836
837////////////////////////////////////////////////////////////////////////////////
838/// copy constructor
839
844
845////////////////////////////////////////////////////////////////////////////////
846/// assignment operator
847
849{
850 if (this != &pf) {
853 }
854 return *this;
855}
856
857////////////////////////////////////////////////////////////////////////////////
858/// Destructor
859
861////////////////////////////////////////////////////////////////////////////////
862/// Update current division index and global matrix to point to a given slice.
863
865{
867 td.fCurrent = idiv;
868 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
869}
870
871////////////////////////////////////////////////////////////////////////////////
872/// Checks if the current point is on division boundary
873
875{
876 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
877 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
878 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
879 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
880 Double_t seg = (xt - fStart) / fStep;
882 if (diff > 0.5)
883 diff = 1. - diff;
884 if (diff < 1e-8)
885 return kTRUE;
886 return kFALSE;
887}
888
889////////////////////////////////////////////////////////////////////////////////
890/// get the node division containing the query point
891
893{
895 TGeoNode *node = nullptr;
896 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
897 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
898 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
899 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
900 Int_t ind = (Int_t)(1. + (xt - fStart) / fStep) - 1;
901 if (dir) {
902 Double_t ttsq = txy * txy + (txz - txy * tyz) * (txz - txy * tyz);
903 Double_t divdirx = 1. / TMath::Sqrt(1. + ttsq);
905 Double_t divdirz = -(txz - txy * tyz) * divdirx;
906 Double_t dot = dir[0] * divdirx + dir[1] * divdiry + dir[2] * divdirz;
907 td.fNextIndex = ind;
908 if (dot > 0)
909 td.fNextIndex++;
910 else
911 td.fNextIndex--;
912 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
913 td.fNextIndex = -1;
914 }
915 if ((ind < 0) || (ind >= fNdivisions))
916 return node;
917 node = GetNodeOffset(ind);
918 cd(ind);
919 return node;
920}
921
922////////////////////////////////////////////////////////////////////////////////
923/// Make a copy of this finder. Reflect by Z if required.
924
926{
928 if (!reflect)
929 return finder;
930 finder->Reflect();
931 return finder;
932}
933
934////////////////////////////////////////////////////////////////////////////////
935/// Save a primitive as a C++ statement(s) on output stream "out".
936
937void TGeoPatternParaX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
938{
939 Int_t iaxis = 1;
940 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
941}
942
943////////////////////////////////////////////////////////////////////////////////
944/// Return new matrix of type used by this finder.
945
947{
948 if (!IsReflected()) {
949 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
950 matrix->RegisterYourself();
951 return matrix;
952 }
954 combi->RegisterYourself();
955 combi->ReflectZ(kTRUE);
956 combi->ReflectZ(kFALSE);
957 return combi;
958}
959
960////////////////////////////////////////////////////////////////////////////////
961/// Fills external matrix with the local one corresponding to the given division
962/// index.
963
965{
966 matrix.Clear();
967 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
968}
969
970//______________________________________________________________________________
971// TGeoPatternParaY - a Y axis divison pattern for PARA shape
972//______________________________________________________________________________
973
974////////////////////////////////////////////////////////////////////////////////
975/// Default constructor
976
982////////////////////////////////////////////////////////////////////////////////
983/// constructor
984
986{
987 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
988 Double_t dy = ((TGeoPara *)vol->GetShape())->GetY();
989 fStart = -dy;
990 fEnd = dy;
991 fStep = 2 * dy / ndivisions;
993}
994////////////////////////////////////////////////////////////////////////////////
995/// constructor
996
999{
1000 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1001 Double_t dy = ((TGeoPara *)vol->GetShape())->GetY();
1002 fStart = -dy;
1003 fEnd = fStart + ndivisions * step;
1004 fStep = step;
1006}
1007////////////////////////////////////////////////////////////////////////////////
1008/// constructor
1009
1012{
1013 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1014 fStart = start;
1015 fEnd = end;
1016 fStep = (end - start) / ndivisions;
1018}
1019////////////////////////////////////////////////////////////////////////////////
1020/// copy constructor
1021
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// assignment operator
1029
1031{
1032 if (this != &pf) {
1035 }
1036 return *this;
1037}
1038
1039////////////////////////////////////////////////////////////////////////////////
1040/// Destructor
1041
1043////////////////////////////////////////////////////////////////////////////////
1044/// Update current division index and global matrix to point to a given slice.
1045
1047{
1049 td.fCurrent = idiv;
1050 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1051 td.fMatrix->SetDx(fTxy * dy);
1052 td.fMatrix->SetDy(dy);
1053}
1054
1055////////////////////////////////////////////////////////////////////////////////
1056/// Checks if the current point is on division boundary
1057
1059{
1060 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
1061 Double_t yt = point[1] - tyz * point[2];
1062 Double_t seg = (yt - fStart) / fStep;
1063 Double_t diff = seg - Int_t(seg);
1064 if (diff > 0.5)
1065 diff = 1. - diff;
1066 if (diff < 1e-8)
1067 return kTRUE;
1068 return kFALSE;
1069}
1070
1071////////////////////////////////////////////////////////////////////////////////
1072/// get the node division containing the query point
1073
1075{
1077 TGeoNode *node = nullptr;
1078 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
1079 Double_t yt = point[1] - tyz * point[2];
1080 Int_t ind = (Int_t)(1. + (yt - fStart) / fStep) - 1;
1081 if (dir) {
1082 Double_t divdiry = 1. / TMath::Sqrt(1. + tyz * tyz);
1084 Double_t dot = dir[1] * divdiry + dir[2] * divdirz;
1085 td.fNextIndex = ind;
1086 if (dot > 0)
1087 td.fNextIndex++;
1088 else
1089 td.fNextIndex--;
1090 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1091 td.fNextIndex = -1;
1092 }
1093 if ((ind < 0) || (ind >= fNdivisions))
1094 return node;
1095 node = GetNodeOffset(ind);
1096 cd(ind);
1097 return node;
1098}
1099
1100////////////////////////////////////////////////////////////////////////////////
1101/// Make a copy of this finder. Reflect by Z if required.
1102
1104{
1106 if (!reflect)
1107 return finder;
1108 finder->Reflect();
1109 return finder;
1110}
1111
1112////////////////////////////////////////////////////////////////////////////////
1113/// Save a primitive as a C++ statement(s) on output stream "out".
1114
1115void TGeoPatternParaY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1116{
1117 Int_t iaxis = 2;
1118 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Return new matrix of type used by this finder.
1123
1125{
1126 if (!IsReflected()) {
1127 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1128 matrix->RegisterYourself();
1129 return matrix;
1130 }
1132 combi->RegisterYourself();
1133 combi->ReflectZ(kTRUE);
1134 combi->ReflectZ(kFALSE);
1135 return combi;
1136}
1137
1138////////////////////////////////////////////////////////////////////////////////
1139/// Fills external matrix with the local one corresponding to the given division
1140/// index.
1141
1143{
1144 matrix.Clear();
1145 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1146 matrix.SetDx(fTxy * dy);
1147 matrix.SetDy(dy);
1148}
1149
1150//______________________________________________________________________________
1151// TGeoPatternParaZ - a Z axis divison pattern for PARA shape
1152//______________________________________________________________________________
1153
1154////////////////////////////////////////////////////////////////////////////////
1155/// Default constructor
1156
1158{
1159 fTxz = 0;
1160 fTyz = 0;
1162}
1163////////////////////////////////////////////////////////////////////////////////
1164/// constructor
1165
1167{
1168 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1169 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1170 Double_t dz = ((TGeoPara *)vol->GetShape())->GetZ();
1171 fStart = -dz;
1172 fEnd = dz;
1173 fStep = 2 * dz / ndivisions;
1175}
1176////////////////////////////////////////////////////////////////////////////////
1177/// constructor
1178
1181{
1182 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1183 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1184 Double_t dz = ((TGeoPara *)vol->GetShape())->GetZ();
1185 fStart = -dz;
1186 fEnd = fStart + ndivisions * step;
1187 fStep = step;
1189}
1190
1191////////////////////////////////////////////////////////////////////////////////
1192/// constructor
1193
1196{
1197 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1198 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1199 fStart = start;
1200 fEnd = end;
1201 fStep = (end - start) / ndivisions;
1203}
1204
1205////////////////////////////////////////////////////////////////////////////////
1206/// copy constructor
1207
1212
1213////////////////////////////////////////////////////////////////////////////////
1214/// assignment operator
1215
1217{
1218 if (this != &pf) {
1221 }
1222 return *this;
1223}
1224
1225////////////////////////////////////////////////////////////////////////////////
1226/// Destructor
1227
1229
1230////////////////////////////////////////////////////////////////////////////////
1231/// Update current division index and global matrix to point to a given slice.
1232
1234{
1236 td.fCurrent = idiv;
1237 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1238 td.fMatrix->SetDx(fTxz * dz);
1239 td.fMatrix->SetDy(fTyz * dz);
1240 td.fMatrix->SetDz((IsReflected()) ? -dz : dz);
1241}
1242
1243////////////////////////////////////////////////////////////////////////////////
1244/// Checks if the current point is on division boundary
1245
1247{
1248 Double_t seg = (point[2] - fStart) / fStep;
1249 Double_t diff = seg - Int_t(seg);
1250 if (diff > 0.5)
1251 diff = 1. - diff;
1252 if (diff < 1e-8)
1253 return kTRUE;
1254 return kFALSE;
1255}
1256
1257////////////////////////////////////////////////////////////////////////////////
1258/// get the node division containing the query point
1259
1261{
1263 TGeoNode *node = nullptr;
1264 Double_t zt = point[2];
1265 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1266 if (dir) {
1267 td.fNextIndex = ind;
1268 if (dir[2] > 0)
1269 td.fNextIndex++;
1270 else
1271 td.fNextIndex--;
1272 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1273 td.fNextIndex = -1;
1274 }
1275 if ((ind < 0) || (ind >= fNdivisions))
1276 return node;
1277 node = GetNodeOffset(ind);
1278 cd(ind);
1279 return node;
1280}
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Make a copy of this finder. Reflect by Z if required.
1284
1286{
1288 if (!reflect)
1289 return finder;
1290 finder->Reflect();
1291 return finder;
1292}
1293
1294////////////////////////////////////////////////////////////////////////////////
1295/// Save a primitive as a C++ statement(s) on output stream "out".
1296
1297void TGeoPatternParaZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1298{
1299 Int_t iaxis = 3;
1300 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1301}
1302
1303////////////////////////////////////////////////////////////////////////////////
1304/// Return new matrix of type used by this finder.
1305
1307{
1308 if (!IsReflected()) {
1309 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1310 matrix->RegisterYourself();
1311 return matrix;
1312 }
1314 combi->RegisterYourself();
1315 combi->ReflectZ(kTRUE);
1316 combi->ReflectZ(kFALSE);
1317 return combi;
1318}
1319
1320////////////////////////////////////////////////////////////////////////////////
1321/// Fills external matrix with the local one corresponding to the given division
1322/// index.
1323
1325{
1326 matrix.Clear();
1327 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1328 matrix.SetDx(fTxz * dz);
1329 matrix.SetDy(fTyz * dz);
1330 matrix.SetDz((IsReflected()) ? -dz : dz);
1331}
1332
1333//______________________________________________________________________________
1334// TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
1335//______________________________________________________________________________
1336
1337////////////////////////////////////////////////////////////////////////////////
1338/// Default constructor
1339
1341{
1342 fTxz = 0;
1343 fTyz = 0;
1345}
1346////////////////////////////////////////////////////////////////////////////////
1347/// constructor
1348
1350{
1351 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1352 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1355 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1356 fStart = -dz;
1357 fEnd = dz;
1358 fStep = 2 * dz / ndivisions;
1360}
1361////////////////////////////////////////////////////////////////////////////////
1362/// constructor
1363
1366{
1367 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1368 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1371 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1372 fStart = -dz;
1373 fEnd = fStart + ndivisions * step;
1374 fStep = step;
1376}
1377////////////////////////////////////////////////////////////////////////////////
1378/// constructor
1379
1382{
1383 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1384 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1387 fStart = start;
1388 fEnd = end;
1389 fStep = (end - start) / ndivisions;
1391}
1392
1393////////////////////////////////////////////////////////////////////////////////
1394/// copy constructor
1395
1397{
1399}
1400
1401////////////////////////////////////////////////////////////////////////////////
1402/// assignment operator
1403
1405{
1406 if (this != &pf) {
1408 fTxz = pf.fTxz;
1409 fTyz = pf.fTyz;
1411 }
1412 return *this;
1413}
1414
1415////////////////////////////////////////////////////////////////////////////////
1416/// Destructor
1417
1419////////////////////////////////////////////////////////////////////////////////
1420/// Update current division index and global matrix to point to a given slice.
1421
1423{
1425 td.fCurrent = idiv;
1426 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1427 td.fMatrix->SetDx(fTxz * dz);
1428 td.fMatrix->SetDy(fTyz * dz);
1429 td.fMatrix->SetDz((IsReflected()) ? -dz : dz);
1430}
1431
1432////////////////////////////////////////////////////////////////////////////////
1433/// Checks if the current point is on division boundary
1434
1436{
1437 Double_t seg = (point[2] - fStart) / fStep;
1438 Double_t diff = seg - Int_t(seg);
1439 if (diff > 0.5)
1440 diff = 1. - diff;
1441 if (diff < 1e-8)
1442 return kTRUE;
1443 return kFALSE;
1444}
1445
1446////////////////////////////////////////////////////////////////////////////////
1447/// get the node division containing the query point
1448
1450{
1452 TGeoNode *node = nullptr;
1453 Double_t zt = point[2];
1454 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1455 if (dir) {
1456 td.fNextIndex = ind;
1457 if (dir[2] > 0)
1458 td.fNextIndex++;
1459 else
1460 td.fNextIndex--;
1461 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1462 td.fNextIndex = -1;
1463 }
1464 if ((ind < 0) || (ind >= fNdivisions))
1465 return node;
1466 node = GetNodeOffset(ind);
1467 cd(ind);
1468 return node;
1469}
1470
1471////////////////////////////////////////////////////////////////////////////////
1472/// Make a copy of this finder. Reflect by Z if required.
1473
1475{
1477 if (!reflect)
1478 return finder;
1479 finder->Reflect();
1480 return finder;
1481}
1482
1483////////////////////////////////////////////////////////////////////////////////
1484/// Save a primitive as a C++ statement(s) on output stream "out".
1485
1486void TGeoPatternTrapZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1487{
1488 Int_t iaxis = 3;
1489 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1490}
1491
1492////////////////////////////////////////////////////////////////////////////////
1493/// Return new matrix of type used by this finder.
1494
1496{
1497 if (!IsReflected()) {
1498 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1499 matrix->RegisterYourself();
1500 return matrix;
1501 }
1503 combi->RegisterYourself();
1504 combi->ReflectZ(kTRUE);
1505 combi->ReflectZ(kFALSE);
1506 return combi;
1507}
1508
1509////////////////////////////////////////////////////////////////////////////////
1510/// Fills external matrix with the local one corresponding to the given division
1511/// index.
1512
1514{
1515 matrix.Clear();
1516 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1517 matrix.SetDx(fTxz * dz);
1518 matrix.SetDy(fTyz * dz);
1519 matrix.SetDz((IsReflected()) ? -dz : dz);
1520}
1521
1522//______________________________________________________________________________
1523// TGeoPatternCylR - a cylindrical R divison pattern
1524//______________________________________________________________________________
1525
1526////////////////////////////////////////////////////////////////////////////////
1527/// Default constructor
1528
1533////////////////////////////////////////////////////////////////////////////////
1534/// constructor
1535
1540////////////////////////////////////////////////////////////////////////////////
1541/// constructor
1542
1544{
1545 fStep = step;
1547 // compute start, end
1548}
1549////////////////////////////////////////////////////////////////////////////////
1550/// constructor
1551
1554{
1555 fStart = start;
1556 fEnd = end;
1557 fStep = (end - start) / ndivisions;
1559}
1560////////////////////////////////////////////////////////////////////////////////
1561/// copy constructor
1562
1567
1568////////////////////////////////////////////////////////////////////////////////
1569/// assignment operator
1570
1572{
1573 if (this != &pf) {
1576 }
1577 return *this;
1578}
1579
1580////////////////////////////////////////////////////////////////////////////////
1581/// Destructor
1582
1584
1585////////////////////////////////////////////////////////////////////////////////
1586/// Checks if the current point is on division boundary
1587
1589{
1590 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1591 Double_t seg = (r - fStart) / fStep;
1592 Double_t diff = seg - Int_t(seg);
1593 if (diff > 0.5)
1594 diff = 1. - diff;
1595 if (diff < 1e-8)
1596 return kTRUE;
1597 return kFALSE;
1598}
1599
1600////////////////////////////////////////////////////////////////////////////////
1601/// Update current division index and global matrix to point to a given slice.
1602
1604{
1606 td.fCurrent = idiv;
1607}
1608
1609////////////////////////////////////////////////////////////////////////////////
1610/// find the node containing the query point
1611
1613{
1615 if (!td.fMatrix)
1616 td.fMatrix = gGeoIdentity;
1617 TGeoNode *node = nullptr;
1618 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1619 Int_t ind = (Int_t)(1. + (r - fStart) / fStep) - 1;
1620 if (dir) {
1621 td.fNextIndex = ind;
1622 Double_t dot = point[0] * dir[0] + point[1] * dir[1];
1623 if (dot > 0)
1624 td.fNextIndex++;
1625 else
1626 td.fNextIndex--;
1627 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1628 td.fNextIndex = -1;
1629 }
1630 if ((ind < 0) || (ind >= fNdivisions))
1631 return node;
1632 node = GetNodeOffset(ind);
1633 cd(ind);
1634 return node;
1635}
1636
1637////////////////////////////////////////////////////////////////////////////////
1638/// Make a copy of this finder. Reflect by Z if required.
1639
1641{
1643 if (!reflect)
1644 return finder;
1645 finder->Reflect();
1646 return finder;
1647}
1648
1649////////////////////////////////////////////////////////////////////////////////
1650/// Save a primitive as a C++ statement(s) on output stream "out".
1651
1652void TGeoPatternCylR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1653{
1654 Int_t iaxis = 1;
1655 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1656}
1657
1658////////////////////////////////////////////////////////////////////////////////
1659/// Return new matrix of type used by this finder.
1660
1665
1666////////////////////////////////////////////////////////////////////////////////
1667/// Fills external matrix with the local one corresponding to the given division
1668/// index.
1669
1671{
1672 matrix.Clear();
1673}
1674
1675//______________________________________________________________________________
1676// TGeoPatternCylPhi - a cylindrical phi divison pattern
1677//______________________________________________________________________________
1678
1679////////////////////////////////////////////////////////////////////////////////
1680/// Default constructor
1681
1687////////////////////////////////////////////////////////////////////////////////
1688/// constructor
1689/// compute step, start, end
1690
1692{
1693 fStart = 0;
1694 fEnd = 0;
1695 fStep = 0;
1696 fSinCos = new Double_t[2 * fNdivisions];
1697 for (Int_t i = 0; i < fNdivisions; i++) {
1698 fSinCos[2 * i] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1699 fSinCos[2 * i + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1700 }
1702}
1703////////////////////////////////////////////////////////////////////////////////
1704/// constructor
1705
1708{
1709 fStep = step;
1710 fSinCos = new Double_t[2 * ndivisions];
1711 for (Int_t i = 0; i < fNdivisions; i++) {
1712 fSinCos[2 * i] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1713 fSinCos[2 * i + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1714 }
1716 // compute start, end
1717}
1718////////////////////////////////////////////////////////////////////////////////
1719/// constructor
1720
1723{
1724 fStart = start;
1725 if (fStart < 0)
1726 fStart += 360;
1727 fEnd = end;
1728 if (fEnd < 0)
1729 fEnd += 360;
1730 if ((end - start) < 0)
1731 fStep = (end - start + 360) / ndivisions;
1732 else
1733 fStep = (end - start) / ndivisions;
1734 fSinCos = new Double_t[2 * ndivisions];
1735 for (Int_t idiv = 0; idiv < ndivisions; idiv++) {
1736 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1737 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1738 }
1740}
1741////////////////////////////////////////////////////////////////////////////////
1742/// Destructor
1743
1745{
1746 if (fSinCos)
1747 delete[] fSinCos;
1748}
1749////////////////////////////////////////////////////////////////////////////////
1750/// Update current division index and global matrix to point to a given slice.
1751
1753{
1755 td.fCurrent = idiv;
1756 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
1757}
1758
1759////////////////////////////////////////////////////////////////////////////////
1760/// Checks if the current point is on division boundary
1761
1763{
1764 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1765 if (phi < 0)
1766 phi += 360;
1767 Double_t ddp = phi - fStart;
1768 if (ddp < 0)
1769 ddp += 360;
1770 Double_t seg = ddp / fStep;
1771 Double_t diff = seg - Int_t(seg);
1772 if (diff > 0.5)
1773 diff = 1. - diff;
1774 if (diff < 1e-8)
1775 return kTRUE;
1776 return kFALSE;
1777}
1778
1779////////////////////////////////////////////////////////////////////////////////
1780/// find the node containing the query point
1781
1783{
1785 TGeoNode *node = nullptr;
1786 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1787 if (phi < 0)
1788 phi += 360;
1789 // Double_t dphi = fStep*fNdivisions;
1790 Double_t ddp = phi - fStart;
1791 if (ddp < 0)
1792 ddp += 360;
1793 // if (ddp>360) ddp-=360;
1794 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
1795 if (dir) {
1796 td.fNextIndex = ind;
1797 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
1798 if (dot > 0)
1799 td.fNextIndex++;
1800 else
1801 td.fNextIndex--;
1802 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1803 td.fNextIndex = -1;
1804 }
1805 if ((ind < 0) || (ind >= fNdivisions))
1806 return node;
1807 node = GetNodeOffset(ind);
1808 cd(ind);
1809 return node;
1810}
1811
1812////////////////////////////////////////////////////////////////////////////////
1813/// Make a copy of this finder. Reflect by Z if required.
1814
1816{
1818 if (!reflect)
1819 return finder;
1820 finder->Reflect();
1821 return finder;
1822}
1823
1824////////////////////////////////////////////////////////////////////////////////
1825/// Save a primitive as a C++ statement(s) on output stream "out".
1826
1827void TGeoPatternCylPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1828{
1829 Int_t iaxis = 2;
1830 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1831}
1832
1833////////////////////////////////////////////////////////////////////////////////
1834/// Stream an object of class TGeoVolume.
1835
1837{
1838 if (R__b.IsReading()) {
1839 R__b.ReadClassBuffer(TGeoPatternCylPhi::Class(), this);
1840 if (fNdivisions) {
1841 fSinCos = new Double_t[2 * fNdivisions];
1842 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
1843 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1844 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1845 }
1846 }
1847 } else {
1848 R__b.WriteClassBuffer(TGeoPatternCylPhi::Class(), this);
1849 }
1850}
1851
1852////////////////////////////////////////////////////////////////////////////////
1853/// Return new matrix of type used by this finder.
1854
1856{
1857 if (!IsReflected()) {
1859 matrix->RegisterYourself();
1860 return matrix;
1861 }
1862 TGeoRotation *rot = new TGeoRotation();
1863 rot->RegisterYourself();
1864 rot->ReflectZ(kTRUE);
1865 rot->ReflectZ(kFALSE);
1866 return rot;
1867}
1868
1869////////////////////////////////////////////////////////////////////////////////
1870/// Fills external matrix with the local one corresponding to the given division
1871/// index.
1872
1874{
1875 matrix.Clear();
1876 matrix.FastRotZ(&fSinCos[2 * idiv]);
1877}
1878
1879//______________________________________________________________________________
1880// TGeoPatternSphR - a spherical R divison pattern
1881//______________________________________________________________________________
1882
1883////////////////////////////////////////////////////////////////////////////////
1884/// Default constructor
1885
1890////////////////////////////////////////////////////////////////////////////////
1891/// constructor
1892/// compute step, start, end
1893
1898////////////////////////////////////////////////////////////////////////////////
1899/// constructor
1900
1902{
1903 fStep = step;
1905 // compute start, end
1906}
1907////////////////////////////////////////////////////////////////////////////////
1908/// constructor
1909
1912{
1913 fStart = start;
1914 fEnd = end;
1915 fStep = (end - start) / ndivisions;
1917}
1918////////////////////////////////////////////////////////////////////////////////
1919/// copy constructor
1920
1925
1926////////////////////////////////////////////////////////////////////////////////
1927/// assignment operator
1928
1930{
1931 if (this != &pf) {
1934 }
1935 return *this;
1936}
1937
1938////////////////////////////////////////////////////////////////////////////////
1939/// Destructor
1940
1942////////////////////////////////////////////////////////////////////////////////
1943/// Update current division index and global matrix to point to a given slice.
1944
1946{
1948 td.fCurrent = idiv;
1949}
1950////////////////////////////////////////////////////////////////////////////////
1951/// find the node containing the query point
1952
1954{
1955 return nullptr;
1956}
1957
1958////////////////////////////////////////////////////////////////////////////////
1959/// Make a copy of this finder. Reflect by Z if required.
1960
1966
1967////////////////////////////////////////////////////////////////////////////////
1968/// Save a primitive as a C++ statement(s) on output stream "out".
1969
1970void TGeoPatternSphR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1971{
1972 Int_t iaxis = 1;
1973 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1974}
1975
1976////////////////////////////////////////////////////////////////////////////////
1977/// Return new matrix of type used by this finder.
1978
1983
1984////////////////////////////////////////////////////////////////////////////////
1985/// Fills external matrix with the local one corresponding to the given division
1986/// index.
1987
1989{
1990 matrix.Clear();
1991}
1992
1993//______________________________________________________________________________
1994// TGeoPatternSphTheta - a spherical theta divison pattern
1995//______________________________________________________________________________
1996
1997////////////////////////////////////////////////////////////////////////////////
1998/// Default constructor
1999
2004////////////////////////////////////////////////////////////////////////////////
2005/// constructor
2006/// compute step, start, end
2007
2012////////////////////////////////////////////////////////////////////////////////
2013/// constructor
2014
2017{
2018 fStep = step;
2020 // compute start, end
2021}
2022////////////////////////////////////////////////////////////////////////////////
2023/// constructor
2024
2027{
2028 fStart = start;
2029 fEnd = end;
2030 fStep = (end - start) / ndivisions;
2032}
2033////////////////////////////////////////////////////////////////////////////////
2034/// copy constructor
2035
2040////////////////////////////////////////////////////////////////////////////////
2041/// assignment operator
2042
2044{
2045 if (this != &pf) {
2048 }
2049 return *this;
2050}
2051////////////////////////////////////////////////////////////////////////////////
2052/// Destructor
2053
2055////////////////////////////////////////////////////////////////////////////////
2056/// Update current division index and global matrix to point to a given slice.
2057
2059{
2061 td.fCurrent = idiv;
2062}
2063////////////////////////////////////////////////////////////////////////////////
2064/// find the node containing the query point
2065
2067{
2068 return nullptr;
2069}
2070
2071////////////////////////////////////////////////////////////////////////////////
2072/// Make a copy of this finder. Reflect by Z if required.
2073
2079
2080////////////////////////////////////////////////////////////////////////////////
2081/// Save a primitive as a C++ statement(s) on output stream "out".
2082
2083void TGeoPatternSphTheta::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2084{
2085 Int_t iaxis = 2;
2086 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2087}
2088
2089////////////////////////////////////////////////////////////////////////////////
2090/// Return new matrix of type used by this finder.
2091
2096
2097////////////////////////////////////////////////////////////////////////////////
2098/// Fills external matrix with the local one corresponding to the given division
2099/// index.
2100
2102{
2103 matrix.Clear();
2104}
2105
2106//______________________________________________________________________________
2107// TGeoPatternSphPhi - a spherical phi divison pattern
2108//______________________________________________________________________________
2109
2110////////////////////////////////////////////////////////////////////////////////
2111/// Default constructor
2112
2118////////////////////////////////////////////////////////////////////////////////
2119/// constructor
2120/// compute step, start, end
2121
2130////////////////////////////////////////////////////////////////////////////////
2131/// constructor
2132/// compute start, end
2133
2141////////////////////////////////////////////////////////////////////////////////
2142/// constructor
2143/// compute step
2144
2147{
2148 fStart = start;
2149 if (fStart < 0)
2150 fStart += 360;
2151 fEnd = end;
2152 if (fEnd < 0)
2153 fEnd += 360;
2154 if ((end - start) < 0)
2155 fStep = (end - start + 360) / ndivisions;
2156 else
2157 fStep = (end - start) / ndivisions;
2158 CreateSinCos();
2160}
2161
2162////////////////////////////////////////////////////////////////////////////////
2163/// Destructor
2164
2169
2170////////////////////////////////////////////////////////////////////////////////
2171/// Create the sincos table if it does not exist
2172
2174{
2175 fSinCos = new Double_t[2 * fNdivisions];
2176 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
2177 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2178 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2179 }
2180 return fSinCos;
2181}
2182
2183////////////////////////////////////////////////////////////////////////////////
2184/// Update current division index and global matrix to point to a given slice.
2185
2187{
2189 td.fCurrent = idiv;
2190 if (!fSinCos)
2191 CreateSinCos();
2192 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
2193}
2194
2195////////////////////////////////////////////////////////////////////////////////
2196/// Checks if the current point is on division boundary
2197
2199{
2200 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2201 if (phi < 0)
2202 phi += 360;
2203 Double_t ddp = phi - fStart;
2204 if (ddp < 0)
2205 ddp += 360;
2206 Double_t seg = ddp / fStep;
2207 Double_t diff = seg - Int_t(seg);
2208 if (diff > 0.5)
2209 diff = 1. - diff;
2210 if (diff < 1e-8)
2211 return kTRUE;
2212 return kFALSE;
2213}
2214////////////////////////////////////////////////////////////////////////////////
2215/// find the node containing the query point
2216
2218{
2220 TGeoNode *node = nullptr;
2221 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2222 if (phi < 0)
2223 phi += 360;
2224 // Double_t dphi = fStep*fNdivisions;
2225 Double_t ddp = phi - fStart;
2226 if (ddp < 0)
2227 ddp += 360;
2228 // if (ddp>360) ddp-=360;
2229 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
2230 if (dir) {
2231 td.fNextIndex = ind;
2232 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
2233 if (dot > 0)
2234 td.fNextIndex++;
2235 else
2236 td.fNextIndex--;
2237 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
2238 td.fNextIndex = -1;
2239 }
2240 if ((ind < 0) || (ind >= fNdivisions))
2241 return node;
2242 node = GetNodeOffset(ind);
2243 cd(ind);
2244 return node;
2245}
2246////////////////////////////////////////////////////////////////////////////////
2247/// Make a copy of this finder. Reflect by Z if required.
2248
2257
2258////////////////////////////////////////////////////////////////////////////////
2259/// Save a primitive as a C++ statement(s) on output stream "out".
2260
2261void TGeoPatternSphPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2262{
2263 Int_t iaxis = 2;
2264 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2265}
2266////////////////////////////////////////////////////////////////////////////////
2267/// Return new matrix of type used by this finder.
2268
2270{
2271 if (!IsReflected()) {
2273 matrix->RegisterYourself();
2274 return matrix;
2275 }
2276 TGeoRotation *rot = new TGeoRotation();
2277 rot->RegisterYourself();
2278 rot->ReflectZ(kTRUE);
2279 rot->ReflectZ(kFALSE);
2280 return rot;
2281}
2282////////////////////////////////////////////////////////////////////////////////
2283/// Fills external matrix with the local one corresponding to the given division
2284/// index.
2285
2287{
2288 if (!fSinCos)
2289 ((TGeoPatternSphPhi *)this)->CreateSinCos();
2290 matrix.Clear();
2291 matrix.FastRotZ(&fSinCos[2 * idiv]);
2292}
2293
2294//______________________________________________________________________________
2295// TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
2296//______________________________________________________________________________
2297
2298////////////////////////////////////////////////////////////////////////////////
2299/// Default constructor
2300
2302{
2303 fNrows = 0;
2304 fAxisOnRows = 0;
2305 fNdivisions = nullptr;
2306 fStart = nullptr;
2308}
2309////////////////////////////////////////////////////////////////////////////////
2310/// Default constructor
2311
2313{
2314 fNrows = nrows;
2315 fAxisOnRows = 0;
2316 fNdivisions = nullptr;
2317 fStart = nullptr;
2319 // compute everything else
2320}
2321////////////////////////////////////////////////////////////////////////////////
2322/// copy constructor
2323
2326 fNrows(pfh.fNrows),
2327 fAxisOnRows(pfh.fAxisOnRows),
2328 fNdivisions(pfh.fNdivisions),
2329 fStart(pfh.fStart)
2330{
2332}
2333
2334////////////////////////////////////////////////////////////////////////////////
2335/// assignment operator
2336
2338{
2339 if (this != &pfh) {
2341 fNrows = pfh.fNrows;
2342 fAxisOnRows = pfh.fAxisOnRows;
2343 fNdivisions = pfh.fNdivisions;
2344 fStart = pfh.fStart;
2346 }
2347 return *this;
2348}
2349////////////////////////////////////////////////////////////////////////////////
2350/// destructor
2351
2353////////////////////////////////////////////////////////////////////////////////
2354/// Update current division index and global matrix to point to a given slice.
2355
2357{
2359 td.fCurrent = idiv;
2360}
2361////////////////////////////////////////////////////////////////////////////////
2362/// find the node containing the query point
2363
2365{
2366 return nullptr;
2367}
2368
2369////////////////////////////////////////////////////////////////////////////////
2370/// Return new matrix of type used by this finder.
2371
2376
2377////////////////////////////////////////////////////////////////////////////////
2378/// Fills external matrix with the local one corresponding to the given division
2379/// index.
2380
2382{
2383 matrix.Clear();
2384}
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:537
Buffer base class used for serializing objects.
Definition TBuffer.h:43
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition TGeoArb8.h:19
Box class.
Definition TGeoBBox.h:17
Class describing rotation + translation.
Definition TGeoMatrix.h:317
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
static Int_t ThreadId()
Translates the current thread id to an ordinal number.
Geometrical transformation package.
Definition TGeoMatrix.h:38
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
Parallelepiped class.
Definition TGeoPara.h:17
a cylindrical phi divison pattern
TGeoPatternCylPhi()
Default constructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
~TGeoPatternCylPhi() override
Destructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void Streamer(TBuffer &) override
Stream an object of class TGeoVolume.
static TClass * Class()
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
a cylindrical R divison pattern
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternCylR()
Default constructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
TGeoPatternCylR & operator=(const TGeoPatternCylR &)
assignment operator
~TGeoPatternCylR() override
Destructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
base finder class for patterns. A pattern is specifying a division type
ThreadData_t & GetThreadData() const
virtual void cd(Int_t)
virtual TGeoNode * CdNext()
Make next node (if any) current.
virtual TGeoMatrix * GetMatrix()
Return current matrix.
void SetRange(Double_t start, Double_t step, Int_t ndivisions)
Set division range. Use this method only when dividing an assembly.
std::vector< ThreadData_t * > fThreadData
Int_t fThreadSize
Vector of thread private transient data.
TGeoPatternFinder & operator=(const TGeoPatternFinder &)
assignment operator
void SetNext(Int_t index)
Set index of next division.
~TGeoPatternFinder() override
Destructor.
Bool_t IsReflected() const
Int_t GetCurrent()
Return current index.
void ClearThreadData() const
TGeoPatternFinder()
Default constructor.
Int_t GetNext() const
Get index of next division.
std::mutex fMutex
Size of the thread vector.
TGeoNode * GetNodeOffset(Int_t idiv)
void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
virtual TGeoMatrix * CreateMatrix() const =0
a divison pattern specialized for honeycombs
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternHoneycomb()
Default constructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternHoneycomb() override
destructor
TGeoPatternHoneycomb & operator=(const TGeoPatternHoneycomb &)
assignment operator
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
a X axis divison pattern for PARA shapes
~TGeoPatternParaX() override
Destructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternParaX()
Default constructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternParaX & operator=(const TGeoPatternParaX &)
assignment operator
a Y axis divison pattern for PARA shapes
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
~TGeoPatternParaY() override
Destructor.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternParaY()
Default constructor.
TGeoPatternParaY & operator=(const TGeoPatternParaY &)
assignment operator
a Z axis divison pattern for PARA shapes
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
~TGeoPatternParaZ() override
Destructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternParaZ & operator=(const TGeoPatternParaZ &)
assignment operator
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternParaZ()
Default constructor.
a spherical phi divison pattern
TGeoPatternSphPhi()
Default constructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternSphPhi() override
Destructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t * CreateSinCos()
Create the sincos table if it does not exist.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
a spherical R divison pattern
~TGeoPatternSphR() override
Destructor.
TGeoPatternSphR()
Default constructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternSphR & operator=(const TGeoPatternSphR &)
assignment operator
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
a spherical theta divison pattern
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
~TGeoPatternSphTheta() override
Destructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternSphTheta()
Default constructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternSphTheta & operator=(const TGeoPatternSphTheta &)
assignment operator
a Z axis divison pattern for TRAP or GTRA shapes
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternTrapZ()
Default constructor.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoPatternTrapZ & operator=(const TGeoPatternTrapZ &)
assignment operator
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternTrapZ() override
Destructor.
TGeoPatternX & operator=(const TGeoPatternX &)
assignment operator
~TGeoPatternX() override
Destructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
TGeoPatternX()
Default constructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
a Y axis divison pattern
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternY & operator=(const TGeoPatternY &)
assignment operator
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
~TGeoPatternY() override
Destructor.
TGeoPatternY()
Default constructor.
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
a Z axis divison pattern
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
TGeoPatternZ()
Default constructor.
~TGeoPatternZ() override
Destructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternZ & operator=(const TGeoPatternZ &)
assignment operator
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
Class describing rotations.
Definition TGeoMatrix.h:168
static Double_t Big()
Definition TGeoShape.h:94
static Double_t Tolerance()
Definition TGeoShape.h:97
Class describing translations.
Definition TGeoMatrix.h:116
A general trapezoid.
Definition TGeoArb8.h:98
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
TGeoShape * GetShape() const
Definition TGeoVolume.h:190
Mother of all ROOT objects.
Definition TObject.h:41
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:299
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition TMath.h:657
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:673
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:605
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Definition TMath.h:611
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition TMath.h:75
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124
Int_t fNextIndex
current division element