Hi Rooters, Andrei,
sorry to bother you now...
I'm using CVS head, and noticed a bit strange behaviour of the method in topic. The following macro shows a few rectangles around the imaginary beampipe, which I want to align. I create a new TGeoCombiTrans as Align() argument, printing them shows the desired values, and in the same time _all_ the physical nodes get aligned by the last of the TGeoCombiTrans...
Could you please have a look and point the errors , if they're mine?
Regards
Michal
{
new TGeoManager("ID viewer","ID");
TGeoMaterial *vac_mat = new TGeoMaterial("Vacuum",0,0,0);
TGeoMaterial *si_mat = new
TGeoMaterial("Silicon",gGeoManager->GetElementTable()->FindElement("silicon"),2.3);
si_mat->SetTransparency(50); //translucent silicon
TGeoMedium *vac = new TGeoMedium("Vacuum",1,vac_mat);
TGeoMedium *si = new TGeoMedium("Silicon",1,si_mat);
TGeoVolume *id_box = gGeoManager->MakeBox("ID_box",vac,600,600,3000);
gGeoManager->SetTopVolume(id_box);
Int_t n= 5;
TGeoVolume *point = gGeoManager->MakeSphere("interaction_point",si,0,10);
TGeoVolume *pipe = gGeoManager->MakeTube("pipe",si,30,35,40);
TGeoVolume *pi_bar = gGeoManager->MakeSphere("pi_bar",vac,0,1);
TGeoVolume *pi_bar_theor =
gGeoManager->MakeTrd1("pi_bar_theor",si,8.2,8.2,.1,30.4);
TGeoVolume *pi_bar_real =
gGeoManager->MakeTrd1("pi_bar_real",si,8.2,8.2,.1,30.4);
pi_bar->AddNode(pi_bar_theor,0);
pi_bar->AddNode(pi_bar_real,1);
point->SetLineColor(kRed);
pi_bar_theor->SetLineColor(kYellow);
pi_bar_real->SetLineColor(kGreen);
TGeoRotation *rot = new TGeoRotation();
TGeoTranslation *tr = new TGeoTranslation();
TGeoCombiTrans *pos[n];
for (Int_t i=0; i< n;i++){
tr->SetTranslation(12*i,12*(5-i),20);
rot->SetAngles(-18*i,0,0);
pos[i]= new TGeoCombiTrans(*tr,*rot);
id_box->AddNode(pi_bar,i,pos[i]);
}
id_box->AddNode(pipe,i+1);
id_box->AddNode(point,i+2);
TString toppath = "/"+ TString(gGeoManager->GetTopNode()->GetName()) +"/";
TString path = toppath;
TString volname;
gGeoManager->CloseGeometry();
for (Int_t i=0; i<n; i++) {
volname = id_box->GetNode(i)->GetName();
path +=volname ;
path += "/";
volname = volname.Remove(volname.Last('_'),7);
path += volname ;
path += "_real_1";
cout<<path<<endl;
gGeoManager->MakePhysicalNode(path);
path=toppath;
}
gGeoManager->CloseGeometry();
id_box->Draw();
TGeoCombiTrans *corr[n];
for (Int_t i=0; i<n; i++) {
tr->SetTranslation(i,0,0);
rot->SetAngles(10*i,0,0);
corr[i] = new TGeoCombiTrans(*tr,*rot);
gGeoManager->GetPhysicalNode(i)->Align(corr[i]);
}
id_box->Draw();
for (Int_t i=0; i<n; i++) {corr[i]->Print();}
}
Received on Tue Feb 07 2006 - 19:24:34 MET
This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:31:57 MET