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