Xtru with loop

Hello everybody,

I try to make an object with the class XTRU.

I defined polygon and sections and it works perfectly.

But, when i try to use this in a loop, that doesn t work I explain:

Part of the code to define my Xtru class:

double x[8]={...}; double y[8]={...}; TGeoXtru *xtru=new TGeoXtru(2); xtru->DefineSection(0,-160,0,0,1}; xtru->DefineSection(0,-160,0,0,1};

And then, if i build:

it works

but i want to make a loop and that doesn t work

TGeoVolume *a[50]; for(int i=0;i<50;i++){ a[i] = geom->MakeXtru((TString::Format("a_%s",&i)).Data(),medium ,xtru); }

Could you please help me and show me what is wrong ?

I solved the pb.

For people with the same problem, the solution is:

In the loop, you have to write:

TGeoVolume *a[50]; for(int i=0;i<50;i++){ a[i] = geom->MakeXtru((TString::Format("a_%s",&i)).Data(),medium ,nz); TGeoXtru *XtruShape=(TGeoXtru *)a[i]->GetShape(); XtruShape ->DefinePolygon(.....); XtruShape->DefineSection(.....); XtruShape->DefineSection(.....); ..... //same nomber of XtruShape->DefineSection(.....); than nz }