Logo ROOT   6.08/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 //______________________________________________________________________________
12 // TGeoPainter - class implementing all draw interfaces for a generic 3D viewer
13 // using TBuffer3D mechanism.
14 //______________________________________________________________________________
15 
16 #include <map>
17 #include "TROOT.h"
18 #include "TClass.h"
19 #include "TColor.h"
20 #include "TPoint.h"
21 #include "TView.h"
22 #include "TAttLine.h"
23 #include "TAttFill.h"
24 #include "TPad.h"
25 #include "TCanvas.h"
26 #include "TH2F.h"
27 #include "TF1.h"
28 #include "TGraph.h"
29 #include "TPluginManager.h"
30 #include "TVirtualPadEditor.h"
31 #include "TStopwatch.h"
32 
33 #include "TPolyMarker3D.h"
34 #include "TVirtualGL.h"
35 
36 #include "TGeoAtt.h"
37 #include "TGeoVolume.h"
38 #include "TGeoNode.h"
39 #include "TGeoManager.h"
40 #include "TGeoTrack.h"
41 #include "TGeoOverlap.h"
42 #include "TGeoChecker.h"
43 #include "TGeoPhysicalNode.h"
44 #include "TGeoPolygon.h"
45 #include "TGeoCompositeShape.h"
46 #include "TGeoShapeAssembly.h"
47 #include "TGeoPainter.h"
48 #include "TMath.h"
49 
50 #include "X3DBuffer.h"
51 
52 #include "TBuffer3D.h"
53 #include "TBuffer3DTypes.h"
54 #include "TVirtualViewer3D.h"
55 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 ///*-*-*-*-*-*-*-*-*-*-*Geometry painter default constructor*-*-*-*-*-*-*-*-*
60 ///*-* ====================================
61 
63 {
65  if (manager) fGeoManager = manager;
66  else {
67  Error("ctor", "No geometry loaded");
68  return;
69  }
70  fNsegments = fGeoManager->GetNsegments();
71  fNVisNodes = 0;
72  fBombX = 1.3;
73  fBombY = 1.3;
74  fBombZ = 1.3;
75  fBombR = 1.3;
76  fVisLevel = fGeoManager->GetVisLevel();
77  fVisOption = fGeoManager->GetVisOption();
78  fExplodedView = fGeoManager->GetBombMode();
79  fVisBranch = "";
80  fVolInfo = "";
81  fVisLock = kFALSE;
82  fIsRaytracing = kFALSE;
83  fTopVisible = kFALSE;
84  fPaintingOverlaps = kFALSE;
85  fPlugin = 0;
86  fVisVolumes = new TObjArray();
87  fOverlap = 0;
88  fGlobal = new TGeoHMatrix();
89  fBuffer = new TBuffer3D(TBuffer3DTypes::kGeneric,20,3*20,0,0,0,0);
90  fClippingShape = 0;
91  fLastVolume = 0;
92  fTopVolume = 0;
93  fIsPaintingShape = kFALSE;
94  memset(&fCheckedBox[0], 0, 6*sizeof(Double_t));
95 
96  fCheckedNode = fGeoManager->GetTopNode();
97  fChecker = new TGeoChecker(fGeoManager);
98  fIsEditable = kFALSE;
99  DefineColors();
100 }
101 ////////////////////////////////////////////////////////////////////////////////
102 ///*-*-*-*-*-*-*-*-*-*-*Geometry painter default destructor*-*-*-*-*-*-*-*-*
103 ///*-* ===================================
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 
249 void TGeoPainter::CheckShape(TGeoShape *shape, Int_t testNo, Int_t nsamples, Option_t *option)
250 {
251  fChecker->CheckShape(shape, testNo, nsamples, option);
252 }
253 
254 ////////////////////////////////////////////////////////////////////////////////
255 ///Clear the list of visible volumes
256 ///reset the kVisOnScreen bit for volumes previously in the list
257 
259 {
260  if (!fVisVolumes) return;
261  TIter next(fVisVolumes);
262  TGeoVolume *vol;
263  while ((vol = (TGeoVolume*)next())) {
265  }
266  fVisVolumes->Clear();
267 }
268 
269 
270 ////////////////////////////////////////////////////////////////////////////////
271 /// Define 100 colors with increasing light intensities for each basic color (1-7)
272 /// Register these colors at indexes starting with 1000.
273 
275 {
276  static Int_t color = 0;
277  if (!color) {
279  for (auto icol=1; icol<10; ++icol)
280  color = GetColor(icol, 0.5);
281  }
282 }
283 
284 ////////////////////////////////////////////////////////////////////////////////
285 /// Get index of a base color with given light intensity (0,1)
286 
288 {
289  using IntMap_t = std::map<Int_t, Int_t>;
290  constexpr Int_t ncolors = 100;
291  constexpr Float_t lmin = 0.25;
292  constexpr Float_t lmax = 0.75;
293  static IntMap_t colmap;
294  Int_t color = base;
295  // Search color in the map
296  auto it = colmap.find(base);
297  if (it != colmap.end()) return (it->second + light*(ncolors-1));
298  // Get color pointer if stored
299  TColor* col_base = gROOT->GetColor(base);
300  if (!col_base) {
301  // If color not defined, use gray palette
302  it = colmap.find(kBlack);
303  if (it != colmap.end()) return (it->second + light*(ncolors-1));
304  col_base = gROOT->GetColor(kBlack);
305  color = 1;
306  }
307  // Create a color palette for col_base
308  Float_t r,g,b,h,l,s;
309  Double_t red[2], green[2], blue[2];
310  Double_t stop[] = {0., 1.0};
311 
312  col_base->GetRGB(r,g,b);
313  TColor::RGB2HLS(r,g,b,h,l,s);
314  TColor::HLS2RGB(h,lmin,s,r,g,b);
315  red[0] = r;
316  green[0] = g;
317  blue[0] = b;
318  TColor::HLS2RGB(h,lmax,s,r,g,b);
319  red[1] = r;
320  green[1] = g;
321  blue[1] = b;
322  Int_t color_map_idx = TColor::CreateGradientColorTable(2, stop, red, green, blue, ncolors);
323  colmap[color] = color_map_idx;
324  return (color_map_idx + light*(ncolors-1));
325 }
326 
327 ////////////////////////////////////////////////////////////////////////////////
328 /// Get currently drawn volume.
329 
331 {
332  if (!gPad) return 0;
333  return fTopVolume;
334 }
335 
336 ////////////////////////////////////////////////////////////////////////////////
337 /// compute the closest distance of approach from point px,py to a volume
338 
340 {
341  const Int_t big = 9999;
342  const Int_t inaxis = 7;
343  const Int_t maxdist = 5;
344 
345  if (fTopVolume != volume) fTopVolume = volume;
346  TView *view = gPad->GetView();
347  if (!view) return big;
348  TGeoBBox *box;
349  fGlobal->Clear();
351 
352  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
353  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
354  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
355  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
356  // return if point not in user area
357  if (px < puxmin - inaxis) return big;
358  if (py > puymin + inaxis) return big;
359  if (px > puxmax + inaxis) return big;
360  if (py < puymax - inaxis) return big;
361 
363  gPad->SetSelected(view);
364  Int_t dist = big;
365 // Int_t id;
366 
367  if (fPaintingOverlaps) {
368  TGeoVolume *crt;
369  crt = fOverlap->GetFirstVolume();
371  dist = crt->GetShape()->DistancetoPrimitive(px,py);
372  if (dist<maxdist) {
373  gPad->SetSelected(crt);
374  box = (TGeoBBox*)crt->GetShape();
376  fCheckedBox[3] = box->GetDX();
377  fCheckedBox[4] = box->GetDY();
378  fCheckedBox[5] = box->GetDZ();
379  return 0;
380  }
381  crt = fOverlap->GetSecondVolume();
383  dist = crt->GetShape()->DistancetoPrimitive(px,py);
384  if (dist<maxdist) {
385  gPad->SetSelected(crt);
386  box = (TGeoBBox*)crt->GetShape();
388  fCheckedBox[3] = box->GetDX();
389  fCheckedBox[4] = box->GetDY();
390  fCheckedBox[5] = box->GetDZ();
391  return 0;
392  }
393  return big;
394  }
395  // Compute distance to the right edge
396  if ((puxmax+inaxis-px) < 40) {
397  if ((py-puymax+inaxis) < 40) {
398  // when the mouse points to the (40x40) right corner of the pad, the manager class is selected
399  gPad->SetSelected(fGeoManager);
401  box = (TGeoBBox*)volume->GetShape();
402  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
403  fCheckedBox[3] = box->GetDX();
404  fCheckedBox[4] = box->GetDY();
405  fCheckedBox[5] = box->GetDZ();
406  return 0;
407  }
408  // when the mouse points to the (40 pix) right edge of the pad, the top volume is selected
409  gPad->SetSelected(volume);
410  fVolInfo = volume->GetName();
411  box = (TGeoBBox*)volume->GetShape();
412  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
413  fCheckedBox[3] = box->GetDX();
414  fCheckedBox[4] = box->GetDY();
415  fCheckedBox[5] = box->GetDZ();
416  return 0;
417  }
418 
419  TGeoVolume *vol = volume;
420  Bool_t vis = vol->IsVisible();
421 // Bool_t drawDaughters = kTRUE;
422  // Do we need to check a branch only?
423  if (volume->IsVisBranch()) {
424  if (!fGeoManager->IsClosed()) return big;
427  while (fGeoManager->GetLevel()) {
428  vol = fGeoManager->GetCurrentVolume();
430  dist = vol->GetShape()->DistancetoPrimitive(px,py);
431  if (dist<maxdist) {
433  box = (TGeoBBox*)vol->GetShape();
436  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
437  else gPad->SetSelected(vol);
438  fCheckedBox[3] = box->GetDX();
439  fCheckedBox[4] = box->GetDY();
440  fCheckedBox[5] = box->GetDZ();
441  fGeoManager->PopPath();
442  return 0;
443  }
444  fGeoManager->CdUp();
445  }
446  fGeoManager->PopPath();
447  return dist;
448  }
449 
450  // Do I need to look for the top volume ?
451  if ((fTopVisible && vis) || !vol->GetNdaughters() || !vol->IsVisDaughters() || vol->IsVisOnly()) {
452  dist = vol->GetShape()->DistancetoPrimitive(px,py);
453  if (dist<maxdist) {
454  fVolInfo = vol->GetName();
455  gPad->SetSelected(vol);
456  box = (TGeoBBox*)vol->GetShape();
457  memcpy(fCheckedBox, box->GetOrigin(), 3*sizeof(Double_t));
458  fCheckedBox[3] = box->GetDX();
459  fCheckedBox[4] = box->GetDY();
460  fCheckedBox[5] = box->GetDZ();
461  return 0;
462  }
463  if (vol->IsVisOnly() || !vol->GetNdaughters() || !vol->IsVisDaughters())
464  return dist;
465  }
466 
467  // Iterate the volume content
468  TGeoIterator next(vol);
469  next.SetTopName(TString::Format("%s_1",vol->GetName()));
470  TGeoNode *daughter;
471 
472  Int_t level, nd;
473  Bool_t last;
474 
475  while ((daughter=next())) {
476  vol = daughter->GetVolume();
477  level = next.GetLevel();
478  nd = daughter->GetNdaughters();
479  vis = daughter->IsVisible();
480  if (volume->IsVisContainers()) {
481  if (vis && level<=fVisLevel) {
482  *fGlobal = next.GetCurrentMatrix();
483  dist = vol->GetShape()->DistancetoPrimitive(px,py);
484  if (dist<maxdist) {
485  next.GetPath(fVolInfo);
486  box = (TGeoBBox*)vol->GetShape();
488  fCheckedNode = daughter;
489  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
490  else gPad->SetSelected(vol);
491  fCheckedBox[3] = box->GetDX();
492  fCheckedBox[4] = box->GetDY();
493  fCheckedBox[5] = box->GetDZ();
494  fGeoManager->PopPath();
495  return 0;
496  }
497  }
498  // Check if we have to skip this branch
499  if (level==fVisLevel || !daughter->IsVisDaughters()) {
500  next.Skip();
501  continue;
502  }
503  } else if (volume->IsVisLeaves()) {
504  last = ((nd==0) || (level==fVisLevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
505  if (vis && last) {
506  *fGlobal = next.GetCurrentMatrix();
507  dist = vol->GetShape()->DistancetoPrimitive(px,py);
508  if (dist<maxdist) {
509  next.GetPath(fVolInfo);
510  box = (TGeoBBox*)vol->GetShape();
512  fCheckedNode = daughter;
513  if (fGeoManager->IsNodeSelectable()) gPad->SetSelected(fCheckedNode);
514  else gPad->SetSelected(vol);
515  fCheckedBox[3] = box->GetDX();
516  fCheckedBox[4] = box->GetDY();
517  fCheckedBox[5] = box->GetDZ();
518  fGeoManager->PopPath();
519  return 0;
520  }
521  }
522  // Check if we have to skip the branch
523  if (last || !daughter->IsVisDaughters()) next.Skip();
524  }
525  }
526  return dist;
527 }
528 
529 ////////////////////////////////////////////////////////////////////////////////
530 /// Set default angles for the current view.
531 
533 {
534  if (gPad) {
535  Int_t irep;
536  TView *view = gPad->GetView();
537  if (!view) return;
538  view->SetView(-206,126,75,irep);
539  ModifiedPad();
540  }
541 }
542 
543 ////////////////////////////////////////////////////////////////////////////////
544 /// Set default volume colors according to tracking media
545 
547 {
549  TGeoVolume *vol;
550  while ((vol=(TGeoVolume*)next()))
551  vol->SetLineColor(vol->GetMaterial()->GetDefaultColor());
552  ModifiedPad();
553 }
554 
555 ////////////////////////////////////////////////////////////////////////////////
556 /// Count number of visible nodes down to a given level.
557 
559 {
560  TGeoVolume *vol = volume;
561  Int_t count = 0;
562  Bool_t vis = vol->IsVisible();
563  // Do I need to look for the top volume ?
564  if ((fTopVisible && vis) || !vol->GetNdaughters() || !vol->IsVisDaughters() || vol->IsVisOnly())
565  count++;
566  // Is this the only volume?
567  if (volume->IsVisOnly()) return count;
568 
569  // Do we need to check a branch only?
570  if (volume->IsVisBranch()) {
573  count = fGeoManager->GetLevel() + 1;
574  fGeoManager->PopPath();
575  return count;
576  }
577  // Iterate the volume content
578  TGeoIterator next(vol);
579  TGeoNode *daughter;
580  Int_t level, nd;
581  Bool_t last;
582 
583  while ((daughter=next())) {
584 // vol = daughter->GetVolume();
585  level = next.GetLevel();
586  nd = daughter->GetNdaughters();
587  vis = daughter->IsVisible();
588  if (volume->IsVisContainers()) {
589  if (vis && level<=rlevel) count++;
590  // Check if we have to skip this branch
591  if (level==rlevel || !daughter->IsVisDaughters()) {
592  next.Skip();
593  continue;
594  }
595  } else if (volume->IsVisLeaves()) {
596  last = ((nd==0) || (level==rlevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
597  if (vis && last) count++;
598  // Check if we have to skip the branch
599  if (last) next.Skip();
600  }
601  }
602  return count;
603 }
604 
605 ////////////////////////////////////////////////////////////////////////////////
606 /// Count total number of visible nodes.
607 
609 {
610  Int_t maxnodes = fGeoManager->GetMaxVisNodes();
611  Int_t vislevel = fGeoManager->GetVisLevel();
612 // TGeoVolume *top = fGeoManager->GetTopVolume();
613  TGeoVolume *top = fTopVolume;
614  if (maxnodes <= 0 && top) {
615  fNVisNodes = CountNodes(top, vislevel);
616  SetVisLevel(vislevel);
617  return fNVisNodes;
618  }
619  //if (the total number of nodes of the top volume is less than maxnodes
620  // we can visualize everything.
621  //recompute the best visibility level
622  if (!top) {
623  SetVisLevel(vislevel);
624  return 0;
625  }
626  fNVisNodes = -1;
627  Bool_t again = kFALSE;
628  for (Int_t level = 1;level<20;level++) {
629  vislevel = level;
630  Int_t nnodes = CountNodes(top, level);
631  if (top->IsVisOnly() || top->IsVisBranch()) {
632  vislevel = fVisLevel;
633  fNVisNodes = nnodes;
634  break;
635  }
636  if (nnodes > maxnodes) {
637  vislevel--;
638  break;
639  }
640  if (nnodes == fNVisNodes) {
641  if (again) break;
642  again = kTRUE;
643  }
644  fNVisNodes = nnodes;
645  }
646  SetVisLevel(vislevel);
647  return fNVisNodes;
648 }
649 
650 ////////////////////////////////////////////////////////////////////////////////
651 /// Check if Ged library is loaded and load geometry editor classe.
652 
654 {
655  if (fIsEditable) return;
656  if (!TClass::GetClass("TGedEditor")) return;
657  TPluginHandler *h;
658  if ((h = gROOT->GetPluginManager()->FindHandler("TGeoManagerEditor"))) {
659  if (h->LoadPlugin() == -1) return;
660  h->ExecPlugin(0);
661  }
662  fIsEditable = kTRUE;
663 }
664 
665 ////////////////////////////////////////////////////////////////////////////////
666 /// Start the geometry editor.
667 
669 {
670  if (!gPad) return;
671  if (!fIsEditable) {
672  if (!option[0]) gPad->GetCanvas()->GetCanvasImp()->ShowEditor();
674  CheckEdit();
675  }
676  gPad->SetSelected(fGeoManager);
677  gPad->GetCanvas()->Selected(gPad,fGeoManager,kButton1Down);
678 }
679 
680 ////////////////////////////////////////////////////////////////////////////////
681 /// Draw method.
682 
684 {
685  DrawVolume(fGeoManager->GetTopVolume(), option);
686 }
687 
688 ////////////////////////////////////////////////////////////////////////////////
689 /// Draw the time evolution of a radionuclide.
690 
692 {
693  Int_t ncoeff = sol->GetNcoeff();
694  if (!ncoeff) return;
695  Double_t tlo=0., thi=0.;
696  Double_t cn=0., lambda=0.;
697  Int_t i;
698  sol->GetRange(tlo, thi);
699  Bool_t autorange = (thi==0.)?kTRUE:kFALSE;
700 
701  // Try to find the optimum range in time.
702  if (autorange) tlo = 0.;
703  sol->GetCoeff(0, cn, lambda);
704  Double_t lambdamin = lambda;
705  TString formula = "";
706  for (i=0; i<ncoeff; i++) {
707  sol->GetCoeff(i, cn, lambda);
708  formula += TString::Format("%g*exp(-%g*x)",cn, lambda);
709  if (i < ncoeff-1) formula += "+";
710  if (lambda < lambdamin &&
711  lambda > 0.) lambdamin = lambda;
712  }
713  if (autorange) thi = 10./lambdamin;
714  // Create a function
715  TF1 *func = new TF1(TString::Format("conc%s",sol->GetElement()->GetName()), formula.Data(), tlo,thi);
716  func->SetTitle(formula + ";time[s]" + TString::Format(";Concentration_of_%s",sol->GetElement()->GetName()));
717  func->SetMinimum(1.e-3);
718  func->SetMaximum(1.25*TMath::Max(sol->Concentration(tlo), sol->Concentration(thi)));
719  func->SetLineColor(sol->GetLineColor());
720  func->SetLineStyle(sol->GetLineStyle());
721  func->SetLineWidth(sol->GetLineWidth());
722  func->SetMarkerColor(sol->GetMarkerColor());
723  func->SetMarkerStyle(sol->GetMarkerStyle());
724  func->SetMarkerSize(sol->GetMarkerSize());
725  func->Draw(option);
726 }
727 
728 ////////////////////////////////////////////////////////////////////////////////
729 /// Draw a polygon in 3D.
730 
732 {
733  Int_t nvert = poly->GetNvert();
734  if (!nvert) {
735  Error("DrawPolygon", "No vertices defined");
736  return;
737  }
738  Int_t nconv = poly->GetNconvex();
739  Double_t *x = new Double_t[nvert+1];
740  Double_t *y = new Double_t[nvert+1];
741  poly->GetVertices(x,y);
742  x[nvert] = x[0];
743  y[nvert] = y[0];
744  TGraph *g1 = new TGraph(nvert+1, x,y);
745  g1->SetTitle(Form("Polygon with %d vertices (outscribed %d)",nvert, nconv));
746  g1->SetLineColor(kRed);
747  g1->SetMarkerColor(kRed);
748  g1->SetMarkerStyle(4);
749  g1->SetMarkerSize(0.8);
750  delete [] x;
751  delete [] y;
752  Double_t *xc = 0;
753  Double_t *yc = 0;
754  TGraph *g2 = 0;
755  if (nconv && !poly->IsConvex()) {
756  xc = new Double_t[nconv+1];
757  yc = new Double_t[nconv+1];
758  poly->GetConvexVertices(xc,yc);
759  xc[nconv] = xc[0];
760  yc[nconv] = yc[0];
761  g2 = new TGraph(nconv+1, xc,yc);
762  g2->SetLineColor(kBlue);
763  g2->SetLineColor(kBlue);
764  g2->SetMarkerColor(kBlue);
765  g2->SetMarkerStyle(21);
766  g2->SetMarkerSize(0.4);
767  delete [] xc;
768  delete [] yc;
769  }
770  if (!gPad) {
771  gROOT->MakeDefCanvas();
772  }
773  g1->Draw("ALP");
774  if (g2) g2->Draw("LP");
775 }
776 
777 ////////////////////////////////////////////////////////////////////////////////
778 /// Draw method.
779 
781 {
782  fTopVolume = vol;
783  fLastVolume = 0;
785 // if (fVisOption==kGeoVisOnly ||
786 // fVisOption==kGeoVisBranch) fGeoManager->SetVisOption(kGeoVisLeaves);
788  TString opt = option;
789  opt.ToLower();
791  fOverlap = 0;
792 
793  if (fVisLock) {
795  fVisLock = kFALSE;
796  }
797  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
798  // Clear pad if option "same" not given
799  if (!gPad) {
800  gROOT->MakeDefCanvas();
801  }
802  if (!opt.Contains("same")) gPad->Clear();
803  // append this volume to pad
804  fTopVolume->AppendPad(option);
805 
806  // Create a 3-D view
807  TView *view = gPad->GetView();
808  if (!view) {
809  view = TView::CreateView(11,0,0);
810  // Set the view to perform a first autorange (frame) draw.
811  // TViewer3DPad will revert view to normal painting after this
812  view->SetAutoRange(kTRUE);
813  if (has_pad) gPad->Update();
814  }
815  if (!opt.Contains("same")) Paint("range");
816  else Paint(opt);
817  view->SetAutoRange(kFALSE);
818  // If we are drawing into the pad, then the view needs to be
819  // set to perspective
820 // if (!view->IsPerspective()) view->SetPerspective();
821 
823 
824  // Create a 3D viewer to paint us
825  gPad->GetViewer3D(option);
826 }
827 
828 ////////////////////////////////////////////////////////////////////////////////
829 /// Draw a shape.
830 
832 {
833  TString opt = option;
834  opt.ToLower();
836  fOverlap = 0;
838 
839  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
840  // Clear pad if option "same" not given
841  if (!gPad) {
842  gROOT->MakeDefCanvas();
843  }
844  if (!opt.Contains("same")) gPad->Clear();
845  // append this shape to pad
846  shape->AppendPad(option);
847 
848  // Create a 3-D view
849  TView *view = gPad->GetView();
850  if (!view) {
851  view = TView::CreateView(11,0,0);
852  // Set the view to perform a first autorange (frame) draw.
853  // TViewer3DPad will revert view to normal painting after this
854  view->SetAutoRange(kTRUE);
855  if (has_pad) gPad->Update();
856  }
857  PaintShape(shape,"range");
858  view->SetAutoRange(kFALSE);
859  view->SetPerspective();
860  // Create a 3D viewer to paint us
861  gPad->GetViewer3D(option);
862 }
863 
864 ////////////////////////////////////////////////////////////////////////////////
865 /// Draw an overlap.
866 
867 void TGeoPainter::DrawOverlap(void *ovlp, Option_t *option)
868 {
869  TString opt = option;
871  TGeoOverlap *overlap = (TGeoOverlap*)ovlp;
872  if (!overlap) return;
873 
875  fOverlap = overlap;
876  opt.ToLower();
877  if (fVisLock) {
879  fVisLock = kFALSE;
880  }
881  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
882  // Clear pad if option "same" not given
883  if (!gPad) {
884  gROOT->MakeDefCanvas();
885  }
886  if (!opt.Contains("same")) gPad->Clear();
887  // append this volume to pad
888  overlap->AppendPad(option);
889 
890  // Create a 3-D view
891  // Create a 3D viewer to paint us
892  gPad->GetViewer3D(option);
893  TView *view = gPad->GetView();
894  if (!view) {
895  view = TView::CreateView(11,0,0);
896  // Set the view to perform a first autorange (frame) draw.
897  // TViewer3DPad will revert view to normal painting after this
898  view->SetAutoRange(kTRUE);
899  PaintOverlap(ovlp, "range");
900  overlap->GetPolyMarker()->Draw("SAME");
901  if (has_pad) gPad->Update();
902  }
903 
904  // If we are drawing into the pad, then the view needs to be
905  // set to perspective
906 // if (!view->IsPerspective()) view->SetPerspective();
907  fVisLock = kTRUE;
908 }
909 
910 
911 ////////////////////////////////////////////////////////////////////////////////
912 /// Draw only one volume.
913 
915 {
916  TString opt = option;
917  opt.ToLower();
918  if (fVisLock) {
920  fVisLock = kFALSE;
921  }
924  Bool_t has_pad = (gPad==0)?kFALSE:kTRUE;
925  // Clear pad if option "same" not given
926  if (!gPad) {
927  gROOT->MakeDefCanvas();
928  }
929  if (!opt.Contains("same")) gPad->Clear();
930  // append this volume to pad
932  fTopVolume->AppendPad(option);
933 
934  // Create a 3-D view
935  TView *view = gPad->GetView();
936  if (!view) {
937  view = TView::CreateView(11,0,0);
938  // Set the view to perform a first autorange (frame) draw.
939  // TViewer3DPad will revert view to normal painting after this
940  view->SetAutoRange(kTRUE);
942  if (has_pad) gPad->Update();
943  }
944 
945  // If we are drawing into the pad, then the view needs to be
946  // set to perspective
947 // if (!view->IsPerspective()) view->SetPerspective();
948  fVisLock = kTRUE;
949 }
950 
951 ////////////////////////////////////////////////////////////////////////////////
952 /// Draw current point in the same view.
953 
955 {
956  if (!gPad) return;
957  if (!gPad->GetView()) return;
958  TPolyMarker3D *pm = new TPolyMarker3D();
959  pm->SetMarkerColor(color);
960  const Double_t *point = fGeoManager->GetCurrentPoint();
961  pm->SetNextPoint(point[0], point[1], point[2]);
962  pm->SetMarkerStyle(8);
963  pm->SetMarkerSize(0.5);
964  pm->Draw("SAME");
965 }
966 
967 ////////////////////////////////////////////////////////////////////////////////
968 
970 {
971 }
972 
973 ////////////////////////////////////////////////////////////////////////////////
974 /// Draw all volumes for a given path.
975 
976 void TGeoPainter::DrawPath(const char *path, Option_t *option)
977 {
979  fVisBranch=path;
983  DrawVolume(fTopVolume,option);
984 }
985 
986 ////////////////////////////////////////////////////////////////////////////////
987 /// Estimate camera movement between tmin and tmax for best track display
988 
990 {
991  if (!gPad) return;
992  TIter next(gPad->GetListOfPrimitives());
993  TVirtualGeoTrack *track;
994  TObject *obj;
995  Int_t ntracks = 0;
996  Double_t *point = 0;
997  AddTrackPoint(point, start, kTRUE);
998  while ((obj=next())) {
999  if (strcmp(obj->ClassName(), "TGeoTrack")) continue;
1000  track = (TVirtualGeoTrack*)obj;
1001  ntracks++;
1002  track->PaintCollect(tmin, start);
1003  }
1004 
1005  if (!ntracks) return;
1006  next.Reset();
1007  AddTrackPoint(point, end, kTRUE);
1008  while ((obj=next())) {
1009  if (strcmp(obj->ClassName(), "TGeoTrack")) continue;
1010  track = (TVirtualGeoTrack*)obj;
1011  if (!track) continue;
1012  track->PaintCollect(tmax, end);
1013  }
1014 }
1015 
1016 ////////////////////////////////////////////////////////////////////////////////
1017 /// Execute mouse actions on a given volume.
1018 
1019 void TGeoPainter::ExecuteManagerEvent(TGeoManager * /*geom*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1020 {
1021  if (!gPad) return;
1022  gPad->SetCursor(kPointer);
1023  switch (event) {
1024  case kButton1Down:
1025  if (!fIsEditable) CheckEdit();
1026  }
1027 }
1028 
1029 ////////////////////////////////////////////////////////////////////////////////
1030 /// Execute mouse actions on a given shape.
1031 
1032 void TGeoPainter::ExecuteShapeEvent(TGeoShape * /*shape*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1033 {
1034  if (!gPad) return;
1035  gPad->SetCursor(kHand);
1036  switch (event) {
1037  case kButton1Down:
1038  if (!fIsEditable) CheckEdit();
1039  }
1040 }
1041 
1042 ////////////////////////////////////////////////////////////////////////////////
1043 /// Execute mouse actions on a given volume.
1044 
1045 void TGeoPainter::ExecuteVolumeEvent(TGeoVolume * /*volume*/, Int_t event, Int_t /*px*/, Int_t /*py*/)
1046 {
1047  if (!gPad) return;
1048  if (!fIsEditable) CheckEdit();
1049 // if (fIsRaytracing) return;
1050 // Bool_t istop = (volume==fTopVolume)?kTRUE:kFALSE;
1051 // if (istop) gPad->SetCursor(kHand);
1052 // else gPad->SetCursor(kPointer);
1053  gPad->SetCursor(kHand);
1054 // static Int_t width, color;
1055  switch (event) {
1056  case kMouseEnter:
1057 // width = volume->GetLineWidth();
1058 // color = volume->GetLineColor();
1059  break;
1060 
1061  case kMouseLeave:
1062 // volume->SetLineWidth(width);
1063 // volume->SetLineColor(color);
1064  break;
1065 
1066  case kButton1Down:
1067 // volume->SetLineWidth(3);
1068 // volume->SetLineColor(2);
1069 // gPad->Modified();
1070 // gPad->Update();
1071  break;
1072 
1073  case kButton1Up:
1074 // volume->SetLineWidth(width);
1075 // volume->SetLineColor(color);
1076 // gPad->Modified();
1077 // gPad->Update();
1078  break;
1079 
1080  case kButton1Double:
1081  gPad->SetCursor(kWatch);
1082  GrabFocus();
1083  break;
1084  }
1085 }
1086 
1087 ////////////////////////////////////////////////////////////////////////////////
1088 /// Get some info about the current selected volume.
1089 
1090 const char *TGeoPainter::GetVolumeInfo(const TGeoVolume *volume, Int_t /*px*/, Int_t /*py*/) const
1091 {
1092  static TString info;
1093  info = "";
1094  if (!gPad) return info;
1095  if (fPaintingOverlaps) {
1096  if (!fOverlap) {
1097  info = "wrong overlapping flag";
1098  return info;
1099  }
1100  TString ovtype, name;
1101  if (fOverlap->IsExtrusion()) ovtype="EXTRUSION";
1102  else ovtype = "OVERLAP";
1103  if (volume==fOverlap->GetFirstVolume()) name=volume->GetName();
1104  else name=fOverlap->GetSecondVolume()->GetName();
1105  info = TString::Format("%s: %s of %g", name.Data(), ovtype.Data(), fOverlap->GetOverlap());
1106  return info;
1107  }
1108  else info = TString::Format("%s, shape=%s", fVolInfo.Data(), volume->GetShape()->ClassName());
1109  return info;
1110 }
1111 
1112 ////////////////////////////////////////////////////////////////////////////////
1113 /// Create/return geometry checker.
1114 
1116 {
1118  return fChecker;
1119 }
1120 
1121 ////////////////////////////////////////////////////////////////////////////////
1122 /// Get the current view angles.
1123 
1124 void TGeoPainter::GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi)
1125 {
1126  if (!gPad) return;
1127  TView *view = gPad->GetView();
1128  if (!view) return;
1129  longitude = view->GetLongitude();
1130  latitude = view->GetLatitude();
1131  psi = view->GetPsi();
1132 }
1133 
1134 ////////////////////////////////////////////////////////////////////////////////
1135 /// Move focus to current volume
1136 
1138 {
1139  if (!gPad) return;
1140  TView *view = gPad->GetView();
1141  if (!view) return;
1142  if (!fCheckedNode && !fPaintingOverlaps) {
1143  printf("Woops!!!\n");
1145  memcpy(&fCheckedBox[0], box->GetOrigin(), 3*sizeof(Double_t));
1146  fCheckedBox[3] = box->GetDX();
1147  fCheckedBox[4] = box->GetDY();
1148  fCheckedBox[5] = box->GetDZ();
1149  }
1150  view->SetPerspective();
1151  Int_t nvols = fVisVolumes->GetEntriesFast();
1152  Int_t nframes = nfr;
1153  if (nfr==0) {
1154  nframes = 1;
1155  if (nvols<1500) nframes=10;
1156  if (nvols<1000) nframes=20;
1157  if (nvols<200) nframes = 50;
1158  if (nvols<100) nframes = 100;
1159  }
1160  view->MoveFocus(&fCheckedBox[0], fCheckedBox[3], fCheckedBox[4], fCheckedBox[5], nframes, dlong, dlat, dpsi);
1161 }
1162 
1163 ////////////////////////////////////////////////////////////////////////////////
1164 /// Generate a lego plot fot the top volume, according to option.
1165 
1167  Int_t nphi, Double_t phimin, Double_t phimax,
1168  Double_t rmin, Double_t rmax, Option_t *option)
1169 {
1170  return fChecker->LegoPlot(ntheta, themin, themax, nphi, phimin, phimax, rmin, rmax, option);
1171 }
1172 ////////////////////////////////////////////////////////////////////////////////
1173 /// Convert a local vector according view rotation matrix
1174 
1175 void TGeoPainter::LocalToMasterVect(const Double_t *local, Double_t *master) const
1176 {
1177  for (Int_t i=0; i<3; i++)
1178  master[i] = -local[0]*fMat[i]-local[1]*fMat[i+3]-local[2]*fMat[i+6];
1179 }
1180 
1181 ////////////////////////////////////////////////////////////////////////////////
1182 /// Check if a pad and view are present and send signal "Modified" to pad.
1183 
1185 {
1186  if (!gPad) return;
1187  if (update) {
1188  gPad->Update();
1189  return;
1190  }
1191  TView *view = gPad->GetView();
1192  if (!view) return;
1193  view->SetViewChanged();
1194  gPad->Modified();
1195  if (gROOT->FromPopUp()) gPad->Update();
1196 }
1197 
1198 ////////////////////////////////////////////////////////////////////////////////
1199 /// Paint current geometry according to option.
1200 
1202 {
1203  if (!fGeoManager || !fTopVolume) return;
1204  Bool_t is_padviewer = kTRUE;
1205  if (gPad) is_padviewer = (!strcmp(gPad->GetViewer3D()->ClassName(),"TViewer3DPad"))?kTRUE:kFALSE;
1206 
1210  else if (fTopVolume->IsVisOnly()) fVisOption = kGeoVisOnly;
1212 
1213 
1214  if (!fIsRaytracing || !is_padviewer) {
1215  if (fGeoManager->IsDrawingExtra()) {
1216  // loop the list of physical volumes
1217  fGeoManager->CdTop();
1219  Int_t nnodes = nodeList->GetEntriesFast();
1220  Int_t inode;
1221  TGeoPhysicalNode *node;
1222  for (inode=0; inode<nnodes; inode++) {
1223  node = (TGeoPhysicalNode*)nodeList->UncheckedAt(inode);
1224  PaintPhysicalNode(node, option);
1225  }
1226  } else {
1227  PaintVolume(fTopVolume,option);
1228  }
1229  fVisLock = kTRUE;
1230  }
1231  // Check if we have to raytrace (only in pad)
1232  if (fIsRaytracing && is_padviewer) Raytrace();
1233 }
1234 
1235 ////////////////////////////////////////////////////////////////////////////////
1236 /// Paint an overlap.
1237 
1238 void TGeoPainter::PaintOverlap(void *ovlp, Option_t *option)
1239 {
1240  if (!fGeoManager) return;
1241  TGeoOverlap *overlap = (TGeoOverlap *)ovlp;
1242  if (!overlap) return;
1243  Int_t color, transparency;
1244  if (fOverlap != overlap) fOverlap = overlap;
1246  TGeoHMatrix *hmat = fGlobal;
1247  TGeoVolume *vol;
1248  TGeoVolume *vol1 = overlap->GetFirstVolume();
1249  TGeoVolume *vol2 = overlap->GetSecondVolume();
1250  TGeoHMatrix *matrix1 = overlap->GetFirstMatrix();
1251  TGeoHMatrix *matrix2 = overlap->GetSecondMatrix();
1252  //
1253  vol = vol1;
1254  *hmat = matrix1;
1256  if (!fVisLock) fVisVolumes->Add(vol);
1258  color = vol->GetLineColor();
1259  transparency = vol->GetTransparency();
1260  vol->SetLineColor(kGreen);
1261  vol->SetTransparency(40);
1262  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1263  PaintShape(*(vol->GetShape()),option);
1264  vol->SetLineColor(color);
1265  vol->SetTransparency(transparency);
1266  vol = vol2;
1267  *hmat = matrix2;
1269  if (!fVisLock) fVisVolumes->Add(vol);
1271  color = vol->GetLineColor();
1272  transparency = vol->GetTransparency();
1273  vol->SetLineColor(kBlue);
1274  vol->SetTransparency(40);
1275  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1276  PaintShape(*(vol->GetShape()),option);
1277  vol->SetLineColor(color);
1278  vol->SetTransparency(transparency);
1280  fVisLock = kTRUE;
1281 }
1282 
1283 ////////////////////////////////////////////////////////////////////////////////
1284 /// Paint recursively a node and its content accordind to visualization options.
1285 
1287 {
1288  PaintVolume(node->GetVolume(), option, global);
1289 }
1290 
1291 ////////////////////////////////////////////////////////////////////////////////
1292 /// Paint recursively a node and its content accordind to visualization options.
1293 
1295 {
1296  if (fTopVolume != top) {
1298  fVisLock = kFALSE;
1299  }
1300  fTopVolume = top;
1301  if (!fVisLevel) return;
1302  TGeoVolume *vol = top;
1303  if(global)
1304  *fGlobal = *global;
1305  else
1306  fGlobal->Clear();
1308  Bool_t drawDaughters = kTRUE;
1309  Bool_t vis = (top->IsVisible() && !top->IsAssembly());
1310  Int_t transparency = 0;
1311 
1312  // Update pad attributes in case we need to paint VOL
1313  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1314 
1315  // Do we need to draw a branch ?
1316  if (top->IsVisBranch()) {
1317  fGeoManager->PushPath();
1319 // while (fGeoManager->GetLevel()) {
1320  vol = fGeoManager->GetCurrentVolume();
1321  if (!fVisLock) {
1322  fVisVolumes->Add(vol);
1324  }
1326  transparency = vol->GetTransparency();
1327  vol->SetTransparency(40);
1328  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1329  if (global) {
1330  *fGlobal = *global;
1332  } else {
1334  }
1336  PaintShape(*(vol->GetShape()),option);
1337  vol->SetTransparency(transparency);
1338  fGeoManager->CdUp();
1339 // }
1340  fVisLock = kTRUE;
1341  fGeoManager->PopPath();
1343  return;
1344  }
1345 
1346  // Do I need to draw the top volume ?
1347  if ((fTopVisible && vis) || !top->GetNdaughters() || !top->IsVisDaughters() || top->IsVisOnly()) {
1350  drawDaughters = PaintShape(*(vol->GetShape()),option);
1351  if (!fVisLock && !vol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1352  fVisVolumes->Add(vol);
1354  }
1355  if (top->IsVisOnly() || !top->GetNdaughters() || !top->IsVisDaughters()) {
1356  fVisLock = kTRUE;
1357  return;
1358  }
1359  }
1360 
1361  // Iterate the volume content
1362  TGeoIterator next(vol);
1363  if (fPlugin) next.SetUserPlugin(fPlugin);
1364  TGeoNode *daughter;
1365 // TGeoMatrix *glmat;
1366  Int_t level, nd;
1367  Bool_t last;
1368  Int_t line_color=0, line_width=0, line_style=0;
1369  while ((daughter=next())) {
1370  vol = daughter->GetVolume();
1372  level = next.GetLevel();
1373  nd = daughter->GetNdaughters();
1374  vis = daughter->IsVisible();
1375  drawDaughters = kTRUE;
1376  if (top->IsVisContainers()) {
1377  if (vis && level<=fVisLevel) {
1378  if (fPlugin) {
1379  line_color = vol->GetLineColor();
1380  line_width = vol->GetLineWidth();
1381  line_style = vol->GetLineStyle();
1382  transparency = vol->GetTransparency();
1383  fPlugin->ProcessNode();
1384  }
1385  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1386  if (global) {
1387  *fGlobal = *global;
1388  *fGlobal *= *next.GetCurrentMatrix();
1389  } else {
1390  *fGlobal = next.GetCurrentMatrix();
1391  }
1393  drawDaughters = PaintShape(*(vol->GetShape()),option);
1394  if (fPlugin) {
1395  vol->SetLineColor(line_color);
1396  vol->SetLineWidth(line_width);
1397  vol->SetLineStyle(line_style);
1398  vol->SetTransparency(transparency);
1399  }
1400  if (!fVisLock && !daughter->IsOnScreen()) {
1401  fVisVolumes->Add(vol);
1403  }
1404  }
1405  // Check if we have to skip this branch
1406  if (!drawDaughters || level==fVisLevel || !daughter->IsVisDaughters()) {
1407  next.Skip();
1408  continue;
1409  }
1410  } else if (top->IsVisLeaves()) {
1411  last = ((nd==0) || (level==fVisLevel) || (!daughter->IsVisDaughters()))?kTRUE:kFALSE;
1412  if (vis && last) {
1413  if (fPlugin) {
1414  line_color = vol->GetLineColor();
1415  line_width = vol->GetLineWidth();
1416  line_style = vol->GetLineStyle();
1417  transparency = vol->GetTransparency();
1418  fPlugin->ProcessNode();
1419  }
1420  if (!strstr(option,"range")) ((TAttLine*)vol)->Modify();
1421  if (global) {
1422  *fGlobal = *global;
1423  *fGlobal *= *next.GetCurrentMatrix();
1424  } else {
1425  *fGlobal = next.GetCurrentMatrix();
1426  }
1428  drawDaughters = PaintShape(*(vol->GetShape()),option);
1429  if (fPlugin) {
1430  vol->SetLineColor(line_color);
1431  vol->SetLineWidth(line_width);
1432  vol->SetLineStyle(line_style);
1433  vol->SetTransparency(transparency);
1434  }
1435  if (!fVisLock && !daughter->IsOnScreen()) {
1436  fVisVolumes->Add(vol);
1438  }
1439  }
1440  // Check if we have to skip the branch
1441  if (!drawDaughters || last || !daughter->IsVisDaughters()) next.Skip();
1442  }
1443  }
1444  if (fPlugin) fPlugin->SetIterator(0);
1446  fVisLock = kTRUE;
1447 }
1448 
1449 ////////////////////////////////////////////////////////////////////////////////
1450 /// Paint the supplied shape into the current 3D viewer
1451 
1452 Bool_t TGeoPainter::PaintShape(const TGeoShape & shape, Option_t * option ) const
1453 {
1454  Bool_t addDaughters = kTRUE;
1455 
1456  TVirtualViewer3D * viewer = gPad->GetViewer3D();
1457 
1458  if (!viewer || shape.IsA()==TGeoShapeAssembly::Class()) {
1459  return addDaughters;
1460  }
1461 
1462  // For non-composite shapes we are the main paint method & perform the negotation
1463  // with the viewer here
1464  if (!shape.IsComposite()) {
1465  // Does viewer prefer local frame positions?
1466  Bool_t localFrame = viewer->PreferLocalFrame();
1467  // Perform first fetch of buffer from the shape and try adding it
1468  // to the viewer
1469  const TBuffer3D & buffer =
1471  Int_t reqSections = viewer->AddObject(buffer, &addDaughters);
1472 
1473  // If the viewer requires additional sections fetch from the shape (if possible)
1474  // and add again
1475  if (reqSections != TBuffer3D::kNone) {
1476  shape.GetBuffer3D(reqSections, localFrame);
1477  viewer->AddObject(buffer, &addDaughters);
1478  }
1479  }
1480  // Composite shapes have their own internal hierarchy of shapes, each
1481  // of which generate a filled TBuffer3D. Therefore we can't pass up a
1482  // single buffer to here. So as a special case the TGeoCompositeShape
1483  // performs it's own painting & negotiation with the viewer.
1484  else {
1485  const TGeoCompositeShape * composite = static_cast<const TGeoCompositeShape *>(&shape);
1486 
1487  // We need the addDaughters flag returned from the viewer from paint
1488  // so can't use the normal TObject::Paint()
1489 // TGeoHMatrix *matrix = (TGeoHMatrix*)TGeoShape::GetTransform();
1490 // if (viewer->PreferLocalFrame()) matrix->Clear();
1491  addDaughters = composite->PaintComposite(option);
1492  }
1493 
1494  return addDaughters;
1495 }
1496 
1497 ////////////////////////////////////////////////////////////////////////////////
1498 /// Paint an overlap.
1499 
1501 {
1503  fGlobal->Clear();
1505  PaintShape(*shape,option);
1506 }
1507 
1508 ////////////////////////////////////////////////////////////////////////////////
1509 /// Paints a physical node associated with a path.
1510 
1512 {
1513  if (!node->IsVisible()) return;
1514  Int_t level = node->GetLevel();
1515  Int_t i, col, wid, sty;
1516  TGeoShape *shape;
1518  TGeoHMatrix *matrix = fGlobal;
1519  TGeoVolume *vcrt;
1520  if (!node->IsVisibleFull()) {
1521  // Paint only last node in the branch
1522  vcrt = node->GetVolume();
1523  if (!strstr(option,"range")) ((TAttLine*)vcrt)->Modify();
1524  shape = vcrt->GetShape();
1525  *matrix = node->GetMatrix();
1527  fGeoManager->SetPaintVolume(vcrt);
1528  if (!node->IsVolAttributes() && !strstr(option,"range")) {
1529  col = vcrt->GetLineColor();
1530  wid = vcrt->GetLineWidth();
1531  sty = vcrt->GetLineStyle();
1532  vcrt->SetLineColor(node->GetLineColor());
1533  vcrt->SetLineWidth(node->GetLineWidth());
1534  vcrt->SetLineStyle(node->GetLineStyle());
1535  ((TAttLine*)vcrt)->Modify();
1536  PaintShape(*shape,option);
1537  vcrt->SetLineColor(col);
1538  vcrt->SetLineWidth(wid);
1539  vcrt->SetLineStyle(sty);
1540  } else {
1541  PaintShape(*shape,option);
1542  }
1543  } else {
1544  // Paint full branch, except top node
1545  for (i=1;i<=level; i++) {
1546  vcrt = node->GetVolume(i);
1547  if (!strstr(option,"range")) ((TAttLine*)vcrt)->Modify();
1548  shape = vcrt->GetShape();
1549  *matrix = node->GetMatrix(i);
1551  fGeoManager->SetPaintVolume(vcrt);
1552  if (!node->IsVolAttributes() && !strstr(option,"range")) {
1553  col = vcrt->GetLineColor();
1554  wid = vcrt->GetLineWidth();
1555  sty = vcrt->GetLineStyle();
1556  vcrt->SetLineColor(node->GetLineColor());
1557  vcrt->SetLineWidth(node->GetLineWidth());
1558  vcrt->SetLineStyle(node->GetLineStyle());
1559  ((TAttLine*)vcrt)->Modify();
1560  PaintShape(*shape,option);
1561  vcrt->SetLineColor(col);
1562  vcrt->SetLineWidth(wid);
1563  vcrt->SetLineStyle(sty);
1564  } else {
1565  PaintShape(*shape,option);
1566  }
1567  }
1568  }
1570 }
1571 
1572 ////////////////////////////////////////////////////////////////////////////////
1573 /// Print overlaps (see TGeoChecker::PrintOverlaps())
1574 
1576 {
1578 }
1579 
1580 ////////////////////////////////////////////////////////////////////////////////
1581 /// Text progress bar.
1582 
1583 void TGeoPainter::OpProgress(const char *opname, Long64_t current, Long64_t size, TStopwatch *watch, Bool_t last, Bool_t refresh, const char *msg)
1584 {
1585  fChecker->OpProgress(opname,current,size,watch,last,refresh, msg);
1586 }
1587 
1588 ////////////////////////////////////////////////////////////////////////////////
1589 /// Draw random points in the bounding box of a volume.
1590 
1591 void TGeoPainter::RandomPoints(const TGeoVolume *vol, Int_t npoints, Option_t *option)
1592 {
1593  fChecker->RandomPoints((TGeoVolume*)vol, npoints, option);
1594 }
1595 
1596 ////////////////////////////////////////////////////////////////////////////////
1597 /// Shoot nrays in the current drawn geometry
1598 
1599 void TGeoPainter::RandomRays(Int_t nrays, Double_t startx, Double_t starty, Double_t startz, const char *target_vol, Bool_t check_norm)
1600 {
1601  fChecker->RandomRays(nrays, startx, starty, startz, target_vol, check_norm);
1602 }
1603 
1604 ////////////////////////////////////////////////////////////////////////////////
1605 /// Raytrace current drawn geometry
1606 
1608 {
1609  if (!gPad || gPad->IsBatch()) return;
1610  TView *view = gPad->GetView();
1611  if (!view) return;
1612  Int_t rtMode = fGeoManager->GetRTmode();
1615  if (!view->IsPerspective()) view->SetPerspective();
1616  gVirtualX->SetMarkerSize(1);
1617  gVirtualX->SetMarkerStyle(1);
1618  Bool_t inclipst=kFALSE, inclip=kFALSE;
1619  Double_t krad = TMath::DegToRad();
1620  Double_t lat = view->GetLatitude();
1621  Double_t longit = view->GetLongitude();
1622  Double_t psi = view->GetPsi();
1623  Double_t c1 = TMath::Cos(psi*krad);
1624  Double_t s1 = TMath::Sin(psi*krad);
1625  Double_t c2 = TMath::Cos(lat*krad);
1626  Double_t s2 = TMath::Sin(lat*krad);
1627  Double_t s3 = TMath::Cos(longit*krad);
1628  Double_t c3 = -TMath::Sin(longit*krad);
1629  fMat[0] = c1*c3 - s1*c2*s3;
1630  fMat[1] = c1*s3 + s1*c2*c3;
1631  fMat[2] = s1*s2;
1632 
1633  fMat[3] = -s1*c3 - c1*c2*s3;
1634  fMat[4] = -s1*s3 + c1*c2*c3;
1635  fMat[5] = c1*s2;
1636 
1637  fMat[6] = s2*s3;
1638  fMat[7] = -s2*c3;
1639  fMat[8] = c2;
1640  Double_t u0, v0, du, dv;
1641  view->GetWindow(u0,v0,du,dv);
1642  Double_t dview = view->GetDview();
1643  Double_t dproj = view->GetDproj();
1644  Double_t local[3] = {0,0,1};
1645  Double_t dir[3], normal[3];
1646  LocalToMasterVect(local,dir);
1647  Double_t min[3], max[3];
1648  view->GetRange(min, max);
1649  Double_t cov[3];
1650  for (Int_t i=0; i<3; i++) cov[i] = 0.5*(min[i]+max[i]);
1651  Double_t cop[3];
1652  for (Int_t i=0; i<3; i++) cop[i] = cov[i] - dir[i]*dview;
1653  fGeoManager->InitTrack(cop, dir);
1654  Bool_t outside = fGeoManager->IsOutside();
1656  if (fClippingShape) inclipst = inclip = fClippingShape->Contains(cop);
1657  Int_t px, py;
1658  Double_t xloc, yloc, modloc;
1659  Int_t pxmin,pxmax, pymin,pymax;
1660  pxmin = gPad->UtoAbsPixel(0);
1661  pxmax = gPad->UtoAbsPixel(1);
1662  pymin = gPad->VtoAbsPixel(1);
1663  pymax = gPad->VtoAbsPixel(0);
1664  TGeoNode *next = nullptr;
1665  TGeoNode *nextnode = nullptr;
1666  Double_t step,steptot;
1667  Double_t *norm;
1668  const Double_t *point = fGeoManager->GetCurrentPoint();
1669  Double_t *ppoint = (Double_t*)point;
1670  Double_t tosource[3];
1671  Double_t calf;
1672  Double_t phi = 45.*krad;
1673  tosource[0] = -dir[0]*TMath::Cos(phi)+dir[1]*TMath::Sin(phi);
1674  tosource[1] = -dir[0]*TMath::Sin(phi)-dir[1]*TMath::Cos(phi);
1675  tosource[2] = -dir[2];
1676 
1677  Bool_t done;
1678 // Int_t istep;
1679  Int_t base_color, color;
1680  Double_t light;
1681  Double_t stemin=0, stemax=TGeoShape::Big();
1682  TPoint *pxy = new TPoint[1];
1683  TGeoVolume *nextvol;
1684  Int_t up;
1685  Int_t ntotal = pxmax*pymax;
1686  Int_t nrays = 0;
1687  TStopwatch *timer = new TStopwatch();
1688  timer->Start();
1689  for (px=pxmin; px<pxmax; px++) {
1690  for (py=pymin; py<pymax; py++) {
1691  if ((nrays%100)==0) OpProgress("Raytracing",nrays,ntotal,timer,kFALSE);
1692  nrays++;
1693  base_color = 1;
1694  steptot = 0;
1695  inclip = inclipst;
1696  xloc = gPad->AbsPixeltoX(pxmin+pxmax-px);
1697  xloc = xloc*du-u0;
1698  yloc = gPad->AbsPixeltoY(pymin+pymax-py);
1699  yloc = yloc*dv-v0;
1700  modloc = TMath::Sqrt(xloc*xloc+yloc*yloc+dproj*dproj);
1701  local[0] = xloc/modloc;
1702  local[1] = yloc/modloc;
1703  local[2] = dproj/modloc;
1704  LocalToMasterVect(local,dir);
1706  fGeoManager->SetOutside(outside);
1709 // fGeoManager->InitTrack(cop,dir);
1710  // current ray pointing to pixel (px,py)
1711  done = kFALSE;
1712  norm = 0;
1713  // propagate to the clipping shape if any
1714  if (fClippingShape) {
1715  if (inclip) {
1716  stemin = fClippingShape->DistFromInside(cop,dir,3);
1717  stemax = TGeoShape::Big();
1718  } else {
1719  stemax = fClippingShape->DistFromOutside(cop,dir,3);
1720  stemin = 0;
1721  }
1722  }
1723 
1724  while (!done) {
1725  if (fClippingShape) {
1726  if (stemin>1E10) break;
1727  if (stemin>0) {
1728  // we are inside clipping shape
1729  fGeoManager->SetStep(stemin);
1730  next = fGeoManager->Step();
1731  steptot = 0;
1732  stemin = 0;
1733  up = 0;
1734  while (next) {
1735  // we found something after clipping region
1736  nextvol = next->GetVolume();
1737  if (nextvol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1738  done = kTRUE;
1739  base_color = nextvol->GetLineColor();
1740  fClippingShape->ComputeNormal(ppoint, dir, normal);
1741  norm = normal;
1742  break;
1743  }
1744  up++;
1745  next = fGeoManager->GetMother(up);
1746  }
1747  if (done) break;
1748  inclip = fClippingShape->Contains(ppoint);
1749  fGeoManager->SetStep(1E-3);
1750  while (inclip) {
1751  fGeoManager->Step();
1752  inclip = fClippingShape->Contains(ppoint);
1753  }
1754  stemax = fClippingShape->DistFromOutside(ppoint,dir,3);
1755  }
1756  }
1757  nextnode = fGeoManager->FindNextBoundaryAndStep();
1758  step = fGeoManager->GetStep();
1759  if (step>1E10) break;
1760  steptot += step;
1761  next = nextnode;
1762  // Check the step
1763  if (fClippingShape) {
1764  if (steptot>stemax) {
1765  steptot = 0;
1766  inclip = fClippingShape->Contains(ppoint);
1767  if (inclip) {
1768  stemin = fClippingShape->DistFromInside(ppoint,dir,3);
1769  stemax = TGeoShape::Big();
1770  continue;
1771  } else {
1772  stemin = 0;
1773  stemax = fClippingShape->DistFromOutside(ppoint,dir,3);
1774  }
1775  }
1776  }
1777  // Check if next node is visible
1778  if (!nextnode) continue;
1779  nextvol = nextnode->GetVolume();
1780  if (nextvol->TestAttBit(TGeoAtt::kVisOnScreen)) {
1781  done = kTRUE;
1782  base_color = nextvol->GetLineColor();
1783  next = nextnode;
1784  break;
1785  }
1786  }
1787  if (!done) continue;
1788  // current ray intersect a visible volume having color=base_color
1789  if (rtMode > 0) {
1792  for (Int_t i=0; i<3; ++i) local[i] += 1.E-8*dir[i];
1793  step = next->GetVolume()->GetShape()->DistFromInside(local,dir,3);
1794  for (Int_t i=0; i<3; ++i) local[i] += step*dir[i];
1795  next->GetVolume()->GetShape()->ComputeNormal(local, dir, normal);
1796  norm = normal;
1797  } else {
1798  if (!norm) norm = fGeoManager->FindNormalFast();
1799  if (!norm) continue;
1800  }
1801  calf = norm[0]*tosource[0]+norm[1]*tosource[1]+norm[2]*tosource[2];
1802  light = TMath::Abs(calf);
1803  color = GetColor(base_color, light);
1804  // Now we know the color of the pixel, just draw it
1805  gVirtualX->SetMarkerColor(color);
1806  pxy[0].fX = px;
1807  pxy[0].fY = py;
1808  gVirtualX->DrawPolyMarker(1,pxy);
1809  }
1810  }
1811  delete [] pxy;
1812  timer->Stop();
1813  fChecker->OpProgress("Raytracing",nrays,ntotal,timer,kTRUE);
1814  delete timer;
1815 }
1816 
1817 ////////////////////////////////////////////////////////////////////////////////
1818 /// shoot npoints randomly in a box of 1E-5 arround current point.
1819 /// return minimum distance to points outside
1820 
1822  const char* g3path)
1823 {
1824  return fChecker->SamplePoints(npoints, dist, epsil, g3path);
1825 }
1826 
1827 ////////////////////////////////////////////////////////////////////////////////
1828 ///--- Set cartesian and radial bomb factors for translations
1829 
1831 {
1832  fBombX = bombx;
1833  fBombY = bomby;
1834  fBombZ = bombz;
1835  fBombR = bombr;
1836  if (IsExplodedView()) ModifiedPad();
1837 }
1838 
1839 ////////////////////////////////////////////////////////////////////////////////
1840 /// set type of exploding view
1841 
1843 {
1844  if ((ibomb<0) || (ibomb>3)) {
1845  Warning("SetExplodedView", "exploded view can be 0-3");
1846  return;
1847  }
1848  if ((Int_t)ibomb==fExplodedView) return;
1849  Bool_t change = (gPad==0)?kFALSE:kTRUE;
1850 
1851  if (ibomb==kGeoNoBomb) {
1852  change &= ((fExplodedView==kGeoNoBomb)?kFALSE:kTRUE);
1853  }
1854  if (ibomb==kGeoBombXYZ) {
1855  change &= ((fExplodedView==kGeoBombXYZ)?kFALSE:kTRUE);
1856  }
1857  if (ibomb==kGeoBombCyl) {
1858  change &= ((fExplodedView==kGeoBombCyl)?kFALSE:kTRUE);
1859  }
1860  if (ibomb==kGeoBombSph) {
1861  change &= ((fExplodedView==kGeoBombSph)?kFALSE:kTRUE);
1862  }
1863  fExplodedView = ibomb;
1864  if (change) ModifiedPad();
1865 }
1866 
1867 ////////////////////////////////////////////////////////////////////////////////
1868 /// Set number of segments to approximate circles
1869 
1871 {
1872  if (nseg<3) {
1873  Warning("SetNsegments", "number of segments should be > 2");
1874  return;
1875  }
1876  if (fNsegments==nseg) return;
1877  fNsegments = nseg;
1878  ModifiedPad();
1879 }
1880 
1881 ////////////////////////////////////////////////////////////////////////////////
1882 /// Set number of points to be generated on the shape outline when checking for overlaps.
1883 
1885  fChecker->SetNmeshPoints(npoints);
1886 }
1887 
1888 ////////////////////////////////////////////////////////////////////////////////
1889 /// Select a node to be checked for overlaps. All overlaps not involving it will
1890 /// be ignored.
1891 
1893  fChecker->SetSelectedNode(node);
1894 }
1895 
1896 ////////////////////////////////////////////////////////////////////////////////
1897 /// Set default level down to which visualization is performed
1898 
1900  if (level==fVisLevel && fLastVolume==fTopVolume) return;
1901  fVisLevel=level;
1902  if (!fTopVolume) return;
1903  if (fVisLock) {
1905  fVisLock = kFALSE;
1906  }
1907  if (!fLastVolume) {
1908 // printf("--- Drawing %6d nodes with %d visible levels\n",fNVisNodes,fVisLevel);
1909  return;
1910  }
1911  if (!gPad) return;
1912  if (gPad->GetView()) {
1913 // printf("--- Drawing %6d nodes with %d visible levels\n",fNVisNodes,fVisLevel);
1914  ModifiedPad();
1915  }
1916 }
1917 
1918 ////////////////////////////////////////////////////////////////////////////////
1919 /// Set top geometry volume as visible.
1920 
1922 {
1923  if (fTopVisible==vis) return;
1924  fTopVisible = vis;
1925  ModifiedPad();
1926 }
1927 
1928 ////////////////////////////////////////////////////////////////////////////////
1929 /// set drawing mode :
1930 /// option=0 (default) all nodes drawn down to vislevel
1931 /// option=1 leaves and nodes at vislevel drawn
1932 /// option=2 path is drawn
1933 
1935  if ((fVisOption<0) || (fVisOption>4)) {
1936  Warning("SetVisOption", "wrong visualization option");
1937  return;
1938  }
1939 
1940  if (option == kGeoVisChanged) {
1941  if (fVisLock) {
1943  fVisLock = kFALSE;
1944  }
1945  ModifiedPad();
1946  return;
1947  }
1948 
1949  if (fTopVolume) {
1950  TGeoAtt *att = (TGeoAtt*)fTopVolume;
1954  switch (option) {
1955  case kGeoVisDefault:
1957  break;
1958  case kGeoVisLeaves:
1959  break;
1960  case kGeoVisOnly:
1962  break;
1963  }
1964  }
1965 
1966  if (fVisOption==option) return;
1967  fVisOption=option;
1968  if (fVisLock) {
1970  fVisLock = kFALSE;
1971  }
1972  ModifiedPad();
1973 }
1974 
1975 ////////////////////////////////////////////////////////////////////////////////
1976 /// Returns distance between point px,py on the pad an a shape.
1977 
1979 {
1980  const Int_t inaxis = 7;
1981  const Int_t maxdist = 5;
1982  const Int_t big = 9999;
1983  Int_t dist = big;
1984  if (!gPad) return dist;
1985  TView *view = gPad->GetView();
1986  if (!(numpoints && view)) return dist;
1987  if (shape->IsA()==TGeoShapeAssembly::Class()) return dist;
1988 
1989  if (fIsPaintingShape) {
1990  Int_t puxmin = gPad->XtoAbsPixel(gPad->GetUxmin());
1991  Int_t puymin = gPad->YtoAbsPixel(gPad->GetUymin());
1992  Int_t puxmax = gPad->XtoAbsPixel(gPad->GetUxmax());
1993  Int_t puymax = gPad->YtoAbsPixel(gPad->GetUymax());
1994  // return if point not in user area
1995  if (px < puxmin - inaxis) return big;
1996  if (py > puymin + inaxis) return big;
1997  if (px > puxmax + inaxis) return big;
1998  if (py < puymax - inaxis) return big;
1999  if ((puxmax+inaxis-px) < 40) {
2000  // when the mouse points to the (40 pix) right edge of the pad, the manager class is selected
2001  gPad->SetSelected(fGeoManager);
2002  return 0;
2003  }
2004  }
2005 
2006  fBuffer->SetRawSizes(numpoints, 3*numpoints, 0, 0, 0, 0);
2008  shape->SetPoints(points);
2009  Double_t dpoint2, x1, y1, xndc[3];
2010  Double_t dmaster[3];
2011  Int_t j;
2012  for (Int_t i=0; i<numpoints; i++) {
2013  j = 3*i;
2014  TGeoShape::GetTransform()->LocalToMaster(&points[j], dmaster);
2015  points[j]=dmaster[0]; points[j+1]=dmaster[1]; points[j+2]=dmaster[2];
2016  view->WCtoNDC(&points[j], xndc);
2017  x1 = gPad->XtoAbsPixel(xndc[0]);
2018  y1 = gPad->YtoAbsPixel(xndc[1]);
2019  dpoint2 = (px-x1)*(px-x1) + (py-y1)*(py-y1);
2020  if (dpoint2 < dist) dist=(Int_t)dpoint2;
2021  }
2022  if (dist > 100) return dist;
2023  dist = Int_t(TMath::Sqrt(Double_t(dist)));
2024  if (dist<maxdist && fIsPaintingShape) gPad->SetSelected((TObject*)shape);
2025  return dist;
2026 }
2027 
2028 ////////////////////////////////////////////////////////////////////////////////
2029 /// Check time of finding "Where am I" for n points.
2030 
2031 void TGeoPainter::Test(Int_t npoints, Option_t *option)
2032 {
2033  fChecker->Test(npoints, option);
2034 }
2035 
2036 ////////////////////////////////////////////////////////////////////////////////
2037 ///--- Geometry overlap checker based on sampling.
2038 
2039 void TGeoPainter::TestOverlaps(const char* path)
2040 {
2041  fChecker->TestOverlaps(path);
2042 }
2043 
2044 ////////////////////////////////////////////////////////////////////////////////
2045 /// Check voxels efficiency per volume.
2046 
2048 {
2049  return fChecker->TestVoxels(vol);
2050 }
2051 
2052 ////////////////////////////////////////////////////////////////////////////////
2053 /// get the new 'unbombed' translation vector according current exploded view mode
2054 
2056 {
2057  memcpy(bombtr, tr, 3*sizeof(Double_t));
2058  switch (fExplodedView) {
2059  case kGeoNoBomb:
2060  return;
2061  case kGeoBombXYZ:
2062  bombtr[0] /= fBombX;
2063  bombtr[1] /= fBombY;
2064  bombtr[2] /= fBombZ;
2065  return;
2066  case kGeoBombCyl:
2067  bombtr[0] /= fBombR;
2068  bombtr[1] /= fBombR;
2069  bombtr[2] /= fBombZ;
2070  return;
2071  case kGeoBombSph:
2072  bombtr[0] /= fBombR;
2073  bombtr[1] /= fBombR;
2074  bombtr[2] /= fBombR;
2075  return;
2076  default:
2077  return;
2078  }
2079 }
2080 
2081 ////////////////////////////////////////////////////////////////////////////////
2082 /// Compute weight [kg] of the current volume.
2083 
2085 {
2086  return fChecker->Weight(precision, option);
2087 }
2088 
2089 
TGeoOverlap * fOverlap
Definition: TGeoPainter.h:65
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:49
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:61
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:39
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:69
TGeoShape * fClippingShape
Definition: TGeoPainter.h:70
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:70
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:19
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:503
Bool_t IsDrawingExtra() const
Definition: TGeoManager.h:199
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:72
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:298
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:19
return c1
Definition: legend1.C:41
Definition: Rtypes.h:61
Int_t fVisLevel
Definition: TGeoPainter.h:54
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:58
virtual Double_t GetLatitude()=0
virtual void DrawPath(const char *path, Option_t *option="")
Draw all volumes for a given path.
Double_t DegToRad()
Definition: TMath.h:50
TH1 * h
Definition: legend2.C:5
Definition: Rtypes.h:60
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:61
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:308
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:63
void Skip()
Stop iterating the current branch.
Definition: TGeoNode.cxx:1231
See TView3D.
Definition: TView.h:29
SCoord_t fX
Definition: TPoint.h:37
virtual void SetTopVisible(Bool_t vis=kTRUE)
Set top geometry volume as visible.
Bool_t IsExtrusion() const
Definition: TGeoOverlap.h:88
void SetSelectedNode(TGeoNode *node)
Definition: TGeoChecker.h:90
TGeoHMatrix * fGlobal
Definition: TGeoPainter.h:66
Int_t fVisOption
Definition: TGeoPainter.h:55
#define gROOT
Definition: TROOT.h:364
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:23
Int_t LoadPlugin()
Load the plugin library for this handler.
SCoord_t fY
Definition: TPoint.h:38
Int_t GetLevel() const
Basic string class.
Definition: TString.h:137
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:410
void MasterToLocal(const Double_t *master, Double_t *local) const
Definition: TGeoManager.h:511
TGeoVolume * GetFirstVolume() const
Definition: TGeoOverlap.h:83
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1089
int Int_t
Definition: RtypesCore.h:41
Bool_t IsNodeSelectable() const
Definition: TGeoManager.h:200
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void Draw(Option_t *option="")
Draw this function with its current attributes.
Definition: TF1.cxx:1086
virtual void DrawPanel()
virtual void SetTitle(const char *title="")
Set graph title.
Definition: TGraph.cxx:2176
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.
Double_t GetStep() const
Definition: TGeoManager.h:382
Definition: Rtypes.h:61
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:3130
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:492
const char * Class
Definition: TXMLSetup.cxx:64
TGeoVolume * fTopVolume
Definition: TGeoPainter.h:71
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:306
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
Definition: TColor.h:54
Bool_t IsVisContainers() const
Definition: TGeoVolume.h:171
Short_t Abs(Short_t d)
Definition: TMathBase.h:110
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:747
Int_t GetVisLevel() const
Returns current depth to which geometry is drawn.
virtual Width_t GetLineWidth() const
Return the line width.
Definition: TAttLine.h:41
TGeoHMatrix * GetFirstMatrix() const
Definition: TGeoOverlap.h:85
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:874
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
Definition: TObject.cxx:165
Double_t fBombX
Definition: TGeoPainter.h:46
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition: TAttMarker.h:37
Int_t PushPath(Int_t startlevel=0)
Definition: TGeoManager.h:537
Int_t GetNdaughters() const
Definition: TGeoVolume.h:362
void MasterToLocalVect(const Double_t *master, Double_t *local) const
Definition: TGeoManager.h:512
void SetVisRaytrace(Bool_t flag=kTRUE)
Definition: TGeoAtt.h:72
void GetRange(Double_t &tmin, Double_t &tmax) const
Definition: TGeoElement.h:307
virtual Style_t GetLineStyle() const
Return the line style.
Definition: TAttLine.h:40
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:188
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.
TStopwatch timer
Definition: pirndm.C:37
void Stop()
Stop the stopwatch.
Definition: TStopwatch.cxx:77
Double_t x[n]
Definition: legend1.C:17
TObjArray * fVisVolumes
Definition: TGeoPainter.h:75
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:2335
Int_t GetLevel() const
Definition: TGeoNode.h:286
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 accordind 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:500
Bool_t fIsEditable
Definition: TGeoPainter.h:76
virtual void GetViewAngles(Double_t &longitude, Double_t &latitude, Double_t &psi)
Get the current view angles.
Bool_t IsVisOnly() const
Definition: TGeoVolume.h:173
A geometry iterator.
Definition: TGeoNode.h:255
TGeoNode * fCheckedNode
Definition: TGeoPainter.h:64
TGeoHMatrix * GetMatrix(Int_t level=-1) const
Return global matrix for node at LEVEL.
void SetMatrixReflection(Bool_t flag=kTRUE)
Definition: TGeoManager.h:395
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:135
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:114
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:190
virtual Double_t GetDview() const =0
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:43
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:169
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition: TAttMarker.h:38
void LocalToMaster(const Double_t *local, Double_t *master) const
Definition: TGeoManager.h:508
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:406
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:50
static void SetTransform(TGeoMatrix *matrix)
Set current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:546
TGeoNode * GetCurrentNode() const
Definition: TGeoManager.h:484
void Error(const char *location, const char *msgfmt,...)
virtual void TestOverlaps(const char *path)
— Geometry overlap checker based on sampling.
virtual void SetPoints(Double_t *points) const =0
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:1534
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:48
Definition: TPoint.h:33
Int_t GetNconvex() const
Definition: TGeoPolygon.h:57
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
point * points
Definition: X3DBuffer.c:20
Int_t GetNvert() const
Definition: TGeoPolygon.h:56
Int_t GetRTmode() const
Definition: TGeoManager.h:435
Class handling Boolean composition of shapes.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:46
Char_t GetTransparency() const
Definition: TGeoVolume.h:203
Double_t fBombY
Definition: TGeoPainter.h:47
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:1394
virtual Double_t Weight(Double_t precision, Option_t *option="v")
Compute weight [kg] of the current volume.
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:27
virtual void PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix *global=0)
Paint recursively a node and its content accordind to visualization options.
TRandom2 r(17)
#define gSize3D
Definition: X3DBuffer.h:42
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:59
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 arround current point.
tomato 2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:255
void SetStep(Double_t step)
Definition: TGeoManager.h:396
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:132
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:233
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Stub implementation to avoid forcing implementation at this stage.
Definition: TGeoShape.cxx:691
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:488
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
Bool_t IsVisDaughters() const
Definition: TGeoNode.h:117
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
char * Form(const char *fmt,...)
TGeoHMatrix * GetCurrentMatrix() const
Definition: TGeoManager.h:481
virtual const Double_t * GetOrigin() const
Definition: TGeoBBox.h:75
const Double_t * GetCurrentDirection() const
Definition: TGeoManager.h:487
Double_t E()
Definition: TMath.h:54
virtual void DefaultAngles()
Set default angles for the current view.
Double_t fBombR
Definition: TGeoPainter.h:49
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:19
TLine * l
Definition: textangle.C:4
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:45
TGeoNode * GetTopNode() const
Definition: TGeoManager.h:498
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:244
Bool_t PopPath()
Definition: TGeoManager.h:538
TGeoChecker * fChecker
Definition: TGeoPainter.h:69
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:73
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:46
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:362
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:389
Double_t Cos(Double_t)
Definition: TMath.h:424
TBuffer3D * fBuffer
Definition: TGeoPainter.h:67
virtual void SetVisOption(Int_t option=0)
set drawing mode : option=0 (default) all nodes drawn down to vislevel option=1 leaves and nodes at v...
virtual Color_t GetLineColor() const
Return the line color.
Definition: TAttLine.h:39
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:3117
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:3267
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:63
TGeoHMatrix * GetSecondMatrix() const
Definition: TGeoOverlap.h:86
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:91
TGeoVolume * GetSecondVolume() const
Definition: TGeoOverlap.h:84
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:402
#define ClassImp(name)
Definition: Rtypes.h:279
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:554
virtual Int_t CountVisibleNodes()
Count total number of visible nodes.
double Double_t
Definition: RtypesCore.h:55
Int_t GetNcoeff() const
Definition: TGeoElement.h:310
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()
-*-*-*-*-*-*-*-*-*-*Geometry painter default destructor-*-*-*-*-*-*-*-* *-* =========================...
void SetPaintVolume(TGeoVolume *vol)
Definition: TGeoManager.h:211
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 daughers of the volume containing this point...
Double_t y[n]
Definition: legend1.C:17
double func(double *x, double *p)
Definition: stressTF1.cxx:213
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
TObjArray * GetListOfPhysicalNodes()
Definition: TGeoManager.h:458
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:23
TGeoIteratorPlugin * fPlugin
Definition: TGeoPainter.h:74
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:2893
Int_t fExplodedView
Definition: TGeoPainter.h:56
static Double_t Big()
Definition: TGeoShape.h:90
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
Definition: TAttLine.h:48
Bool_t IsReflection() const
Definition: TGeoMatrix.h:80
Bool_t IsVisLeaves() const
Definition: TGeoVolume.h:172
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:36
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:538
TGeoVolume * fLastVolume
Definition: TGeoPainter.h:72
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.
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 arround current point.
void SetAttBit(UInt_t f)
Definition: TGeoAtt.h:67
void CheckGeometryFull(Bool_t checkoverlaps=kTRUE, Bool_t checkcrossings=kTRUE, Int_t nrays=10000, const Double_t *vertex=NULL)
Geometry checking.
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:51
static void SetPainter(const TVirtualGeoPainter *painter)
Static function to set an alternative histogram painter.
Bool_t IsVisDaughters() const
Definition: TGeoAtt.h:91
A 3D polymarker.
Definition: TPolyMarker3D.h:40
virtual void DrawShape(TGeoShape *shape, Option_t *option="")
Draw a shape.
Short_t Max(Short_t a, Short_t b)
Definition: TMathBase.h:202
const Double_t * GetCurrentPoint() const
Definition: TGeoManager.h:486
1-Dim function class
Definition: TF1.h:149
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:53
Double_t Sin(Double_t)
Definition: TMath.h:421
TObjArray * GetListOfVolumes() const
Definition: TGeoManager.h:463
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:102
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:57
TGeoNode * GetMother(Int_t up=1) const
Definition: TGeoManager.h:478
#define gPad
Definition: TVirtualPad.h:289
Int_t fNVisNodes
Definition: TGeoPainter.h:53
void Add(TObject *obj)
Definition: TObjArray.h:75
TPolyMarker3D * GetPolyMarker() const
Definition: TGeoOverlap.h:82
static void InitializeColors()
Initialize colors used by the TCanvas based graphics (via TColor objects).
Definition: TColor.cxx:1048
Definition: Rtypes.h:61
Int_t fNsegments
Definition: TGeoPainter.h:52
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition: TAttMarker.h:36
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:464
TGeoVolume * GetTopVolume() const
Definition: TGeoManager.h:497
TGeoManager * fGeoManager
Definition: TGeoPainter.h:68
Bool_t IsClosed() const
Definition: TGeoManager.h:279
TGeoShape * GetShape() const
Definition: TGeoVolume.h:204
TString fVisBranch
Definition: TGeoPainter.h:62
const Bool_t kTRUE
Definition: Rtypes.h:91
Bool_t IsVisible() const
Bool_t IsVisBranch() const
Definition: TGeoAtt.h:92
virtual void SetNsegments(Int_t nseg=20)
Set number of segments to approximate circles.
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:2128
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
return c3
Definition: legend3.C:15
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:106
Line Attributes class.
Definition: TAttLine.h:24
Double_t fMat[9]
Definition: TGeoPainter.h:51
char name[80]
Definition: TGX11.cxx:109
Bool_t fIsRaytracing
Definition: TGeoPainter.h:60
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:911
Double_t GetOverlap() const
Definition: TGeoOverlap.h:87
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:74
Bool_t IsVisible() const
Definition: TGeoNode.h:116
virtual Bool_t IsPerspective() const =0
const char * Data() const
Definition: TString.h:349
Stopwatch class.
Definition: TStopwatch.h:30
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.