63 return viewer && viewer->
IsA() && std::strcmp(viewer->
IsA()->
GetName(),
"TViewerX3D") == 0;
77 Error(
"ctor",
"No geometry loaded");
144 static Int_t npoints = 0;
156 for (i = 0; i < 3; i++)
162 for (i = 0; i < 3; i++) {
163 box[i] += ninv * (point[i] -
box[i]);
164 if (point[i] <
xmin[i])
166 if (point[i] >
xmax[i])
177 memcpy(bombtr, tr, 3 *
sizeof(
Double_t));
221 static Int_t color = 0;
224 for (
auto icol = 1; icol < 10; ++icol)
234 using IntMap_t = std::map<Int_t, Int_t>;
235 constexpr Int_t ncolors = 100;
238 static IntMap_t colmap;
241 auto it = colmap.find(base);
242 if (it != colmap.end())
243 return (it->second + light * (ncolors - 1));
249 if (it != colmap.end())
250 return (it->second + light * (ncolors - 1));
271 colmap[color] = color_map_idx;
272 return (color_map_idx + light * (ncolors - 1));
290 const Int_t big = 9999;
291 const Int_t inaxis = 7;
292 const Int_t maxdist = 5;
308 if (px < puxmin - inaxis)
310 if (py > puymin + inaxis)
312 if (px > puxmax + inaxis)
314 if (py < puymax - inaxis)
318 gPad->SetSelected(view);
327 if (dist < maxdist) {
328 gPad->SetSelected(crt);
339 if (dist < maxdist) {
340 gPad->SetSelected(crt);
351 if ((puxmax + inaxis - px) < 40) {
352 if ((py - puymax + inaxis) < 40) {
364 gPad->SetSelected(volume);
387 if (dist < maxdist) {
395 gPad->SetSelected(vol);
411 if (dist < maxdist) {
413 gPad->SetSelected(vol);
433 while ((daughter = next())) {
442 if (dist < maxdist) {
450 gPad->SetSelected(vol);
468 if (dist < maxdist) {
476 gPad->SetSelected(vol);
502 view->
SetView(-206, 126, 75, irep);
548 while ((daughter = next())) {
554 if (vis && level <= rlevel)
582 if (maxnodes <= 0 && top) {
596 for (
Int_t level = 1; level < 20; level++) {
604 if (nnodes > maxnodes) {
629 if ((
h =
gROOT->GetPluginManager()->FindHandler(
"TGeoManagerEditor"))) {
630 if (
h->LoadPlugin() == -1)
646 gPad->GetCanvas()->GetCanvasImp()->ShowEditor();
683 for (i = 0; i < ncoeff; i++) {
688 if (lambda < lambdamin && lambda > 0.)
692 thi = 10. / lambdamin;
714 Error(
"DrawPolygon",
"No vertices defined");
724 g1->
SetTitle(
Form(
"Polygon with %d vertices (outscribed %d)", nvert, nconv));
740 g2 =
new TGraph(nconv + 1, xc, yc);
750 gROOT->MakeDefCanvas();
780 gROOT->MakeDefCanvas();
809 gPad->GetViewer3D(option);
826 gROOT->MakeDefCanvas();
847 gPad->GetViewer3D(option);
871 gROOT->MakeDefCanvas();
880 gPad->GetViewer3D(option);
915 gROOT->MakeDefCanvas();
948 if (!
gPad->GetView())
952 if (!viewer || IsX3DViewer(viewer))
994 while ((obj = next())) {
995 if (strcmp(obj->
ClassName(),
"TGeoTrack"))
1006 while ((obj = next())) {
1007 if (strcmp(obj->
ClassName(),
"TGeoTrack"))
1104 info =
"wrong overlapping flag";
1109 ovtype =
"EXTRUSION";
1112 if (volume ==
fOverlap->GetFirstVolume())
1149 printf(
"Woops!!!\n");
1158 Int_t nframes = nfr;
1178 for (
Int_t i = 0; i < 3; i++)
1179 master[i] = -local[0] *
fMat[i] - local[1] *
fMat[i + 3] - local[2] *
fMat[i + 6];
1198 if (
gROOT->FromPopUp())
1211 is_padviewer = (!strcmp(
gPad->GetViewer3D()->ClassName(),
"TViewer3DPad")) ?
kTRUE :
kFALSE;
1231 for (inode = 0; inode < nnodes; inode++) {
1255 Int_t color, transparency;
1276 if (!strstr(option,
"range"))
1291 if (!strstr(option,
"range"))
1328 Int_t transparency = 0;
1331 if (!strstr(option,
"range"))
1347 if (!strstr(option,
"range"))
1389 Int_t line_color = 0, line_width = 0, line_style = 0;
1390 while ((daughter = next())) {
1396 drawDaughters =
kTRUE;
1406 if (!strstr(option,
"range"))
1442 if (!strstr(option,
"range"))
1469 fPlugin->SetIterator(
nullptr);
1484 return addDaughters;
1502 viewer->
AddObject(buffer, &addDaughters);
1519 return addDaughters;
1541 Int_t i, col, wid, sty;
1549 if (!strstr(option,
"range"))
1572 for (i = 1; i <= level; i++) {
1574 if (!strstr(option,
"range"))
1650 for (
Int_t i = 0; i < 3; i++)
1651 cov[i] = 0.5 * (min[i] + max[i]);
1653 for (
Int_t i = 0; i < 3; i++)
1654 cop[i] = cov[i] - dir[i] * dview;
1662 Int_t pxmin, pxmax, pymin, pymax;
1663 pxmin =
gPad->UtoAbsPixel(0);
1664 pxmax =
gPad->UtoAbsPixel(1);
1665 pymin =
gPad->VtoAbsPixel(1);
1666 pymax =
gPad->VtoAbsPixel(0);
1678 tosource[2] = -dir[2];
1684 Int_t base_color, color;
1690 Int_t ntotal = pxmax * pymax;
1694 for (px = pxmin; px < pxmax; px++) {
1695 for (py = pymin; py < pymax; py++) {
1696 if ((nrays % 100) == 0)
1697 checker->OpProgress(
"Raytracing", nrays, ntotal, timer,
kFALSE);
1701 Bool_t inclip = inclipst;
1702 xloc =
gPad->AbsPixeltoX(pxmin + pxmax - px);
1703 xloc = xloc * du - u0;
1704 yloc =
gPad->AbsPixeltoY(pymin + pymax - py);
1705 yloc = yloc * dv -
v0;
1706 modloc =
TMath::Sqrt(xloc * xloc + yloc * yloc + dproj * dproj);
1707 local[0] = xloc / modloc;
1708 local[1] = yloc / modloc;
1709 local[2] = dproj / modloc;
1765 nextnode =
fGeoManager->FindNextBoundaryAndStep();
1773 if (steptot > stemax) {
1803 for (
Int_t i = 0; i < 3; ++i)
1804 local[i] += 1.E-8 * dir[i];
1806 for (
Int_t i = 0; i < 3; ++i)
1807 local[i] += step * dir[i];
1816 calf = norm[0] * tosource[0] + norm[1] * tosource[1] + norm[2] * tosource[2];
1818 color =
GetColor(base_color, light);
1828 checker->OpProgress(
"Raytracing", nrays, ntotal, timer,
kTRUE);
1850 if ((ibomb < 0) || (ibomb > 3)) {
1851 Warning(
"SetExplodedView",
"exploded view can be 0-3");
1881 Warning(
"SetNsegments",
"number of segments should be > 2");
1910 if (
gPad->GetView()) {
1936 Warning(
"SetVisOption",
"wrong visualization option");
1976 const Int_t inaxis = 7;
1977 const Int_t maxdist = 5;
1978 const Int_t big = 9999;
1983 if (!(numpoints && view))
1994 if (px < puxmin - inaxis)
1996 if (py > puymin + inaxis)
1998 if (px > puxmax + inaxis)
2000 if (py < puymax - inaxis)
2002 if ((puxmax + inaxis - px) < 40) {
2009 fBuffer->SetRawSizes(numpoints, 3 * numpoints, 0, 0, 0, 0);
2015 for (
Int_t i = 0; i < numpoints; i++) {
2019 points[j + 1] = dmaster[1];
2020 points[j + 2] = dmaster[2];
2022 x1 =
gPad->XtoAbsPixel(xndc[0]);
2023 y1 =
gPad->YtoAbsPixel(xndc[1]);
2024 dpoint2 = (px - x1) * (px - x1) + (py - y1) * (py - y1);
2026 dist = (
Int_t)dpoint2;
2041 memcpy(bombtr, tr, 3 *
sizeof(
Double_t));
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
externTGeoManager * gGeoManager
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
virtual Color_t GetLineColor() const
Return the line color.
virtual void SetLineStyle(Style_t lstyle)
Set the line style.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual Style_t GetLineStyle() const
Return the line style.
virtual Style_t GetMarkerStyle() const
Return the marker style.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual Color_t GetMarkerColor() const
Return the marker color.
virtual Size_t GetMarkerSize() const
Return the marker size.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Generic 3D primitive description class.
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.
virtual void GetRGB(Float_t &r, Float_t &g, Float_t &b) const
static void InitializeColors()
static void HLS2RGB(Float_t h, Float_t l, Float_t s, Float_t &r, Float_t &g, Float_t &b)
static void RGB2HLS(Float_t r, Float_t g, Float_t b, Float_t &h, Float_t &l, Float_t &s)
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)
void SetTitle(const char *title="") override
Set the title of the TNamed.
void Draw(Option_t *option="") override
Default Draw method for all objects.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
Visualization and tracking attributes for volumes and nodes.
Bool_t TestAttBit(UInt_t f) const
Bool_t IsVisBranch() const
void ResetAttBit(UInt_t f)
Bool_t IsVisDaughters() const
Class representing the Bateman solution for a decay branch.
Double_t Concentration(Double_t time) const
Find concentration of the element at a given time.
void GetCoeff(Int_t i, Double_t &cn, Double_t &lambda) const
void GetRange(Double_t &tmin, Double_t &tmax) const
TGeoElementRN * GetElement() const
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.
const TGeoMatrix * GetCurrentMatrix() const
Returns global matrix for current node.
void SetTopName(const char *name)
Set the top name for path.
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.
virtual Int_t GetDefaultColor() const
Get some default color related to this material.
Geometrical transformation package.
Bool_t IsReflection() const
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...
Bool_t IsVisDaughters() const
Bool_t IsOnScreen() const
check if this node is drawn. Assumes that this node is current
TGeoVolume * GetVolume() const
Int_t GetNdaughters() const
Base class describing geometry overlaps.
TGeoVolume * GetSecondVolume() const
TPolyMarker3D * GetPolyMarker() const
TGeoHMatrix * GetFirstMatrix() const
TGeoHMatrix * GetSecondMatrix() const
TGeoVolume * GetFirstVolume() const
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.
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.
TGeoIteratorPlugin * fPlugin
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
void Raytrace(Option_t *option="") override
Raytrace current drawn geometry.
~TGeoPainter() override
Default destructor.
void SetVisOption(Int_t option=0) override
Set drawing mode :
Bool_t IsExplodedView() const override
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.
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.
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
Bool_t PaintShape(const TGeoShape &shape, Option_t *option) const
Paint the supplied shape into the current 3D viewer.
Int_t CountNodes(TGeoVolume *vol, Int_t level) const
Count number of visible nodes down to a given level.
void DrawShape(TGeoShape *shape, Option_t *option="") override
Draw a shape.
void DrawOnly(Option_t *option="") override
Draw only one volume.
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 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.
void PaintVolume(TGeoVolume *vol, Option_t *option="", TGeoMatrix *global=nullptr) override
Paint recursively a node and its content according to visualization options.
void SetNsegments(Int_t nseg=20) override
Set number of segments to approximate circles.
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.
void PaintPhysicalNode(TGeoPhysicalNode *node, Option_t *option="")
Paints a physical node associated with a path.
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 DrawBatemanSol(TGeoBatemanSol *sol, Option_t *option="") override
Draw the time evolution of a radionuclide.
void ExecuteShapeEvent(TGeoShape *shape, Int_t event, Int_t px, Int_t py) override
Execute mouse actions on a given shape.
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.
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
Physical nodes are the actual 'touchable' objects in the geometry, representing a path of positioned ...
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.
void GetVertices(Double_t *x, Double_t *y) const
Fill list of vertices into provided arrays.
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.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override=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.
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
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const =0
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
virtual void SetPoints(Double_t *points) const =0
TClass * IsA() const override
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Bool_t IsVisContainers() const
void SetLineWidth(Width_t lwidth) override
Set the line width.
TGeoMaterial * GetMaterial() const
Int_t GetNdaughters() const
void SetTransparency(Char_t transparency=0)
void SetLineColor(Color_t lcolor) override
Set the line color.
TGeoShape * GetShape() const
Bool_t IsVisLeaves() const
void SetLineStyle(Style_t lstyle) override
Set the line style.
virtual Bool_t IsAssembly() const
Returns true if the volume is an assembly or a scaled assembly.
Char_t GetTransparency() const
virtual Bool_t IsVisible() const
void Draw(Option_t *chopt="") override
Default Draw method for all objects.
void SetTitle(const char *title="") override
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
TObject * UncheckedAt(Int_t i) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
TObject()
TObject constructor.
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.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
void ToLower()
Change string to lower-case.
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
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.
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
static void SetPainter(const TVirtualGeoPainter *painter)
Static function to set an alternative histogram painter.
TVirtualGeoPainter(TGeoManager *manager)
Geometry painter default constructor.
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
TClass * IsA() const override
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)
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Double_t Sqrt(Double_t x)
Returns the square root of x.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.