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