Skip to content

Commit 9325616

Browse files
sawenzelclaude
andcommitted
Write out the TRD chamber dimensions instead of resolving them at run time
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 5f10631 commit 9325616

1 file changed

Lines changed: 51 additions & 35 deletions

File tree

Detectors/TRD/base/src/Geometry.cxx

Lines changed: 51 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,22 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
377377
for (int ilayer = 0; ilayer < NLAYER; ilayer++) {
378378
int iDet = getDetectorSec(ilayer, istack);
379379

380+
// Half-sizes of this chamber and of the three air volumes the material layers sit in.
381+
// The Geant3 convention of passing -1 and letting TGeo copy the dimension from the
382+
// mother at CheckGeometry() time is not used here: every such placement makes TGeo
383+
// clone a fresh TGeoVolume, so the dimensions are written out instead.
384+
// double, not float: the originals compute the whole expression in double and only the
385+
// store into parCha[] rounds, so a float intermediate here would shift a dimension by
386+
// one ulp and, through Geant4's stepping, move a handful of hits.
387+
const double halfWidth = CWIDTH[ilayer] / 2.0;
388+
const double halfLength = CLENGTH[ilayer][istack] / 2.0 - HSPACE / 2.0;
389+
const double radX = halfWidth - CALT - CCLST - CGLT; // inside of the radiator (UC)
390+
const double radY = halfLength - CCLFT - CGLT;
391+
const double ampX = halfWidth + CROW - CCUTB; // inside of the amplification frame (UE)
392+
const double ampY = halfLength - CCUTA;
393+
const double robX = halfWidth + CROW - CAUT; // inside of the back-panel frame (UG)
394+
const double robY = halfLength - CAUT;
395+
380396
// The lower part of the readout chambers (drift volume + radiator)
381397
// The aluminum frames
382398
snprintf(cTagV, kTag, "UA%02d", iDet);
@@ -402,8 +418,8 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
402418
// The Wacosit frames
403419
snprintf(cTagV, kTag, "UB%02d", iDet);
404420
parCha[0] = CWIDTH[ilayer] / 2.0 - CALT;
405-
parCha[1] = -1.0;
406-
parCha[2] = -1.0;
421+
parCha[1] = halfLength;
422+
parCha[2] = CRAH / 2.0 + CDRH / 2.0;
407423
createVolume(cTagV, "BOX ", idtmed[7], parCha, kNparCha);
408424
// The glue around the radiator
409425
snprintf(cTagV, kTag, "UX%02d", iDet);
@@ -415,7 +431,7 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
415431
snprintf(cTagV, kTag, "UC%02d", iDet);
416432
parCha[0] = CWIDTH[ilayer] / 2.0 - CALT - CCLST - CGLT;
417433
parCha[1] = CLENGTH[ilayer][istack] / 2.0 - HSPACE / 2.0 - CCLFT - CGLT;
418-
parCha[2] = -1.0;
434+
parCha[2] = CRAH / 2.0;
419435
createVolume(cTagV, "BOX ", idtmed[2], parCha, kNparCha);
420436

421437
// The upper part of the readout chambers (amplification volume)
@@ -429,7 +445,7 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
429445
snprintf(cTagV, kTag, "UE%02d", iDet);
430446
parCha[0] = CWIDTH[ilayer] / 2.0 + CROW - CCUTB;
431447
parCha[1] = CLENGTH[ilayer][istack] / 2.0 - HSPACE / 2.0 - CCUTA;
432-
parCha[2] = -1.;
448+
parCha[2] = CAMH / 2.0;
433449
createVolume(cTagV, "BOX ", idtmed[2], parCha, kNparCha);
434450

435451
// The back panel, including pad plane and readout boards
@@ -443,40 +459,40 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
443459
snprintf(cTagV, kTag, "UG%02d", iDet);
444460
parCha[0] = CWIDTH[ilayer] / 2.0 + CROW - CAUT;
445461
parCha[1] = CLENGTH[ilayer][istack] / 2.0 - HSPACE / 2.0 - CAUT;
446-
parCha[2] = -1.0;
462+
parCha[2] = CROH / 2.0;
447463
createVolume(cTagV, "BOX ", idtmed[2], parCha, kNparCha);
448464

449465
//
450466
// The material layers inside the chambers
451467
//
452468

453469
// Mylar layer (radiator)
454-
parCha[0] = -1.0;
455-
parCha[1] = -1.0;
470+
parCha[0] = radX;
471+
parCha[1] = radY;
456472
parCha[2] = RMYTHICK / 2.0;
457473
snprintf(cTagV, kTag, "URMY%02d", iDet);
458474
createVolume(cTagV, "BOX ", idtmed[27], parCha, kNparCha);
459475
// Carbon layer (radiator)
460-
parCha[0] = -1.0;
461-
parCha[1] = -1.0;
476+
parCha[0] = radX;
477+
parCha[1] = radY;
462478
parCha[2] = RCBTHICK / 2.0;
463479
snprintf(cTagV, kTag, "URCB%02d", iDet);
464480
createVolume(cTagV, "BOX ", idtmed[26], parCha, kNparCha);
465481
// Araldite layer (radiator)
466-
parCha[0] = -1.0;
467-
parCha[1] = -1.0;
482+
parCha[0] = radX;
483+
parCha[1] = radY;
468484
parCha[2] = RGLTHICK / 2.0;
469485
snprintf(cTagV, kTag, "URGL%02d", iDet);
470486
createVolume(cTagV, "BOX ", idtmed[11], parCha, kNparCha);
471487
// Rohacell layer (radiator)
472-
parCha[0] = -1.0;
473-
parCha[1] = -1.0;
488+
parCha[0] = radX;
489+
parCha[1] = radY;
474490
parCha[2] = RRHTHICK / 2.0;
475491
snprintf(cTagV, kTag, "URRH%02d", iDet);
476492
createVolume(cTagV, "BOX ", idtmed[15], parCha, kNparCha);
477493
// Fiber layer (radiator)
478-
parCha[0] = -1.0;
479-
parCha[1] = -1.0;
494+
parCha[0] = radX;
495+
parCha[1] = radY;
480496
parCha[2] = RFBTHICK / 2.0;
481497
snprintf(cTagV, kTag, "URFB%02d", iDet);
482498
createVolume(cTagV, "BOX ", idtmed[28], parCha, kNparCha);
@@ -489,63 +505,63 @@ void Geometry::createVolumes(std::vector<int> const& idtmed)
489505
createVolume(cTagV, "BOX ", idtmed[9], parCha, kNparCha);
490506

491507
// Xe/Isobutane layer (amplification volume)
492-
parCha[0] = -1.0;
493-
parCha[1] = -1.0;
508+
parCha[0] = ampX;
509+
parCha[1] = ampY;
494510
parCha[2] = AMTHICK / 2.0;
495511
snprintf(cTagV, kTag, "UK%02d", iDet);
496512
createVolume(cTagV, "BOX ", idtmed[9], parCha, kNparCha);
497513
// Cu layer (wire plane)
498-
parCha[0] = -1.0;
499-
parCha[1] = -1.0;
514+
parCha[0] = ampX;
515+
parCha[1] = ampY;
500516
parCha[2] = WRTHICK / 2.0;
501517
snprintf(cTagV, kTag, "UW%02d", iDet);
502518
createVolume(cTagV, "BOX ", idtmed[3], parCha, kNparCha);
503519

504520
// Cu layer (pad plane)
505-
parCha[0] = -1.0;
506-
parCha[1] = -1.0;
521+
parCha[0] = robX;
522+
parCha[1] = robY;
507523
parCha[2] = PPDTHICK / 2.0;
508524
snprintf(cTagV, kTag, "UPPD%02d", iDet);
509525
createVolume(cTagV, "BOX ", idtmed[5], parCha, kNparCha);
510526
// G10 layer (pad plane)
511-
parCha[0] = -1.0;
512-
parCha[1] = -1.0;
527+
parCha[0] = robX;
528+
parCha[1] = robY;
513529
parCha[2] = PPPTHICK / 2.0;
514530
snprintf(cTagV, kTag, "UPPP%02d", iDet);
515531
createVolume(cTagV, "BOX ", idtmed[13], parCha, kNparCha);
516532
// Araldite layer (glue)
517-
parCha[0] = -1.0;
518-
parCha[1] = -1.0;
533+
parCha[0] = robX;
534+
parCha[1] = robY;
519535
parCha[2] = PGLTHICK / 2.0;
520536
snprintf(cTagV, kTag, "UPGL%02d", iDet);
521537
createVolume(cTagV, "BOX ", idtmed[11], parCha, kNparCha);
522538
// Carbon layer (carbon fiber mats)
523-
parCha[0] = -1.0;
524-
parCha[1] = -1.0;
539+
parCha[0] = robX;
540+
parCha[1] = robY;
525541
parCha[2] = PCBTHICK / 2.0;
526542
snprintf(cTagV, kTag, "UPCB%02d", iDet);
527543
createVolume(cTagV, "BOX ", idtmed[26], parCha, kNparCha);
528544
// Aramide layer (honeycomb)
529-
parCha[0] = -1.0;
530-
parCha[1] = -1.0;
545+
parCha[0] = robX;
546+
parCha[1] = robY;
531547
parCha[2] = PHCTHICK / 2.0;
532548
snprintf(cTagV, kTag, "UPHC%02d", iDet);
533549
createVolume(cTagV, "BOX ", idtmed[10], parCha, kNparCha);
534550
// G10 layer (PCB readout board)
535-
parCha[0] = -1.0;
536-
parCha[1] = -1.0;
551+
parCha[0] = robX;
552+
parCha[1] = robY;
537553
parCha[2] = PPCTHICK / 2;
538554
snprintf(cTagV, kTag, "UPPC%02d", iDet);
539555
createVolume(cTagV, "BOX ", idtmed[13], parCha, kNparCha);
540556
// Cu layer (traces in readout board)
541-
parCha[0] = -1.0;
542-
parCha[1] = -1.0;
557+
parCha[0] = robX;
558+
parCha[1] = robY;
543559
parCha[2] = PRBTHICK / 2.0;
544560
snprintf(cTagV, kTag, "UPRB%02d", iDet);
545561
createVolume(cTagV, "BOX ", idtmed[6], parCha, kNparCha);
546562
// Cu layer (other material on in readout board, incl. screws)
547-
parCha[0] = -1.0;
548-
parCha[1] = -1.0;
563+
parCha[0] = robX;
564+
parCha[1] = robY;
549565
parCha[2] = PELTHICK / 2.0;
550566
snprintf(cTagV, kTag, "UPEL%02d", iDet);
551567
createVolume(cTagV, "BOX ", idtmed[4], parCha, kNparCha);

0 commit comments

Comments
 (0)