Logo ROOT  
Reference Guide
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 "Riostream.h"
31#include "TBuffer.h"
32#include "TObject.h"
33#include "TGeoMatrix.h"
34#include "TGeoPara.h"
35#include "TGeoArb8.h"
36#include "TGeoNode.h"
37#include "TGeoManager.h"
38#include "TMath.h"
39
54
55
56////////////////////////////////////////////////////////////////////////////////
57/// Constructor.
58
60 fMatrix(0), fCurrent(-1), fNextIndex(-1)
61{
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Destructor.
66
68{
69// if (fMatrix != gGeoIdentity) delete fMatrix;
70}
71
72////////////////////////////////////////////////////////////////////////////////
73
75{
77 return *fThreadData[tid];
78}
79
80////////////////////////////////////////////////////////////////////////////////
81
83{
84 std::lock_guard<std::mutex> guard(fMutex);
85 std::vector<ThreadData_t*>::iterator i = fThreadData.begin();
86 while (i != fThreadData.end())
87 {
88 delete *i;
89 ++i;
90 }
91 fThreadData.clear();
92 fThreadSize = 0;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96/// Create thread data for n threads max.
97
99{
100 std::lock_guard<std::mutex> guard(fMutex);
101 fThreadData.resize(nthreads);
102 fThreadSize = nthreads;
103 for (Int_t tid=0; tid<nthreads; tid++) {
104 if (fThreadData[tid] == 0) {
105 fThreadData[tid] = new ThreadData_t;
106 fThreadData[tid]->fMatrix = CreateMatrix();
107 }
108 }
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Default constructor
113
115{
116 fNdivisions = 0;
117 fDivIndex = 0;
118 fStep = 0;
119 fStart = 0;
120 fEnd = 0;
121 fVolume = 0;
122 fThreadSize = 0;
123}
124
125////////////////////////////////////////////////////////////////////////////////
126/// Default constructor
127
129{
130 fVolume = vol;
131 fNdivisions = ndiv;
132 fDivIndex = 0;
133 fStep = 0;
134 fStart = 0;
135 fEnd = 0;
136 fThreadSize = 0;
137}
138
139////////////////////////////////////////////////////////////////////////////////
140///copy constructor
141
143 TObject(pf),
144 fStep(pf.fStep),
145 fStart(pf.fStart),
146 fEnd(pf.fEnd),
149 fVolume(pf.fVolume)
150{
151}
152
153////////////////////////////////////////////////////////////////////////////////
154///assignment operator
155
157{
158 if(this!=&pf) {
160 fStep=pf.fStep;
161 fStart=pf.fStart;
162 fEnd=pf.fEnd;
165 fVolume=pf.fVolume;
166 }
167 return *this;
168}
169
170////////////////////////////////////////////////////////////////////////////////
171/// Destructor
172
174{
176}
177
178////////////////////////////////////////////////////////////////////////////////
179/// Return current index.
180
182{
183 return GetThreadData().fCurrent;
184}
185
186////////////////////////////////////////////////////////////////////////////////
187/// Return current matrix.
188
190{
191 return GetThreadData().fMatrix;
192}
193
194////////////////////////////////////////////////////////////////////////////////
195/// Get index of next division.
196
198{
199 return GetThreadData().fNextIndex;
200}
201
202////////////////////////////////////////////////////////////////////////////////
203/// Set index of next division.
204
206{
207 GetThreadData().fNextIndex = index;
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// Make next node (if any) current.
212
214{
216 if (td.fNextIndex < 0) return NULL;
217 cd(td.fNextIndex);
218 return GetNodeOffset(td.fCurrent);
219}
220
221////////////////////////////////////////////////////////////////////////////////
222/// Set division range. Use this method only when dividing an assembly.
223
225{
226 fStart = start;
227 fEnd = fStart + ndivisions*step;
228 fStep = step;
229 fNdivisions = ndivisions;
230}
231
232//______________________________________________________________________________
233// TGeoPatternX - a X axis divison pattern
234//______________________________________________________________________________
235
236////////////////////////////////////////////////////////////////////////////////
237/// Default constructor
238
240{
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// constructor
246
248 :TGeoPatternFinder(vol, ndivisions)
249{
250 Double_t dx = ((TGeoBBox*)vol->GetShape())->GetDX();
251 fStart = -dx;
252 fEnd = dx;
253 fStep = 2*dx/ndivisions;
255}
256
257////////////////////////////////////////////////////////////////////////////////
258/// constructor
259
261 :TGeoPatternFinder(vol, ndivisions)
262{
263 Double_t dx = ((TGeoBBox*)vol->GetShape())->GetDX();
264 fStart = -dx;
265 fEnd = fStart + ndivisions*step;
266 fStep = step;
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// constructor
272
274 :TGeoPatternFinder(vol, ndivisions)
275{
276 fStart = start;
277 fEnd = end;
278 fStep = (end - start)/ndivisions;
280}
281
282////////////////////////////////////////////////////////////////////////////////
283///copy constructor
284
287{
289}
290
291////////////////////////////////////////////////////////////////////////////////
292///assignment operator
293
295{
296 if(this!=&pf) {
299 }
300 return *this;
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Destructor
305
307{
308}
309
310////////////////////////////////////////////////////////////////////////////////
311/// Update current division index and global matrix to point to a given slice.
312
314{
316 td.fCurrent=idiv;
317 td.fMatrix->SetDx(fStart+idiv*fStep+0.5*fStep);
318}
319
320////////////////////////////////////////////////////////////////////////////////
321/// Return new matrix of type used by this finder.
322
324{
325 if (!IsReflected()) {
326 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
327 matrix->RegisterYourself();
328 return matrix;
329 }
330 TGeoCombiTrans *combi = new TGeoCombiTrans();
331 combi->RegisterYourself();
332 combi->ReflectZ(kTRUE);
333 combi->ReflectZ(kFALSE);
334 return combi;
335}
336
337////////////////////////////////////////////////////////////////////////////////
338/// Fills external matrix with the local one corresponding to the given division
339/// index.
340
342{
343 matrix.Clear();
344 matrix.SetDx(fStart+idiv*fStep+0.5*fStep);
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Checks if the current point is on division boundary
349
351{
352 Double_t seg = (point[0]-fStart)/fStep;
353 Double_t diff = seg - Long64_t(seg);
354 if (diff>0.5) diff = 1.-diff;
355 if (diff<1e-8) return kTRUE;
356 return kFALSE;
357}
358
359////////////////////////////////////////////////////////////////////////////////
360/// Find the cell corresponding to point and next cell along dir (if asked)
361
363{
365 TGeoNode *node = 0;
366 Int_t ind = (Int_t)(1.+(point[0]-fStart)/fStep) - 1;
367 if (dir) {
368 td.fNextIndex = ind;
369 if (dir[0]>0) td.fNextIndex++;
370 else td.fNextIndex--;
371 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
372 }
373 if ((ind<0) || (ind>=fNdivisions)) return node;
374 node = GetNodeOffset(ind);
375 cd(ind);
376 return node;
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// Compute distance to next division layer returning the index of next section.
381/// Point is in the frame of the divided volume.
382
384{
386 indnext = -1;
388 if (TMath::Abs(dir[0])<TGeoShape::Tolerance()) return dist;
389 if (td.fCurrent<0) {
390 Error("FindNextBoundary", "Must call FindNode first");
391 return dist;
392 }
393 Int_t inc = (dir[0]>0)?1:0;
394 dist = (fStep*(td.fCurrent+inc)-point[0])/dir[0];
395 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
396 if (!inc) inc = -1;
397 indnext = td.fCurrent+inc;
398 return dist;
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// Make a copy of this finder. Reflect by Z if required.
403
405{
406 TGeoPatternX *finder = new TGeoPatternX(*this);
407 if (!reflect) 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////////////////////////////////////////////////////////////////////////////////
427/// Default constructor
428
430{
432}
433
434////////////////////////////////////////////////////////////////////////////////
435/// constructor
436
438 :TGeoPatternFinder(vol, ndivisions)
439{
440 Double_t dy = ((TGeoBBox*)vol->GetShape())->GetDY();
441 fStart = -dy;
442 fEnd = dy;
443 fStep = 2*dy/ndivisions;
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// constructor
449
451 :TGeoPatternFinder(vol, ndivisions)
452{
453 Double_t dy = ((TGeoBBox*)vol->GetShape())->GetDY();
454 fStart = -dy;
455 fEnd = fStart + ndivisions*step;
456 fStep = step;
458}
459
460////////////////////////////////////////////////////////////////////////////////
461/// constructor
462
464 :TGeoPatternFinder(vol, ndivisions)
465{
466 fStart = start;
467 fEnd = end;
468 fStep = (end - start)/ndivisions;
470}
471
472////////////////////////////////////////////////////////////////////////////////
473///copy constructor
474
477{
479}
480
481////////////////////////////////////////////////////////////////////////////////
482///assignment operator
483
485{
486 if(this!=&pf) {
489 }
490 return *this;
491}
492
493////////////////////////////////////////////////////////////////////////////////
494/// Destructor
495
497{
498}
499
500////////////////////////////////////////////////////////////////////////////////
501/// Update current division index and global matrix to point to a given slice.
502
504{
506 td.fCurrent=idiv;
507 td.fMatrix->SetDy(fStart+idiv*fStep+0.5*fStep);
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Return new matrix of type used by this finder.
512
514{
515 if (!IsReflected()) {
516 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
517 matrix->RegisterYourself();
518 return matrix;
519 }
520 TGeoCombiTrans *combi = new TGeoCombiTrans();
521 combi->RegisterYourself();
522 combi->ReflectZ(kTRUE);
523 combi->ReflectZ(kFALSE);
524 return combi;
525}
526
527////////////////////////////////////////////////////////////////////////////////
528/// Fills external matrix with the local one corresponding to the given division
529/// index.
530
532{
533 matrix.Clear();
534 matrix.SetDy(fStart+idiv*fStep+0.5*fStep);
535}
536
537////////////////////////////////////////////////////////////////////////////////
538/// Checks if the current point is on division boundary
539
541{
542 Double_t seg = (point[1]-fStart)/fStep;
543 Double_t diff = seg - Int_t(seg);
544 if (diff>0.5) diff = 1.-diff;
545 if (diff<1e-8) return kTRUE;
546 return kFALSE;
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// Find the cell corresponding to point and next cell along dir (if asked)
551
553{
555 TGeoNode *node = 0;
556 Int_t ind = (Int_t)(1.+(point[1]-fStart)/fStep) - 1;
557 if (dir) {
558 td.fNextIndex = ind;
559 if (dir[1]>0) td.fNextIndex++;
560 else td.fNextIndex--;
561 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
562 }
563 if ((ind<0) || (ind>=fNdivisions)) 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;
578 if (TMath::Abs(dir[1])<TGeoShape::Tolerance()) return dist;
579 if (td.fCurrent<0) {
580 Error("FindNextBoundary", "Must call FindNode first");
581 return dist;
582 }
583 Int_t inc = (dir[1]>0)?1:0;
584 dist = (fStep*(td.fCurrent+inc)-point[1])/dir[1];
585 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
586 if (!inc) inc = -1;
587 indnext = td.fCurrent+inc;
588 return dist;
589}
590
591////////////////////////////////////////////////////////////////////////////////
592/// Make a copy of this finder. Reflect by Z if required.
593
595{
596 TGeoPatternY *finder = new TGeoPatternY(*this);
597 if (!reflect) return finder;
598 finder->Reflect();
599 return finder;
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Save a primitive as a C++ statement(s) on output stream "out".
604
605void TGeoPatternY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
606{
607 Int_t iaxis = 2;
608 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
609}
610
611//______________________________________________________________________________
612// TGeoPatternZ - a Z axis divison pattern
613//______________________________________________________________________________
614
615
616////////////////////////////////////////////////////////////////////////////////
617/// Default constructor
618
620{
622}
623////////////////////////////////////////////////////////////////////////////////
624/// constructor
625
627 :TGeoPatternFinder(vol, ndivisions)
628{
629 Double_t dz = ((TGeoBBox*)vol->GetShape())->GetDZ();
630 fStart = -dz;
631 fEnd = dz;
632 fStep = 2*dz/ndivisions;
634}
635////////////////////////////////////////////////////////////////////////////////
636/// constructor
637
639 :TGeoPatternFinder(vol, ndivisions)
640{
641 Double_t dz = ((TGeoBBox*)vol->GetShape())->GetDZ();
642 fStart = -dz;
643 fEnd = fStart + ndivisions*step;
644 fStep = step;
646}
647////////////////////////////////////////////////////////////////////////////////
648/// constructor
649
651 :TGeoPatternFinder(vol, ndivisions)
652{
653 fStart = start;
654 fEnd = end;
655 fStep = (end - start)/ndivisions;
657}
658
659////////////////////////////////////////////////////////////////////////////////
660///copy constructor
661
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}
686////////////////////////////////////////////////////////////////////////////////
687/// Update current division index and global matrix to point to a given slice.
688
690{
692 td.fCurrent=idiv;
693 td.fMatrix->SetDz(((IsReflected())?-1.:1.)*(fStart+idiv*fStep+0.5*fStep));
694}
695
696////////////////////////////////////////////////////////////////////////////////
697/// Return new matrix of type used by this finder.
698
700{
701 if (!IsReflected()) {
702 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
703 matrix->RegisterYourself();
704 return matrix;
705 }
706 TGeoCombiTrans *combi = new TGeoCombiTrans();
707 combi->RegisterYourself();
708 combi->ReflectZ(kTRUE);
709 combi->ReflectZ(kFALSE);
710 return combi;
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// Fills external matrix with the local one corresponding to the given division
715/// index.
716
718{
719 matrix.Clear();
720 matrix.SetDz(((IsReflected())?-1.:1.)*(fStart+idiv*fStep+0.5*fStep));
721}
722
723////////////////////////////////////////////////////////////////////////////////
724/// Checks if the current point is on division boundary
725
727{
728 Double_t seg = (point[2]-fStart)/fStep;
729 Double_t diff = seg - Int_t(seg);
730 if (diff>0.5) diff = 1.-diff;
731 if (diff<1e-8) 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) td.fNextIndex++;
746 else td.fNextIndex--;
747 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
748 }
749 if ((ind<0) || (ind>=fNdivisions)) return node;
750 node = GetNodeOffset(ind);
751 cd(ind);
752 return node;
753}
754
755////////////////////////////////////////////////////////////////////////////////
756/// Compute distance to next division layer returning the index of next section.
757/// Point is in the frame of the divided volume.
758
760{
761 indnext = -1;
764 if (TMath::Abs(dir[2])<TGeoShape::Tolerance()) return dist;
765 if (td.fCurrent<0) {
766 Error("FindNextBoundary", "Must call FindNode first");
767 return dist;
768 }
769 Int_t inc = (dir[2]>0)?1:0;
770 dist = (fStep*(td.fCurrent+inc)-point[2])/dir[2];
771 if (dist<0.) Error("FindNextBoundary", "Negative distance d=%g",dist);
772 if (!inc) inc = -1;
773 indnext = td.fCurrent+inc;
774 return dist;
775}
776
777////////////////////////////////////////////////////////////////////////////////
778/// Make a copy of this finder. Reflect by Z if required.
779
781{
782 TGeoPatternZ *finder = new TGeoPatternZ(*this);
783 if (!reflect) return finder;
784 finder->Reflect();
785 return finder;
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// Save a primitive as a C++ statement(s) on output stream "out".
790
791void TGeoPatternZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
792{
793 Int_t iaxis = 3;
794 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
795}
796
797//______________________________________________________________________________
798// TGeoPatternParaX - a X axis divison pattern for PARA shape
799//______________________________________________________________________________
800
801////////////////////////////////////////////////////////////////////////////////
802/// Default constructor
803
805{
807}
808////////////////////////////////////////////////////////////////////////////////
809/// constructor
810
812 :TGeoPatternFinder(vol, ndivisions)
813{
814 Double_t dx = ((TGeoPara*)vol->GetShape())->GetX();
815 fStart = -dx;
816 fEnd = dx;
817 fStep = 2*dx/ndivisions;
819}
820////////////////////////////////////////////////////////////////////////////////
821/// constructor
822
824 :TGeoPatternFinder(vol, ndivisions)
825{
826 Double_t dx = ((TGeoPara*)vol->GetShape())->GetX();
827 fStart = -dx;
828 fEnd = fStart + ndivisions*step;
829 fStep = step;
831}
832////////////////////////////////////////////////////////////////////////////////
833/// constructor
834
836 :TGeoPatternFinder(vol, ndivisions)
837{
838 fStart = start;
839 fEnd = end;
840 fStep = (end - start)/ndivisions;
842}
843
844////////////////////////////////////////////////////////////////////////////////
845///copy constructor
846
849{
851}
852
853////////////////////////////////////////////////////////////////////////////////
854///assignment operator
855
857{
858 if(this!=&pf) {
861 }
862 return *this;
863}
864
865////////////////////////////////////////////////////////////////////////////////
866/// Destructor
867
869{
870}
871////////////////////////////////////////////////////////////////////////////////
872/// Update current division index and global matrix to point to a given slice.
873
875{
877 td.fCurrent=idiv;
878 td.fMatrix->SetDx(fStart+idiv*fStep+0.5*fStep);
879}
880
881////////////////////////////////////////////////////////////////////////////////
882/// Checks if the current point is on division boundary
883
885{
886 Double_t txy = ((TGeoPara*)fVolume->GetShape())->GetTxy();
887 Double_t txz = ((TGeoPara*)fVolume->GetShape())->GetTxz();
888 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
889 Double_t xt = point[0]-txz*point[2]-txy*(point[1]-tyz*point[2]);
890 Double_t seg = (xt-fStart)/fStep;
891 Double_t diff = seg - Int_t(seg);
892 if (diff>0.5) diff = 1.-diff;
893 if (diff<1e-8) return kTRUE;
894 return kFALSE;
895}
896
897////////////////////////////////////////////////////////////////////////////////
898/// get the node division containing the query point
899
901{
903 TGeoNode *node = 0;
904 Double_t txy = ((TGeoPara*)fVolume->GetShape())->GetTxy();
905 Double_t txz = ((TGeoPara*)fVolume->GetShape())->GetTxz();
906 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
907 Double_t xt = point[0]-txz*point[2]-txy*(point[1]-tyz*point[2]);
908 Int_t ind = (Int_t)(1.+(xt-fStart)/fStep)-1;
909 if (dir) {
910 Double_t ttsq = txy*txy + (txz-txy*tyz)*(txz-txy*tyz);
911 Double_t divdirx = 1./TMath::Sqrt(1.+ttsq);
912 Double_t divdiry = -txy*divdirx;
913 Double_t divdirz = -(txz-txy*tyz)*divdirx;
914 Double_t dot = dir[0]*divdirx + dir[1]*divdiry + dir[2]*divdirz;
915 td.fNextIndex = ind;
916 if (dot>0) td.fNextIndex++;
917 else td.fNextIndex--;
918 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
919 }
920 if ((ind<0) || (ind>=fNdivisions)) return node;
921 node = GetNodeOffset(ind);
922 cd(ind);
923 return node;
924}
925
926////////////////////////////////////////////////////////////////////////////////
927/// Make a copy of this finder. Reflect by Z if required.
928
930{
931 TGeoPatternParaX *finder = new TGeoPatternParaX(*this);
932 if (!reflect) return finder;
933 finder->Reflect();
934 return finder;
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// Save a primitive as a C++ statement(s) on output stream "out".
939
940void TGeoPatternParaX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
941{
942 Int_t iaxis = 1;
943 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
944}
945
946////////////////////////////////////////////////////////////////////////////////
947/// Return new matrix of type used by this finder.
948
950{
951 if (!IsReflected()) {
952 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
953 matrix->RegisterYourself();
954 return matrix;
955 }
956 TGeoCombiTrans *combi = new TGeoCombiTrans();
957 combi->RegisterYourself();
958 combi->ReflectZ(kTRUE);
959 combi->ReflectZ(kFALSE);
960 return combi;
961}
962
963////////////////////////////////////////////////////////////////////////////////
964/// Fills external matrix with the local one corresponding to the given division
965/// index.
966
968{
969 matrix.Clear();
970 matrix.SetDx(fStart+idiv*fStep+0.5*fStep);
971}
972
973//______________________________________________________________________________
974// TGeoPatternParaY - a Y axis divison pattern for PARA shape
975//______________________________________________________________________________
976
977////////////////////////////////////////////////////////////////////////////////
978/// Default constructor
979
981{
982 fTxy = 0;
984}
985////////////////////////////////////////////////////////////////////////////////
986/// constructor
987
989 :TGeoPatternFinder(vol, ndivisions)
990{
991 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
992 Double_t dy = ((TGeoPara*)vol->GetShape())->GetY();
993 fStart = -dy;
994 fEnd = dy;
995 fStep = 2*dy/ndivisions;
997}
998////////////////////////////////////////////////////////////////////////////////
999/// constructor
1000
1002 :TGeoPatternFinder(vol, ndivisions)
1003{
1004 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
1005 Double_t dy = ((TGeoPara*)vol->GetShape())->GetY();
1006 fStart = -dy;
1007 fEnd = fStart + ndivisions*step;
1008 fStep = step;
1010}
1011////////////////////////////////////////////////////////////////////////////////
1012/// constructor
1013
1015 :TGeoPatternFinder(vol, ndivisions)
1016{
1017 fTxy = ((TGeoPara*)vol->GetShape())->GetTxy();
1018 fStart = start;
1019 fEnd = end;
1020 fStep = (end - start)/ndivisions;
1022}
1023////////////////////////////////////////////////////////////////////////////////
1024///copy constructor
1025
1028{
1030}
1031
1032////////////////////////////////////////////////////////////////////////////////
1033///assignment operator
1034
1036{
1037 if(this!=&pf) {
1040 }
1041 return *this;
1042}
1043
1044////////////////////////////////////////////////////////////////////////////////
1045/// Destructor
1046
1048{
1049}
1050////////////////////////////////////////////////////////////////////////////////
1051/// Update current division index and global matrix to point to a given slice.
1052
1054{
1056 td.fCurrent = idiv;
1057 Double_t dy = fStart+idiv*fStep+0.5*fStep;
1058 td.fMatrix->SetDx(fTxy*dy);
1059 td.fMatrix->SetDy(dy);
1060}
1061
1062////////////////////////////////////////////////////////////////////////////////
1063/// Checks if the current point is on division boundary
1064
1066{
1067 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
1068 Double_t yt = point[1]-tyz*point[2];
1069 Double_t seg = (yt-fStart)/fStep;
1070 Double_t diff = seg - Int_t(seg);
1071 if (diff>0.5) diff = 1.-diff;
1072 if (diff<1e-8) return kTRUE;
1073 return kFALSE;
1074}
1075
1076////////////////////////////////////////////////////////////////////////////////
1077/// get the node division containing the query point
1078
1080{
1082 TGeoNode *node = 0;
1083 Double_t tyz = ((TGeoPara*)fVolume->GetShape())->GetTyz();
1084 Double_t yt = point[1]-tyz*point[2];
1085 Int_t ind = (Int_t)(1.+(yt-fStart)/fStep) - 1;
1086 if (dir) {
1087 Double_t divdiry = 1./TMath::Sqrt(1.+tyz*tyz);
1088 Double_t divdirz = -tyz*divdiry;
1089 Double_t dot = dir[1]*divdiry + dir[2]*divdirz;
1090 td.fNextIndex = ind;
1091 if (dot>0) td.fNextIndex++;
1092 else td.fNextIndex--;
1093 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1094 }
1095 if ((ind<0) || (ind>=fNdivisions)) return node;
1096 node = GetNodeOffset(ind);
1097 cd(ind);
1098 return node;
1099}
1100
1101////////////////////////////////////////////////////////////////////////////////
1102/// Make a copy of this finder. Reflect by Z if required.
1103
1105{
1106 TGeoPatternParaY *finder = new TGeoPatternParaY(*this);
1107 if (!reflect) return finder;
1108 finder->Reflect();
1109 return finder;
1110}
1111
1112////////////////////////////////////////////////////////////////////////////////
1113/// Save a primitive as a C++ statement(s) on output stream "out".
1114
1115void TGeoPatternParaY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1116{
1117 Int_t iaxis = 2;
1118 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1119}
1120
1121////////////////////////////////////////////////////////////////////////////////
1122/// Return new matrix of type used by this finder.
1123
1125{
1126 if (!IsReflected()) {
1127 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1128 matrix->RegisterYourself();
1129 return matrix;
1130 }
1131 TGeoCombiTrans *combi = new TGeoCombiTrans();
1132 combi->RegisterYourself();
1133 combi->ReflectZ(kTRUE);
1134 combi->ReflectZ(kFALSE);
1135 return combi;
1136}
1137
1138////////////////////////////////////////////////////////////////////////////////
1139/// Fills external matrix with the local one corresponding to the given division
1140/// index.
1141
1143{
1144 matrix.Clear();
1145 Double_t dy = fStart+idiv*fStep+0.5*fStep;
1146 matrix.SetDx(fTxy*dy);
1147 matrix.SetDy(dy);
1148}
1149
1150//______________________________________________________________________________
1151// TGeoPatternParaZ - a Z axis divison pattern for PARA shape
1152//______________________________________________________________________________
1153
1154////////////////////////////////////////////////////////////////////////////////
1155/// Default constructor
1156
1158{
1159 fTxz = 0;
1160 fTyz = 0;
1162}
1163////////////////////////////////////////////////////////////////////////////////
1164/// constructor
1165
1167 :TGeoPatternFinder(vol, ndivisions)
1168{
1169 fTxz = ((TGeoPara*)vol->GetShape())->GetTxz();
1170 fTyz = ((TGeoPara*)vol->GetShape())->GetTyz();
1171 Double_t dz = ((TGeoPara*)vol->GetShape())->GetZ();
1172 fStart = -dz;
1173 fEnd = dz;
1174 fStep = 2*dz/ndivisions;
1176}
1177////////////////////////////////////////////////////////////////////////////////
1178/// constructor
1179
1181 :TGeoPatternFinder(vol, ndivisions)
1182{
1183 fTxz = ((TGeoPara*)vol->GetShape())->GetTxz();
1184 fTyz = ((TGeoPara*)vol->GetShape())->GetTyz();
1185 Double_t dz = ((TGeoPara*)vol->GetShape())->GetZ();
1186 fStart = -dz;
1187 fEnd = fStart + ndivisions*step;
1188 fStep = step;
1190}
1191
1192////////////////////////////////////////////////////////////////////////////////
1193/// constructor
1194
1196 :TGeoPatternFinder(vol, ndivisions)
1197{
1198 fTxz = ((TGeoPara*)vol->GetShape())->GetTxz();
1199 fTyz = ((TGeoPara*)vol->GetShape())->GetTyz();
1200 fStart = start;
1201 fEnd = end;
1202 fStep = (end - start)/ndivisions;
1204}
1205
1206////////////////////////////////////////////////////////////////////////////////
1207///copy constructor
1208
1211{
1213}
1214
1215////////////////////////////////////////////////////////////////////////////////
1216///assignment operator
1217
1219{
1220 if(this!=&pf) {
1223 }
1224 return *this;
1225}
1226
1227////////////////////////////////////////////////////////////////////////////////
1228/// Destructor
1229
1231{
1232}
1233
1234////////////////////////////////////////////////////////////////////////////////
1235/// Update current division index and global matrix to point to a given slice.
1236
1238{
1240 td.fCurrent = idiv;
1241 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1242 td.fMatrix->SetDx(fTxz*dz);
1243 td.fMatrix->SetDy(fTyz*dz);
1244 td.fMatrix->SetDz((IsReflected())?-dz:dz);
1245}
1246
1247////////////////////////////////////////////////////////////////////////////////
1248/// Checks if the current point is on division boundary
1249
1251{
1252 Double_t seg = (point[2]-fStart)/fStep;
1253 Double_t diff = seg - Int_t(seg);
1254 if (diff>0.5) diff = 1.-diff;
1255 if (diff<1e-8) return kTRUE;
1256 return kFALSE;
1257}
1258
1259////////////////////////////////////////////////////////////////////////////////
1260/// get the node division containing the query point
1261
1263{
1265 TGeoNode *node = 0;
1266 Double_t zt = point[2];
1267 Int_t ind = (Int_t)(1.+(zt-fStart)/fStep) - 1;
1268 if (dir) {
1269 td.fNextIndex = ind;
1270 if (dir[2]>0) td.fNextIndex++;
1271 else td.fNextIndex--;
1272 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1273 }
1274 if ((ind<0) || (ind>=fNdivisions)) return node;
1275 node = GetNodeOffset(ind);
1276 cd(ind);
1277 return node;
1278}
1279
1280////////////////////////////////////////////////////////////////////////////////
1281/// Make a copy of this finder. Reflect by Z if required.
1282
1284{
1285 TGeoPatternParaZ *finder = new TGeoPatternParaZ(*this);
1286 if (!reflect) return finder;
1287 finder->Reflect();
1288 return finder;
1289}
1290
1291////////////////////////////////////////////////////////////////////////////////
1292/// Save a primitive as a C++ statement(s) on output stream "out".
1293
1294void TGeoPatternParaZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1295{
1296 Int_t iaxis = 3;
1297 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1298}
1299
1300////////////////////////////////////////////////////////////////////////////////
1301/// Return new matrix of type used by this finder.
1302
1304{
1305 if (!IsReflected()) {
1306 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1307 matrix->RegisterYourself();
1308 return matrix;
1309 }
1310 TGeoCombiTrans *combi = new TGeoCombiTrans();
1311 combi->RegisterYourself();
1312 combi->ReflectZ(kTRUE);
1313 combi->ReflectZ(kFALSE);
1314 return combi;
1315}
1316
1317////////////////////////////////////////////////////////////////////////////////
1318/// Fills external matrix with the local one corresponding to the given division
1319/// index.
1320
1322{
1323 matrix.Clear();
1324 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1325 matrix.SetDx(fTxz*dz);
1326 matrix.SetDy(fTyz*dz);
1327 matrix.SetDz((IsReflected())?-dz:dz);
1328}
1329
1330//______________________________________________________________________________
1331// TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
1332//______________________________________________________________________________
1333
1334////////////////////////////////////////////////////////////////////////////////
1335/// Default constructor
1336
1338{
1339 fTxz = 0;
1340 fTyz = 0;
1342}
1343////////////////////////////////////////////////////////////////////////////////
1344/// constructor
1345
1347 :TGeoPatternFinder(vol, ndivisions)
1348{
1349 Double_t theta = ((TGeoTrap*)vol->GetShape())->GetTheta();
1350 Double_t phi = ((TGeoTrap*)vol->GetShape())->GetPhi();
1353 Double_t dz = ((TGeoArb8*)vol->GetShape())->GetDz();
1354 fStart = -dz;
1355 fEnd = dz;
1356 fStep = 2*dz/ndivisions;
1358}
1359////////////////////////////////////////////////////////////////////////////////
1360/// constructor
1361
1363 :TGeoPatternFinder(vol, ndivisions)
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 = fStart + ndivisions*step;
1372 fStep = step;
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 fStart = start;
1386 fEnd = end;
1387 fStep = (end - start)/ndivisions;
1389}
1390
1391////////////////////////////////////////////////////////////////////////////////
1392///copy constructor
1393
1396 fTxz(pf.fTxz),
1397 fTyz(pf.fTyz)
1398{
1400}
1401
1402////////////////////////////////////////////////////////////////////////////////
1403///assignment operator
1404
1406{
1407 if(this!=&pf) {
1409 fTxz = pf.fTxz;
1410 fTyz = pf.fTyz;
1412 }
1413 return *this;
1414}
1415
1416////////////////////////////////////////////////////////////////////////////////
1417/// Destructor
1418
1420{
1421}
1422////////////////////////////////////////////////////////////////////////////////
1423/// Update current division index and global matrix to point to a given slice.
1424
1426{
1428 td.fCurrent = idiv;
1429 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1430 td.fMatrix->SetDx(fTxz*dz);
1431 td.fMatrix->SetDy(fTyz*dz);
1432 td.fMatrix->SetDz((IsReflected())?-dz:dz);
1433}
1434
1435////////////////////////////////////////////////////////////////////////////////
1436/// Checks if the current point is on division boundary
1437
1439{
1440 Double_t seg = (point[2]-fStart)/fStep;
1441 Double_t diff = seg - Int_t(seg);
1442 if (diff>0.5) diff = 1.-diff;
1443 if (diff<1e-8) return kTRUE;
1444 return kFALSE;
1445}
1446
1447////////////////////////////////////////////////////////////////////////////////
1448/// get the node division containing the query point
1449
1451{
1453 TGeoNode *node = 0;
1454 Double_t zt = point[2];
1455 Int_t ind = (Int_t)(1. + (zt-fStart)/fStep) - 1;
1456 if (dir) {
1457 td.fNextIndex = ind;
1458 if (dir[2]>0) td.fNextIndex++;
1459 else td.fNextIndex--;
1460 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1461 }
1462 if ((ind<0) || (ind>=fNdivisions)) return node;
1463 node = GetNodeOffset(ind);
1464 cd(ind);
1465 return node;
1466}
1467
1468////////////////////////////////////////////////////////////////////////////////
1469/// Make a copy of this finder. Reflect by Z if required.
1470
1472{
1473 TGeoPatternTrapZ *finder = new TGeoPatternTrapZ(*this);
1474 if (!reflect) return finder;
1475 finder->Reflect();
1476 return finder;
1477}
1478
1479////////////////////////////////////////////////////////////////////////////////
1480/// Save a primitive as a C++ statement(s) on output stream "out".
1481
1482void TGeoPatternTrapZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1483{
1484 Int_t iaxis = 3;
1485 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1486}
1487
1488////////////////////////////////////////////////////////////////////////////////
1489/// Return new matrix of type used by this finder.
1490
1492{
1493 if (!IsReflected()) {
1494 TGeoMatrix *matrix = new TGeoTranslation(0.,0.,0.);
1495 matrix->RegisterYourself();
1496 return matrix;
1497 }
1498 TGeoCombiTrans *combi = new TGeoCombiTrans();
1499 combi->RegisterYourself();
1500 combi->ReflectZ(kTRUE);
1501 combi->ReflectZ(kFALSE);
1502 return combi;
1503}
1504
1505////////////////////////////////////////////////////////////////////////////////
1506/// Fills external matrix with the local one corresponding to the given division
1507/// index.
1508
1510{
1511 matrix.Clear();
1512 Double_t dz = fStart+idiv*fStep+0.5*fStep;
1513 matrix.SetDx(fTxz*dz);
1514 matrix.SetDy(fTyz*dz);
1515 matrix.SetDz((IsReflected())?-dz:dz);
1516}
1517
1518//______________________________________________________________________________
1519// TGeoPatternCylR - a cylindrical R divison pattern
1520//______________________________________________________________________________
1521
1522////////////////////////////////////////////////////////////////////////////////
1523/// Default constructor
1524
1526{
1528}
1529////////////////////////////////////////////////////////////////////////////////
1530/// constructor
1531
1533 :TGeoPatternFinder(vol, ndivisions)
1534{
1536}
1537////////////////////////////////////////////////////////////////////////////////
1538/// constructor
1539
1541 :TGeoPatternFinder(vol, ndivisions)
1542{
1543 fStep = step;
1545// compute start, end
1546}
1547////////////////////////////////////////////////////////////////////////////////
1548/// constructor
1549
1551 :TGeoPatternFinder(vol, ndivisions)
1552{
1553 fStart = start;
1554 fEnd = end;
1555 fStep = (end - start)/ndivisions;
1557}
1558////////////////////////////////////////////////////////////////////////////////
1559///copy constructor
1560
1563{
1565}
1566
1567////////////////////////////////////////////////////////////////////////////////
1568///assignment operator
1569
1571{
1572 if(this!=&pf) {
1575 }
1576 return *this;
1577}
1578
1579////////////////////////////////////////////////////////////////////////////////
1580/// Destructor
1581
1583{
1584}
1585
1586////////////////////////////////////////////////////////////////////////////////
1587/// Checks if the current point is on division boundary
1588
1590{
1591 Double_t r = TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
1592 Double_t seg = (r-fStart)/fStep;
1593 Double_t diff = seg - Int_t(seg);
1594 if (diff>0.5) diff = 1.-diff;
1595 if (diff<1e-8) return kTRUE;
1596 return kFALSE;
1597}
1598
1599////////////////////////////////////////////////////////////////////////////////
1600/// Update current division index and global matrix to point to a given slice.
1601
1603{
1605 td.fCurrent=idiv;
1606}
1607
1608////////////////////////////////////////////////////////////////////////////////
1609/// find the node containing the query point
1610
1612{
1614 if (!td.fMatrix) td.fMatrix = gGeoIdentity;
1615 TGeoNode *node = 0;
1616 Double_t r = TMath::Sqrt(point[0]*point[0]+point[1]*point[1]);
1617 Int_t ind = (Int_t)(1. + (r-fStart)/fStep) - 1;
1618 if (dir) {
1619 td.fNextIndex = ind;
1620 Double_t dot = point[0]*dir[0] + point[1]*dir[1];
1621 if (dot>0) td.fNextIndex++;
1622 else td.fNextIndex--;
1623 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1624 }
1625 if ((ind<0) || (ind>=fNdivisions)) return node;
1626 node = GetNodeOffset(ind);
1627 cd(ind);
1628 return node;
1629}
1630
1631////////////////////////////////////////////////////////////////////////////////
1632/// Make a copy of this finder. Reflect by Z if required.
1633
1635{
1636 TGeoPatternCylR *finder = new TGeoPatternCylR(*this);
1637 if (!reflect) return finder;
1638 finder->Reflect();
1639 return finder;
1640}
1641
1642////////////////////////////////////////////////////////////////////////////////
1643/// Save a primitive as a C++ statement(s) on output stream "out".
1644
1645void TGeoPatternCylR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1646{
1647 Int_t iaxis = 1;
1648 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1649}
1650
1651////////////////////////////////////////////////////////////////////////////////
1652/// Return new matrix of type used by this finder.
1653
1655{
1656 return gGeoIdentity;
1657}
1658
1659////////////////////////////////////////////////////////////////////////////////
1660/// Fills external matrix with the local one corresponding to the given division
1661/// index.
1662
1664{
1665 matrix.Clear();
1666}
1667
1668//______________________________________________________________________________
1669// TGeoPatternCylPhi - a cylindrical phi divison pattern
1670//______________________________________________________________________________
1671
1672////////////////////////////////////////////////////////////////////////////////
1673/// Default constructor
1674
1676{
1677 fSinCos = 0;
1679}
1680////////////////////////////////////////////////////////////////////////////////
1681/// constructor
1682/// compute step, start, end
1683
1685 :TGeoPatternFinder(vol, ndivisions)
1686{
1687 fStart = 0;
1688 fEnd = 0;
1689 fStep = 0;
1690 fSinCos = new Double_t[2*fNdivisions];
1691 for (Int_t i = 0; i<fNdivisions; i++) {
1693 fSinCos[2*i+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+i*fStep));
1694 }
1696}
1697////////////////////////////////////////////////////////////////////////////////
1698/// constructor
1699
1701 :TGeoPatternFinder(vol, ndivisions)
1702{
1703 fStep = step;
1704 fSinCos = new Double_t[2*ndivisions];
1705 for (Int_t i = 0; i<fNdivisions; i++) {
1707 fSinCos[2*i+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+i*fStep));
1708 }
1710// compute start, end
1711}
1712////////////////////////////////////////////////////////////////////////////////
1713/// constructor
1714
1716 :TGeoPatternFinder(vol, ndivisions)
1717{
1718 fStart = start;
1719 if (fStart<0) fStart+=360;
1720 fEnd = end;
1721 if (fEnd<0) fEnd+=360;
1722 if ((end-start)<0)
1723 fStep = (end-start+360)/ndivisions;
1724 else
1725 fStep = (end-start)/ndivisions;
1726 fSinCos = new Double_t[2*ndivisions];
1727 for (Int_t idiv = 0; idiv<ndivisions; idiv++) {
1728 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(start+0.5*fStep+idiv*fStep));
1729 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(start+0.5*fStep+idiv*fStep));
1730 }
1732}
1733////////////////////////////////////////////////////////////////////////////////
1734/// Destructor
1735
1737{
1738 if (fSinCos) delete [] fSinCos;
1739}
1740////////////////////////////////////////////////////////////////////////////////
1741/// Update current division index and global matrix to point to a given slice.
1742
1744{
1746 td.fCurrent = idiv;
1747 ((TGeoRotation*)td.fMatrix)->FastRotZ(&fSinCos[2*idiv]);
1748}
1749
1750////////////////////////////////////////////////////////////////////////////////
1751/// Checks if the current point is on division boundary
1752
1754{
1755 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
1756 if (phi<0) phi += 360;
1757 Double_t ddp = phi - fStart;
1758 if (ddp<0) ddp+=360;
1759 Double_t seg = ddp/fStep;
1760 Double_t diff = seg - Int_t(seg);
1761 if (diff>0.5) diff = 1.-diff;
1762 if (diff<1e-8) return kTRUE;
1763 return kFALSE;
1764}
1765
1766////////////////////////////////////////////////////////////////////////////////
1767/// find the node containing the query point
1768
1770{
1772 TGeoNode *node = 0;
1773 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
1774 if (phi<0) phi += 360;
1775// Double_t dphi = fStep*fNdivisions;
1776 Double_t ddp = phi - fStart;
1777 if (ddp<0) ddp+=360;
1778// if (ddp>360) ddp-=360;
1779 Int_t ind = (Int_t)(1. + ddp/fStep) - 1;
1780 if (dir) {
1781 td.fNextIndex = ind;
1782 Double_t dot = point[0]*dir[1]-point[1]*dir[0];
1783 if (dot>0) td.fNextIndex++;
1784 else td.fNextIndex--;
1785 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
1786 }
1787 if ((ind<0) || (ind>=fNdivisions)) return node;
1788 node = GetNodeOffset(ind);
1789 cd(ind);
1790 return node;
1791}
1792
1793////////////////////////////////////////////////////////////////////////////////
1794/// Make a copy of this finder. Reflect by Z if required.
1795
1797{
1798 TGeoPatternCylPhi *finder = new TGeoPatternCylPhi(*this);
1799 if (!reflect) return finder;
1800 finder->Reflect();
1801 return finder;
1802}
1803
1804////////////////////////////////////////////////////////////////////////////////
1805/// Save a primitive as a C++ statement(s) on output stream "out".
1806
1807void TGeoPatternCylPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1808{
1809 Int_t iaxis = 2;
1810 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1811}
1812
1813////////////////////////////////////////////////////////////////////////////////
1814/// Stream an object of class TGeoVolume.
1815
1816void TGeoPatternCylPhi::Streamer(TBuffer &R__b)
1817{
1818 if (R__b.IsReading()) {
1820 if (fNdivisions) {
1821 fSinCos = new Double_t[2*fNdivisions];
1822 for (Int_t idiv = 0; idiv<fNdivisions; idiv++) {
1823 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
1824 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
1825 }
1826 }
1827 } else {
1829 }
1830}
1831
1832////////////////////////////////////////////////////////////////////////////////
1833/// Return new matrix of type used by this finder.
1834
1836{
1837 if (!IsReflected()) {
1838 TGeoRotation *matrix = new TGeoRotation();
1839 matrix->RegisterYourself();
1840 return matrix;
1841 }
1842 TGeoRotation *rot = new TGeoRotation();
1843 rot->RegisterYourself();
1844 rot->ReflectZ(kTRUE);
1845 rot->ReflectZ(kFALSE);
1846 return rot;
1847}
1848
1849////////////////////////////////////////////////////////////////////////////////
1850/// Fills external matrix with the local one corresponding to the given division
1851/// index.
1852
1854{
1855 matrix.Clear();
1856 matrix.FastRotZ(&fSinCos[2*idiv]);
1857}
1858
1859//______________________________________________________________________________
1860// TGeoPatternSphR - a spherical R divison pattern
1861//______________________________________________________________________________
1862
1863////////////////////////////////////////////////////////////////////////////////
1864/// Default constructor
1865
1867{
1869}
1870////////////////////////////////////////////////////////////////////////////////
1871/// constructor
1872/// compute step, start, end
1873
1875 :TGeoPatternFinder(vol, ndivisions)
1876{
1878}
1879////////////////////////////////////////////////////////////////////////////////
1880/// constructor
1881
1883 :TGeoPatternFinder(vol, ndivisions)
1884{
1885 fStep = step;
1887// compute start, end
1888}
1889////////////////////////////////////////////////////////////////////////////////
1890/// constructor
1891
1893 :TGeoPatternFinder(vol, ndivisions)
1894{
1895 fStart = start;
1896 fEnd = end;
1897 fStep = (end - start)/ndivisions;
1899}
1900////////////////////////////////////////////////////////////////////////////////
1901///copy constructor
1902
1905{
1907}
1908
1909////////////////////////////////////////////////////////////////////////////////
1910///assignment operator
1911
1913{
1914 if(this!=&pf) {
1917 }
1918 return *this;
1919}
1920
1921////////////////////////////////////////////////////////////////////////////////
1922/// Destructor
1923
1925{
1926}
1927////////////////////////////////////////////////////////////////////////////////
1928/// Update current division index and global matrix to point to a given slice.
1929
1931{
1933 td.fCurrent = idiv;
1934}
1935////////////////////////////////////////////////////////////////////////////////
1936/// find the node containing the query point
1937
1939{
1940 return 0;
1941}
1942
1943////////////////////////////////////////////////////////////////////////////////
1944/// Make a copy of this finder. Reflect by Z if required.
1945
1947{
1948 TGeoPatternSphR *finder = new TGeoPatternSphR(*this);
1949 return finder;
1950}
1951
1952////////////////////////////////////////////////////////////////////////////////
1953/// Save a primitive as a C++ statement(s) on output stream "out".
1954
1955void TGeoPatternSphR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1956{
1957 Int_t iaxis = 1;
1958 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1959}
1960
1961////////////////////////////////////////////////////////////////////////////////
1962/// Return new matrix of type used by this finder.
1963
1965{
1966 return gGeoIdentity;
1967}
1968
1969////////////////////////////////////////////////////////////////////////////////
1970/// Fills external matrix with the local one corresponding to the given division
1971/// index.
1972
1974{
1975 matrix.Clear();
1976}
1977
1978//______________________________________________________________________________
1979// TGeoPatternSphTheta - a spherical theta divison pattern
1980//______________________________________________________________________________
1981
1982////////////////////////////////////////////////////////////////////////////////
1983/// Default constructor
1984
1986{
1988}
1989////////////////////////////////////////////////////////////////////////////////
1990/// constructor
1991/// compute step, start, end
1992
1994 :TGeoPatternFinder(vol, ndivisions)
1995{
1997}
1998////////////////////////////////////////////////////////////////////////////////
1999/// constructor
2000
2002 :TGeoPatternFinder(vol, ndivisions)
2003{
2004 fStep = step;
2006// compute start, end
2007}
2008////////////////////////////////////////////////////////////////////////////////
2009/// constructor
2010
2012 :TGeoPatternFinder(vol, ndivisions)
2013{
2014 fStart = start;
2015 fEnd = end;
2016 fStep = (end - start)/ndivisions;
2018}
2019////////////////////////////////////////////////////////////////////////////////
2020///copy constructor
2021
2024{
2026}
2027////////////////////////////////////////////////////////////////////////////////
2028///assignment operator
2029
2031{
2032 if(this!=&pf) {
2035 }
2036 return *this;
2037}
2038////////////////////////////////////////////////////////////////////////////////
2039/// Destructor
2040
2042{
2043}
2044////////////////////////////////////////////////////////////////////////////////
2045/// Update current division index and global matrix to point to a given slice.
2046
2048{
2050 td.fCurrent=idiv;
2051}
2052////////////////////////////////////////////////////////////////////////////////
2053/// find the node containing the query point
2054
2056{
2057 return 0;
2058}
2059
2060////////////////////////////////////////////////////////////////////////////////
2061/// Make a copy of this finder. Reflect by Z if required.
2062
2064{
2065 TGeoPatternSphTheta *finder = new TGeoPatternSphTheta(*this);
2066 return finder;
2067}
2068
2069////////////////////////////////////////////////////////////////////////////////
2070/// Save a primitive as a C++ statement(s) on output stream "out".
2071
2072void TGeoPatternSphTheta::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2073{
2074 Int_t iaxis = 2;
2075 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2076}
2077
2078////////////////////////////////////////////////////////////////////////////////
2079/// Return new matrix of type used by this finder.
2080
2082{
2083 return gGeoIdentity;
2084}
2085
2086////////////////////////////////////////////////////////////////////////////////
2087/// Fills external matrix with the local one corresponding to the given division
2088/// index.
2089
2091{
2092 matrix.Clear();
2093}
2094
2095//______________________________________________________________________________
2096// TGeoPatternSphPhi - a spherical phi divison pattern
2097//______________________________________________________________________________
2098
2099////////////////////////////////////////////////////////////////////////////////
2100/// Default constructor
2101
2103{
2104 fSinCos = 0;
2106}
2107////////////////////////////////////////////////////////////////////////////////
2108/// constructor
2109/// compute step, start, end
2110
2112 :TGeoPatternFinder(vol, ndivisions)
2113{
2114 fStart = 0;
2115 fEnd = 360.;
2116 fStep = 360./ndivisions;
2117 CreateSinCos();
2119}
2120////////////////////////////////////////////////////////////////////////////////
2121/// constructor
2122/// compute start, end
2123
2125 :TGeoPatternFinder(vol, ndivisions)
2126{
2127 fStep = step;
2128 CreateSinCos();
2130}
2131////////////////////////////////////////////////////////////////////////////////
2132/// constructor
2133/// compute step
2134
2136 :TGeoPatternFinder(vol, ndivisions)
2137{
2138 fStart = start;
2139 if (fStart<0) fStart+=360;
2140 fEnd = end;
2141 if (fEnd<0) fEnd+=360;
2142 if ((end-start)<0)
2143 fStep = (end-start+360)/ndivisions;
2144 else
2145 fStep = (end-start)/ndivisions;
2146 CreateSinCos();
2148}
2149
2150////////////////////////////////////////////////////////////////////////////////
2151/// Destructor
2152
2154{
2155 delete [] fSinCos;
2156}
2157
2158////////////////////////////////////////////////////////////////////////////////
2159/// Create the sincos table if it does not exist
2160
2162{
2163 fSinCos = new Double_t[2*fNdivisions];
2164 for (Int_t idiv = 0; idiv<fNdivisions; idiv++) {
2165 fSinCos[2*idiv] = TMath::Sin(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
2166 fSinCos[2*idiv+1] = TMath::Cos(TMath::DegToRad()*(fStart+0.5*fStep+idiv*fStep));
2167 }
2168 return fSinCos;
2169}
2170
2171////////////////////////////////////////////////////////////////////////////////
2172/// Update current division index and global matrix to point to a given slice.
2173
2175{
2177 td.fCurrent = idiv;
2178 if (!fSinCos) CreateSinCos();
2179 ((TGeoRotation*)td.fMatrix)->FastRotZ(&fSinCos[2*idiv]);
2180}
2181
2182////////////////////////////////////////////////////////////////////////////////
2183/// Checks if the current point is on division boundary
2184
2186{
2187 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
2188 if (phi<0) phi += 360;
2189 Double_t ddp = phi - fStart;
2190 if (ddp<0) ddp+=360;
2191 Double_t seg = ddp/fStep;
2192 Double_t diff = seg - Int_t(seg);
2193 if (diff>0.5) diff = 1.-diff;
2194 if (diff<1e-8) return kTRUE;
2195 return kFALSE;
2196}
2197////////////////////////////////////////////////////////////////////////////////
2198/// find the node containing the query point
2199
2201{
2203 TGeoNode *node = 0;
2204 Double_t phi = TMath::ATan2(point[1], point[0])*TMath::RadToDeg();
2205 if (phi<0) phi += 360;
2206// Double_t dphi = fStep*fNdivisions;
2207 Double_t ddp = phi - fStart;
2208 if (ddp<0) ddp+=360;
2209// if (ddp>360) ddp-=360;
2210 Int_t ind = (Int_t)(1. + ddp/fStep) - 1;
2211 if (dir) {
2212 td.fNextIndex = ind;
2213 Double_t dot = point[0]*dir[1]-point[1]*dir[0];
2214 if (dot>0) td.fNextIndex++;
2215 else td.fNextIndex--;
2216 if ((td.fNextIndex<0) || (td.fNextIndex>=fNdivisions)) td.fNextIndex = -1;
2217 }
2218 if ((ind<0) || (ind>=fNdivisions)) return node;
2219 node = GetNodeOffset(ind);
2220 cd(ind);
2221 return node;
2222}
2223////////////////////////////////////////////////////////////////////////////////
2224/// Make a copy of this finder. Reflect by Z if required.
2225
2227{
2229 if (!reflect) return finder;
2230 finder->Reflect();
2231 return finder;
2232}
2233
2234////////////////////////////////////////////////////////////////////////////////
2235/// Save a primitive as a C++ statement(s) on output stream "out".
2236
2237void TGeoPatternSphPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2238{
2239 Int_t iaxis = 2;
2240 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2241}
2242////////////////////////////////////////////////////////////////////////////////
2243/// Return new matrix of type used by this finder.
2244
2246{
2247 if (!IsReflected()) {
2248 TGeoRotation *matrix = new TGeoRotation();
2249 matrix->RegisterYourself();
2250 return matrix;
2251 }
2252 TGeoRotation *rot = new TGeoRotation();
2253 rot->RegisterYourself();
2254 rot->ReflectZ(kTRUE);
2255 rot->ReflectZ(kFALSE);
2256 return rot;
2257}
2258////////////////////////////////////////////////////////////////////////////////
2259/// Fills external matrix with the local one corresponding to the given division
2260/// index.
2261
2263{
2264 if (!fSinCos) ((TGeoPatternSphPhi*)this)->CreateSinCos();
2265 matrix.Clear();
2266 matrix.FastRotZ(&fSinCos[2*idiv]);
2267}
2268
2269//______________________________________________________________________________
2270// TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
2271//______________________________________________________________________________
2272
2273////////////////////////////////////////////////////////////////////////////////
2274/// Default constructor
2275
2277{
2278 fNrows = 0;
2279 fAxisOnRows = 0;
2280 fNdivisions = 0;
2281 fStart = 0;
2283}
2284////////////////////////////////////////////////////////////////////////////////
2285/// Default constructor
2286
2288 :TGeoPatternFinder(vol, nrows)
2289{
2290 fNrows = nrows;
2291 fAxisOnRows = 0;
2292 fNdivisions = 0;
2293 fStart = 0;
2295// compute everything else
2296}
2297////////////////////////////////////////////////////////////////////////////////
2298///copy constructor
2299
2301 TGeoPatternFinder(pfh),
2302 fNrows(pfh.fNrows),
2303 fAxisOnRows(pfh.fAxisOnRows),
2304 fNdivisions(pfh.fNdivisions),
2305 fStart(pfh.fStart)
2306{
2308}
2309
2310////////////////////////////////////////////////////////////////////////////////
2311///assignment operator
2312
2314{
2315 if(this!=&pfh) {
2317 fNrows=pfh.fNrows;
2320 fStart=pfh.fStart;
2322 }
2323 return *this;
2324}
2325////////////////////////////////////////////////////////////////////////////////
2326/// destructor
2327
2329{
2330}
2331////////////////////////////////////////////////////////////////////////////////
2332/// Update current division index and global matrix to point to a given slice.
2333
2335{
2337 td.fCurrent=idiv;
2338}
2339////////////////////////////////////////////////////////////////////////////////
2340/// find the node containing the query point
2341
2343{
2344 return 0;
2345}
2346
2347////////////////////////////////////////////////////////////////////////////////
2348/// Return new matrix of type used by this finder.
2349
2351{
2352 return gGeoIdentity;
2353}
2354
2355////////////////////////////////////////////////////////////////////////////////
2356/// Fills external matrix with the local one corresponding to the given division
2357/// index.
2358
2360{
2361 matrix.Clear();
2362}
void Class()
Definition: Class.C:29
ROOT::R::TRInterface & r
Definition: Object.C:4
#define e(i)
Definition: RSha256.hxx:103
int Int_t
Definition: RtypesCore.h:43
const Bool_t kFALSE
Definition: RtypesCore.h:90
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
long long Long64_t
Definition: RtypesCore.h:71
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
R__EXTERN TGeoIdentity * gGeoIdentity
Definition: TGeoMatrix.h:478
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Bool_t IsReading() const
Definition: TBuffer.h:85
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.
Definition: TGeoMatrix.cxx:526
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)
TGeoVolume * fVolume
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:47
TGeoShape * GetShape() const
Definition: TGeoVolume.h:186
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:891
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
Double_t ATan2(Double_t y, Double_t x)
Definition: TMath.h:669
constexpr Double_t DegToRad()
Conversion from degree to radian:
Definition: TMath.h:82
Double_t Sqrt(Double_t x)
Definition: TMath.h:681
Double_t Cos(Double_t)
Definition: TMath.h:631
Double_t Sin(Double_t)
Definition: TMath.h:627
Double_t Tan(Double_t)
Definition: TMath.h:635
constexpr Double_t RadToDeg()
Conversion from radian to degree:
Definition: TMath.h:74
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
Int_t fNextIndex
current division element