Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoNode.cxx
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Andrei Gheata 24/10/01
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TGeoNode
13\ingroup Geometry_classes
14
15 A node represent a volume positioned inside another.They store links to both
16volumes and to the TGeoMatrix representing the relative positioning. Node are
17never instantiated directly by users, but created as a result of volume operations.
18Adding a volume named A with a given user ID inside a volume B will create a node
19node named A_ID. This will be added to the list of nodes stored by B. Also,
20when applying a division operation in N slices to a volume A, a list of nodes
21B_1, B_2, ..., B_N is also created. A node B_i does not represent a unique
22object in the geometry because its container A might be at its turn positioned
23as node inside several other volumes. Only when a complete branch of nodes
24is fully defined up to the top node in the geometry, a given path like:
25
26 /TOP_1/.../A_3/B_7 will represent an unique object.
27
28Its global transformation matrix can be computed as the pile-up of all local
29transformations in its branch. We will therefore call "logical graph" the
30hierarchy defined by nodes and volumes. The expansion of the logical graph by
31all possible paths defines a tree structure where all nodes are unique
32"touchable" objects. We will call this the "physical tree". Unlike the logical
33graph, the physical tree can become a huge structure with several milions of nodes
34in case of complex geometries, therefore it is not always a good idea to keep it
35transient in memory. Since a the logical and physical structures are correlated, the
36modeller rather keeps track only of the current branch, updating the current
37global matrix at each change of the level in geometry. The current physical node
38is not an object that can be asked for at a given moment, but rather represented
39by the combination: current node + current global matrix. However, physical nodes
40have unique ID's that can be retrieved for a given modeler state. These can be
41fed back to the modeler in order to force a physical node to become current.
42The advantage of this comes from the fact that all navigation queries check
43first the current node, therefore knowing the location of a point in the
44geometry can be saved as a starting state for later use.
45
46 Nodes can be declared as "overlapping" in case they do overlap with other
47nodes inside the same container or extrude this container. Non-overlapping
48nodes can be created with:
49
50~~~ {.cpp}
51 TGeoVolume::AddNode(TGeoVolume *daughter, Int_t copy_No, TGeoMatrix *matr);
52~~~
53
54The creation of overlapping nodes can be done with a similar prototype:
55
56~~~ {.cpp}
57 TGeoVolume::AddNodeOverlap(same arguments);
58~~~
59
60When closing the geometry, overlapping nodes perform a check of possible
61overlaps with their neighbours. These are stored and checked all the time
62during navigation, therefore navigation is slower when embedding such nodes
63into geometry.
64
65 Node have visualization attributes as volume have. When undefined by users,
66painting a node on a pad will take the corresponding volume attributes.
67
68\image html geom_t_node.png
69*/
70
71#include <iostream>
72
73#include "TBrowser.h"
74#include "TObjArray.h"
75#include "TStyle.h"
76
77#include "TGeoManager.h"
78#include "TGeoMatrix.h"
79#include "TGeoShape.h"
80#include "TGeoVolume.h"
81#include "TVirtualGeoPainter.h"
82#include "TGeoVoxelFinder.h"
83#include "TGeoNode.h"
84#include "TMath.h"
85#include "TStopwatch.h"
86#include "TGeoExtension.h"
87
88// statics and globals
89
91
92////////////////////////////////////////////////////////////////////////////////
93/// Default constructor
94
96{
97 fVolume = nullptr;
98 fMother = nullptr;
99 fNumber = 0;
100 fNovlp = 0;
101 fOverlaps = nullptr;
102 fUserExtension = nullptr;
103 fFWExtension = nullptr;
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Constructor
108
110{
111 if (!vol) {
112 Error("ctor", "volume not specified");
113 return;
114 }
115 fVolume = (TGeoVolume *)vol;
116 if (fVolume->IsAdded())
118 fVolume->SetAdded();
119 fMother = nullptr;
120 fNumber = 0;
121 fNovlp = 0;
122 fOverlaps = nullptr;
123 fUserExtension = nullptr;
124 fFWExtension = nullptr;
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Destructor
129
131{
132 if (fOverlaps)
133 delete[] fOverlaps;
134 if (fUserExtension) {
136 fUserExtension = nullptr;
137 }
138 if (fFWExtension) {
140 fFWExtension = nullptr;
141 }
142}
143
144////////////////////////////////////////////////////////////////////////////////
145/// How-to-browse for a node.
146
148{
149 if (!b)
150 return;
151 if (!GetNdaughters())
152 return;
153 TGeoNode *daughter;
154 TString title;
155 for (Int_t i = 0; i < GetNdaughters(); i++) {
156 daughter = GetDaughter(i);
157 b->Add(daughter, daughter->GetName(), daughter->IsVisible());
158 }
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// Returns the number of daughters. Nodes pointing to same volume counted
163/// once if unique_volumes is set.
164
166{
167 static Int_t icall = 0;
168 Int_t counter = 0;
169 // Count this node
170 if (unique_volumes) {
171 if (!fVolume->IsSelected()) {
172 counter++;
174 }
175 } else
176 counter++;
177 icall++;
179 // Count daughters recursively
180 for (Int_t i = 0; i < nd; i++)
181 counter += GetDaughter(i)->CountDaughters(unique_volumes);
182 icall--;
183 // Un-mark volumes
184 if (icall == 0)
186 return counter;
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Check overlaps bigger than OVLP hierarchically, starting with this node.
191
193{
194 Int_t icheck = 0;
195 Int_t ncheck = 0;
196 TStopwatch *timer;
197 Int_t i;
198 Bool_t sampling = kFALSE;
199 TString opt(option);
200 opt.ToLower();
201 if (opt.Contains("s"))
202 sampling = kTRUE;
203
205 ncheck = CountDaughters(kFALSE);
206 timer = new TStopwatch();
207 geom->ClearOverlaps();
209 Info("CheckOverlaps", "Checking overlaps for %s and daughters within %g", fVolume->GetName(), ovlp);
210 if (sampling) {
211 Info("CheckOverlaps", "Checking overlaps by sampling <%s> for %s and daughters", option, fVolume->GetName());
212 Info("CheckOverlaps", "=== NOTE: Extrusions NOT checked with sampling option ! ===");
213 }
214 timer->Start();
215 geom->GetGeomPainter()->OpProgress(fVolume->GetName(), icheck, ncheck, timer, kFALSE);
217 icheck++;
218 TGeoIterator next(fVolume);
219 TGeoNode *node;
220 TString path;
221 TObjArray *overlaps = geom->GetListOfOverlaps();
222 Int_t novlps;
223 TString msg;
224 while ((node = next())) {
225 next.GetPath(path);
226 icheck++;
227 if (!node->GetVolume()->IsSelected()) {
228 msg = TString::Format("found %d overlaps", overlaps->GetEntriesFast());
229 geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(), icheck, ncheck, timer, kFALSE, msg);
230 node->GetVolume()->SelectVolume(kFALSE);
231 node->GetVolume()->CheckOverlaps(ovlp, option);
232 }
233 }
236 geom->SortOverlaps();
237 novlps = overlaps->GetEntriesFast();
238 TNamed *obj;
239 for (i = 0; i < novlps; i++) {
240 obj = (TNamed *)overlaps->At(i);
241 obj->SetName(TString::Format("ov%05d", i));
242 }
243 geom->GetGeomPainter()->OpProgress("Check overlaps:", icheck, ncheck, timer, kTRUE);
244 Info("CheckOverlaps", "Number of illegal overlaps/extrusions : %d\n", novlps);
245 delete timer;
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// compute the closest distance of approach from point px,py to this node
250
252{
253 Int_t dist = 9999;
254 if (!fVolume)
255 return dist;
259 if (!painter)
260 return dist;
261 dist = painter->DistanceToPrimitiveVol(fVolume, px, py);
262 return dist;
263}
264
265////////////////////////////////////////////////////////////////////////////////
266/// Execute mouse actions on this volume.
267
269{
270 if (!fVolume)
271 return;
273 if (!painter)
274 return;
275 painter->ExecuteVolumeEvent(fVolume, event, px, py);
276}
277
278////////////////////////////////////////////////////////////////////////////////
279/// Get node info for the browser.
280
282{
283 if (!fVolume)
284 return nullptr;
286 if (!painter)
287 return nullptr;
288 return (char *)painter->GetVolumeInfo(fVolume, px, py);
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// check if this node is drawn. Assumes that this node is current
293
295{
297 return kTRUE;
298 return kFALSE;
299}
300
301////////////////////////////////////////////////////////////////////////////////
302/// Inspect this node.
303
305{
306 printf("== Inspecting node %s ", GetName());
307 if (fMother)
308 printf("mother volume %s. ", fMother->GetName());
309 if (IsOverlapping())
310 printf("(Node is MANY)\n");
311 else
312 printf("\n");
313 if (fOverlaps && fMother) {
314 printf(" possibly overlapping with : ");
315 for (Int_t i = 0; i < fNovlp; i++)
316 printf(" %s ", fMother->GetNode(fOverlaps[i])->GetName());
317 printf("\n");
318 }
319 printf("Transformation matrix:\n");
320 TGeoMatrix *matrix = GetMatrix();
321 if (GetMatrix())
322 matrix->Print();
323 fVolume->Print();
324}
325
326////////////////////////////////////////////////////////////////////////////////
327/// check for wrong parameters in shapes
328
330{
332 Int_t nd = GetNdaughters();
333 if (!nd)
334 return;
335 for (Int_t i = 0; i < nd; i++)
337}
338
339////////////////////////////////////////////////////////////////////////////////
340/// draw only this node independently of its vis options
341
343{
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// draw current node according to option
349
351{
353 gGeoManager->CdUp();
354 Double_t point[3];
356 gGeoManager->SetCurrentPoint(&point[0]);
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Method drawing the overlap candidates with this node.
362
364{
365 if (!fNovlp) {
366 printf("node %s is ONLY\n", GetName());
367 return;
368 }
369 if (!fOverlaps) {
370 printf("node %s no overlaps\n", GetName());
371 return;
372 }
373 TGeoNode *node;
374 Int_t i;
376 for (i = 0; i < nd; i++) {
377 node = fMother->GetNode(i);
379 }
381 for (i = 0; i < fNovlp; i++) {
382 node = fMother->GetNode(fOverlaps[i]);
383 node->GetVolume()->SetVisibility(kTRUE);
384 }
386 fMother->Draw();
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Fill array with node id. Recursive on node branch.
391
392void TGeoNode::FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
393{
394 Int_t nd = GetNdaughters();
395 if (!nd)
396 return;
397 TGeoNode *daughter;
398 Int_t istart = ifree; // start index for daughters
399 ifree += nd;
400 for (Int_t id = 0; id < nd; id++) {
401 daughter = GetDaughter(id);
402 array[istart + id] = ifree;
403 array[ifree++] = ++nodeid;
404 daughter->FillIdArray(ifree, nodeid, array);
405 }
406}
407
408////////////////////////////////////////////////////////////////////////////////
409/// Search for a node within the branch of this one.
410
412{
413 Int_t nd = GetNdaughters();
414 if (!nd)
415 return -1;
416 TIter next(fVolume->GetNodes());
417 TGeoNode *daughter;
418 while ((daughter = (TGeoNode *)next())) {
419 if (daughter == node) {
420 gGeoManager->GetListOfNodes()->AddAt(daughter, level + 1);
421 return (level + 1);
422 }
423 }
424 next.Reset();
425 Int_t new_level;
426 while ((daughter = (TGeoNode *)next())) {
427 new_level = daughter->FindNode(node, level + 1);
428 if (new_level >= 0) {
429 gGeoManager->GetListOfNodes()->AddAt(daughter, level + 1);
430 return new_level;
431 }
432 }
433 return -1;
434}
435
436////////////////////////////////////////////////////////////////////////////////
437/// save attributes for this node
438
439void TGeoNode::SaveAttributes(std::ostream &out)
440{
441 if (IsVisStreamed())
442 return;
444 char quote = '"';
445 Bool_t voldef = kFALSE;
446 if ((fVolume->IsVisTouched()) && (!fVolume->IsVisStreamed())) {
448 out << " vol = gGeoManager->GetVolume(" << quote << fVolume->GetName() << quote << ");" << std::endl;
449 voldef = kTRUE;
450 if (!fVolume->IsVisDaughters())
451 out << " vol->SetVisDaughters(kFALSE);" << std::endl;
452 if (fVolume->IsVisible()) {
453 /*
454 if (fVolume->GetLineColor() != gStyle->GetLineColor())
455 out<<" vol->SetLineColor("<<fVolume->GetLineColor()<<");"<<std::endl;
456 if (fVolume->GetLineStyle() != gStyle->GetLineStyle())
457 out<<" vol->SetLineStyle("<<fVolume->GetLineStyle()<<");"<<std::endl;
458 if (fVolume->GetLineWidth() != gStyle->GetLineWidth())
459 out<<" vol->SetLineWidth("<<fVolume->GetLineWidth()<<");"<<std::endl;
460 */
461 } else {
462 out << " vol->SetVisibility(kFALSE);" << std::endl;
463 }
464 }
465 if (!IsVisDaughters())
466 return;
467 Int_t nd = GetNdaughters();
468 if (!nd)
469 return;
470 TGeoNode *node;
471 for (Int_t i = 0; i < nd; i++) {
472 node = GetDaughter(i);
473 if (node->IsVisStreamed())
474 continue;
475 if (node->IsVisTouched()) {
476 if (!voldef)
477 out << " vol = gGeoManager->GetVolume(" << quote << fVolume->GetName() << quote << ");" << std::endl;
478 out << " node = vol->GetNode(" << i << ");" << std::endl;
479 if (!node->IsVisDaughters()) {
480 out << " node->VisibleDaughters(kFALSE);" << std::endl;
481 node->SetVisStreamed(kTRUE);
482 continue;
483 }
484 if (!node->IsVisible())
485 out << " node->SetVisibility(kFALSE);" << std::endl;
486 }
487 node->SaveAttributes(out);
488 node->SetVisStreamed(kTRUE);
489 }
490}
491
492////////////////////////////////////////////////////////////////////////////////
493/// Connect user-defined extension to the node. The node "grabs" a copy, so
494/// the original object can be released by the producer. Release the previously
495/// connected extension if any.
496///
497/// NOTE: This interface is intended for user extensions and is guaranteed not
498/// to be used by TGeo
499
501{
503 fUserExtension = nullptr;
504 if (ext)
505 fUserExtension = ext->Grab();
506 if (tmp)
507 tmp->Release();
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// Connect framework defined extension to the node. The node "grabs" a copy,
512/// so the original object can be released by the producer. Release the previously
513/// connected extension if any.
514///
515/// NOTE: This interface is intended for the use by TGeo and the users should
516/// NOT connect extensions using this method
517
519{
521 fFWExtension = nullptr;
522 if (ext)
523 fFWExtension = ext->Grab();
524 if (tmp)
525 tmp->Release();
526}
527
528////////////////////////////////////////////////////////////////////////////////
529/// Get a copy of the user extension pointer. The user must call Release() on
530/// the copy pointer once this pointer is not needed anymore (equivalent to
531/// delete() after calling new())
532
534{
535 if (fUserExtension)
536 return fUserExtension->Grab();
537 return nullptr;
538}
539
540////////////////////////////////////////////////////////////////////////////////
541/// Get a copy of the framework extension pointer. The user must call Release() on
542/// the copy pointer once this pointer is not needed anymore (equivalent to
543/// delete() after calling new())
544
546{
547 if (fFWExtension)
548 return fFWExtension->Grab();
549 return nullptr;
550}
551////////////////////////////////////////////////////////////////////////////////
552/// Check the overlab between the bounding box of the node overlaps with the one
553/// the brother with index IOTHER.
554
556{
557 if (!fOverlaps)
558 return kFALSE;
559 for (Int_t i = 0; i < fNovlp; i++)
560 if (fOverlaps[i] == iother)
561 return kTRUE;
562 return kFALSE;
563}
564
565////////////////////////////////////////////////////////////////////////////////
566/// Convert the point coordinates from mother reference to local reference system
567
568void TGeoNode::MasterToLocal(const Double_t *master, Double_t *local) const
569{
570 GetMatrix()->MasterToLocal(master, local);
571}
572
573////////////////////////////////////////////////////////////////////////////////
574/// Convert a vector from mother reference to local reference system
575
576void TGeoNode::MasterToLocalVect(const Double_t *master, Double_t *local) const
577{
578 GetMatrix()->MasterToLocalVect(master, local);
579}
580
581////////////////////////////////////////////////////////////////////////////////
582/// Convert the point coordinates from local reference system to mother reference
583
584void TGeoNode::LocalToMaster(const Double_t *local, Double_t *master) const
585{
586 GetMatrix()->LocalToMaster(local, master);
587}
588
589////////////////////////////////////////////////////////////////////////////////
590/// Convert a vector from local reference system to mother reference
591
592void TGeoNode::LocalToMasterVect(const Double_t *local, Double_t *master) const
593{
594 GetMatrix()->LocalToMasterVect(local, master);
595}
596
597////////////////////////////////////////////////////////////////////////////////
598/// Print the path (A/B/C/...) to this node on stdout
599
600void TGeoNode::ls(Option_t * /*option*/) const {}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Paint this node and its content according to visualization settings.
604
606{
608 if (!painter)
609 return;
610 painter->PaintNode(this, option);
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// print daughters candidates for containing current point
615
617{
618 Double_t point[3];
620 printf(" Local : %g, %g, %g\n", point[0], point[1], point[2]);
621 if (!fVolume->Contains(&point[0])) {
622 printf("current point not inside this\n");
623 return;
624 }
626 TGeoNode *node;
627 if (finder) {
628 printf("current node divided\n");
629 node = finder->FindNode(&point[0]);
630 if (!node) {
631 printf("point not inside division element\n");
632 return;
633 }
634 printf("inside division element %s\n", node->GetName());
635 return;
636 }
637 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
638 if (!voxels) {
639 printf("volume not voxelized\n");
640 return;
641 }
642 Int_t ncheck = 0;
644 TGeoStateInfo &info = *nav->GetCache()->GetInfo();
645 Int_t *check_list = voxels->GetCheckList(&point[0], ncheck, info);
646 nav->GetCache()->ReleaseInfo();
647 voxels->PrintVoxelLimits(&point[0]);
648 if (!check_list) {
649 printf("no candidates for current point\n");
650 return;
651 }
652 TString overlap = "ONLY";
653 for (Int_t id = 0; id < ncheck; id++) {
654 node = fVolume->GetNode(check_list[id]);
655 if (node->IsOverlapping())
656 overlap = "MANY";
657 else
658 overlap = "ONLY";
659 printf("%i %s %s\n", check_list[id], node->GetName(), overlap.Data());
660 }
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// print possible overlapping nodes
666
668{
669 if (!fOverlaps) {
670 printf("node %s no overlaps\n", GetName());
671 return;
672 }
673 printf("Overlaps for node %s :\n", GetName());
674 TGeoNode *node;
675 for (Int_t i = 0; i < fNovlp; i++) {
676 node = fMother->GetNode(fOverlaps[i]);
677 printf(" %s\n", node->GetName());
678 }
679}
680
681////////////////////////////////////////////////////////////////////////////////
682/// computes the closest distance from given point to this shape
683
685{
686 Double_t local[3];
687 GetMatrix()->MasterToLocal(point, local);
688 return fVolume->GetShape()->Safety(local, in);
689}
690
691////////////////////////////////////////////////////////////////////////////////
692/// Copy content of lst of overlaps from source array
693
695{
696 Int_t *ovlps = nullptr;
697 if (src && (novlp > 0)) {
698 ovlps = new Int_t[novlp];
699 memcpy(ovlps, src, novlp * sizeof(Int_t));
700 }
701 SetOverlaps(ovlps, novlp);
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// set the list of overlaps for this node (ovlp must be created with operator new)
706
708{
709 if (fOverlaps)
710 delete[] fOverlaps;
711 fOverlaps = ovlp;
712 fNovlp = novlp;
713}
714
715////////////////////////////////////////////////////////////////////////////////
716/// Set visibility of the node (obsolete).
717
719{
720 if (gGeoManager->IsClosed())
723 if (vis && !fVolume->IsVisible())
726}
727
728////////////////////////////////////////////////////////////////////////////////
729/// Set visibility of the daughters (obsolete).
730
732{
733 if (gGeoManager->IsClosed())
735 SetVisDaughters(vis);
737}
738
739/** \class TGeoNodeMatrix
740\ingroup Geometry_classes
741A node containing local transformation.
742*/
743
745
746////////////////////////////////////////////////////////////////////////////////
747/// Default constructor
748
750{
751 fMatrix = nullptr;
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Constructor.
756
758{
759 fMatrix = (TGeoMatrix *)matrix;
760 if (!fMatrix)
762}
763
764////////////////////////////////////////////////////////////////////////////////
765/// Destructor
766
768
769////////////////////////////////////////////////////////////////////////////////
770/// return the total size in bytes of this node
771
773{
774 Int_t count = 40 + 4; // TGeoNode + fMatrix
775 // if (fMatrix) count += fMatrix->GetByteCount();
776 return count;
777}
778
779////////////////////////////////////////////////////////////////////////////////
780/// Returns type of optimal voxelization for this node.
781/// - type = 0 -> cartesian
782/// - type = 1 -> cylindrical
783
785{
787 if (!type)
788 return 0;
789 if (!fMatrix->IsRotAboutZ())
790 return 0;
791 const Double_t *transl = fMatrix->GetTranslation();
792 if (TMath::Abs(transl[0]) > 1E-10)
793 return 0;
794 if (TMath::Abs(transl[1]) > 1E-10)
795 return 0;
796 return 1;
797}
798
799////////////////////////////////////////////////////////////////////////////////
800/// Make a copy of this node.
801
803{
805 node->SetName(GetName());
806 node->SetTitle(GetTitle());
807 // set the mother
809 // set the copy number
810 node->SetNumber(fNumber);
811 // copy overlaps
813
814 // copy VC
815 if (IsVirtual())
816 node->SetVirtual();
817 if (IsOverlapping())
818 node->SetOverlapping(); // <--- ADDED
819 // Copy extensions
822 node->SetCloned();
823 return node;
824}
825
826////////////////////////////////////////////////////////////////////////////////
827/// Matrix setter.
828
830{
831 fMatrix = (TGeoMatrix *)matrix;
832 if (!fMatrix)
834}
835
836/** \class TGeoNodeOffset
837\ingroup Geometry_classes
838Node containing an offset.
839*/
840
842
843////////////////////////////////////////////////////////////////////////////////
844/// Default constructor
845
847{
849 fOffset = 0;
850 fIndex = 0;
851 fFinder = nullptr;
852}
853
854////////////////////////////////////////////////////////////////////////////////
855/// Constructor. Null pointer to matrix means identity transformation
856
858{
860 fOffset = offset;
861 fIndex = index;
862 fFinder = nullptr;
863}
864
865////////////////////////////////////////////////////////////////////////////////
866/// Destructor
867
869
870////////////////////////////////////////////////////////////////////////////////
871/// Get the index of this offset.
872
874{
875 return (fIndex + fFinder->GetDivIndex());
876}
877
878////////////////////////////////////////////////////////////////////////////////
879/// Make a copy of this node
880
882{
884 node->SetName(GetName());
885 node->SetTitle(GetTitle());
886 // set the mother
888 // set the copy number
889 node->SetNumber(fNumber);
890 if (IsVirtual())
891 node->SetVirtual();
892 // set the finder
893 node->SetFinder(GetFinder());
894 // set extensions
897 return node;
898}
899
900/** \class TGeoIterator
901\ingroup Geometry_classes
902A geometry iterator.
903
904A geometry iterator that sequentially follows all nodes of the geometrical
905hierarchy of a volume. The iterator has to be initiated with a top volume
906pointer:
907
908~~~ {.cpp}
909 TGeoIterator next(myVolume);
910~~~
911
912One can use the iterator as any other in ROOT:
913
914~~~ {.cpp}
915 TGeoNode *node;
916 while ((node=next())) {
917 ...
918 }
919~~~
920
921The iterator can perform 2 types of iterations that can be selected via:
922
923~~~ {.cpp}
924 next.SetType(Int_t type);
925~~~
926
927Here TYPE can be:
928 - 0 (default) - 'first daughter next' behavior
929 - 1 - iteration at the current level only
930
931Supposing the tree structure looks like:
932
933~~~ {.cpp}
934TOP ___ A_1 ___ A1_1 ___ A11_1
935 | | |___ A12_1
936 | |_____A2_1 ___ A21_1
937 | |___ A21_2
938 |___ B_1 ...
939~~~
940
941The order of iteration for TYPE=0 is: A_1, A1_1, A11_1, A12_1, A2_1, A21_1,
942A21_2, B_1, ...
943
944The order of iteration for TYPE=1 is: A_1, B_1, ...
945At any moment during iteration, TYPE can be changed. If the last iterated node
946is for instance A1_1 and the iteration type was 0, one can do:
947
948~~~ {.cpp}
949 next.SetType(1);
950~~~
951
952The next iterated nodes will be the rest of A daughters: A2,A3,... The iterator
953will return 0 after finishing all daughters of A.
954
955During iteration, the following can be retrieved:
956 - Top volume where iteration started: TGeoIterator::GetTopVolume()
957 - Node at level I in the current branch: TGeoIterator::GetNode(Int_t i)
958 - Iteration type: TGeoIterator::GetType()
959 - Global matrix of the current node with respect to the top volume:
960 TGeoIterator::GetCurrentMatrix()
961
962The iterator can be reset by changing (or not) the top volume:
963
964~~~ {.cpp}
965 TGeoIterator::Reset(TGeoVolume *top);
966~~~
967
968### Example:
969
970We want to find out a volume named "MyVol" in the hierarchy of TOP volume.
971
972~~~ {.cpp}
973 TIter next(TOP);
974 TGeoNode *node;
975 TString name("MyVol");
976 while ((node=next()))
977 if (name == node->GetVolume()->GetName()) return node->GetVolume();
978~~~
979*/
980
981/** \class TGeoIteratorPlugin
982\ingroup Geometry_classes
983*/
984
987
988////////////////////////////////////////////////////////////////////////////////
989/// Geometry iterator for a branch starting with a TOP node.
990
992{
993 fTop = top;
994 fLevel = 0;
997 fType = 0;
998 fArray = new Int_t[30];
999 fMatrix = new TGeoHMatrix();
1000 fTopName = fTop->GetName();
1001 fPlugin = nullptr;
1003}
1004
1005////////////////////////////////////////////////////////////////////////////////
1006/// Copy ctor.
1007
1009{
1010 fTop = iter.GetTopVolume();
1011 fLevel = iter.GetLevel();
1013 fMustStop = kFALSE;
1014 fType = iter.GetType();
1015 fArray = new Int_t[30 + 30 * Int_t(fLevel / 30)];
1016 for (Int_t i = 0; i < fLevel + 1; i++)
1017 fArray[i] = iter.GetIndex(i);
1018 fMatrix = new TGeoHMatrix(*iter.GetCurrentMatrix());
1019 fTopName = fTop->GetName();
1020 fPlugin = iter.fPlugin;
1022 ;
1023}
1024
1025////////////////////////////////////////////////////////////////////////////////
1026/// Destructor.
1027
1029{
1030 if (fArray)
1031 delete[] fArray;
1032 delete fMatrix;
1033}
1034
1035////////////////////////////////////////////////////////////////////////////////
1036/// Assignment.
1037
1039{
1040 if (&iter == this)
1041 return *this;
1042 fTop = iter.GetTopVolume();
1043 fLevel = iter.GetLevel();
1045 fMustStop = kFALSE;
1046 fType = iter.GetType();
1047 if (fArray)
1048 delete[] fArray;
1049 fArray = new Int_t[30 + 30 * Int_t(fLevel / 30)];
1050 for (Int_t i = 0; i < fLevel + 1; i++)
1051 fArray[i] = iter.GetIndex(i);
1052 if (!fMatrix)
1053 fMatrix = new TGeoHMatrix();
1054 *fMatrix = *iter.GetCurrentMatrix();
1055 fTopName = fTop->GetName();
1056 fPlugin = iter.fPlugin;
1058 ;
1059 return *this;
1060}
1061
1062////////////////////////////////////////////////////////////////////////////////
1063/// Returns next node.
1064
1066{
1067 if (fMustStop)
1068 return nullptr;
1069 TGeoNode *mother = nullptr;
1070 TGeoNode *next = nullptr;
1071 Int_t i;
1072 Int_t nd = fTop->GetNdaughters();
1073 if (!nd) {
1074 fMustStop = kTRUE;
1075 return nullptr;
1076 }
1077 if (!fLevel) {
1078 fArray[++fLevel] = 0;
1079 next = fTop->GetNode(0);
1080 if (fPlugin && fPluginAutoexec)
1082 return next;
1083 }
1084 next = fTop->GetNode(fArray[1]);
1085 // Move to current node
1086 for (i = 2; i < fLevel + 1; i++) {
1087 mother = next;
1088 next = mother->GetDaughter(fArray[i]);
1089 }
1090 if (fMustResume) {
1092 if (fPlugin && fPluginAutoexec)
1094 return next;
1095 }
1096
1097 switch (fType) {
1098 case 0: // default next daughter behavior
1099 nd = next->GetNdaughters();
1100 if (nd) {
1101 // First daughter next
1102 fLevel++;
1103 if ((fLevel % 30) == 0)
1104 IncreaseArray();
1105 fArray[fLevel] = 0;
1106 if (fPlugin && fPluginAutoexec)
1108 return next->GetDaughter(0);
1109 }
1110 // cd up and pick next
1111 while (next) {
1112 next = GetNode(fLevel - 1);
1113 if (!next) {
1114 nd = fTop->GetNdaughters();
1115 if (fArray[fLevel] < nd - 1) {
1116 fArray[fLevel]++;
1117 if (fPlugin && fPluginAutoexec)
1119 return fTop->GetNode(fArray[fLevel]);
1120 }
1121 fMustStop = kTRUE;
1122 return nullptr;
1123 } else {
1124 nd = next->GetNdaughters();
1125 if (fArray[fLevel] < nd - 1) {
1126 fArray[fLevel]++;
1127 if (fPlugin && fPluginAutoexec)
1129 return next->GetDaughter(fArray[fLevel]);
1130 }
1131 }
1132 fLevel--;
1133 }
1134 break;
1135 case 1: // one level search
1136 if (mother)
1137 nd = mother->GetNdaughters();
1138 if (fArray[fLevel] < nd - 1) {
1139 fArray[fLevel]++;
1140 if (fPlugin && fPluginAutoexec)
1142 if (!mother)
1143 return fTop->GetNode(fArray[fLevel]);
1144 else
1145 return mother->GetDaughter(fArray[fLevel]);
1146 }
1147 }
1148 fMustStop = kTRUE;
1149 return nullptr;
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// Returns next node.
1154
1156{
1157 return Next();
1158}
1159
1160////////////////////////////////////////////////////////////////////////////////
1161/// Returns global matrix for current node.
1162
1164{
1165 fMatrix->Clear();
1166 if (!fLevel)
1167 return fMatrix;
1168 TGeoNode *node = fTop->GetNode(fArray[1]);
1169 fMatrix->Multiply(node->GetMatrix());
1170 for (Int_t i = 2; i < fLevel + 1; i++) {
1171 node = node->GetDaughter(fArray[i]);
1172 fMatrix->Multiply(node->GetMatrix());
1173 }
1174 return fMatrix;
1175}
1176
1177////////////////////////////////////////////////////////////////////////////////
1178/// Returns current node at a given level.
1179
1181{
1182 if (!level || level > fLevel)
1183 return nullptr;
1184 TGeoNode *node = fTop->GetNode(fArray[1]);
1185 for (Int_t i = 2; i < level + 1; i++)
1186 node = node->GetDaughter(fArray[i]);
1187 return node;
1188}
1189
1190////////////////////////////////////////////////////////////////////////////////
1191/// Returns the path for the current node.
1192
1194{
1195 path = fTopName;
1196 if (!fLevel)
1197 return;
1198 TGeoNode *node = fTop->GetNode(fArray[1]);
1199 path += "/";
1200 path += node->GetName();
1201 for (Int_t i = 2; i < fLevel + 1; i++) {
1202 node = node->GetDaughter(fArray[i]);
1203 path += "/";
1204 path += node->GetName();
1205 }
1206}
1207
1208////////////////////////////////////////////////////////////////////////////////
1209/// Increase by 30 the size of the array.
1210
1212{
1213 Int_t *array = new Int_t[fLevel + 30];
1214 memcpy(array, fArray, fLevel * sizeof(Int_t));
1215 delete[] fArray;
1216 fArray = array;
1217}
1218
1219////////////////////////////////////////////////////////////////////////////////
1220/// Resets the iterator for volume TOP.
1221
1223{
1224 if (top)
1225 fTop = top;
1226 fLevel = 0;
1228 fMustStop = kFALSE;
1229}
1230
1231////////////////////////////////////////////////////////////////////////////////
1232/// Set the top name for path
1233
1235{
1236 fTopName = name;
1237}
1238
1239////////////////////////////////////////////////////////////////////////////////
1240/// Stop iterating the current branch. The iteration of the next node will
1241/// behave as if the branch starting from the current node (included) is not existing.
1242
1244{
1246 TGeoNode *next = GetNode(fLevel);
1247 if (!next)
1248 return;
1249 Int_t nd;
1250 switch (fType) {
1251 case 0: // default next daughter behavior
1252 // cd up and pick next
1253 while (next) {
1254 next = GetNode(fLevel - 1);
1255 nd = (next == nullptr) ? fTop->GetNdaughters() : next->GetNdaughters();
1256 if (fArray[fLevel] < nd - 1) {
1257 ++fArray[fLevel];
1258 return;
1259 }
1260 fLevel--;
1261 if (!fLevel) {
1262 fMustStop = kTRUE;
1263 return;
1264 }
1265 }
1266 break;
1267 case 1: // one level search
1268 next = GetNode(fLevel - 1);
1269 nd = (next == nullptr) ? fTop->GetNdaughters() : next->GetNdaughters();
1270 if (fArray[fLevel] < nd - 1) {
1271 ++fArray[fLevel];
1272 return;
1273 }
1274 fMustStop = kTRUE;
1275 break;
1276 }
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// Set a plugin.
1281
1283{
1284 fPlugin = plugin;
1285 if (plugin)
1286 plugin->SetIterator(this);
1287}
#define b(i)
Definition RSha256.hxx:100
int Int_t
Definition RtypesCore.h:45
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t option
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
R__EXTERN TGeoIdentity * gGeoIdentity
Definition TGeoMatrix.h:537
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Bool_t IsVisStreamed() const
Definition TGeoAtt.h:90
Bool_t TestAttBit(UInt_t f) const
Definition TGeoAtt.h:64
Bool_t IsVisTouched() const
Definition TGeoAtt.h:91
void SetVisStreamed(Bool_t vis=kTRUE)
Mark attributes as "streamed to file".
Definition TGeoAtt.cxx:128
void SetVisDaughters(Bool_t vis=kTRUE)
Set visibility for the daughters.
Definition TGeoAtt.cxx:116
@ kVisOnScreen
Definition TGeoAtt.h:31
Bool_t IsVisDaughters() const
Definition TGeoAtt.h:84
virtual void SetVisibility(Bool_t vis=kTRUE)
Set visibility for this object.
Definition TGeoAtt.cxx:104
void SetVisTouched(Bool_t vis=kTRUE)
Mark visualization attributes as "modified".
Definition TGeoAtt.cxx:138
ABC for user objects attached to TGeoVolume or TGeoNode.
virtual TGeoExtension * Grab()=0
virtual void Release() const =0
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition TGeoMatrix.h:458
void Clear(Option_t *option="") override
clear the data for this matrix
void Multiply(const TGeoMatrix *right)
multiply to the right with an other transformation if right is identity matrix, just return
void SetIterator(const TGeoIterator *iter)
Definition TGeoNode.h:237
virtual void ProcessNode()=0
A geometry iterator.
Definition TGeoNode.h:248
Int_t GetType() const
Definition TGeoNode.h:300
TGeoIterator & operator=(const TGeoIterator &iter)
Assignment.
void Reset(TGeoVolume *top=nullptr)
Resets the iterator for volume TOP.
TGeoIteratorPlugin * fPlugin
Definition TGeoNode.h:258
virtual ~TGeoIterator()
Destructor.
const TGeoMatrix * GetCurrentMatrix() const
Returns global matrix for current node.
Bool_t fMustStop
Definition TGeoNode.h:252
void SetTopName(const char *name)
Set the top name for path.
Bool_t fMustResume
Definition TGeoNode.h:251
Int_t fLevel
Definition TGeoNode.h:253
Bool_t fPluginAutoexec
Definition TGeoNode.h:259
Int_t fType
Definition TGeoNode.h:254
Int_t GetLevel() const
Definition TGeoNode.h:294
void GetPath(TString &path) const
Returns the path for the current node.
void IncreaseArray()
Increase by 30 the size of the array.
TGeoNode * GetNode(Int_t level) const
Returns current node at a given level.
TGeoNode * operator()()
Returns next node.
TGeoHMatrix * fMatrix
Definition TGeoNode.h:256
Int_t GetIndex(Int_t i) const
Definition TGeoNode.h:293
TGeoVolume * fTop
Definition TGeoNode.h:250
TGeoNode * Next()
Returns next node.
void SetUserPlugin(TGeoIteratorPlugin *plugin)
Set a plugin.
void Skip()
Stop iterating the current branch.
Int_t * fArray
Definition TGeoNode.h:255
TString fTopName
Definition TGeoNode.h:257
TGeoVolume * GetTopVolume() const
Definition TGeoNode.h:299
The manager class for any TGeo geometry.
Definition TGeoManager.h:44
TObjArray * GetListOfOverlaps()
void CdUp()
Go one level up in geometry.
void ClearOverlaps()
Clear the list of overlaps.
TGeoNavigator * GetCurrentNavigator() const
Returns current navigator for the calling thread.
Bool_t IsClosed() const
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
TObjArray * GetListOfNodes()
void SetVisLevel(Int_t level=3)
set default level down to which visualization is performed
void SetCheckingOverlaps(Bool_t flag=kTRUE)
void SetCurrentPoint(Double_t *point)
TGeoNode * FindNode(Bool_t safe_start=kTRUE)
Returns deepest node containing current point.
const Double_t * GetCurrentPoint() const
void ModifiedPad() const
Send "Modified" signal to painter.
TGeoVolume * GetCurrentVolume() const
TVirtualGeoPainter * GetPainter() const
void MasterToLocal(const Double_t *master, Double_t *local) const
void SortOverlaps()
Sort overlaps by decreasing overlap distance. Extrusions comes first.
Geometrical transformation package.
Definition TGeoMatrix.h:38
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
convert a vector by multiplying its column vector (x, y, z, 1) to matrix inverse
void Print(Option_t *option="") const override
print the matrix in 4x4 format
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix
virtual const Double_t * GetTranslation() const =0
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Bool_t IsRotAboutZ() const
Returns true if no rotation or the rotation is about Z axis.
Class providing navigation API for TGeo geometries.
TGeoNodeCache * GetCache() const
TGeoStateInfo * GetInfo()
Get next state info pointer.
void ReleaseInfo()
Release last used state info pointer.
A node containing local transformation.
Definition TGeoNode.h:154
void SetMatrix(const TGeoMatrix *matrix)
Matrix setter.
Definition TGeoNode.cxx:829
TGeoNode * MakeCopyNode() const override
Make a copy of this node.
Definition TGeoNode.cxx:802
Int_t GetByteCount() const override
return the total size in bytes of this node
Definition TGeoNode.cxx:772
TGeoNodeMatrix()
Default constructor.
Definition TGeoNode.cxx:749
TGeoMatrix * fMatrix
Definition TGeoNode.h:156
~TGeoNodeMatrix() override
Destructor.
Definition TGeoNode.cxx:767
Int_t GetOptimalVoxels() const override
Returns type of optimal voxelization for this node.
Definition TGeoNode.cxx:784
Node containing an offset.
Definition TGeoNode.h:184
Double_t fOffset
Definition TGeoNode.h:186
void SetFinder(TGeoPatternFinder *finder)
Definition TGeoNode.h:210
TGeoPatternFinder * fFinder
Definition TGeoNode.h:188
TGeoPatternFinder * GetFinder() const override
Definition TGeoNode.h:203
~TGeoNodeOffset() override
Destructor.
Definition TGeoNode.cxx:868
TGeoNodeOffset()
Default constructor.
Definition TGeoNode.cxx:846
Int_t GetIndex() const override
Get the index of this offset.
Definition TGeoNode.cxx:873
TGeoNode * MakeCopyNode() const override
Make a copy of this node.
Definition TGeoNode.cxx:881
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition TGeoNode.h:39
Bool_t IsOverlapping() const
Definition TGeoNode.h:107
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the node.
Definition TGeoNode.cxx:518
Bool_t IsVisDaughters() const
Definition TGeoNode.h:110
Bool_t IsOnScreen() const
check if this node is drawn. Assumes that this node is current
Definition TGeoNode.cxx:294
TGeoVolume * GetVolume() const
Definition TGeoNode.h:99
void SaveAttributes(std::ostream &out)
save attributes for this node
Definition TGeoNode.cxx:439
TGeoVolume * fVolume
Definition TGeoNode.h:41
void CheckShapes()
check for wrong parameters in shapes
Definition TGeoNode.cxx:329
void PrintOverlaps() const
print possible overlapping nodes
Definition TGeoNode.cxx:667
TGeoExtension * fFWExtension
Transient user-defined extension to volumes.
Definition TGeoNode.h:47
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
compute the closest distance of approach from point px,py to this node
Definition TGeoNode.cxx:251
TGeoNode()
Default constructor.
Definition TGeoNode.cxx:95
TGeoExtension * fUserExtension
Definition TGeoNode.h:46
Int_t * fOverlaps
Definition TGeoNode.h:45
Int_t fNovlp
Definition TGeoNode.h:44
void SetOverlapping(Bool_t flag=kTRUE)
Definition TGeoNode.h:120
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
Definition TGeoNode.cxx:545
void SetOverlaps(Int_t *ovlp, Int_t novlp)
set the list of overlaps for this node (ovlp must be created with operator new)
Definition TGeoNode.cxx:707
void PrintCandidates() const
print daughters candidates for containing current point
Definition TGeoNode.cxx:616
void ls(Option_t *option="") const override
Print the path (A/B/C/...) to this node on stdout.
Definition TGeoNode.cxx:600
Int_t GetNdaughters() const
Definition TGeoNode.h:91
TGeoNode * GetDaughter(Int_t ind) const
Definition TGeoNode.h:83
virtual TGeoMatrix * GetMatrix() const =0
void SetVisibility(Bool_t vis=kTRUE) override
Set visibility of the node (obsolete).
Definition TGeoNode.cxx:718
Bool_t MayOverlap(Int_t iother) const
Check the overlab between the bounding box of the node overlaps with the one the brother with index I...
Definition TGeoNode.cxx:555
Bool_t IsVisible() const
Definition TGeoNode.h:109
void CopyOverlaps(Int_t *ovlp, Int_t novlp)
Transient framework-defined extension to volumes.
Definition TGeoNode.cxx:694
void SetMotherVolume(TGeoVolume *mother)
Definition TGeoNode.h:125
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the node.
Definition TGeoNode.cxx:500
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a vector from local reference system to mother reference.
Definition TGeoNode.cxx:592
void Browse(TBrowser *b) override
How-to-browse for a node.
Definition TGeoNode.cxx:147
void Paint(Option_t *option="") override
Paint this node and its content according to visualization settings.
Definition TGeoNode.cxx:605
void DrawOverlaps()
Method drawing the overlap candidates with this node.
Definition TGeoNode.cxx:363
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
Convert the point coordinates from local reference system to mother reference.
Definition TGeoNode.cxx:584
Int_t CountDaughters(Bool_t unique_volumes=kFALSE)
Returns the number of daughters.
Definition TGeoNode.cxx:165
void DrawOnly(Option_t *option="")
draw only this node independently of its vis options
Definition TGeoNode.cxx:342
@ kGeoNodeOffset
Definition TGeoNode.h:58
void SetVirtual()
Definition TGeoNode.h:121
void Draw(Option_t *option="") override
draw current node according to option
Definition TGeoNode.cxx:350
void SetNumber(Int_t number)
Definition TGeoNode.h:118
virtual void MasterToLocal(const Double_t *master, Double_t *local) const
Convert the point coordinates from mother reference to local reference system.
Definition TGeoNode.cxx:568
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Definition TGeoNode.cxx:533
Int_t FindNode(const TGeoNode *node, Int_t level)
Search for a node within the branch of this one.
Definition TGeoNode.cxx:411
void VisibleDaughters(Bool_t vis=kTRUE)
Set visibility of the daughters (obsolete).
Definition TGeoNode.cxx:731
void FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
Fill array with node id. Recursive on node branch.
Definition TGeoNode.cxx:392
Int_t fNumber
Definition TGeoNode.h:43
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
Convert a vector from mother reference to local reference system.
Definition TGeoNode.cxx:576
char * GetObjectInfo(Int_t px, Int_t py) const override
Get node info for the browser.
Definition TGeoNode.cxx:281
Bool_t IsVirtual() const
Definition TGeoNode.h:108
~TGeoNode() override
Destructor.
Definition TGeoNode.cxx:130
void SetCloned(Bool_t flag=kTRUE)
Definition TGeoNode.h:119
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="")
Check overlaps bigger than OVLP hierarchically, starting with this node.
Definition TGeoNode.cxx:192
void InspectNode() const
Inspect this node.
Definition TGeoNode.cxx:304
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute mouse actions on this volume.
Definition TGeoNode.cxx:268
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape
Definition TGeoNode.cxx:684
TGeoVolume * fMother
Definition TGeoNode.h:42
Base finder class for patterns.
virtual TGeoNode * FindNode(Double_t *, const Double_t *=nullptr)
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
virtual Bool_t IsCylType() const =0
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
void SetVisibility(Bool_t vis=kTRUE) override
set visibility of this volume
void Print(Option_t *option="") const override
Print volume info.
Bool_t IsSelected() const
Definition TGeoVolume.h:150
TGeoManager * GetGeoManager() const
Definition TGeoVolume.h:173
Bool_t Contains(const Double_t *point) const
Definition TGeoVolume.h:104
void Draw(Option_t *option="") override
draw top volume according to option
Int_t GetNdaughters() const
Definition TGeoVolume.h:362
void SelectVolume(Bool_t clear=kFALSE)
Select this volume as matching an arbitrary criteria.
TObjArray * GetNodes()
Definition TGeoVolume.h:169
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
void CheckShapes()
check for negative parameters in shapes.
TGeoPatternFinder * GetFinder() const
Definition TGeoVolume.h:177
TGeoVoxelFinder * GetVoxels() const
Getter for optimization structure.
TGeoShape * GetShape() const
Definition TGeoVolume.h:190
void SetAdded()
Definition TGeoVolume.h:215
void SetReplicated()
Definition TGeoVolume.h:216
virtual void DrawOnly(Option_t *option="")
draw only this volume
virtual Bool_t IsVisible() const
Definition TGeoVolume.h:155
Bool_t IsAdded() const
Definition TGeoVolume.h:147
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="") const
Overlap checking tool.
Finder class handling voxels.
virtual Int_t * GetCheckList(const Double_t *point, Int_t &nelem, TGeoStateInfo &td)
get the list of daughter indices for which point is inside their bbox
void PrintVoxelLimits(const Double_t *point) const
print the voxel containing point
void Reset()
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
An array of TObjects.
Definition TObjArray.h:31
Int_t GetEntriesFast() const
Definition TObjArray.h:58
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:987
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:961
Stopwatch class.
Definition TStopwatch.h:28
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Basic string class.
Definition TString.h:139
void ToLower()
Change string to lower-case.
Definition TString.cxx:1182
const char * Data() const
Definition TString.h:376
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2378
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
Abstract class for geometry painters.
virtual void OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch=nullptr, Bool_t last=kFALSE, Bool_t refresh=kFALSE, const char *msg="")=0
virtual Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py)=0
virtual const char * GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const =0
virtual void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py)=0
virtual void PaintNode(TGeoNode *node, Option_t *option="", TGeoMatrix *global=nullptr)=0
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123
Statefull info for the current geometry level.