TGeoCompositeShape inconsistency or possible improvement

See second post
So I went to use the TGeoCompositeShape class and it is quite confusing why you would use the name of the TGeoVolume to do the boolean operation but not the name of the transformation matrix.
From the class documentation:

      TGeoTranslation *t1 = new TGeoTranslation("T1",0,0,-20);
      TGeoTranslation *t2 = new TGeoTranslation("T2",0,0, 20);
      TGeoRotation *r1 = new TGeoRotation("R1"); // transformations need names
      r1->SetAngles(90,30,90,120,0,0); // rotation with 30 degrees about Z
      TGeoTube *a = new TGeoTube(0, 10,20);
      a->SetName("A");                 // shapes need names too
      TGeoTube *b = new TGeoTube(0, 20,20);
      TGeoBBox *c = new TGeoBBox(10,10,50);
      TGeoBBox *d = new TGeoBBox(50,10,10);

      TGeoCompositeShape *cs;
      cs = new TGeoCompositeShape("CS", "(A:t1+B:t2)\(C+D:r1)");

Seems to me, for consistency, the last line should read like this:

      cs = new TGeoCompositeShape("CS", "(A:T1+B:T2)\(C+D:R1)");

That is instead of “t1” you should use the name “T1”.
I would assume this is why you would say that transformations need names?
This would be a nicer implementation because I can do a loop, creating different matrices and changing the name, and still easily use arrays of pointers.


Page 328 of the users manual…

What is the downside of doing this automatically if gGeoManager exists?


Right, all the lower case transformations names should read in upper case (i.e. transformation names). Some transformations are just temporarily created in order to create the final one, so it is not good to book them all to the manager. Note that transformations used for positioning (TGeoVolume::AddNode) are automatically registered.


Note that there is a better alternative of using a formula in case you need this in a loop. See class TGeoBoolNode : you can create intermediate composite shapes to assemble your final one.