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