Skip to content

Commit

Permalink
Fix the construction of cloned sensitive volumes
Browse files Browse the repository at this point in the history
FairRoot allows for construction of clones volumes
using the volume_name#{clone_number} scheme.
Changing FairMCApplication::ConstructSensitiveDetectors()
to support this.
  • Loading branch information
karabowi committed May 6, 2022
1 parent c792d73 commit 51bffcc
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions base/sim/FairMCApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1336,10 +1336,23 @@ void FairMCApplication::UndoGeometryModifications()

void FairMCApplication::ConstructSensitiveDetectors()
{
for (auto const& x : fMapSensitiveDetectors) {
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors " << x.first << " " << x.second;
TVirtualMC::GetMC()->SetSensitiveDetector(x.first, x.second);
}
std::map<std::string, FairModule*> cloneVolumeMap;

for (auto const& x : fMapSensitiveDetectors) {
std::string volName = x.first;//.substr(0, x.first.find("#", 0));
if (volName.find('#') != std::string::npos) {
volName = volName.substr(0, volName.find("#", 0));
std::map<std::string, FairModule*>::iterator it;
it = cloneVolumeMap.find(volName);
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors got clone " << x.first << " " << x.second;
if (it != cloneVolumeMap.end())
continue;
cloneVolumeMap[volName] = x.second;
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors really do " << volName;
}
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors really do " << volName;
TVirtualMC::GetMC()->SetSensitiveDetector(volName, x.second);
}
}

void FairMCApplication::AddSensitiveModule(std::string volName, FairModule* module)
Expand Down

0 comments on commit 51bffcc

Please sign in to comment.