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