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 // Make sure this manager has a navigator for the current worker.
327 if (!geom->GetCurrentNavigator())
328 geom->AddNavigator();
329
330 std::vector<TGeoOverlapResult> local;
331 local.reserve(32);
332
333 for (size_t i = range.first; i < range.second; ++i) {
335 if (checker->ComputeOverlap(candidates[i], r))
336 local.emplace_back(std::move(r));
337 }
338
339 if (!local.empty()) {
340 std::lock_guard<std::mutex> lock(resultsMutex);
341 results.insert(results.end(), std::make_move_iterator(local.begin()), std::make_move_iterator(local.end()));
342 }
343 },
344 chunks);
345#else
346 // serial version
347 Info("CheckOverlaps", "--- checking candidates with on a single thread (IMT not configured)...");
348 timer.Start();
349 for (size_t i = 0; i < candidates.size(); ++i) {
351 if (checker->ComputeOverlap(candidates[i], r))
352 results.emplace_back(std::move(r));
353 }
354#endif
355
356 // -------- Stage 3: materialize overlaps (main thread)
357 for (const auto &r : results)
358 checker->MaterializeOverlap(r);
359
360 geom->SetCheckingOverlaps(kFALSE);
361 geom->SortOverlaps();
362
363 // Rename overlaps as before
364 TObjArray *overlaps = geom->GetListOfOverlaps();
365 const Int_t novlps = overlaps->GetEntriesFast();
366 for (Int_t i = 0; i < novlps; i++)
367 ((TNamed *)overlaps->At(i))->SetName(TString::Format("ov%05d", i));
368 timer.Stop();
369 Info("CheckOverlaps", "Number of illegal overlaps/extrusions : %d found in %g [sec]", novlps, timer.RealTime());
370}
371
372////////////////////////////////////////////////////////////////////////////////
373/// compute the closest distance of approach from point px,py to this node
374
376{
377 Int_t dist = 9999;
378 if (!fVolume)
379 return dist;
383 if (!painter)
384 return dist;
385 dist = painter->DistanceToPrimitiveVol(fVolume, px, py);
386 return dist;
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Execute mouse actions on this volume.
391
393{
394 if (!fVolume)
395 return;
397 if (!painter)
398 return;
399 painter->ExecuteVolumeEvent(fVolume, event, px, py);
400}
401
402////////////////////////////////////////////////////////////////////////////////
403/// Get node info for the browser.
404
406{
407 if (!fVolume)
408 return nullptr;
410 if (!painter)
411 return nullptr;
412 return (char *)painter->GetVolumeInfo(fVolume, px, py);
413}
414
415////////////////////////////////////////////////////////////////////////////////
416/// check if this node is drawn. Assumes that this node is current
417
419{
421 return kTRUE;
422 return kFALSE;
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Inspect this node.
427
429{
430 printf("== Inspecting node %s ", GetName());
431 if (fMother)
432 printf("mother volume %s. ", fMother->GetName());
433 if (IsOverlapping())
434 printf("(Node is MANY)\n");
435 else
436 printf("\n");
437 if (fOverlaps && fMother) {
438 printf(" possibly overlapping with : ");
439 for (Int_t i = 0; i < fNovlp; i++)
440 printf(" %s ", fMother->GetNode(fOverlaps[i])->GetName());
441 printf("\n");
442 }
443 printf("Transformation matrix:\n");
445 if (GetMatrix())
446 matrix->Print();
447 fVolume->Print();
448}
449
450////////////////////////////////////////////////////////////////////////////////
451/// check for wrong parameters in shapes
452
454{
456 Int_t nd = GetNdaughters();
457 if (!nd)
458 return;
459 for (Int_t i = 0; i < nd; i++)
461}
462
463////////////////////////////////////////////////////////////////////////////////
464/// draw only this node independently of its vis options
465
470
471////////////////////////////////////////////////////////////////////////////////
472/// draw current node according to option
473
483
484////////////////////////////////////////////////////////////////////////////////
485/// Method drawing the overlap candidates with this node.
486
488{
489 if (!fNovlp) {
490 printf("node %s is ONLY\n", GetName());
491 return;
492 }
493 if (!fOverlaps) {
494 printf("node %s no overlaps\n", GetName());
495 return;
496 }
497 TGeoNode *node;
498 Int_t i;
500 for (i = 0; i < nd; i++) {
501 node = fMother->GetNode(i);
503 }
505 for (i = 0; i < fNovlp; i++) {
506 node = fMother->GetNode(fOverlaps[i]);
507 node->GetVolume()->SetVisibility(kTRUE);
508 }
510 fMother->Draw();
511}
512
513////////////////////////////////////////////////////////////////////////////////
514/// Fill array with node id. Recursive on node branch.
515
516void TGeoNode::FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
517{
518 Int_t nd = GetNdaughters();
519 if (!nd)
520 return;
522 Int_t istart = ifree; // start index for daughters
523 ifree += nd;
524 for (Int_t id = 0; id < nd; id++) {
525 daughter = GetDaughter(id);
526 array[istart + id] = ifree;
527 array[ifree++] = ++nodeid;
528 daughter->FillIdArray(ifree, nodeid, array);
529 }
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Search for a node within the branch of this one.
534
536{
537 Int_t nd = GetNdaughters();
538 if (!nd)
539 return -1;
540 TIter next(fVolume->GetNodes());
542 while ((daughter = (TGeoNode *)next())) {
543 if (daughter == node) {
545 return (level + 1);
546 }
547 }
548 next.Reset();
550 while ((daughter = (TGeoNode *)next())) {
551 new_level = daughter->FindNode(node, level + 1);
552 if (new_level >= 0) {
554 return new_level;
555 }
556 }
557 return -1;
558}
559
560////////////////////////////////////////////////////////////////////////////////
561/// save attributes for this node
562
563void TGeoNode::SaveAttributes(std::ostream &out)
564{
565 if (IsVisStreamed())
566 return;
568 char quote = '"';
570 if ((fVolume->IsVisTouched()) && (!fVolume->IsVisStreamed())) {
572 out << " vol = gGeoManager->GetVolume(" << quote << fVolume->GetName() << quote << ");" << std::endl;
573 voldef = kTRUE;
574 if (!fVolume->IsVisDaughters())
575 out << " vol->SetVisDaughters(kFALSE);" << std::endl;
576 if (fVolume->IsVisible()) {
577 /*
578 if (fVolume->GetLineColor() != gStyle->GetLineColor())
579 out<<" vol->SetLineColor("<<fVolume->GetLineColor()<<");"<<std::endl;
580 if (fVolume->GetLineStyle() != gStyle->GetLineStyle())
581 out<<" vol->SetLineStyle("<<fVolume->GetLineStyle()<<");"<<std::endl;
582 if (fVolume->GetLineWidth() != gStyle->GetLineWidth())
583 out<<" vol->SetLineWidth("<<fVolume->GetLineWidth()<<");"<<std::endl;
584 */
585 } else {
586 out << " vol->SetVisibility(kFALSE);" << std::endl;
587 }
588 }
589 if (!IsVisDaughters())
590 return;
591 Int_t nd = GetNdaughters();
592 if (!nd)
593 return;
594 TGeoNode *node;
595 for (Int_t i = 0; i < nd; i++) {
596 node = GetDaughter(i);
597 if (node->IsVisStreamed())
598 continue;
599 if (node->IsVisTouched()) {
600 if (!voldef)
601 out << " vol = gGeoManager->GetVolume(" << quote << fVolume->GetName() << quote << ");" << std::endl;
602 out << " node = vol->GetNode(" << i << ");" << std::endl;
603 if (!node->IsVisDaughters()) {
604 out << " node->VisibleDaughters(kFALSE);" << std::endl;
605 node->SetVisStreamed(kTRUE);
606 continue;
607 }
608 if (!node->IsVisible())
609 out << " node->SetVisibility(kFALSE);" << std::endl;
610 }
611 node->SaveAttributes(out);
612 node->SetVisStreamed(kTRUE);
613 }
614}
615
616////////////////////////////////////////////////////////////////////////////////
617/// Connect user-defined extension to the node. The node "grabs" a copy, so
618/// the original object can be released by the producer. Release the previously
619/// connected extension if any.
620///
621/// NOTE: This interface is intended for user extensions and is guaranteed not
622/// to be used by TGeo
623
625{
627 fUserExtension = nullptr;
628 if (ext)
629 fUserExtension = ext->Grab();
630 if (tmp)
631 tmp->Release();
632}
633
634////////////////////////////////////////////////////////////////////////////////
635/// Connect framework defined extension to the node. The node "grabs" a copy,
636/// so the original object can be released by the producer. Release the previously
637/// connected extension if any.
638///
639/// NOTE: This interface is intended for the use by TGeo and the users should
640/// NOT connect extensions using this method
641
643{
645 fFWExtension = nullptr;
646 if (ext)
647 fFWExtension = ext->Grab();
648 if (tmp)
649 tmp->Release();
650}
651
652////////////////////////////////////////////////////////////////////////////////
653/// Get a copy of the user extension pointer. The user must call Release() on
654/// the copy pointer once this pointer is not needed anymore (equivalent to
655/// delete() after calling new())
656
658{
659 if (fUserExtension)
660 return fUserExtension->Grab();
661 return nullptr;
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Get a copy of the framework extension pointer. The user must call Release() on
666/// the copy pointer once this pointer is not needed anymore (equivalent to
667/// delete() after calling new())
668
670{
671 if (fFWExtension)
672 return fFWExtension->Grab();
673 return nullptr;
674}
675////////////////////////////////////////////////////////////////////////////////
676/// Check the overlab between the bounding box of the node overlaps with the one
677/// the brother with index IOTHER.
678
680{
681 if (!fOverlaps)
682 return kFALSE;
683 for (Int_t i = 0; i < fNovlp; i++)
684 if (fOverlaps[i] == iother)
685 return kTRUE;
686 return kFALSE;
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Convert the point coordinates from mother reference to local reference system
691
693{
694 GetMatrix()->MasterToLocal(master, local);
695}
696
697////////////////////////////////////////////////////////////////////////////////
698/// Convert a vector from mother reference to local reference system
699
701{
702 GetMatrix()->MasterToLocalVect(master, local);
703}
704
705////////////////////////////////////////////////////////////////////////////////
706/// Convert the point coordinates from local reference system to mother reference
707
709{
710 GetMatrix()->LocalToMaster(local, master);
711}
712
713////////////////////////////////////////////////////////////////////////////////
714/// Convert a vector from local reference system to mother reference
715
717{
718 GetMatrix()->LocalToMasterVect(local, master);
719}
720
721////////////////////////////////////////////////////////////////////////////////
722/// Print the path (A/B/C/...) to this node on stdout
723
724void TGeoNode::ls(Option_t * /*option*/) const {}
725
726////////////////////////////////////////////////////////////////////////////////
727/// Paint this node and its content according to visualization settings.
728
730{
732 if (!painter)
733 return;
734 painter->PaintNode(this, option);
735}
736
737////////////////////////////////////////////////////////////////////////////////
738/// print daughters candidates for containing current point
739
741{
742 Double_t point[3];
744 printf(" Local : %g, %g, %g\n", point[0], point[1], point[2]);
745 if (!fVolume->Contains(&point[0])) {
746 printf("current point not inside this\n");
747 return;
748 }
750 TGeoNode *node;
751 if (finder) {
752 printf("current node divided\n");
753 node = finder->FindNode(&point[0]);
754 if (!node) {
755 printf("point not inside division element\n");
756 return;
757 }
758 printf("inside division element %s\n", node->GetName());
759 return;
760 }
762 if (!voxels) {
763 printf("volume not voxelized\n");
764 return;
765 }
766 Int_t ncheck = 0;
768 TGeoStateInfo &info = *nav->GetCache()->GetInfo();
769 Int_t *check_list = voxels->GetCheckList(&point[0], ncheck, info);
770 nav->GetCache()->ReleaseInfo();
771 voxels->PrintVoxelLimits(&point[0]);
772 if (!check_list) {
773 printf("no candidates for current point\n");
774 return;
775 }
776 TString overlap = "ONLY";
777 for (Int_t id = 0; id < ncheck; id++) {
778 node = fVolume->GetNode(check_list[id]);
779 if (node->IsOverlapping())
780 overlap = "MANY";
781 else
782 overlap = "ONLY";
783 printf("%i %s %s\n", check_list[id], node->GetName(), overlap.Data());
784 }
786}
787
788////////////////////////////////////////////////////////////////////////////////
789/// print possible overlapping nodes
790
792{
793 if (!fOverlaps) {
794 printf("node %s no overlaps\n", GetName());
795 return;
796 }
797 printf("Overlaps for node %s :\n", GetName());
798 TGeoNode *node;
799 for (Int_t i = 0; i < fNovlp; i++) {
800 node = fMother->GetNode(fOverlaps[i]);
801 printf(" %s\n", node->GetName());
802 }
803}
804
805////////////////////////////////////////////////////////////////////////////////
806/// computes the closest distance from given point to this shape
807
809{
810 Double_t local[3];
811 GetMatrix()->MasterToLocal(point, local);
812 return fVolume->GetShape()->Safety(local, in);
813}
814
815////////////////////////////////////////////////////////////////////////////////
816/// Copy content of lst of overlaps from source array
817
819{
820 Int_t *ovlps = nullptr;
821 if (src && (novlp > 0)) {
822 ovlps = new Int_t[novlp];
823 memcpy(ovlps, src, novlp * sizeof(Int_t));
824 }
826}
827
828////////////////////////////////////////////////////////////////////////////////
829/// set the list of overlaps for this node (ovlp must be created with operator new)
830
832{
833 if (fOverlaps)
834 delete[] fOverlaps;
835 fOverlaps = ovlp;
836 fNovlp = novlp;
837}
838
839////////////////////////////////////////////////////////////////////////////////
840/// Set visibility of the node (obsolete).
841
843{
844 if (gGeoManager->IsClosed())
847 if (vis && !fVolume->IsVisible())
850}
851
852////////////////////////////////////////////////////////////////////////////////
853/// Set visibility of the daughters (obsolete).
854
862
863/** \class TGeoNodeMatrix
864\ingroup Geometry_classes
865A node containing local transformation.
866*/
867
868////////////////////////////////////////////////////////////////////////////////
869/// Default constructor
870
872{
873 fMatrix = nullptr;
874}
875
876////////////////////////////////////////////////////////////////////////////////
877/// Constructor.
878
885
886////////////////////////////////////////////////////////////////////////////////
887/// Destructor
888
890
891////////////////////////////////////////////////////////////////////////////////
892/// return the total size in bytes of this node
893
895{
896 Int_t count = 40 + 4; // TGeoNode + fMatrix
897 // if (fMatrix) count += fMatrix->GetByteCount();
898 return count;
899}
900
901////////////////////////////////////////////////////////////////////////////////
902/// Returns type of optimal voxelization for this node.
903/// - type = 0 -> cartesian
904/// - type = 1 -> cylindrical
905
907{
909 if (!type)
910 return 0;
911 if (!fMatrix->IsRotAboutZ())
912 return 0;
914 if (TMath::Abs(transl[0]) > 1E-10)
915 return 0;
916 if (TMath::Abs(transl[1]) > 1E-10)
917 return 0;
918 return 1;
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// Make a copy of this node.
923
925{
927 node->SetName(GetName());
928 node->SetTitle(GetTitle());
929 // set the mother
931 // set the copy number
932 node->SetNumber(fNumber);
933 // copy overlaps
935
936 // copy VC
937 if (IsVirtual())
938 node->SetVirtual();
939 if (IsOverlapping())
940 node->SetOverlapping(); // <--- ADDED
941 // Copy extensions
944 node->SetCloned();
945 return node;
946}
947
948////////////////////////////////////////////////////////////////////////////////
949/// Matrix setter.
950
957
958/** \class TGeoNodeOffset
959\ingroup Geometry_classes
960Node containing an offset.
961*/
962
963////////////////////////////////////////////////////////////////////////////////
964/// Default constructor
965
967{
969 fOffset = 0;
970 fIndex = 0;
971 fFinder = nullptr;
972}
973
974////////////////////////////////////////////////////////////////////////////////
975/// Constructor. Null pointer to matrix means identity transformation
976
984
985////////////////////////////////////////////////////////////////////////////////
986/// Destructor
987
989
990////////////////////////////////////////////////////////////////////////////////
991/// Get the index of this offset.
992
994{
995 return (fIndex + fFinder->GetDivIndex());
996}
997
998////////////////////////////////////////////////////////////////////////////////
999/// Make a copy of this node
1000
1002{
1004 node->SetName(GetName());
1005 node->SetTitle(GetTitle());
1006 // set the mother
1007 node->SetMotherVolume(fMother);
1008 // set the copy number
1009 node->SetNumber(fNumber);
1010 if (IsVirtual())
1011 node->SetVirtual();
1012 // set the finder
1013 node->SetFinder(GetFinder());
1014 // set extensions
1017 return node;
1018}
1019
1020/** \class TGeoIterator
1021\ingroup Geometry_classes
1022A geometry iterator.
1023
1024A geometry iterator that sequentially follows all nodes of the geometrical
1025hierarchy of a volume. The iterator has to be initiated with a top volume
1026pointer:
1027
1028~~~ {.cpp}
1029 TGeoIterator next(myVolume);
1030~~~
1031
1032One can use the iterator as any other in ROOT:
1033
1034~~~ {.cpp}
1035 TGeoNode *node;
1036 while ((node=next())) {
1037 ...
1038 }
1039~~~
1040
1041The iterator can perform 2 types of iterations that can be selected via:
1042
1043~~~ {.cpp}
1044 next.SetType(Int_t type);
1045~~~
1046
1047Here TYPE can be:
1048 - 0 (default) - 'first daughter next' behavior
1049 - 1 - iteration at the current level only
1050
1051Supposing the tree structure looks like:
1052
1053~~~ {.cpp}
1054TOP ___ A_1 ___ A1_1 ___ A11_1
1055 | | |___ A12_1
1056 | |_____A2_1 ___ A21_1
1057 | |___ A21_2
1058 |___ B_1 ...
1059~~~
1060
1061The order of iteration for TYPE=0 is: A_1, A1_1, A11_1, A12_1, A2_1, A21_1,
1062A21_2, B_1, ...
1063
1064The order of iteration for TYPE=1 is: A_1, B_1, ...
1065At any moment during iteration, TYPE can be changed. If the last iterated node
1066is for instance A1_1 and the iteration type was 0, one can do:
1067
1068~~~ {.cpp}
1069 next.SetType(1);
1070~~~
1071
1072The next iterated nodes will be the rest of A daughters: A2,A3,... The iterator
1073will return 0 after finishing all daughters of A.
1074
1075During iteration, the following can be retrieved:
1076 - Top volume where iteration started: TGeoIterator::GetTopVolume()
1077 - Node at level I in the current branch: TGeoIterator::GetNode(Int_t i)
1078 - Iteration type: TGeoIterator::GetType()
1079 - Global matrix of the current node with respect to the top volume:
1080 TGeoIterator::GetCurrentMatrix()
1081
1082The iterator can be reset by changing (or not) the top volume:
1083
1084~~~ {.cpp}
1085 TGeoIterator::Reset(TGeoVolume *top);
1086~~~
1087
1088### Example:
1089
1090We want to find out a volume named "MyVol" in the hierarchy of TOP volume.
1091
1092~~~ {.cpp}
1093 TIter next(TOP);
1094 TGeoNode *node;
1095 TString name("MyVol");
1096 while ((node=next()))
1097 if (name == node->GetVolume()->GetName()) return node->GetVolume();
1098~~~
1099*/
1100
1101/** \class TGeoIteratorPlugin
1102\ingroup Geometry_classes
1103*/
1104
1105////////////////////////////////////////////////////////////////////////////////
1106/// Geometry iterator for a branch starting with a TOP node.
1107
1109{
1110 fTop = top;
1111 fLevel = 0;
1113 fMustStop = kFALSE;
1114 fType = 0;
1115 fArray = new Int_t[30];
1116 fMatrix = new TGeoHMatrix();
1117 fTopName = fTop->GetName();
1118 fPlugin = nullptr;
1120}
1121
1122////////////////////////////////////////////////////////////////////////////////
1123/// Copy ctor.
1124
1126{
1127 fTop = iter.GetTopVolume();
1128 fLevel = iter.GetLevel();
1130 fMustStop = kFALSE;
1131 fType = iter.GetType();
1132 fArray = new Int_t[30 + 30 * Int_t(fLevel / 30)];
1133 for (Int_t i = 0; i < fLevel + 1; i++)
1134 fArray[i] = iter.GetIndex(i);
1135 fMatrix = new TGeoHMatrix(*iter.GetCurrentMatrix());
1136 fTopName = fTop->GetName();
1137 fPlugin = iter.fPlugin;
1139 ;
1140}
1141
1142////////////////////////////////////////////////////////////////////////////////
1143/// Destructor.
1144
1146{
1147 if (fArray)
1148 delete[] fArray;
1149 delete fMatrix;
1150}
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// Assignment.
1154
1156{
1157 if (&iter == this)
1158 return *this;
1159 fTop = iter.GetTopVolume();
1160 fLevel = iter.GetLevel();
1162 fMustStop = kFALSE;
1163 fType = iter.GetType();
1164 if (fArray)
1165 delete[] fArray;
1166 fArray = new Int_t[30 + 30 * Int_t(fLevel / 30)];
1167 for (Int_t i = 0; i < fLevel + 1; i++)
1168 fArray[i] = iter.GetIndex(i);
1169 if (!fMatrix)
1170 fMatrix = new TGeoHMatrix();
1171 *fMatrix = *iter.GetCurrentMatrix();
1172 fTopName = fTop->GetName();
1173 fPlugin = iter.fPlugin;
1175 ;
1176 return *this;
1177}
1178
1179////////////////////////////////////////////////////////////////////////////////
1180/// Returns next node.
1181
1183{
1184 if (fMustStop)
1185 return nullptr;
1186 TGeoNode *mother = nullptr;
1187 TGeoNode *next = nullptr;
1188 Int_t i;
1189 Int_t nd = fTop->GetNdaughters();
1190 if (!nd) {
1191 fMustStop = kTRUE;
1192 return nullptr;
1193 }
1194 if (!fLevel) {
1195 fArray[++fLevel] = 0;
1196 next = fTop->GetNode(0);
1197 if (fPlugin && fPluginAutoexec)
1199 return next;
1200 }
1201 next = fTop->GetNode(fArray[1]);
1202 // Move to current node
1203 for (i = 2; i < fLevel + 1; i++) {
1204 mother = next;
1205 next = mother->GetDaughter(fArray[i]);
1206 }
1207 if (fMustResume) {
1209 if (fPlugin && fPluginAutoexec)
1211 return next;
1212 }
1213
1214 switch (fType) {
1215 case 0: // default next daughter behavior
1216 nd = next->GetNdaughters();
1217 if (nd) {
1218 // First daughter next
1219 fLevel++;
1220 if ((fLevel % 30) == 0)
1221 IncreaseArray();
1222 fArray[fLevel] = 0;
1223 if (fPlugin && fPluginAutoexec)
1225 return next->GetDaughter(0);
1226 }
1227 // cd up and pick next
1228 while (next) {
1229 next = GetNode(fLevel - 1);
1230 if (!next) {
1231 nd = fTop->GetNdaughters();
1232 if (fArray[fLevel] < nd - 1) {
1233 fArray[fLevel]++;
1234 if (fPlugin && fPluginAutoexec)
1236 return fTop->GetNode(fArray[fLevel]);
1237 }
1238 fMustStop = kTRUE;
1239 return nullptr;
1240 } else {
1241 nd = next->GetNdaughters();
1242 if (fArray[fLevel] < nd - 1) {
1243 fArray[fLevel]++;
1244 if (fPlugin && fPluginAutoexec)
1246 return next->GetDaughter(fArray[fLevel]);
1247 }
1248 }
1249 fLevel--;
1250 }
1251 break;
1252 case 1: // one level search
1253 if (mother)
1254 nd = mother->GetNdaughters();
1255 if (fArray[fLevel] < nd - 1) {
1256 fArray[fLevel]++;
1257 if (fPlugin && fPluginAutoexec)
1259 if (!mother)
1260 return fTop->GetNode(fArray[fLevel]);
1261 else
1262 return mother->GetDaughter(fArray[fLevel]);
1263 }
1264 }
1265 fMustStop = kTRUE;
1266 return nullptr;
1267}
1268
1269////////////////////////////////////////////////////////////////////////////////
1270/// Returns next node.
1271
1273{
1274 return Next();
1275}
1276
1277////////////////////////////////////////////////////////////////////////////////
1278/// Returns global matrix for current node.
1279
1281{
1282 fMatrix->Clear();
1283 if (!fLevel)
1284 return fMatrix;
1285 TGeoNode *node = fTop->GetNode(fArray[1]);
1286 fMatrix->Multiply(node->GetMatrix());
1287 for (Int_t i = 2; i < fLevel + 1; i++) {
1288 node = node->GetDaughter(fArray[i]);
1289 fMatrix->Multiply(node->GetMatrix());
1290 }
1291 return fMatrix;
1292}
1293
1294////////////////////////////////////////////////////////////////////////////////
1295/// Returns current node at a given level.
1296
1298{
1299 if (!level || level > fLevel)
1300 return nullptr;
1301 TGeoNode *node = fTop->GetNode(fArray[1]);
1302 for (Int_t i = 2; i < level + 1; i++)
1303 node = node->GetDaughter(fArray[i]);
1304 return node;
1305}
1306
1307////////////////////////////////////////////////////////////////////////////////
1308/// Returns the path for the current node.
1309
1311{
1312 path = fTopName;
1313 if (!fLevel)
1314 return;
1315 TGeoNode *node = fTop->GetNode(fArray[1]);
1316 path += "/";
1317 path += node->GetName();
1318 for (Int_t i = 2; i < fLevel + 1; i++) {
1319 node = node->GetDaughter(fArray[i]);
1320 path += "/";
1321 path += node->GetName();
1322 }
1323}
1324
1325////////////////////////////////////////////////////////////////////////////////
1326/// Increase by 30 the size of the array.
1327
1329{
1330 Int_t *array = new Int_t[fLevel + 30];
1331 memcpy(array, fArray, fLevel * sizeof(Int_t));
1332 delete[] fArray;
1333 fArray = array;
1334}
1335
1336////////////////////////////////////////////////////////////////////////////////
1337/// Resets the iterator for volume TOP.
1338
1340{
1341 if (top)
1342 fTop = top;
1343 fLevel = 0;
1345 fMustStop = kFALSE;
1346}
1347
1348////////////////////////////////////////////////////////////////////////////////
1349/// Set the top name for path
1350
1352{
1353 fTopName = name;
1354}
1355
1356////////////////////////////////////////////////////////////////////////////////
1357/// Stop iterating the current branch. The iteration of the next node will
1358/// behave as if the branch starting from the current node (included) is not existing.
1359
1361{
1363 TGeoNode *next = GetNode(fLevel);
1364 if (!next)
1365 return;
1366 Int_t nd;
1367 switch (fType) {
1368 case 0: // default next daughter behavior
1369 // cd up and pick next
1370 while (next) {
1371 next = GetNode(fLevel - 1);
1372 nd = (next == nullptr) ? fTop->GetNdaughters() : next->GetNdaughters();
1373 if (fArray[fLevel] < nd - 1) {
1374 ++fArray[fLevel];
1375 return;
1376 }
1377 fLevel--;
1378 if (!fLevel) {
1379 fMustStop = kTRUE;
1380 return;
1381 }
1382 }
1383 break;
1384 case 1: // one level search
1385 next = GetNode(fLevel - 1);
1386 nd = (next == nullptr) ? fTop->GetNdaughters() : next->GetNdaughters();
1387 if (fArray[fLevel] < nd - 1) {
1388 ++fArray[fLevel];
1389 return;
1390 }
1391 fMustStop = kTRUE;
1392 break;
1393 }
1394}
1395
1396////////////////////////////////////////////////////////////////////////////////
1397/// Set a plugin.
1398
1400{
1401 fPlugin = plugin;
1402 if (plugin)
1403 plugin->SetIterator(this);
1404}
#define b(i)
Definition RSha256.hxx:100
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t 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:148
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:951
TGeoNode * MakeCopyNode() const override
Make a copy of this node.
Definition TGeoNode.cxx:924
Int_t GetByteCount() const override
return the total size in bytes of this node
Definition TGeoNode.cxx:894
TGeoNodeMatrix()
Default constructor.
Definition TGeoNode.cxx:871
TGeoMatrix * fMatrix
Definition TGeoNode.h:157
~TGeoNodeMatrix() override
Destructor.
Definition TGeoNode.cxx:889
Int_t GetOptimalVoxels() const override
Returns type of optimal voxelization for this node.
Definition TGeoNode.cxx:906
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:988
TGeoNodeOffset()
Default constructor.
Definition TGeoNode.cxx:966
Int_t GetIndex() const override
Get the index of this offset.
Definition TGeoNode.cxx:993
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:642
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:418
TGeoVolume * GetVolume() const
Definition TGeoNode.h:100
void SaveAttributes(std::ostream &out)
save attributes for this node
Definition TGeoNode.cxx:563
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:453
void PrintOverlaps() const
print possible overlapping nodes
Definition TGeoNode.cxx:791
TGeoExtension * fFWExtension
! Transient framework-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:375
TGeoNode()
Default constructor.
Definition TGeoNode.cxx:100
TGeoExtension * fUserExtension
! Transient user-defined extension to volumes
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:669
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:831
void PrintCandidates() const
print daughters candidates for containing current point
Definition TGeoNode.cxx:740
void ls(Option_t *option="") const override
Print the path (A/B/C/...) to this node on stdout.
Definition TGeoNode.cxx:724
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:842
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:679
Bool_t IsVisible() const
Definition TGeoNode.h:110
void CopyOverlaps(Int_t *ovlp, Int_t novlp)
Copy content of lst of overlaps from source array.
Definition TGeoNode.cxx:818
void SetMotherVolume(TGeoVolume *mother)
Definition TGeoNode.h:126
void SetUserExtension(TGeoExtension *ext)
Connect user-defined extension to the node.
Definition TGeoNode.cxx:624
virtual void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a vector from local reference system to mother reference.
Definition TGeoNode.cxx:716
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:729
void DrawOverlaps()
Method drawing the overlap candidates with this node.
Definition TGeoNode.cxx:487
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:708
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:466
@ 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:474
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:692
TGeoExtension * GrabUserExtension() const
Get a copy of the user extension pointer.
Definition TGeoNode.cxx:657
Int_t FindNode(const TGeoNode *node, Int_t level)
Search for a node within the branch of this one.
Definition TGeoNode.cxx:535
void VisibleDaughters(Bool_t vis=kTRUE)
Set visibility of the daughters (obsolete).
Definition TGeoNode.cxx:855
void FillIdArray(Int_t &ifree, Int_t &nodeid, Int_t *array) const
Fill array with node id. Recursive on node branch.
Definition TGeoNode.cxx:516
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:700
char * GetObjectInfo(Int_t px, Int_t py) const override
Get node info for the browser.
Definition TGeoNode.cxx:405
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:428
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
Execute mouse actions on this volume.
Definition TGeoNode.cxx:392
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:808
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:886
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Definition TObject.cxx:1070
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:2459
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:643
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:669
UInt_t GetThreadPoolSize()
Returns the size of ROOT's thread pool.
Definition TROOT.cxx:676
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.