Problem with sector's angles when divide TGeoPgon

ROOT Version: 6.32.02
Platform: Fedora 39
Compiler: G++ 13.2.0

Hi,
I’m working with a TGeoPgon object. After dividing this object using Divide, I get a TGeoVolumeMulti, to which I add a node, which is added to all child TGeoVolumes of my TGeoPgon.

The problem is that the node is added to each of the child Volumes with an offset of 360/nSectors, and not 360/(nSectors * 2) as I expect. As a result, it turns out that the figures from neighboring Volumes are each rotated by 30 degrees (I have 12 sectors), and not by 15, due to which I get a total angle between them of 60 degrees, and not 30, which completely breaks the regular dodecagon that I am building.

Attempts to somehow influence the insertion offset using TGeoCombiTrans did not bring any results. Apparently, when adding a node to TGeoVolumeMulti, a forced offset occurs at a fixed angle, which I was unable to change.

Perhaps I am not working correctly with this object, or I am missing another way to influence the node offset angle when inserting.

Below is a code fragment with the creation of TGeoPgon and adding a node there.

Thanks in advance for your answer

// Create TGeoPgon
TGeoPgon *pgon = new TGeoPgon("MainPolygon", 0, 360, 12, 2);
pgon->DefineSection(0, secGeo.GetZMin(), secGeo.GetYPadAreaLowerEdge(), secGeo.GetRmax());
pgon->DefineSection(0, secGeo.GetZMax(), secGeo.GetYPadAreaLowerEdge(), secGeo.GetRmax());

TGeoMedium *air = new TGeoMedium("Air", 1, new TGeoMaterial("Material", 0, 0, 0));
TGeoVolume *SectorBaseVolume = new TGeoVolume("SectorVolume", pgon, air);

// Add sensor
TGeoVolume *dividedSetcorVolume = SectorBaseVolume->Divide("divPgon", 2, 12, 0, -1);
TGeoVolume *innerSensorVolume = makeSensorVolume(geoManager, medium, secGeo.GetPadHeight()[0] * 0.5, secGeo.GetPadWidth()[0] * 0.5, secGeo.GetDriftLength() * 0.5, 0);

Double_t x = secGeo.GetYPadAreaLowerEdge();
Double_t y = 0;
Double_t z = 0;
dividedSetcorVolume->AddNode(currentSensorVolume, 1, new TGeoTranslation(x, y, z));

Welcome to the ROOT Forum!
Maybe @agheata can help with this

1 Like

When you divide a TGeoPgon, you get a “cell” volume placed several times in the original shape. If you divide in phi with a number of divisions equal to the number of polygon edges, you get a trapezoid prism cell at phi=0 (symmetric about the Y axis like in the attached figure in top view)
pgon_div
So you need to place other volumes correctly only in this shifted cell, the content will appear in all the others. If you still don’t manage to get what you want, please attach a simplified working example showing the feature.

This part of the code demonstrates the whole problem, below I have attached screenshots [1], [2] with the result I get when executing the code. I pass the x coordinate as a constant and in theory all layers should be strictly at an angle of 90 degrees to the centre, but in the end this does not happen.

const Double_t x = 10.0;
const Double_t z = .0;
for (int i = 0; i < 10; ++i) { 
   Double_t y = i * 0,5; // 0,5 - it's a width of sensorVolume 
   dividedSetcorVolume->AddNode(sensorVolume, i, new TGeoTranslation(x, y, z));
}


As I wrote, I need a reproducer, i.e. a simple macro that I can run standalone, which the snippet you quoted isn’t. I tried the following myself, without being able to reproduce the rotations from your snapshot:

void reproducer() {
   new TGeoManager("pgon", "");
   TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7);
   TGeoMedium *med = new TGeoMedium("MED",1,mat);
   TGeoVolume *top = gGeoManager->MakeBox("TOP",med,150,150,100);
   gGeoManager->SetTopVolume(top);
   TGeoVolume *vol = gGeoManager->MakePgon("PGON",med, 0,360,12,2);
   TGeoPgon *pgon = (TGeoPgon*)(vol->GetShape());
   pgon->DefineSection(0,-70,25,50);
   pgon->DefineSection(1,70,25,50);
   TGeoVolume *dividedSetcorVolume = vol->Divide("divPgon", 2, 12, 0, -1);
   dividedSetcorVolume->SetLineColor(kBlue);
   dividedSetcorVolume->SetLineStyle(3);
   TGeoVolume *sensor = gGeoManager->MakeBox("sensor",med,12.5, 5, 1);
   sensor->SetLineColor(kRed);
   dividedSetcorVolume->AddNode(sensor, 1, new TGeoTranslation(25+12.5, 0, 0));
   top->AddNode(vol,1);
   gGeoManager->CloseGeometry();
   vol->SetVisContainers();
   vol->Draw();
}

Thank you very much! Comparing my implementation with your example, I realized that 0 to y of the sectors is in their centre, not in the corner. This is where the presented behaviour arose from

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.