Hi Rooters,
I would like to produce a set of 10 cones, all with different rmax1, rmax2, and dz. Whilst I realise the easiest, and most direct, way to do this would be to simply write out 10 different lines, I will eventually want to extend to 499 cones. Thus I wish to know if it is possible to initialize a shape and then create a node to position the shape in a ‘FOR’ loop such that every time round the loop a new shape and node is created?
Something that effectively does:
For(Int_t i= 0; i<10; i++) {
dz = some function of i;
rmax1 = some function of i;
rmax2= some function of i;
TCONE *cone_i = new TCONE(“cone_i”, “cone_i”, “cone_material”, dz, rmax1, rmax2);
TNode *node_i = new TNode(“node_i”, “node_i”, cone_i);
}
Do I need to convert the int to a string first … like:
TCONE *Form(“cone_%d”,i) = … ?
Please excuse me for not including the actual code, but I havn’t written it yet! I just wish to know the feasibility of this before starting. If anyone needs more info just say.
Thanks,
Rich