Re: Re: Different displays of TGeo Union in TPad/X3D and OpenGL

From: Andrei Gheata <Andrei.Gheata_at_cern.ch>
Date: Fri, 16 Feb 2007 11:07:11 +0100


Hi Brett,

The attached patch should solve the problem: composites with several CSG levels ignored the global matrix of the volume having this shape.

Thanks for reporting this,
Andrei

Brett Viren wrote:
> Hi again,
>
> Andrei Gheata <Andrei.Gheata_at_cern.ch> writes:
>

>> No, this is not a feature, but a bug related to the visualization of
>> this shape in GL. Visualization of TGeo composite shapes was
>> implemented quite long ago by Timur Pocheptsov (the end remark in the
>> class docs is no longer valid). Looks like some matrix it passed in a
>> wrong way to GL interface, this is why you see the gap. I wonder if
>> Timur can look into it. A geometry definition made with a simple macro
>> (not by conversion via VGM) would also help.

>
> I saved the problematic geometry as a .C file (appended). When
> re-running it, the OpenGL artifact remains, so it is useful as a
> pure-ROOT demonstration of the problem. I tried running this on some
> older releases and find:
>
> 5.14/00 - fails
> 5.12/00 - fails
> 5.11/02 - okay.
>
> The only strangeness in the generated macro itself that I could see is
> that some of the TGeoRotations are given empty strings for names.
> Adding in non-empty names had no effect. The appended file has these
> empty strings filled in. It isn't clear to me why these rotations are
> there in the first place as there are no rotations in the original
> geometry.
>
>
> -Brett.
>
> // --- pmt.C showing OpenGL artifact --- //
> /* run like:
>
> root -l pmt.C
> top = gGeoManager->GetTopVolume()
> top->Draw()
> Menu: "View"->"View With"->"OpenGL"
>
> */
>
> void pmt() {
> gSystem->Load("libGeom");
> new TGeoManager("VGM Root geometry", "VGM Root geometry");
>
> Double_t dx,dy,dz;
> Double_t dx1, dx2, dy1, dy2;
> Double_t vert[20], par[20];
> Double_t theta, phi, h1, bl1, tl1, alpha1, h2, bl2, tl2, alpha2;
> Double_t twist;
> Double_t origin[3];
> Double_t rmin, rmax, rmin1, rmax1, rmin2, rmax2;
> Double_t r, rlo, rhi;
> Double_t phi1, phi2;
> Double_t a,b;
> Double_t point[3], norm[3];
> Double_t rin, stin, rout, stout;
> Double_t thx, phx, thy, phy, thz, phz;
> Double_t alpha, theta1, theta2, phi1, phi2, dphi;
> Double_t tr[3], rot[9];
> Double_t z, density, radl, absl, w;
> Double_t lx,ly,lz,tx,ty,tz;
> Double_t xvert[50], yvert[50];
> Double_t zsect,x0,y0,scale0;
> Int_t nel, numed, nz, nedges, nvert;
> TGeoBoolNode *pBoolNode = 0;
>
> // MATERIALS, MIXTURES AND TRACKING MEDIA
> // Material: Air
> a = 12.006700;
> z = 7.000000;
> density = 0.001205;
> radl = 26914.614250;
> absl = 0.000000;
> pMat1 = new TGeoMaterial("Air", a,z,density,radl,absl);
> pMat1->SetIndex(0);
> // Medium: Air
> numed = 0; // medium number
> par[0] = 0.000000; // isvol
> par[1] = 0.000000; // ifield
> par[2] = 0.000000; // fieldm
> par[3] = 0.000000; // tmaxfd
> par[4] = 0.000000; // stemax
> par[5] = 0.000000; // deemax
> par[6] = 0.000000; // epsil
> par[7] = 0.000000; // stmin
> pMed1 = new TGeoMedium("Air", numed,pMat1, par);
> // Material: Water
> a = 1.007970;
> z = 1.000000;
> density = 1.000000;
> radl = 57.838822;
> absl = 0.000000;
> pMat5 = new TGeoMaterial("Water", a,z,density,radl,absl);
> pMat5->SetIndex(4);
> // Medium: Water
> numed = 4; // medium number
> par[0] = 0.000000; // isvol
> par[1] = 0.000000; // ifield
> par[2] = 0.000000; // fieldm
> par[3] = 0.000000; // tmaxfd
> par[4] = 0.000000; // stemax
> par[5] = 0.000000; // deemax
> par[6] = 0.000000; // epsil
> par[7] = 0.000000; // stmin
> pMed5 = new TGeoMedium("Water", numed,pMat5, par);
>
> // TRANSFORMATION MATRICES
> // Combi transformation:
> dx = 0.000000;
> dy = 0.000000;
> dz = -5.000000;
> // Rotation:
> thx = 90.000000; phx = 0.000000;
> thy = 90.000000; phy = 90.000000;
> thz = 0.000000; phz = 0.000000;
> TGeoRotation *pMatrix7 = new TGeoRotation("pMatrix7",thx,phx,thy,phy,thz,phz);
> pMatrix6 = new TGeoCombiTrans("pMatrix6", dx,dy,dz,pMatrix7);
> // Shape: bigbox type: TGeoBBox
> dx = 20.000000;
> dy = 20.000000;
> dz = 20.000000;
> TGeoShape *pbigbox_1 = new TGeoBBox("bigbox", dx,dy,dz);
> // Volume: bigbox
> pbigbox_8446548 = new TGeoVolume("bigbox",pbigbox_1, pMed1);
> pbigbox_8446548->SetVisLeaves(kTRUE);
>
> // SET TOP VOLUME OF GEOMETRY
> gGeoManager->SetTopVolume(pbigbox_8446548);
>
> // SHAPES, VOLUMES AND GEOMETRICAL HIERARCHY
> // Shape: bulb type: TGeoSphere
> rmin = 11.500000;
> rmax = 12.500000;
> theta1 = 0.000000;
> theta2 = 66.421822;
> phi1 = 0.000000;
> phi2 = 360.000000;
> TGeoShape *pbulb_2 = new TGeoSphere("bulb",rmin,rmax,theta1, theta2,phi1,phi2);
> // Shape: butt type: TGeoSphere
> rmin = 11.500000;
> rmax = 12.500000;
> theta1 = 113.578178;
> theta2 = 156.421822;
> phi1 = 0.000000;
> phi2 = 360.000000;
> TGeoShape *pbutt_3 = new TGeoSphere("butt",rmin,rmax,theta1, theta2,phi1,phi2);
> // Shape: base type: TGeoTubeSeg
> rmin = 4.000000;
> rmax = 5.000000;
> dz = 3.500000;
> phi1 = 0.000000;
> phi2 = 360.000000;
> TGeoShape *pbase_4 = new TGeoTubeSeg("base",rmin,rmax,dz,phi1,phi2);
> // Combi transformation: boolean_butt_base
> dx = 0.000000;
> dy = 0.000000;
> dz = -14.956439;
> // Rotation:
> thx = 90.000000; phx = 0.000000;
> thy = 90.000000; phy = 90.000000;
> thz = 0.000000; phz = 0.000000;
> TGeoRotation *pMatrix3 = new TGeoRotation("pMatrix3",thx,phx,thy,phy,thz,phz);
> pMatrix2 = new TGeoCombiTrans("boolean_butt_base", dx,dy,dz,pMatrix3);
> pBoolNode = new TGeoUnion(pbutt_3,pbase_4,0,pMatrix2);
> // Shape: boolean_butt_base type: TGeoCompositeShape
> TGeoShape *pboolean_butt_base_5 = new TGeoCompositeShape("boolean_butt_base", pBoolNode);
> pboolean_butt_base_5->SetTitle("butt+base:boolean_butt_base");
> // Combi transformation: boolean_bulb_boolean_butt_base
> dx = 0.000000;
> dy = 0.000000;
> dz = 10.000000;
> // Rotation:
> thx = 90.000000; phx = 0.000000;
> thy = 90.000000; phy = 90.000000;
> thz = 0.000000; phz = 0.000000;
> TGeoRotation *pMatrix5 = new TGeoRotation("pMatrix5",thx,phx,thy,phy,thz,phz);
> pMatrix4 = new TGeoCombiTrans("boolean_bulb_boolean_butt_base", dx,dy,dz,pMatrix5);
> pBoolNode = new TGeoUnion(pbulb_2,pboolean_butt_base_5,0,pMatrix4);
> // Shape: boolean_bulb_boolean_butt_base type: TGeoCompositeShape
> TGeoShape *pboolean_bulb_boolean_butt_base_6 = new TGeoCompositeShape("boolean_bulb_boolean_butt_base", pBoolNode);
> pboolean_bulb_boolean_butt_base_6->SetTitle("bulb+boolean_butt_base:boolean_bulb_boolean_butt_base");
> // Volume: bulb
> pbulb_8440f00 = new TGeoVolume("bulb",pboolean_bulb_boolean_butt_base_6, pMed5);
> pbulb_8440f00->SetVisLeaves(kTRUE);
> pbigbox_8446548->AddNode(pbulb_8440f00, 0, pMatrix6);
>
> // CLOSE GEOMETRY
> gGeoManager->CloseGeometry();
> }
>

Received on Fri Feb 16 2007 - 11:12:50 CET

This archive was generated by hypermail 2.2.0 : Fri Feb 16 2007 - 11:50:01 CET