Skip to content

Commit 07719f4

Browse files
sawenzelclaude
andcommitted
Let the ZEM calorimeters be built without the far beam line
This adds two ZDCSimParam switches so a simulation can keep the ZEM geometry without paying for transport to the ZN/ZP calorimeters at +-113 m. - The ZDC geometry is the +-113 m beam line, its magnets, ZN, ZP and ZEM; the transport cost is the beam line, while ZEM sits at z = 7.6 m. - buildBeamLine=false skips the beam line, the magnets and ZN/ZP; buildZEM controls the ZEM calorimeters. - The ZN and ZP construction moves into createZNZP() and the ZEM construction into createZEM(), so createDetectors() shows what depends on the beam line. - The PMC and PMQ medium ids move ahead of that branch: ProcessHits compares every step against them for ZEM too, so leaving them in the ZN block gave ZEM hits with no energy loss and no light yield. - The ZN/ZP sensitive volume lookups are guarded so they no longer abort when the volumes are absent. - 20 pythia8pp events with TGeant3: 276.9 s with the full ZDC, 141.6 +- 1.1 s with --skipModules ZDC, 136.9 +- 1.9 s with buildBeamLine=false. - 50 events of 20 muons at 200 GeV into 4.6 < eta < 5.3 give 234 ZEM hits with 2167 photoelectrons at buildBeamLine=false, against 230 hits and 2097 with the full ZDC. https://its.cern.ch/jira/browse/O2-7158 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent d80c5cb commit 07719f4

3 files changed

Lines changed: 66 additions & 29 deletions

File tree

Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ class Detector : public o2::base::DetImpl<Detector>
121121
void createCsideBeamLine();
122122
void createMagnets();
123123
void createDetectors();
124+
void createZNZP();
125+
void createZEM();
124126

125127
// determine detector; sector/tower and impact coordinates given volumename and position
126128
void getDetIDandSecID(TString const& volname, math_utils::Vector3D<float> const& x,

Detectors/ZDC/simulation/include/ZDCSimulation/ZDCSimParam.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ namespace zdc
2424
struct ZDCSimParam : public o2::conf::ConfigurableParamHelper<ZDCSimParam> {
2525

2626
bool continuous = true; ///< flag for continuous simulation
27+
/// Build the +-113 m beam line, its magnets and the ZN/ZP calorimeters that sit
28+
/// there. This is what the ZDC costs in transport time; turning it off leaves the
29+
/// ZEM calorimeters at z ~ 7.6 m in the geometry.
30+
bool buildBeamLine = true;
31+
bool buildZEM = true; ///< build the ZEM calorimeters
2732
int nBCAheadCont = 1; ///< number of BC to read ahead of trigger in continuous mode
2833
int nBCAheadTrig = 3; ///< number of BC to read ahead of trigger in triggered mode
2934
bool recordSpatialResponse = false; ///< whether to record 2D spatial response showering images in proton/neutron detector

Detectors/ZDC/simulation/src/Detector.cxx

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -217,47 +217,54 @@ void Detector::ConstructGeometry()
217217

218218
createMaterials();
219219

220-
createAsideBeamLine();
221-
createCsideBeamLine();
222-
createMagnets();
220+
if (ZDCSimParam::Instance().buildBeamLine) {
221+
createAsideBeamLine();
222+
createCsideBeamLine();
223+
createMagnets();
224+
} else {
225+
LOG(info) << "ZDC: beam line, magnets and the ZN/ZP calorimeters are not built";
226+
}
223227
createDetectors();
224228
}
225229

226230
//_____________________________________________________________________________
227231
void Detector::defineSensitiveVolumes()
228232
{
229233
LOG(info) << "defining sensitive for ZDC";
230-
auto vol = gGeoManager->GetVolume("ZNENV");
231-
if (vol) {
232-
AddSensitiveVolume(vol);
233-
mZNENVVolID = vol->GetNumber(); // initialize id
234-
235-
AddSensitiveVolume(gGeoManager->GetVolume("ZNF1"));
236-
AddSensitiveVolume(gGeoManager->GetVolume("ZNF2"));
237-
AddSensitiveVolume(gGeoManager->GetVolume("ZNF3"));
238-
AddSensitiveVolume(gGeoManager->GetVolume("ZNF4"));
239-
} else {
240-
LOG(fatal) << "can't find volume ZNENV";
241-
}
242-
vol = gGeoManager->GetVolume("ZPENV");
243-
if (vol) {
244-
AddSensitiveVolume(vol);
245-
mZPENVVolID = vol->GetNumber(); // initialize id
246-
247-
AddSensitiveVolume(gGeoManager->GetVolume("ZPF1"));
248-
AddSensitiveVolume(gGeoManager->GetVolume("ZPF2"));
249-
AddSensitiveVolume(gGeoManager->GetVolume("ZPF3"));
250-
AddSensitiveVolume(gGeoManager->GetVolume("ZPF4"));
251-
} else {
252-
LOG(fatal) << "can't find volume ZPENV";
234+
TGeoVolume* vol = nullptr;
235+
if (ZDCSimParam::Instance().buildBeamLine) {
236+
vol = gGeoManager->GetVolume("ZNENV");
237+
if (vol) {
238+
AddSensitiveVolume(vol);
239+
mZNENVVolID = vol->GetNumber(); // initialize id
240+
241+
AddSensitiveVolume(gGeoManager->GetVolume("ZNF1"));
242+
AddSensitiveVolume(gGeoManager->GetVolume("ZNF2"));
243+
AddSensitiveVolume(gGeoManager->GetVolume("ZNF3"));
244+
AddSensitiveVolume(gGeoManager->GetVolume("ZNF4"));
245+
} else {
246+
LOG(fatal) << "can't find volume ZNENV";
247+
}
248+
vol = gGeoManager->GetVolume("ZPENV");
249+
if (vol) {
250+
AddSensitiveVolume(vol);
251+
mZPENVVolID = vol->GetNumber(); // initialize id
252+
253+
AddSensitiveVolume(gGeoManager->GetVolume("ZPF1"));
254+
AddSensitiveVolume(gGeoManager->GetVolume("ZPF2"));
255+
AddSensitiveVolume(gGeoManager->GetVolume("ZPF3"));
256+
AddSensitiveVolume(gGeoManager->GetVolume("ZPF4"));
257+
} else {
258+
LOG(fatal) << "can't find volume ZPENV";
259+
}
253260
}
254261
// em calorimeter
255262
vol = gGeoManager->GetVolume("ZEM ");
256263
if (vol) {
257264
AddSensitiveVolume(vol);
258265
mZEMVolID = vol->GetNumber();
259266
AddSensitiveVolume(gGeoManager->GetVolume("ZEMF"));
260-
} else {
267+
} else if (ZDCSimParam::Instance().buildZEM) {
261268
LOG(fatal) << "can't find volume ZEM";
262269
}
263270
}
@@ -2068,6 +2075,22 @@ void Detector::createMagnets()
20682075
}
20692076
//_____________________________________________________________________________
20702077
void Detector::createDetectors()
2078+
{
2079+
// ProcessHits compares the medium of every step against these two, for ZEM as
2080+
// much as for ZN and ZP, so they have to be resolved whatever is built.
2081+
mMediumPMCid = getMediumID(kSiO2pmc);
2082+
mMediumPMQid = getMediumID(kSiO2pmq);
2083+
2084+
// ZN and ZP sit in the ZDCA/ZDCC mother volumes that the beam line builds, so
2085+
// they stand or fall with it. ZEM is at z = 7.6 m and is built either way.
2086+
if (ZDCSimParam::Instance().buildBeamLine) {
2087+
createZNZP();
2088+
}
2089+
createZEM();
2090+
}
2091+
2092+
//_____________________________________________________________________________
2093+
void Detector::createZNZP()
20712094
{
20722095
// Create the ZDCs
20732096

@@ -2082,8 +2105,6 @@ void Detector::createDetectors()
20822105

20832106
// -------------------------------------------------------------------------------
20842107
//--> Neutron calorimeter (ZN)
2085-
mMediumPMCid = getMediumID(kSiO2pmc);
2086-
mMediumPMQid = getMediumID(kSiO2pmq);
20872108

20882109
// an envelop volume for the purpose of registering particles entering the detector
20892110
double eps = 0.1; // 1 mm
@@ -2300,8 +2321,17 @@ void Detector::createDetectors()
23002321
TVirtualMC::GetMC()->Gspos("ZPBS", 3, "ZDCA", Geometry::ZPAPOSITION[0] + Geometry::ZPDIMENSION[0] + zpSupportWallside[0], Geometry::ZPAPOSITION[1] + 0.75, Geometry::ZPAPOSITION[2] + zpSupportWallside[2], 0, "ONLY");
23012322
TVirtualMC::GetMC()->Gspos("ZPBS", 4, "ZDCA", Geometry::ZPAPOSITION[0] - Geometry::ZPDIMENSION[0] - zpSupportWallside[0], Geometry::ZPAPOSITION[1] + 0.75, Geometry::ZPAPOSITION[2] + zpSupportWallside[2], 0, "ONLY");
23022323

2324+
}
2325+
2326+
//_____________________________________________________________________________
2327+
void Detector::createZEM()
2328+
{
23032329
// -------------------------------------------------------------------------------
23042330
// -> EM calorimeter (ZEM)
2331+
if (!ZDCSimParam::Instance().buildZEM) {
2332+
LOG(warning) << "ZDC: the ZEM calorimeters are not built";
2333+
return;
2334+
}
23052335
int32_t irotzem1, irotzem2;
23062336
double rangzem1[6] = {0., 0., 90., 90., -90., 0.};
23072337
double rangzem2[6] = {180., 0., 90., 45. + 90., 90., 45.};

0 commit comments

Comments
 (0)