Logo ROOT   6.12/07
Reference Guide
TGeoPainter.cxx
Go to the documentation of this file.
1 // @(#)root/geompainter:$Id: 58726ead32989b65bb2cbff2af4235fe9c6b12ae $
2 // Author: Andrei Gheata 05/03/02
3 /*************************************************************************
4  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5  * All rights reserved. *
6  * *
7  * For the licensing terms see $ROOTSYS/LICENSE. *
8  * For the list of contributors see $ROOTSYS/README/CREDITS. *
9  *************************************************************************/
10 
11 /** \class TGeoPainter
12 \ingroup Geometry_classes
13 
14 Class implementing all draw interfaces for a generic 3D viewer
15 using TBuffer3D mechanism.
16 */
17 
18 #include <map>
19 #include "TROOT.h"
20 #include "TClass.h"
21 #include "TColor.h"
22 #include "TPoint.h"
23 #include "TView.h"
24 #include "TAttLine.h"
25 #include "TAttFill.h"
26 #include "TPad.h"
27 #include "TCanvas.h"
28 #include "TH2F.h"
29 #include "TF1.h"
30 #include "TGraph.h"
31 #include "TPluginManager.h"
32 #include "TVirtualPadEditor.h"
33 #include "TStopwatch.h"
34 
35 #include "TPolyMarker3D.h"
36 #include "TVirtualGL.h"
37 
38 #include "TGeoAtt.h"
39 #include "TGeoVolume.h"
40 #include "TGeoNode.h"
41 #include "TGeoManager.h"
42 #include "TGeoTrack.h"
43 #include "TGeoOverlap.h"
44 #include "TGeoChecker.h"
45 #include "TGeoPhysicalNode.h"
46 #include "TGeoPolygon.h"
47 #include "TGeoCompositeShape.h"
48 #include "TGeoShapeAssembly.h"
49 #include "TGeoPainter.h"
50 #include "TMath.h"
51 
52 #include "X3DBuffer.h"
53 
54 #include "TBuffer3D.h"
55 #include "TBuffer3DTypes.h"
56 #include "TVirtualViewer3D.h"
57 
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Default constructor.
62 
64 {
66  if (manager) fGeoManager = manager;
67  else {
68  Error("ctor", "No geometry loaded");
69  return;
70  }
72  fNVisNodes = 0;
73  fBombX = 1.3;
74  fBombY = 1.3;
75  fBombZ = 1.3;
76  fBombR = 1.3;
80  fVisBranch = "";
81  fVolInfo = "";
82  fVisLock = kFALSE;
86  fPlugin = 0;
87  fVisVolumes = new TObjArray();
88  fOverlap = 0;
89  fGlobal = new TGeoHMatrix();
90  fBuffer = new TBuffer3D(TBuffer3DTypes::kGeneric,20,3*20,0,0,0,0);
91  fClippingShape = 0;
92  fLastVolume = 0;
93  fTopVolume = 0;
95  memset(&fCheckedBox[0], 0, 6*sizeof(Double_t));
96 
100  DefineColors();
101 }
102 ////////////////////////////////////////////////////////////////////////////////
103 /// Default destructor.
104 
106 {
107  if (fChecker) delete fChecker;
108  delete fVisVolumes;
109  delete fGlobal;
110  delete fBuffer;
111  if (fPlugin) delete fPlugin;
112 }
113 ////////////////////////////////////////////////////////////////////////////////
114 /// Add numpoints, numsegs, numpolys to the global 3D size.
115 
116 void TGeoPainter::AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys)
117 {
118  gSize3D.numPoints += numpoints;
119  gSize3D.numSegs += numsegs;
120  gSize3D.numPolys += numpolys;
121 }
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Create a primary TGeoTrack.
124 
126 {
127  return (TVirtualGeoTrack*)(new TGeoTrack(id,pdgcode,0,particle));
128 }
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Average center of view of all painted tracklets and compute view box.
132 
134 {
135  static Int_t npoints = 0;
136  static Double_t xmin[3] = {0,0,0};
137  static Double_t xmax[3] = {0,0,0};
138  Int_t i;
139  if (reset) {
140  memset(box, 0, 6*sizeof(Double_t));
141  memset(xmin, 0, 3*sizeof(Double_t));
142  memset(xmax, 0, 3*sizeof(Double_t));
143  npoints = 0;
144  return;
145  }
146  if (npoints==0) {
147  for (i=0; i<3; i++) xmin[i]=xmax[i]=0;
148  npoints++;
149  }
150  npoints++;
151  Double_t ninv = 1./Double_t(npoints);
152  for (i=0; i<3; i++) {
153  box[i] += ninv*(point[i]-box[i]);
154  if (point[i]<xmin[i]) xmin[i]=point[i];
155  if (point[i]>xmax[i]) xmax[i]=point[i];
156  box[i+3] = 0.5*(xmax[i]-xmin[i]);
157  }
158 }
159 
160 ////////////////////////////////////////////////////////////////////////////////
161 /// Get the new 'bombed' translation vector according current exploded view mode.
162 
164 {
165  memcpy(bombtr, tr, 3*sizeof(Double_t));
166  switch (fExplodedView) {
167  case kGeoNoBomb:
168  return;
169  case kGeoBombXYZ:
170  bombtr[0] *= fBombX;
171  bombtr[1] *= fBombY;
172  bombtr[2] *= fBombZ;
173  return;
174  case kGeoBombCyl:
175  bombtr[0] *= fBombR;
176  bombtr[1] *= fBombR;
177  bombtr[2] *= fBombZ;
178  return;
179  case kGeoBombSph:
180  bombtr[0] *= fBombR;
181  bombtr[1] *= fBombR;
182  bombtr[2] *= fBombR;
183  return;
184  default:
185  return;
186  }
187 }
188 
189 ////////////////////////////////////////////////////////////////////////////////
190 /// Check pushes and pulls needed to cross the next boundary with respect to the
191 /// position given by FindNextBoundary. If radius is not mentioned the full bounding
192 /// box will be sampled.
193 
195 {
196  fChecker->CheckBoundaryErrors(ntracks, radius);
197 }
198 
199 ////////////////////////////////////////////////////////////////////////////////
200 /// Check the boundary errors reference file created by CheckBoundaryErrors method.
201 /// The shape for which the crossing failed is drawn with the starting point in red
202 /// and the extrapolated point to boundary (+/- failing push/pull) in yellow.
203 
205 {
207 }
208 
209 ////////////////////////////////////////////////////////////////////////////////
210 /// Geometry checking method (see: TGeoManager::CheckGeometry())
211 
212 void TGeoPainter::CheckGeometryFull(Bool_t checkoverlaps, Bool_t checkcrossings, Int_t ntracks, const Double_t *vertex)
213 {
214  fChecker->CheckGeometryFull(checkoverlaps,checkcrossings,ntracks,vertex);
215 }
216 
217 ////////////////////////////////////////////////////////////////////////////////
218 /// Geometry checking method (see TGeoChecker).
219 
220 void TGeoPainter::CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const
221 {
222  fChecker->CheckGeometry(nrays, startx, starty, startz);
223 }
224 
225 ////////////////////////////////////////////////////////////////////////////////
226 /// Check overlaps for the top volume of the geometry, within a limit OVLP.
227 
228 void TGeoPainter::CheckOverlaps(const TGeoVolume *vol, Double_t ovlp, Option_t *option) const
229 {
230  fChecker->CheckOverlaps(vol, ovlp, option);
231 }
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Check current point in the geometry.
235 
237 {
238  fChecker->CheckPoint(x,y,z,option);
239 }
240 
241 ////////////////////////////////////////////////////////////////////////////////
242 /// Test for shape navigation methods. Summary for test numbers:
243 /// - 1: DistFromInside/Outside. Sample points inside the shape. Generate
244 /// directions randomly in cos(theta). Compute DistFromInside and move the
245 /// point with bigger distance. Compute DistFromOutside back from new point.
246 /// Plot d-(d1+d2)
247 
248 void TGeoPainter::CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
249 {
250  fChecker->CheckShape(shape, testNo, nsamples, option);
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 ///Clear the list of visible volumes
255 ///reset the kVisOnScreen bit for volumes previously in the list
256 
258 {
259  if (!fVisVolumes) return;
260  TIter next(fVisVolumes);
261  TGeoVolume *vol;
262  while ((vol = (TGeoVolume*)next())) {
264  }
265  fVisVolumes->Clear();
266 }
267 
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Define 100 colors with increasing light intensities for each basic color (1-7)
271 /// Register these colors at indexes starting with 1000.
272 
274 {
275  static Int_t color = 0;
276  if (!color) {
278  for (auto icol=1; icol<10; ++icol)
279  color = GetColor(icol, 0.5);
280  }
281 }
282 
283 ////////////////////////////////////////////////////////////////////////////////
284 /// Get index of a base color with given light intensity (0,1)
285 
287 {
288  using IntMap_t = std::map<Int_t, Int_t>;
289  constexpr Int_t ncolors = 100;
290  constexpr Float_t lmin = 0.25;
291  constexpr Float_t lmax = 0.75;
292  static IntMap_t colmap;
293  Int_t color = base;
294  // Search color in the map
295  auto it = colmap.find(base);
296  if (it != colmap.end()) return (it->second + light*(ncolors-1));
297  // Get color pointer if stored
298  TColor* col_base = gROOT->GetColor(base);
299  if (!col_base) {
300  // If color not defined, use gray palette
301  it = colmap.find(kBlack);
302  if (it != colmap.end()) return (it->second + light*(ncolors-1));
303  col_base = gROOT->GetColor(kBlack);
304  color = 1;
305  }
306  // Create a color palette for col_base
307  Float_t r=0., g=0., b=0., h=0., l=0., s=0.;
308  Double_t red[2], green[2], blue[2];
309  Double_t stop[] = {0., 1.0};
310 
311  if (col_base) col_base->GetRGB(r,g,b);
312  TColor::RGB2HLS(r,g,b,h,l,s);
313  TColor::HLS2RGB(h,lmin,s,r,g,b);
314  red[0] = r;
315  green[0] = g;
316  blue[0] = b;
317  TColor::HLS2RGB(h,lmax,s,r,g,b);
318  red[1] = r;
319  green[1] = g;
320  blue[1] = b;
321  Int_t color_map_idx = TColor::CreateGradientColorTable(2, stop, red, green, blue, ncolors);
322  colmap[color] = color_map_idx;
323  return (color_map_idx + light*(ncolors-1));
324 }
325 
326 ////////////////////////////////////////////////////////////////////////////////
327 /// Get currently drawn volume.
328 
330 {
331  if (!gPad) return 0;
332  return fTopVolume;
333 }
334 
335 ////////////////////////////////////////////////////////////////////////////////
336 /// Compute the closest distance of approach from point px,py to a volume.
337 
339 {
340  const Int_t big = 9999;
341  const Int_t inaxis = 7;
342  const Int_t maxdist = 5;
343 
344  if (fTopVolume != volume) fTopVolume = volume;
345  TView *view = gPad->GetView();
346  if (!view) return big;
347  TGeoBBox *box;
348  fGlobal->Clear();
350 
351  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
352  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
353  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
354  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
355  // return if point not in user area
356  if (px < puxmin - inaxis) return big;
357  if (py > puymin + inaxis) return big;
358  if (px > puxmax + inaxis) return big;
359  if (py < puymax - inaxis) return big;
360 
362  gPad->SetSelected(view);
363  Int_t dist = big;
364 // Int_t id;
365 
366  if (fPaintingOverlaps) {
367  TGeoVolume *crt;
368  crt = fOverlap->GetFirstVolume();
370  dist = crt->GetShape()->DistancetoPrimitive(px,py);
371  if (dist<maxdist) {
372  gPad->SetSelected(crt);
373  box = (TGeoBBox*)crt->GetShape();
375  fCheckedBox[3] = box->GetDX();
376  fCheckedBox[4] = box->GetDY();
377  fCheckedBox[5] = box->GetDZ();
378  return 0;
379  }
380  crt = fOverlap->GetSecondVolume();
382  dist = crt->GetShape()->DistancetoPrimitive(px,py);
383  if (dist<maxdist) {
384  gPad->SetSelected(crt);
385  box = (TGeoBBox*)crt->GetShape();
387  fCheckedBox[3] = box->GetDX();
388  fCheckedBox[4] = box->GetDY();
389  fCheckedBox[5] = box->GetDZ();
390  return 0;
391  }
392  return big;
393  }
394  // Compute distance to the right edge
395  if ((puxmax+inaxis-px) < 40) {
396  if ((py-puymax+inaxis) < 40) {
397  // when the mouse points to the (40x40) right corner of the pad, the manager class is selected
398  gPad->SetSelected(fGeoManager);
400  box = (TGeoBBox*)volume->GetShape();
401  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
402  fCheckedBox[3] = box->GetDX();
403  fCheckedBox[4] = box->GetDY();
404  fCheckedBox[5] = box->GetDZ();
405  return 0;
406  }
407  // when the mouse points to the (40 pix) right edge of the pad, the top volume is selected
408  gPad->SetSelected(volume);
409  fVolInfo = volume->GetName();
410  box = (TGeoBBox*)volume->GetShape();
411  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
412  fCheckedBox[3] = box->GetDX();
413  fCheckedBox[4] = box->GetDY();
414  fCheckedBox[5] = box->GetDZ();
415  return 0;
416  }
417 
418  TGeoVolume *vol = volume;
419  Bool_t vis = vol->IsVisible();
420 // Bool_t drawDaughters = kTRUE;
421  // Do we need to check a branch only?
422  if (volume->IsVisBranch()) {
423  if (!fGeoManager->IsClosed()) return big;
426  while (fGeoManager->GetLevel()) {
427  vol = fGeoManager->GetCurrentVolume();
429  dist = vol->GetShape()->DistancetoPrimitive(px,py);
430  if (dist<maxdist) {
432  box = (TGeoBBox*)vol->GetShape();
435  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
436  else gPad->SetSelected(vol);
437  fCheckedBox[3] = box->GetDX();
438  fCheckedBox[4] = box->GetDY();
439  fCheckedBox[5] = box->GetDZ();
440  fGeoManager->PopPath();
441  return 0;
442  }
443  fGeoManager->CdUp();
444  }
445  fGeoManager->PopPath();
446  return dist;
447  }
448 
449  // Do I need to look for the top volume ?
450  if ((fTopVisible && vis) || !vol->GetNdaughters() || !vol->IsVisDaughters() || vol->IsVisOnly()) {
451  dist = vol->GetShape()->DistancetoPrimitive(px,py);
452  if (dist<maxdist) {
453  fVolInfo = vol->GetName();
454  gPad->SetSelected(vol);
455  box = (TGeoBBox*)vol->GetShape();
456  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
457  fCheckedBox[3] = box->GetDX();
458  fCheckedBox[4] = box->GetDY();
459  fCheckedBox[5] = box->GetDZ();
460  return 0;
461  }
462  if (vol->IsVisOnly() || !vol->GetNdaughters() || !vol->IsVisDaughters())
463  return dist;
464  }
465 
466  // Iterate the volume content
467  TGeoIterator next(vol);
468  next.SetTopName(TString::Format("%s_1",vol->GetName()));
469  TGeoNode *daughter;
470 
471  Int_t level, nd;
472  Bool_t last;
473 
474  while ((daughter=next())) {
475  vol = daughter->GetVolume();
476  level = next.GetLevel();
477  nd = daughter->GetNdaughters();
478  vis = daughter->IsVisible();
479  if (volume->IsVisContainers()) {
480  if (vis && level<=fVisLevel) {
481  *fGlobal = next.GetCurrentMatrix();
482  dist = vol->GetShape()->DistancetoPrimitive(px,py);
483  if (dist<maxdist) {
484  next.GetPath(fVolInfo);
485  box = (TGeoBBox*)vol->GetShape();
487  fCheckedNode = daughter;
488  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
489  else gPad->SetSelected(vol);
490  fCheckedBox[3] = box->GetDX();
491  fCheckedBox[4] = box->GetDY();
492  fCheckedBox[5] = box->GetDZ();
493  fGeoManager->PopPath();
494  return 0;
495  }
496  }
497  // Check if we have to skip this branch
498  if (level==fVisLevel || !daughter->IsVisDaughters()) {
499  next.Skip();
500  continue;
501  }
502  } else if (volume->IsVisLeaves()) {
503  last = ((nd==0) || (level==fVisLevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
504  if (vis && last) {
505  *fGlobal = next.GetCurrentMatrix();
506  dist = vol->GetShape()->DistancetoPrimitive(px,py);
507  if (dist<maxdist) {
508  next.GetPath(fVolInfo);
509  box = (TGeoBBox*)vol->GetShape();
511  fCheckedNode = daughter;
512  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
513  else gPad->SetSelected(vol);
514  fCheckedBox[3] = box->GetDX();
515  fCheckedBox[4] = box->GetDY();
516  fCheckedBox[5] = box->GetDZ();
517  fGeoManager->PopPath();
518  return 0;
519  }
520  }
521  // Check if we have to skip the branch
522  if (last || !daughter->IsVisDaughters()) next.Skip();
523  }
524  }
525  return dist;
526 }
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Set default angles for the current view.
530 
532 {
533  if (gPad) {
534  Int_t irep;
535  TView *view = gPad->GetView();
536  if (!view) return;
537  view->SetView(-206,126,75,irep);
538  ModifiedPad();
539  }
540 }
541 
542 ////////////////////////////////////////////////////////////////////////////////
543 /// Set default volume colors according to tracking media
544 
546 {
548  TGeoVolume *vol;
549  while ((vol=(TGeoVolume*)next()))
550  vol->SetLineColor(vol->GetMaterial()->GetDefaultColor());
551  ModifiedPad();
552 }
553 
554 ////////////////////////////////////////////////////////////////////////////////
555 /// Count number of visible nodes down to a given level.
556 
558 {
559  TGeoVolume *vol = volume;
560  Int_t count = 0;
561  Bool_t vis = vol->IsVisible();
562  // Do I need to look for the top volume ?
563  if ((fTopVisible && vis) || !vol->GetNdaughters() || !vol->IsVisDaughters() || vol->IsVisOnly())
564  count++;
565  // Is this the only volume?
566  if (volume->IsVisOnly()) return count;
567 
568  // Do we need to check a branch only?
569  if (volume->IsVisBranch()) {
572  count = fGeoManager->GetLevel() + 1;
573  fGeoManager->PopPath();
574  return count;
575  }
576  // Iterate the volume content
577  TGeoIterator next(vol);
578  TGeoNode *daughter;
579  Int_t level, nd;
580  Bool_t last;
581 
582  while ((daughter=next())) {
583 // vol = daughter->GetVolume();
584  level = next.GetLevel();
585  nd = daughter->GetNdaughters();
586  vis = daughter->IsVisible();
587  if (volume->IsVisContainers()) {
588  if (vis && level<=rlevel) count++;
589  // Check if we have to skip this branch
590  if (level==rlevel || !daughter->IsVisDaughters()) {
591  next.Skip();
592  continue;
593  }
594  } else if (volume->IsVisLeaves()) {
595  last = ((nd==0) || (level==rlevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
596  if (vis && last) count++;
597  // Check if we have to skip the branch
598  if (last) next.Skip();
599  }
600  }
601  return count;
602 }
603 
604 ////////////////////////////////////////////////////////////////////////////////
605 /// Count total number of visible nodes.
606 
608 {
609  Int_t maxnodes = fGeoManager->GetMaxVisNodes();
610  Int_t vislevel = fGeoManager->GetVisLevel();
611 // TGeoVolume *top = fGeoManager->GetTopVolume();
612  TGeoVolume *top = fTopVolume;
613  if (maxnodes <= 0 && top) {
614  fNVisNodes = CountNodes(top, vislevel);
615  SetVisLevel(vislevel);
616  return fNVisNodes;
617  }
618  //if (the total number of nodes of the top volume is less than maxnodes
619  // we can visualize everything.
620  //recompute the best visibility level
621  if (!top) {
622  SetVisLevel(vislevel);
623  return 0;
624  }
625  fNVisNodes = -1;
626  Bool_t again = kFALSE;
627  for (Int_t level = 1;level<20;level++) {
628  vislevel = level;
629  Int_t nnodes = CountNodes(top, level);
630  if (top->IsVisOnly() || top->IsVisBranch()) {
631  vislevel = fVisLevel;
632  fNVisNodes = nnodes;
633  break;
634  }
635  if (nnodes > maxnodes) {
636  vislevel--;
637  break;
638  }
639  if (nnodes == fNVisNodes) {
640  if (again) break;
641  again = kTRUE;
642  }
643  fNVisNodes = nnodes;
644  }
645  SetVisLevel(vislevel);
646  return fNVisNodes;
647 }
648 
649 ////////////////////////////////////////////////////////////////////////////////
650 /// Check if Ged library is loaded and load geometry editor classe.
651 
653 {
654  if (fIsEditable) return;
655  if (!TClass::GetClass("TGedEditor")) return;
656  TPluginHandler *h;
657  if ((h = gROOT->GetPluginManager()->FindHandler("TGeoManagerEditor"))) {
658  if (h->LoadPlugin() == -1) return;
659  h->ExecPlugin(0);
660  }
661  fIsEditable = kTRUE;
662 }
663 
664 ////////////////////////////////////////////////////////////////////////////////
665 /// Start the geometry editor.
666 
668 {
669  if (!gPad) return;
670  if (!fIsEditable) {
671  if (!option[0]) gPad->GetCanvas()->GetCanvasImp()->ShowEditor();
673  CheckEdit();
674  }
675  gPad->SetSelected(fGeoManager);
676  gPad->GetCanvas()->Selected(gPad,fGeoManager,kButton1Down);
677 }
678 
679 ////////////////////////////////////////////////////////////////////////////////
680 /// Draw method.
681 
683 {
684  DrawVolume(fGeoManager->GetTopVolume(), option);
685 }
686 
687 ////////////////////////////////////////////////////////////////////////////////
688 /// Draw the time evolution of a radionuclide.
689 
691 {
692  Int_t ncoeff = sol->GetNcoeff();
693  if (!ncoeff) return;
694  Double_t tlo=0., thi=0.;
695  Double_t cn=0., lambda=0.;
696  Int_t i;
697  sol->GetRange(tlo, thi);
698  Bool_t autorange = (thi==0.)?kTRUE:kFALSE;
699 
700  // Try to find the optimum range in time.
701  if (autorange) tlo = 0.;
702  sol->GetCoeff(0, cn, lambda);
703  Double_t lambdamin = lambda;
704  TString formula = "";
705  for (i=0; i<ncoeff; i++) {
706  sol->GetCoeff(i, cn, lambda);
707  formula += TString::Format("%g*exp(-%g*x)",cn, lambda);
708  if (i < ncoeff-1) formula += "+";
709  if (lambda < lambdamin &&
710  lambda > 0.) lambdamin = lambda;
711  }
712  if (autorange) thi = 10./lambdamin;
713  // Create a function
714  TF1 *func = new TF1(TString::Format("conc%s",sol->GetElement()->GetName()), formula.Data(), tlo,thi);
715  func->SetTitle(formula + ";time[s]" + TString::Format(";Concentration_of_%s",sol->GetElement()->GetName()));
716  func->SetMinimum(1.e-3);
717  func->SetMaximum(1.25*TMath::Max(sol->Concentration(tlo), sol->Concentration(thi)));
718  func->SetLineColor(sol->GetLineColor());
719  func->SetLineStyle(sol->GetLineStyle());
720  func->SetLineWidth(sol->GetLineWidth());
721  func->SetMarkerColor(sol->GetMarkerColor());
722  func->SetMarkerStyle(sol->GetMarkerStyle());
723  func->SetMarkerSize(sol->GetMarkerSize());
724  func->Draw(option);
725 }
726 
727 ////////////////////////////////////////////////////////////////////////////////
728 /// Draw a polygon in 3D.
729 
731 {
732  Int_t nvert = poly->GetNvert();
733  if (!nvert) {
734  Error("DrawPolygon", "No vertices defined");
735  return;
736  }
737  Int_t nconv = poly->GetNconvex();
738  Double_t *x = new Double_t[nvert+1];
739  Double_t *y = new Double_t[nvert+1];
740  poly->GetVertices(x,y);
741  x[nvert] = x[0];
742  y[nvert] = y[0];
743  TGraph *g1 = new TGraph(nvert+1, x,y);
744  g1->SetTitle(Form("Polygon with %d vertices (outscribed %d)",nvert, nconv));
745  g1->SetLineColor(kRed);
746  g1->SetMarkerColor(kRed);
747  g1->SetMarkerStyle(4);
748  g1->SetMarkerSize(0.8);
749  delete [] x;
750  delete [] y;
751  Double_t *xc = 0;
752  Double_t *yc = 0;
753  TGraph *g2 = 0;
754  if (nconv && !poly->IsConvex()) {
755  xc = new Double_t[nconv+1];
756  yc = new Double_t[nconv+1];
757  poly->GetConvexVertices(xc,yc);
758  xc[nconv] = xc[0];
759  yc[nconv] = yc[0];
760  g2 = new TGraph(nconv+1, xc,yc);
761  g2->SetLineColor(kBlue);
762  g2->SetLineColor(kBlue);
763  g2->SetMarkerColor(kBlue);
764  g2->SetMarkerStyle(21);
765  g2->SetMarkerSize(0.4);
766  delete [] xc;
767  delete [] yc;
768  }
769  if (!gPad) {
770  gROOT->MakeDefCanvas();
771  }
772  g1->Draw("ALP");
773  if (g2) g2->Draw("LP");
774 }
775 
776 ////////////////////////////////////////////////////////////////////////////////
777 /// Draw method.
778 
780 {
781  fTopVolume = vol;
782  fLastVolume = 0;
784 // if (fVisOption==kGeoVisOnly ||
785 // fVisOption==kGeoVisBranch) fGeoManager->SetVisOption(kGeoVisLeaves);
787  TString opt = option;
788  opt.ToLower();
790  fOverlap = 0;
791 
792  if (fVisLock) {
794  fVisLock = kFALSE;
795  }
796  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
797  // Clear pad if option "same" not given
798  if (!gPad) {
799  gROOT->MakeDefCanvas();
800  }
801  if (!opt.Contains("same")) gPad->Clear();
802  // append this volume to pad
803  fTopVolume->AppendPad(option);
804 
805  // Create a 3-D view
806  TView *view = gPad->GetView();
807  if (!view) {
808  view = TView::CreateView(11,0,0);
809  // Set the view to perform a first autorange (frame) draw.
810  // TViewer3DPad will revert view to normal painting after this
811  view->SetAutoRange(kTRUE);
812  if (has_pad) gPad->Update();
813  }
814  if (!opt.Contains("same")) Paint("range");
815  else Paint(opt);
816  view->SetAutoRange(kFALSE);
817  // If we are drawing into the pad, then the view needs to be
818  // set to perspective
819 // if (!view->IsPerspective()) view->SetPerspective();
820 
822 
823  // Create a 3D viewer to paint us
824  gPad->GetViewer3D(option);
825 }
826 
827 ////////////////////////////////////////////////////////////////////////////////
828 /// Draw a shape.
829 
831 {
832  TString opt = option;
833  opt.ToLower();
835  fOverlap = 0;
837 
838  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
839  // Clear pad if option "same" not given
840  if (!gPad) {
841  gROOT->MakeDefCanvas();
842  }
843  if (!opt.Contains("same")) gPad->Clear();
844  // append this shape to pad
845  shape->AppendPad(option);
846 
847  // Create a 3-D view
848  TView *view = gPad->GetView();
849  if (!view) {
850  view = TView::CreateView(11,0,0);
851  // Set the view to perform a first autorange (frame) draw.
852  // TViewer3DPad will revert view to normal painting after this
853  view->SetAutoRange(kTRUE);
854  if (has_pad) gPad->Update();
855  }
856  PaintShape(shape,"range");
857  view->SetAutoRange(kFALSE);
858  view->SetPerspective();
859  // Create a 3D viewer to paint us
860  gPad->GetViewer3D(option);
861 }
862 
863 ////////////////////////////////////////////////////////////////////////////////
864 /// Draw an overlap.
865 
866 void TGeoPainter::DrawOverlap(void *ovlp, Option_t *option)
867 {
868  TString opt = option;
870  TGeoOverlap *overlap = (TGeoOverlap*)ovlp;
871  if (!overlap) return;
872 
874  fOverlap = overlap;
875  opt.ToLower();
876  if (fVisLock) {
878  fVisLock = kFALSE;
879  }
880  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
881  // Clear pad if option "same" not given
882  if (!gPad) {
883  gROOT->MakeDefCanvas();
884  }
885  if (!opt.Contains("same")) gPad->Clear();
886  // append this volume to pad
887  overlap->AppendPad(option);
888 
889  // Create a 3-D view
890  // Create a 3D viewer to paint us
891  gPad->GetViewer3D(option);
892  TView *view = gPad->GetView();
893  if (!view) {
894  view = TView::CreateView(11,0,0);
895  // Set the view to perform a first autorange (frame) draw.
896  // TViewer3DPad will revert view to normal painting after this
897  view->SetAutoRange(kTRUE);
898  PaintOverlap(ovlp, "range");
899  overlap->GetPolyMarker()->Draw("SAME");
900  if (has_pad) gPad->Update();
901  }
902 
903  // If we are drawing into the pad, then the view needs to be
904  // set to perspective
905 // if (!view->IsPerspective()) view->SetPerspective();
906  fVisLock = kTRUE;
907 }
908 
909 
910 ////////////////////////////////////////////////////////////////////////////////
911 /// Draw only one volume.
912 
914 {
915  TString opt = option;
916  opt.ToLower();
917  if (fVisLock) {
919  fVisLock = kFALSE;
920  }
923  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
924  // Clear pad if option "same" not given
925  if (!gPad) {
926  gROOT->MakeDefCanvas();
927  }
928  if (!opt.Contains("same")) gPad->Clear();
929  // append this volume to pad
931  fTopVolume->AppendPad(option);
932 
933  // Create a 3-D view
934  TView *view = gPad->GetView();
935  if (!view) {
936  view = TView::CreateView(11,0,0);
937  // Set the view to perform a first autorange (frame) draw.
938  // TViewer3DPad will revert view to normal painting after this
939  view->SetAutoRange(kTRUE);
941  if (has_pad) gPad->Update();
942  }
943 
944  // If we are drawing into the pad, then the view needs to be
945  // set to perspective
946 // if (!view->IsPerspective()) view->SetPerspective();
947  fVisLock = kTRUE;
948 }
949 
950 ////////////////////////////////////////////////////////////////////////////////
951 /// Draw current point in the same view.
952 
954 {
955  if (!gPad) return;
956  if (!gPad->GetView()) return;
957  TPolyMarker3D *pm = new TPolyMarker3D();
958  pm->SetMarkerColor(color);
959  const Double_t *point = fGeoManager->GetCurrentPoint();
960  pm->SetNextPoint(point[0], point[1], point[2]);
961  pm->SetMarkerStyle(8);
962  pm->SetMarkerSize(0.5);
963  pm->Draw("SAME");
964 }
965 
966 ////////////////////////////////////////////////////////////////////////////////
967 
969 {
970 }
971 
972 ////////////////////////////////////////////////////////////////////////////////
973 /// Draw all volumes for a given path.
974 
975 void TGeoPainter::DrawPath(const char *path, Option_t *option)
976 {
978  fVisBranch=path;
982  DrawVolume(fTopVolume,option);
983 }
984 
985 ////////////////////////////////////////////////////////////////////////////////
986 /// Estimate camera movement between tmin and tmax for best track display
987 
989 {
990  if (!gPad) return;
991  TIter next(gPad->GetListOfPrimitives());
992  TVirtualGeoTrack *track;
993  TObject *obj;
994  Int_t ntracks = 0;
995  Double_t *point = 0;
996  AddTrackPoint(point, start, kTRUE);
997  while ((obj=next())) {
998  if (strcmp(obj->ClassName(), "TGeoTrack")) continue;
999  track = (TVirtualGeoTrack*)obj;
1000  ntracks++;
1001  track->PaintCollect(tmin, start);
1002  }
1003 
1004  if (!ntracks) return;
1005  next.Reset();
1006  AddTrackPoint(point, end, kTRUE);
1007  while ((obj=next())) {
1008  if (strcmp(obj->ClassName(), "TGeoTrack")) continue;
1009  track = (TVirtualGeoTrack*)obj;
1010  if (!track) continue;
1011  track->PaintCollect(tmax, end);
1012  }
1013 }
1014 
1015 ////////////////////////////////////////////////////////////////////////////////
1016 /// Execute mouse actions on a given volume.
1017 
1018 void TGeoPainter::ExecuteManagerEvent(TGeoManager * /*geom*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1019 {
1020  if (!gPad) return;
1021  gPad->SetCursor(kPointer);
1022  switch (event) {
1023  case kButton1Down:
1024  if (!fIsEditable) CheckEdit();
1025  }
1026 }
1027 
1028 ////////////////////////////////////////////////////////////////////////////////
1029 /// Execute mouse actions on a given shape.
1030 
1031 void TGeoPainter::ExecuteShapeEvent(TGeoShape * /*shape*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1032 {
1033  if (!gPad) return;
1034  gPad->SetCursor(kHand);
1035  switch (event) {
1036  case kButton1Down:
1037  if (!fIsEditable) CheckEdit();
1038  }
1039 }
1040 
1041 ////////////////////////////////////////////////////////////////////////////////
1042 /// Execute mouse actions on a given volume.
1043 
1044 void TGeoPainter::ExecuteVolumeEvent(TGeoVolume * /*volume*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1045 {
1046  if (!gPad) return;
1047  if (!fIsEditable) CheckEdit();
1048 // if (fIsRaytracing) return;
1049 // Bool_t istop = (volume==fTopVolume)?kTRUE:kFALSE;
1050 // if (istop) gPad->SetCursor(kHand);
1051 // else gPad->SetCursor(kPointer);
1052  gPad->SetCursor(kHand);
1053 // static Int_t width, color;
1054  switch (event) {
1055  case kMouseEnter:
1056 // width = volume->GetLineWidth();
1057 // color = volume->GetLineColor();
1058  break;
1059 
1060  case kMouseLeave:
1061 // volume->SetLineWidth(width);
1062 // volume->SetLineColor(color);
1063  break;
1064 
1065  case kButton1Down:
1066 // volume->SetLineWidth(3);
1067 // volume->SetLineColor(2);
1068 // gPad->Modified();
1069 // gPad->Update();
1070  break;
1071 
1072  case kButton1Up:
1073 // volume->SetLineWidth(width);
1074 // volume->SetLineColor(color);
1075 // gPad->Modified();
1076 // gPad->Update();
1077  break;
1078 
1079  case kButton1Double:
1080  gPad->SetCursor(kWatch);
1081  GrabFocus();
1082  break;
1083  }
1084 }
1085 
1086 ////////////////////////////////////////////////////////////////////////////////
1087 /// Get some info about the current selected volume.
1088 
1089 const char *TGeoPainter::GetVolumeInfo(const TGeoVolume *volume, Int_t /*px*/, Int_t /*py*/) const
1090 {
1091  static TString info;
1092  info = "";
1093  if (!gPad) return info;
1094  if (fPaintingOverlaps) {
1095  if (!fOverlap) {
1096  info = "wrong overlapping flag";
1097  return info;
1098  }
1099  TString ovtype, name;
1100  if (fOverlap->IsExtrusion()) ovtype="EXTRUSION";
1101  else ovtype = "OVERLAP";
1102  if (volume==fOverlap->GetFirstVolume()) name=volume->GetName();
1103  else name=fOverlap->GetSecondVolume()->GetName();
1104  info = TString::Format("%s: %s of %g", name.Data(), ovtype.Data(), fOverlap->GetOverlap());
1105  return info;
1106  }
1107  else info = TString::Format("%s, shape=%s", fVolInfo.Data(), volume->GetShape()->ClassName());
1108  return info;
1109 }
1110 
1111 ////////////////////////////////////////////////////////////////////////////////
1112 /// Create/return geometry checker.
1113 
1115 {
1117  return fChecker;
1118 }
1119 
1120 ////////////////////////////////////////////////////////////////////////////////
1121 /// Get the current view angles.
1122 
1123 void TGeoPainter::GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi)
1124 {
1125  if (!gPad) return;
1126  TView *view = gPad->GetView();
1127  if (!view) return;
1128  longitude = view->GetLongitude();
1129  latitude = view->GetLatitude();
1130  psi = view->GetPsi();
1131 }
1132 
1133 ////////////////////////////////////////////////////////////////////////////////
1134 /// Move focus to current volume
1135 
1137 {
1138  if (!gPad) return;
1139  TView *view = gPad->GetView();
1140  if (!view) return;
1141  if (!fCheckedNode && !fPaintingOverlaps) {
1142  printf("Woops!!!\n");
1144  memcpy(&fCheckedBox[0], box->GetOrigin(), 3*sizeof(Double_t));
1145  fCheckedBox[3] = box->GetDX();
1146  fCheckedBox[4] = box->GetDY();
1147  fCheckedBox[5] = box->GetDZ();
1148  }
1149  view->SetPerspective();
1150  Int_t nvols = fVisVolumes->GetEntriesFast();
1151  Int_t nframes = nfr;
1152  if (nfr==0) {
1153  nframes = 1;
1154  if (nvols<1500) nframes=10;
1155  if (nvols<1000) nframes=20;
1156  if (nvols<200) nframes = 50;
1157  if (nvols<100) nframes = 100;
1158  }
1159  view->MoveFocus(&fCheckedBox[0], fCheckedBox[3], fCheckedBox[4], fCheckedBox[5], nframes, dlong, dlat, dpsi);
1160 }
1161 
1162 ////////////////////////////////////////////////////////////////////////////////
1163 /// Generate a lego plot fot the top volume, according to option.
1164 
1166  Int_t nphi, Double_t phimin, Double_t phimax,
1167  Double_t rmin, Double_t rmax, Option_t *option)
1168 {
1169  return fChecker->LegoPlot(ntheta, themin, themax, nphi, phimin, phimax, rmin, rmax, option);
1170 }
1171 ////////////////////////////////////////////////////////////////////////////////
1172 /// Convert a local vector according view rotation matrix
1173 
1174 void TGeoPainter::LocalToMasterVect(const Double_t *local, Double_t *master) const
1175 {
1176  for (Int_t i=0; i<3; i++)
1177  master[i] = -local[0]*fMat[i]-local[1]*fMat[i+3]-local[2]*fMat[i+6];
1178 }
1179 
1180 ////////////////////////////////////////////////////////////////////////////////
1181 /// Check if a pad and view are present and send signal "Modified" to pad.
1182 
1184 {
1185  if (!gPad) return;
1186  if (update) {
1187  gPad->Update();
1188  return;
1189  }
1190  TView *view = gPad->GetView();
1191  if (!view) return;
1192  view->SetViewChanged();
1193  gPad->Modified();
1194  if (gROOT->FromPopUp()) gPad->Update();
1195 }
1196 
1197 ////////////////////////////////////////////////////////////////////////////////
1198 /// Paint current geometry according to option.
1199 
1201 {
1202  if (!fGeoManager || !fTopVolume) return;
1203  Bool_t is_padviewer = kTRUE;
1204  if (gPad) is_padviewer = (!strcmp(gPad->GetViewer3D()->ClassName(),"TViewer3DPad"))?kTRUE:kFALSE;
1205 
1209  else if (fTopVolume->IsVisOnly()) fVisOption = kGeoVisOnly;
1211 
1212 
1213  if (!fIsRaytracing || !is_padviewer) {
1214  if (fGeoManager->IsDrawingExtra()) {
1215  // loop the list of physical volumes
1216  fGeoManager->CdTop();
1218  Int_t nnodes = nodeList->GetEntriesFast();
1219  Int_t inode;
1220  TGeoPhysicalNode *node;
1221  for (inode=0; inode<nnodes; inode++) {
1222  node = (TGeoPhysicalNode*)nodeList->UncheckedAt(inode);
1223  PaintPhysicalNode(node, option);
1224  }
1225  } else {
1226  PaintVolume(fTopVolume,option);
1227  }
1228  fVisLock = kTRUE;
1229  }
1230  // Check if we have to raytrace (only in pad)
1231  if (fIsRaytracing && is_padviewer) Raytrace();
1232 }
1233 
1234 ////////////////////////////////////////////////////////////////////////////////
1235 /// Paint an overlap.
1236 
1237 void TGeoPainter::PaintOverlap(void *ovlp, Option_t *option)
1238 {
1239  if (!fGeoManager) return;
1240  TGeoOverlap *overlap = (TGeoOverlap *)ovlp;
1241  if (!overlap) return;
1242  Int_t color, transparency;
1243  if (fOverlap != overlap) fOverlap = overlap;
1245  TGeoHMatrix *hmat = fGlobal;
1246  TGeoVolume *vol;
1247  TGeoVolume *vol1 = overlap->GetFirstVolume();
1248  TGeoVolume *vol2 = overlap->GetSecondVolume();
1249  TGeoHMatrix *matrix1 = overlap->GetFirstMatrix();
1250  TGeoHMatrix *matrix2 = overlap->GetSecondMatrix();
1251  //
1252  vol = vol1;
1253  *hmat = matrix1;
1255  if (!fVisLock) fVisVolumes->Add(vol);
1257  color = vol->GetLineColor();
1258  transparency = vol->GetTransparency();
1259  vol->SetLineColor(kGreen);
1260  vol->SetTransparency(40);
1261  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1262  PaintShape(*(vol->GetShape()),option);
1263  vol->SetLineColor(color);
1264  vol->SetTransparency(transparency);
1265  vol = vol2;
1266  *hmat = matrix2;
1268  if (!fVisLock) fVisVolumes->Add(vol);
1270  color = vol->GetLineColor();
1271  transparency = vol->GetTransparency();
1272  vol->SetLineColor(kBlue);
1273  vol->SetTransparency(40);
1274  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1275  PaintShape(*(vol->GetShape()),option);
1276  vol->SetLineColor(color);
1277  vol->SetTransparency(transparency);
1279  fVisLock = kTRUE;
1280 }
1281 
1282 ////////////////////////////////////////////////////////////////////////////////
1283 /// Paint recursively a node and its content according to visualization options.
1284 
1286 {
1287  PaintVolume(node->GetVolume(), option, global);
1288 }
1289 
1290 ////////////////////////////////////////////////////////////////////////////////
1291 /// Paint recursively a node and its content according to visualization options.
1292 
1294 {
1295  if (fTopVolume != top) {
1297  fVisLock = kFALSE;
1298  }
1299  fTopVolume = top;
1300  if (!fVisLevel) return;
1301  TGeoVolume *vol = top;
1302  if(global)
1303  *fGlobal = *global;
1304  else
1305  fGlobal->Clear();
1307  Bool_t drawDaughters = kTRUE;
1308  Bool_t vis = (top->IsVisible() && !top->IsAssembly());
1309  Int_t transparency = 0;
1310 
1311  // Update pad attributes in case we need to paint VOL
1312  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1313 
1314  // Do we need to draw a branch ?
1315  if (top->IsVisBranch()) {
1316  fGeoManager->PushPath();
1318 // while (fGeoManager->GetLevel()) {
1319  vol = fGeoManager->GetCurrentVolume();
1320  if (!fVisLock) {
1321  fVisVolumes->Add(vol);
1323  }
1325  transparency = vol->GetTransparency();
1326  vol->SetTransparency(40);
1327  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1328  if (global) {
1329  *fGlobal = *global;
1331  } else {
1333  }
1335  PaintShape(*(vol->GetShape()),option);
1336  vol->SetTransparency(transparency);
1337  fGeoManager->CdUp();
1338 // }
1339  fVisLock = kTRUE;
1340  fGeoManager->PopPath();
1342  return;
1343  }
1344 
1345  // Do I need to draw the top volume ?
1346  if ((fTopVisible && vis) || !top->GetNdaughters() || !top->IsVisDaughters() || top->IsVisOnly()) {
1349  PaintShape(*(vol->GetShape()),option);
1350  if (!fVisLock && !vol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1351  fVisVolumes->Add(vol);
1353  }
1354  if (top->IsVisOnly() || !top->GetNdaughters() || !top->IsVisDaughters()) {
1355  fVisLock = kTRUE;
1356  return;
1357  }
1358  }
1359 
1360  // Iterate the volume content
1361  TGeoIterator next(vol);
1362  if (fPlugin) next.SetUserPlugin(fPlugin);
1363  TGeoNode *daughter;
1364 // TGeoMatrix *glmat;
1365  Int_t level, nd;
1366  Bool_t last;
1367  Int_t line_color=0, line_width=0, line_style=0;
1368  while ((daughter=next())) {
1369  vol = daughter->GetVolume();
1371  level = next.GetLevel();
1372  nd = daughter->GetNdaughters();
1373  vis = daughter->IsVisible();
1374  drawDaughters = kTRUE;
1375  if (top->IsVisContainers()) {
1376  if (vis && level<=fVisLevel) {
1377  if (fPlugin) {
1378  line_color = vol->GetLineColor();
1379  line_width = vol->GetLineWidth();
1380  line_style = vol->GetLineStyle();
1381  transparency = vol->GetTransparency();
1382  fPlugin->ProcessNode();
1383  }
1384  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1385  if (global) {
1386  *fGlobal = *global;
1387  *fGlobal *= *next.GetCurrentMatrix();
1388  } else {
1389  *fGlobal = next.GetCurrentMatrix();
1390  }
1392  drawDaughters = PaintShape(*(vol->GetShape()),option);
1393  if (fPlugin) {
1394  vol->SetLineColor(line_color);
1395  vol->SetLineWidth(line_width);
1396  vol->SetLineStyle(line_style);
1397  vol->SetTransparency(transparency);
1398  }
1399  if (!fVisLock && !daughter->IsOnScreen()) {
1400  fVisVolumes->Add(vol);
1402  }
1403  }
1404  // Check if we have to skip this branch
1405  if (!drawDaughters || level==fVisLevel || !daughter->IsVisDaughters()) {
1406  next.Skip();
1407  continue;
1408  }
1409  } else if (top->IsVisLeaves()) {
1410  last = ((nd==0) || (level==fVisLevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
1411  if (vis && last) {
1412  if (fPlugin) {
1413  line_color = vol->GetLineColor();
1414  line_width = vol->GetLineWidth();
1415  line_style = vol->GetLineStyle();
1416  transparency = vol->GetTransparency();
1417  fPlugin->ProcessNode();
1418  }
1419  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1420  if (global) {
1421  *fGlobal = *global;
1422  *fGlobal *= *next.GetCurrentMatrix();
1423  } else {
1424  *fGlobal = next.GetCurrentMatrix();
1425  }
1427  drawDaughters = PaintShape(*(vol->GetShape()),option);
1428  if (fPlugin) {
1429  vol->SetLineColor(line_color);
1430  vol->SetLineWidth(line_width);
1431  vol->SetLineStyle(line_style);
1432  vol->SetTransparency(transparency);
1433  }
1434  if (!fVisLock && !daughter->IsOnScreen()) {
1435  fVisVolumes->Add(vol);
1437  }
1438  }
1439  // Check if we have to skip the branch
1440  if (!drawDaughters || last || !daughter->IsVisDaughters()) next.Skip();
1441  }
1442  }
1443  if (fPlugin) fPlugin->SetIterator(0);
1445  fVisLock = kTRUE;
1446 }
1447 
1448 ////////////////////////////////////////////////////////////////////////////////
1449 /// Paint the supplied shape into the current 3D viewer
1450 
1451 Bool_t TGeoPainter::PaintShape(const TGeoShape & shape, Option_t * option ) const
1452 {
1453  Bool_t addDaughters = kTRUE;
1454 
1455  TVirtualViewer3D * viewer = gPad->GetViewer3D();
1456 
1457  if (!viewer || shape.IsA()==TGeoShapeAssembly::Class()) {
1458  return addDaughters;
1459  }
1460 
1461  // For non-composite shapes we are the main paint method & perform the negotiation
1462  // with the viewer here
1463  if (!shape.IsComposite()) {
1464  // Does viewer prefer local frame positions?
1465  Bool_t localFrame = viewer->PreferLocalFrame();
1466  // Perform first fetch of buffer from the shape and try adding it
1467  // to the viewer
1468  const TBuffer3D & buffer =
1470  Int_t reqSections = viewer->AddObject(buffer, &addDaughters);
1471 
1472  // If the viewer requires additional sections fetch from the shape (if possible)
1473  // and add again
1474  if (reqSections != TBuffer3D::kNone) {
1475  shape.GetBuffer3D(reqSections, localFrame);
1476  viewer->AddObject(buffer, &addDaughters);
1477  }
1478  }
1479  // Composite shapes have their own internal hierarchy of shapes, each
1480  // of which generate a filled TBuffer3D. Therefore we can't pass up a
1481  // single buffer to here. So as a special case the TGeoCompositeShape
1482  // performs it's own painting & negotiation with the viewer.
1483  else {
1484  const TGeoCompositeShape * composite = static_cast<const TGeoCompositeShape *>(&shape);
1485 
1486  // We need the addDaughters flag returned from the viewer from paint
1487  // so can't use the normal TObject::Paint()
1488 // TGeoHMatrix *matrix = (TGeoHMatrix*)TGeoShape::GetTransform();
1489 // if (viewer->PreferLocalFrame()) matrix->Clear();
1490  addDaughters = composite->PaintComposite(option);
1491  }
1492 
1493  return addDaughters;
1494 }
1495 
1496 ////////////////////////////////////////////////////////////////////////////////
1497 /// Paint an overlap.
1498 
1500 {
1502  fGlobal->Clear();
1504  PaintShape(*shape,option);
1505 }
1506 
1507 ////////////////////////////////////////////////////////////////////////////////
1508 /// Paints a physical node associated with a path.
1509 
1511 {
1512  if (!node->IsVisible()) return;
1513  Int_t level = node->GetLevel();
1514  Int_t i, col, wid, sty;
1515  TGeoShape *shape;
1517  TGeoHMatrix *matrix = fGlobal;
1518  TGeoVolume *vcrt;
1519  if (!node->IsVisibleFull()) {
1520  // Paint only last node in the branch
1521  vcrt = node->GetVolume();
1522  if (!strstr(option,"range")) ((TAttLine*)vcrt)->Modify();
1523  shape = vcrt->GetShape();
1524  *matrix = node->GetMatrix();
1526  fGeoManager->SetPaintVolume(vcrt);
1527  if (!node->IsVolAttributes() && !strstr(option,"range")) {
1528  col = vcrt->GetLineColor();
1529  wid = vcrt->GetLineWidth();
1530  sty = vcrt->GetLineStyle();
1531  vcrt->SetLineColor(node->GetLineColor());
1532  vcrt->SetLineWidth(node->GetLineWidth());
1533  vcrt->SetLineStyle(node->GetLineStyle());
1534  ((TAttLine*)vcrt)->Modify();
1535  PaintShape(*shape,option);
1536  vcrt->SetLineColor(col);
1537  vcrt->SetLineWidth(wid);
1538  vcrt->SetLineStyle(sty);
1539  } else {
1540  PaintShape(*shape,option);
1541  }
1542  } else {
1543  // Paint full branch, except top node
1544  for (i=1;i<=level; i++) {
1545  vcrt = node->GetVolume(i);
1546  if (!strstr(option,"range")) ((TAttLine*)vcrt)->Modify();
1547  shape = vcrt->GetShape();
1548  *matrix = node->GetMatrix(i);
1550  fGeoManager->SetPaintVolume(vcrt);
1551  if (!node->IsVolAttributes() && !strstr(option,"range")) {
1552  col = vcrt->GetLineColor();
1553  wid = vcrt->GetLineWidth();
1554  sty = vcrt->GetLineStyle();
1555  vcrt->SetLineColor(node->GetLineColor());
1556  vcrt->SetLineWidth(node->GetLineWidth());
1557  vcrt->SetLineStyle(node->GetLineStyle());
1558  ((TAttLine*)vcrt)->Modify();
1559  PaintShape(*shape,option);
1560  vcrt->SetLineColor(col);
1561  vcrt->SetLineWidth(wid);
1562  vcrt->SetLineStyle(sty);
1563  } else {
1564  PaintShape(*shape,option);
1565  }
1566  }
1567  }
1569 }
1570 
1571 ////////////////////////////////////////////////////////////////////////////////
1572 /// Print overlaps (see TGeoChecker::PrintOverlaps())
1573 
1575 {
1577 }
1578 
1579 ////////////////////////////////////////////////////////////////////////////////
1580 /// Text progress bar.
1581 
1582 void TGeoPainter::OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch, Bool_t last, Bool_t refresh, const char *msg)
1583 {
1584  fChecker->OpProgress(opname,current,size,watch,last,refresh, msg);
1585 }
1586 
1587 ////////////////////////////////////////////////////////////////////////////////
1588 /// Draw random points in the bounding box of a volume.
1589 
1590 void TGeoPainter::RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option)
1591 {
1592  fChecker->RandomPoints((TGeoVolume*)vol, npoints, option);
1593 }
1594 
1595 ////////////////////////////////////////////////////////////////////////////////
1596 /// Shoot nrays in the current drawn geometry
1597 
1598 void TGeoPainter::RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol, Bool_t check_norm)
1599 {
1600  fChecker->RandomRays(nrays, startx, starty, startz, target_vol, check_norm);
1601 }
1602 
1603 ////////////////////////////////////////////////////////////////////////////////
1604 /// Raytrace current drawn geometry
1605 
1607 {
1608  if (!gPad || gPad->IsBatch()) return;
1609  TView *view = gPad->GetView();
1610  if (!view) return;
1611  Int_t rtMode = fGeoManager->GetRTmode();
1614  if (!view->IsPerspective()) view->SetPerspective();
1615  gVirtualX->SetMarkerSize(1);
1616  gVirtualX->SetMarkerStyle(1);
1617  Bool_t inclipst=kFALSE, inclip=kFALSE;
1618  Double_t krad = TMath::DegToRad();
1619  Double_t lat = view->GetLatitude();
1620  Double_t longit = view->GetLongitude();
1621  Double_t psi = view->GetPsi();
1622  Double_t c1 = TMath::Cos(psi*krad);
1623  Double_t s1 = TMath::Sin(psi*krad);
1624  Double_t c2 = TMath::Cos(lat*krad);
1625  Double_t s2 = TMath::Sin(lat*krad);
1626  Double_t s3 = TMath::Cos(longit*krad);
1627  Double_t c3 = -TMath::Sin(longit*krad);
1628  fMat[0] = c1*c3 - s1*c2*s3;
1629  fMat[1] = c1*s3 + s1*c2*c3;
1630  fMat[2] = s1*s2;
1631 
1632  fMat[3] = -s1*c3 - c1*c2*s3;
1633  fMat[4] = -s1*s3 + c1*c2*c3;
1634  fMat[5] = c1*s2;
1635 
1636  fMat[6] = s2*s3;
1637  fMat[7] = -s2*c3;
1638  fMat[8] = c2;
1639  Double_t u0, v0, du, dv;
1640  view->GetWindow(u0,v0,du,dv);
1641  Double_t dview = view->GetDview();
1642  Double_t dproj = view->GetDproj();
1643  Double_t local[3] = {0,0,1};
1644  Double_t dir[3], normal[3];
1645  LocalToMasterVect(local,dir);
1646  Double_t min[3], max[3];
1647  view->GetRange(min, max);
1648  Double_t cov[3];
1649  for (Int_t i=0; i<3; i++) cov[i] = 0.5*(min[i]+max[i]);
1650  Double_t cop[3];
1651  for (Int_t i=0; i<3; i++) cop[i] = cov[i] - dir[i]*dview;
1652  fGeoManager->InitTrack(cop, dir);
1653  Bool_t outside = fGeoManager->IsOutside();
1655  if (fClippingShape) inclipst = inclip = fClippingShape->Contains(cop);
1656  Int_t px, py;
1657  Double_t xloc, yloc, modloc;
1658  Int_t pxmin,pxmax, pymin,pymax;
1659  pxmin = gPad->UtoAbsPixel(0);
1660  pxmax = gPad->UtoAbsPixel(1);
1661  pymin = gPad->VtoAbsPixel(1);
1662  pymax = gPad->VtoAbsPixel(0);
1663  TGeoNode *next = nullptr;
1664  TGeoNode *nextnode = nullptr;
1665  Double_t step,steptot;
1666  Double_t *norm;
1667  const Double_t *point = fGeoManager->GetCurrentPoint();
1668  Double_t *ppoint = (Double_t*)point;
1669  Double_t tosource[3];
1670  Double_t calf;
1671  Double_t phi = 45.*krad;
1672  tosource[0] = -dir[0]*TMath::Cos(phi)+dir[1]*TMath::Sin(phi);
1673  tosource[1] = -dir[0]*TMath::Sin(phi)-dir[1]*TMath::Cos(phi);
1674  tosource[2] = -dir[2];
1675 
1676  Bool_t done;
1677 // Int_t istep;
1678  Int_t base_color, color;
1679  Double_t light;
1680  Double_t stemin=0, stemax=TGeoShape::Big();
1681  TPoint *pxy = new TPoint[1];
1682  TGeoVolume *nextvol;
1683  Int_t up;
1684  Int_t ntotal = pxmax*pymax;
1685  Int_t nrays = 0;
1686  TStopwatch *timer = new TStopwatch();
1687  timer->Start();
1688  for (px=pxmin; px<pxmax; px++) {
1689  for (py=pymin; py<pymax; py++) {
1690  if ((nrays%100)==0) OpProgress("Raytracing",nrays,ntotal,timer,kFALSE);
1691  nrays++;
1692  base_color = 1;
1693  steptot = 0;
1694  inclip = inclipst;
1695  xloc = gPad->AbsPixeltoX(pxmin+pxmax-px);
1696  xloc = xloc*du-u0;
1697  yloc = gPad->AbsPixeltoY(pymin+pymax-py);
1698  yloc = yloc*dv-v0;
1699  modloc = TMath::Sqrt(xloc*xloc+yloc*yloc+dproj*dproj);
1700  local[0] = xloc/modloc;
1701  local[1] = yloc/modloc;
1702  local[2] = dproj/modloc;
1703  LocalToMasterVect(local,dir);
1705  fGeoManager->SetOutside(outside);
1708 // fGeoManager->InitTrack(cop,dir);
1709  // current ray pointing to pixel (px,py)
1710  done = kFALSE;
1711  norm = 0;
1712  // propagate to the clipping shape if any
1713  if (fClippingShape) {
1714  if (inclip) {
1715  stemin = fClippingShape->DistFromInside(cop,dir,3);
1716  stemax = TGeoShape::Big();
1717  } else {
1718  stemax = fClippingShape->DistFromOutside(cop,dir,3);
1719  stemin = 0;
1720  }
1721  }
1722 
1723  while (!done) {
1724  if (fClippingShape) {
1725  if (stemin>1E10) break;
1726  if (stemin>0) {
1727  // we are inside clipping shape
1728  fGeoManager->SetStep(stemin);
1729  next = fGeoManager->Step();
1730  steptot = 0;
1731  stemin = 0;
1732  up = 0;
1733  while (next) {
1734  // we found something after clipping region
1735  nextvol = next->GetVolume();
1736  if (nextvol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1737  done = kTRUE;
1738  base_color = nextvol->GetLineColor();
1739  fClippingShape->ComputeNormal(ppoint, dir, normal);
1740  norm = normal;
1741  break;
1742  }
1743  up++;
1744  next = fGeoManager->GetMother(up);
1745  }
1746  if (done) break;
1747  inclip = fClippingShape->Contains(ppoint);
1748  fGeoManager->SetStep(1E-3);
1749  while (inclip) {
1750  fGeoManager->Step();
1751  inclip = fClippingShape->Contains(ppoint);
1752  }
1753  stemax = fClippingShape->DistFromOutside(ppoint,dir,3);
1754  }
1755  }
1756  nextnode = fGeoManager->FindNextBoundaryAndStep();
1757  step = fGeoManager->GetStep();
1758  if (step>1E10) break;
1759  steptot += step;
1760  next = nextnode;
1761  // Check the step
1762  if (fClippingShape) {
1763  if (steptot>stemax) {
1764  steptot = 0;
1765  inclip = fClippingShape->Contains(ppoint);
1766  if (inclip) {
1767  stemin = fClippingShape->DistFromInside(ppoint,dir,3);
1768  stemax = TGeoShape::Big();
1769  continue;
1770  } else {
1771  stemin = 0;
1772  stemax = fClippingShape->DistFromOutside(ppoint,dir,3);
1773  }
1774  }
1775  }
1776  // Check if next node is visible
1777  if (!nextnode) continue;
1778  nextvol = nextnode->GetVolume();
1779  if (nextvol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1780  done = kTRUE;
1781  base_color = nextvol->GetLineColor();
1782  next = nextnode;
1783  break;
1784  }
1785  }
1786  if (!done) continue;
1787  // current ray intersect a visible volume having color=base_color
1788  if (rtMode > 0) {
1791  for (Int_t i=0; i<3; ++i) local[i] += 1.E-8*dir[i];
1792  step = next->GetVolume()->GetShape()->DistFromInside(local,dir,3);
1793  for (Int_t i=0; i<3; ++i) local[i] += step*dir[i];
1794  next->GetVolume()->GetShape()->ComputeNormal(local, dir, normal);
1795  norm = normal;
1796  } else {
1797  if (!norm) norm = fGeoManager->FindNormalFast();
1798  if (!norm) continue;
1799  }
1800  calf = norm[0]*tosource[0]+norm[1]*tosource[1]+norm[2]*tosource[2];
1801  light = TMath::Abs(calf);
1802  color = GetColor(base_color, light);
1803  // Now we know the color of the pixel, just draw it
1804  gVirtualX->SetMarkerColor(color);
1805  pxy[0].fX = px;
1806  pxy[0].fY = py;
1807  gVirtualX->DrawPolyMarker(1,pxy);
1808  }
1809  }
1810  delete [] pxy;
1811  timer->Stop();
1812  fChecker->OpProgress("Raytracing",nrays,ntotal,timer,kTRUE);
1813  delete timer;
1814 }
1815 
1816 ////////////////////////////////////////////////////////////////////////////////
1817 /// Shoot npoints randomly in a box of 1E-5 around current point.
1818 /// Return minimum distance to points outside.
1819 
1821  const char* g3path)
1822 {
1823  return fChecker->SamplePoints(npoints, dist, epsil, g3path);
1824 }
1825 
1826 ////////////////////////////////////////////////////////////////////////////////
1827 /// Set cartesian and radial bomb factors for translations.
1828 
1830 {
1831  fBombX = bombx;
1832  fBombY = bomby;
1833  fBombZ = bombz;
1834  fBombR = bombr;
1835  if (IsExplodedView()) ModifiedPad();
1836 }
1837 
1838 ////////////////////////////////////////////////////////////////////////////////
1839 /// Set type of exploding view.
1840 
1842 {
1843  if ((ibomb<0) || (ibomb>3)) {
1844  Warning("SetExplodedView", "exploded view can be 0-3");
1845  return;
1846  }
1847  if ((Int_t)ibomb==fExplodedView) return;
1848  Bool_t change = (gPad==0)?kFALSE:kTRUE;
1849 
1850  if (ibomb==kGeoNoBomb) {
1851  change &= ((fExplodedView==kGeoNoBomb)?kFALSE:kTRUE);
1852  }
1853  if (ibomb==kGeoBombXYZ) {
1854  change &= ((fExplodedView==kGeoBombXYZ)?kFALSE:kTRUE);
1855  }
1856  if (ibomb==kGeoBombCyl) {
1857  change &= ((fExplodedView==kGeoBombCyl)?kFALSE:kTRUE);
1858  }
1859  if (ibomb==kGeoBombSph) {
1860  change &= ((fExplodedView==kGeoBombSph)?kFALSE:kTRUE);
1861  }
1862  fExplodedView = ibomb;
1863  if (change) ModifiedPad();
1864 }
1865 
1866 ////////////////////////////////////////////////////////////////////////////////
1867 /// Set number of segments to approximate circles.
1868 
1870 {
1871  if (nseg<3) {
1872  Warning("SetNsegments", "number of segments should be > 2");
1873  return;
1874  }
1875  if (fNsegments==nseg) return;
1876  fNsegments = nseg;
1877  ModifiedPad();
1878 }
1879 
1880 ////////////////////////////////////////////////////////////////////////////////
1881 /// Set number of points to be generated on the shape outline when checking for overlaps.
1882 
1884  fChecker->SetNmeshPoints(npoints);
1885 }
1886 
1887 ////////////////////////////////////////////////////////////////////////////////
1888 /// Select a node to be checked for overlaps. All overlaps not involving it will
1889 /// be ignored.
1890 
1892  fChecker->SetSelectedNode(node);
1893 }
1894 
1895 ////////////////////////////////////////////////////////////////////////////////
1896 /// Set default level down to which visualization is performed
1897 
1899  if (level==fVisLevel && fLastVolume==fTopVolume) return;
1900  fVisLevel=level;
1901  if (!fTopVolume) return;
1902  if (fVisLock) {
1904  fVisLock = kFALSE;
1905  }
1906  if (!fLastVolume) {
1907 // printf("--- Drawing %6d nodes with %d visible levels\n",fNVisNodes,fVisLevel);
1908  return;
1909  }
1910  if (!gPad) return;
1911  if (gPad->GetView()) {
1912 // printf("--- Drawing %6d nodes with %d visible levels\n",fNVisNodes,fVisLevel);
1913  ModifiedPad();
1914  }
1915 }
1916 
1917 ////////////////////////////////////////////////////////////////////////////////
1918 /// Set top geometry volume as visible.
1919 
1921 {
1922  if (fTopVisible==vis) return;
1923  fTopVisible = vis;
1924  ModifiedPad();
1925 }
1926 
1927 ////////////////////////////////////////////////////////////////////////////////
1928 /// Set drawing mode :
1929 /// - option=0 (default) all nodes drawn down to vislevel
1930 /// - option=1 leaves and nodes at vislevel drawn
1931 /// - option=2 path is drawn
1932 
1934  if ((fVisOption<0) || (fVisOption>4)) {
1935  Warning("SetVisOption", "wrong visualization option");
1936  return;
1937  }
1938 
1939  if (option == kGeoVisChanged) {
1940  if (fVisLock) {
1942  fVisLock = kFALSE;
1943  }
1944  ModifiedPad();
1945  return;
1946  }
1947 
1948  if (fTopVolume) {
1949  TGeoAtt *att = (TGeoAtt*)fTopVolume;
1953  switch (option) {
1954  case kGeoVisDefault:
1956  break;
1957  case kGeoVisLeaves:
1958  break;
1959  case kGeoVisOnly:
1961  break;
1962  }
1963  }
1964 
1965  if (fVisOption==option) return;
1966  fVisOption=option;
1967  if (fVisLock) {
1969  fVisLock = kFALSE;
1970  }
1971  ModifiedPad();
1972 }
1973 
1974 ////////////////////////////////////////////////////////////////////////////////
1975 /// Returns distance between point px,py on the pad an a shape.
1976 
1978 {
1979  const Int_t inaxis = 7;
1980  const Int_t maxdist = 5;
1981  const Int_t big = 9999;
1982  Int_t dist = big;
1983  if (!gPad) return dist;
1984  TView *view = gPad->GetView();
1985  if (!(numpoints && view)) return dist;
1986  if (shape->IsA()==TGeoShapeAssembly::Class()) return dist;
1987 
1988  if (fIsPaintingShape) {
1989  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
1990  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
1991  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
1992  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
1993  // return if point not in user area
1994  if (px < puxmin - inaxis) return big;
1995  if (py > puymin + inaxis) return big;
1996  if (px > puxmax + inaxis) return big;
1997  if (py < puymax - inaxis) return big;
1998  if ((puxmax+inaxis-px) < 40) {
1999  // when the mouse points to the (40 pix) right edge of the pad, the manager class is selected
2000  gPad->SetSelected(fGeoManager);
2001  return 0;
2002  }
2003  }
2004 
2005  fBuffer->SetRawSizes(numpoints, 3*numpoints, 0, 0, 0, 0);
2007  shape->SetPoints(points);
2008  Double_t dpoint2, x1, y1, xndc[3];
2009  Double_t dmaster[3];
2010  Int_t j;
2011  for (Int_t i=0; i<numpoints; i++) {
2012  j = 3*i;
2013  TGeoShape::GetTransform()->LocalToMaster(&points[j], dmaster);
2014  points[j]=dmaster[0]; points[j+1]=dmaster[1]; points[j+2]=dmaster[2];
2015  view->WCtoNDC(&points[j], xndc);
2016  x1 = gPad->XtoAbsPixel(xndc[0]);
2017  y1 = gPad->YtoAbsPixel(xndc[1]);
2018  dpoint2 = (px-x1)*(px-x1) + (py-y1)*(py-y1);
2019  if (dpoint2 < dist) dist=(Int_t)dpoint2;
2020  }
2021  if (dist > 100) return dist;
2022  dist = Int_t(TMath::Sqrt(Double_t(dist)));
2023  if (dist<maxdist && fIsPaintingShape) gPad->SetSelected((TObject*)shape);
2024  return dist;
2025 }
2026 
2027 ////////////////////////////////////////////////////////////////////////////////
2028 /// Check time of finding "Where am I" for n points.
2029 
2030 void TGeoPainter::Test(Int_t npoints, Option_t *option)
2031 {
2032  fChecker->Test(npoints, option);
2033 }
2034 
2035 ////////////////////////////////////////////////////////////////////////////////
2036 /// Geometry overlap checker based on sampling.
2037 
2038 void TGeoPainter::TestOverlaps(const char* path)
2039 {
2040  fChecker->TestOverlaps(path);
2041 }
2042 
2043 ////////////////////////////////////////////////////////////////////////////////
2044 /// Check voxels efficiency per volume.
2045 
2047 {
2048  return fChecker->TestVoxels(vol);
2049 }
2050 
2051 ////////////////////////////////////////////////////////////////////////////////
2052 /// Get the new 'unbombed' translation vector according current exploded view mode.
2053 
2055 {
2056  memcpy(bombtr, tr, 3*sizeof(Double_t));
2057  switch (fExplodedView) {
2058  case kGeoNoBomb:
2059  return;
2060  case kGeoBombXYZ:
2061  bombtr[0] /= fBombX;
2062  bombtr[1] /= fBombY;
2063  bombtr[2] /= fBombZ;
2064  return;
2065  case kGeoBombCyl:
2066  bombtr[0] /= fBombR;
2067  bombtr[1] /= fBombR;
2068  bombtr[2] /= fBombZ;
2069  return;
2070  case kGeoBombSph:
2071  bombtr[0] /= fBombR;
2072  bombtr[1] /= fBombR;
2073  bombtr[2] /= fBombR;
2074  return;
2075  default:
2076  return;
2077  }
2078 }
2079 
2080 ////////////////////////////////////////////////////////////////////////////////
2081 /// Compute weight [kg] of the current volume.
2082 
2084 {
2085  return fChecker->Weight(precision, option);
2086 }
2087 
2088 
TGeoOverlap * fOverlap
Definition: TGeoPainter.h:61
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
void TestOverlaps(const char *path)
Geometry overlap checker based on sampling.
double dist(Rotation3D const &r1, Rotation3D const &r2)
Definition: 3DDistances.cxx:48
virtual void Test(Int_t npoints, Option_t *option)
Check time of finding "Where am I" for n points.
Bool_t fIsPaintingShape
Definition: TGeoPainter.h:57
virtual void SetCheckedNode(TGeoNode *node)
Select a node to be checked for overlaps.
virtual TVirtualGeoTrack * AddTrack(Int_t id, Int_t pdgcode, TObject *part)
Create a primary TGeoTrack.
An array of TObjects.
Definition: TObjArray.h:37
void DefineColors() const
Define 100 colors with increasing light intensities for each basic color (1-7) Register these colors ...
virtual Int_t GetColor(Int_t base, Float_t light) const
Get index of a base color with given light intensity (0,1)
TGeoNode * InitTrack(const Double_t *point, const Double_t *dir)
Initialize current point and current direction vector (normalized) in MARS.
float xmin
Definition: THbookFile.cxx:93
void ResetAttBit(UInt_t f)
Definition: TGeoAtt.h:67
TGeoShape * fClippingShape
Definition: TGeoPainter.h:66
virtual void SetBombFactors(Double_t bombx=1.3, Double_t bomby=1.3, Double_t bombz=1.3, Double_t bombr=1.3)
Set cartesian and radial bomb factors for translations.
void DoRestoreState()
Restore a backed-up state without affecting the cache stack.
void GetPath(TString &path) const
Returns the path for the current node.
Definition: TGeoNode.cxx:1183
Bool_t TestAttBit(UInt_t f) const
Definition: TGeoAtt.h:68
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
virtual Bool_t PaintComposite(Option_t *option="") const
Paint this composite shape into the current 3D viewer Returns bool flag indicating if the caller shou...
virtual void Raytrace(Option_t *option="")
Raytrace current drawn geometry.
Box class.
Definition: TGeoBBox.h:17
long long Long64_t
Definition: RtypesCore.h:69
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
Definition: TStopwatch.cxx:58
void SetCurrentDirection(Double_t *dir)
Definition: TGeoManager.h:506
Bool_t IsDrawingExtra() const
Definition: TGeoManager.h:202
void SetUserPlugin(TGeoIteratorPlugin *plugin)
Set a plugin.
Definition: TGeoNode.cxx:1269
virtual void RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option="")
Draw random points in the bounding box of a volume.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
virtual Double_t GetDX() const
Definition: TGeoBBox.h:70
virtual void CheckBoundaryReference(Int_t icheck=-1)
Check the boundary errors reference file created by CheckBoundaryErrors method.
virtual void WCtoNDC(const Float_t *pw, Float_t *pn)=0
virtual void Clear(Option_t *option="")
Remove all objects from the array.
Definition: TObjArray.cxx:320
float Float_t
Definition: RtypesCore.h:53
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)=0
Computes distance from point (px,py) to the object.
virtual void DrawPolygon(const TGeoPolygon *poly)
Draw a polygon in 3D.
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
virtual void Paint(Option_t *option="")
Paint current geometry according to option.
Visualization and tracking attributes for volumes and nodes.
Definition: TGeoAtt.h:17
return c1
Definition: legend1.C:41
Definition: Rtypes.h:59
Int_t fVisLevel
Definition: TGeoPainter.h:50
virtual void ExecuteVolumeEvent(TGeoVolume *volume, Int_t event, Int_t px, Int_t py)
Execute mouse actions on a given volume.
virtual Int_t DistanceToPrimitiveVol(TGeoVolume *vol, Int_t px, Int_t py)
Compute the closest distance of approach from point px,py to a volume.
void CdUp()
Go one level up in geometry.
virtual void ProcessNode()=0
virtual void DrawOverlap(void *ovlp, Option_t *option="")
Draw an overlap.
Bool_t fTopVisible
Definition: TGeoPainter.h:54
virtual Double_t GetLatitude()=0
virtual void DrawPath(const char *path, Option_t *option="")
Draw all volumes for a given path.
TH1 * h
Definition: legend2.C:5
Definition: Rtypes.h:58
virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.)
Check pushes and pulls needed to cross the next boundary with respect to the position given by FindNe...
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
virtual void PaintOverlap(void *ovlp, Option_t *option="")
Paint an overlap.
virtual Int_t ShapeDistancetoPrimitive(const TGeoShape *shape, Int_t numpoints, Int_t px, Int_t py) const
Returns distance between point px,py on the pad an a shape.
virtual void ClearVisibleVolumes()
Clear the list of visible volumes reset the kVisOnScreen bit for volumes previously in the list...
TGeoElementRN * GetElement() const
Definition: TGeoElement.h:310
virtual void AddTrackPoint(Double_t *point, Double_t *box, Bool_t reset=kFALSE)
Average center of view of all painted tracklets and compute view box.
TH2F * LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180., Int_t nphi=90, Double_t phimin=0., Double_t phimax=360., Double_t rmin=0., Double_t rmax=9999999, Option_t *option="")
Generate a lego plot fot the top volume, according to option.
Bool_t IsConvex() const
Definition: TGeoPolygon.h:59
void Skip()
Stop iterating the current branch.
Definition: TGeoNode.cxx:1231
See TView3D.
Definition: TView.h:25
SCoord_t fX
Definition: TPoint.h:35
virtual void SetTopVisible(Bool_t vis=kTRUE)
Set top geometry volume as visible.
Bool_t IsExtrusion() const
Definition: TGeoOverlap.h:78
void SetSelectedNode(TGeoNode *node)
Definition: TGeoChecker.h:88
TGeoHMatrix * fGlobal
Definition: TGeoPainter.h:62
Int_t fVisOption
Definition: TGeoPainter.h:51
#define gROOT
Definition: TROOT.h:402
void SetTopVolume(TGeoVolume *vol)
Set the top volume and corresponding node as starting point of the geometry.
An arbitrary polygon defined by vertices.
Definition: TGeoPolygon.h:19
Int_t LoadPlugin()
Load the plugin library for this handler.
SCoord_t fY
Definition: TPoint.h:36
Int_t GetLevel() const
Basic string class.
Definition: TString.h:125
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:420
void MasterToLocal(const Double_t *master, Double_t *local) const
Definition: TGeoManager.h:514
TGeoVolume * GetFirstVolume() const
Definition: TGeoOverlap.h:73
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1099
int Int_t
Definition: RtypesCore.h:41
Bool_t IsNodeSelectable() const
Definition: TGeoManager.h:203
bool Bool_t
Definition: RtypesCore.h:59
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1222
virtual void DrawPanel()
virtual void SetTitle(const char *title="")
Set graph title.
Definition: TGraph.cxx:2208
void GetConvexVertices(Double_t *x, Double_t *y) const
Fill list of vertices of the convex outscribed polygon into provided arrays.
void GetVertices(Double_t *x, Double_t *y) const
Fill list of vertices into provided arrays.
TGeoPainter(TGeoManager *manager)
Default constructor.
Definition: TGeoPainter.cxx:63
Double_t GetStep() const
Definition: TGeoManager.h:385
Definition: Rtypes.h:59
virtual void DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="")
Draw the time evolution of a radionuclide.
virtual void SetMinimum(Double_t minimum=-1111)
Set the minimum value along Y for this function In case the function is already drawn, set also the minimum in the helper histogram.
Definition: TF1.cxx:3294
virtual void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
Test for shape navigation methods.
virtual void Modify()
Change current line attributes if necessary.
Definition: TAttLine.cxx:232
Int_t GetLevel() const
Definition: TGeoManager.h:495
TGeoVolume * fTopVolume
Definition: TGeoPainter.h:67
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
void GetCoeff(Int_t i, Double_t &cn, Double_t &lambda) const
Definition: TGeoElement.h:308
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
Definition: TColor.h:50
Bool_t IsVisContainers() const
Definition: TGeoVolume.h:158
Short_t Abs(Short_t d)
Definition: TMathBase.h:108
virtual void SetPerspective()=0
virtual void UnbombTranslation(const Double_t *tr, Double_t *bombtr)
Get the new &#39;unbombed&#39; translation vector according current exploded view mode.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
Definition: TGraph.cxx:745
Int_t GetVisLevel() const
Returns current depth to which geometry is drawn.
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:35
TGeoHMatrix * GetFirstMatrix() const
Definition: TGeoOverlap.h:75
virtual void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL)
Geometry checking method (see: TGeoManager::CheckGeometry())
virtual void AddSize3D(Int_t numpoints, Int_t numsegs, Int_t numpolys)
Add numpoints, numsegs, numpolys to the global 3D size.
Bool_t IsRaytracing() const
Check if the painter is currently ray-tracing the content of this volume.
Definition: TGeoVolume.cxx:873
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:105
Double_t fBombX
Definition: TGeoPainter.h:42
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition: TAttMarker.h:32
Int_t PushPath(Int_t startlevel=0)
Definition: TGeoManager.h:542
Int_t GetNdaughters() const
Definition: TGeoVolume.h:350
void MasterToLocalVect(const Double_t *master, Double_t *local) const
Definition: TGeoManager.h:515
void SetVisRaytrace(Bool_t flag=kTRUE)
Definition: TGeoAtt.h:70
void GetRange(Double_t &tmin, Double_t &tmax) const
Definition: TGeoElement.h:309
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:34
virtual Double_t GetPsi()=0
virtual Bool_t Contains(const Double_t *point) const =0
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
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="")
Text progress bar.
void Stop()
Stop the stopwatch.
Definition: TStopwatch.cxx:77
Double_t x[n]
Definition: legend1.C:17
TObjArray * fVisVolumes
Definition: TGeoPainter.h:71
virtual void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="") const
Check overlaps for the top volume of the geometry, within a limit OVLP.
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:2365
Int_t GetLevel() const
Definition: TGeoNode.h:274
void Class()
Definition: Class.C:29
virtual void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="")
Check current point in the geometry.
virtual void PaintNode(TGeoNode *node, Option_t *option="", TGeoMatrix *global=0)
Paint recursively a node and its content according to visualization options.
void CheckOverlaps(const TGeoVolume *vol, Double_t ovlp=0.1, Option_t *option="")
Check illegal overlaps for volume VOL within a limit OVLP.
virtual void DrawVolume(TGeoVolume *vol, Option_t *option="")
Draw method.
void SetCurrentPoint(Double_t *point)
Definition: TGeoManager.h:503
Bool_t fIsEditable
Definition: TGeoPainter.h:72
virtual void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi)
Get the current view angles.
Bool_t IsVisOnly() const
Definition: TGeoVolume.h:160
A geometry iterator.
Definition: TGeoNode.h:243
TGeoNode * fCheckedNode
Definition: TGeoPainter.h:60
TGeoHMatrix * GetMatrix(Int_t level=-1) const
Return global matrix for node at LEVEL.
void SetMatrixReflection(Bool_t flag=kTRUE)
Definition: TGeoManager.h:398
Double_t Concentration(Double_t time) const
Find concentration of the element at a given time.
virtual void SetNmeshPoints(Int_t npoints)
Set number of points to be generated on the shape outline when checking for overlaps.
Int_t CountNodes(TGeoVolume *vol, Int_t level) const
Count number of visible nodes down to a given level.
virtual Bool_t IsExplodedView() const
Definition: TGeoPainter.h:131
Bool_t IsOnScreen() const
check if this node is drawn. Assumes that this node is current
Definition: TGeoNode.cxx:308
Double_t * fPnts
Definition: TBuffer3D.h:112
constexpr Double_t DegToRad()
Definition: TMath.h:64
virtual void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol=0, Bool_t check_norm=kFALSE)
Shoot nrays in the current drawn geometry.
Int_t GetMaxVisNodes() const
Definition: TGeoManager.h:193
virtual Double_t GetDview() const =0
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
const TGeoMatrix * GetCurrentMatrix() const
Returns global matrix for current node.
Definition: TGeoNode.cxx:1156
virtual const char * GetVolumeInfo(const TGeoVolume *volume, Int_t px, Int_t py) const
Get some info about the current selected volume.
void SetTopName(const char *name)
Set the top name for path.
Definition: TGeoNode.cxx:1222
void Test(Int_t npoints, Option_t *option)
Check time of finding "Where am I" for n points.
virtual void DrawCurrentPoint(Int_t color)
Draw current point in the same view.
virtual Bool_t IsVisible() const
Definition: TGeoVolume.h:156
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition: TAttMarker.h:33
void LocalToMaster(const Double_t *local, Double_t *master) const
Definition: TGeoManager.h:511
Abstract 3D shapes viewer.
void RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol=0, Bool_t check_norm=kFALSE)
Randomly shoot nrays from point (startx,starty,startz) and plot intersections with surfaces for curre...
void SetOutside(Bool_t flag=kTRUE)
Definition: TGeoManager.h:409
Int_t GetVisOption() const
Returns current depth to which geometry is drawn.
Base class for user-defined tracks attached to a geometry.
void SetNmeshPoints(Int_t npoints=1000)
Set number of points to be generated on the shape outline when checking for overlaps.
Double_t fCheckedBox[6]
Definition: TGeoPainter.h:46
static void SetTransform(TGeoMatrix *matrix)
Set current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:544
TGeoNode * GetCurrentNode() const
Definition: TGeoManager.h:487
virtual void TestOverlaps(const char *path)
Geometry overlap checker based on sampling.
virtual void SetPoints(Double_t *points) const =0
Class implementing all draw interfaces for a generic 3D viewer using TBuffer3D mechanism.
Definition: TGeoPainter.h:40
virtual void SetView(Double_t longitude, Double_t latitude, Double_t psi, Int_t &irep)=0
virtual void GrabFocus(Int_t nfr=0, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0)
Move focus to current volume.
static void RGB2HLS(Float_t r, Float_t g, Float_t b, Float_t &h, Float_t &l, Float_t &s)
Static method to compute HLS from RGB.
Definition: TColor.cxx:1578
REAL * vertex
Definition: triangle.c:512
Physical nodes are the actual &#39;touchable&#39; objects in the geometry, representing a path of positioned ...
Double_t fBombZ
Definition: TGeoPainter.h:44
Definition: TPoint.h:31
Int_t GetNconvex() const
Definition: TGeoPolygon.h:53
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
point * points
Definition: X3DBuffer.c:20
Int_t GetNvert() const
Definition: TGeoPolygon.h:52
Int_t GetRTmode() const
Definition: TGeoManager.h:437
Class handling Boolean composition of shapes.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
Char_t GetTransparency() const
Definition: TGeoVolume.h:190
Double_t fBombY
Definition: TGeoPainter.h:43
static void HLS2RGB(Float_t h, Float_t l, Float_t s, Float_t &r, Float_t &g, Float_t &b)
Static method to compute RGB from HLS.
Definition: TColor.cxx:1438
virtual Double_t Weight(Double_t precision, Option_t *option="v")
Compute weight [kg] of the current volume.
Int_t GetNsegments() const
Get number of segments approximating circles.
virtual void DrawOnly(Option_t *option="")
Draw only one volume.
Bool_t TestVoxels(TGeoVolume *vol, Int_t npoints=1000000)
Returns optimal voxelization type for volume vol.
Base abstract class for all shapes.
Definition: TGeoShape.h:25
virtual void PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix *global=0)
Paint recursively a node and its content according to visualization options.
ROOT::R::TRInterface & r
Definition: Object.C:4
#define gSize3D
Definition: X3DBuffer.h:40
TGeoChecker * GetChecker()
Create/return geometry checker.
virtual void EditGeometry(Option_t *option="")
Start the geometry editor.
void Clear(Option_t *option="")
clear the data for this matrix
virtual void DefaultColors()
Set default volume colors according to tracking media.
TGeoNode * Step(Bool_t is_geom=kTRUE, Bool_t cross=kTRUE)
Make a rectilinear step of length fStep from current point (fPoint) on current direction (fDirection)...
Bool_t fPaintingOverlaps
Definition: TGeoPainter.h:55
virtual TGeoVolume * GetDrawnVolume() const
Get currently drawn volume.
virtual void ModifiedPad(Bool_t update=kFALSE) const
Check if a pad and view are present and send signal "Modified" to pad.
TGeoNode * FindNextBoundaryAndStep(Double_t stepmax=TGeoShape::Big(), Bool_t compsafe=kFALSE)
Compute distance to next boundary within STEPMAX.
virtual void Draw(Option_t *option="")
Draw method.
Long_t ExecPlugin(int nargs, const T &... params)
virtual TGeoNode * SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path)
Shoot npoints randomly in a box of 1E-5 around current point.
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:249
void SetStep(Double_t step)
Definition: TGeoManager.h:399
virtual void CheckBoundaryErrors(Int_t ntracks=1000000, Double_t radius=-1.)
Check pushes and pulls needed to cross the next boundary with respect to the position given by FindNe...
Double_t * FindNormalFast()
Computes fast normal to next crossed boundary, assuming that the current point is close enough to the...
virtual Double_t GetDproj() const =0
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
void RandomPoints(TGeoVolume *vol, Int_t npoints, Option_t *option)
Draw random points in the bounding box of a volume.
static void ShowEditor()
Show the global pad editor. Static method.
void SetTransparency(Char_t transparency=0)
Definition: TGeoVolume.h:220
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Stub implementation to avoid forcing implementation at this stage.
Definition: TGeoShape.cxx:689
virtual void CheckBoundaryReference(Int_t icheck=-1)
Check the boundary errors reference file created by CheckBoundaryErrors method.
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
TGeoVolume * GetCurrentVolume() const
Definition: TGeoManager.h:491
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
Int_t GetEntriesFast() const
Definition: TObjArray.h:64
Bool_t IsVisDaughters() const
Definition: TGeoNode.h:105
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
char * Form(const char *fmt,...)
TGeoHMatrix * GetCurrentMatrix() const
Definition: TGeoManager.h:484
virtual const Double_t * GetOrigin() const
Definition: TGeoBBox.h:73
const Double_t * GetCurrentDirection() const
Definition: TGeoManager.h:490
virtual void DefaultAngles()
Set default angles for the current view.
Double_t fBombR
Definition: TGeoPainter.h:45
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Definition: TBuffer3D.cxx:359
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
virtual void SetVisLevel(Int_t level=3)
Set default level down to which visualization is performed.
virtual Bool_t TestVoxels(TGeoVolume *vol)
Check voxels efficiency per volume.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
TGeoNode * GetTopNode() const
Definition: TGeoManager.h:501
virtual void SetExplodedView(Int_t iopt=0)
Set type of exploding view.
float xmax
Definition: THbookFile.cxx:93
void SetIterator(const TGeoIterator *iter)
Definition: TGeoNode.h:232
Bool_t PopPath()
Definition: TGeoManager.h:543
TGeoChecker * fChecker
Definition: TGeoPainter.h:65
virtual void EstimateCameraMove(Double_t tmin, Double_t tmax, Double_t *start, Double_t *end)
Estimate camera movement between tmin and tmax for best track display.
virtual Double_t GetDY() const
Definition: TGeoBBox.h:71
virtual void Draw(Option_t *option="")
Draws 3-D polymarker with its current attributes.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const =0
#define gVirtualX
Definition: TVirtualX.h:350
constexpr Double_t E()
Definition: TMath.h:74
virtual Double_t GetLongitude()=0
virtual void LocalToMaster(const Double_t *local, Double_t *master) const
convert a point by multiplying its column vector (x, y, z, 1) to matrix inverse
Definition: TGeoMatrix.cxx:339
Double_t Cos(Double_t)
Definition: TMath.h:550
TBuffer3D * fBuffer
Definition: TGeoPainter.h:63
virtual void SetVisOption(Int_t option=0)
Set drawing mode :
const Bool_t kFALSE
Definition: RtypesCore.h:88
Geometry checking package.
Definition: TGeoChecker.h:37
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:33
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum value along Y for this function In case the function is already drawn, set also the maximum in the helper histogram.
Definition: TF1.cxx:3281
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const =0
Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const
Paint the supplied shape into the current 3D viewer.
virtual void SetTitle(const char *title="")
Set function title if title has the form "fffffff;xxxx;yyyy", it is assumed that the function title i...
Definition: TF1.cxx:3436
virtual Int_t SetNextPoint(Double_t x, Double_t y, Double_t z)
Set point following LastPoint to x, y, z.
virtual Bool_t cd(const char *path="")
Browse the tree of nodes starting from fTopNode according to pathname.
void LocalToMasterVect(const Double_t *local, Double_t *master) const
Convert a local vector according view rotation matrix.
void CheckEdit()
Check if Ged library is loaded and load geometry editor classe.
TString fVolInfo
Definition: TGeoPainter.h:59
TGeoHMatrix * GetSecondMatrix() const
Definition: TGeoOverlap.h:76
virtual void MoveFocus(Double_t *center, Double_t dx, Double_t dy, Double_t dz, Int_t nsteps=10, Double_t dlong=0, Double_t dlat=0, Double_t dpsi=0)=0
Bool_t IsVolAttributes() const
virtual void GetWindow(Double_t &u0, Double_t &v0, Double_t &du, Double_t &dv) const =0
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="")
Print current operation progress.
return c2
Definition: legend2.C:14
virtual Bool_t PreferLocalFrame() const =0
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:89
TGeoVolume * GetSecondVolume() const
Definition: TGeoOverlap.h:74
static const double x1[5]
void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option="")
Paints a physical node associated with a path.
Bool_t IsOutside() const
Definition: TGeoManager.h:405
#define ClassImp(name)
Definition: Rtypes.h:359
virtual void PrintOverlaps() const
Print overlaps (see TGeoChecker::PrintOverlaps())
void DoBackupState()
Backup the current state without affecting the cache stack.
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:559
virtual Int_t CountVisibleNodes()
Count total number of visible nodes.
double Double_t
Definition: RtypesCore.h:55
Int_t GetNcoeff() const
Definition: TGeoElement.h:312
Bool_t IsVisibleFull() const
TGeoVolume * GetVolume(Int_t level=-1) const
Return volume associated with node at LEVEL in the branch.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual ~TGeoPainter()
Default destructor.
void SetPaintVolume(TGeoVolume *vol)
Definition: TGeoManager.h:214
void CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
Test for shape navigation methods.
void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const
Shoot nrays with random directions from starting point (startx, starty, startz) in the reference fram...
void CdTop()
Make top level node the current node.
void CheckPoint(Double_t x=0, Double_t y=0, Double_t z=0, Option_t *option="")
Draw point (x,y,z) over the picture of the daughters of the volume containing this point...
Double_t y[n]
Definition: legend1.C:17
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:570
static constexpr double s
TObjArray * GetListOfPhysicalNodes()
Definition: TGeoManager.h:460
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition: TRolke.cxx:630
The color creation and management class.
Definition: TColor.h:19
TGeoIteratorPlugin * fPlugin
Definition: TGeoPainter.h:70
TH2F * LegoPlot(Int_t ntheta=60, Double_t themin=0., Double_t themax=180., Int_t nphi=90, Double_t phimin=0., Double_t phimax=360., Double_t rmin=0., Double_t rmax=9999999, Option_t *option="")
Generate a lego plot fot the top volume, according to option.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2887
Int_t fExplodedView
Definition: TGeoPainter.h:52
static Double_t Big()
Definition: TGeoShape.h:88
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:42
Bool_t IsReflection() const
Definition: TGeoMatrix.h:69
Bool_t IsVisLeaves() const
Definition: TGeoVolume.h:159
virtual void SetLineColor(Color_t lcolor)
Set the line color.
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
Definition: TView.cxx:39
virtual void ExecuteManagerEvent(TGeoManager *geom, Int_t event, Int_t px, Int_t py)
Execute mouse actions on a given volume.
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:536
TGeoVolume * fLastVolume
Definition: TGeoPainter.h:68
void PrintOverlaps() const
Print the current list of overlaps held by the manager class.
Mother of all ROOT objects.
Definition: TObject.h:37
Double_t Weight(Double_t precision=0.01, Option_t *option="v")
Estimate weight of top level volume with a precision SIGMA(W)/W better than PRECISION.
Base class describing geometry overlaps.
Definition: TGeoOverlap.h:37
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
TGeoNode * SamplePoints(Int_t npoints, Double_t &dist, Double_t epsil, const char *g3path)
shoot npoints randomly in a box of 1E-5 around current point.
void SetAttBit(UInt_t f)
Definition: TGeoAtt.h:65
void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL)
Geometry checking.
Int_t GetBombMode() const
Definition: TGeoManager.h:191
Abstract class for geometry painters.
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:39
static void SetPainter(const TVirtualGeoPainter *painter)
Static function to set an alternative histogram painter.
Class for user-defined tracks attached to a geometry.
Definition: TGeoTrack.h:30
Bool_t IsVisDaughters() const
Definition: TGeoAtt.h:89
A 3D polymarker.
Definition: TPolyMarker3D.h:32
virtual void DrawShape(TGeoShape *shape, Option_t *option="")
Draw a shape.
auto * l
Definition: textangle.C:4
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:200
const Double_t * GetCurrentPoint() const
Definition: TGeoManager.h:489
1-Dim function class
Definition: TF1.h:211
virtual void GetRange(Float_t *min, Float_t *max)=0
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
Double_t Sin(Double_t)
Definition: TMath.h:547
TObjArray * GetListOfVolumes() const
Definition: TGeoManager.h:465
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
virtual void SetViewChanged(Bool_t flag=kTRUE)=0
Int_t GetNdaughters() const
Definition: TGeoNode.h:90
virtual void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py)
Execute mouse actions on a given shape.
Bool_t fVisLock
Definition: TGeoPainter.h:53
TGeoNode * GetMother(Int_t up=1) const
Definition: TGeoManager.h:481
#define gPad
Definition: TVirtualPad.h:285
Int_t fNVisNodes
Definition: TGeoPainter.h:49
void Add(TObject *obj)
Definition: TObjArray.h:73
TPolyMarker3D * GetPolyMarker() const
Definition: TGeoOverlap.h:72
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:1070
Definition: Rtypes.h:59
Int_t fNsegments
Definition: TGeoPainter.h:48
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition: TAttMarker.h:31
def normal(shape, name=None)
virtual void CheckGeometry(Int_t nrays, Double_t startx, Double_t starty, Double_t startz) const
Geometry checking method (see TGeoChecker).
virtual void BombTranslation(const Double_t *tr, Double_t *bombtr)
Get the new &#39;bombed&#39; translation vector according current exploded view mode.
Double_t Sqrt(Double_t x)
Definition: TMath.h:590
TGeoVolume * GetTopVolume() const
Definition: TGeoManager.h:500
TGeoManager * fGeoManager
Definition: TGeoPainter.h:64
Bool_t IsClosed() const
Definition: TGeoManager.h:282
TGeoShape * GetShape() const
Definition: TGeoVolume.h:191
TString fVisBranch
Definition: TGeoPainter.h:58
Bool_t IsVisible() const
Bool_t IsVisBranch() const
Definition: TGeoAtt.h:90
virtual void SetNsegments(Int_t nseg=20)
Set number of segments to approximate circles.
const Bool_t kTRUE
Definition: RtypesCore.h:87
static Int_t CreateGradientColorTable(UInt_t Number, Double_t *Stops, Double_t *Red, Double_t *Green, Double_t *Blue, UInt_t NColors, Float_t alpha=1.)
Static function creating a color table with several connected linear gradients.
Definition: TColor.cxx:2202
return c3
Definition: legend3.C:15
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:94
Line Attributes class.
Definition: TAttLine.h:18
Double_t fMat[9]
Definition: TGeoPainter.h:47
char name[80]
Definition: TGX11.cxx:109
Bool_t fIsRaytracing
Definition: TGeoPainter.h:56
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
Double_t GetOverlap() const
Definition: TGeoOverlap.h:77
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:72
Bool_t IsVisible() const
Definition: TGeoNode.h:104
virtual Bool_t IsPerspective() const =0
const char * Data() const
Definition: TString.h:345
Stopwatch class.
Definition: TStopwatch.h:28
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
static constexpr double g