Skip to content

Commit 5f10631

Browse files
sawenzelclaude
andcommitted
Build the TRD cooling pipes and power lines once per layer
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent ee38904 commit 5f10631

1 file changed

Lines changed: 29 additions & 31 deletions

File tree

Detectors/TRD/base/src/Geometry.cxx

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,7 @@ void Geometry::createServices(std::vector<int> const& idtmed)
15341534

15351535
const int kTag = 100;
15361536
char cTagV[kTag];
1537+
char cTagM[kTag];
15371538

15381539
const int kNparBox = 3;
15391540
float parBox[kNparBox];
@@ -1919,21 +1920,22 @@ void Geometry::createServices(std::vector<int> const& idtmed)
19191920
// The cooling pipes inside the service volumes
19201921
//
19211922

1922-
// The cooling pipes
1923-
parTube[0] = 0.0;
1924-
parTube[1] = 0.0;
1925-
parTube[2] = 0.0;
1926-
createVolume("UTCP", "TUBE", idtmed[24], parTube, 0);
1927-
// The cooling water
1928-
parTube[0] = 0.0;
1929-
parTube[1] = 0.2 / 2.0;
1930-
parTube[2] = -1.0;
1931-
createVolume("UTCH", "TUBE", idtmed[14], parTube, kNparTube);
1932-
// Water inside the cooling pipe
1933-
xpos = 0.0;
1934-
ypos = 0.0;
1935-
zpos = 0.0;
1936-
TVirtualMC::GetMC()->Gspos("UTCH", 1, "UTCP", xpos, ypos, zpos, 0, "ONLY");
1923+
// The cooling pipes and the water inside them. Their only free parameter is the chamber
1924+
// width, which depends on the layer alone, so six volumes cover all 456 rows of a
1925+
// supermodule.
1926+
for (ilayer = 0; ilayer < NLAYER; ilayer++) {
1927+
snprintf(cTagV, kTag, "UCP%01d", ilayer);
1928+
parTube[0] = 0.0;
1929+
parTube[1] = 0.3 / 2.0; // Thickness of the cooling pipes
1930+
parTube[2] = CWIDTH[ilayer] / 2.0;
1931+
createVolume(cTagV, "TUBE", idtmed[24], parTube, kNparTube);
1932+
snprintf(cTagM, kTag, "UCW%01d", ilayer);
1933+
parTube[0] = 0.0;
1934+
parTube[1] = 0.2 / 2.0; // The cooling water
1935+
parTube[2] = CWIDTH[ilayer] / 2.0;
1936+
createVolume(cTagM, "TUBE", idtmed[14], parTube, kNparTube);
1937+
TVirtualMC::GetMC()->Gspos(cTagM, 1, cTagV, 0.0, 0.0, 0.0, 0, "ONLY");
1938+
}
19371939

19381940
// Position the cooling pipes in the mother volume
19391941
for (istack = 0; istack < NSTACK; istack++) {
@@ -1943,16 +1945,12 @@ void Geometry::createServices(std::vector<int> const& idtmed)
19431945
int nMCMrow = getRowMax(ilayer, istack, 0);
19441946
float ySize = (getChamberLength(ilayer, istack) - 2.0 * RPADW) / ((float)nMCMrow);
19451947
snprintf(cTagV, kTag, "UU%02d", iDet);
1948+
snprintf(cTagM, kTag, "UCP%01d", ilayer);
19461949
for (int iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
19471950
xpos = 0.0;
19481951
ypos = (0.5 + iMCMrow) * ySize - CLENGTH[ilayer][istack] / 2.0 + HSPACE / 2.0;
19491952
zpos = 0.0 + 0.742 / 2.0;
1950-
// The cooling pipes
1951-
parTube[0] = 0.0;
1952-
parTube[1] = 0.3 / 2.0; // Thickness of the cooling pipes
1953-
parTube[2] = CWIDTH[ilayer] / 2.0;
1954-
TVirtualMC::GetMC()->Gsposp("UTCP", iCopy + iMCMrow, cTagV, xpos, ypos, zpos, matrix[2], "ONLY", parTube,
1955-
kNparTube);
1953+
TVirtualMC::GetMC()->Gspos(cTagM, iCopy + iMCMrow, cTagV, xpos, ypos, zpos, matrix[2], "ONLY");
19561954
}
19571955
}
19581956
}
@@ -1961,11 +1959,14 @@ void Geometry::createServices(std::vector<int> const& idtmed)
19611959
// The power lines
19621960
//
19631961

1964-
// The copper power lines
1965-
parTube[0] = 0.0;
1966-
parTube[1] = 0.0;
1967-
parTube[2] = 0.0;
1968-
createVolume("UTPL", "TUBE", idtmed[5], parTube, 0);
1962+
// The copper power lines, again one per layer rather than one per row
1963+
for (ilayer = 0; ilayer < NLAYER; ilayer++) {
1964+
snprintf(cTagV, kTag, "UPL%01d", ilayer);
1965+
parTube[0] = 0.0;
1966+
parTube[1] = 0.2 / 2.0; // Thickness of the power lines
1967+
parTube[2] = CWIDTH[ilayer] / 2.0;
1968+
createVolume(cTagV, "TUBE", idtmed[5], parTube, kNparTube);
1969+
}
19691970

19701971
// Position the power lines in the mother volume
19711972
for (istack = 0; istack < NSTACK; istack++) {
@@ -1975,15 +1976,12 @@ void Geometry::createServices(std::vector<int> const& idtmed)
19751976
int nMCMrow = getRowMax(ilayer, istack, 0);
19761977
float ySize = (getChamberLength(ilayer, istack) - 2.0 * RPADW) / ((float)nMCMrow);
19771978
snprintf(cTagV, kTag, "UU%02d", iDet);
1979+
snprintf(cTagM, kTag, "UPL%01d", ilayer);
19781980
for (int iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) {
19791981
xpos = 0.0;
19801982
ypos = (0.5 + iMCMrow) * ySize - 1.0 - CLENGTH[ilayer][istack] / 2.0 + HSPACE / 2.0;
19811983
zpos = -0.4 + 0.742 / 2.0;
1982-
parTube[0] = 0.0;
1983-
parTube[1] = 0.2 / 2.0; // Thickness of the power lines
1984-
parTube[2] = CWIDTH[ilayer] / 2.0;
1985-
TVirtualMC::GetMC()->Gsposp("UTPL", iCopy + iMCMrow, cTagV, xpos, ypos, zpos, matrix[2], "ONLY", parTube,
1986-
kNparTube);
1984+
TVirtualMC::GetMC()->Gspos(cTagM, iCopy + iMCMrow, cTagV, xpos, ypos, zpos, matrix[2], "ONLY");
19871985
}
19881986
}
19891987
}

0 commit comments

Comments
 (0)