I resume this topic because I’m trying to draw the layout of a drift chamber made of wires inside tubes and I encountered problems setting Fill attributes and Transparency of tubes: I’m not able to draw solid objects.
Although [color=#0000FF]TGeoVolume::GetFillStyle()[/color] give me [color=#0000FF]1001[/color] I used [color=#0000FF]TGeoVolume::SetFillStyle(1001)[/color] and [color=#0000FF]TGeoVolume::SetFillColor(17)[/color] without success.
So I tried with the same functions for [color=#0000FF]TGeoMaterial[/color]: nothing changed.
Then I attempted with [color=#0000FF]TGeoMaterial::SetTransparency(0)[/color] and [color=#0000FF]TGeoVolume::SetTransparency(0)[/color] but again only tubes lines were drawn.
The only way I found to draw solid tubes was [color=#0000FF]TGeoVolume::Raytrace()[/color] but this way I can’t set transparency so I can’t see wires inside tubes.
Someone can help me? I’m working on Scientific Linux and root version 5.18, I compile using [color=#0000FF].x lay_ch.C++[/color]. Below my code:
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->SetFillStyle(1001);
tmat->SetFillColor(17);
tmat->SetTransparency(0);
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[numtubes];
TGeoVolume *wire[numtubes];
TGeoTranslation T;
TGeoRotation R;
TGeoCombiTrans *M[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);
tube[i]->SetFillStyle(1001);
tube[i]->SetFillColor(17);
tube[i]->SetTransparency(0);
wire[i]->SetLineColor(46);
wire[i]->SetFillColor(46);
tube[i]->AddNode(wire[i],1);
top->AddNode(tube[i],1,M[i]);
}
top->SetVisContainers();
manager->CloseGeometry();
TCanvas *c3D = new TCanvas("c3D","Chamber Layout",1200,800);
top->Draw("");
return;
}