View Composite Shape with the GL viewer

Hi,

i currently got trouble when i want to view a composite shape with the root GL-viewer.

i’ve build a composite shape by using:

TGeoBBox *ApertureBox = new TGeoBBox("ApertureBox", 12.5, 12.5, 0.25);
TGeoTube *ApertureHole = new TGeoTube("ApertureHole", 2.5, 2.5, 0.25);
TGeoCompositeShape *ApertureCS = new TGeoCompositeShape("ApertureCS", "ApertureBox-ApertureHole");
TGeoVolume *Aperture = new TGeoVolume("Aperture", ApertureCS, medTa);
Aperture -> SetLineColor(34);
TGeoTranslation *ApTr = new TGeoTranslation(0, 0, 80);
World -> AddNode(Aperture, 2, ApTr);
TCanvas *c1 = new TCanvas("c1", "c1", 800, 600);
c1 -> Draw();
geom -> CloseGeometry();
geom -> SetNsegments(120);
World -> Draw("ogl");

It should be a box with a hole in it, i can see the hole when i don’t use ogl an only use the Draw command.
But i want to see it also within the GL Viewer.
What i am doing wrong?

Thanks
Johannes

Hi,

Your example is not complete and does not run. Here’s output I get with trunk:

Info in <TGeoManager::TGeoManager>: Geometry Geometry, default geometry created
Error in <TGeoTube::SetTubeDimensions>: In shape ApertureHole wrong rmin=2.5 rmax=2.5
Error: Symbol medTa is not defined in current scope  sabo.C:5:
*** Interpreter error recovered ***

Try setting rmin to 0.

I don’t think you actually see a hole with std viewer … it’s just a tubular sheet of zero thickness.

If it still doesn’t work please attach a code that actually runs :wink:

Cheers,
Matevz

Hi,

youre right, i’ve only posted a code snippet where i create my composite shape.
I actual try to get used to the the use of the geo class.
I’ve attached the the code which should run.

Cheers
Johannes
geo.cxx (3.48 KB)

[url]OpenGL viewer and transparency
geo.cxx (3.62 KB)

Hi,

thanks for reply, but this doens’t solve the problem which i have with composite geometrys.
The apertures hole isn’t showing up and also the lids (top and bottom) of my scattering chamber aren’t there, when i take a look of my setup in the open gl viewer.

The SetTransparency thing works but this is something which i will most probably need when the composite geometries where shown in the right manner.

Cheers
Johannes

Hi,

Can you post your latest version of the code, too … this way we can talk about the same thing :slight_smile:

Cheers,
Matevz

Hi!

Yes of course, but there isn’t realy a change within the code.
I’ve tried to follow the advise of Wile E. Coyote.
But i don’t want to make things transparent, i want that when i create composite shape like an aperture with an hole in the middle that this will be shown correctly within the gl-viewer.
At the moment the hole is invisible, but you can see it in the wire construction.
Also the scattering chamber should have lids. These are correctly shown within the wire construction but within the gl-viewer you can only see the main body (a tube with a certain inner diamter > 0).
Attached you’ll find the actual code.

Thanks and Cheers
Jo
geo.cxx (3.64 KB)

Hi,

The aperture hole had to small dz so you got rounding errors produce a “covered hole”. I increased the dz to 0.3 and it shows up fine:
TGeoTube *ApertureHole = new TGeoTube(“ApertureHole”, 0., 2.5, 0.3);

The lids are there :slight_smile:

Cheers,
Matevz

Actually, it is sufficient to increase the “dz” of the “ApertureHole” to “0.25 + 1.E-16” or to decrease the “dz” of the “ApertureBox” to “0.25 - 1.E-16”.

Ah,
Thanks to both of you, i don’t know why i haven’t fiddle around with dz.
Ok but still, there is the “problem”, that the lids of the scattering chamber won’t show up.
Any idea on that.

Thanks again.
Jo

I think we both claim that we see both lids. If I “remove” any one of them from the “ScatteringChamberMain + ScatteringChamberLid:LidTr1 + ScatteringChamberLid:LidTr2”, I can immediately see the difference (no lid on one side).

Um, ok.
could you please be so kind and post an screenshot of that?
Because i realy see nothing within the OpenGL viewer.
Maybe there is something else going wrong on my system…

Cheers
Jo

After removing " + ScatteringChamberLid:LidTr2" (ROOT 5.34 and/or 5.28):



Ok,
in this case i have a Problem, because this isn’t showing up on my computer.
My Root Verison is 5.34/01.
Attached you can see my output.

Cheers
Johannes

Which operating system? Which compiler?

Hi,
at the moment i am loading the code within root with help of the .L geo.cxx++ command.
My operating system is fedora 16, gcc -v list:

Es werden eingebaute Spezifikationen verwendet. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/lto-wrapper Ziel: x86_64-redhat-linux Konfiguriert mit: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --disable-build-with-cxx --disable-build-poststage1-with-cxx --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread-Modell: posix gcc-Version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)

Cheers Johannes

Hi,

This is really strange … I don’t think this could be related to your compiler.

Can you try 5.34.3 (released two weeks back) or trunk? There weren’t many changes in geom / gl but that’s the only difference that could be relevant.

Matevz

Hi,

yes at the moment i even don’t know where to look.
At the moment i update my root version to the latest and will try again.
Could you please be so kind to upload the exact code with which you get the output you’ve uploaded?
Maybe i’ve done something stupid with my code in the meanwhile.

Thanks and cheers
Johannes

Hi there,

problem solved, i updated my root version and now everything seems to work.
Thanks for your support! :smiley:

Cheers
Johannes

Yay! :slight_smile: