From ae0523e7e1883b7dcebf3247a4bd4d954673281c Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Mon, 18 Jul 2022 23:53:40 +0200 Subject: [PATCH] Fix errors for Geant4 --- DDCore/include/DD4hep/ConditionAny.h | 10 ++++----- DDG4/lcio/LCIOSDTestActions.cpp | 21 ++++++++++++++----- .../Geant4DetectorGeometryConstruction.cpp | 9 ++++---- DDG4/plugins/Geant4P1ShowerModel.cpp | 6 ++++++ DDG4/src/Geant4ParticleHandler.cpp | 9 +++++--- 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/DDCore/include/DD4hep/ConditionAny.h b/DDCore/include/DD4hep/ConditionAny.h index c95b49469..d486bab6e 100644 --- a/DDCore/include/DD4hep/ConditionAny.h +++ b/DDCore/include/DD4hep/ConditionAny.h @@ -150,17 +150,17 @@ namespace dd4hep { /// Construct conditions object and bind the data template <typename PAYLOAD> inline - ConditionAny::ConditionAny(key_type hash_key, PAYLOAD&& data) { + ConditionAny::ConditionAny(key_type hash_key, PAYLOAD&& payload) { ConditionAny c(hash_key); - c.get() = std::move(data); + c.get() = std::move(payload); this->m_element = c.ptr(); } - /// Construct conditions object and bind the data + /// Construct conditions object and bind the payload template <typename PAYLOAD> inline - ConditionAny::ConditionAny(const std::string& name, const std::string& type, PAYLOAD&& data) { + ConditionAny::ConditionAny(const std::string& name, const std::string& type, PAYLOAD&& payload) { ConditionAny c(name, type); - c.get() = std::move(data); + c.get() = std::move(payload); this->m_element = c.ptr(); } diff --git a/DDG4/lcio/LCIOSDTestActions.cpp b/DDG4/lcio/LCIOSDTestActions.cpp index b69af910a..44c983742 100644 --- a/DDG4/lcio/LCIOSDTestActions.cpp +++ b/DDG4/lcio/LCIOSDTestActions.cpp @@ -64,21 +64,25 @@ namespace Tests { InstanceCount::decrement(this); } /// Define collections created by this sensitivie action object - virtual void defineCollections() {} + virtual void defineCollections() override {} /// G4VSensitiveDetector interface: Method invoked at the begining of each event. - virtual void begin(G4HCofThisEvent* hce) { + virtual void begin(G4HCofThisEvent* hce) override { Base::begin(hce); } /// G4VSensitiveDetector interface: Method invoked at the end of each event. - virtual void end(G4HCofThisEvent* hce) { + virtual void end(G4HCofThisEvent* hce) override { Base::end(hce); } /// G4VSensitiveDetector interface: Method for generating hit(s) using the G4Step object. - virtual bool process(G4Step* step,G4TouchableHistory* history) { + virtual bool process(G4Step* step,G4VTouchable* history) override { + return Base::process(step,history); + } + /// GFlash/FastSim interface: Method for generating hit(s) using the G4Step object. + virtual bool process(const Geant4FastSimSpot* spot,G4VTouchable* history) override { return Base::process(step,history); } /// G4VSensitiveDetector interface: Method invoked if the event was aborted. - virtual void clear(G4HCofThisEvent* hce) { + virtual void clear(G4HCofThisEvent* hce) override { Base::clear(hce); } }; @@ -142,6 +146,13 @@ namespace Tests { return true; } + /// Method for generating hit(s) using the information of G4Step object. + template <> bool Geant4SensitiveAction<LcioTestTracker>::process(Geant4FastSimSpot* ,G4TouchableHistory* /*hist*/ ) { + except("Not implemented"); + return true; + } + + typedef Geant4SensitiveAction<LcioTestTracker> LcioTestTrackerAction; } // namespace diff --git a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp index 1106a3d76..9bc119c5a 100644 --- a/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp +++ b/DDG4/plugins/Geant4DetectorGeometryConstruction.cpp @@ -319,9 +319,9 @@ int Geant4DetectorGeometryConstruction::printVolumeObj(const char* vol_path, Pla /// Print geant4 volume int Geant4DetectorGeometryConstruction::printVolume(const char* vol_path) { if ( vol_path ) { - auto [p, pv] = resolve_path(vol_path); - if ( pv.isValid() ) { - return printVolumeObj(vol_path, pv, ~0x0); + auto physVol = resolve_path(vol_path); + if ( physVol.second.isValid() ) { + return printVolumeObj(vol_path, physVol.second, ~0x0); } } warning("+++ printVolume: Property VolumePath not set. [Ignored]"); @@ -372,7 +372,8 @@ int Geant4DetectorGeometryConstruction::printVolTree(const char* vol_path) { /// Check geant4 volume int Geant4DetectorGeometryConstruction::checkVolume(const char* vol_path) { if ( vol_path ) { - auto [p, pv] = resolve_path(vol_path); + auto physVol = resolve_path(vol_path); + auto pv = physVol.second; if ( pv.isValid() ) { auto& g4map = Geant4Mapping::instance().data().g4Volumes; auto it = g4map.find(pv.volume()); diff --git a/DDG4/plugins/Geant4P1ShowerModel.cpp b/DDG4/plugins/Geant4P1ShowerModel.cpp index e8125fec2..315bbe07c 100644 --- a/DDG4/plugins/Geant4P1ShowerModel.cpp +++ b/DDG4/plugins/Geant4P1ShowerModel.cpp @@ -32,13 +32,19 @@ #include <DDG4/Geant4FastSimSpot.h> // Geant4 include files +#include "G4Version.hh" #include "G4Gamma.hh" #include "Randomize.hh" #include "G4SystemOfUnits.hh" +#if G4VERSION_NUMBER > 1070 #include "G4FastSimHitMaker.hh" +#else +class G4FastSimHitMaker { public: void make(const G4FastHit&, const G4FastTrack&) { } }; +#endif // C/C++ include files + /// Namespace for the AIDA detector description toolkit namespace dd4hep { diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 82a4b7025..4e09bb387 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -490,7 +490,8 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { // Processing by Geant4 to establish mother daughter relationships. // == > use finalParticles map and NOT m_particleMap. int equiv_id = -1; - for( auto& [idx, p] : finalParticles ) { + for( auto& part : finalParticles ) { + auto& p = part.second; if ( p->g4Parent > 0 ) { TrackEquivalents::iterator iequ = equivalents.find(p->g4Parent); if ( iequ != equivalents.end() ) { @@ -656,7 +657,8 @@ void Geant4ParticleHandler::checkConsistency() const { int num_errors = 0; /// First check the consistency of the particle map itself - for(const auto& [idx, particle] : m_particleMap ) { + for(const auto& part : m_particleMap ) { + Geant4Particle* particle = part.second; Geant4ParticleHandle p(particle); PropertyMask mask(p->reason); PropertyMask status(p->status); @@ -698,7 +700,8 @@ void Geant4ParticleHandler::checkConsistency() const { } void Geant4ParticleHandler::setVertexEndpointBit() { - for( auto& [idx, p] : m_particleMap ) { + for( auto& part : m_particleMap ) { + auto* p = part.second; if( !p->parents.empty() ) { Geant4Particle *parent(m_particleMap[ *p->parents.begin() ]); const double X( parent->vex - p->vsx ); -- GitLab