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
53
54////////////////////////////////////////////////////////////////////////////////
55/// Constructor.
56
57TGeoPatternFinder::ThreadData_t::ThreadData_t() : fMatrix(0), fCurrent(-1), fNextIndex(-1) {}
58
59////////////////////////////////////////////////////////////////////////////////
60/// Destructor.
61
63{
64 // if (fMatrix != gGeoIdentity) delete fMatrix;
65}
66
67////////////////////////////////////////////////////////////////////////////////
68
70{
72 return *fThreadData[tid];
73}
74
75////////////////////////////////////////////////////////////////////////////////
76
78{
79 std::lock_guard<std::mutex> guard(fMutex);
80 std::vector<ThreadData_t *>::iterator i = fThreadData.begin();
81 while (i != fThreadData.end()) {
82 delete *i;
83 ++i;
84 }
85 fThreadData.clear();
86 fThreadSize = 0;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Create thread data for n threads max.
91
93{
94 std::lock_guard<std::mutex> guard(fMutex);
95 fThreadData.resize(nthreads);
96 fThreadSize = nthreads;
97 for (Int_t tid = 0; tid < nthreads; tid++) {
98 if (fThreadData[tid] == 0) {
99 fThreadData[tid] = new ThreadData_t;
101 }
102 }
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Default constructor
107
109{
110 fNdivisions = 0;
111 fDivIndex = 0;
112 fStep = 0;
113 fStart = 0;
114 fEnd = 0;
115 fVolume = 0;
116 fThreadSize = 0;
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Default constructor
121
123{
124 fVolume = vol;
125 fNdivisions = ndiv;
126 fDivIndex = 0;
127 fStep = 0;
128 fStart = 0;
129 fEnd = 0;
130 fThreadSize = 0;
131}
132
133////////////////////////////////////////////////////////////////////////////////
134/// copy constructor
135
137 : TObject(pf),
138 fStep(pf.fStep),
139 fStart(pf.fStart),
140 fEnd(pf.fEnd),
143 fVolume(pf.fVolume)
144{
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// assignment operator
149
151{
152 if (this != &pf) {
154 fStep = pf.fStep;
155 fStart = pf.fStart;
156 fEnd = pf.fEnd;
158 fDivIndex = pf.fDivIndex;
159 fVolume = pf.fVolume;
160 }
161 return *this;
162}
163
164////////////////////////////////////////////////////////////////////////////////
165/// Destructor
166
168{
170}
171
172////////////////////////////////////////////////////////////////////////////////
173/// Return current index.
174
176{
177 return GetThreadData().fCurrent;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Return current matrix.
182
184{
185 return GetThreadData().fMatrix;
186}
187
188////////////////////////////////////////////////////////////////////////////////
189/// Get index of next division.
190
192{
193 return GetThreadData().fNextIndex;
194}
195
196////////////////////////////////////////////////////////////////////////////////
197/// Set index of next division.
198
200{
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// Make next node (if any) current.
206
208{
210 if (td.fNextIndex < 0)
211 return NULL;
212 cd(td.fNextIndex);
213 return GetNodeOffset(td.fCurrent);
214}
215
216////////////////////////////////////////////////////////////////////////////////
217/// Set division range. Use this method only when dividing an assembly.
218
220{
221 fStart = start;
222 fEnd = fStart + ndivisions * step;
223 fStep = step;
224 fNdivisions = ndivisions;
225}
226
227//______________________________________________________________________________
228// TGeoPatternX - a X axis divison pattern
229//______________________________________________________________________________
230
231////////////////////////////////////////////////////////////////////////////////
232/// Default constructor
233
235{
237}
238
239////////////////////////////////////////////////////////////////////////////////
240/// constructor
241
243{
244 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
245 fStart = -dx;
246 fEnd = dx;
247 fStep = 2 * dx / ndivisions;
249}
250
251////////////////////////////////////////////////////////////////////////////////
252/// constructor
253
254TGeoPatternX::TGeoPatternX(TGeoVolume *vol, Int_t ndivisions, Double_t step) : TGeoPatternFinder(vol, ndivisions)
255{
256 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
257 fStart = -dx;
258 fEnd = fStart + ndivisions * step;
259 fStep = step;
261}
262
263////////////////////////////////////////////////////////////////////////////////
264/// constructor
265
267 : TGeoPatternFinder(vol, ndivisions)
268{
269 fStart = start;
270 fEnd = end;
271 fStep = (end - start) / ndivisions;
273}
274
275////////////////////////////////////////////////////////////////////////////////
276/// copy constructor
277
279{
281}
282
283////////////////////////////////////////////////////////////////////////////////
284/// assignment operator
285
287{
288 if (this != &pf) {
291 }
292 return *this;
293}
294
295////////////////////////////////////////////////////////////////////////////////
296/// Destructor
297
299
300////////////////////////////////////////////////////////////////////////////////
301/// Update current division index and global matrix to point to a given slice.
302
304{
306 td.fCurrent = idiv;
307 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
308}
309
310////////////////////////////////////////////////////////////////////////////////
311/// Return new matrix of type used by this finder.
312
314{
315 if (!IsReflected()) {
316 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
317 matrix->RegisterYourself();
318 return matrix;
319 }
320 TGeoCombiTrans *combi = new TGeoCombiTrans();
321 combi->RegisterYourself();
322 combi->ReflectZ(kTRUE);
323 combi->ReflectZ(kFALSE);
324 return combi;
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Fills external matrix with the local one corresponding to the given division
329/// index.
330
332{
333 matrix.Clear();
334 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Checks if the current point is on division boundary
339
341{
342 Double_t seg = (point[0] - fStart) / fStep;
343 Double_t diff = seg - Long64_t(seg);
344 if (diff > 0.5)
345 diff = 1. - diff;
346 if (diff < 1e-8)
347 return kTRUE;
348 return kFALSE;
349}
350
351////////////////////////////////////////////////////////////////////////////////
352/// Find the cell corresponding to point and next cell along dir (if asked)
353
355{
357 TGeoNode *node = 0;
358 Int_t ind = (Int_t)(1. + (point[0] - fStart) / fStep) - 1;
359 if (dir) {
360 td.fNextIndex = ind;
361 if (dir[0] > 0)
362 td.fNextIndex++;
363 else
364 td.fNextIndex--;
365 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
366 td.fNextIndex = -1;
367 }
368 if ((ind < 0) || (ind >= fNdivisions))
369 return node;
370 node = GetNodeOffset(ind);
371 cd(ind);
372 return node;
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Compute distance to next division layer returning the index of next section.
377/// Point is in the frame of the divided volume.
378
380{
382 indnext = -1;
383 Double_t dist = TGeoShape::Big();
384 if (TMath::Abs(dir[0]) < TGeoShape::Tolerance())
385 return dist;
386 if (td.fCurrent < 0) {
387 Error("FindNextBoundary", "Must call FindNode first");
388 return dist;
389 }
390 Int_t inc = (dir[0] > 0) ? 1 : 0;
391 dist = (fStep * (td.fCurrent + inc) - point[0]) / dir[0];
392 if (dist < 0.)
393 Error("FindNextBoundary", "Negative distance d=%g", dist);
394 if (!inc)
395 inc = -1;
396 indnext = td.fCurrent + inc;
397 return dist;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Make a copy of this finder. Reflect by Z if required.
402
404{
405 TGeoPatternX *finder = new TGeoPatternX(*this);
406 if (!reflect)
407 return finder;
408 finder->Reflect();
409 return finder;
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Save a primitive as a C++ statement(s) on output stream "out".
414
415void TGeoPatternX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
416{
417 Int_t iaxis = 1;
418 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
419}
420
421//______________________________________________________________________________
422// TGeoPatternY - a Y axis divison pattern
423//______________________________________________________________________________
424
425////////////////////////////////////////////////////////////////////////////////
426/// Default constructor
427
429{
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// constructor
435
437{
438 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
439 fStart = -dy;
440 fEnd = dy;
441 fStep = 2 * dy / ndivisions;
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// constructor
447
448TGeoPatternY::TGeoPatternY(TGeoVolume *vol, Int_t ndivisions, Double_t step) : TGeoPatternFinder(vol, ndivisions)
449{
450 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
451 fStart = -dy;
452 fEnd = fStart + ndivisions * step;
453 fStep = step;
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// constructor
459
461 : TGeoPatternFinder(vol, ndivisions)
462{
463 fStart = start;
464 fEnd = end;
465 fStep = (end - start) / ndivisions;
467}
468
469////////////////////////////////////////////////////////////////////////////////
470/// copy constructor
471
473{
475}
476
477////////////////////////////////////////////////////////////////////////////////
478/// assignment operator
479
481{
482 if (this != &pf) {
485 }
486 return *this;
487}
488
489////////////////////////////////////////////////////////////////////////////////
490/// Destructor
491
493
494////////////////////////////////////////////////////////////////////////////////
495/// Update current division index and global matrix to point to a given slice.
496
498{
500 td.fCurrent = idiv;
501 td.fMatrix->SetDy(fStart + idiv * fStep + 0.5 * fStep);
502}
503
504////////////////////////////////////////////////////////////////////////////////
505/// Return new matrix of type used by this finder.
506
508{
509 if (!IsReflected()) {
510 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
511 matrix->RegisterYourself();
512 return matrix;
513 }
514 TGeoCombiTrans *combi = new TGeoCombiTrans();
515 combi->RegisterYourself();
516 combi->ReflectZ(kTRUE);
517 combi->ReflectZ(kFALSE);
518 return combi;
519}
520
521////////////////////////////////////////////////////////////////////////////////
522/// Fills external matrix with the local one corresponding to the given division
523/// index.
524
526{
527 matrix.Clear();
528 matrix.SetDy(fStart + idiv * fStep + 0.5 * fStep);
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Checks if the current point is on division boundary
533
535{
536 Double_t seg = (point[1] - fStart) / fStep;
537 Double_t diff = seg - Int_t(seg);
538 if (diff > 0.5)
539 diff = 1. - diff;
540 if (diff < 1e-8)
541 return kTRUE;
542 return kFALSE;
543}
544
545////////////////////////////////////////////////////////////////////////////////
546/// Find the cell corresponding to point and next cell along dir (if asked)
547
549{
551 TGeoNode *node = 0;
552 Int_t ind = (Int_t)(1. + (point[1] - fStart) / fStep) - 1;
553 if (dir) {
554 td.fNextIndex = ind;
555 if (dir[1] > 0)
556 td.fNextIndex++;
557 else
558 td.fNextIndex--;
559 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
560 td.fNextIndex = -1;
561 }
562 if ((ind < 0) || (ind >= fNdivisions))
563 return node;
564 node = GetNodeOffset(ind);
565 cd(ind);
566 return node;
567}
568
569////////////////////////////////////////////////////////////////////////////////
570/// Compute distance to next division layer returning the index of next section.
571/// Point is in the frame of the divided volume.
572
574{
576 indnext = -1;
577 Double_t dist = TGeoShape::Big();
578 if (TMath::Abs(dir[1]) < TGeoShape::Tolerance())
579 return dist;
580 if (td.fCurrent < 0) {
581 Error("FindNextBoundary", "Must call FindNode first");
582 return dist;
583 }
584 Int_t inc = (dir[1] > 0) ? 1 : 0;
585 dist = (fStep * (td.fCurrent + inc) - point[1]) / dir[1];
586 if (dist < 0.)
587 Error("FindNextBoundary", "Negative distance d=%g", dist);
588 if (!inc)
589 inc = -1;
590 indnext = td.fCurrent + inc;
591 return dist;
592}
593
594////////////////////////////////////////////////////////////////////////////////
595/// Make a copy of this finder. Reflect by Z if required.
596
598{
599 TGeoPatternY *finder = new TGeoPatternY(*this);
600 if (!reflect)
601 return finder;
602 finder->Reflect();
603 return finder;
604}
605
606////////////////////////////////////////////////////////////////////////////////
607/// Save a primitive as a C++ statement(s) on output stream "out".
608
609void TGeoPatternY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
610{
611 Int_t iaxis = 2;
612 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
613}
614
615//______________________________________________________________________________
616// TGeoPatternZ - a Z axis divison pattern
617//______________________________________________________________________________
618
619////////////////////////////////////////////////////////////////////////////////
620/// Default constructor
621
623{
625}
626////////////////////////////////////////////////////////////////////////////////
627/// constructor
628
630{
631 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
632 fStart = -dz;
633 fEnd = dz;
634 fStep = 2 * dz / ndivisions;
636}
637////////////////////////////////////////////////////////////////////////////////
638/// constructor
639
640TGeoPatternZ::TGeoPatternZ(TGeoVolume *vol, Int_t ndivisions, Double_t step) : TGeoPatternFinder(vol, ndivisions)
641{
642 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
643 fStart = -dz;
644 fEnd = fStart + ndivisions * step;
645 fStep = step;
647}
648////////////////////////////////////////////////////////////////////////////////
649/// constructor
650
652 : TGeoPatternFinder(vol, ndivisions)
653{
654 fStart = start;
655 fEnd = end;
656 fStep = (end - start) / ndivisions;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// copy constructor
662
664{
666}
667
668////////////////////////////////////////////////////////////////////////////////
669/// assignment operator
670
672{
673 if (this != &pf) {
676 }
677 return *this;
678}
679
680////////////////////////////////////////////////////////////////////////////////
681/// Destructor
682
684////////////////////////////////////////////////////////////////////////////////
685/// Update current division index and global matrix to point to a given slice.
686
688{
690 td.fCurrent = idiv;
691 td.fMatrix->SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
692}
693
694////////////////////////////////////////////////////////////////////////////////
695/// Return new matrix of type used by this finder.
696
698{
699 if (!IsReflected()) {
700 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
701 matrix->RegisterYourself();
702 return matrix;
703 }
704 TGeoCombiTrans *combi = new TGeoCombiTrans();
705 combi->RegisterYourself();
706 combi->ReflectZ(kTRUE);
707 combi->ReflectZ(kFALSE);
708 return combi;
709}
710
711////////////////////////////////////////////////////////////////////////////////
712/// Fills external matrix with the local one corresponding to the given division
713/// index.
714
716{
717 matrix.Clear();
718 matrix.SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Checks if the current point is on division boundary
723
725{
726 Double_t seg = (point[2] - fStart) / fStep;
727 Double_t diff = seg - Int_t(seg);
728 if (diff > 0.5)
729 diff = 1. - diff;
730 if (diff < 1e-8)
731 return kTRUE;
732 return kFALSE;
733}
734
735////////////////////////////////////////////////////////////////////////////////
736/// Find the cell corresponding to point and next cell along dir (if asked)
737
739{
741 TGeoNode *node = 0;
742 Int_t ind = (Int_t)(1. + (point[2] - fStart) / fStep) - 1;
743 if (dir) {
744 td.fNextIndex = ind;
745 if (dir[2] > 0)
746 td.fNextIndex++;
747 else
748 td.fNextIndex--;
749 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
750 td.fNextIndex = -1;
751 }
752 if ((ind < 0) || (ind >= fNdivisions))
753 return node;
754 node = GetNodeOffset(ind);
755 cd(ind);
756 return node;
757}
758
759////////////////////////////////////////////////////////////////////////////////
760/// Compute distance to next division layer returning the index of next section.
761/// Point is in the frame of the divided volume.
762
764{
765 indnext = -1;
767 Double_t dist = TGeoShape::Big();
768 if (TMath::Abs(dir[2]) < TGeoShape::Tolerance())
769 return dist;
770 if (td.fCurrent < 0) {
771 Error("FindNextBoundary", "Must call FindNode first");
772 return dist;
773 }
774 Int_t inc = (dir[2] > 0) ? 1 : 0;
775 dist = (fStep * (td.fCurrent + inc) - point[2]) / dir[2];
776 if (dist < 0.)
777 Error("FindNextBoundary", "Negative distance d=%g", dist);
778 if (!inc)
779 inc = -1;
780 indnext = td.fCurrent + inc;
781 return dist;
782}
783
784////////////////////////////////////////////////////////////////////////////////
785/// Make a copy of this finder. Reflect by Z if required.
786
788{
789 TGeoPatternZ *finder = new TGeoPatternZ(*this);
790 if (!reflect)
791 return finder;
792 finder->Reflect();
793 return finder;
794}
795
796////////////////////////////////////////////////////////////////////////////////
797/// Save a primitive as a C++ statement(s) on output stream "out".
798
799void TGeoPatternZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
800{
801 Int_t iaxis = 3;
802 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
803}
804
805//______________________________________________________________________________
806// TGeoPatternParaX - a X axis divison pattern for PARA shape
807//______________________________________________________________________________
808
809////////////////////////////////////////////////////////////////////////////////
810/// Default constructor
811
813{
815}
816////////////////////////////////////////////////////////////////////////////////
817/// constructor
818
820{
821 Double_t dx = ((TGeoPara *)vol->GetShape())->GetX();
822 fStart = -dx;
823 fEnd = dx;
824 fStep = 2 * dx / ndivisions;
826}
827////////////////////////////////////////////////////////////////////////////////
828/// constructor
829
831 : TGeoPatternFinder(vol, ndivisions)
832{
833 Double_t dx = ((TGeoPara *)vol->GetShape())->GetX();
834 fStart = -dx;
835 fEnd = fStart + ndivisions * step;
836 fStep = step;
838}
839////////////////////////////////////////////////////////////////////////////////
840/// constructor
841
843 : TGeoPatternFinder(vol, ndivisions)
844{
845 fStart = start;
846 fEnd = end;
847 fStep = (end - start) / ndivisions;
849}
850
851////////////////////////////////////////////////////////////////////////////////
852/// copy constructor
853
855{
857}
858
859////////////////////////////////////////////////////////////////////////////////
860/// assignment operator
861
863{
864 if (this != &pf) {
867 }
868 return *this;
869}
870
871////////////////////////////////////////////////////////////////////////////////
872/// Destructor
873
875////////////////////////////////////////////////////////////////////////////////
876/// Update current division index and global matrix to point to a given slice.
877
879{
881 td.fCurrent = idiv;
882 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
883}
884
885////////////////////////////////////////////////////////////////////////////////
886/// Checks if the current point is on division boundary
887
889{
890 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
891 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
892 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
893 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
894 Double_t seg = (xt - fStart) / fStep;
895 Double_t diff = seg - Int_t(seg);
896 if (diff > 0.5)
897 diff = 1. - diff;
898 if (diff < 1e-8)
899 return kTRUE;
900 return kFALSE;
901}
902
903////////////////////////////////////////////////////////////////////////////////
904/// get the node division containing the query point
905
907{
909 TGeoNode *node = 0;
910 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
911 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
912 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
913 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
914 Int_t ind = (Int_t)(1. + (xt - fStart) / fStep) - 1;
915 if (dir) {
916 Double_t ttsq = txy * txy + (txz - txy * tyz) * (txz - txy * tyz);
917 Double_t divdirx = 1. / TMath::Sqrt(1. + ttsq);
918 Double_t divdiry = -txy * divdirx;
919 Double_t divdirz = -(txz - txy * tyz) * divdirx;
920 Double_t dot = dir[0] * divdirx + dir[1] * divdiry + dir[2] * divdirz;
921 td.fNextIndex = ind;
922 if (dot > 0)
923 td.fNextIndex++;
924 else
925 td.fNextIndex--;
926 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
927 td.fNextIndex = -1;
928 }
929 if ((ind < 0) || (ind >= fNdivisions))
930 return node;
931 node = GetNodeOffset(ind);
932 cd(ind);
933 return node;
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// Make a copy of this finder. Reflect by Z if required.
938
940{
941 TGeoPatternParaX *finder = new TGeoPatternParaX(*this);
942 if (!reflect)
943 return finder;
944 finder->Reflect();
945 return finder;
946}
947
948////////////////////////////////////////////////////////////////////////////////
949/// Save a primitive as a C++ statement(s) on output stream "out".
950
951void TGeoPatternParaX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
952{
953 Int_t iaxis = 1;
954 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
955}
956
957////////////////////////////////////////////////////////////////////////////////
958/// Return new matrix of type used by this finder.
959
961{
962 if (!IsReflected()) {
963 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
964 matrix->RegisterYourself();
965 return matrix;
966 }
967 TGeoCombiTrans *combi = new TGeoCombiTrans();
968 combi->RegisterYourself();
969 combi->ReflectZ(kTRUE);
970 combi->ReflectZ(kFALSE);
971 return combi;
972}
973
974////////////////////////////////////////////////////////////////////////////////
975/// Fills external matrix with the local one corresponding to the given division
976/// index.
977
979{
980 matrix.Clear();
981 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
982}
983
984//______________________________________________________________________________
985// TGeoPatternParaY - a Y axis divison pattern for PARA shape
986//______________________________________________________________________________
987
988////////////////////////////////////////////////////////////////////////////////
989/// Default constructor
990
992{
993 fTxy = 0;
995}
996////////////////////////////////////////////////////////////////////////////////
997/// constructor
998
1000{
1001 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1002 Double_t dy = ((TGeoPara *)vol->GetShape())->GetY();
1003 fStart = -dy;
1004 fEnd = dy;
1005 fStep = 2 * dy / ndivisions;
1007}
1008////////////////////////////////////////////////////////////////////////////////
1009/// constructor
1010
1012 : TGeoPatternFinder(vol, ndivisions)
1013{
1014 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1015 Double_t dy = ((TGeoPara *)vol->GetShape())->GetY();
1016 fStart = -dy;
1017 fEnd = fStart + ndivisions * step;
1018 fStep = step;
1020}
1021////////////////////////////////////////////////////////////////////////////////
1022/// constructor
1023
1025 : TGeoPatternFinder(vol, ndivisions)
1026{
1027 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1028 fStart = start;
1029 fEnd = end;
1030 fStep = (end - start) / ndivisions;
1032}
1033////////////////////////////////////////////////////////////////////////////////
1034/// copy constructor
1035
1037{
1039}
1040
1041////////////////////////////////////////////////////////////////////////////////
1042/// assignment operator
1043
1045{
1046 if (this != &pf) {
1049 }
1050 return *this;
1051}
1052
1053////////////////////////////////////////////////////////////////////////////////
1054/// Destructor
1055
1057////////////////////////////////////////////////////////////////////////////////
1058/// Update current division index and global matrix to point to a given slice.
1059
1061{
1063 td.fCurrent = idiv;
1064 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1065 td.fMatrix->SetDx(fTxy * dy);
1066 td.fMatrix->SetDy(dy);
1067}
1068
1069////////////////////////////////////////////////////////////////////////////////
1070/// Checks if the current point is on division boundary
1071
1073{
1074 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
1075 Double_t yt = point[1] - tyz * point[2];
1076 Double_t seg = (yt - fStart) / fStep;
1077 Double_t diff = seg - Int_t(seg);
1078 if (diff > 0.5)
1079 diff = 1. - diff;
1080 if (diff < 1e-8)
1081 return kTRUE;
1082 return kFALSE;
1083}
1084
1085////////////////////////////////////////////////////////////////////////////////
1086/// get the node division containing the query point
1087
1089{
1091 TGeoNode *node = 0;
1092 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
1093 Double_t yt = point[1] - tyz * point[2];
1094 Int_t ind = (Int_t)(1. + (yt - fStart) / fStep) - 1;
1095 if (dir) {
1096 Double_t divdiry = 1. / TMath::Sqrt(1. + tyz * tyz);
1097 Double_t divdirz = -tyz * divdiry;
1098 Double_t dot = dir[1] * divdiry + dir[2] * divdirz;
1099 td.fNextIndex = ind;
1100 if (dot > 0)
1101 td.fNextIndex++;
1102 else
1103 td.fNextIndex--;
1104 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1105 td.fNextIndex = -1;
1106 }
1107 if ((ind < 0) || (ind >= fNdivisions))
1108 return node;
1109 node = GetNodeOffset(ind);
1110 cd(ind);
1111 return node;
1112}
1113
1114////////////////////////////////////////////////////////////////////////////////
1115/// Make a copy of this finder. Reflect by Z if required.
1116
1118{
1119 TGeoPatternParaY *finder = new TGeoPatternParaY(*this);
1120 if (!reflect)
1121 return finder;
1122 finder->Reflect();
1123 return finder;
1124}
1125
1126////////////////////////////////////////////////////////////////////////////////
1127/// Save a primitive as a C++ statement(s) on output stream "out".
1128
1129void TGeoPatternParaY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1130{
1131 Int_t iaxis = 2;
1132 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1133}
1134
1135////////////////////////////////////////////////////////////////////////////////
1136/// Return new matrix of type used by this finder.
1137
1139{
1140 if (!IsReflected()) {
1141 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1142 matrix->RegisterYourself();
1143 return matrix;
1144 }
1145 TGeoCombiTrans *combi = new TGeoCombiTrans();
1146 combi->RegisterYourself();
1147 combi->ReflectZ(kTRUE);
1148 combi->ReflectZ(kFALSE);
1149 return combi;
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// Fills external matrix with the local one corresponding to the given division
1154/// index.
1155
1157{
1158 matrix.Clear();
1159 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1160 matrix.SetDx(fTxy * dy);
1161 matrix.SetDy(dy);
1162}
1163
1164//______________________________________________________________________________
1165// TGeoPatternParaZ - a Z axis divison pattern for PARA shape
1166//______________________________________________________________________________
1167
1168////////////////////////////////////////////////////////////////////////////////
1169/// Default constructor
1170
1172{
1173 fTxz = 0;
1174 fTyz = 0;
1176}
1177////////////////////////////////////////////////////////////////////////////////
1178/// constructor
1179
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 = dz;
1187 fStep = 2 * dz / ndivisions;
1189}
1190////////////////////////////////////////////////////////////////////////////////
1191/// constructor
1192
1194 : TGeoPatternFinder(vol, ndivisions)
1195{
1196 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1197 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1198 Double_t dz = ((TGeoPara *)vol->GetShape())->GetZ();
1199 fStart = -dz;
1200 fEnd = fStart + ndivisions * step;
1201 fStep = step;
1203}
1204
1205////////////////////////////////////////////////////////////////////////////////
1206/// constructor
1207
1209 : TGeoPatternFinder(vol, ndivisions)
1210{
1211 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1212 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1213 fStart = start;
1214 fEnd = end;
1215 fStep = (end - start) / ndivisions;
1217}
1218
1219////////////////////////////////////////////////////////////////////////////////
1220/// copy constructor
1221
1223{
1225}
1226
1227////////////////////////////////////////////////////////////////////////////////
1228/// assignment operator
1229
1231{
1232 if (this != &pf) {
1235 }
1236 return *this;
1237}
1238
1239////////////////////////////////////////////////////////////////////////////////
1240/// Destructor
1241
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// Update current division index and global matrix to point to a given slice.
1246
1248{
1250 td.fCurrent = idiv;
1251 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1252 td.fMatrix->SetDx(fTxz * dz);
1253 td.fMatrix->SetDy(fTyz * dz);
1254 td.fMatrix->SetDz((IsReflected()) ? -dz : dz);
1255}
1256
1257////////////////////////////////////////////////////////////////////////////////
1258/// Checks if the current point is on division boundary
1259
1261{
1262 Double_t seg = (point[2] - fStart) / fStep;
1263 Double_t diff = seg - Int_t(seg);
1264 if (diff > 0.5)
1265 diff = 1. - diff;
1266 if (diff < 1e-8)
1267 return kTRUE;
1268 return kFALSE;
1269}
1270
1271////////////////////////////////////////////////////////////////////////////////
1272/// get the node division containing the query point
1273
1275{
1277 TGeoNode *node = 0;
1278 Double_t zt = point[2];
1279 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1280 if (dir) {
1281 td.fNextIndex = ind;
1282 if (dir[2] > 0)
1283 td.fNextIndex++;
1284 else
1285 td.fNextIndex--;
1286 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1287 td.fNextIndex = -1;
1288 }
1289 if ((ind < 0) || (ind >= fNdivisions))
1290 return node;
1291 node = GetNodeOffset(ind);
1292 cd(ind);
1293 return node;
1294}
1295
1296////////////////////////////////////////////////////////////////////////////////
1297/// Make a copy of this finder. Reflect by Z if required.
1298
1300{
1301 TGeoPatternParaZ *finder = new TGeoPatternParaZ(*this);
1302 if (!reflect)
1303 return finder;
1304 finder->Reflect();
1305 return finder;
1306}
1307
1308////////////////////////////////////////////////////////////////////////////////
1309/// Save a primitive as a C++ statement(s) on output stream "out".
1310
1311void TGeoPatternParaZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1312{
1313 Int_t iaxis = 3;
1314 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1315}
1316
1317////////////////////////////////////////////////////////////////////////////////
1318/// Return new matrix of type used by this finder.
1319
1321{
1322 if (!IsReflected()) {
1323 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1324 matrix->RegisterYourself();
1325 return matrix;
1326 }
1327 TGeoCombiTrans *combi = new TGeoCombiTrans();
1328 combi->RegisterYourself();
1329 combi->ReflectZ(kTRUE);
1330 combi->ReflectZ(kFALSE);
1331 return combi;
1332}
1333
1334////////////////////////////////////////////////////////////////////////////////
1335/// Fills external matrix with the local one corresponding to the given division
1336/// index.
1337
1339{
1340 matrix.Clear();
1341 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1342 matrix.SetDx(fTxz * dz);
1343 matrix.SetDy(fTyz * dz);
1344 matrix.SetDz((IsReflected()) ? -dz : dz);
1345}
1346
1347//______________________________________________________________________________
1348// TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
1349//______________________________________________________________________________
1350
1351////////////////////////////////////////////////////////////////////////////////
1352/// Default constructor
1353
1355{
1356 fTxz = 0;
1357 fTyz = 0;
1359}
1360////////////////////////////////////////////////////////////////////////////////
1361/// constructor
1362
1364{
1365 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1366 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1369 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1370 fStart = -dz;
1371 fEnd = dz;
1372 fStep = 2 * dz / ndivisions;
1374}
1375////////////////////////////////////////////////////////////////////////////////
1376/// constructor
1377
1379 : TGeoPatternFinder(vol, ndivisions)
1380{
1381 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1382 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1385 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1386 fStart = -dz;
1387 fEnd = fStart + ndivisions * step;
1388 fStep = step;
1390}
1391////////////////////////////////////////////////////////////////////////////////
1392/// constructor
1393
1395 : TGeoPatternFinder(vol, ndivisions)
1396{
1397 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1398 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1401 fStart = start;
1402 fEnd = end;
1403 fStep = (end - start) / ndivisions;
1405}
1406
1407////////////////////////////////////////////////////////////////////////////////
1408/// copy constructor
1409
1410TGeoPatternTrapZ::TGeoPatternTrapZ(const TGeoPatternTrapZ &pf) : TGeoPatternFinder(pf), fTxz(pf.fTxz), fTyz(pf.fTyz)
1411{
1413}
1414
1415////////////////////////////////////////////////////////////////////////////////
1416/// assignment operator
1417
1419{
1420 if (this != &pf) {
1422 fTxz = pf.fTxz;
1423 fTyz = pf.fTyz;
1425 }
1426 return *this;
1427}
1428
1429////////////////////////////////////////////////////////////////////////////////
1430/// Destructor
1431
1433////////////////////////////////////////////////////////////////////////////////
1434/// Update current division index and global matrix to point to a given slice.
1435
1437{
1439 td.fCurrent = idiv;
1440 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1441 td.fMatrix->SetDx(fTxz * dz);
1442 td.fMatrix->SetDy(fTyz * dz);
1443 td.fMatrix->SetDz((IsReflected()) ? -dz : dz);
1444}
1445
1446////////////////////////////////////////////////////////////////////////////////
1447/// Checks if the current point is on division boundary
1448
1450{
1451 Double_t seg = (point[2] - fStart) / fStep;
1452 Double_t diff = seg - Int_t(seg);
1453 if (diff > 0.5)
1454 diff = 1. - diff;
1455 if (diff < 1e-8)
1456 return kTRUE;
1457 return kFALSE;
1458}
1459
1460////////////////////////////////////////////////////////////////////////////////
1461/// get the node division containing the query point
1462
1464{
1466 TGeoNode *node = 0;
1467 Double_t zt = point[2];
1468 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1469 if (dir) {
1470 td.fNextIndex = ind;
1471 if (dir[2] > 0)
1472 td.fNextIndex++;
1473 else
1474 td.fNextIndex--;
1475 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1476 td.fNextIndex = -1;
1477 }
1478 if ((ind < 0) || (ind >= fNdivisions))
1479 return node;
1480 node = GetNodeOffset(ind);
1481 cd(ind);
1482 return node;
1483}
1484
1485////////////////////////////////////////////////////////////////////////////////
1486/// Make a copy of this finder. Reflect by Z if required.
1487
1489{
1490 TGeoPatternTrapZ *finder = new TGeoPatternTrapZ(*this);
1491 if (!reflect)
1492 return finder;
1493 finder->Reflect();
1494 return finder;
1495}
1496
1497////////////////////////////////////////////////////////////////////////////////
1498/// Save a primitive as a C++ statement(s) on output stream "out".
1499
1500void TGeoPatternTrapZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1501{
1502 Int_t iaxis = 3;
1503 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1504}
1505
1506////////////////////////////////////////////////////////////////////////////////
1507/// Return new matrix of type used by this finder.
1508
1510{
1511 if (!IsReflected()) {
1512 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1513 matrix->RegisterYourself();
1514 return matrix;
1515 }
1516 TGeoCombiTrans *combi = new TGeoCombiTrans();
1517 combi->RegisterYourself();
1518 combi->ReflectZ(kTRUE);
1519 combi->ReflectZ(kFALSE);
1520 return combi;
1521}
1522
1523////////////////////////////////////////////////////////////////////////////////
1524/// Fills external matrix with the local one corresponding to the given division
1525/// index.
1526
1528{
1529 matrix.Clear();
1530 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1531 matrix.SetDx(fTxz * dz);
1532 matrix.SetDy(fTyz * dz);
1533 matrix.SetDz((IsReflected()) ? -dz : dz);
1534}
1535
1536//______________________________________________________________________________
1537// TGeoPatternCylR - a cylindrical R divison pattern
1538//______________________________________________________________________________
1539
1540////////////////////////////////////////////////////////////////////////////////
1541/// Default constructor
1542
1544{
1546}
1547////////////////////////////////////////////////////////////////////////////////
1548/// constructor
1549
1551{
1553}
1554////////////////////////////////////////////////////////////////////////////////
1555/// constructor
1556
1558{
1559 fStep = step;
1561 // compute start, end
1562}
1563////////////////////////////////////////////////////////////////////////////////
1564/// constructor
1565
1567 : TGeoPatternFinder(vol, ndivisions)
1568{
1569 fStart = start;
1570 fEnd = end;
1571 fStep = (end - start) / ndivisions;
1573}
1574////////////////////////////////////////////////////////////////////////////////
1575/// copy constructor
1576
1578{
1580}
1581
1582////////////////////////////////////////////////////////////////////////////////
1583/// assignment operator
1584
1586{
1587 if (this != &pf) {
1590 }
1591 return *this;
1592}
1593
1594////////////////////////////////////////////////////////////////////////////////
1595/// Destructor
1596
1598
1599////////////////////////////////////////////////////////////////////////////////
1600/// Checks if the current point is on division boundary
1601
1603{
1604 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1605 Double_t seg = (r - fStart) / fStep;
1606 Double_t diff = seg - Int_t(seg);
1607 if (diff > 0.5)
1608 diff = 1. - diff;
1609 if (diff < 1e-8)
1610 return kTRUE;
1611 return kFALSE;
1612}
1613
1614////////////////////////////////////////////////////////////////////////////////
1615/// Update current division index and global matrix to point to a given slice.
1616
1618{
1620 td.fCurrent = idiv;
1621}
1622
1623////////////////////////////////////////////////////////////////////////////////
1624/// find the node containing the query point
1625
1627{
1629 if (!td.fMatrix)
1630 td.fMatrix = gGeoIdentity;
1631 TGeoNode *node = 0;
1632 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1633 Int_t ind = (Int_t)(1. + (r - fStart) / fStep) - 1;
1634 if (dir) {
1635 td.fNextIndex = ind;
1636 Double_t dot = point[0] * dir[0] + point[1] * dir[1];
1637 if (dot > 0)
1638 td.fNextIndex++;
1639 else
1640 td.fNextIndex--;
1641 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1642 td.fNextIndex = -1;
1643 }
1644 if ((ind < 0) || (ind >= fNdivisions))
1645 return node;
1646 node = GetNodeOffset(ind);
1647 cd(ind);
1648 return node;
1649}
1650
1651////////////////////////////////////////////////////////////////////////////////
1652/// Make a copy of this finder. Reflect by Z if required.
1653
1655{
1656 TGeoPatternCylR *finder = new TGeoPatternCylR(*this);
1657 if (!reflect)
1658 return finder;
1659 finder->Reflect();
1660 return finder;
1661}
1662
1663////////////////////////////////////////////////////////////////////////////////
1664/// Save a primitive as a C++ statement(s) on output stream "out".
1665
1666void TGeoPatternCylR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1667{
1668 Int_t iaxis = 1;
1669 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1670}
1671
1672////////////////////////////////////////////////////////////////////////////////
1673/// Return new matrix of type used by this finder.
1674
1676{
1677 return gGeoIdentity;
1678}
1679
1680////////////////////////////////////////////////////////////////////////////////
1681/// Fills external matrix with the local one corresponding to the given division
1682/// index.
1683
1685{
1686 matrix.Clear();
1687}
1688
1689//______________________________________________________________________________
1690// TGeoPatternCylPhi - a cylindrical phi divison pattern
1691//______________________________________________________________________________
1692
1693////////////////////////////////////////////////////////////////////////////////
1694/// Default constructor
1695
1697{
1698 fSinCos = 0;
1700}
1701////////////////////////////////////////////////////////////////////////////////
1702/// constructor
1703/// compute step, start, end
1704
1706{
1707 fStart = 0;
1708 fEnd = 0;
1709 fStep = 0;
1710 fSinCos = new Double_t[2 * fNdivisions];
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}
1717////////////////////////////////////////////////////////////////////////////////
1718/// constructor
1719
1721 : TGeoPatternFinder(vol, ndivisions)
1722{
1723 fStep = step;
1724 fSinCos = new Double_t[2 * ndivisions];
1725 for (Int_t i = 0; i < fNdivisions; i++) {
1726 fSinCos[2 * i] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1727 fSinCos[2 * i + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1728 }
1730 // compute start, end
1731}
1732////////////////////////////////////////////////////////////////////////////////
1733/// constructor
1734
1736 : TGeoPatternFinder(vol, ndivisions)
1737{
1738 fStart = start;
1739 if (fStart < 0)
1740 fStart += 360;
1741 fEnd = end;
1742 if (fEnd < 0)
1743 fEnd += 360;
1744 if ((end - start) < 0)
1745 fStep = (end - start + 360) / ndivisions;
1746 else
1747 fStep = (end - start) / ndivisions;
1748 fSinCos = new Double_t[2 * ndivisions];
1749 for (Int_t idiv = 0; idiv < ndivisions; idiv++) {
1750 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1751 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1752 }
1754}
1755////////////////////////////////////////////////////////////////////////////////
1756/// Destructor
1757
1759{
1760 if (fSinCos)
1761 delete[] fSinCos;
1762}
1763////////////////////////////////////////////////////////////////////////////////
1764/// Update current division index and global matrix to point to a given slice.
1765
1767{
1769 td.fCurrent = idiv;
1770 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
1771}
1772
1773////////////////////////////////////////////////////////////////////////////////
1774/// Checks if the current point is on division boundary
1775
1777{
1778 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1779 if (phi < 0)
1780 phi += 360;
1781 Double_t ddp = phi - fStart;
1782 if (ddp < 0)
1783 ddp += 360;
1784 Double_t seg = ddp / fStep;
1785 Double_t diff = seg - Int_t(seg);
1786 if (diff > 0.5)
1787 diff = 1. - diff;
1788 if (diff < 1e-8)
1789 return kTRUE;
1790 return kFALSE;
1791}
1792
1793////////////////////////////////////////////////////////////////////////////////
1794/// find the node containing the query point
1795
1797{
1799 TGeoNode *node = 0;
1800 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1801 if (phi < 0)
1802 phi += 360;
1803 // Double_t dphi = fStep*fNdivisions;
1804 Double_t ddp = phi - fStart;
1805 if (ddp < 0)
1806 ddp += 360;
1807 // if (ddp>360) ddp-=360;
1808 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
1809 if (dir) {
1810 td.fNextIndex = ind;
1811 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
1812 if (dot > 0)
1813 td.fNextIndex++;
1814 else
1815 td.fNextIndex--;
1816 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1817 td.fNextIndex = -1;
1818 }
1819 if ((ind < 0) || (ind >= fNdivisions))
1820 return node;
1821 node = GetNodeOffset(ind);
1822 cd(ind);
1823 return node;
1824}
1825
1826////////////////////////////////////////////////////////////////////////////////
1827/// Make a copy of this finder. Reflect by Z if required.
1828
1830{
1831 TGeoPatternCylPhi *finder = new TGeoPatternCylPhi(*this);
1832 if (!reflect)
1833 return finder;
1834 finder->Reflect();
1835 return finder;
1836}
1837
1838////////////////////////////////////////////////////////////////////////////////
1839/// Save a primitive as a C++ statement(s) on output stream "out".
1840
1841void TGeoPatternCylPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1842{
1843 Int_t iaxis = 2;
1844 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1845}
1846
1847////////////////////////////////////////////////////////////////////////////////
1848/// Stream an object of class TGeoVolume.
1849
1851{
1852 if (R__b.IsReading()) {
1854 if (fNdivisions) {
1855 fSinCos = new Double_t[2 * fNdivisions];
1856 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
1857 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1858 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1859 }
1860 }
1861 } else {
1863 }
1864}
1865
1866////////////////////////////////////////////////////////////////////////////////
1867/// Return new matrix of type used by this finder.
1868
1870{
1871 if (!IsReflected()) {
1872 TGeoRotation *matrix = new TGeoRotation();
1873 matrix->RegisterYourself();
1874 return matrix;
1875 }
1876 TGeoRotation *rot = new TGeoRotation();
1877 rot->RegisterYourself();
1878 rot->ReflectZ(kTRUE);
1879 rot->ReflectZ(kFALSE);
1880 return rot;
1881}
1882
1883////////////////////////////////////////////////////////////////////////////////
1884/// Fills external matrix with the local one corresponding to the given division
1885/// index.
1886
1888{
1889 matrix.Clear();
1890 matrix.FastRotZ(&fSinCos[2 * idiv]);
1891}
1892
1893//______________________________________________________________________________
1894// TGeoPatternSphR - a spherical R divison pattern
1895//______________________________________________________________________________
1896
1897////////////////////////////////////////////////////////////////////////////////
1898/// Default constructor
1899
1901{
1903}
1904////////////////////////////////////////////////////////////////////////////////
1905/// constructor
1906/// compute step, start, end
1907
1909{
1911}
1912////////////////////////////////////////////////////////////////////////////////
1913/// constructor
1914
1916{
1917 fStep = step;
1919 // compute start, end
1920}
1921////////////////////////////////////////////////////////////////////////////////
1922/// constructor
1923
1925 : TGeoPatternFinder(vol, ndivisions)
1926{
1927 fStart = start;
1928 fEnd = end;
1929 fStep = (end - start) / ndivisions;
1931}
1932////////////////////////////////////////////////////////////////////////////////
1933/// copy constructor
1934
1936{
1938}
1939
1940////////////////////////////////////////////////////////////////////////////////
1941/// assignment operator
1942
1944{
1945 if (this != &pf) {
1948 }
1949 return *this;
1950}
1951
1952////////////////////////////////////////////////////////////////////////////////
1953/// Destructor
1954
1956////////////////////////////////////////////////////////////////////////////////
1957/// Update current division index and global matrix to point to a given slice.
1958
1960{
1962 td.fCurrent = idiv;
1963}
1964////////////////////////////////////////////////////////////////////////////////
1965/// find the node containing the query point
1966
1968{
1969 return 0;
1970}
1971
1972////////////////////////////////////////////////////////////////////////////////
1973/// Make a copy of this finder. Reflect by Z if required.
1974
1976{
1977 TGeoPatternSphR *finder = new TGeoPatternSphR(*this);
1978 return finder;
1979}
1980
1981////////////////////////////////////////////////////////////////////////////////
1982/// Save a primitive as a C++ statement(s) on output stream "out".
1983
1984void TGeoPatternSphR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1985{
1986 Int_t iaxis = 1;
1987 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1988}
1989
1990////////////////////////////////////////////////////////////////////////////////
1991/// Return new matrix of type used by this finder.
1992
1994{
1995 return gGeoIdentity;
1996}
1997
1998////////////////////////////////////////////////////////////////////////////////
1999/// Fills external matrix with the local one corresponding to the given division
2000/// index.
2001
2003{
2004 matrix.Clear();
2005}
2006
2007//______________________________________________________________________________
2008// TGeoPatternSphTheta - a spherical theta divison pattern
2009//______________________________________________________________________________
2010
2011////////////////////////////////////////////////////////////////////////////////
2012/// Default constructor
2013
2015{
2017}
2018////////////////////////////////////////////////////////////////////////////////
2019/// constructor
2020/// compute step, start, end
2021
2023{
2025}
2026////////////////////////////////////////////////////////////////////////////////
2027/// constructor
2028
2030 : TGeoPatternFinder(vol, ndivisions)
2031{
2032 fStep = step;
2034 // compute start, end
2035}
2036////////////////////////////////////////////////////////////////////////////////
2037/// constructor
2038
2040 : TGeoPatternFinder(vol, ndivisions)
2041{
2042 fStart = start;
2043 fEnd = end;
2044 fStep = (end - start) / ndivisions;
2046}
2047////////////////////////////////////////////////////////////////////////////////
2048/// copy constructor
2049
2051{
2053}
2054////////////////////////////////////////////////////////////////////////////////
2055/// assignment operator
2056
2058{
2059 if (this != &pf) {
2062 }
2063 return *this;
2064}
2065////////////////////////////////////////////////////////////////////////////////
2066/// Destructor
2067
2069////////////////////////////////////////////////////////////////////////////////
2070/// Update current division index and global matrix to point to a given slice.
2071
2073{
2075 td.fCurrent = idiv;
2076}
2077////////////////////////////////////////////////////////////////////////////////
2078/// find the node containing the query point
2079
2081{
2082 return 0;
2083}
2084
2085////////////////////////////////////////////////////////////////////////////////
2086/// Make a copy of this finder. Reflect by Z if required.
2087
2089{
2090 TGeoPatternSphTheta *finder = new TGeoPatternSphTheta(*this);
2091 return finder;
2092}
2093
2094////////////////////////////////////////////////////////////////////////////////
2095/// Save a primitive as a C++ statement(s) on output stream "out".
2096
2097void TGeoPatternSphTheta::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2098{
2099 Int_t iaxis = 2;
2100 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2101}
2102
2103////////////////////////////////////////////////////////////////////////////////
2104/// Return new matrix of type used by this finder.
2105
2107{
2108 return gGeoIdentity;
2109}
2110
2111////////////////////////////////////////////////////////////////////////////////
2112/// Fills external matrix with the local one corresponding to the given division
2113/// index.
2114
2116{
2117 matrix.Clear();
2118}
2119
2120//______________________________________________________________________________
2121// TGeoPatternSphPhi - a spherical phi divison pattern
2122//______________________________________________________________________________
2123
2124////////////////////////////////////////////////////////////////////////////////
2125/// Default constructor
2126
2128{
2129 fSinCos = 0;
2131}
2132////////////////////////////////////////////////////////////////////////////////
2133/// constructor
2134/// compute step, start, end
2135
2137{
2138 fStart = 0;
2139 fEnd = 360.;
2140 fStep = 360. / ndivisions;
2141 CreateSinCos();
2143}
2144////////////////////////////////////////////////////////////////////////////////
2145/// constructor
2146/// compute start, end
2147
2149 : TGeoPatternFinder(vol, ndivisions)
2150{
2151 fStep = step;
2152 CreateSinCos();
2154}
2155////////////////////////////////////////////////////////////////////////////////
2156/// constructor
2157/// compute step
2158
2160 : TGeoPatternFinder(vol, ndivisions)
2161{
2162 fStart = start;
2163 if (fStart < 0)
2164 fStart += 360;
2165 fEnd = end;
2166 if (fEnd < 0)
2167 fEnd += 360;
2168 if ((end - start) < 0)
2169 fStep = (end - start + 360) / ndivisions;
2170 else
2171 fStep = (end - start) / ndivisions;
2172 CreateSinCos();
2174}
2175
2176////////////////////////////////////////////////////////////////////////////////
2177/// Destructor
2178
2180{
2181 delete[] fSinCos;
2182}
2183
2184////////////////////////////////////////////////////////////////////////////////
2185/// Create the sincos table if it does not exist
2186
2188{
2189 fSinCos = new Double_t[2 * fNdivisions];
2190 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
2191 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2192 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2193 }
2194 return fSinCos;
2195}
2196
2197////////////////////////////////////////////////////////////////////////////////
2198/// Update current division index and global matrix to point to a given slice.
2199
2201{
2203 td.fCurrent = idiv;
2204 if (!fSinCos)
2205 CreateSinCos();
2206 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
2207}
2208
2209////////////////////////////////////////////////////////////////////////////////
2210/// Checks if the current point is on division boundary
2211
2213{
2214 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2215 if (phi < 0)
2216 phi += 360;
2217 Double_t ddp = phi - fStart;
2218 if (ddp < 0)
2219 ddp += 360;
2220 Double_t seg = ddp / fStep;
2221 Double_t diff = seg - Int_t(seg);
2222 if (diff > 0.5)
2223 diff = 1. - diff;
2224 if (diff < 1e-8)
2225 return kTRUE;
2226 return kFALSE;
2227}
2228////////////////////////////////////////////////////////////////////////////////
2229/// find the node containing the query point
2230
2232{
2234 TGeoNode *node = 0;
2235 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2236 if (phi < 0)
2237 phi += 360;
2238 // Double_t dphi = fStep*fNdivisions;
2239 Double_t ddp = phi - fStart;
2240 if (ddp < 0)
2241 ddp += 360;
2242 // if (ddp>360) ddp-=360;
2243 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
2244 if (dir) {
2245 td.fNextIndex = ind;
2246 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
2247 if (dot > 0)
2248 td.fNextIndex++;
2249 else
2250 td.fNextIndex--;
2251 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
2252 td.fNextIndex = -1;
2253 }
2254 if ((ind < 0) || (ind >= fNdivisions))
2255 return node;
2256 node = GetNodeOffset(ind);
2257 cd(ind);
2258 return node;
2259}
2260////////////////////////////////////////////////////////////////////////////////
2261/// Make a copy of this finder. Reflect by Z if required.
2262
2264{
2266 if (!reflect)
2267 return finder;
2268 finder->Reflect();
2269 return finder;
2270}
2271
2272////////////////////////////////////////////////////////////////////////////////
2273/// Save a primitive as a C++ statement(s) on output stream "out".
2274
2275void TGeoPatternSphPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2276{
2277 Int_t iaxis = 2;
2278 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2279}
2280////////////////////////////////////////////////////////////////////////////////
2281/// Return new matrix of type used by this finder.
2282
2284{
2285 if (!IsReflected()) {
2286 TGeoRotation *matrix = new TGeoRotation();
2287 matrix->RegisterYourself();
2288 return matrix;
2289 }
2290 TGeoRotation *rot = new TGeoRotation();
2291 rot->RegisterYourself();
2292 rot->ReflectZ(kTRUE);
2293 rot->ReflectZ(kFALSE);
2294 return rot;
2295}
2296////////////////////////////////////////////////////////////////////////////////
2297/// Fills external matrix with the local one corresponding to the given division
2298/// index.
2299
2301{
2302 if (!fSinCos)
2303 ((TGeoPatternSphPhi *)this)->CreateSinCos();
2304 matrix.Clear();
2305 matrix.FastRotZ(&fSinCos[2 * idiv]);
2306}
2307
2308//______________________________________________________________________________
2309// TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
2310//______________________________________________________________________________
2311
2312////////////////////////////////////////////////////////////////////////////////
2313/// Default constructor
2314
2316{
2317 fNrows = 0;
2318 fAxisOnRows = 0;
2319 fNdivisions = 0;
2320 fStart = 0;
2322}
2323////////////////////////////////////////////////////////////////////////////////
2324/// Default constructor
2325
2327{
2328 fNrows = nrows;
2329 fAxisOnRows = 0;
2330 fNdivisions = 0;
2331 fStart = 0;
2333 // compute everything else
2334}
2335////////////////////////////////////////////////////////////////////////////////
2336/// copy constructor
2337
2339 : TGeoPatternFinder(pfh),
2340 fNrows(pfh.fNrows),
2341 fAxisOnRows(pfh.fAxisOnRows),
2342 fNdivisions(pfh.fNdivisions),
2343 fStart(pfh.fStart)
2344{
2346}
2347
2348////////////////////////////////////////////////////////////////////////////////
2349/// assignment operator
2350
2352{
2353 if (this != &pfh) {
2355 fNrows = pfh.fNrows;
2358 fStart = pfh.fStart;
2360 }
2361 return *this;
2362}
2363////////////////////////////////////////////////////////////////////////////////
2364/// destructor
2365
2367////////////////////////////////////////////////////////////////////////////////
2368/// Update current division index and global matrix to point to a given slice.
2369
2371{
2373 td.fCurrent = idiv;
2374}
2375////////////////////////////////////////////////////////////////////////////////
2376/// find the node containing the query point
2377
2379{
2380 return 0;
2381}
2382
2383////////////////////////////////////////////////////////////////////////////////
2384/// Return new matrix of type used by this finder.
2385
2387{
2388 return gGeoIdentity;
2389}
2390
2391////////////////////////////////////////////////////////////////////////////////
2392/// Fills external matrix with the local one corresponding to the given division
2393/// index.
2394
2396{
2397 matrix.Clear();
2398}
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
long long Long64_t
Definition RtypesCore.h:80
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
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
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition TGeoArb8.h:17
Box class.
Definition TGeoBBox.h:17
Class describing rotation + translation.
Definition TGeoMatrix.h:317
void RegisterYourself() override
Register the matrix in the current manager, which will become the owner.
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to XY.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
void SetDz(Double_t dz) override
Definition TGeoMatrix.h:506
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
void SetDy(Double_t dy) override
Definition TGeoMatrix.h:501
void Clear(Option_t *option="") override
clear the data for this matrix
void SetDx(Double_t dx) override
Definition TGeoMatrix.h:496
static Int_t ThreadId()
Translates the current thread id to an ordinal number.
Geometrical transformation package.
Definition TGeoMatrix.h:38
virtual void SetDz(Double_t)
Definition TGeoMatrix.h:101
virtual void SetDy(Double_t)
Definition TGeoMatrix.h:100
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
virtual void SetDx(Double_t)
Definition TGeoMatrix.h:99
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
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.
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.
ThreadData_t & GetThreadData() const
virtual void cd(Int_t)
void Reflect(Bool_t flag=kTRUE)
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
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
~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
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
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.
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.
~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.
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
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)
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.
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
void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE) override
Multiply by a reflection respect to XY.
static Double_t Big()
Definition TGeoShape.h:87
static Double_t Tolerance()
Definition TGeoShape.h:90
Class describing translations.
Definition TGeoMatrix.h:116
A general trapezoid.
Definition TGeoArb8.h:96
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)
TObject assignment operator.
Definition TObject.h:296
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
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:646
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:79
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:662
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:594
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:588
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Definition TMath.h:600
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition TMath.h:72
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Int_t fNextIndex
current division element