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