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 Jul 6, 2022
1 parent a152b9c commit c9f37e1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions base/sim/FairMCApplication.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1316,9 +1316,22 @@ void FairMCApplication::UndoGeometryModifications()

void FairMCApplication::ConstructSensitiveDetectors()
{
std::map<std::string, FairModule*> cloneVolumeMap;

for (auto const& x : fMapSensitiveDetectors) {
LOG(debug) << "FairMCApplication::ConstructSensitiveDetectors " << x.first << " " << x.second;
TVirtualMC::GetMC()->SetSensitiveDetector(x.first, x.second);
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);
}
}

Expand Down

0 comments on commit c9f37e1

Please sign in to comment.