Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Detectors/ZDC/simulation/include/ZDCSimulation/Detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ class Detector : public o2::base::DetImpl<Detector>
void createCsideBeamLine();
void createMagnets();
void createDetectors();
void createZNZP();
void createZEM();

// determine detector; sector/tower and impact coordinates given volumename and position
void getDetIDandSecID(TString const& volname, math_utils::Vector3D<float> const& x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ namespace zdc
struct ZDCSimParam : public o2::conf::ConfigurableParamHelper<ZDCSimParam> {

bool continuous = true; ///< flag for continuous simulation
/// Build the +-113 m beam line, its magnets and the ZN/ZP calorimeters that sit
/// there. This is what the ZDC costs in transport time; turning it off leaves the
/// ZEM calorimeters at z ~ 7.6 m in the geometry.
bool buildBeamLine = true;
bool buildZEM = true; ///< build the ZEM calorimeters
int nBCAheadCont = 1; ///< number of BC to read ahead of trigger in continuous mode
int nBCAheadTrig = 3; ///< number of BC to read ahead of trigger in triggered mode
bool recordSpatialResponse = false; ///< whether to record 2D spatial response showering images in proton/neutron detector
Expand Down
87 changes: 58 additions & 29 deletions Detectors/ZDC/simulation/src/Detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -217,47 +217,54 @@ void Detector::ConstructGeometry()

createMaterials();

createAsideBeamLine();
createCsideBeamLine();
createMagnets();
if (ZDCSimParam::Instance().buildBeamLine) {
createAsideBeamLine();
createCsideBeamLine();
createMagnets();
} else {
LOG(info) << "ZDC: beam line, magnets and the ZN/ZP calorimeters are not built";
}
createDetectors();
}

//_____________________________________________________________________________
void Detector::defineSensitiveVolumes()
{
LOG(info) << "defining sensitive for ZDC";
auto vol = gGeoManager->GetVolume("ZNENV");
if (vol) {
AddSensitiveVolume(vol);
mZNENVVolID = vol->GetNumber(); // initialize id

AddSensitiveVolume(gGeoManager->GetVolume("ZNF1"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF2"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF3"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF4"));
} else {
LOG(fatal) << "can't find volume ZNENV";
}
vol = gGeoManager->GetVolume("ZPENV");
if (vol) {
AddSensitiveVolume(vol);
mZPENVVolID = vol->GetNumber(); // initialize id

AddSensitiveVolume(gGeoManager->GetVolume("ZPF1"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF2"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF3"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF4"));
} else {
LOG(fatal) << "can't find volume ZPENV";
TGeoVolume* vol = nullptr;
if (ZDCSimParam::Instance().buildBeamLine) {
vol = gGeoManager->GetVolume("ZNENV");
if (vol) {
AddSensitiveVolume(vol);
mZNENVVolID = vol->GetNumber(); // initialize id

AddSensitiveVolume(gGeoManager->GetVolume("ZNF1"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF2"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF3"));
AddSensitiveVolume(gGeoManager->GetVolume("ZNF4"));
} else {
LOG(fatal) << "can't find volume ZNENV";
}
vol = gGeoManager->GetVolume("ZPENV");
if (vol) {
AddSensitiveVolume(vol);
mZPENVVolID = vol->GetNumber(); // initialize id

AddSensitiveVolume(gGeoManager->GetVolume("ZPF1"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF2"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF3"));
AddSensitiveVolume(gGeoManager->GetVolume("ZPF4"));
} else {
LOG(fatal) << "can't find volume ZPENV";
}
}
// em calorimeter
vol = gGeoManager->GetVolume("ZEM ");
if (vol) {
AddSensitiveVolume(vol);
mZEMVolID = vol->GetNumber();
AddSensitiveVolume(gGeoManager->GetVolume("ZEMF"));
} else {
} else if (ZDCSimParam::Instance().buildZEM) {
LOG(fatal) << "can't find volume ZEM";
}
}
Expand Down Expand Up @@ -2068,6 +2075,22 @@ void Detector::createMagnets()
}
//_____________________________________________________________________________
void Detector::createDetectors()
{
// ProcessHits compares the medium of every step against these two, for ZEM as
// much as for ZN and ZP, so they have to be resolved whatever is built.
mMediumPMCid = getMediumID(kSiO2pmc);
mMediumPMQid = getMediumID(kSiO2pmq);

// ZN and ZP sit in the ZDCA/ZDCC mother volumes that the beam line builds, so
// they stand or fall with it. ZEM is at z = 7.6 m and is built either way.
if (ZDCSimParam::Instance().buildBeamLine) {
createZNZP();
}
createZEM();
}

//_____________________________________________________________________________
void Detector::createZNZP()
{
// Create the ZDCs

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

// -------------------------------------------------------------------------------
//--> Neutron calorimeter (ZN)
mMediumPMCid = getMediumID(kSiO2pmc);
mMediumPMQid = getMediumID(kSiO2pmq);

// an envelop volume for the purpose of registering particles entering the detector
double eps = 0.1; // 1 mm
Expand Down Expand Up @@ -2299,9 +2320,17 @@ void Detector::createDetectors()
TVirtualMC::GetMC()->Gspos("ZPBS", 2, "ZDCC", Geometry::ZPCPOSITION[0] - Geometry::ZPDIMENSION[0] - zpSupportWallside[0], Geometry::ZPCPOSITION[1] + 0.75, Geometry::ZPCPOSITION[2] - zpSupportWallside[2], 0, "ONLY");
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");
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");
}

//_____________________________________________________________________________
void Detector::createZEM()
{
// -------------------------------------------------------------------------------
// -> EM calorimeter (ZEM)
if (!ZDCSimParam::Instance().buildZEM) {
LOG(warning) << "ZDC: the ZEM calorimeters are not built";
return;
}
int32_t irotzem1, irotzem2;
double rangzem1[6] = {0., 0., 90., 90., -90., 0.};
double rangzem2[6] = {180., 0., 90., 45. + 90., 90., 45.};
Expand Down