Skip to content
Snippets Groups Projects

MuonIDHltAlg - Cannot cache memory address of dd4hep detector elements.

Merged Christopher Rob Jones requested to merge jonrob/Rec:fix-MuonIDHltAlg-dd4hep into master
All threads resolved!
1 file
+ 30
13
Compare changes
  • Side-by-side
  • Inline
@@ -64,8 +64,8 @@ namespace {
struct MiniID {
LHCb::Event::flags_v<scalar_t, StatusMasks> flags;
float chi2Corr = -10000.0f;
float LLMu = log( 0.00001f );
float LLBg = log( 1.0f );
float LLMu = std::log( 0.00001f );
float LLBg = std::log( 1.0f );
float CatBoost = -999.f;
std::array<LHCb::LHCbID, nMuonStations> tiles{};
};
@@ -76,21 +76,32 @@ namespace details {
class Cache {
public:
const DeMuonDetector* m_det = nullptr;
size_t m_stationsCount = 0;
size_t m_regionsCount = 0;
MuonTrackExtrapolation m_regionInner, m_regionOuter;
SigmaPadCache m_sigmapadX, m_sigmapadY;
ScatterCache m_scattercache;
std::array<float, 4> m_stationZ{{}};
#ifdef USE_DD4HEP
DeMuonDetector m_det;
#else
const DeMuonDetector* m_det = nullptr;
#endif
size_t m_stationsCount = 0;
size_t m_regionsCount = 0;
MuonTrackExtrapolation m_regionInner, m_regionOuter;
SigmaPadCache m_sigmapadX, m_sigmapadY;
ScatterCache m_scattercache;
std::array<float, nMuonStations> m_stationZ{{}};
public:
Cache() = default;
Cache( DeMuonDetector const& det )
: m_det{&det}, m_stationsCount( det.stations() ), m_regionsCount{det.regions() / m_stationsCount} {
: m_stationsCount( det.stations() ), m_regionsCount{det.regions() / m_stationsCount} {
// DetElems with dd4hep are transient handles with no persistent lifetime so you
// cannot take the memory address ofthem and cache this, as with DetDesc.
// Instead just copy the handle.
#ifdef USE_DD4HEP
m_det = det;
#else
m_det = &det;
#endif
// Update the cached DeMuon geometry (should be done by the detector element..)
// det.fillGeoArray();
for ( int s = 0; s != det.stations(); ++s ) {
m_regionInner[s] = std::make_pair( det.getInnerX( s ), det.getInnerY( s ) );
m_regionOuter[s] = std::make_pair( det.getOuterX( s ), det.getOuterY( s ) );
@@ -461,7 +472,13 @@ private: // methods
for ( const auto& hit : hitContainer.station( station ).hits() ) {
if ( predicate( hit ) ) {
occupancies[station]++;
if ( !hit.uncrossed() || cond.m_det->mapInRegion( station, hit.region() ) == 1 ) {
if ( !hit.uncrossed() ||
#ifdef USE_DD4HEP
cond.m_det.mapInRegion( station, hit.region() ) == 1
#else
cond.m_det->mapInRegion( station, hit.region() ) == 1
#endif
) {
occupancies_crossed[station]++;
}
}
Loading