Logo ROOT  
Reference Guide
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 = 0;
98 fMother = 0;
99 fNumber = 0;
100 fNovlp = 0;
101 fOverlaps = 0;
102 fUserExtension = 0;
103 fFWExtension = 0;
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Constructor
108
110{
111 if (!vol) {
112 Error("ctor", "volume not specified");
113 return;
114 }
115 fVolume = (TGeoVolume*)vol;
117 fVolume->SetAdded();
118 fMother = 0;
119 fNumber = 0;
120 fNovlp = 0;
121 fOverlaps = 0;
122 fUserExtension = 0;
123 fFWExtension = 0;
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Destructor
128
130{
131 if (fOverlaps) delete [] fOverlaps;
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// How-to-browse for a node.
138
140{
141 if (!b) return;
142 if (!GetNdaughters()) return;
143 TGeoNode *daughter;
144 TString title;
145 for (Int_t i=0; i<GetNdaughters(); i++) {
146 daughter = GetDaughter(i);
147 b->Add(daughter, daughter->GetName(), daughter->IsVisible());
148 }
149}
150
151////////////////////////////////////////////////////////////////////////////////
152/// Returns the number of daughters. Nodes pointing to same volume counted
153/// once if unique_volumes is set.
154
156{
157 static Int_t icall = 0;
158 Int_t counter = 0;
159 // Count this node
160 if (unique_volumes) {
161 if (!fVolume->IsSelected()) {
162 counter++;
164 }
165 } else counter++;
166 icall++;
168 // Count daughters recursively
169 for (Int_t i=0; i<nd; i++) counter += GetDaughter(i)->CountDaughters(unique_volumes);
170 icall--;
171 // Un-mark volumes
172 if (icall == 0) fVolume->SelectVolume(kTRUE);
173 return counter;
174}
175
176////////////////////////////////////////////////////////////////////////////////
177/// Check overlaps bigger than OVLP hierarchically, starting with this node.
178
180{
181 Int_t icheck = 0;
182 Int_t ncheck = 0;
183 TStopwatch *timer;
184 Int_t i;
185 Bool_t sampling = kFALSE;
186 TString opt(option);
187 opt.ToLower();
188 if (opt.Contains("s")) sampling = kTRUE;
189
191 ncheck = CountDaughters(kFALSE);
192 timer = new TStopwatch();
193 geom->ClearOverlaps();
195 Info("CheckOverlaps", "Checking overlaps for %s and daughters within %g", fVolume->GetName(),ovlp);
196 if (sampling) {
197 Info("CheckOverlaps", "Checking overlaps by sampling <%s> for %s and daughters", option, fVolume->GetName());
198 Info("CheckOverlaps", "=== NOTE: Extrusions NOT checked with sampling option ! ===");
199 }
200 timer->Start();
201 geom->GetGeomPainter()->OpProgress(fVolume->GetName(),icheck,ncheck,timer,kFALSE);
202 fVolume->CheckOverlaps(ovlp,option);
203 icheck++;
204 TGeoIterator next(fVolume);
205 TGeoNode *node;
206 TString path;
207 TObjArray *overlaps = geom->GetListOfOverlaps();
208 Int_t novlps;
209 TString msg;
210 while ((node=next())) {
211 next.GetPath(path);
212 icheck++;
213 if (!node->GetVolume()->IsSelected()) {
214 msg = TString::Format("found %d overlaps", overlaps->GetEntriesFast());
215 geom->GetGeomPainter()->OpProgress(node->GetVolume()->GetName(),icheck,ncheck,timer,kFALSE, msg);
216 node->GetVolume()->SelectVolume(kFALSE);
217 node->GetVolume()->CheckOverlaps(ovlp,option);
218 }
219 }
222 geom->SortOverlaps();
223 novlps = overlaps->GetEntriesFast();
224 TNamed *obj;
225 for (i=0; i<novlps; i++) {
226 obj = (TNamed*)overlaps->At(i);
227 obj->SetName(TString::Format("ov%05d",i));
228 }
229 geom->GetGeomPainter()->OpProgress("Check overlaps:",icheck,ncheck,timer,kTRUE);
230 Info("CheckOverlaps", "Number of illegal overlaps/extrusions : %d\n", novlps);
231 delete timer;
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// compute the closest distance of approach from point px,py to this node
236
238{
239 Int_t dist = 9999;
240 if (!fVolume) return dist;
243 if (!painter) return dist;
244 dist = painter->DistanceToPrimitiveVol(fVolume, px, py);
245 return dist;
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// Execute mouse actions on this volume.
250
252{
253 if (!fVolume) return;
255 if (!painter) return;
256 painter->ExecuteVolumeEvent(fVolume, event, px, py);
257}
258
259////////////////////////////////////////////////////////////////////////////////
260/// Get node info for the browser.
261
263{
264 if (!fVolume) return 0;
266 if (!painter) return 0;
267 return (char*)painter->GetVolumeInfo(fVolume, px, py);
268}
269
270////////////////////////////////////////////////////////////////////////////////
271/// check if this node is drawn. Assumes that this node is current
272
274{
276 return kFALSE;
277}
278
279////////////////////////////////////////////////////////////////////////////////
280/// Inspect this node.
281
283{
284 printf("== Inspecting node %s ", GetName());
285 if (fMother) printf("mother volume %s. ", fMother->GetName());
286 if (IsOverlapping()) printf("(Node is MANY)\n");
287 else printf("\n");
288 if (fOverlaps && fMother) {
289 printf(" possibly overlapping with : ");
290 for (Int_t i=0; i<fNovlp; i++)
291 printf(" %s ", fMother->GetNode(fOverlaps[i])->GetName());
292 printf("\n");
293 }
294 printf("Transformation matrix:\n");
295 TGeoMatrix *matrix = GetMatrix();
296 if (GetMatrix()) matrix->Print();
297 fVolume->Print();
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// check for wrong parameters in shapes
302
304{
306 Int_t nd = GetNdaughters();
307 if (!nd) return;
308 for (Int_t i=0; i<nd; i++) fVolume->GetNode(i)->CheckShapes();
309}
310
311////////////////////////////////////////////////////////////////////////////////
312/// draw only this node independently of its vis options
313
315{
316 fVolume->DrawOnly(option);
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// draw current node according to option
321
323{
325 gGeoManager->CdUp();
326 Double_t point[3];
328 gGeoManager->SetCurrentPoint(&point[0]);
330}
331
332////////////////////////////////////////////////////////////////////////////////
333/// Method drawing the overlap candidates with this node.
334
336{
337 if (!fNovlp) {printf("node %s is ONLY\n", GetName()); return;}
338 if (!fOverlaps) {printf("node %s no overlaps\n", GetName()); return;}
339 TGeoNode *node;
340 Int_t i;
342 for (i=0; i<nd; i++) {
343 node = fMother->GetNode(i);
345 }
347 for (i=0; i<fNovlp; i++) {
348 node = fMother->GetNode(fOverlaps[i]);
349 node->GetVolume()->SetVisibility(kTRUE);
350 }
352 fMother->Draw();
353}
354
355////////////////////////////////////////////////////////////////////////////////
356/// Fill array with node id. Recursive on node branch.
357
358void TGeoNode::FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
359{
360 Int_t nd = GetNdaughters();
361 if (!nd) return;
362 TGeoNode *daughter;
363 Int_t istart = ifree; // start index for daughters
364 ifree += nd;
365 for (Int_t id=0; id<nd; id++) {
366 daughter = GetDaughter(id);
367 array[istart+id] = ifree;
368 array[ifree++] = ++nodeid;
369 daughter->FillIdArray(ifree, nodeid, array);
370 }
371}
372
373
374////////////////////////////////////////////////////////////////////////////////
375/// Search for a node within the branch of this one.
376
378{
379 Int_t nd = GetNdaughters();
380 if (!nd) return -1;
381 TIter next(fVolume->GetNodes());
382 TGeoNode *daughter;
383 while ((daughter=(TGeoNode*)next())) {
384 if (daughter==node) {
385 gGeoManager->GetListOfNodes()->AddAt(daughter,level+1);
386 return (level+1);
387 }
388 }
389 next.Reset();
390 Int_t new_level;
391 while ((daughter=(TGeoNode*)next())) {
392 new_level = daughter->FindNode(node, level+1);
393 if (new_level>=0) {
394 gGeoManager->GetListOfNodes()->AddAt(daughter, level+1);
395 return new_level;
396 }
397 }
398 return -1;
399}
400
401////////////////////////////////////////////////////////////////////////////////
402/// save attributes for this node
403
404void TGeoNode::SaveAttributes(std::ostream &out)
405{
406 if (IsVisStreamed()) return;
408 char quote='"';
409 Bool_t voldef = kFALSE;
410 if ((fVolume->IsVisTouched()) && (!fVolume->IsVisStreamed())) {
412 out << " vol = gGeoManager->GetVolume("<<quote<<fVolume->GetName()<<quote<<");"<<std::endl;
413 voldef = kTRUE;
414 if (!fVolume->IsVisDaughters())
415 out << " vol->SetVisDaughters(kFALSE);"<<std::endl;
416 if (fVolume->IsVisible()) {
417/*
418 if (fVolume->GetLineColor() != gStyle->GetLineColor())
419 out<<" vol->SetLineColor("<<fVolume->GetLineColor()<<");"<<std::endl;
420 if (fVolume->GetLineStyle() != gStyle->GetLineStyle())
421 out<<" vol->SetLineStyle("<<fVolume->GetLineStyle()<<");"<<std::endl;
422 if (fVolume->GetLineWidth() != gStyle->GetLineWidth())
423 out<<" vol->SetLineWidth("<<fVolume->GetLineWidth()<<");"<<std::endl;
424*/
425 } else {
426 out <<" vol->SetVisibility(kFALSE);"<<std::endl;
427 }
428 }
429 if (!IsVisDaughters()) return;
430 Int_t nd = GetNdaughters();
431 if (!nd) return;
432 TGeoNode *node;
433 for (Int_t i=0; i<nd; i++) {
434 node = GetDaughter(i);
435 if (node->IsVisStreamed()) continue;
436 if (node->IsVisTouched()) {
437 if (!voldef)
438 out << " vol = gGeoManager->GetVolume("<<quote<<fVolume->GetName()<<quote<<");"<<std::endl;
439 out<<" node = vol->GetNode("<<i<<");"<<std::endl;
440 if (!node->IsVisDaughters()) {
441 out<<" node->VisibleDaughters(kFALSE);"<<std::endl;
442 node->SetVisStreamed(kTRUE);
443 continue;
444 }
445 if (!node->IsVisible())
446 out<<" node->SetVisibility(kFALSE);"<<std::endl;
447 }
448 node->SaveAttributes(out);
449 node->SetVisStreamed(kTRUE);
450 }
451}
452
453////////////////////////////////////////////////////////////////////////////////
454/// Connect user-defined extension to the node. The node "grabs" a copy, so
455/// the original object can be released by the producer. Release the previously
456/// connected extension if any.
457///
458/// NOTE: This interface is intended for user extensions and is guaranteed not
459/// to be used by TGeo
460
462{
464 fUserExtension = 0;
465 if (ext) fUserExtension = ext->Grab();
466}
467
468////////////////////////////////////////////////////////////////////////////////
469/// Connect framework defined extension to the node. The node "grabs" a copy,
470/// so the original object can be released by the producer. Release the previously
471/// connected extension if any.
472///
473/// NOTE: This interface is intended for the use by TGeo and the users should
474/// NOT connect extensions using this method
475
477{
479 fFWExtension = 0;
480 if (ext) fFWExtension = ext->Grab();
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Get a copy of the user extension pointer. The user must call Release() on
485/// the copy pointer once this pointer is not needed anymore (equivalent to
486/// delete() after calling new())
487
489{
490 if (fUserExtension) return fUserExtension->Grab();
491 return 0;
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Get a copy of the framework extension pointer. The user must call Release() on
496/// the copy pointer once this pointer is not needed anymore (equivalent to
497/// delete() after calling new())
498
500{
501 if (fFWExtension) return fFWExtension->Grab();
502 return 0;
503}
504////////////////////////////////////////////////////////////////////////////////
505/// Check the overlab between the bounding box of the node overlaps with the one
506/// the brother with index IOTHER.
507
509{
510 if (!fOverlaps) return kFALSE;
511 for (Int_t i=0; i<fNovlp; i++) if (fOverlaps[i]==iother) return kTRUE;
512 return kFALSE;
513}
514
515////////////////////////////////////////////////////////////////////////////////
516/// Convert the point coordinates from mother reference to local reference system
517
518void TGeoNode::MasterToLocal(const Double_t *master, Double_t *local) const
519{
520 GetMatrix()->MasterToLocal(master, local);
521}
522
523////////////////////////////////////////////////////////////////////////////////
524/// Convert a vector from mother reference to local reference system
525
526void TGeoNode::MasterToLocalVect(const Double_t *master, Double_t *local) const
527{
528 GetMatrix()->MasterToLocalVect(master, local);
529}
530
531////////////////////////////////////////////////////////////////////////////////
532/// Convert the point coordinates from local reference system to mother reference
533
534void TGeoNode::LocalToMaster(const Double_t *local, Double_t *master) const
535{
536 GetMatrix()->LocalToMaster(local, master);
537}
538
539////////////////////////////////////////////////////////////////////////////////
540/// Convert a vector from local reference system to mother reference
541
542void TGeoNode::LocalToMasterVect(const Double_t *local, Double_t *master) const
543{
544 GetMatrix()->LocalToMasterVect(local, master);
545}
546
547////////////////////////////////////////////////////////////////////////////////
548/// Print the path (A/B/C/...) to this node on stdout
549
550void TGeoNode::ls(Option_t * /*option*/) const
551{
552}
553
554////////////////////////////////////////////////////////////////////////////////
555/// Paint this node and its content according to visualization settings.
556
558{
560 if (!painter) return;
561 painter->PaintNode(this, option);
562}
563
564////////////////////////////////////////////////////////////////////////////////
565/// print daughters candidates for containing current point
566
568{
569 Double_t point[3];
571 printf(" Local : %g, %g, %g\n", point[0], point[1], point[2]);
572 if (!fVolume->Contains(&point[0])) {
573 printf("current point not inside this\n");
574 return;
575 }
577 TGeoNode *node;
578 if (finder) {
579 printf("current node divided\n");
580 node = finder->FindNode(&point[0]);
581 if (!node) {
582 printf("point not inside division element\n");
583 return;
584 }
585 printf("inside division element %s\n", node->GetName());
586 return;
587 }
588 TGeoVoxelFinder *voxels = fVolume->GetVoxels();
589 if (!voxels) {
590 printf("volume not voxelized\n");
591 return;
592 }
593 Int_t ncheck = 0;
595 TGeoStateInfo &info = *nav->GetCache()->GetInfo();
596 Int_t *check_list = voxels->GetCheckList(&point[0], ncheck, info);
597 nav->GetCache()->ReleaseInfo();
598 voxels->PrintVoxelLimits(&point[0]);
599 if (!check_list) {
600 printf("no candidates for current point\n");
601 return;
602 }
603 TString overlap = "ONLY";
604 for (Int_t id=0; id<ncheck; id++) {
605 node = fVolume->GetNode(check_list[id]);
606 if (node->IsOverlapping()) overlap = "MANY";
607 else overlap = "ONLY";
608 printf("%i %s %s\n", check_list[id], node->GetName(), overlap.Data());
609 }
611}
612
613////////////////////////////////////////////////////////////////////////////////
614/// print possible overlapping nodes
615
617{
618 if (!fOverlaps) {printf("node %s no overlaps\n", GetName()); return;}
619 printf("Overlaps for node %s :\n", GetName());
620 TGeoNode *node;
621 for (Int_t i=0; i<fNovlp; i++) {
622 node = fMother->GetNode(fOverlaps[i]);
623 printf(" %s\n", node->GetName());
624 }
625}
626
627////////////////////////////////////////////////////////////////////////////////
628/// computes the closest distance from given point to this shape
629
631{
632 Double_t local[3];
633 GetMatrix()->MasterToLocal(point,local);
634 return fVolume->GetShape()->Safety(local,in);
635}
636
637////////////////////////////////////////////////////////////////////////////////
638/// Copy content of lst of overlaps from source array
639
641{
642 Int_t *ovlps = nullptr;
643 if (src && (novlp > 0)) {
644 ovlps = new Int_t[novlp];
645 memcpy(ovlps, src, novlp*sizeof(Int_t));
646 }
647 SetOverlaps(ovlps, novlp);
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// set the list of overlaps for this node (ovlp must be created with operator new)
652
654{
655 if (fOverlaps) delete [] fOverlaps;
656 fOverlaps = ovlp;
657 fNovlp = novlp;
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// Set visibility of the node (obsolete).
662
664{
667 if (vis && !fVolume->IsVisible()) fVolume->SetVisibility(vis);
669}
670
671////////////////////////////////////////////////////////////////////////////////
672/// Set visibility of the daughters (obsolete).
673
675{
677 SetVisDaughters(vis);
679}
680
681/** \class TGeoNodeMatrix
682\ingroup Geometry_classes
683A node containing local transformation.
684*/
685
687
688////////////////////////////////////////////////////////////////////////////////
689/// Default constructor
690
692{
693 fMatrix = 0;
694}
695
696////////////////////////////////////////////////////////////////////////////////
697/// Constructor.
698
700 TGeoNode(vol)
701{
702 fMatrix = (TGeoMatrix*)matrix;
704}
705
706////////////////////////////////////////////////////////////////////////////////
707/// Destructor
708
710{
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// return the total size in bytes of this node
715
717{
718 Int_t count = 40 + 4; // TGeoNode + fMatrix
719// if (fMatrix) count += fMatrix->GetByteCount();
720 return count;
721}
722
723////////////////////////////////////////////////////////////////////////////////
724/// Returns type of optimal voxelization for this node.
725/// - type = 0 -> cartesian
726/// - type = 1 -> cylindrical
727
729{
731 if (!type) return 0;
732 if (!fMatrix->IsRotAboutZ()) return 0;
733 const Double_t *transl = fMatrix->GetTranslation();
734 if (TMath::Abs(transl[0])>1E-10) return 0;
735 if (TMath::Abs(transl[1])>1E-10) return 0;
736 return 1;
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Make a copy of this node.
741
743{
745 node->SetName(GetName());
746 node->SetTitle(GetTitle());
747 // set the mother
749 // set the copy number
750 node->SetNumber(fNumber);
751 // copy overlaps
753
754 // copy VC
755 if (IsVirtual()) node->SetVirtual();
756 if (IsOverlapping()) node->SetOverlapping(); // <--- ADDED
757 // Copy extensions
760 node->SetCloned();
761 return node;
762}
763
764////////////////////////////////////////////////////////////////////////////////
765/// Matrix setter.
766
768{
769 fMatrix = (TGeoMatrix*)matrix;
771}
772
773/** \class TGeoNodeOffset
774\ingroup Geometry_classes
775Node containing an offset.
776*/
777
779
780////////////////////////////////////////////////////////////////////////////////
781/// Default constructor
782
784{
786 fOffset = 0;
787 fIndex = 0;
788 fFinder = 0;
789}
790
791////////////////////////////////////////////////////////////////////////////////
792/// Constructor. Null pointer to matrix means identity transformation
793
795 TGeoNode(vol)
796{
798 fOffset = offset;
799 fIndex = index;
800 fFinder = 0;
801}
802
803////////////////////////////////////////////////////////////////////////////////
804/// Destructor
805
807{
808}
809
810////////////////////////////////////////////////////////////////////////////////
811/// Get the index of this offset.
812
814{
815 return (fIndex+fFinder->GetDivIndex());
816}
817
818////////////////////////////////////////////////////////////////////////////////
819/// Make a copy of this node
820
822{
824 node->SetName(GetName());
825 node->SetTitle(GetTitle());
826 // set the mother
828 // set the copy number
829 node->SetNumber(fNumber);
830 if (IsVirtual()) node->SetVirtual();
831 // set the finder
832 node->SetFinder(GetFinder());
833 // set extensions
836 return node;
837}
838
839/** \class TGeoIterator
840\ingroup Geometry_classes
841A geometry iterator.
842
843A geometry iterator that sequentially follows all nodes of the geometrical
844hierarchy of a volume. The iterator has to be initiated with a top volume
845pointer:
846
847~~~ {.cpp}
848 TGeoIterator next(myVolume);
849~~~
850
851One can use the iterator as any other in ROOT:
852
853~~~ {.cpp}
854 TGeoNode *node;
855 while ((node=next())) {
856 ...
857 }
858~~~
859
860The iterator can perform 2 types of iterations that can be selected via:
861
862~~~ {.cpp}
863 next.SetType(Int_t type);
864~~~
865
866Here TYPE can be:
867 - 0 (default) - 'first daughter next' behavior
868 - 1 - iteration at the current level only
869
870Supposing the tree structure looks like:
871
872~~~ {.cpp}
873TOP ___ A_1 ___ A1_1 ___ A11_1
874 | | |___ A12_1
875 | |_____A2_1 ___ A21_1
876 | |___ A21_2
877 |___ B_1 ...
878~~~
879
880The order of iteration for TYPE=0 is: A_1, A1_1, A11_1, A12_1, A2_1, A21_1,
881A21_2, B_1, ...
882
883The order of iteration for TYPE=1 is: A_1, B_1, ...
884At any moment during iteration, TYPE can be changed. If the last iterated node
885is for instance A1_1 and the iteration type was 0, one can do:
886
887~~~ {.cpp}
888 next.SetType(1);
889~~~
890
891The next iterated nodes will be the rest of A daughters: A2,A3,... The iterator
892will return 0 after finishing all daughters of A.
893
894During iteration, the following can be retrieved:
895 - Top volume where iteration started: TGeoIterator::GetTopVolume()
896 - Node at level I in the current branch: TGeoIterator::GetNode(Int_t i)
897 - Iteration type: TGeoIterator::GetType()
898 - Global matrix of the current node with respect to the top volume:
899 TGeoIterator::GetCurrentMatrix()
900
901The iterator can be reset by changing (or not) the top volume:
902
903~~~ {.cpp}
904 TGeoIterator::Reset(TGeoVolume *top);
905~~~
906
907### Example:
908
909We want to find out a volume named "MyVol" in the hierarchy of TOP volume.
910
911~~~ {.cpp}
912 TIter next(TOP);
913 TGeoNode *node;
914 TString name("MyVol");
915 while ((node=next()))
916 if (name == node->GetVolume()->GetName()) return node->GetVolume();
917~~~
918*/
919
920/** \class TGeoIteratorPlugin
921\ingroup Geometry_classes
922*/
923
926
927////////////////////////////////////////////////////////////////////////////////
928/// Geometry iterator for a branch starting with a TOP node.
929
931{
932 fTop = top;
933 fLevel = 0;
936 fType = 0;
937 fArray = new Int_t[30];
938 fMatrix = new TGeoHMatrix();
939 fTopName = fTop->GetName();
940 fPlugin = 0;
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// Copy ctor.
946
948{
949 fTop = iter.GetTopVolume();
950 fLevel = iter.GetLevel();
953 fType = iter.GetType();
954 fArray = new Int_t[30+ 30*Int_t(fLevel/30)];
955 for (Int_t i=0; i<fLevel+1; i++) fArray[i] = iter.GetIndex(i);
956 fMatrix = new TGeoHMatrix(*iter.GetCurrentMatrix());
957 fTopName = fTop->GetName();
958 fPlugin = iter.fPlugin;
960}
961
962////////////////////////////////////////////////////////////////////////////////
963/// Destructor.
964
966{
967 if (fArray) delete [] fArray;
968 delete fMatrix;
969}
970
971////////////////////////////////////////////////////////////////////////////////
972/// Assignment.
973
975{
976 if (&iter == this) return *this;
977 fTop = iter.GetTopVolume();
978 fLevel = iter.GetLevel();
981 fType = iter.GetType();
982 if (fArray) delete [] fArray;
983 fArray = new Int_t[30+ 30*Int_t(fLevel/30)];
984 for (Int_t i=0; i<fLevel+1; i++) fArray[i] = iter.GetIndex(i);
985 if (!fMatrix) fMatrix = new TGeoHMatrix();
986 *fMatrix = *iter.GetCurrentMatrix();
987 fTopName = fTop->GetName();
988 fPlugin = iter.fPlugin;
990 return *this;
991}
992
993////////////////////////////////////////////////////////////////////////////////
994/// Returns next node.
995
997{
998 if (fMustStop) return 0;
999 TGeoNode *mother = 0;
1000 TGeoNode *next = 0;
1001 Int_t i;
1002 Int_t nd = fTop->GetNdaughters();
1003 if (!nd) {
1004 fMustStop = kTRUE;
1005 return 0;
1006 }
1007 if (!fLevel) {
1008 fArray[++fLevel] = 0;
1009 next = fTop->GetNode(0);
1011 return next;
1012 }
1013 next = fTop->GetNode(fArray[1]);
1014 // Move to current node
1015 for (i=2; i<fLevel+1; i++) {
1016 mother = next;
1017 next = mother->GetDaughter(fArray[i]);
1018 }
1019 if (fMustResume) {
1022 return next;
1023 }
1024
1025 switch (fType) {
1026 case 0: // default next daughter behavior
1027 nd = next->GetNdaughters();
1028 if (nd) {
1029 // First daughter next
1030 fLevel++;
1031 if ((fLevel%30)==0) IncreaseArray();
1032 fArray[fLevel] = 0;
1034 return next->GetDaughter(0);
1035 }
1036 // cd up and pick next
1037 while (next) {
1038 next = GetNode(fLevel-1);
1039 if (!next) {
1040 nd = fTop->GetNdaughters();
1041 if (fArray[fLevel]<nd-1) {
1042 fArray[fLevel]++;
1044 return fTop->GetNode(fArray[fLevel]);
1045 }
1046 fMustStop = kTRUE;
1047 return 0;
1048 } else {
1049 nd = next->GetNdaughters();
1050 if (fArray[fLevel]<nd-1) {
1051 fArray[fLevel]++;
1053 return next->GetDaughter(fArray[fLevel]);
1054 }
1055 }
1056 fLevel--;
1057 }
1058 break;
1059 case 1: // one level search
1060 if (mother) nd = mother->GetNdaughters();
1061 if (fArray[fLevel]<nd-1) {
1062 fArray[fLevel]++;
1064 if (!mother) return fTop->GetNode(fArray[fLevel]);
1065 else return mother->GetDaughter(fArray[fLevel]);
1066 }
1067 }
1068 fMustStop = kTRUE;
1069 return 0;
1070}
1071
1072////////////////////////////////////////////////////////////////////////////////
1073/// Returns next node.
1074
1076{
1077 return Next();
1078}
1079
1080////////////////////////////////////////////////////////////////////////////////
1081/// Returns global matrix for current node.
1082
1084{
1085 fMatrix->Clear();
1086 if (!fLevel) return fMatrix;
1087 TGeoNode *node = fTop->GetNode(fArray[1]);
1088 fMatrix->Multiply(node->GetMatrix());
1089 for (Int_t i=2; i<fLevel+1; i++) {
1090 node = node->GetDaughter(fArray[i]);
1091 fMatrix->Multiply(node->GetMatrix());
1092 }
1093 return fMatrix;
1094}
1095
1096////////////////////////////////////////////////////////////////////////////////
1097/// Returns current node at a given level.
1098
1100{
1101 if (!level || level>fLevel) return 0;
1102 TGeoNode *node = fTop->GetNode(fArray[1]);
1103 for (Int_t i=2; i<level+1; i++) node = node->GetDaughter(fArray[i]);
1104 return node;
1105}
1106
1107////////////////////////////////////////////////////////////////////////////////
1108/// Returns the path for the current node.
1109
1111{
1112 path = fTopName;
1113 if (!fLevel) return;
1114 TGeoNode *node = fTop->GetNode(fArray[1]);
1115 path += "/";
1116 path += node->GetName();
1117 for (Int_t i=2; i<fLevel+1; i++) {
1118 node = node->GetDaughter(fArray[i]);
1119 path += "/";
1120 path += node->GetName();
1121 }
1122}
1123
1124////////////////////////////////////////////////////////////////////////////////
1125/// Increase by 30 the size of the array.
1126
1128{
1129 Int_t *array = new Int_t[fLevel+30];
1130 memcpy(array, fArray, fLevel*sizeof(Int_t));
1131 delete [] fArray;
1132 fArray = array;
1133}
1134
1135////////////////////////////////////////////////////////////////////////////////
1136/// Resets the iterator for volume TOP.
1137
1139{
1140 if (top) fTop = top;
1141 fLevel = 0;
1143 fMustStop = kFALSE;
1144}
1145
1146////////////////////////////////////////////////////////////////////////////////
1147/// Set the top name for path
1148
1150{
1151 fTopName = name;
1152}
1153
1154////////////////////////////////////////////////////////////////////////////////
1155/// Stop iterating the current branch. The iteration of the next node will
1156/// behave as if the branch starting from the current node (included) is not existing.
1157
1159{
1161 TGeoNode *next = GetNode(fLevel);
1162 if (!next) return;
1163 Int_t nd;
1164 switch (fType) {
1165 case 0: // default next daughter behavior
1166 // cd up and pick next
1167 while (next) {
1168 next = GetNode(fLevel-1);
1169 nd = (next==0)?fTop->GetNdaughters():next->GetNdaughters();
1170 if (fArray[fLevel]<nd-1) {
1171 ++fArray[fLevel];
1172 return;
1173 }
1174 fLevel--;
1175 if (!fLevel) {
1176 fMustStop = kTRUE;
1177 return;
1178 }
1179 }
1180 break;
1181 case 1: // one level search
1182 next = GetNode(fLevel-1);
1183 nd = (next==0)?fTop->GetNdaughters():next->GetNdaughters();
1184 if (fArray[fLevel]<nd-1) {
1185 ++fArray[fLevel];
1186 return;
1187 }
1188 fMustStop = kTRUE;
1189 break;
1190 }
1191}
1192
1193////////////////////////////////////////////////////////////////////////////////
1194/// Set a plugin.
1195
1197{
1198 fPlugin = plugin;
1199 if (plugin) plugin->SetIterator(this);
1200}
int Int_t
Definition: CPyCppyy.h:43
#define b(i)
Definition: RSha256.hxx:100
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:364
int type
Definition: TGX11.cxx:121
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
R__EXTERN TGeoIdentity * gGeoIdentity
Definition: TGeoMatrix.h:478
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Bool_t IsVisStreamed() const
Definition: TGeoAtt.h:95
Bool_t TestAttBit(UInt_t f) const
Definition: TGeoAtt.h:68
Bool_t IsVisTouched() const
Definition: TGeoAtt.h:96
void SetVisStreamed(Bool_t vis=kTRUE)
Mark attributes as "streamed to file".
Definition: TGeoAtt.cxx:123
void SetVisDaughters(Bool_t vis=kTRUE)
Set visibility for the daughters.
Definition: TGeoAtt.cxx:114
@ kVisOnScreen
Definition: TGeoAtt.h:32
Bool_t IsVisDaughters() const
Definition: TGeoAtt.h:89
virtual void SetVisibility(Bool_t vis=kTRUE)
Set visibility for this object.
Definition: TGeoAtt.cxx:105
void SetVisTouched(Bool_t vis=kTRUE)
Mark visualization attributes as "modified".
Definition: TGeoAtt.cxx:131
ABC for user objects attached to TGeoVolume or TGeoNode.
Definition: TGeoExtension.h:20
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:421
void Clear(Option_t *option="")
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:233
virtual void ProcessNode()=0
A geometry iterator.
Definition: TGeoNode.h:245
Int_t GetType() const
Definition: TGeoNode.h:283
TGeoIterator & operator=(const TGeoIterator &iter)
Assignment.
Definition: TGeoNode.cxx:974
TGeoIteratorPlugin * fPlugin
Definition: TGeoNode.h:256
virtual ~TGeoIterator()
Destructor.
Definition: TGeoNode.cxx:965
const TGeoMatrix * GetCurrentMatrix() const
Returns global matrix for current node.
Definition: TGeoNode.cxx:1083
Bool_t fMustStop
Definition: TGeoNode.h:249
void SetTopName(const char *name)
Set the top name for path.
Definition: TGeoNode.cxx:1149
Bool_t fMustResume
Definition: TGeoNode.h:248
Int_t fLevel
Definition: TGeoNode.h:250
Bool_t fPluginAutoexec
Definition: TGeoNode.h:257
Int_t fType
Definition: TGeoNode.h:251
void Reset(TGeoVolume *top=0)
Resets the iterator for volume TOP.
Definition: TGeoNode.cxx:1138
Int_t GetLevel() const
Definition: TGeoNode.h:276
void GetPath(TString &path) const
Returns the path for the current node.
Definition: TGeoNode.cxx:1110
void IncreaseArray()
Increase by 30 the size of the array.
Definition: TGeoNode.cxx:1127
TGeoNode * GetNode(Int_t level) const
Returns current node at a given level.
Definition: TGeoNode.cxx:1099
TGeoNode * operator()()
Returns next node.
Definition: TGeoNode.cxx:1075
TGeoHMatrix * fMatrix
Definition: TGeoNode.h:253
Int_t GetIndex(Int_t i) const
Definition: TGeoNode.h:275
TGeoVolume * fTop
Definition: TGeoNode.h:247
TGeoNode * Next()
Returns next node.
Definition: TGeoNode.cxx:996
TGeoVolume * GetTopVolume() const
Definition: TGeoNode.h:282
void SetUserPlugin(TGeoIteratorPlugin *plugin)
Set a plugin.
Definition: TGeoNode.cxx:1196
void Skip()
Stop iterating the current branch.
Definition: TGeoNode.cxx:1158
Int_t * fArray
Definition: TGeoNode.h:252
TString fTopName
Definition: TGeoNode.h:254
The manager class for any TGeo geometry.
Definition: TGeoManager.h:45
TObjArray * GetListOfNodes()
Definition: TGeoManager.h:487
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
Definition: TGeoManager.h:305
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
const Double_t * GetCurrentPoint() const
Definition: TGeoManager.h:521
void SetVisLevel(Int_t level=3)
set default level down to which visualization is performed
TVirtualGeoPainter * GetPainter() const
Definition: TGeoManager.h:213
void SetCheckingOverlaps(Bool_t flag=kTRUE)
Definition: TGeoManager.h:418
void SetCurrentPoint(Double_t *point)
Definition: TGeoManager.h:535
TGeoNode * FindNode(Bool_t safe_start=kTRUE)
Returns deepest node containing current point.
void ModifiedPad() const
Send "Modified" signal to painter.
TObjArray * GetListOfOverlaps()
Definition: TGeoManager.h:489
void MasterToLocal(const Double_t *master, Double_t *local) const
Definition: TGeoManager.h:546
TGeoVolume * GetCurrentVolume() const
Definition: TGeoManager.h:523
void SortOverlaps()
Sort overlaps by decreasing overlap distance. Extrusions comes first.
Geometrical transformation package.
Definition: TGeoMatrix.h:41
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
Definition: TGeoMatrix.cxx:363
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
Definition: TGeoMatrix.cxx:406
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
Definition: TGeoMatrix.cxx:431
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
Definition: TGeoMatrix.cxx:339
Bool_t IsRotAboutZ() const
Returns true if no rotation or the rotation is about Z axis.
Definition: TGeoMatrix.cxx:269
virtual const Double_t * GetTranslation() const =0
void Print(Option_t *option="") const
print the matrix in 4x4 format
Definition: TGeoMatrix.cxx:486
Class providing navigation API for TGeo geometries.
Definition: TGeoNavigator.h:34
TGeoNodeCache * GetCache() const
TGeoStateInfo * GetInfo()
Get next state info pointer.
Definition: TGeoCache.cxx:319
void ReleaseInfo()
Release last used state info pointer.
Definition: TGeoCache.cxx:336
A node containing local transformation.
Definition: TGeoNode.h:153
virtual Int_t GetOptimalVoxels() const
Returns type of optimal voxelization for this node.
Definition: TGeoNode.cxx:728
void SetMatrix(const TGeoMatrix *matrix)
Matrix setter.
Definition: TGeoNode.cxx:767
virtual ~TGeoNodeMatrix()
Destructor.
Definition: TGeoNode.cxx:709
virtual Int_t GetByteCount() const
return the total size in bytes of this node
Definition: TGeoNode.cxx:716
TGeoNodeMatrix()
Default constructor.
Definition: TGeoNode.cxx:691
TGeoMatrix * fMatrix
Definition: TGeoNode.h:155
virtual TGeoNode * MakeCopyNode() const
Make a copy of this node.
Definition: TGeoNode.cxx:742
Node containing an offset.
Definition: TGeoNode.h:184
virtual TGeoPatternFinder * GetFinder() const
Definition: TGeoNode.h:203
Double_t fOffset
Definition: TGeoNode.h:186
void SetFinder(TGeoPatternFinder *finder)
Definition: TGeoNode.h:206
TGeoPatternFinder * fFinder
Definition: TGeoNode.h:188
virtual TGeoNode * MakeCopyNode() const
Make a copy of this node.
Definition: TGeoNode.cxx:821
Int_t fIndex
Definition: TGeoNode.h:187
virtual ~TGeoNodeOffset()
Destructor.
Definition: TGeoNode.cxx:806
TGeoNodeOffset()
Default constructor.
Definition: TGeoNode.cxx:783
virtual Int_t GetIndex() const
Get the index of this offset.
Definition: TGeoNode.cxx:813
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:41
Bool_t IsOverlapping() const
Definition: TGeoNode.h:105
void SetFWExtension(TGeoExtension *ext)
Connect framework defined extension to the node.
Definition: TGeoNode.cxx:476
Bool_t IsVisDaughters() const
Definition: TGeoNode.h:108
Bool_t IsOnScreen() const
check if this node is drawn. Assumes that this node is current
Definition: TGeoNode.cxx:273
void SaveAttributes(std::ostream &out)
save attributes for this node
Definition: TGeoNode.cxx:404
TGeoVolume * fVolume
Definition: TGeoNode.h:43
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
Execute mouse actions on this volume.
Definition: TGeoNode.cxx:251
virtual void Paint(Option_t *option="")
Paint this node and its content according to visualization settings.
Definition: TGeoNode.cxx:557
void Draw(Option_t *option="")
draw current node according to option
Definition: TGeoNode.cxx:322
void CheckShapes()
check for wrong parameters in shapes
Definition: TGeoNode.cxx:303
void PrintOverlaps() const
print possible overlapping nodes
Definition: TGeoNode.cxx:616
TGeoExtension * fFWExtension
Transient user-defined extension to volumes.
Definition: TGeoNode.h:49
TGeoNode()
Default constructor.
Definition: TGeoNode.cxx:95
TGeoExtension * fUserExtension
Definition: TGeoNode.h:48
virtual TGeoMatrix * GetMatrix() const =0
Int_t * fOverlaps
Definition: TGeoNode.h:47
Int_t fNovlp
Definition: TGeoNode.h:46
void SetOverlapping(Bool_t flag=kTRUE)
Definition: TGeoNode.h:118
TGeoExtension * GrabFWExtension() const
Get a copy of the framework extension pointer.
Definition: TGeoNode.cxx:499
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:653
void PrintCandidates() const
print daughters candidates for containing current point
Definition: TGeoNode.cxx:567
Int_t GetNdaughters() const
Definition: TGeoNode.h:93
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute the closest distance of approach from point px,py to this node
Definition: TGeoNode.cxx:237
TGeoNode * GetDaughter(Int_t ind) const
Definition: TGeoNode.h:85
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:508
Bool_t IsVisible() const
Definition: TGeoNode.h:107
void CopyOverlaps(Int_t *ovlp, Int_t novlp)
Transient framework-defined extension to volumes.
Definition: TGeoNode.cxx:640
void SetMotherVolume(TGeoVolume *mother)
Definition: TGeoNode.h:123
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the node.
Definition: TGeoNode.cxx:461
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a vector from local reference system to mother reference.
Definition: TGeoNode.cxx:542
void DrawOverlaps()
Method drawing the overlap candidates with this node.
Definition: TGeoNode.cxx:335
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:534
Int_t CountDaughters(Bool_t unique_volumes=kFALSE)
Returns the number of daughters.
Definition: TGeoNode.cxx:155
void DrawOnly(Option_t *option="")
draw only this node independently of its vis options
Definition: TGeoNode.cxx:314
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:97
void SetVisibility(Bool_t vis=kTRUE)
Set visibility of the node (obsolete).
Definition: TGeoNode.cxx:663
void SetVirtual()
Definition: TGeoNode.h:119
void SetNumber(Int_t number)
Definition: TGeoNode.h:116
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:518
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Definition: TGeoNode.cxx:488
Int_t FindNode(const TGeoNode *node, Int_t level)
Search for a node within the branch of this one.
Definition: TGeoNode.cxx:377
void VisibleDaughters(Bool_t vis=kTRUE)
Set visibility of the daughters (obsolete).
Definition: TGeoNode.cxx:674
void FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
Fill array with node id. Recursive on node branch.
Definition: TGeoNode.cxx:358
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Get node info for the browser.
Definition: TGeoNode.cxx:262
virtual ~TGeoNode()
Destructor.
Definition: TGeoNode.cxx:129
Int_t fNumber
Definition: TGeoNode.h:45
virtual void MasterToLocalVect(const Double_t *master, Double_t *local) const
Convert a vector from mother reference to local reference system.
Definition: TGeoNode.cxx:526
virtual void ls(Option_t *option="") const
Print the path (A/B/C/...) to this node on stdout.
Definition: TGeoNode.cxx:550
Bool_t IsVirtual() const
Definition: TGeoNode.h:106
@ kGeoNodeOffset
Definition: TGeoNode.h:60
void SetCloned(Bool_t flag=kTRUE)
Definition: TGeoNode.h:117
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="")
Check overlaps bigger than OVLP hierarchically, starting with this node.
Definition: TGeoNode.cxx:179
void Browse(TBrowser *b)
How-to-browse for a node.
Definition: TGeoNode.cxx:139
void InspectNode() const
Inspect this node.
Definition: TGeoNode.cxx:282
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:630
TGeoVolume * fMother
Definition: TGeoNode.h:44
Base finder class for patterns.
virtual TGeoNode * FindNode(Double_t *, const Double_t *=0)
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:49
TGeoShape * GetShape() const
Definition: TGeoVolume.h:188
virtual void Print(Option_t *option="") const
Print volume info.
TGeoManager * GetGeoManager() const
Definition: TGeoVolume.h:171
TGeoPatternFinder * GetFinder() const
Definition: TGeoVolume.h:175
Bool_t IsSelected() const
Definition: TGeoVolume.h:148
Bool_t Contains(const Double_t *point) const
Definition: TGeoVolume.h:109
Int_t GetNdaughters() const
Definition: TGeoVolume.h:349
void SelectVolume(Bool_t clear=kFALSE)
Select this volume as matching an arbitrary criteria.
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
virtual void SetVisibility(Bool_t vis=kTRUE)
set visibility of this volume
void CheckShapes()
check for negative parameters in shapes.
Definition: TGeoVolume.cxx:648
TGeoVoxelFinder * GetVoxels() const
Getter for optimization structure.
virtual void Draw(Option_t *option="")
draw top volume according to option
TObjArray * GetNodes()
Definition: TGeoVolume.h:167
void SetAdded()
Definition: TGeoVolume.h:210
void SetReplicated()
Definition: TGeoVolume.h:211
virtual void DrawOnly(Option_t *option="")
draw only this volume
virtual Bool_t IsVisible() const
Definition: TGeoVolume.h:153
Bool_t IsAdded() const
Definition: TGeoVolume.h:145
void CheckOverlaps(Double_t ovlp=0.1, Option_t *option="") const
Overlap checking tool.
Definition: TGeoVolume.cxx:589
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()
Definition: TCollection.h:252
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual const char * GetTitle() const
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:37
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
Definition: TObjArray.cxx:254
TObject * At(Int_t idx) const
Definition: TObjArray.h:166
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition: TObject.cxx:867
Stopwatch class.
Definition: TStopwatch.h:28
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Definition: TStopwatch.cxx:58
Basic string class.
Definition: TString.h:136
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1150
const char * Data() const
Definition: TString.h:369
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:2336
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:624
Abstract class for geometry painters.
virtual const char * GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const =0
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 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
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
static const std::string name("name")
constexpr Double_t E()
Base of natural log:
Definition: TMath.h:96
Short_t Abs(Short_t d)
Definition: TMathBase.h:120
Statefull info for the current geometry level.
Definition: TGeoStateInfo.h:21