Skip to content

Commit c9f37e1

Browse files
committed
Fix the construction of cloned sensitive volumes
FairRoot allows for construction of clones volumes using the volume_name#{clone_number} scheme. Changing FairMCApplication::ConstructSensitiveDetectors() to support this.
1 parent a152b9c commit c9f37e1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

base/sim/FairMCApplication.cxx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,9 +1316,22 @@ void FairMCApplication::UndoGeometryModifications()
13161316

13171317
void FairMCApplication::ConstructSensitiveDetectors()
13181318
{
1319+
std::map<std::string, FairModule*> cloneVolumeMap;
1320+
13191321
for (auto const& x : fMapSensitiveDetectors) {
1320-
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors " << x.first << " " << x.second;
1321-
TVirtualMC::GetMC()->SetSensitiveDetector(x.first, x.second);
1322+
std::string volName = x.first; //.substr(0, x.first.find("#", 0));
1323+
if (volName.find('#') != std::string::npos) {
1324+
volName = volName.substr(0, volName.find("#", 0));
1325+
std::map<std::string, FairModule*>::iterator it;
1326+
it = cloneVolumeMap.find(volName);
1327+
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors got clone " << x.first << " " << x.second;
1328+
if (it != cloneVolumeMap.end())
1329+
continue;
1330+
cloneVolumeMap[volName] = x.second;
1331+
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors really do " << volName;
1332+
}
1333+
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors really do " << volName;
1334+
TVirtualMC::GetMC()->SetSensitiveDetector(volName, x.second);
13221335
}
13231336
}
13241337

0 commit comments

Comments
 (0)