Hi,
This is probably what you want:
int numtubes = 5;
Float_t rintube[5] = {2.35, 2.35, 2.35, 2.35, 2.35};
Float_t d_wire[5] = {0.01, 0.01, 0.01, 0.01, 0.01};
Float_t z_min[5] = {-40.,-40.,-40.,-40.,-40.};
Float_t z_max[5] = { 40., 40., 40., 40., 40.};
Float_t x_f0[5] = {0.,-40.,-20., 20., 40.};
Float_t ytubes[5] = {10.,0.,0.,20.,0.};
void lay_ch()
{
TGeoManager *manager = new TGeoManager("Chamber Layout", "Chamber Layout");
TGeoMaterial *mat = new TGeoMaterial("Vacuum", 0.,0.,0.);
TGeoMaterial *tmat = new TGeoMaterial("TubeMat", 26.98,13.,2.700);
tmat->SetTransparency(50);
TGeoMaterial *wmat = new TGeoMaterial("WireMat", 63.546,29.,8.920);
TGeoMedium *med = new TGeoMedium("Vacuum", 0, mat);
TGeoMedium *tmed = new TGeoMedium("TubeMed", 0, tmat);
TGeoMedium *wmed = new TGeoMedium("WireMed", 0, wmat);
TGeoVolume *top = manager->MakeBox("Top",med,150.,183.65,120.);
manager->SetTopVolume(top);
TGeoVolume **tube = new TGeoVolume*[numtubes];
TGeoVolume **wire = new TGeoVolume*[numtubes];
TGeoTranslation T;
TGeoRotation R;
TGeoCombiTrans **M = new TGeoCombiTrans *[numtubes];
char tname[30], wname[30];
for (int i=0; i<numtubes; i++)
{
T.SetTranslation(x_f0[i], ytubes[i], 0.);
R.SetAngles(0.,0.,0.);
M[i]= new TGeoCombiTrans(T,R);
sprintf(tname, "Tube[%i]",i);
sprintf(wname, "wire[%i]",i);
tube[i] = manager->MakeTube(tname,tmed,rintube[i],rintube[i]+0.15,z_max[i]-z_min[i]);
wire[i] = manager->MakeTube(wname,wmed,0.,d_wire[i],z_max[i]-z_min[i]);
tube[i]->SetLineColor(17);
wire[i]->SetLineColor(46);
// tube[i]->AddNode(wire[i],1);
top->AddNode(tube[i],1,M[i]);
top->AddNode(wire[i],1,M[i]);
}
manager->CloseGeometry();
TCanvas *c3D = new TCanvas("c3D","Chamber Layout",1200,800);
delete [] tube;
delete [] wire;
delete [] M;
top->Draw("ogl");
}
Note that:
- TGeo does not use SetFillColor/SetFillStyle - the line color is used also as fill color
- you should not position a wire in the hole of a tube; any daughter volume should be contained inside the body of the mother volume. Rather position both with the same matrix in a common container.
- to visualize in solid mode with transparency you have to use the OpenGL viewer and just use: TGeoMaterial::SetTransparency(0 to 100) or TGeoVolume::SetTransparency(). Note that a transparency>50 will make a volume invisible in the normal pad.
- the changed macro above do produce transparent chambers - you see the wires only if you zoom (mouse wheel) since the wires are very thin.
Cheers,