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