Skip to content

Commit 7fad233

Browse files
sawenzelclaude
andcommitted
Carry the CPV geometry in double
This removes the gaps between the CPV frame and its active planes and converts the CPV geometry from float to double. - The frame and the active planes it touches were placed from two different float sums of the same plane, 38 nm apart in twelve pairs, and CPVF and CPVAr were 0.11 nm apart. - The GeometryParams members and getters, the shape half-lengths and the placement coordinates are double; the class version is bumped. - The twelve near-coincident face pairs in the CPV mother are gone. - In a PIPE plus CPV geometry, CPV hits under VecGeom navigation go from 0 to 6876, against 7392 with TGeo. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 9cbb000 commit 7fad233

2 files changed

Lines changed: 46 additions & 36 deletions

File tree

‎Detectors/CPV/simulation/include/CPVSimulation/GeometryParams.h‎

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class GeometryParams final : public TNamed
4040
return sGeomParam;
4141
}
4242

43-
void GetModuleAngle(int module, float angle[3][2]) const
43+
void GetModuleAngle(int module, double angle[3][2]) const
4444
{
4545
for (int i = 0; i < 3; i++) {
4646
for (int ian = 0; ian < 2; ian++) {
@@ -49,9 +49,9 @@ class GeometryParams final : public TNamed
4949
}
5050
}
5151

52-
float GetCPVAngle(Int_t index) const { return mCPVAngle[index - 1]; }
52+
double GetCPVAngle(Int_t index) const { return mCPVAngle[index - 1]; }
5353

54-
void GetModuleCenter(int module, float* pos) const
54+
void GetModuleCenter(int module, double* pos) const
5555
{
5656
for (int i = 0; i < 3; i++) {
5757
pos[i] = mModuleCenter[module][i];
@@ -61,18 +61,18 @@ class GeometryParams final : public TNamed
6161
int GetNModules() const { return mNModules; }
6262
int GetNumberOfCPVPadsPhi() const { return mNumberOfCPVPadsPhi; }
6363
int GetNumberOfCPVPadsZ() const { return mNumberOfCPVPadsZ; }
64-
float GetCPVPadSizePhi() const { return mCPVPadSizePhi; }
65-
float GetCPVPadSizeZ() const { return mCPVPadSizeZ; }
66-
float GetCPVBoxSize(int index) const { return mCPVBoxSize[index]; }
67-
float GetCPVActiveSize(int index) const { return mCPVActiveSize[index]; }
64+
double GetCPVPadSizePhi() const { return mCPVPadSizePhi; }
65+
double GetCPVPadSizeZ() const { return mCPVPadSizeZ; }
66+
double GetCPVBoxSize(int index) const { return mCPVBoxSize[index]; }
67+
double GetCPVActiveSize(int index) const { return mCPVActiveSize[index]; }
6868
int GetNumberOfCPVChipsPhi() const { return mNumberOfCPVChipsPhi; }
6969
int GetNumberOfCPVChipsZ() const { return mNumberOfCPVChipsZ; }
70-
float GetGassiplexChipSize(int index) const { return mGassiplexChipSize[index]; }
71-
float GetCPVGasThickness() const { return mCPVGasThickness; }
72-
float GetCPVTextoliteThickness() const { return mCPVTextoliteThickness; }
73-
float GetCPVCuNiFoilThickness() const { return mCPVCuNiFoilThickness; }
74-
float GetFTPosition(int index) const { return mFTPosition[index]; }
75-
float GetCPVFrameSize(int index) const { return mCPVFrameSize[index]; }
70+
double GetGassiplexChipSize(int index) const { return mGassiplexChipSize[index]; }
71+
double GetCPVGasThickness() const { return mCPVGasThickness; }
72+
double GetCPVTextoliteThickness() const { return mCPVTextoliteThickness; }
73+
double GetCPVCuNiFoilThickness() const { return mCPVCuNiFoilThickness; }
74+
double GetFTPosition(int index) const { return mFTPosition[index]; }
75+
double GetCPVFrameSize(int index) const { return mCPVFrameSize[index]; }
7676

7777
private:
7878
///
@@ -86,23 +86,23 @@ class GeometryParams final : public TNamed
8686
int mNModules; // Number of CPV modules
8787
int mNumberOfCPVPadsPhi; // Number of CPV pads in phi
8888
int mNumberOfCPVPadsZ; // Number of CPV pads in z
89-
float mCPVPadSizePhi; // CPV pad size in phi
90-
float mCPVPadSizeZ; // CPV pad size in z
91-
float mCPVBoxSize[3]; // Outer size of CPV box
92-
float mCPVActiveSize[2]; // Active size of CPV box (x,z)
89+
double mCPVPadSizePhi; // CPV pad size in phi
90+
double mCPVPadSizeZ; // CPV pad size in z
91+
double mCPVBoxSize[3]; // Outer size of CPV box
92+
double mCPVActiveSize[2]; // Active size of CPV box (x,z)
9393
int mNumberOfCPVChipsPhi; // Number of CPV Gassiplex chips in phi
9494
int mNumberOfCPVChipsZ; // Number of CPV Gassiplex chips in z
95-
float mGassiplexChipSize[3]; // Size of a Gassiplex chip (0 - in z, 1 - in phi, 2 - thickness (in ALICE radius))
96-
float mCPVGasThickness; // Thickness of CPV gas volume
97-
float mCPVTextoliteThickness; // Thickness of CPV textolite PCB (without moil)
98-
float mCPVCuNiFoilThickness; // Thickness of CPV Copper-Nickel moil of PCB
99-
float mFTPosition[4]; // Positions of the 4 PCB vs the CPV box center
100-
float mCPVFrameSize[3]; // CPV frame size (0 - in phi, 1 - in z, 2 - thickness (along ALICE radius))
101-
float mIPtoCPVSurface; // Distance from IP to CPV front cover
102-
float mModuleAngle[5][3][2]; // Orientation angles of CPV modules
103-
float mCPVAngle[5]; // Direction to the center of CPV modules in phi
104-
float mModuleCenter[5][3]; // Coordunates of modules centra in ALICE system
105-
ClassDefOverride(GeometryParams, 1);
95+
double mGassiplexChipSize[3]; // Size of a Gassiplex chip (0 - in z, 1 - in phi, 2 - thickness (in ALICE radius))
96+
double mCPVGasThickness; // Thickness of CPV gas volume
97+
double mCPVTextoliteThickness; // Thickness of CPV textolite PCB (without moil)
98+
double mCPVCuNiFoilThickness; // Thickness of CPV Copper-Nickel moil of PCB
99+
double mFTPosition[4]; // Positions of the 4 PCB vs the CPV box center
100+
double mCPVFrameSize[3]; // CPV frame size (0 - in phi, 1 - in z, 2 - thickness (along ALICE radius))
101+
double mIPtoCPVSurface; // Distance from IP to CPV front cover
102+
double mModuleAngle[5][3][2]; // Orientation angles of CPV modules
103+
double mCPVAngle[5]; // Direction to the center of CPV modules in phi
104+
double mModuleCenter[5][3]; // Coordunates of modules centra in ALICE system
105+
ClassDefOverride(GeometryParams, 2);
106106
};
107107
} // namespace cpv
108108
} // namespace o2

‎Detectors/CPV/simulation/src/Detector.cxx‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ void Detector::ConstructGeometry()
358358
CreateMaterials();
359359

360360
// Create a CPV modules-containers which will be filled with the stuff later.
361-
float par[3], x, y, z;
361+
double par[3], x, y, z;
362362

363363
// The box containing all CPV filled with air
364364
par[0] = geomParams->GetCPVBoxSize(0) / 2.0;
@@ -372,11 +372,11 @@ void Detector::ConstructGeometry()
372372
if (!mActiveModule[iModule]) {
373373
continue;
374374
}
375-
float angle[3][2] = {0};
375+
double angle[3][2] = {0};
376376
geomParams->GetModuleAngle(iModule, angle);
377377
Matrix(idrotm[iModule], angle[0][0], angle[0][1], angle[1][0], angle[1][1], angle[2][0], angle[2][1]);
378378

379-
float pos[3] = {0};
379+
double pos[3] = {0};
380380
geomParams->GetModuleCenter(iModule, pos);
381381

382382
fMC->Gspos("CPV", iModule, "barrel", pos[0], pos[1] + 30., pos[2], idrotm[iModule], "ONLY");
@@ -396,8 +396,8 @@ void Detector::ConstructGeometry()
396396
fMC->Gspos("CPVC", 1, "CPVG", 0, y, 0, 0, "ONLY");
397397

398398
// Position of the chip inside CPV
399-
float xStep = geomParams->GetCPVActiveSize(0) / (geomParams->GetNumberOfCPVChipsPhi() + 1);
400-
float zStep = geomParams->GetCPVActiveSize(1) / (geomParams->GetNumberOfCPVChipsZ() + 1);
399+
double xStep = geomParams->GetCPVActiveSize(0) / (geomParams->GetNumberOfCPVChipsPhi() + 1);
400+
double zStep = geomParams->GetCPVActiveSize(1) / (geomParams->GetNumberOfCPVChipsZ() + 1);
401401
int copy = 0;
402402
y = geomParams->GetCPVFrameSize(1) / 2 - geomParams->GetFTPosition(0) +
403403
geomParams->GetCPVTextoliteThickness() / 2 + geomParams->GetGassiplexChipSize(1) / 2 + 0.1;
@@ -451,10 +451,20 @@ void Detector::ConstructGeometry()
451451
par[2] = geomParams->GetCPVFrameSize(2) / 2;
452452
fMC->Gsvolu("CPVF2", "BOX ", getMediumID(ID_AL), par, 3);
453453

454+
// The frame's inner faces are the edges of the active plane. Deriving them from the box and
455+
// frame sizes instead of from the active size left CPVF2 38 nm away from CPVF and CPVAr:
456+
// algebraically the same plane, different float sums. TGeo relocates from a point pushed far
457+
// past a boundary and never notices; VecGeom answers DistanceToOut = -1 and gives the volume
458+
// back to its mother. Place the frame against the halves the active volumes were actually
459+
// given, so the faces land on the same double.
460+
const double activeHalfX = geomParams->GetCPVActiveSize(0) / 2;
461+
const double activeHalfZ = geomParams->GetCPVActiveSize(1) / 2;
462+
const double frameHalfX = geomParams->GetCPVFrameSize(0) / 2;
463+
const double frameHalfZ = geomParams->GetCPVFrameSize(2) / 2;
454464
for (int j = 0; j <= 1; j++) {
455-
x = TMath::Sign(1, 2 * j - 1) * (geomParams->GetCPVBoxSize(0) - geomParams->GetCPVFrameSize(0)) / 2;
465+
x = TMath::Sign(1, 2 * j - 1) * (activeHalfX + frameHalfX);
456466
fMC->Gspos("CPVF1", j + 1, "CPV", x, 0, 0, 0, "ONLY");
457-
z = TMath::Sign(1, 2 * j - 1) * (geomParams->GetCPVBoxSize(2) - geomParams->GetCPVFrameSize(2)) / 2;
467+
z = TMath::Sign(1, 2 * j - 1) * (activeHalfZ + frameHalfZ);
458468
fMC->Gspos("CPVF2", j + 1, "CPV", 0, 0, z, 0, "ONLY");
459469
}
460470

@@ -590,7 +600,7 @@ void Detector::addAlignableVolumes() const
590600
LOG(debug) << "Got TGeoPNEntry " << alignableEntry;
591601

592602
if (alignableEntry) {
593-
Float_t angle = geom->GetCPVAngle(iModule);
603+
double angle = geom->GetCPVAngle(iModule);
594604
TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
595605

596606
TGeoHMatrix* matTtoL = new TGeoHMatrix;

0 commit comments

Comments
 (0)