From 330949a45355982aaf7ee64d2395d1c74d8aea08 Mon Sep 17 00:00:00 2001 From: Markus Frank <markus.frank@cern.ch> Date: Thu, 26 Nov 2015 11:21:54 +0000 Subject: [PATCH] Fix ROOT 5 backwards compatibility issues --- .../include/DDG4/Geant4DetectorConstruction.h | 12 ++- DDG4/python/DDG4Dict.C | 81 ++++++++++--------- DDG4/src/python/Geant4PythonCall.cpp | 3 + DDG4/tpython/DDPython.cpp | 1 + DDRec/include/DDRec/Surface.h | 8 +- DDRec/src/Surface.cpp | 20 ++--- doc/CompileAllOptionPermutations.sh | 2 +- 7 files changed, 73 insertions(+), 54 deletions(-) diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h index ae350400f..ff202dd86 100644 --- a/DDG4/include/DDG4/Geant4DetectorConstruction.h +++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h @@ -17,11 +17,14 @@ // Framework include files #include "DDG4/Geant4Action.h" +#if !defined(__CINT__) #include "DDG4/Geant4GeometryInfo.h" +#endif // Forward declarations class G4VUserDetectorConstruction; class G4VSensitiveDetector; +class G4VPhysicalVolume; class G4LogicalVolume; @@ -38,6 +41,7 @@ namespace DD4hep { // Forward declarations class Geant4Kernel; + class Geant4GeometryInfo; class Geant4DetectorConstruction; class Geant4DetectorConstructionContext; class Geant4DetectorConstructionSequence; @@ -57,7 +61,11 @@ namespace DD4hep { class Geant4DetectorConstructionContext { public: /// Reference to geometry object +#ifdef __CINT__ + Geometry::LCDD* lcdd; +#else Geometry::LCDD& lcdd; +#endif /// Reference to the world after construction G4VPhysicalVolume* world; /// The cached geometry information @@ -143,6 +151,7 @@ namespace DD4hep { /// Sensitive detector construction callback. Called at "ConstructSDandField()" virtual void constructSensitives(Geant4DetectorConstructionContext* ctxt); +#if !defined(__CINT__) //@{ Accessor to the various geant4 maps after construction /// Access to the converted materials @@ -162,8 +171,7 @@ namespace DD4hep { const Geant4GeometryMaps::LimitMap& limits() const; /// Access to the converted regions const Geant4GeometryMaps::RegionMap& regions() const; - /// Access to the converted sensitive detectors - //const Geant4GeometryMaps::SensDetMap& sensitives() const; +#endif //@} }; diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C index 476d3d169..83c00d4bd 100644 --- a/DDG4/python/DDG4Dict.C +++ b/DDG4/python/DDG4Dict.C @@ -29,7 +29,6 @@ using namespace DD4hep::Simulation; #include "DDG4/Geant4Config.h" #include "DDG4/Geant4DataDump.h" #include "DDG4/Geant4InputAction.h" -#include <iostream> namespace DD4hep { namespace Simulation { @@ -235,83 +234,91 @@ namespace { #pragma link C++ class dd4hep_ptr<Geant4InputAction::Particles>::base_t; #endif -#pragma link C++ class ActionHandle; -#pragma link C++ class FilterHandle; -#pragma link C++ class RunActionHandle; -#pragma link C++ class PhaseActionHandle; -#pragma link C++ class GeneratorActionHandle; -#pragma link C++ class EventActionHandle; -#pragma link C++ class PhysicsListHandle; -#pragma link C++ class TrackingActionHandle; -#pragma link C++ class SteppingActionHandle; -#pragma link C++ class StackingActionHandle; -#pragma link C++ class SensitiveHandle; -#pragma link C++ class UserInitializationHandle; -#pragma link C++ class DetectorConstructionHandle; - -#pragma link C++ class GeneratorActionSequenceHandle; -#pragma link C++ class RunActionSequenceHandle; -#pragma link C++ class EventActionSequenceHandle; -#pragma link C++ class TrackingActionSequenceHandle; -#pragma link C++ class SteppingActionSequenceHandle; -#pragma link C++ class StackingActionSequenceHandle; -#pragma link C++ class PhysicsListActionSequenceHandle; -#pragma link C++ class SensDetActionSequenceHandle; -#pragma link C++ class UserInitializationSequenceHandle; -#pragma link C++ class DetectorConstructionSequenceHandle; - -#pragma link C++ class Geant4DataDump; - +// Basic stuff #pragma link C++ class Geant4ActionCreation; -#pragma link C++ class Geant4Action; #pragma link C++ class Geant4Kernel; #pragma link C++ class Geant4Kernel::PhaseSelector; #pragma link C++ class Geant4Context; #pragma link C++ class KernelHandle; -#pragma link C++ class Geant4Random; +#pragma link C++ class Geant4ActionContainer; +#pragma link C++ class Geant4Action; +#pragma link C++ class ActionHandle; + +#pragma link C++ class RunActionSequenceHandle; #pragma link C++ class Geant4RunActionSequence; +#pragma link C++ class RunActionHandle; +#pragma link C++ class Geant4SharedRunAction; #pragma link C++ class Geant4RunAction; +#pragma link C++ class EventActionSequenceHandle; #pragma link C++ class Geant4EventActionSequence; +#pragma link C++ class EventActionHandle; +#pragma link C++ class Geant4SharedEventAction; #pragma link C++ class Geant4EventAction; +#pragma link C++ class SteppingActionSequenceHandle; #pragma link C++ class Geant4SteppingActionSequence; +#pragma link C++ class SteppingActionHandle; +#pragma link C++ class Geant4SharedSteppingAction; #pragma link C++ class Geant4SteppingAction; -#pragma link C++ class Geant4StackingActionSequence; +#pragma link C++ class StackingActionHandle; #pragma link C++ class Geant4StackingAction; +#pragma link C++ class StackingActionSequenceHandle; +#pragma link C++ class Geant4StackingActionSequence; -#pragma link C++ class Geant4TrackingActionSequence; +#pragma link C++ class TrackingActionHandle; #pragma link C++ class Geant4TrackingAction; +#pragma link C++ class TrackingActionSequenceHandle; +#pragma link C++ class Geant4TrackingActionSequence; +#pragma link C++ class GeneratorActionHandle; +#pragma link C++ class GeneratorActionSequenceHandle; #pragma link C++ class Geant4GeneratorActionSequence; #pragma link C++ class Geant4GeneratorAction; + #pragma link C++ class Geant4InputAction; #pragma link C++ class Geant4EventReader; -#pragma link C++ class Geant4PhysicsListActionSequence; +#pragma link C++ class PhysicsListHandle; #pragma link C++ class Geant4PhysicsList; +#pragma link C++ class PhysicsListActionSequenceHandle; +#pragma link C++ class Geant4PhysicsListActionSequence; +#pragma link C++ class UserInitializationHandle; +#pragma link C++ class UserInitializationSequenceHandle; #pragma link C++ class Geant4UserInitializationSequence; #pragma link C++ class Geant4UserInitialization; +#pragma link C++ class DetectorConstructionHandle; +#pragma link C++ class DetectorConstructionSequenceHandle; #pragma link C++ class Geant4DetectorConstructionSequence; #pragma link C++ class Geant4DetectorConstruction; -#pragma link C++ class Geant4ParticleHandler; -#pragma link C++ class Geant4UserParticleHandler; -#pragma link C++ class Geant4Filter; +#pragma link C++ class SensitiveHandle; +#pragma link C++ class SensDetActionSequenceHandle; #pragma link C++ class Geant4ActionSD; #pragma link C++ class Geant4Sensitive; #pragma link C++ class Geant4SensDetActionSequence; +#pragma link C++ class FilterHandle; +#pragma link C++ class Geant4Filter; + +#pragma link C++ class PhaseActionHandle; #pragma link C++ class Geant4ActionPhase; #pragma link C++ class Geant4PhaseAction; + #pragma link C++ class Callback; #pragma link C++ class Callback::mfunc_t; -// Work around CINT bug: +// Other (specialized) components +#pragma link C++ class Geant4DataDump; +#pragma link C++ class Geant4Random; +#pragma link C++ class Geant4ParticleHandler; +#pragma link C++ class Geant4UserParticleHandler; + + // somehow the symbol Geometry moved into global namespace. Redeclare it here namespace Geometry {} #pragma link C++ namespace Geometry; diff --git a/DDG4/src/python/Geant4PythonCall.cpp b/DDG4/src/python/Geant4PythonCall.cpp index a580f40c6..1dc4a5743 100644 --- a/DDG4/src/python/Geant4PythonCall.cpp +++ b/DDG4/src/python/Geant4PythonCall.cpp @@ -16,6 +16,7 @@ // Framework include files #include "DDG4Python/Geant4PythonCall.h" #include "DDG4Python/DDPython.h" +#include "TPyReturn.h" // C/C++ include files #include <stdexcept> @@ -88,7 +89,9 @@ namespace DD4hep { namespace Simulation { INSTANTIATE(unsigned long); INSTANTIATE(float); INSTANTIATE(double); +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) INSTANTIATE(char*); +#endif INSTANTIATE(const char*); INSTANTIATE(PyObject*); INSTANTIATE(void*); diff --git a/DDG4/tpython/DDPython.cpp b/DDG4/tpython/DDPython.cpp index 64afefd54..878c62db5 100644 --- a/DDG4/tpython/DDPython.cpp +++ b/DDG4/tpython/DDPython.cpp @@ -21,6 +21,7 @@ #include "Python.h" #include <fstream> #include <sstream> +#include <stdexcept> #include <pthread.h> // Forward declartions diff --git a/DDRec/include/DDRec/Surface.h b/DDRec/include/DDRec/Surface.h index e273168bc..b4e484907 100644 --- a/DDRec/include/DDRec/Surface.h +++ b/DDRec/include/DDRec/Surface.h @@ -483,14 +483,14 @@ namespace DD4hep { class VolCylinder : public VolSurface{ public: - VolCylinder( Geometry::Volume vol, SurfaceType type_val, double thickness_inner ,double thickness_outer, Vector3D origin_pos ) : - VolSurface( new VolCylinderImpl( vol, type_val, thickness_inner , thickness_outer, origin_pos ) ) {} + VolCylinder( Geometry::Volume vol, SurfaceType typ_val, double thickness_inner ,double thickness_outer, Vector3D origin_val ) : + VolSurface( new VolCylinderImpl( vol, typ_val, thickness_inner , thickness_outer, origin_val ) ) {} } ; class VolCone : public VolSurface{ public: - VolCone( Geometry::Volume vol, SurfaceType type, double thickness_inner ,double thickness_outer, Vector3D v, Vector3D origin ) : - VolSurface( new VolConeImpl( vol, type, thickness_inner , thickness_outer, v, origin ) ) {} + VolCone( Geometry::Volume vol, SurfaceType typ_val, double thickness_inner ,double thickness_outer, Vector3D v_val, Vector3D origin_val ) : + VolSurface( new VolConeImpl( vol, typ_val, thickness_inner , thickness_outer, v_val, origin_val ) ) {} } ; //====================================================================================================== diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp index 7f22f0a71..614e9f596 100644 --- a/DDRec/src/Surface.cpp +++ b/DDRec/src/Surface.cpp @@ -319,27 +319,27 @@ namespace DD4hep { //================================================================================================================ VolConeImpl::VolConeImpl( Geometry::Volume vol, SurfaceType typ, - double thickness_inner ,double thickness_outer, Vector3D v, Vector3D o ) : + double thickness_inner ,double thickness_outer, Vector3D v_val, Vector3D o_val ) : - VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , v , Vector3D() , Vector3D() , vol, 0) { + VolSurfaceBase(typ, thickness_inner, thickness_outer, Vector3D() , v_val , Vector3D() , Vector3D() , vol, 0) { - Vector3D o_rphi( o.x() , o.y() , 0. ) ; + Vector3D o_rphi( o_val.x() , o_val.y() , 0. ) ; // sanity check: v and o have to have a common phi - double dphi = v.phi() - o_rphi.phi() ; + double dphi = v_val.phi() - o_rphi.phi() ; while( dphi < -M_PI ) dphi += 2.*M_PI ; while( dphi > M_PI ) dphi -= 2.*M_PI ; if( std::fabs( dphi ) > 1e-6 ){ - std::stringstream sst ; sst << "VolConeImpl::VolConeImpl() - incompatibel vector v and o given " - << v << " - " << o ; - throw std::runtime_error( sst.str() ) ; + std::stringstream sst ; sst << "VolConeImpl::VolConeImpl() - incompatibel vector v and o given " + << v_val << " - " << o_val ; + throw std::runtime_error( sst.str() ) ; } - Vector3D n( 1. , v.phi() , ( v.theta() + M_PI/2. ) , Vector3D::spherical ) ; - Vector3D u = v.cross( n ) ; + Vector3D n( 1. , v_val.phi() , ( v_val.theta() + M_PI/2. ) , Vector3D::spherical ) ; + Vector3D u_val = v_val.cross( n ) ; - setU( u ) ; + setU( u_val ) ; setOrigin( o_rphi ) ; setNormal( n ) ; diff --git a/doc/CompileAllOptionPermutations.sh b/doc/CompileAllOptionPermutations.sh index 79fa66b41..fcd6f9077 100755 --- a/doc/CompileAllOptionPermutations.sh +++ b/doc/CompileAllOptionPermutations.sh @@ -5,8 +5,8 @@ INSTALL_G4=${SW}/g4_10.01.p02_dbg/lib/Geant4-10.1.2; INSTALL_LCIO=${SW}/lcio/v02-04-03; INSTALL_XERCESC=${SW}/xercesc; CHECKOUT=${dir_name}/../../DD4hep.trunk/checkout; -export ROOTSYS=${SW}/root_v5.34.25_dbg; export ROOTSYS=${SW}/root_v6.04.00_dbg; +export ROOTSYS=${SW}/root_v5.34.25_dbg; . ${ROOTSYS}/bin/thisroot.sh; #cat ${ROOTSYS}/bin/thisroot.sh; # -- GitLab