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
39std::atomic<UInt_t> TGeoPatternFinder::fgInstanceCount{0};
40
41////////////////////////////////////////////////////////////////////////////////
42/// (Re)build the per-thread scratch state for this finder into the given slot.
43/// Cold path: runs once per (thread, finder, generation).
44
46{
48 if (!manager) {
49 Error("InitThreadSlot", "Pattern finder has no owning geometry manager");
50 return;
51 }
52 if (!td.fMatrix) {
53 // CreateMatrix() registers the new matrix with the geometry manager, which mutates a
54 // shared, unlocked TObjArray. Lazy initialization means several threads can reach this
55 // on first touch concurrently, so serialize the registration. Taken once per
56 // (thread, finder); steady-state navigation is lock-free.
57 static std::mutex sInitMutex;
58 std::lock_guard<std::mutex> guard(sInitMutex);
59 td.fMatrix = CreateMatrix();
60 }
61 // A generation bump only invalidates the cached division indices. The matrix stays valid for
62 // its owning manager's lifetime and is deliberately reused. The manager releases it during
63 // destruction; replacing it here would retain another matrix on every ClearThreadData().
64 td.fCurrent = -1;
65 td.fNextIndex = -1;
66 td.fInitGen = fGeneration.load(std::memory_order_acquire);
67}
68
69////////////////////////////////////////////////////////////////////////////////
70/// Return the identity matrix owned by this finder's geometry manager.
71
73{
75 return manager ? static_cast<TGeoMatrix *>(manager->GetListOfMatrices()->At(0)) : nullptr;
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// Register a lazily-created pattern matrix with the manager owning this finder's volume.
80
82{
84 if (!manager || !matrix)
85 return;
86 if (!matrix->IsRegistered()) {
87 manager->RegisterMatrix(matrix);
89 }
90 if (matrix->IsCombi()) {
91 TGeoRotation *rotation = static_cast<TGeoCombiTrans *>(matrix)->GetRotation();
92 if (rotation && rotation->IsRotation())
94 }
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Default constructor
99
101{
102 fNdivisions = 0;
103 fDivIndex = 0;
104 fStep = 0;
105 fStart = 0;
106 fEnd = 0;
107 fVolume = nullptr;
108}
109
110////////////////////////////////////////////////////////////////////////////////
111/// Default constructor
112
114{
115 fVolume = vol;
116 fNdivisions = ndiv;
117 fDivIndex = 0;
118 fStep = 0;
119 fStart = 0;
120 fEnd = 0;
121}
122
123////////////////////////////////////////////////////////////////////////////////
124/// copy constructor
125
127 : TObject(pf),
128 fStep(pf.fStep),
129 fStart(pf.fStart),
130 fEnd(pf.fEnd),
131 fNdivisions(pf.fNdivisions),
132 fDivIndex(pf.fDivIndex),
133 fVolume(pf.fVolume)
134{
135}
136
137////////////////////////////////////////////////////////////////////////////////
138/// assignment operator
139
141{
142 if (this != &pf) {
144 fStep = pf.fStep;
145 fStart = pf.fStart;
146 fEnd = pf.fEnd;
147 fNdivisions = pf.fNdivisions;
148 fDivIndex = pf.fDivIndex;
149 fVolume = pf.fVolume;
150 }
151 return *this;
152}
153
154////////////////////////////////////////////////////////////////////////////////
155/// Destructor
156
161
162////////////////////////////////////////////////////////////////////////////////
163/// Return current index.
164
169
170////////////////////////////////////////////////////////////////////////////////
171/// Return current matrix.
172
177
178////////////////////////////////////////////////////////////////////////////////
179/// Get index of next division.
180
185
186////////////////////////////////////////////////////////////////////////////////
187/// Set index of next division.
188
193
194////////////////////////////////////////////////////////////////////////////////
195/// Make next node (if any) current.
196
198{
200 if (td.fNextIndex < 0)
201 return nullptr;
202 cd(td.fNextIndex);
203 return GetNodeOffset(td.fCurrent);
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Set division range. Use this method only when dividing an assembly.
208
210{
211 fStart = start;
212 fEnd = fStart + ndivisions * step;
213 fStep = step;
215}
216
217//______________________________________________________________________________
218// TGeoPatternX - a X axis divison pattern
219//______________________________________________________________________________
220
221////////////////////////////////////////////////////////////////////////////////
222/// Default constructor
223
228
229////////////////////////////////////////////////////////////////////////////////
230/// constructor
231
233{
234 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
235 fStart = -dx;
236 fEnd = dx;
237 fStep = 2 * dx / ndivisions;
239}
240
241////////////////////////////////////////////////////////////////////////////////
242/// constructor
243
245{
246 Double_t dx = ((TGeoBBox *)vol->GetShape())->GetDX();
247 fStart = -dx;
248 fEnd = fStart + ndivisions * step;
249 fStep = step;
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// constructor
255
258{
259 fStart = start;
260 fEnd = end;
261 fStep = (end - start) / ndivisions;
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// copy constructor
267
272
273////////////////////////////////////////////////////////////////////////////////
274/// assignment operator
275
277{
278 if (this != &pf) {
281 }
282 return *this;
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Destructor
287
289
290////////////////////////////////////////////////////////////////////////////////
291/// Update current division index and global matrix to point to a given slice.
292
294{
296 td.fCurrent = idiv;
297 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Return new matrix of type used by this finder.
302
304{
305 if (!IsReflected()) {
306 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
308 return matrix;
309 }
312 combi->ReflectZ(kTRUE);
313 combi->ReflectZ(kFALSE);
314 return combi;
315}
316
317////////////////////////////////////////////////////////////////////////////////
318/// Fills external matrix with the local one corresponding to the given division
319/// index.
320
322{
323 matrix.Clear();
324 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Checks if the current point is on division boundary
329
331{
332 Double_t seg = (point[0] - fStart) / fStep;
334 if (diff > 0.5)
335 diff = 1. - diff;
336 if (diff < 1e-8)
337 return kTRUE;
338 return kFALSE;
339}
340
341////////////////////////////////////////////////////////////////////////////////
342/// Find the cell corresponding to point and next cell along dir (if asked)
343
345{
347 TGeoNode *node = nullptr;
348 Int_t ind = (Int_t)(1. + (point[0] - fStart) / fStep) - 1;
349 if (dir) {
350 td.fNextIndex = ind;
351 if (dir[0] > 0)
352 td.fNextIndex++;
353 else
354 td.fNextIndex--;
355 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
356 td.fNextIndex = -1;
357 }
358 if ((ind < 0) || (ind >= fNdivisions))
359 return node;
360 node = GetNodeOffset(ind);
361 cd(ind);
362 return node;
363}
364
365////////////////////////////////////////////////////////////////////////////////
366/// Compute distance to next division layer returning the index of next section.
367/// Point is in the frame of the divided volume.
368
370{
372 indnext = -1;
373 Double_t dist = TGeoShape::Big();
374 if (TMath::Abs(dir[0]) < TGeoShape::Tolerance())
375 return dist;
376 if (td.fCurrent < 0) {
377 Error("FindNextBoundary", "Must call FindNode first");
378 return dist;
379 }
380 Int_t inc = (dir[0] > 0) ? 1 : 0;
381 dist = (fStep * (td.fCurrent + inc) - point[0]) / dir[0];
382 if (dist < 0.)
383 Error("FindNextBoundary", "Negative distance d=%g", dist);
384 if (!inc)
385 inc = -1;
386 indnext = td.fCurrent + inc;
387 return dist;
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Make a copy of this finder. Reflect by Z if required.
392
394{
395 TGeoPatternX *finder = new TGeoPatternX(*this);
396 if (!reflect)
397 return finder;
398 finder->Reflect();
399 return finder;
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Save a primitive as a C++ statement(s) on output stream "out".
404
405void TGeoPatternX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
406{
407 Int_t iaxis = 1;
408 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
409}
410
411//______________________________________________________________________________
412// TGeoPatternY - a Y axis divison pattern
413//______________________________________________________________________________
414
415////////////////////////////////////////////////////////////////////////////////
416/// Default constructor
417
422
423////////////////////////////////////////////////////////////////////////////////
424/// constructor
425
427{
428 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
429 fStart = -dy;
430 fEnd = dy;
431 fStep = 2 * dy / ndivisions;
433}
434
435////////////////////////////////////////////////////////////////////////////////
436/// constructor
437
439{
440 Double_t dy = ((TGeoBBox *)vol->GetShape())->GetDY();
441 fStart = -dy;
442 fEnd = fStart + ndivisions * step;
443 fStep = step;
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// constructor
449
452{
453 fStart = start;
454 fEnd = end;
455 fStep = (end - start) / ndivisions;
457}
458
459////////////////////////////////////////////////////////////////////////////////
460/// copy constructor
461
466
467////////////////////////////////////////////////////////////////////////////////
468/// assignment operator
469
471{
472 if (this != &pf) {
475 }
476 return *this;
477}
478
479////////////////////////////////////////////////////////////////////////////////
480/// Destructor
481
483
484////////////////////////////////////////////////////////////////////////////////
485/// Update current division index and global matrix to point to a given slice.
486
488{
490 td.fCurrent = idiv;
491 td.fMatrix->SetDy(fStart + idiv * fStep + 0.5 * fStep);
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Return new matrix of type used by this finder.
496
498{
499 if (!IsReflected()) {
500 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
502 return matrix;
503 }
506 combi->ReflectZ(kTRUE);
507 combi->ReflectZ(kFALSE);
508 return combi;
509}
510
511////////////////////////////////////////////////////////////////////////////////
512/// Fills external matrix with the local one corresponding to the given division
513/// index.
514
516{
517 matrix.Clear();
518 matrix.SetDy(fStart + idiv * fStep + 0.5 * fStep);
519}
520
521////////////////////////////////////////////////////////////////////////////////
522/// Checks if the current point is on division boundary
523
525{
526 Double_t seg = (point[1] - fStart) / fStep;
528 if (diff > 0.5)
529 diff = 1. - diff;
530 if (diff < 1e-8)
531 return kTRUE;
532 return kFALSE;
533}
534
535////////////////////////////////////////////////////////////////////////////////
536/// Find the cell corresponding to point and next cell along dir (if asked)
537
539{
541 TGeoNode *node = nullptr;
542 Int_t ind = (Int_t)(1. + (point[1] - fStart) / fStep) - 1;
543 if (dir) {
544 td.fNextIndex = ind;
545 if (dir[1] > 0)
546 td.fNextIndex++;
547 else
548 td.fNextIndex--;
549 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
550 td.fNextIndex = -1;
551 }
552 if ((ind < 0) || (ind >= fNdivisions))
553 return node;
554 node = GetNodeOffset(ind);
555 cd(ind);
556 return node;
557}
558
559////////////////////////////////////////////////////////////////////////////////
560/// Compute distance to next division layer returning the index of next section.
561/// Point is in the frame of the divided volume.
562
564{
566 indnext = -1;
567 Double_t dist = TGeoShape::Big();
568 if (TMath::Abs(dir[1]) < TGeoShape::Tolerance())
569 return dist;
570 if (td.fCurrent < 0) {
571 Error("FindNextBoundary", "Must call FindNode first");
572 return dist;
573 }
574 Int_t inc = (dir[1] > 0) ? 1 : 0;
575 dist = (fStep * (td.fCurrent + inc) - point[1]) / dir[1];
576 if (dist < 0.)
577 Error("FindNextBoundary", "Negative distance d=%g", dist);
578 if (!inc)
579 inc = -1;
580 indnext = td.fCurrent + inc;
581 return dist;
582}
583
584////////////////////////////////////////////////////////////////////////////////
585/// Make a copy of this finder. Reflect by Z if required.
586
588{
589 TGeoPatternY *finder = new TGeoPatternY(*this);
590 if (!reflect)
591 return finder;
592 finder->Reflect();
593 return finder;
594}
595
596////////////////////////////////////////////////////////////////////////////////
597/// Save a primitive as a C++ statement(s) on output stream "out".
598
599void TGeoPatternY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
600{
601 Int_t iaxis = 2;
602 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
603}
604
605//______________________________________________________________________________
606// TGeoPatternZ - a Z axis divison pattern
607//______________________________________________________________________________
608
609////////////////////////////////////////////////////////////////////////////////
610/// Default constructor
611
616////////////////////////////////////////////////////////////////////////////////
617/// constructor
618
620{
621 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
622 fStart = -dz;
623 fEnd = dz;
624 fStep = 2 * dz / ndivisions;
626}
627////////////////////////////////////////////////////////////////////////////////
628/// constructor
629
631{
632 Double_t dz = ((TGeoBBox *)vol->GetShape())->GetDZ();
633 fStart = -dz;
634 fEnd = fStart + ndivisions * step;
635 fStep = step;
637}
638////////////////////////////////////////////////////////////////////////////////
639/// constructor
640
643{
644 fStart = start;
645 fEnd = end;
646 fStep = (end - start) / ndivisions;
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// copy constructor
652
657
658////////////////////////////////////////////////////////////////////////////////
659/// assignment operator
660
662{
663 if (this != &pf) {
666 }
667 return *this;
668}
669
670////////////////////////////////////////////////////////////////////////////////
671/// Destructor
672
674////////////////////////////////////////////////////////////////////////////////
675/// Update current division index and global matrix to point to a given slice.
676
678{
680 td.fCurrent = idiv;
681 td.fMatrix->SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Return new matrix of type used by this finder.
686
688{
689 if (!IsReflected()) {
690 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
692 return matrix;
693 }
696 combi->ReflectZ(kTRUE);
697 combi->ReflectZ(kFALSE);
698 return combi;
699}
700
701////////////////////////////////////////////////////////////////////////////////
702/// Fills external matrix with the local one corresponding to the given division
703/// index.
704
706{
707 matrix.Clear();
708 matrix.SetDz(((IsReflected()) ? -1. : 1.) * (fStart + idiv * fStep + 0.5 * fStep));
709}
710
711////////////////////////////////////////////////////////////////////////////////
712/// Checks if the current point is on division boundary
713
715{
716 Double_t seg = (point[2] - fStart) / fStep;
718 if (diff > 0.5)
719 diff = 1. - diff;
720 if (diff < 1e-8)
721 return kTRUE;
722 return kFALSE;
723}
724
725////////////////////////////////////////////////////////////////////////////////
726/// Find the cell corresponding to point and next cell along dir (if asked)
727
729{
731 TGeoNode *node = nullptr;
732 Int_t ind = (Int_t)(1. + (point[2] - fStart) / fStep) - 1;
733 if (dir) {
734 td.fNextIndex = ind;
735 if (dir[2] > 0)
736 td.fNextIndex++;
737 else
738 td.fNextIndex--;
739 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
740 td.fNextIndex = -1;
741 }
742 if ((ind < 0) || (ind >= fNdivisions))
743 return node;
744 node = GetNodeOffset(ind);
745 cd(ind);
746 return node;
747}
748
749////////////////////////////////////////////////////////////////////////////////
750/// Compute distance to next division layer returning the index of next section.
751/// Point is in the frame of the divided volume.
752
754{
755 indnext = -1;
757 Double_t dist = TGeoShape::Big();
758 if (TMath::Abs(dir[2]) < TGeoShape::Tolerance())
759 return dist;
760 if (td.fCurrent < 0) {
761 Error("FindNextBoundary", "Must call FindNode first");
762 return dist;
763 }
764 Int_t inc = (dir[2] > 0) ? 1 : 0;
765 dist = (fStep * (td.fCurrent + inc) - point[2]) / dir[2];
766 if (dist < 0.)
767 Error("FindNextBoundary", "Negative distance d=%g", dist);
768 if (!inc)
769 inc = -1;
770 indnext = td.fCurrent + inc;
771 return dist;
772}
773
774////////////////////////////////////////////////////////////////////////////////
775/// Make a copy of this finder. Reflect by Z if required.
776
778{
779 TGeoPatternZ *finder = new TGeoPatternZ(*this);
780 if (!reflect)
781 return finder;
782 finder->Reflect();
783 return finder;
784}
785
786////////////////////////////////////////////////////////////////////////////////
787/// Save a primitive as a C++ statement(s) on output stream "out".
788
789void TGeoPatternZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
790{
791 Int_t iaxis = 3;
792 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
793}
794
795//______________________________________________________________________________
796// TGeoPatternParaX - a X axis divison pattern for PARA shape
797//______________________________________________________________________________
798
799////////////////////////////////////////////////////////////////////////////////
800/// Default constructor
801
806////////////////////////////////////////////////////////////////////////////////
807/// constructor
808
817////////////////////////////////////////////////////////////////////////////////
818/// constructor
819
822{
823 Double_t dx = ((TGeoPara *)vol->GetShape())->GetX();
824 fStart = -dx;
825 fEnd = fStart + ndivisions * step;
826 fStep = step;
828}
829////////////////////////////////////////////////////////////////////////////////
830/// constructor
831
834{
835 fStart = start;
836 fEnd = end;
837 fStep = (end - start) / ndivisions;
839}
840
841////////////////////////////////////////////////////////////////////////////////
842/// copy constructor
843
848
849////////////////////////////////////////////////////////////////////////////////
850/// assignment operator
851
853{
854 if (this != &pf) {
857 }
858 return *this;
859}
860
861////////////////////////////////////////////////////////////////////////////////
862/// Destructor
863
865////////////////////////////////////////////////////////////////////////////////
866/// Update current division index and global matrix to point to a given slice.
867
869{
871 td.fCurrent = idiv;
872 td.fMatrix->SetDx(fStart + idiv * fStep + 0.5 * fStep);
873}
874
875////////////////////////////////////////////////////////////////////////////////
876/// Checks if the current point is on division boundary
877
879{
880 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
881 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
882 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
883 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
884 Double_t seg = (xt - fStart) / fStep;
886 if (diff > 0.5)
887 diff = 1. - diff;
888 if (diff < 1e-8)
889 return kTRUE;
890 return kFALSE;
891}
892
893////////////////////////////////////////////////////////////////////////////////
894/// get the node division containing the query point
895
897{
899 TGeoNode *node = nullptr;
900 Double_t txy = ((TGeoPara *)fVolume->GetShape())->GetTxy();
901 Double_t txz = ((TGeoPara *)fVolume->GetShape())->GetTxz();
902 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
903 Double_t xt = point[0] - txz * point[2] - txy * (point[1] - tyz * point[2]);
904 Int_t ind = (Int_t)(1. + (xt - fStart) / fStep) - 1;
905 if (dir) {
906 Double_t ttsq = txy * txy + (txz - txy * tyz) * (txz - txy * tyz);
907 Double_t divdirx = 1. / TMath::Sqrt(1. + ttsq);
909 Double_t divdirz = -(txz - txy * tyz) * divdirx;
910 Double_t dot = dir[0] * divdirx + dir[1] * divdiry + dir[2] * divdirz;
911 td.fNextIndex = ind;
912 if (dot > 0)
913 td.fNextIndex++;
914 else
915 td.fNextIndex--;
916 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
917 td.fNextIndex = -1;
918 }
919 if ((ind < 0) || (ind >= fNdivisions))
920 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{
932 if (!reflect)
933 return finder;
934 finder->Reflect();
935 return finder;
936}
937
938////////////////////////////////////////////////////////////////////////////////
939/// Save a primitive as a C++ statement(s) on output stream "out".
940
941void TGeoPatternParaX::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
942{
943 Int_t iaxis = 1;
944 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
945}
946
947////////////////////////////////////////////////////////////////////////////////
948/// Return new matrix of type used by this finder.
949
951{
952 if (!IsReflected()) {
953 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
955 return matrix;
956 }
959 combi->ReflectZ(kTRUE);
960 combi->ReflectZ(kFALSE);
961 return combi;
962}
963
964////////////////////////////////////////////////////////////////////////////////
965/// Fills external matrix with the local one corresponding to the given division
966/// index.
967
969{
970 matrix.Clear();
971 matrix.SetDx(fStart + idiv * fStep + 0.5 * fStep);
972}
973
974//______________________________________________________________________________
975// TGeoPatternParaY - a Y axis divison pattern for PARA shape
976//______________________________________________________________________________
977
978////////////////////////////////////////////////////////////////////////////////
979/// Default constructor
980
986////////////////////////////////////////////////////////////////////////////////
987/// constructor
988
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
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
1016{
1017 fTxy = ((TGeoPara *)vol->GetShape())->GetTxy();
1018 fStart = start;
1019 fEnd = end;
1020 fStep = (end - start) / ndivisions;
1022}
1023////////////////////////////////////////////////////////////////////////////////
1024/// copy constructor
1025
1030
1031////////////////////////////////////////////////////////////////////////////////
1032/// assignment operator
1033
1035{
1036 if (this != &pf) {
1039 }
1040 return *this;
1041}
1042
1043////////////////////////////////////////////////////////////////////////////////
1044/// Destructor
1045
1047////////////////////////////////////////////////////////////////////////////////
1048/// Update current division index and global matrix to point to a given slice.
1049
1051{
1053 td.fCurrent = idiv;
1054 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1055 td.fMatrix->SetDx(fTxy * dy);
1056 td.fMatrix->SetDy(dy);
1057}
1058
1059////////////////////////////////////////////////////////////////////////////////
1060/// Checks if the current point is on division boundary
1061
1063{
1064 Double_t tyz = ((TGeoPara *)fVolume->GetShape())->GetTyz();
1065 Double_t yt = point[1] - tyz * point[2];
1066 Double_t seg = (yt - fStart) / fStep;
1067 Double_t diff = seg - Int_t(seg);
1068 if (diff > 0.5)
1069 diff = 1. - diff;
1070 if (diff < 1e-8)
1071 return kTRUE;
1072 return kFALSE;
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// get the node division containing the query point
1077
1079{
1081 TGeoNode *node = nullptr;
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);
1088 Double_t dot = dir[1] * divdiry + dir[2] * divdirz;
1089 td.fNextIndex = ind;
1090 if (dot > 0)
1091 td.fNextIndex++;
1092 else
1093 td.fNextIndex--;
1094 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1095 td.fNextIndex = -1;
1096 }
1097 if ((ind < 0) || (ind >= fNdivisions))
1098 return node;
1099 node = GetNodeOffset(ind);
1100 cd(ind);
1101 return node;
1102}
1103
1104////////////////////////////////////////////////////////////////////////////////
1105/// Make a copy of this finder. Reflect by Z if required.
1106
1108{
1110 if (!reflect)
1111 return finder;
1112 finder->Reflect();
1113 return finder;
1114}
1115
1116////////////////////////////////////////////////////////////////////////////////
1117/// Save a primitive as a C++ statement(s) on output stream "out".
1118
1119void TGeoPatternParaY::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1120{
1121 Int_t iaxis = 2;
1122 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1123}
1124
1125////////////////////////////////////////////////////////////////////////////////
1126/// Return new matrix of type used by this finder.
1127
1129{
1130 if (!IsReflected()) {
1131 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1133 return matrix;
1134 }
1137 combi->ReflectZ(kTRUE);
1138 combi->ReflectZ(kFALSE);
1139 return combi;
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Fills external matrix with the local one corresponding to the given division
1144/// index.
1145
1147{
1148 matrix.Clear();
1149 Double_t dy = fStart + idiv * fStep + 0.5 * fStep;
1150 matrix.SetDx(fTxy * dy);
1151 matrix.SetDy(dy);
1152}
1153
1154//______________________________________________________________________________
1155// TGeoPatternParaZ - a Z axis divison pattern for PARA shape
1156//______________________________________________________________________________
1157
1158////////////////////////////////////////////////////////////////////////////////
1159/// Default constructor
1160
1162{
1163 fTxz = 0;
1164 fTyz = 0;
1166}
1167////////////////////////////////////////////////////////////////////////////////
1168/// constructor
1169
1171{
1172 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1173 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1174 Double_t dz = ((TGeoPara *)vol->GetShape())->GetZ();
1175 fStart = -dz;
1176 fEnd = dz;
1177 fStep = 2 * dz / ndivisions;
1179}
1180////////////////////////////////////////////////////////////////////////////////
1181/// constructor
1182
1185{
1186 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1187 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1188 Double_t dz = ((TGeoPara *)vol->GetShape())->GetZ();
1189 fStart = -dz;
1190 fEnd = fStart + ndivisions * step;
1191 fStep = step;
1193}
1194
1195////////////////////////////////////////////////////////////////////////////////
1196/// constructor
1197
1200{
1201 fTxz = ((TGeoPara *)vol->GetShape())->GetTxz();
1202 fTyz = ((TGeoPara *)vol->GetShape())->GetTyz();
1203 fStart = start;
1204 fEnd = end;
1205 fStep = (end - start) / ndivisions;
1207}
1208
1209////////////////////////////////////////////////////////////////////////////////
1210/// copy constructor
1211
1216
1217////////////////////////////////////////////////////////////////////////////////
1218/// assignment operator
1219
1221{
1222 if (this != &pf) {
1225 }
1226 return *this;
1227}
1228
1229////////////////////////////////////////////////////////////////////////////////
1230/// Destructor
1231
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)
1255 diff = 1. - diff;
1256 if (diff < 1e-8)
1257 return kTRUE;
1258 return kFALSE;
1259}
1260
1261////////////////////////////////////////////////////////////////////////////////
1262/// get the node division containing the query point
1263
1265{
1267 TGeoNode *node = nullptr;
1268 Double_t zt = point[2];
1269 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1270 if (dir) {
1271 td.fNextIndex = ind;
1272 if (dir[2] > 0)
1273 td.fNextIndex++;
1274 else
1275 td.fNextIndex--;
1276 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1277 td.fNextIndex = -1;
1278 }
1279 if ((ind < 0) || (ind >= fNdivisions))
1280 return node;
1281 node = GetNodeOffset(ind);
1282 cd(ind);
1283 return node;
1284}
1285
1286////////////////////////////////////////////////////////////////////////////////
1287/// Make a copy of this finder. Reflect by Z if required.
1288
1290{
1292 if (!reflect)
1293 return finder;
1294 finder->Reflect();
1295 return finder;
1296}
1297
1298////////////////////////////////////////////////////////////////////////////////
1299/// Save a primitive as a C++ statement(s) on output stream "out".
1300
1301void TGeoPatternParaZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1302{
1303 Int_t iaxis = 3;
1304 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1305}
1306
1307////////////////////////////////////////////////////////////////////////////////
1308/// Return new matrix of type used by this finder.
1309
1311{
1312 if (!IsReflected()) {
1313 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1315 return matrix;
1316 }
1319 combi->ReflectZ(kTRUE);
1320 combi->ReflectZ(kFALSE);
1321 return combi;
1322}
1323
1324////////////////////////////////////////////////////////////////////////////////
1325/// Fills external matrix with the local one corresponding to the given division
1326/// index.
1327
1329{
1330 matrix.Clear();
1331 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1332 matrix.SetDx(fTxz * dz);
1333 matrix.SetDy(fTyz * dz);
1334 matrix.SetDz((IsReflected()) ? -dz : dz);
1335}
1336
1337//______________________________________________________________________________
1338// TGeoPatternTrapZ - a Z axis divison pattern for TRAP or GTRA shapes
1339//______________________________________________________________________________
1340
1341////////////////////////////////////////////////////////////////////////////////
1342/// Default constructor
1343
1345{
1346 fTxz = 0;
1347 fTyz = 0;
1349}
1350////////////////////////////////////////////////////////////////////////////////
1351/// constructor
1352
1354{
1355 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1356 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1359 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1360 fStart = -dz;
1361 fEnd = dz;
1362 fStep = 2 * dz / ndivisions;
1364}
1365////////////////////////////////////////////////////////////////////////////////
1366/// constructor
1367
1370{
1371 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1372 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1375 Double_t dz = ((TGeoArb8 *)vol->GetShape())->GetDz();
1376 fStart = -dz;
1377 fEnd = fStart + ndivisions * step;
1378 fStep = step;
1380}
1381////////////////////////////////////////////////////////////////////////////////
1382/// constructor
1383
1386{
1387 Double_t theta = ((TGeoTrap *)vol->GetShape())->GetTheta();
1388 Double_t phi = ((TGeoTrap *)vol->GetShape())->GetPhi();
1391 fStart = start;
1392 fEnd = end;
1393 fStep = (end - start) / ndivisions;
1395}
1396
1397////////////////////////////////////////////////////////////////////////////////
1398/// copy constructor
1399
1401{
1403}
1404
1405////////////////////////////////////////////////////////////////////////////////
1406/// assignment operator
1407
1409{
1410 if (this != &pf) {
1412 fTxz = pf.fTxz;
1413 fTyz = pf.fTyz;
1415 }
1416 return *this;
1417}
1418
1419////////////////////////////////////////////////////////////////////////////////
1420/// Destructor
1421
1423////////////////////////////////////////////////////////////////////////////////
1424/// Update current division index and global matrix to point to a given slice.
1425
1427{
1429 td.fCurrent = idiv;
1430 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1431 td.fMatrix->SetDx(fTxz * dz);
1432 td.fMatrix->SetDy(fTyz * dz);
1433 td.fMatrix->SetDz((IsReflected()) ? -dz : dz);
1434}
1435
1436////////////////////////////////////////////////////////////////////////////////
1437/// Checks if the current point is on division boundary
1438
1440{
1441 Double_t seg = (point[2] - fStart) / fStep;
1442 Double_t diff = seg - Int_t(seg);
1443 if (diff > 0.5)
1444 diff = 1. - diff;
1445 if (diff < 1e-8)
1446 return kTRUE;
1447 return kFALSE;
1448}
1449
1450////////////////////////////////////////////////////////////////////////////////
1451/// get the node division containing the query point
1452
1454{
1456 TGeoNode *node = nullptr;
1457 Double_t zt = point[2];
1458 Int_t ind = (Int_t)(1. + (zt - fStart) / fStep) - 1;
1459 if (dir) {
1460 td.fNextIndex = ind;
1461 if (dir[2] > 0)
1462 td.fNextIndex++;
1463 else
1464 td.fNextIndex--;
1465 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1466 td.fNextIndex = -1;
1467 }
1468 if ((ind < 0) || (ind >= fNdivisions))
1469 return node;
1470 node = GetNodeOffset(ind);
1471 cd(ind);
1472 return node;
1473}
1474
1475////////////////////////////////////////////////////////////////////////////////
1476/// Make a copy of this finder. Reflect by Z if required.
1477
1479{
1481 if (!reflect)
1482 return finder;
1483 finder->Reflect();
1484 return finder;
1485}
1486
1487////////////////////////////////////////////////////////////////////////////////
1488/// Save a primitive as a C++ statement(s) on output stream "out".
1489
1490void TGeoPatternTrapZ::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1491{
1492 Int_t iaxis = 3;
1493 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1494}
1495
1496////////////////////////////////////////////////////////////////////////////////
1497/// Return new matrix of type used by this finder.
1498
1500{
1501 if (!IsReflected()) {
1502 TGeoMatrix *matrix = new TGeoTranslation(0., 0., 0.);
1504 return matrix;
1505 }
1508 combi->ReflectZ(kTRUE);
1509 combi->ReflectZ(kFALSE);
1510 return combi;
1511}
1512
1513////////////////////////////////////////////////////////////////////////////////
1514/// Fills external matrix with the local one corresponding to the given division
1515/// index.
1516
1518{
1519 matrix.Clear();
1520 Double_t dz = fStart + idiv * fStep + 0.5 * fStep;
1521 matrix.SetDx(fTxz * dz);
1522 matrix.SetDy(fTyz * dz);
1523 matrix.SetDz((IsReflected()) ? -dz : dz);
1524}
1525
1526//______________________________________________________________________________
1527// TGeoPatternCylR - a cylindrical R divison pattern
1528//______________________________________________________________________________
1529
1530////////////////////////////////////////////////////////////////////////////////
1531/// Default constructor
1532
1537////////////////////////////////////////////////////////////////////////////////
1538/// constructor
1539
1544////////////////////////////////////////////////////////////////////////////////
1545/// constructor
1546
1548{
1549 fStep = step;
1551 // compute start, end
1552}
1553////////////////////////////////////////////////////////////////////////////////
1554/// constructor
1555
1558{
1559 fStart = start;
1560 fEnd = end;
1561 fStep = (end - start) / ndivisions;
1563}
1564////////////////////////////////////////////////////////////////////////////////
1565/// copy constructor
1566
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// assignment operator
1574
1576{
1577 if (this != &pf) {
1580 }
1581 return *this;
1582}
1583
1584////////////////////////////////////////////////////////////////////////////////
1585/// Destructor
1586
1588
1589////////////////////////////////////////////////////////////////////////////////
1590/// Checks if the current point is on division boundary
1591
1593{
1594 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1595 Double_t seg = (r - fStart) / fStep;
1596 Double_t diff = seg - Int_t(seg);
1597 if (diff > 0.5)
1598 diff = 1. - diff;
1599 if (diff < 1e-8)
1600 return kTRUE;
1601 return kFALSE;
1602}
1603
1604////////////////////////////////////////////////////////////////////////////////
1605/// Update current division index and global matrix to point to a given slice.
1606
1608{
1610 td.fCurrent = idiv;
1611}
1612
1613////////////////////////////////////////////////////////////////////////////////
1614/// find the node containing the query point
1615
1617{
1619 if (!td.fMatrix)
1620 td.fMatrix = gGeoIdentity;
1621 TGeoNode *node = nullptr;
1622 Double_t r = TMath::Sqrt(point[0] * point[0] + point[1] * point[1]);
1623 Int_t ind = (Int_t)(1. + (r - fStart) / fStep) - 1;
1624 if (dir) {
1625 td.fNextIndex = ind;
1626 Double_t dot = point[0] * dir[0] + point[1] * dir[1];
1627 if (dot > 0)
1628 td.fNextIndex++;
1629 else
1630 td.fNextIndex--;
1631 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1632 td.fNextIndex = -1;
1633 }
1634 if ((ind < 0) || (ind >= fNdivisions))
1635 return node;
1636 node = GetNodeOffset(ind);
1637 cd(ind);
1638 return node;
1639}
1640
1641////////////////////////////////////////////////////////////////////////////////
1642/// Make a copy of this finder. Reflect by Z if required.
1643
1645{
1647 if (!reflect)
1648 return finder;
1649 finder->Reflect();
1650 return finder;
1651}
1652
1653////////////////////////////////////////////////////////////////////////////////
1654/// Save a primitive as a C++ statement(s) on output stream "out".
1655
1656void TGeoPatternCylR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1657{
1658 Int_t iaxis = 1;
1659 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1660}
1661
1662////////////////////////////////////////////////////////////////////////////////
1663/// Return new matrix of type used by this finder.
1664
1669
1670////////////////////////////////////////////////////////////////////////////////
1671/// Fills external matrix with the local one corresponding to the given division
1672/// index.
1673
1675{
1676 matrix.Clear();
1677}
1678
1679//______________________________________________________________________________
1680// TGeoPatternCylPhi - a cylindrical phi divison pattern
1681//______________________________________________________________________________
1682
1683////////////////////////////////////////////////////////////////////////////////
1684/// Default constructor
1685
1691////////////////////////////////////////////////////////////////////////////////
1692/// constructor
1693/// compute step, start, end
1694
1696{
1697 fStart = 0;
1698 fEnd = 0;
1699 fStep = 0;
1700 fSinCos = new Double_t[2 * fNdivisions];
1701 for (Int_t i = 0; i < fNdivisions; i++) {
1702 fSinCos[2 * i] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1703 fSinCos[2 * i + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1704 }
1706}
1707////////////////////////////////////////////////////////////////////////////////
1708/// constructor
1709
1712{
1713 fStep = step;
1714 fSinCos = new Double_t[2 * ndivisions];
1715 for (Int_t i = 0; i < fNdivisions; i++) {
1716 fSinCos[2 * i] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1717 fSinCos[2 * i + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + i * fStep));
1718 }
1720 // compute start, end
1721}
1722////////////////////////////////////////////////////////////////////////////////
1723/// constructor
1724
1727{
1728 fStart = start;
1729 if (fStart < 0)
1730 fStart += 360;
1731 fEnd = end;
1732 if (fEnd < 0)
1733 fEnd += 360;
1734 if ((end - start) < 0)
1735 fStep = (end - start + 360) / ndivisions;
1736 else
1737 fStep = (end - start) / ndivisions;
1738 fSinCos = new Double_t[2 * ndivisions];
1739 for (Int_t idiv = 0; idiv < ndivisions; idiv++) {
1740 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1741 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (start + 0.5 * fStep + idiv * fStep));
1742 }
1744}
1745////////////////////////////////////////////////////////////////////////////////
1746/// Destructor
1747
1749{
1750 if (fSinCos)
1751 delete[] fSinCos;
1752}
1753////////////////////////////////////////////////////////////////////////////////
1754/// Update current division index and global matrix to point to a given slice.
1755
1757{
1759 td.fCurrent = idiv;
1760 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
1761}
1762
1763////////////////////////////////////////////////////////////////////////////////
1764/// Checks if the current point is on division boundary
1765
1767{
1768 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1769 if (phi < 0)
1770 phi += 360;
1771 Double_t ddp = phi - fStart;
1772 if (ddp < 0)
1773 ddp += 360;
1774 Double_t seg = ddp / fStep;
1775 Double_t diff = seg - Int_t(seg);
1776 if (diff > 0.5)
1777 diff = 1. - diff;
1778 if (diff < 1e-8)
1779 return kTRUE;
1780 return kFALSE;
1781}
1782
1783////////////////////////////////////////////////////////////////////////////////
1784/// find the node containing the query point
1785
1787{
1789 TGeoNode *node = nullptr;
1790 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
1791 if (phi < 0)
1792 phi += 360;
1793 // Double_t dphi = fStep*fNdivisions;
1794 Double_t ddp = phi - fStart;
1795 if (ddp < 0)
1796 ddp += 360;
1797 // if (ddp>360) ddp-=360;
1798 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
1799 if (dir) {
1800 td.fNextIndex = ind;
1801 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
1802 if (dot > 0)
1803 td.fNextIndex++;
1804 else
1805 td.fNextIndex--;
1806 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
1807 td.fNextIndex = -1;
1808 }
1809 if ((ind < 0) || (ind >= fNdivisions))
1810 return node;
1811 node = GetNodeOffset(ind);
1812 cd(ind);
1813 return node;
1814}
1815
1816////////////////////////////////////////////////////////////////////////////////
1817/// Make a copy of this finder. Reflect by Z if required.
1818
1820{
1822 if (!reflect)
1823 return finder;
1824 finder->Reflect();
1825 return finder;
1826}
1827
1828////////////////////////////////////////////////////////////////////////////////
1829/// Save a primitive as a C++ statement(s) on output stream "out".
1830
1831void TGeoPatternCylPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1832{
1833 Int_t iaxis = 2;
1834 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1835}
1836
1837////////////////////////////////////////////////////////////////////////////////
1838/// Stream an object of class TGeoVolume.
1839
1841{
1842 if (R__b.IsReading()) {
1843 R__b.ReadClassBuffer(TGeoPatternCylPhi::Class(), this);
1844 if (fNdivisions) {
1845 fSinCos = new Double_t[2 * fNdivisions];
1846 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
1847 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1848 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
1849 }
1850 }
1851 } else {
1852 R__b.WriteClassBuffer(TGeoPatternCylPhi::Class(), this);
1853 }
1854}
1855
1856////////////////////////////////////////////////////////////////////////////////
1857/// Return new matrix of type used by this finder.
1858
1860{
1861 if (!IsReflected()) {
1864 return matrix;
1865 }
1866 TGeoRotation *rot = new TGeoRotation();
1868 rot->ReflectZ(kTRUE);
1869 rot->ReflectZ(kFALSE);
1870 return rot;
1871}
1872
1873////////////////////////////////////////////////////////////////////////////////
1874/// Fills external matrix with the local one corresponding to the given division
1875/// index.
1876
1878{
1879 matrix.Clear();
1880 matrix.FastRotZ(&fSinCos[2 * idiv]);
1881}
1882
1883//______________________________________________________________________________
1884// TGeoPatternSphR - a spherical R divison pattern
1885//______________________________________________________________________________
1886
1887////////////////////////////////////////////////////////////////////////////////
1888/// Default constructor
1889
1894////////////////////////////////////////////////////////////////////////////////
1895/// constructor
1896/// compute step, start, end
1897
1902////////////////////////////////////////////////////////////////////////////////
1903/// constructor
1904
1906{
1907 fStep = step;
1909 // compute start, end
1910}
1911////////////////////////////////////////////////////////////////////////////////
1912/// constructor
1913
1916{
1917 fStart = start;
1918 fEnd = end;
1919 fStep = (end - start) / ndivisions;
1921}
1922////////////////////////////////////////////////////////////////////////////////
1923/// copy constructor
1924
1929
1930////////////////////////////////////////////////////////////////////////////////
1931/// assignment operator
1932
1934{
1935 if (this != &pf) {
1938 }
1939 return *this;
1940}
1941
1942////////////////////////////////////////////////////////////////////////////////
1943/// Destructor
1944
1946////////////////////////////////////////////////////////////////////////////////
1947/// Update current division index and global matrix to point to a given slice.
1948
1950{
1952 td.fCurrent = idiv;
1953}
1954////////////////////////////////////////////////////////////////////////////////
1955/// find the node containing the query point
1956
1958{
1959 return nullptr;
1960}
1961
1962////////////////////////////////////////////////////////////////////////////////
1963/// Make a copy of this finder. Reflect by Z if required.
1964
1970
1971////////////////////////////////////////////////////////////////////////////////
1972/// Save a primitive as a C++ statement(s) on output stream "out".
1973
1974void TGeoPatternSphR::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
1975{
1976 Int_t iaxis = 1;
1977 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
1978}
1979
1980////////////////////////////////////////////////////////////////////////////////
1981/// Return new matrix of type used by this finder.
1982
1987
1988////////////////////////////////////////////////////////////////////////////////
1989/// Fills external matrix with the local one corresponding to the given division
1990/// index.
1991
1993{
1994 matrix.Clear();
1995}
1996
1997//______________________________________________________________________________
1998// TGeoPatternSphTheta - a spherical theta divison pattern
1999//______________________________________________________________________________
2000
2001////////////////////////////////////////////////////////////////////////////////
2002/// Default constructor
2003
2008////////////////////////////////////////////////////////////////////////////////
2009/// constructor
2010/// compute step, start, end
2011
2016////////////////////////////////////////////////////////////////////////////////
2017/// constructor
2018
2021{
2022 fStep = step;
2024 // compute start, end
2025}
2026////////////////////////////////////////////////////////////////////////////////
2027/// constructor
2028
2031{
2032 fStart = start;
2033 fEnd = end;
2034 fStep = (end - start) / ndivisions;
2036}
2037////////////////////////////////////////////////////////////////////////////////
2038/// copy constructor
2039
2044////////////////////////////////////////////////////////////////////////////////
2045/// assignment operator
2046
2048{
2049 if (this != &pf) {
2052 }
2053 return *this;
2054}
2055////////////////////////////////////////////////////////////////////////////////
2056/// Destructor
2057
2059////////////////////////////////////////////////////////////////////////////////
2060/// Update current division index and global matrix to point to a given slice.
2061
2063{
2065 td.fCurrent = idiv;
2066}
2067////////////////////////////////////////////////////////////////////////////////
2068/// find the node containing the query point
2069
2071{
2072 return nullptr;
2073}
2074
2075////////////////////////////////////////////////////////////////////////////////
2076/// Make a copy of this finder. Reflect by Z if required.
2077
2083
2084////////////////////////////////////////////////////////////////////////////////
2085/// Save a primitive as a C++ statement(s) on output stream "out".
2086
2087void TGeoPatternSphTheta::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2088{
2089 Int_t iaxis = 2;
2090 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2091}
2092
2093////////////////////////////////////////////////////////////////////////////////
2094/// Return new matrix of type used by this finder.
2095
2100
2101////////////////////////////////////////////////////////////////////////////////
2102/// Fills external matrix with the local one corresponding to the given division
2103/// index.
2104
2106{
2107 matrix.Clear();
2108}
2109
2110//______________________________________________________________________________
2111// TGeoPatternSphPhi - a spherical phi divison pattern
2112//______________________________________________________________________________
2113
2114////////////////////////////////////////////////////////////////////////////////
2115/// Default constructor
2116
2122////////////////////////////////////////////////////////////////////////////////
2123/// constructor
2124/// compute step, start, end
2125
2134////////////////////////////////////////////////////////////////////////////////
2135/// constructor
2136/// compute start, end
2137
2145////////////////////////////////////////////////////////////////////////////////
2146/// constructor
2147/// compute step
2148
2151{
2152 fStart = start;
2153 if (fStart < 0)
2154 fStart += 360;
2155 fEnd = end;
2156 if (fEnd < 0)
2157 fEnd += 360;
2158 if ((end - start) < 0)
2159 fStep = (end - start + 360) / ndivisions;
2160 else
2161 fStep = (end - start) / ndivisions;
2162 CreateSinCos();
2164}
2165
2166////////////////////////////////////////////////////////////////////////////////
2167/// Destructor
2168
2173
2174////////////////////////////////////////////////////////////////////////////////
2175/// Create the sincos table if it does not exist
2176
2178{
2179 fSinCos = new Double_t[2 * fNdivisions];
2180 for (Int_t idiv = 0; idiv < fNdivisions; idiv++) {
2181 fSinCos[2 * idiv] = TMath::Sin(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2182 fSinCos[2 * idiv + 1] = TMath::Cos(TMath::DegToRad() * (fStart + 0.5 * fStep + idiv * fStep));
2183 }
2184 return fSinCos;
2185}
2186
2187////////////////////////////////////////////////////////////////////////////////
2188/// Update current division index and global matrix to point to a given slice.
2189
2191{
2193 td.fCurrent = idiv;
2194 if (!fSinCos)
2195 CreateSinCos();
2196 ((TGeoRotation *)td.fMatrix)->FastRotZ(&fSinCos[2 * idiv]);
2197}
2198
2199////////////////////////////////////////////////////////////////////////////////
2200/// Checks if the current point is on division boundary
2201
2203{
2204 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2205 if (phi < 0)
2206 phi += 360;
2207 Double_t ddp = phi - fStart;
2208 if (ddp < 0)
2209 ddp += 360;
2210 Double_t seg = ddp / fStep;
2211 Double_t diff = seg - Int_t(seg);
2212 if (diff > 0.5)
2213 diff = 1. - diff;
2214 if (diff < 1e-8)
2215 return kTRUE;
2216 return kFALSE;
2217}
2218////////////////////////////////////////////////////////////////////////////////
2219/// find the node containing the query point
2220
2222{
2224 TGeoNode *node = nullptr;
2225 Double_t phi = TMath::ATan2(point[1], point[0]) * TMath::RadToDeg();
2226 if (phi < 0)
2227 phi += 360;
2228 // Double_t dphi = fStep*fNdivisions;
2229 Double_t ddp = phi - fStart;
2230 if (ddp < 0)
2231 ddp += 360;
2232 // if (ddp>360) ddp-=360;
2233 Int_t ind = (Int_t)(1. + ddp / fStep) - 1;
2234 if (dir) {
2235 td.fNextIndex = ind;
2236 Double_t dot = point[0] * dir[1] - point[1] * dir[0];
2237 if (dot > 0)
2238 td.fNextIndex++;
2239 else
2240 td.fNextIndex--;
2241 if ((td.fNextIndex < 0) || (td.fNextIndex >= fNdivisions))
2242 td.fNextIndex = -1;
2243 }
2244 if ((ind < 0) || (ind >= fNdivisions))
2245 return node;
2246 node = GetNodeOffset(ind);
2247 cd(ind);
2248 return node;
2249}
2250////////////////////////////////////////////////////////////////////////////////
2251/// Make a copy of this finder. Reflect by Z if required.
2252
2261
2262////////////////////////////////////////////////////////////////////////////////
2263/// Save a primitive as a C++ statement(s) on output stream "out".
2264
2265void TGeoPatternSphPhi::SavePrimitive(std::ostream &out, Option_t * /*option*/ /*= ""*/)
2266{
2267 Int_t iaxis = 2;
2268 out << iaxis << ", " << fNdivisions << ", " << fStart << ", " << fStep;
2269}
2270////////////////////////////////////////////////////////////////////////////////
2271/// Return new matrix of type used by this finder.
2272
2274{
2275 if (!IsReflected()) {
2278 return matrix;
2279 }
2280 TGeoRotation *rot = new TGeoRotation();
2282 rot->ReflectZ(kTRUE);
2283 rot->ReflectZ(kFALSE);
2284 return rot;
2285}
2286////////////////////////////////////////////////////////////////////////////////
2287/// Fills external matrix with the local one corresponding to the given division
2288/// index.
2289
2291{
2292 if (!fSinCos)
2293 ((TGeoPatternSphPhi *)this)->CreateSinCos();
2294 matrix.Clear();
2295 matrix.FastRotZ(&fSinCos[2 * idiv]);
2296}
2297
2298//______________________________________________________________________________
2299// TGeoPatternHoneycomb - a divison pattern specialized for honeycombs
2300//______________________________________________________________________________
2301
2302////////////////////////////////////////////////////////////////////////////////
2303/// Default constructor
2304
2306{
2307 fNrows = 0;
2308 fAxisOnRows = 0;
2309 fNdivisions = nullptr;
2310 fStart = nullptr;
2312}
2313////////////////////////////////////////////////////////////////////////////////
2314/// Default constructor
2315
2317{
2318 fNrows = nrows;
2319 fAxisOnRows = 0;
2320 fNdivisions = nullptr;
2321 fStart = nullptr;
2323 // compute everything else
2324}
2325////////////////////////////////////////////////////////////////////////////////
2326/// copy constructor
2327
2330 fNrows(pfh.fNrows),
2331 fAxisOnRows(pfh.fAxisOnRows),
2332 fNdivisions(pfh.fNdivisions),
2333 fStart(pfh.fStart)
2334{
2336}
2337
2338////////////////////////////////////////////////////////////////////////////////
2339/// assignment operator
2340
2342{
2343 if (this != &pfh) {
2345 fNrows = pfh.fNrows;
2346 fAxisOnRows = pfh.fAxisOnRows;
2347 fNdivisions = pfh.fNdivisions;
2348 fStart = pfh.fStart;
2350 }
2351 return *this;
2352}
2353////////////////////////////////////////////////////////////////////////////////
2354/// destructor
2355
2357////////////////////////////////////////////////////////////////////////////////
2358/// Update current division index and global matrix to point to a given slice.
2359
2361{
2363 td.fCurrent = idiv;
2364}
2365////////////////////////////////////////////////////////////////////////////////
2366/// find the node containing the query point
2367
2369{
2370 return nullptr;
2371}
2372
2373////////////////////////////////////////////////////////////////////////////////
2374/// Return new matrix of type used by this finder.
2375
2380
2381////////////////////////////////////////////////////////////////////////////////
2382/// Fills external matrix with the local one corresponding to the given division
2383/// index.
2384
2386{
2387 matrix.Clear();
2388}
#define e(i)
Definition RSha256.hxx:103
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:84
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:538
Buffer base class used for serializing objects.
Definition TBuffer.h:43
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition TGeoArb8.h:19
Box class.
Definition TGeoBBox.h:18
Class describing rotation + translation.
Definition TGeoMatrix.h:318
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:459
The manager class for any TGeo geometry.
Definition TGeoManager.h:46
Geometrical transformation package.
Definition TGeoMatrix.h:39
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
Parallelepiped class.
Definition TGeoPara.h:17
a cylindrical phi divison pattern
TGeoPatternCylPhi()
Default constructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
~TGeoPatternCylPhi() override
Destructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
Double_t * fSinCos
![2*fNdivisions] table of sines/cosines
void Streamer(TBuffer &) override
Stream an object of class TGeoVolume.
static TClass * Class()
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
a cylindrical R divison pattern
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternCylR()
Default constructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
TGeoPatternCylR & operator=(const TGeoPatternCylR &)
assignment operator
~TGeoPatternCylR() override
Destructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
base finder class for patterns. A pattern is specifying a division type
static std::atomic< UInt_t > fgInstanceCount
virtual void cd(Int_t)
virtual TGeoNode * CdNext()
Make next node (if any) current.
virtual TGeoMatrix * GetMatrix()
Return current matrix.
void SetRange(Double_t start, Double_t step, Int_t ndivisions)
Set division range. Use this method only when dividing an assembly.
void InitThreadSlot(ThreadData_t &td) const
(Re)build the per-thread scratch state for this finder into the given slot.
ThreadData_t & GetThreadData() const
Per-thread scratch state, owned by the calling thread and indexed by this finder.
TGeoPatternFinder & operator=(const TGeoPatternFinder &)
assignment operator
TGeoMatrix * GetOwnerIdentity() const
Return the identity matrix owned by this finder's geometry manager.
void SetNext(Int_t index)
Set index of next division.
~TGeoPatternFinder() override
Destructor.
TGeoManager * GetOwnerManager() const
void RegisterMatrix(TGeoMatrix *matrix) const
Register a lazily-created pattern matrix with the manager owning this finder's volume.
Bool_t IsReflected() const
void CreateThreadData(Int_t)
No-op: this finder allocates its scratch state lazily for every calling thread.
Int_t GetCurrent()
Return current index.
std::atomic< Int_t > fGeneration
non-reused index of this finder into the per-thread vector
void ClearThreadData() const
Invalidate the per-thread data.
TGeoPatternFinder()
Default constructor.
Int_t GetNext() const
Get index of next division.
TGeoNode * GetNodeOffset(Int_t idiv)
virtual TGeoMatrix * CreateMatrix() const =0
a divison pattern specialized for honeycombs
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternHoneycomb()
Default constructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternHoneycomb() override
destructor
TGeoPatternHoneycomb & operator=(const TGeoPatternHoneycomb &)
assignment operator
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
a X axis divison pattern for PARA shapes
~TGeoPatternParaX() override
Destructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternParaX()
Default constructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternParaX & operator=(const TGeoPatternParaX &)
assignment operator
a Y axis divison pattern for PARA shapes
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
~TGeoPatternParaY() override
Destructor.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternParaY()
Default constructor.
TGeoPatternParaY & operator=(const TGeoPatternParaY &)
assignment operator
a Z axis divison pattern for PARA shapes
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
~TGeoPatternParaZ() override
Destructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternParaZ & operator=(const TGeoPatternParaZ &)
assignment operator
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoPatternParaZ()
Default constructor.
a spherical phi divison pattern
TGeoPatternSphPhi()
Default constructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternSphPhi() override
Destructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Double_t * fSinCos
! Sincos table
Double_t * CreateSinCos()
Create the sincos table if it does not exist.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
a spherical R divison pattern
~TGeoPatternSphR() override
Destructor.
TGeoPatternSphR()
Default constructor.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternSphR & operator=(const TGeoPatternSphR &)
assignment operator
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
a spherical theta divison pattern
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
find the node containing the query point
~TGeoPatternSphTheta() override
Destructor.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternSphTheta()
Default constructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternSphTheta & operator=(const TGeoPatternSphTheta &)
assignment operator
a Z axis divison pattern for TRAP or GTRA shapes
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternTrapZ()
Default constructor.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
get the node division containing the query point
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoPatternTrapZ & operator=(const TGeoPatternTrapZ &)
assignment operator
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
~TGeoPatternTrapZ() override
Destructor.
TGeoPatternX & operator=(const TGeoPatternX &)
assignment operator
~TGeoPatternX() override
Destructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
TGeoPatternX()
Default constructor.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
a Y axis divison pattern
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
TGeoPatternY & operator=(const TGeoPatternY &)
assignment operator
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
~TGeoPatternY() override
Destructor.
TGeoPatternY()
Default constructor.
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
a Z axis divison pattern
void cd(Int_t idiv) override
Update current division index and global matrix to point to a given slice.
TGeoMatrix * CreateMatrix() const override
Return new matrix of type used by this finder.
TGeoNode * FindNode(Double_t *point, const Double_t *dir=nullptr) override
Find the cell corresponding to point and next cell along dir (if asked)
virtual Double_t FindNextBoundary(Double_t *point, Double_t *dir, Int_t &indnext)
Compute distance to next division layer returning the index of next section.
TGeoPatternZ()
Default constructor.
~TGeoPatternZ() override
Destructor.
TGeoPatternFinder * MakeCopy(Bool_t reflect=kFALSE) override
Make a copy of this finder. Reflect by Z if required.
TGeoPatternZ & operator=(const TGeoPatternZ &)
assignment operator
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Bool_t IsOnBoundary(const Double_t *point) const override
Checks if the current point is on division boundary.
void UpdateMatrix(Int_t idiv, TGeoHMatrix &matrix) const override
Fills external matrix with the local one corresponding to the given division index.
Class describing rotations.
Definition TGeoMatrix.h:169
static Double_t Big()
Definition TGeoShape.h:95
static Double_t Tolerance()
Definition TGeoShape.h:98
Class describing translations.
Definition TGeoMatrix.h:117
A general trapezoid.
Definition TGeoArb8.h:99
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:45
TGeoShape * GetShape() const
Definition TGeoVolume.h:193
Mother of all ROOT objects.
Definition TObject.h:42
TObject & operator=(const TObject &rhs) noexcept
TObject assignment operator.
Definition TObject.h:305
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1095
Double_t ATan2(Double_t y, Double_t x)
Returns the principal value of the arc tangent of y/x, expressed in radians.
Definition TMath.h:659
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Definition TMath.h:82
Double_t Sqrt(Double_t x)
Returns the square root of x.
Definition TMath.h:675
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Definition TMath.h:607
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:601
Double_t Tan(Double_t)
Returns the tangent of an angle of x radians.
Definition TMath.h:613
constexpr Double_t RadToDeg()
Conversion from radian to degree: .
Definition TMath.h:75
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122
bumped whenever the per-thread state must be rebuilt
Int_t fCurrent
generic matrix (owned by TGeoManager)
Int_t fNextIndex
current division element