Skip to content

Commit

Permalink
Merge pull request #32218 from ghugo83/fix_ECAL_Quadrants
Browse files Browse the repository at this point in the history
Fix ECAL Endcap quadrants issue with DD4hep reflected volumes + Also fix ECAL Barrel and CSCs reflected active detectors
  • Loading branch information
cmsbuild authored Nov 21, 2020
2 parents 1bdc240 + db38ed1 commit d3024a8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <DD4hep/Filter.h>

#include "G4LogicalVolume.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4ReflectionFactory.hh"

#include "FWCore/MessageLogger/interface/MessageLogger.h"
Expand Down Expand Up @@ -56,6 +57,19 @@ G4VPhysicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog)
auto fff = it.first->GetName();
catalog.insert({sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, fff);

auto reflectedG4LogicalVolumeName = fff + "_refl";
bool hasReflectedVolumeInStore = false;
G4LogicalVolumeStore *theStore = G4LogicalVolumeStore::GetInstance();
for (const auto &lv : *theStore) {
if (lv->GetName().find(reflectedG4LogicalVolumeName) != std::string::npos) {
hasReflectedVolumeInStore = true;
}
}
if (hasReflectedVolumeInStore) {
catalog.insert(
{sClassName.data(), sClassName.size()}, {sROUName.data(), sROUName.size()}, reflectedG4LogicalVolumeName);
}

edm::LogVerbatim("SimG4CoreApplication")
<< " DDG4SensitiveConverter: Sensitive " << fff << " Class Name " << sClassName << " ROU Name " << sROUName;
}
Expand Down

0 comments on commit d3024a8

Please sign in to comment.