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////////////////////////////////////////////////////////////////////////////////
56/// Constructor.
57
59 fMatrix(0), fCurrent(-1), fNextIndex(-1)
60{
61}
62
63////////////////////////////////////////////////////////////////////////////////
64/// Destructor.
65
67{
68// if (fMatrix != gGeoIdentity) delete fMatrix;
69}
70
71////////////////////////////////////////////////////////////////////////////////
72
74{
76 return *fThreadData[tid];
77}
78
79////////////////////////////////////////////////////////////////////////////////
80
82{
83 std::lock_guard<std::mutex> guard(fMutex);
84 std::vector<ThreadData_t*>::iterator i = fThreadData.begin();
85 while (i != fThreadData.end())
86 {
87 delete *i;
88 ++i;
89 }
90 fThreadData.clear();
91 fThreadSize = 0;
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// Create thread data for n threads max.
96
98{
99 std::lock_guard<std::mutex> guard(fMutex);
100 fThreadData.resize(nthreads);
101 fThreadSize = nthreads;
102 for (Int_t tid=0; tid<nthreads; tid++) {
103 if (fThreadData[tid] == 0) {
104 fThreadData[tid] = new ThreadData_t;
106 }
107 }
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Default constructor
112
114{
115 fNdivisions = 0;
116 fDivIndex = 0;
117 fStep = 0;
118 fStart = 0;
119 fEnd = 0;
120 fVolume = 0;
121 fThreadSize = 0;
122}
123
124////////////////////////////////////////////////////////////////////////////////
125/// Default constructor
126
128{
129 fVolume = vol;
130 fNdivisions = ndiv;
131 fDivIndex = 0;
132 fStep = 0;
133 fStart = 0;
134 fEnd = 0;
135 fThreadSize = 0;
136}
137
138////////////////////////////////////////////////////////////////////////////////
139///copy constructor
140
142 TObject(pf),
143 fStep(pf.fStep),
144 fStart(pf.fStart),
145 fEnd(pf.fEnd),
148 fVolume(pf.fVolume)
149{
150}
151
152////////////////////////////////////////////////////////////////////////////////
153///assignment operator
154
156{
157 if(this!=&pf) {
159 fStep=pf.fStep;
160 fStart=pf.fStart;
161 fEnd=pf.fEnd;
164 fVolume=pf.fVolume;
165 }
166 return *this;
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Destructor
171
173{
175}
176
177////////////////////////////////////////////////////////////////////////////////
178/// Return current index.
179
181{
182 return GetThreadData().fCurrent;
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Return current matrix.
187
189{
190 return GetThreadData().fMatrix;
191}
192
193////////////////////////////////////////////////////////////////////////////////
194/// Get index of next division.
195
197{
198 return GetThreadData().fNextIndex;
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Set index of next division.
203
205{
206 GetThreadData().fNextIndex = index;
207}
208
209////////////////////////////////////////////////////////////////////////////////
210/// Make next node (if any) current.
211
213{
215 if (td.fNextIndex < 0) return NULL;
216 cd(td.fNextIndex);
217 return GetNodeOffset(td.fCurrent);
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Set division range. Use this method only when dividing an assembly.
222
224{
225 fStart = start;
226 fEnd = fStart + ndivisions*step;
227 fStep = step;
228 fNdivisions = ndivisions;
229}
230
231//______________________________________________________________________________
232// TGeoPatternX - a X axis divison pattern
233//______________________________________________________________________________
234
235////////////////////////////////////////////////////////////////////////////////
236/// Default constructor
237
239{
241}
242
243////////////////////////////////////////////////////////////////////////////////
244/// constructor
245
247 :TGeoPatternFinder(vol, ndivisions)
248{
249 Double_t dx = ((TGeoBBox*)vol->GetShape())->GetDX();
250 fStart = -dx;
251 fEnd = dx;
252 fStep = 2*dx/ndivisions;
254}
255
256////////////////////////////////////////////////////////////////////////////////
257/// constructor
258
260 :TGeoPatternFinder(vol, ndivisions)
261{
262 Double_t dx = ((TGeoBBox*)vol->GetShape())->GetDX();
263 fStart = -dx;
264 fEnd = fStart + ndivisions*step;
265 fStep = step;
267}
268
269////////////////////////////////////////////////////////////////////////////////
270/// constructor
271
273 :TGeoPatternFinder(vol, ndivisions)
274{
275 fStart = start;
276 fEnd = end;
277 fStep = (end - start)/ndivisions;
279}
280
281////////////////////////////////////////////////////////////////////////////////
282///copy constructor
283
286{
288}
289
290////////////////////////////////////////////////////////////////////////////////
291///assignment operator
292
294{
295 if(this!=&pf) {
298 }
299 return *this;
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// Destructor
304
306{
307}
308
309////////////////////////////////////////////////////////////////////////////////
310/// Update current division index and global matrix to point to a given slice.
311
313{
315 td.fCurrent=idiv;
316 td.fMatrix->SetDx(fStart+idiv*fStep+0.5*fStep);
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Return new matrix of type used by this finder.
321
323{
324 if (!IsReflected()) {
325 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
326 matrix->RegisterYourself();
327 return matrix;
328 }
329 TGeoCombiTrans *combi = new TGeoCombiTrans();
330 combi->RegisterYourself();
331 combi->ReflectZ(kTRUE);
332 combi->ReflectZ(kFALSE);
333 return combi;
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Fills external matrix with the local one corresponding to the given division
338/// index.
339
341{
342 matrix.Clear();
343 matrix.SetDx(fStart+idiv*fStep+0.5*fStep);
344}
345
346////////////////////////////////////////////////////////////////////////////////
347/// Checks if the current point is on division boundary
348
350{
351 Double_t seg = (point[0]-fStart)/fStep;
352 Double_t diff = seg - Long64_t(seg);
353 if (diff>0.5) diff = 1.-diff;
354 if (diff<1e-8) return kTRUE;
355 return kFALSE;
356}
357
358////////////////////////////////////////////////////////////////////////////////
359/// Find the cell corresponding to point and next cell along dir (if asked)
360
362{
364 TGeoNode *node = 0;
365 Int_t ind = (Int_t)(1.+(point[0]-fStart)/fStep) - 1;
366 if (dir) {
367 td.fNextIndex = ind;
368 if (dir[0]>0) td.fNextIndex++;
369 else td.fNextIndex--;
370 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
371 }
372 if ((ind<0) || (ind>=fNdivisions)) return node;
373 node = GetNodeOffset(ind);
374 cd(ind);
375 return node;
376}
377
378////////////////////////////////////////////////////////////////////////////////
379/// Compute distance to next division layer returning the index of next section.
380/// Point is in the frame of the divided volume.
381
383{
385 indnext = -1;
386 Double_t dist = TGeoShape::Big();
387 if (TMath::Abs(dir[0])<TGeoShape::Tolerance()) return dist;
388 if (td.fCurrent<0) {
389 Error("FindNextBoundary", "Must call FindNode first");
390 return dist;
391 }
392 Int_t inc = (dir[0]>0)?1:0;
393 dist = (fStep*(td.fCurrent+inc)-point[0])/dir[0];
394 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
395 if (!inc) 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) return finder;
407 finder->Reflect();
408 return finder;
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Save a primitive as a C++ statement(s) on output stream "out".
413
414void TGeoPatternX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
415{
416 Int_t iaxis = 1;
417 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
418}
419
420//______________________________________________________________________________
421// TGeoPatternY - a Y axis divison pattern
422//______________________________________________________________________________
423
424
425////////////////////////////////////////////////////////////////////////////////
426/// Default constructor
427
429{
431}
432
433////////////////////////////////////////////////////////////////////////////////
434/// constructor
435
437 :TGeoPatternFinder(vol, ndivisions)
438{
439 Double_t dy = ((TGeoBBox*)vol->GetShape())->GetDY();
440 fStart = -dy;
441 fEnd = dy;
442 fStep = 2*dy/ndivisions;
444}
445
446////////////////////////////////////////////////////////////////////////////////
447/// constructor
448
450 :TGeoPatternFinder(vol, ndivisions)
451{
452 Double_t dy = ((TGeoBBox*)vol->GetShape())->GetDY();
453 fStart = -dy;
454 fEnd = fStart + ndivisions*step;
455 fStep = step;
457}
458
459////////////////////////////////////////////////////////////////////////////////
460/// constructor
461
463 :TGeoPatternFinder(vol, ndivisions)
464{
465 fStart = start;
466 fEnd = end;
467 fStep = (end - start)/ndivisions;
469}
470
471////////////////////////////////////////////////////////////////////////////////
472///copy constructor
473
476{
478}
479
480////////////////////////////////////////////////////////////////////////////////
481///assignment operator
482
484{
485 if(this!=&pf) {
488 }
489 return *this;
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// Destructor
494
496{
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Update current division index and global matrix to point to a given slice.
501
503{
505 td.fCurrent=idiv;
506 td.fMatrix->SetDy(fStart+idiv*fStep+0.5*fStep);
507}
508
509////////////////////////////////////////////////////////////////////////////////
510/// Return new matrix of type used by this finder.
511
513{
514 if (!IsReflected()) {
515 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
516 matrix->RegisterYourself();
517 return matrix;
518 }
519 TGeoCombiTrans *combi = new TGeoCombiTrans();
520 combi->RegisterYourself();
521 combi->ReflectZ(kTRUE);
522 combi->ReflectZ(kFALSE);
523 return combi;
524}
525
526////////////////////////////////////////////////////////////////////////////////
527/// Fills external matrix with the local one corresponding to the given division
528/// index.
529
531{
532 matrix.Clear();
533 matrix.SetDy(fStart+idiv*fStep+0.5*fStep);
534}
535
536////////////////////////////////////////////////////////////////////////////////
537/// Checks if the current point is on division boundary
538
540{
541 Double_t seg = (point[1]-fStart)/fStep;
542 Double_t diff = seg - Int_t(seg);
543 if (diff>0.5) diff = 1.-diff;
544 if (diff<1e-8) return kTRUE;
545 return kFALSE;
546}
547
548////////////////////////////////////////////////////////////////////////////////
549/// Find the cell corresponding to point and next cell along dir (if asked)
550
552{
554 TGeoNode *node = 0;
555 Int_t ind = (Int_t)(1.+(point[1]-fStart)/fStep) - 1;
556 if (dir) {
557 td.fNextIndex = ind;
558 if (dir[1]>0) td.fNextIndex++;
559 else td.fNextIndex--;
560 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
561 }
562 if ((ind<0) || (ind>=fNdivisions)) return node;
563 node = GetNodeOffset(ind);
564 cd(ind);
565 return node;
566}
567
568////////////////////////////////////////////////////////////////////////////////
569/// Compute distance to next division layer returning the index of next section.
570/// Point is in the frame of the divided volume.
571
573{
575 indnext = -1;
576 Double_t dist = TGeoShape::Big();
577 if (TMath::Abs(dir[1])<TGeoShape::Tolerance()) return dist;
578 if (td.fCurrent<0) {
579 Error("FindNextBoundary", "Must call FindNode first");
580 return dist;
581 }
582 Int_t inc = (dir[1]>0)?1:0;
583 dist = (fStep*(td.fCurrent+inc)-point[1])/dir[1];
584 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
585 if (!inc) inc = -1;
586 indnext = td.fCurrent+inc;
587 return dist;
588}
589
590////////////////////////////////////////////////////////////////////////////////
591/// Make a copy of this finder. Reflect by Z if required.
592
594{
595 TGeoPatternY *finder = new TGeoPatternY(*this);
596 if (!reflect) return finder;
597 finder->Reflect();
598 return finder;
599}
600
601////////////////////////////////////////////////////////////////////////////////
602/// Save a primitive as a C++ statement(s) on output stream "out".
603
604void TGeoPatternY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
605{
606 Int_t iaxis = 2;
607 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
608}
609
610//______________________________________________________________________________
611// TGeoPatternZ - a Z axis divison pattern
612//______________________________________________________________________________
613
614
615////////////////////////////////////////////////////////////////////////////////
616/// Default constructor
617
619{
621}
622////////////////////////////////////////////////////////////////////////////////
623/// constructor
624
626 :TGeoPatternFinder(vol, ndivisions)
627{
628 Double_t dz = ((TGeoBBox*)vol->GetShape())->GetDZ();
629 fStart = -dz;
630 fEnd = dz;
631 fStep = 2*dz/ndivisions;
633}
634////////////////////////////////////////////////////////////////////////////////
635/// constructor
636
638 :TGeoPatternFinder(vol, ndivisions)
639{
640 Double_t dz = ((TGeoBBox*)vol->GetShape())->GetDZ();
641 fStart = -dz;
642 fEnd = fStart + ndivisions*step;
643 fStep = step;
645}
646////////////////////////////////////////////////////////////////////////////////
647/// constructor
648
650 :TGeoPatternFinder(vol, ndivisions)
651{
652 fStart = start;
653 fEnd = end;
654 fStep = (end - start)/ndivisions;
656}
657
658////////////////////////////////////////////////////////////////////////////////
659///copy constructor
660
663{
665}
666
667////////////////////////////////////////////////////////////////////////////////
668///assignment operator
669
671{
672 if(this!=&pf) {
675 }
676 return *this;
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// Destructor
681
683{
684}
685////////////////////////////////////////////////////////////////////////////////
686/// Update current division index and global matrix to point to a given slice.
687
689{
691 td.fCurrent=idiv;
692 td.fMatrix->SetDz(((IsReflected())?-1.:1.)*(fStart+idiv*fStep+0.5*fStep));
693}
694
695////////////////////////////////////////////////////////////////////////////////
696/// Return new matrix of type used by this finder.
697
699{
700 if (!IsReflected()) {
701 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
702 matrix->RegisterYourself();
703 return matrix;
704 }
705 TGeoCombiTrans *combi = new TGeoCombiTrans();
706 combi->RegisterYourself();
707 combi->ReflectZ(kTRUE);
708 combi->ReflectZ(kFALSE);
709 return combi;
710}
711
712////////////////////////////////////////////////////////////////////////////////
713/// Fills external matrix with the local one corresponding to the given division
714/// index.
715
717{
718 matrix.Clear();
719 matrix.SetDz(((IsReflected())?-1.:1.)*(fStart+idiv*fStep+0.5*fStep));
720}
721
722////////////////////////////////////////////////////////////////////////////////
723/// Checks if the current point is on division boundary
724
726{
727 Double_t seg = (point[2]-fStart)/fStep;
728 Double_t diff = seg - Int_t(seg);
729 if (diff>0.5) diff = 1.-diff;
730 if (diff<1e-8) return kTRUE;
731 return kFALSE;
732}
733
734////////////////////////////////////////////////////////////////////////////////
735/// Find the cell corresponding to point and next cell along dir (if asked)
736
738{
740 TGeoNode *node = 0;
741 Int_t ind = (Int_t)(1.+(point[2]-fStart)/fStep) - 1;
742 if (dir) {
743 td.fNextIndex = ind;
744 if (dir[2]>0) td.fNextIndex++;
745 else td.fNextIndex--;
746 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
747 }
748 if ((ind<0) || (ind>=fNdivisions)) return node;
749 node = GetNodeOffset(ind);
750 cd(ind);
751 return node;
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Compute distance to next division layer returning the index of next section.
756/// Point is in the frame of the divided volume.
757
759{
760 indnext = -1;
762 Double_t dist = TGeoShape::Big();
763 if (TMath::Abs(dir[2])<TGeoShape::Tolerance()) return dist;
764 if (td.fCurrent<0) {
765 Error("FindNextBoundary", "Must call FindNode first");
766 return dist;
767 }
768 Int_t inc = (dir[2]>0)?1:0;
769 dist = (fStep*(td.fCurrent+inc)-point[2])/dir[2];
770 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
771 if (!inc) inc = -1;
772 indnext = td.fCurrent+inc;
773 return dist;
774}
775
776////////////////////////////////////////////////////////////////////////////////
777/// Make a copy of this finder. Reflect by Z if required.
778
780{
781 TGeoPatternZ *finder = new TGeoPatternZ(*this);
782 if (!reflect) return finder;
783 finder->Reflect();
784 return finder;
785}
786
787////////////////////////////////////////////////////////////////////////////////
788/// Save a primitive as a C++ statement(s) on output stream "out".
789
790void TGeoPatternZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
791{
792 Int_t iaxis = 3;
793 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
794}
795
796//______________________________________________________________________________
797// TGeoPatternParaX - a X axis divison pattern for PARA shape
798//______________________________________________________________________________
799
800////////////////////////////////////////////////////////////////////////////////
801/// Default constructor
802
804{
806}
807////////////////////////////////////////////////////////////////////////////////
808/// constructor
809
811 :TGeoPatternFinder(vol, ndivisions)
812{
813 Double_t dx = ((TGeoPara*)vol->GetShape())->GetX();
814 fStart = -dx;
815 fEnd = dx;
816 fStep = 2*dx/ndivisions;
818}
819////////////////////////////////////////////////////////////////////////////////
820/// constructor
821
823 :TGeoPatternFinder(vol, ndivisions)
824{
825 Double_t dx = ((TGeoPara*)vol->GetShape())->GetX();
826 fStart = -dx;
827 fEnd = fStart + ndivisions*step;
828 fStep = step;
830}
831////////////////////////////////////////////////////////////////////////////////
832/// constructor
833
835 :TGeoPatternFinder(vol, ndivisions)
836{
837 fStart = start;
838 fEnd = end;
839 fStep = (end - start)/ndivisions;
841}
842
843////////////////////////////////////////////////////////////////////////////////
844///copy constructor
845
848{
850}
851
852////////////////////////////////////////////////////////////////////////////////
853///assignment operator
854
856{
857 if(this!=&pf) {
860 }
861 return *this;
862}
863
864////////////////////////////////////////////////////////////////////////////////
865/// Destructor
866
868{
869}
870////////////////////////////////////////////////////////////////////////////////
871/// Update current division index and global matrix to point to a given slice.
872
874{
876 td.fCurrent=idiv;
877 td.fMatrix->SetDx(fStart+idiv*fStep+0.5*fStep);
878}
879
880////////////////////////////////////////////////////////////////////////////////
881/// Checks if the current point is on division boundary
882
884{
885 Double_t txy = ((TGeoPara*)fVolume->GetShape())->GetTxy();
886 Double_t txz = ((TGeoPara*)fVolume->GetShape())->GetTxz();
887 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
888 Double_t xt = point[0]-txz*point[2]-txy*(point[1]-tyz*point[2]);
889 Double_t seg = (xt-fStart)/fStep;
890 Double_t diff = seg - Int_t(seg);
891 if (diff>0.5) diff = 1.-diff;
892 if (diff<1e-8) return kTRUE;
893 return kFALSE;
894}
895
896////////////////////////////////////////////////////////////////////////////////
897/// get the node division containing the query point
898
900{
902 TGeoNode *node = 0;
903 Double_t txy = ((TGeoPara*)fVolume->GetShape())->GetTxy();
904 Double_t txz = ((TGeoPara*)fVolume->GetShape())->GetTxz();
905 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
906 Double_t xt = point[0]-txz*point[2]-txy*(point[1]-tyz*point[2]);
907 Int_t ind = (Int_t)(1.+(xt-fStart)/fStep)-1;
908 if (dir) {
909 Double_t ttsq = txy*txy + (txz-txy*tyz)*(txz-txy*tyz);
910 Double_t divdirx = 1./TMath::Sqrt(1.+ttsq);
911 Double_t divdiry = -txy*divdirx;
912 Double_t divdirz = -(txz-txy*tyz)*divdirx;
913 Double_t dot = dir[0]*divdirx + dir[1]*divdiry + dir[2]*divdirz;
914 td.fNextIndex = ind;
915 if (dot>0) td.fNextIndex++;
916 else td.fNextIndex--;
917 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
918 }
919 if ((ind<0) || (ind>=fNdivisions)) return node;
920 node = GetNodeOffset(ind);
921 cd(ind);
922 return node;
923}
924
925////////////////////////////////////////////////////////////////////////////////
926/// Make a copy of this finder. Reflect by Z if required.
927
929{
930 TGeoPatternParaX *finder = new TGeoPatternParaX(*this);
931 if (!reflect) return finder;
932 finder->Reflect();
933 return finder;
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// Save a primitive as a C++ statement(s) on output stream "out".
938
939void TGeoPatternParaX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
940{
941 Int_t iaxis = 1;
942 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
943}
944
945////////////////////////////////////////////////////////////////////////////////
946/// Return new matrix of type used by this finder.
947
949{
950 if (!IsReflected()) {
951 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
952 matrix->RegisterYourself();
953 return matrix;
954 }
955 TGeoCombiTrans *combi = new TGeoCombiTrans();
956 combi->RegisterYourself();
957 combi->ReflectZ(kTRUE);
958 combi->ReflectZ(kFALSE);
959 return combi;
960}
961
962////////////////////////////////////////////////////////////////////////////////
963/// Fills external matrix with the local one corresponding to the given division
964/// index.
965
967{
968 matrix.Clear();
969 matrix.SetDx(fStart+idiv*fStep+0.5*fStep);
970}
971
972//______________________________________________________________________________
973// TGeoPatternParaY - a Y axis divison pattern for PARA shape
974//______________________________________________________________________________
975
976////////////////////////////////////////////////////////////////////////////////
977/// Default constructor
978
980{
981 fTxy = 0;
983}
984////////////////////////////////////////////////////////////////////////////////
985/// constructor
986
988 :TGeoPatternFinder(vol, ndivisions)
989{
990 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
991 Double_t dy = ((TGeoPara*)vol->GetShape())->GetY();
992 fStart = -dy;
993 fEnd = dy;
994 fStep = 2*dy/ndivisions;
996}
997////////////////////////////////////////////////////////////////////////////////
998/// constructor
999
1001 :TGeoPatternFinder(vol, ndivisions)
1002{
1003 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
1004 Double_t dy = ((TGeoPara*)vol->GetShape())->GetY();
1005 fStart = -dy;
1006 fEnd = fStart + ndivisions*step;
1007 fStep = step;
1009}
1010////////////////////////////////////////////////////////////////////////////////
1011/// constructor
1012
1014 :TGeoPatternFinder(vol, ndivisions)
1015{
1016 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
1017 fStart = start;
1018 fEnd = end;
1019 fStep = (end - start)/ndivisions;
1021}
1022////////////////////////////////////////////////////////////////////////////////
1023///copy constructor
1024
1027{
1029}
1030
1031////////////////////////////////////////////////////////////////////////////////
1032///assignment operator
1033
1035{
1036 if(this!=&pf) {
1039 }
1040 return *this;
1041}
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Destructor
1045
1047{
1048}
1049////////////////////////////////////////////////////////////////////////////////
1050/// Update current division index and global matrix to point to a given slice.
1051
1053{
1055 td.fCurrent = idiv;
1056 Double_t dy = fStart+idiv*fStep+0.5*fStep;
1057 td.fMatrix->SetDx(fTxy*dy);
1058 td.fMatrix->SetDy(dy);
1059}
1060
1061////////////////////////////////////////////////////////////////////////////////
1062/// Checks if the current point is on division boundary
1063
1065{
1066 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
1067 Double_t yt = point[1]-tyz*point[2];
1068 Double_t seg = (yt-fStart)/fStep;
1069 Double_t diff = seg - Int_t(seg);
1070 if (diff>0.5) diff = 1.-diff;
1071 if (diff<1e-8) return kTRUE;
1072 return kFALSE;
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// get the node division containing the query point
1077
1079{
1081 TGeoNode *node = 0;
1082 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
1083 Double_t yt = point[1]-tyz*point[2];
1084 Int_t ind = (Int_t)(1.+(yt-fStart)/fStep) - 1;
1085 if (dir) {
1086 Double_t divdiry = 1./TMath::Sqrt(1.+tyz*tyz);
1087 Double_t divdirz = -tyz*divdiry;
1088 Double_t dot = dir[1]*divdiry + dir[2]*divdirz;
1089 td.fNextIndex = ind;
1090 if (dot>0) td.fNextIndex++;
1091 else td.fNextIndex--;
1092 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1093 }
1094 if ((ind<0) || (ind>=fNdivisions)) 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{
1105 TGeoPatternParaY *finder = new TGeoPatternParaY(*this);
1106 if (!reflect) return finder;
1107 finder->Reflect();
1108 return finder;
1109}
1110
1111////////////////////////////////////////////////////////////////////////////////
1112/// Save a primitive as a C++ statement(s) on output stream "out".
1113
1114void TGeoPatternParaY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1115{
1116 Int_t iaxis = 2;
1117 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1118}
1119
1120////////////////////////////////////////////////////////////////////////////////
1121/// Return new matrix of type used by this finder.
1122
1124{
1125 if (!IsReflected()) {
1126 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1127 matrix->RegisterYourself();
1128 return matrix;
1129 }
1130 TGeoCombiTrans *combi = new TGeoCombiTrans();
1131 combi->RegisterYourself();
1132 combi->ReflectZ(kTRUE);
1133 combi->ReflectZ(kFALSE);
1134 return combi;
1135}
1136
1137////////////////////////////////////////////////////////////////////////////////
1138/// Fills external matrix with the local one corresponding to the given division
1139/// index.
1140
1142{
1143 matrix.Clear();
1144 Double_t dy = fStart+idiv*fStep+0.5*fStep;
1145 matrix.SetDx(fTxy*dy);
1146 matrix.SetDy(dy);
1147}
1148
1149//______________________________________________________________________________
1150// TGeoPatternParaZ - a Z axis divison pattern for PARA shape
1151//______________________________________________________________________________
1152
1153////////////////////////////////////////////////////////////////////////////////
1154/// Default constructor
1155
1157{
1158 fTxz = 0;
1159 fTyz = 0;
1161}
1162////////////////////////////////////////////////////////////////////////////////
1163/// constructor
1164
1166 :TGeoPatternFinder(vol, ndivisions)
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
1180 :TGeoPatternFinder(vol, ndivisions)
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
1195 :TGeoPatternFinder(vol, ndivisions)
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
1210{
1212}
1213
1214////////////////////////////////////////////////////////////////////////////////
1215///assignment operator
1216
1218{
1219 if(this!=&pf) {
1222 }
1223 return *this;
1224}
1225
1226////////////////////////////////////////////////////////////////////////////////
1227/// Destructor
1228
1230{
1231}
1232
1233////////////////////////////////////////////////////////////////////////////////
1234/// Update current division index and global matrix to point to a given slice.
1235
1237{
1239 td.fCurrent = idiv;
1240 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1241 td.fMatrix->SetDx(fTxz*dz);
1242 td.fMatrix->SetDy(fTyz*dz);
1243 td.fMatrix->SetDz((IsReflected())?-dz:dz);
1244}
1245
1246////////////////////////////////////////////////////////////////////////////////
1247/// Checks if the current point is on division boundary
1248
1250{
1251 Double_t seg = (point[2]-fStart)/fStep;
1252 Double_t diff = seg - Int_t(seg);
1253 if (diff>0.5) diff = 1.-diff;
1254 if (diff<1e-8) return kTRUE;
1255 return kFALSE;
1256}
1257
1258////////////////////////////////////////////////////////////////////////////////
1259/// get the node division containing the query point
1260
1262{
1264 TGeoNode *node = 0;
1265 Double_t zt = point[2];
1266 Int_t ind = (Int_t)(1.+(zt-fStart)/fStep) - 1;
1267 if (dir) {
1268 td.fNextIndex = ind;
1269 if (dir[2]>0) td.fNextIndex++;
1270 else td.fNextIndex--;
1271 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1272 }
1273 if ((ind<0) || (ind>=fNdivisions)) return node;
1274 node = GetNodeOffset(ind);
1275 cd(ind);
1276 return node;
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// Make a copy of this finder. Reflect by Z if required.
1281
1283{
1284 TGeoPatternParaZ *finder = new TGeoPatternParaZ(*this);
1285 if (!reflect) return finder;
1286 finder->Reflect();
1287 return finder;
1288}
1289
1290////////////////////////////////////////////////////////////////////////////////
1291/// Save a primitive as a C++ statement(s) on output stream "out".
1292
1293void TGeoPatternParaZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1294{
1295 Int_t iaxis = 3;
1296 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1297}
1298
1299////////////////////////////////////////////////////////////////////////////////
1300/// Return new matrix of type used by this finder.
1301
1303{
1304 if (!IsReflected()) {
1305 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1306 matrix->RegisterYourself();
1307 return matrix;
1308 }
1309 TGeoCombiTrans *combi = new TGeoCombiTrans();
1310 combi->RegisterYourself();
1311 combi->ReflectZ(kTRUE);
1312 combi->ReflectZ(kFALSE);
1313 return combi;
1314}
1315
1316////////////////////////////////////////////////////////////////////////////////
1317/// Fills external matrix with the local one corresponding to the given division
1318/// index.
1319
1321{
1322 matrix.Clear();
1323 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1324 matrix.SetDx(fTxz*dz);
1325 matrix.SetDy(fTyz*dz);
1326 matrix.SetDz((IsReflected())?-dz:dz);
1327}
1328
1329//______________________________________________________________________________
1330// TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
1331//______________________________________________________________________________
1332
1333////////////////////////////////////////////////////////////////////////////////
1334/// Default constructor
1335
1337{
1338 fTxz = 0;
1339 fTyz = 0;
1341}
1342////////////////////////////////////////////////////////////////////////////////
1343/// constructor
1344
1346 :TGeoPatternFinder(vol, ndivisions)
1347{
1348 Double_t theta = ((TGeoTrap*)vol->GetShape())->GetTheta();
1349 Double_t phi = ((TGeoTrap*)vol->GetShape())->GetPhi();
1352 Double_t dz = ((TGeoArb8*)vol->GetShape())->GetDz();
1353 fStart = -dz;
1354 fEnd = dz;
1355 fStep = 2*dz/ndivisions;
1357}
1358////////////////////////////////////////////////////////////////////////////////
1359/// constructor
1360
1362 :TGeoPatternFinder(vol, ndivisions)
1363{
1364 Double_t theta = ((TGeoTrap*)vol->GetShape())->GetTheta();
1365 Double_t phi = ((TGeoTrap*)vol->GetShape())->GetPhi();
1368 Double_t dz = ((TGeoArb8*)vol->GetShape())->GetDz();
1369 fStart = -dz;
1370 fEnd = fStart + ndivisions*step;
1371 fStep = step;
1373}
1374////////////////////////////////////////////////////////////////////////////////
1375/// constructor
1376
1378 :TGeoPatternFinder(vol, ndivisions)
1379{
1380 Double_t theta = ((TGeoTrap*)vol->GetShape())->GetTheta();
1381 Double_t phi = ((TGeoTrap*)vol->GetShape())->GetPhi();
1384 fStart = start;
1385 fEnd = end;
1386 fStep = (end - start)/ndivisions;
1388}
1389
1390////////////////////////////////////////////////////////////////////////////////
1391///copy constructor
1392
1395 fTxz(pf.fTxz),
1396 fTyz(pf.fTyz)
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}
1421////////////////////////////////////////////////////////////////////////////////
1422/// Update current division index and global matrix to point to a given slice.
1423
1425{
1427 td.fCurrent = idiv;
1428 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1429 td.fMatrix->SetDx(fTxz*dz);
1430 td.fMatrix->SetDy(fTyz*dz);
1431 td.fMatrix->SetDz((IsReflected())?-dz:dz);
1432}
1433
1434////////////////////////////////////////////////////////////////////////////////
1435/// Checks if the current point is on division boundary
1436
1438{
1439 Double_t seg = (point[2]-fStart)/fStep;
1440 Double_t diff = seg - Int_t(seg);
1441 if (diff>0.5) diff = 1.-diff;
1442 if (diff<1e-8) return kTRUE;
1443 return kFALSE;
1444}
1445
1446////////////////////////////////////////////////////////////////////////////////
1447/// get the node division containing the query point
1448
1450{
1452 TGeoNode *node = 0;
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) td.fNextIndex++;
1458 else td.fNextIndex--;
1459 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1460 }
1461 if ((ind<0) || (ind>=fNdivisions)) return node;
1462 node = GetNodeOffset(ind);
1463 cd(ind);
1464 return node;
1465}
1466
1467////////////////////////////////////////////////////////////////////////////////
1468/// Make a copy of this finder. Reflect by Z if required.
1469
1471{
1472 TGeoPatternTrapZ *finder = new TGeoPatternTrapZ(*this);
1473 if (!reflect) return finder;
1474 finder->Reflect();
1475 return finder;
1476}
1477
1478////////////////////////////////////////////////////////////////////////////////
1479/// Save a primitive as a C++ statement(s) on output stream "out".
1480
1481void TGeoPatternTrapZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1482{
1483 Int_t iaxis = 3;
1484 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1485}
1486
1487////////////////////////////////////////////////////////////////////////////////
1488/// Return new matrix of type used by this finder.
1489
1491{
1492 if (!IsReflected()) {
1493 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1494 matrix->RegisterYourself();
1495 return matrix;
1496 }
1497 TGeoCombiTrans *combi = new TGeoCombiTrans();
1498 combi->RegisterYourself();
1499 combi->ReflectZ(kTRUE);
1500 combi->ReflectZ(kFALSE);
1501 return combi;
1502}
1503
1504////////////////////////////////////////////////////////////////////////////////
1505/// Fills external matrix with the local one corresponding to the given division
1506/// index.
1507
1509{
1510 matrix.Clear();
1511 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1512 matrix.SetDx(fTxz*dz);
1513 matrix.SetDy(fTyz*dz);
1514 matrix.SetDz((IsReflected())?-dz:dz);
1515}
1516
1517//______________________________________________________________________________
1518// TGeoPatternCylR - a cylindrical R divison pattern
1519//______________________________________________________________________________
1520
1521////////////////////////////////////////////////////////////////////////////////
1522/// Default constructor
1523
1525{
1527}
1528////////////////////////////////////////////////////////////////////////////////
1529/// constructor
1530
1532 :TGeoPatternFinder(vol, ndivisions)
1533{
1535}
1536////////////////////////////////////////////////////////////////////////////////
1537/// constructor
1538
1540 :TGeoPatternFinder(vol, ndivisions)
1541{
1542 fStep = step;
1544// compute start, end
1545}
1546////////////////////////////////////////////////////////////////////////////////
1547/// constructor
1548
1550 :TGeoPatternFinder(vol, ndivisions)
1551{
1552 fStart = start;
1553 fEnd = end;
1554 fStep = (end - start)/ndivisions;
1556}
1557////////////////////////////////////////////////////////////////////////////////
1558///copy constructor
1559
1562{
1564}
1565
1566////////////////////////////////////////////////////////////////////////////////
1567///assignment operator
1568
1570{
1571 if(this!=&pf) {
1574 }
1575 return *this;
1576}
1577
1578////////////////////////////////////////////////////////////////////////////////
1579/// Destructor
1580
1582{
1583}
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) diff = 1.-diff;
1594 if (diff<1e-8) return kTRUE;
1595 return kFALSE;
1596}
1597
1598////////////////////////////////////////////////////////////////////////////////
1599/// Update current division index and global matrix to point to a given slice.
1600
1602{
1604 td.fCurrent=idiv;
1605}
1606
1607////////////////////////////////////////////////////////////////////////////////
1608/// find the node containing the query point
1609
1611{
1613 if (!td.fMatrix) td.fMatrix = gGeoIdentity;
1614 TGeoNode *node = 0;
1615 Double_t r = TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
1616 Int_t ind = (Int_t)(1. + (r-fStart)/fStep) - 1;
1617 if (dir) {
1618 td.fNextIndex = ind;
1619 Double_t dot = point[0]*dir[0] + point[1]*dir[1];
1620 if (dot>0) td.fNextIndex++;
1621 else td.fNextIndex--;
1622 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1623 }
1624 if ((ind<0) || (ind>=fNdivisions)) return node;
1625 node = GetNodeOffset(ind);
1626 cd(ind);
1627 return node;
1628}
1629
1630////////////////////////////////////////////////////////////////////////////////
1631/// Make a copy of this finder. Reflect by Z if required.
1632
1634{
1635 TGeoPatternCylR *finder = new TGeoPatternCylR(*this);
1636 if (!reflect) return finder;
1637 finder->Reflect();
1638 return finder;
1639}
1640
1641////////////////////////////////////////////////////////////////////////////////
1642/// Save a primitive as a C++ statement(s) on output stream "out".
1643
1644void TGeoPatternCylR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1645{
1646 Int_t iaxis = 1;
1647 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1648}
1649
1650////////////////////////////////////////////////////////////////////////////////
1651/// Return new matrix of type used by this finder.
1652
1654{
1655 return gGeoIdentity;
1656}
1657
1658////////////////////////////////////////////////////////////////////////////////
1659/// Fills external matrix with the local one corresponding to the given division
1660/// index.
1661
1663{
1664 matrix.Clear();
1665}
1666
1667//______________________________________________________________________________
1668// TGeoPatternCylPhi - a cylindrical phi divison pattern
1669//______________________________________________________________________________
1670
1671////////////////////////////////////////////////////////////////////////////////
1672/// Default constructor
1673
1675{
1676 fSinCos = 0;
1678}
1679////////////////////////////////////////////////////////////////////////////////
1680/// constructor
1681/// compute step, start, end
1682
1684 :TGeoPatternFinder(vol, ndivisions)
1685{
1686 fStart = 0;
1687 fEnd = 0;
1688 fStep = 0;
1689 fSinCos = new Double_t[2*fNdivisions];
1690 for (Int_t i = 0; i<fNdivisions; i++) {
1692 fSinCos[2*i+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+i*fStep));
1693 }
1695}
1696////////////////////////////////////////////////////////////////////////////////
1697/// constructor
1698
1700 :TGeoPatternFinder(vol, ndivisions)
1701{
1702 fStep = step;
1703 fSinCos = new Double_t[2*ndivisions];
1704 for (Int_t i = 0; i<fNdivisions; i++) {
1706 fSinCos[2*i+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+i*fStep));
1707 }
1709// compute start, end
1710}
1711////////////////////////////////////////////////////////////////////////////////
1712/// constructor
1713
1715 :TGeoPatternFinder(vol, ndivisions)
1716{
1717 fStart = start;
1718 if (fStart<0) fStart+=360;
1719 fEnd = end;
1720 if (fEnd<0) fEnd+=360;
1721 if ((end-start)<0)
1722 fStep = (end-start+360)/ndivisions;
1723 else
1724 fStep = (end-start)/ndivisions;
1725 fSinCos = new Double_t[2*ndivisions];
1726 for (Int_t idiv = 0; idiv<ndivisions; idiv++) {
1727 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(start+0.5*fStep+idiv*fStep));
1728 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(start+0.5*fStep+idiv*fStep));
1729 }
1731}
1732////////////////////////////////////////////////////////////////////////////////
1733/// Destructor
1734
1736{
1737 if (fSinCos) delete [] fSinCos;
1738}
1739////////////////////////////////////////////////////////////////////////////////
1740/// Update current division index and global matrix to point to a given slice.
1741
1743{
1745 td.fCurrent = idiv;
1746 ((TGeoRotation*)td.fMatrix)->FastRotZ(&fSinCos[2*idiv]);
1747}
1748
1749////////////////////////////////////////////////////////////////////////////////
1750/// Checks if the current point is on division boundary
1751
1753{
1754 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
1755 if (phi<0) phi += 360;
1756 Double_t ddp = phi - fStart;
1757 if (ddp<0) ddp+=360;
1758 Double_t seg = ddp/fStep;
1759 Double_t diff = seg - Int_t(seg);
1760 if (diff>0.5) diff = 1.-diff;
1761 if (diff<1e-8) return kTRUE;
1762 return kFALSE;
1763}
1764
1765////////////////////////////////////////////////////////////////////////////////
1766/// find the node containing the query point
1767
1769{
1771 TGeoNode *node = 0;
1772 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
1773 if (phi<0) phi += 360;
1774// Double_t dphi = fStep*fNdivisions;
1775 Double_t ddp = phi - fStart;
1776 if (ddp<0) ddp+=360;
1777// if (ddp>360) ddp-=360;
1778 Int_t ind = (Int_t)(1. + ddp/fStep) - 1;
1779 if (dir) {
1780 td.fNextIndex = ind;
1781 Double_t dot = point[0]*dir[1]-point[1]*dir[0];
1782 if (dot>0) td.fNextIndex++;
1783 else td.fNextIndex--;
1784 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1785 }
1786 if ((ind<0) || (ind>=fNdivisions)) return node;
1787 node = GetNodeOffset(ind);
1788 cd(ind);
1789 return node;
1790}
1791
1792////////////////////////////////////////////////////////////////////////////////
1793/// Make a copy of this finder. Reflect by Z if required.
1794
1796{
1797 TGeoPatternCylPhi *finder = new TGeoPatternCylPhi(*this);
1798 if (!reflect) return finder;
1799 finder->Reflect();
1800 return finder;
1801}
1802
1803////////////////////////////////////////////////////////////////////////////////
1804/// Save a primitive as a C++ statement(s) on output stream "out".
1805
1806void TGeoPatternCylPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1807{
1808 Int_t iaxis = 2;
1809 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1810}
1811
1812////////////////////////////////////////////////////////////////////////////////
1813/// Stream an object of class TGeoVolume.
1814
1815void TGeoPatternCylPhi::Streamer(TBuffer &R__b)
1816{
1817 if (R__b.IsReading()) {
1818 R__b.ReadClassBuffer(TGeoPatternCylPhi::Class(), this);
1819 if (fNdivisions) {
1820 fSinCos = new Double_t[2*fNdivisions];
1821 for (Int_t idiv = 0; idiv<fNdivisions; idiv++) {
1822 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
1823 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
1824 }
1825 }
1826 } else {
1827 R__b.WriteClassBuffer(TGeoPatternCylPhi::Class(), this);
1828 }
1829}
1830
1831////////////////////////////////////////////////////////////////////////////////
1832/// Return new matrix of type used by this finder.
1833
1835{
1836 if (!IsReflected()) {
1837 TGeoRotation *matrix = new TGeoRotation();
1838 matrix->RegisterYourself();
1839 return matrix;
1840 }
1841 TGeoRotation *rot = new TGeoRotation();
1842 rot->RegisterYourself();
1843 rot->ReflectZ(kTRUE);
1844 rot->ReflectZ(kFALSE);
1845 return rot;
1846}
1847
1848////////////////////////////////////////////////////////////////////////////////
1849/// Fills external matrix with the local one corresponding to the given division
1850/// index.
1851
1853{
1854 matrix.Clear();
1855 matrix.FastRotZ(&fSinCos[2*idiv]);
1856}
1857
1858//______________________________________________________________________________
1859// TGeoPatternSphR - a spherical R divison pattern
1860//______________________________________________________________________________
1861
1862////////////////////////////////////////////////////////////////////////////////
1863/// Default constructor
1864
1866{
1868}
1869////////////////////////////////////////////////////////////////////////////////
1870/// constructor
1871/// compute step, start, end
1872
1874 :TGeoPatternFinder(vol, ndivisions)
1875{
1877}
1878////////////////////////////////////////////////////////////////////////////////
1879/// constructor
1880
1882 :TGeoPatternFinder(vol, ndivisions)
1883{
1884 fStep = step;
1886// compute start, end
1887}
1888////////////////////////////////////////////////////////////////////////////////
1889/// constructor
1890
1892 :TGeoPatternFinder(vol, ndivisions)
1893{
1894 fStart = start;
1895 fEnd = end;
1896 fStep = (end - start)/ndivisions;
1898}
1899////////////////////////////////////////////////////////////////////////////////
1900///copy constructor
1901
1904{
1906}
1907
1908////////////////////////////////////////////////////////////////////////////////
1909///assignment operator
1910
1912{
1913 if(this!=&pf) {
1916 }
1917 return *this;
1918}
1919
1920////////////////////////////////////////////////////////////////////////////////
1921/// Destructor
1922
1924{
1925}
1926////////////////////////////////////////////////////////////////////////////////
1927/// Update current division index and global matrix to point to a given slice.
1928
1930{
1932 td.fCurrent = idiv;
1933}
1934////////////////////////////////////////////////////////////////////////////////
1935/// find the node containing the query point
1936
1938{
1939 return 0;
1940}
1941
1942////////////////////////////////////////////////////////////////////////////////
1943/// Make a copy of this finder. Reflect by Z if required.
1944
1946{
1947 TGeoPatternSphR *finder = new TGeoPatternSphR(*this);
1948 return finder;
1949}
1950
1951////////////////////////////////////////////////////////////////////////////////
1952/// Save a primitive as a C++ statement(s) on output stream "out".
1953
1954void TGeoPatternSphR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1955{
1956 Int_t iaxis = 1;
1957 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1958}
1959
1960////////////////////////////////////////////////////////////////////////////////
1961/// Return new matrix of type used by this finder.
1962
1964{
1965 return gGeoIdentity;
1966}
1967
1968////////////////////////////////////////////////////////////////////////////////
1969/// Fills external matrix with the local one corresponding to the given division
1970/// index.
1971
1973{
1974 matrix.Clear();
1975}
1976
1977//______________________________________________________________________________
1978// TGeoPatternSphTheta - a spherical theta divison pattern
1979//______________________________________________________________________________
1980
1981////////////////////////////////////////////////////////////////////////////////
1982/// Default constructor
1983
1985{
1987}
1988////////////////////////////////////////////////////////////////////////////////
1989/// constructor
1990/// compute step, start, end
1991
1993 :TGeoPatternFinder(vol, ndivisions)
1994{
1996}
1997////////////////////////////////////////////////////////////////////////////////
1998/// constructor
1999
2001 :TGeoPatternFinder(vol, ndivisions)
2002{
2003 fStep = step;
2005// compute start, end
2006}
2007////////////////////////////////////////////////////////////////////////////////
2008/// constructor
2009
2011 :TGeoPatternFinder(vol, ndivisions)
2012{
2013 fStart = start;
2014 fEnd = end;
2015 fStep = (end - start)/ndivisions;
2017}
2018////////////////////////////////////////////////////////////////////////////////
2019///copy constructor
2020
2023{
2025}
2026////////////////////////////////////////////////////////////////////////////////
2027///assignment operator
2028
2030{
2031 if(this!=&pf) {
2034 }
2035 return *this;
2036}
2037////////////////////////////////////////////////////////////////////////////////
2038/// Destructor
2039
2041{
2042}
2043////////////////////////////////////////////////////////////////////////////////
2044/// Update current division index and global matrix to point to a given slice.
2045
2047{
2049 td.fCurrent=idiv;
2050}
2051////////////////////////////////////////////////////////////////////////////////
2052/// find the node containing the query point
2053
2055{
2056 return 0;
2057}
2058
2059////////////////////////////////////////////////////////////////////////////////
2060/// Make a copy of this finder. Reflect by Z if required.
2061
2063{
2064 TGeoPatternSphTheta *finder = new TGeoPatternSphTheta(*this);
2065 return finder;
2066}
2067
2068////////////////////////////////////////////////////////////////////////////////
2069/// Save a primitive as a C++ statement(s) on output stream "out".
2070
2071void TGeoPatternSphTheta::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2072{
2073 Int_t iaxis = 2;
2074 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2075}
2076
2077////////////////////////////////////////////////////////////////////////////////
2078/// Return new matrix of type used by this finder.
2079
2081{
2082 return gGeoIdentity;
2083}
2084
2085////////////////////////////////////////////////////////////////////////////////
2086/// Fills external matrix with the local one corresponding to the given division
2087/// index.
2088
2090{
2091 matrix.Clear();
2092}
2093
2094//______________________________________________________________________________
2095// TGeoPatternSphPhi - a spherical phi divison pattern
2096//______________________________________________________________________________
2097
2098////////////////////////////////////////////////////////////////////////////////
2099/// Default constructor
2100
2102{
2103 fSinCos = 0;
2105}
2106////////////////////////////////////////////////////////////////////////////////
2107/// constructor
2108/// compute step, start, end
2109
2111 :TGeoPatternFinder(vol, ndivisions)
2112{
2113 fStart = 0;
2114 fEnd = 360.;
2115 fStep = 360./ndivisions;
2116 CreateSinCos();
2118}
2119////////////////////////////////////////////////////////////////////////////////
2120/// constructor
2121/// compute start, end
2122
2124 :TGeoPatternFinder(vol, ndivisions)
2125{
2126 fStep = step;
2127 CreateSinCos();
2129}
2130////////////////////////////////////////////////////////////////////////////////
2131/// constructor
2132/// compute step
2133
2135 :TGeoPatternFinder(vol, ndivisions)
2136{
2137 fStart = start;
2138 if (fStart<0) fStart+=360;
2139 fEnd = end;
2140 if (fEnd<0) fEnd+=360;
2141 if ((end-start)<0)
2142 fStep = (end-start+360)/ndivisions;
2143 else
2144 fStep = (end-start)/ndivisions;
2145 CreateSinCos();
2147}
2148
2149////////////////////////////////////////////////////////////////////////////////
2150/// Destructor
2151
2153{
2154 delete [] fSinCos;
2155}
2156
2157////////////////////////////////////////////////////////////////////////////////
2158/// Create the sincos table if it does not exist
2159
2161{
2162 fSinCos = new Double_t[2*fNdivisions];
2163 for (Int_t idiv = 0; idiv<fNdivisions; idiv++) {
2164 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
2165 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
2166 }
2167 return fSinCos;
2168}
2169
2170////////////////////////////////////////////////////////////////////////////////
2171/// Update current division index and global matrix to point to a given slice.
2172
2174{
2176 td.fCurrent = idiv;
2177 if (!fSinCos) CreateSinCos();
2178 ((TGeoRotation*)td.fMatrix)->FastRotZ(&fSinCos[2*idiv]);
2179}
2180
2181////////////////////////////////////////////////////////////////////////////////
2182/// Checks if the current point is on division boundary
2183
2185{
2186 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
2187 if (phi<0) phi += 360;
2188 Double_t ddp = phi - fStart;
2189 if (ddp<0) ddp+=360;
2190 Double_t seg = ddp/fStep;
2191 Double_t diff = seg - Int_t(seg);
2192 if (diff>0.5) diff = 1.-diff;
2193 if (diff<1e-8) return kTRUE;
2194 return kFALSE;
2195}
2196////////////////////////////////////////////////////////////////////////////////
2197/// find the node containing the query point
2198
2200{
2202 TGeoNode *node = 0;
2203 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
2204 if (phi<0) phi += 360;
2205// Double_t dphi = fStep*fNdivisions;
2206 Double_t ddp = phi - fStart;
2207 if (ddp<0) ddp+=360;
2208// if (ddp>360) ddp-=360;
2209 Int_t ind = (Int_t)(1. + ddp/fStep) - 1;
2210 if (dir) {
2211 td.fNextIndex = ind;
2212 Double_t dot = point[0]*dir[1]-point[1]*dir[0];
2213 if (dot>0) td.fNextIndex++;
2214 else td.fNextIndex--;
2215 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
2216 }
2217 if ((ind<0) || (ind>=fNdivisions)) return node;
2218 node = GetNodeOffset(ind);
2219 cd(ind);
2220 return node;
2221}
2222////////////////////////////////////////////////////////////////////////////////
2223/// Make a copy of this finder. Reflect by Z if required.
2224
2226{
2228 if (!reflect) return finder;
2229 finder->Reflect();
2230 return finder;
2231}
2232
2233////////////////////////////////////////////////////////////////////////////////
2234/// Save a primitive as a C++ statement(s) on output stream "out".
2235
2236void TGeoPatternSphPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2237{
2238 Int_t iaxis = 2;
2239 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2240}
2241////////////////////////////////////////////////////////////////////////////////
2242/// Return new matrix of type used by this finder.
2243
2245{
2246 if (!IsReflected()) {
2247 TGeoRotation *matrix = new TGeoRotation();
2248 matrix->RegisterYourself();
2249 return matrix;
2250 }
2251 TGeoRotation *rot = new TGeoRotation();
2252 rot->RegisterYourself();
2253 rot->ReflectZ(kTRUE);
2254 rot->ReflectZ(kFALSE);
2255 return rot;
2256}
2257////////////////////////////////////////////////////////////////////////////////
2258/// Fills external matrix with the local one corresponding to the given division
2259/// index.
2260
2262{
2263 if (!fSinCos) ((TGeoPatternSphPhi*)this)->CreateSinCos();
2264 matrix.Clear();
2265 matrix.FastRotZ(&fSinCos[2*idiv]);
2266}
2267
2268//______________________________________________________________________________
2269// TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
2270//______________________________________________________________________________
2271
2272////////////////////////////////////////////////////////////////////////////////
2273/// Default constructor
2274
2276{
2277 fNrows = 0;
2278 fAxisOnRows = 0;
2279 fNdivisions = 0;
2280 fStart = 0;
2282}
2283////////////////////////////////////////////////////////////////////////////////
2284/// Default constructor
2285
2287 :TGeoPatternFinder(vol, nrows)
2288{
2289 fNrows = nrows;
2290 fAxisOnRows = 0;
2291 fNdivisions = 0;
2292 fStart = 0;
2294// compute everything else
2295}
2296////////////////////////////////////////////////////////////////////////////////
2297///copy constructor
2298
2300 TGeoPatternFinder(pfh),
2301 fNrows(pfh.fNrows),
2302 fAxisOnRows(pfh.fAxisOnRows),
2303 fNdivisions(pfh.fNdivisions),
2304 fStart(pfh.fStart)
2305{
2307}
2308
2309////////////////////////////////////////////////////////////////////////////////
2310///assignment operator
2311
2313{
2314 if(this!=&pfh) {
2316 fNrows=pfh.fNrows;
2319 fStart=pfh.fStart;
2321 }
2322 return *this;
2323}
2324////////////////////////////////////////////////////////////////////////////////
2325/// destructor
2326
2328{
2329}
2330////////////////////////////////////////////////////////////////////////////////
2331/// Update current division index and global matrix to point to a given slice.
2332
2334{
2336 td.fCurrent=idiv;
2337}
2338////////////////////////////////////////////////////////////////////////////////
2339/// find the node containing the query point
2340
2342{
2343 return 0;
2344}
2345
2346////////////////////////////////////////////////////////////////////////////////
2347/// Return new matrix of type used by this finder.
2348
2350{
2351 return gGeoIdentity;
2352}
2353
2354////////////////////////////////////////////////////////////////////////////////
2355/// Fills external matrix with the local one corresponding to the given division
2356/// index.
2357
2359{
2360 matrix.Clear();
2361}
ROOT::R::TRInterface & r
Definition Object.C:4
#define e(i)
Definition RSha256.hxx:103
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:73
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:478
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=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:18
Box class.
Definition TGeoBBox.h:18
Class describing rotation + translation.
Definition TGeoMatrix.h:292
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:421
virtual void SetDz(Double_t dz)
Definition TGeoMatrix.h:461
void Clear(Option_t *option="")
clear the data for this matrix
void FastRotZ(const Double_t *sincos)
Perform a rotation about Z having the sine/cosine of the rotation angle.
virtual void SetDx(Double_t dx)
Definition TGeoMatrix.h:459
virtual void SetDy(Double_t dy)
Definition TGeoMatrix.h:460
static Int_t ThreadId()
Translates the current thread id to an ordinal number.
Geometrical transformation package.
Definition TGeoMatrix.h:41
virtual void SetDz(Double_t)
Definition TGeoMatrix.h:106
virtual void SetDy(Double_t)
Definition TGeoMatrix.h:105
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
virtual void SetDx(Double_t)
Definition TGeoMatrix.h:104
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:41
Parallelepiped class.
Definition TGeoPara.h:18
TGeoPatternCylPhi()
Default constructor.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual ~TGeoPatternCylPhi()
Destructor.
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
TGeoPatternCylR()
Default constructor.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual ~TGeoPatternCylR()
Destructor.
TGeoPatternCylR & operator=(const TGeoPatternCylR &)
assignment operator
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
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.
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.
Bool_t IsReflected() const
std::vector< ThreadData_t * > fThreadData
Int_t GetCurrent()
Return current index.
void ClearThreadData() const
TGeoPatternFinder()
Default constructor.
Int_t GetNext() const
Get index of next division.
virtual ~TGeoPatternFinder()
Destructor.
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
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual ~TGeoPatternHoneycomb()
destructor
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternHoneycomb()
Default constructor.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
TGeoPatternHoneycomb & operator=(const TGeoPatternHoneycomb &)
assignment operator
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
get the node division containing the query point
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternParaX()
Default constructor.
virtual ~TGeoPatternParaX()
Destructor.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
TGeoPatternParaX & operator=(const TGeoPatternParaX &)
assignment operator
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual ~TGeoPatternParaY()
Destructor.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
TGeoPatternParaY()
Default constructor.
TGeoPatternParaY & operator=(const TGeoPatternParaY &)
assignment operator
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
get the node division containing the query point
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
get the node division containing the query point
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
TGeoPatternParaZ & operator=(const TGeoPatternParaZ &)
assignment operator
virtual ~TGeoPatternParaZ()
Destructor.
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
TGeoPatternParaZ()
Default constructor.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
TGeoPatternSphPhi()
Default constructor.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual ~TGeoPatternSphPhi()
Destructor.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
Double_t * CreateSinCos()
Create the sincos table if it does not exist.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
TGeoPatternSphR()
Default constructor.
virtual ~TGeoPatternSphR()
Destructor.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternSphR & operator=(const TGeoPatternSphR &)
assignment operator
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternSphTheta()
Default constructor.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual ~TGeoPatternSphTheta()
Destructor.
TGeoPatternSphTheta & operator=(const TGeoPatternSphTheta &)
assignment operator
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
find the node containing the query point
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
get the node division containing the query point
TGeoPatternTrapZ()
Default constructor.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual ~TGeoPatternTrapZ()
Destructor.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
TGeoPatternTrapZ & operator=(const TGeoPatternTrapZ &)
assignment operator
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
TGeoPatternX & operator=(const TGeoPatternX &)
assignment operator
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
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.
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
Find the cell corresponding to point and next cell along dir (if asked)
virtual ~TGeoPatternX()
Destructor.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
Find the cell corresponding to point and next cell along dir (if asked)
TGeoPatternY & operator=(const TGeoPatternY &)
assignment operator
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual ~TGeoPatternY()
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.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
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.
virtual TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE)
Make a copy of this finder. Reflect by Z if required.
TGeoPatternZ()
Default constructor.
virtual Bool_t IsOnBoundary(const Double_t *point) const
Checks if the current point is on division boundary.
virtual ~TGeoPatternZ()
Destructor.
TGeoPatternZ & operator=(const TGeoPatternZ &)
assignment operator
virtual TGeoNode * FindNode(Double_t *point, const Double_t *dir=0)
Find the cell corresponding to point and next cell along dir (if asked)
virtual void cd(Int_t idiv)
Update current division index and global matrix to point to a given slice.
virtual void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const
Fills external matrix with the local one corresponding to the given division index.
virtual TGeoMatrix * CreateMatrix() const
Return new matrix of type used by this finder.
Class describing rotations.
Definition TGeoMatrix.h:175
virtual void ReflectZ(Bool_t leftside, Bool_t rotonly=kFALSE)
Multiply by a reflection respect to XY.
static Double_t Big()
Definition TGeoShape.h:88
static Double_t Tolerance()
Definition TGeoShape.h:91
Class describing translations.
Definition TGeoMatrix.h:122
TRAP is a general trapezoid, i.e.
Definition TGeoArb8.h:92
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:49
TGeoShape * GetShape() const
Definition TGeoVolume.h:189
Mother of all ROOT objects.
Definition TObject.h:37
TObject & operator=(const TObject &rhs)
TObject assignment operator.
Definition TObject.h:283
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:893
Double_t ATan2(Double_t y, Double_t x)
Definition TMath.h:679
constexpr Double_t DegToRad()
Conversion from degree to radian:
Definition TMath.h:81
Double_t Sqrt(Double_t x)
Definition TMath.h:691
Double_t Cos(Double_t)
Definition TMath.h:643
Double_t Sin(Double_t)
Definition TMath.h:639
Double_t Tan(Double_t)
Definition TMath.h:647
constexpr Double_t RadToDeg()
Conversion from radian to degree:
Definition TMath.h:73
Short_t Abs(Short_t d)
Definition TMathBase.h:120
Int_t fNextIndex
current division element