diff --git a/DDAlign/CMakeLists.txt b/DDAlign/CMakeLists.txt index f7fbfdaacf1b152b6fd92fb106f4dabeecb0f52c..cd9365d592a733e15fad7afa17ca466572f23a87 100644 --- a/DDAlign/CMakeLists.txt +++ b/DDAlign/CMakeLists.txt @@ -21,7 +21,6 @@ add_library(DD4hepAlign SHARED ${sources}) target_link_libraries(DD4hepAlign DD4hepCore ${ROOT_LIBRARIES}) # # -SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") if(DD4HEP_USE_XERCESC) add_definitions(-DDD4HEP_USE_XERCESC) else() diff --git a/DDAlign/include/DDAlign/AlignmentStack.h b/DDAlign/include/DDAlign/AlignmentStack.h index 47e48701d463a6af0ade6dfb8ea6fa3d79e630db..f4933a293ff0d3e3da9b1e3f74a5cb5ac11b44a3 100644 --- a/DDAlign/include/DDAlign/AlignmentStack.h +++ b/DDAlign/include/DDAlign/AlignmentStack.h @@ -12,9 +12,8 @@ // Framework include files #include "DD4hep/Detector.h" #include "DD4hep/Objects.h" +#include "DD4hep/Memory.h" -// C/C++ include files -#include <memory> /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -31,7 +30,7 @@ namespace DD4hep { class AlignmentStack { public: - friend class std::auto_ptr<AlignmentStack>; + friend class dd4hep_ptr<AlignmentStack>; enum { OVERLAP_DEFINED = 1<<0, @@ -129,17 +128,17 @@ namespace DD4hep { /// Check existence of alignment stack static bool exists(); /// Add a new entry to the cache. The key is the placement path - static bool insert(const std::string& full_path, std::auto_ptr<StackEntry>& new_entry); + static bool insert(const std::string& full_path, dd4hep_ptr<StackEntry>& new_entry); /// Add a new entry to the cache. The key is the placement path. The placement path must be set in the entry - static bool insert(std::auto_ptr<StackEntry>& new_entry); + static bool insert(dd4hep_ptr<StackEntry>& new_entry); /// Clear data content and remove the slignment stack void release(); /// Access size of the alignment stack size_t size() const { return m_stack.size(); } /// Add a new entry to the cache. The key is the placement path - bool add(std::auto_ptr<StackEntry>& new_entry); + bool add(dd4hep_ptr<StackEntry>& new_entry); /// Retrieve an alignment entry of the current stack - std::auto_ptr<StackEntry> pop(); + dd4hep_ptr<StackEntry> pop(); /// Get all path entries to be aligned. Note: transient! std::vector<const StackEntry*> entries() const; }; diff --git a/DDAlign/src/AlignmentParser.cpp b/DDAlign/src/AlignmentParser.cpp index 9a17a2a3f6d2722fc9df7111e0d53667ed7208fd..4aa7d00f9c752aef91da78054b0c3d7ab776160c 100644 --- a/DDAlign/src/AlignmentParser.cpp +++ b/DDAlign/src/AlignmentParser.cpp @@ -200,7 +200,7 @@ template <> void Converter<volume>::operator()(xml_h e) const { if ( check ) flags |= AlignmentStack::CHECKOVL_DEFINED; if ( check_val ) flags |= AlignmentStack::CHECKOVL_VALUE; - auto_ptr<StackEntry> entry(new StackEntry(elt->first,placementPath,trafo.second,ovl,flags)); + dd4hep_ptr<StackEntry> entry(new StackEntry(elt->first,placementPath,trafo.second,ovl,flags)); AlignmentStack::insert(entry); pair<DetElement,string> vol_param(elt->first,subpath); xml_coll_t(e,_U(volume)).for_each(Converter<volume>(lcdd,&vol_param)); @@ -258,7 +258,7 @@ template <> void Converter<detelement>::operator()(xml_h e) const { placementPath.c_str(), yes_no(trafo.first), yes_no(reset), yes_no(reset_dau)); - auto_ptr<StackEntry> entry(new StackEntry(elt,placementPath,trafo.second,ovl,flags)); + dd4hep_ptr<StackEntry> entry(new StackEntry(elt,placementPath,trafo.second,ovl,flags)); AlignmentStack::insert(entry); pair<DetElement,string> vol_param(elt,""); diff --git a/DDAlign/src/AlignmentStack.cpp b/DDAlign/src/AlignmentStack.cpp index e089e6a2a7b05b1595a95c95b5439b51fc23214e..11c0ca791b8044e02691b848bfc385ea6ae7f0c5 100644 --- a/DDAlign/src/AlignmentStack.cpp +++ b/DDAlign/src/AlignmentStack.cpp @@ -17,13 +17,13 @@ using namespace std; using namespace DD4hep; using namespace DD4hep::Geometry; -static auto_ptr<AlignmentStack>& _stack() { - static auto_ptr<AlignmentStack> s; +static dd4hep_ptr<AlignmentStack>& _stack() { + static dd4hep_ptr<AlignmentStack> s; return s; } -static auto_ptr<AlignmentStack>& _stack(AlignmentStack* obj) { - auto_ptr<AlignmentStack>& s = _stack(); - s = auto_ptr<AlignmentStack>(obj); +static dd4hep_ptr<AlignmentStack>& _stack(AlignmentStack* obj) { + dd4hep_ptr<AlignmentStack>& s = _stack(); + s = dd4hep_ptr<AlignmentStack>(obj); return s; } @@ -196,7 +196,7 @@ void AlignmentStack::release() { } /// Add a new entry to the cache. The key is the placement path -bool AlignmentStack::insert(const string& full_path, auto_ptr<StackEntry>& entry) { +bool AlignmentStack::insert(const string& full_path, dd4hep_ptr<StackEntry>& entry) { if ( entry.get() && !full_path.empty() ) { entry->path = full_path; return get().add(entry); @@ -205,12 +205,12 @@ bool AlignmentStack::insert(const string& full_path, auto_ptr<StackEntry>& entry } /// Add a new entry to the cache. The key is the placement path -bool AlignmentStack::insert(auto_ptr<StackEntry>& entry) { +bool AlignmentStack::insert(dd4hep_ptr<StackEntry>& entry) { return get().add(entry); } /// Add a new entry to the cache. The key is the placement path -bool AlignmentStack::add(auto_ptr<StackEntry>& entry) { +bool AlignmentStack::add(dd4hep_ptr<StackEntry>& entry) { if ( entry.get() && !entry->path.empty() ) { Stack::const_iterator i = m_stack.find(entry->path); if ( i == m_stack.end() ) { @@ -231,12 +231,12 @@ bool AlignmentStack::add(auto_ptr<StackEntry>& entry) { } /// Retrieve an alignment entry of the current stack -auto_ptr<AlignmentStack::StackEntry> AlignmentStack::pop() { +dd4hep_ptr<AlignmentStack::StackEntry> AlignmentStack::pop() { Stack::iterator i = m_stack.begin(); if ( i != m_stack.end() ) { StackEntry* e = (*i).second; m_stack.erase(i); - return auto_ptr<StackEntry>(e); + return dd4hep_ptr<StackEntry>(e); } throw runtime_error("AlignmentStack> Alignment stack is empty. " "Cannot pop entries - check size first!"); diff --git a/DDCond/CMakeLists.txt b/DDCond/CMakeLists.txt index 3d3d8be05e6166f49478c538aad35d5ac8b04d49..090c89d688c1ded6147afb779ec0adce1d5ff3b4 100644 --- a/DDCond/CMakeLists.txt +++ b/DDCond/CMakeLists.txt @@ -21,8 +21,6 @@ include_directories(${CMAKE_SOURCE_DIR}/DDCore/include file(GLOB sources src/*.cpp) add_library(DD4hepCond SHARED ${sources}) target_link_libraries(DD4hepCond DD4hepCore ${ROOT_LIBRARIES}) -SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") - if(DD4HEP_USE_XERCESC) add_definitions(-DDD4HEP_USE_XERCESC) diff --git a/DDCond/include/DDCond/ConditionsStack.h b/DDCond/include/DDCond/ConditionsStack.h index c9bf36a89d6b7a2cc1cbb9d2f9c690d01d4b6168..7f7b0d2caf5c1c21978fa528825765d1781ca66c 100644 --- a/DDCond/include/DDCond/ConditionsStack.h +++ b/DDCond/include/DDCond/ConditionsStack.h @@ -11,9 +11,7 @@ // Framework include files #include "DD4hep/Detector.h" - -// C/C++ include files -#include <memory> +#include "DD4hep/Memory.h" /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -34,7 +32,7 @@ namespace DD4hep { */ class ConditionsStack { public: - friend class std::auto_ptr<ConditionsStack>; + friend class dd4hep_ptr<ConditionsStack>; typedef ConditionsInterna::Entry Entry; typedef std::map<std::string,Entry*> Stack; @@ -56,13 +54,13 @@ namespace DD4hep { /// Check existence of conditions stack static bool exists(); /// Push new entry into the stack - void insert(std::auto_ptr<Entry>& data); + void insert(dd4hep_ptr<Entry>& data); /// Clear data content and remove the slignment stack void release(); /// Access size of the conditions stack size_t size() const { return m_stack.size(); } /// Retrieve an conditions entry of the current stack - std::auto_ptr<Entry> pop(); + dd4hep_ptr<Entry> pop(); /// Get all path entries to be aligned. Note: transient! std::vector<const Entry*> entries() const; }; diff --git a/DDCond/src/ConditionsParser.cpp b/DDCond/src/ConditionsParser.cpp index 5cb4bcbbd32aa105b0977ae0f545fa4804508cc5..a088e4b3288e91f0f9c821f523a7da8bf264a81d 100644 --- a/DDCond/src/ConditionsParser.cpp +++ b/DDCond/src/ConditionsParser.cpp @@ -63,11 +63,11 @@ DetElement _getDetector(void* param, xml_h e) { } /// Helper: Extract the string value from the xml element -auto_ptr<Entry> _getStackEntry(void* param, xml_h element) { +dd4hep_ptr<Entry> _getStackEntry(void* param, xml_h element) { xml_comp_t e(element); DetElement elt = _getDetector(param, element); string name = e.hasAttr(_U(name)) ? e.nameStr() : e.tag(); - auto_ptr<Entry> result(new Entry(elt,name,e.tag(),_getValidity(element))); + dd4hep_ptr<Entry> result(new Entry(elt,name,e.tag(),_getValidity(element))); return result; } @@ -120,7 +120,7 @@ template <> void Converter<arbitrary>::operator()(xml_h e) const { else if ( tag == "detelements" ) xml_coll_t(e,_U(star)).for_each(Converter<conditions>(lcdd,param)); else { - auto_ptr<Entry> val(_getStackEntry(param,e)); + dd4hep_ptr<Entry> val(_getStackEntry(param,e)); val->value = elt.hasAttr(_U(value)) ? elt.valueStr() : e.text(); ConditionsStack::get().insert(val); } diff --git a/DDCond/src/ConditionsStack.cpp b/DDCond/src/ConditionsStack.cpp index bf51e4cf8b750507fcfae2f34a6820625a53f858..5f25ce1563e60be29ffffd2350ea10560bfda42c 100644 --- a/DDCond/src/ConditionsStack.cpp +++ b/DDCond/src/ConditionsStack.cpp @@ -17,13 +17,13 @@ using namespace std; using namespace DD4hep; using namespace DD4hep::Geometry; -static auto_ptr<ConditionsStack>& _stack() { - static auto_ptr<ConditionsStack> s; +static dd4hep_ptr<ConditionsStack>& _stack() { + static dd4hep_ptr<ConditionsStack> s; return s; } -static auto_ptr<ConditionsStack>& _stack(ConditionsStack* obj) { - auto_ptr<ConditionsStack>& s = _stack(); - s = auto_ptr<ConditionsStack>(obj); +static dd4hep_ptr<ConditionsStack>& _stack(ConditionsStack* obj) { + dd4hep_ptr<ConditionsStack>& s = _stack(); + s = dd4hep_ptr<ConditionsStack>(obj); return s; } @@ -67,12 +67,12 @@ void ConditionsStack::release() { } /// Retrieve an conditions entry of the current stack -auto_ptr<ConditionsStack::Entry> ConditionsStack::pop() { +dd4hep_ptr<ConditionsStack::Entry> ConditionsStack::pop() { Stack::iterator i = m_stack.begin(); if ( i != m_stack.end() ) { Entry* e = (*i).second; m_stack.erase(i); - return auto_ptr<Entry>(e); + return dd4hep_ptr<Entry>(e); } throw runtime_error("ConditionsStack> pop: Conditions stack is empty. Check size first!"); } @@ -87,7 +87,7 @@ vector<const ConditionsStack::Entry*> ConditionsStack::entries() const { } /// Push new entry into the stack -void ConditionsStack::insert(auto_ptr<Entry>& data) { +void ConditionsStack::insert(dd4hep_ptr<Entry>& data) { if ( data.get() && !data->name.empty() ) { DetElement det = data->detector; // Need to make some checks BEFORE insertion diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 990199c939f181949604429c5c91ebe55437cdc4..1deef8d2cd8b4fcca852f43bed54dd4e6237f06f 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -33,21 +33,21 @@ if(DD4HEP_USE_PYROOT) add_definitions(-DDD4HEP_USE_PYROOT) set(libraries ${libraries} PyROOT) endif() +if(NOT DD4HEP_NO_REFLEX) + set(libraries ${libraries} Reflex) +endif() add_library(DD4hepCore SHARED ${sources} ${parser_sources} ) -target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBRARIES} Geom Reflex ${libraries}) +target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XML_LIBRARIES} ${DDSegmentation_LIBRARIES} Geom ${libraries}) ## generates rootmap and installs the library add_dd4hep_plugin(DD4hepPlugins SHARED ${plugin_sources}) -target_link_libraries(DD4hepPlugins ${ROOT_LIBRARIES} ${XML_LIBRARIES} DD4hepCore Geom Reflex ${libraries}) +target_link_libraries(DD4hepPlugins ${ROOT_LIBRARIES} ${XML_LIBRARIES} DD4hepCore Geom ${libraries}) -SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") SET_TARGET_PROPERTIES( DD4hepCore DD4hepPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) - #--- install target------------------------------------- - install(DIRECTORY include/DD4hep include/XML DESTINATION include PATTERN ".svn" EXCLUDE ) diff --git a/DDCore/include/DD4hep/Detector.h b/DDCore/include/DD4hep/Detector.h index 05772ffe13e6d7c03e0c44f3903b4a6250306c4a..09e7af733da83760e670d423ef35dbf676eb520c 100644 --- a/DDCore/include/DD4hep/Detector.h +++ b/DDCore/include/DD4hep/Detector.h @@ -69,8 +69,8 @@ namespace DD4hep { } /// Constructor to copy handled object - SensitiveDetector(Object* ptr) - : RefObject(ptr) { + SensitiveDetector(Object* obj_pointer) + : RefObject(obj_pointer) { } /// Copy from named handle @@ -236,8 +236,8 @@ namespace DD4hep { } /// Constructor to hold handled object - DetElement(Object* ptr) - : RefObject(ptr) { + DetElement(Object* object_ptr) + : RefObject(object_ptr) { } /// Clone constructor @@ -306,11 +306,11 @@ namespace DD4hep { } /// Extend the detector element with an arbitrary callback template <typename Q, typename T> - void callAtUpdate(unsigned int type, Q* pointer, + void callAtUpdate(unsigned int typ, Q* pointer, void (T::*pmf)(unsigned long typ, DetElement& det, void* opt_par)) const { CallbackSequence::checkTypes(typeid(T), typeid(Q), dynamic_cast<T*>(pointer)); - i_addUpdateCall(type, Callback(pointer).make(pmf)); + i_addUpdateCall(typ, Callback(pointer).make(pmf)); } /// Remove callback from object void removeAtUpdate(unsigned int type, void* pointer) const; diff --git a/DDCore/include/DD4hep/LCDDData.h b/DDCore/include/DD4hep/LCDDData.h index 99ac9fcc4912880b9e7afa6b3f33dfe6f1db28d7..0cb40975c4606461d628cf52aa1145b45769efb5 100644 --- a/DDCore/include/DD4hep/LCDDData.h +++ b/DDCore/include/DD4hep/LCDDData.h @@ -48,7 +48,6 @@ namespace DD4hep { } }; - protected: /// Implementation of a map of named DD4hep Handles /** * \author M.Frank @@ -81,6 +80,7 @@ namespace DD4hep { } }; + protected: TGeoManager* m_manager; ObjectHandleMap m_readouts; ObjectHandleMap m_idDict; diff --git a/DDCore/include/DD4hep/Plugins_ROOT5.inl b/DDCore/include/DD4hep/Plugins_ROOT5.inl index f601084f197a50f169b0986102c74babe2f0ae33..8c387fdaba80ddb3943d7a86bd4bb5cec70a2c2f 100644 --- a/DDCore/include/DD4hep/Plugins_ROOT5.inl +++ b/DDCore/include/DD4hep/Plugins_ROOT5.inl @@ -125,7 +125,8 @@ namespace DD4hep { ROOT::Reflex::FunctionBuilder func(sig, fname.c_str(), stub, 0, "", ROOT::Reflex::PUBLIC); func.AddProperty("name", name).AddProperty("id", name); if ( PluginService::debug() ) { - printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",fname.c_str(),sig.Name().c_str()); + std::string sig_name = sig.Name(); + printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",fname.c_str(),sig_name.c_str()); } } } diff --git a/DDCore/include/DD4hep/Plugins_ROOT6.inl b/DDCore/include/DD4hep/Plugins_ROOT6.inl index 3405fdf7037bb00e536f15eeead0907c5313dd90..ceaa48928811256c388941724949b675f24bdd5f 100644 --- a/DDCore/include/DD4hep/Plugins_ROOT6.inl +++ b/DDCore/include/DD4hep/Plugins_ROOT6.inl @@ -6,8 +6,123 @@ // Author : M.Frank // //==================================================================== -#ifndef DD4HEP_PLUGINS_ROOT6 -#define DD4HEP_PLUGINS_ROOT6 +#ifndef DD4HEP_PLUGINS_ROOT6_INL +#define DD4HEP_PLUGINS_ROOT6_INL -#endif // DD4HEP_PLUGINS_ROOT6 +#include "DD4hep/Printout.h" + +/// The DD4hep namespace declaration +namespace DD4hep { + + /** Declaration and implementation of all templated Create methods. + * Concrete instances must be created using the instantiators below. + * + * \author M.Frank + * \date 10/03/2015 + */ + template <typename R> R PluginService::Create(const std::string& name) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name); } + + template <typename R, typename A0> R PluginService::Create(const std::string& name, A0 a0) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name,a0); } + + template <typename R, typename A0, typename A1> + R PluginService::Create(const std::string& name, A0 a0, A1 a1) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1); } + + template <typename R, typename A0, typename A1, typename A2> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2); } + + template <typename R, typename A0, typename A1, typename A2, typename A3> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3); } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4); } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> + R PluginService::Create(const std::string& name, A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) + { return 0; } // ROOT::Reflex::PluginService::Create<R>(name, a0, a1, a2, a3, a4, a5); } + + + /** Internal namespace -- should under no circumstances be used directly. + * The named namespace is necessary to trick the linker. Entries in an anonymous + * namespace would be oiptimized away..... + * + * \author M.Frank + * \date 10/03/2015 + */ + namespace plugin_signatures_namespace { + + namespace { + + /// Helper to convert function pointer to void pointer. + /** + * \author M.Frank + * \date 10/03/2015 + */ + template <typename T> union FuncPtr { + FuncPtr(T t) { fcn = t; } + void* ptr; + T fcn; + }; + /// Helper to convert function pointer to helper union + template <typename T> FuncPtr<T> __func(T t) { return FuncPtr<T>(t); } + } + + /// Defined required creator functions to instantiate the "Create" signatures. + /** The Create signatures are instantiated from a macro only containing + * the arguments. Otherwise these functions are + * pretty useless. + * + * \author M.Frank + * \date 10/03/2015 + */ + template <typename R> void* instantiate_creator () + { return __func(PluginService::Create<R>).ptr; } + + template <typename R, typename A0> void* instantiate_creator(A0) + { return __func(PluginService::Create<R,A0>).ptr; } + + template <typename R, typename A0, typename A1> void* instantiate_creator(A0,A1) + { return __func(PluginService::Create<R,A0,A1>).ptr; } + + template <typename R, typename A0, typename A1, typename A2> + void* instantiate_creator(A0,A1,A2) + { return __func(PluginService::Create<R,A0,A1,A2>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3> + void* instantiate_creator(A0,A1,A2,A3) + { return __func(PluginService::Create<R,A0,A1,A2,A3>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4> + void* instantiate_creator(A0,A1,A2,A3,A4) + { return __func(PluginService::Create<R,A0,A1,A2,A3,A4>).ptr; } + + template <typename R, typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> + void* instantiate_creator(A0,A1,A2,A3,A4,A5) + { return __func(PluginService::Create<R,A0,A1,A2,A3,A4,A5>).ptr; } + + + namespace { + template <typename SIGNATURE> static void reflex_plugin(const std::string& name, DD4hep::PluginService::stub_t /* stub */) { + if ( PluginService::debug() ) { + std::string sig_name = "?????"; + printout(INFO,"PluginService","+++ Declared factory for id %s with signature %s.",name.c_str(),sig_name.c_str()); + } + } + } + } +} + + + +#define DD4HEP_IMPLEMENT_PLUGIN_REGISTRY(R, ARGS) namespace DD4hep { \ + template <> void PluginRegistry< R ARGS >::add(const char* n, DD4hep::PluginService::stub_t f) \ + { plugin_signatures_namespace::reflex_plugin< R ARGS >(n,f); } \ + namespace plugin_signatures_namespace { template void* instantiate_creator<R> ARGS ; }} + +#endif // DD4HEP_PLUGINS_ROOT6_INL diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index ae040a870ad4d75130f603f3565af72056f2fb45..566f613a86da57ab76cbddf9844b30fc791f9b92 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -115,7 +115,7 @@ namespace DD4hep { class Box: public Solid_type<TGeoBBox> { protected: /// Internal helper method to support object construction - void make(const std::string& name, double x, double y, double z); + void make(double x_val, double y_val, double z_val); public: /// Constructor to be used with an existing object @@ -129,18 +129,18 @@ namespace DD4hep { } /// Constructor to create an anonymous new box object (retrieves name from volume) - Box(double x, double y, double z) { - make("", x, y, z); + Box(double x_val, double y_val, double z_val) { + make(x_val, y_val, z_val); } /// Constructor to create an anonymous new box object (retrieves name from volume) template <typename X, typename Y, typename Z> - Box(const X& x, const Y& y, const Z& z) { - make("", _toDouble(x), _toDouble(y), _toDouble(z)); + Box(const X& x_val, const Y& y_val, const Z& z_val) { + make(_toDouble(x_val), _toDouble(y_val), _toDouble(z_val)); } /// Set the box dimensions - Box& setDimensions(double x, double y, double z); + Box& setDimensions(double x_val, double y_val, double z_val); /// Access half "length" of the box double x() const; @@ -257,7 +257,7 @@ namespace DD4hep { class Tube: public Solid_type< /*TGeoTubeSeg */MyConeSeg> { protected: /// Internal helper method to support object construction - void make(const std::string& name, double rmin, double rmax, double z, double startPhi, double deltaPhi); + void make(const std::string& nam, double rmin, double rmax, double z, double startPhi, double deltaPhi); public: /// Constructor to be used with an existing object @@ -285,13 +285,13 @@ namespace DD4hep { } /// Legacy: Constructor to create a new identifiable tube object with attribute initialization - Tube(const std::string& name, double rmin, double rmax, double z) { - make(name, rmin, rmax, z, 0, 2*M_PI); + Tube(const std::string& nam, double rmin, double rmax, double z) { + make(nam, rmin, rmax, z, 0, 2*M_PI); } /// Legacy: Constructor to create a new identifiable tube object with attribute initialization - Tube(const std::string& name, double rmin, double rmax, double z, double deltaPhi) { - make(name, rmin, rmax, z, 0, deltaPhi); + Tube(const std::string& nam, double rmin, double rmax, double z, double deltaPhi) { + make(nam, rmin, rmax, z, 0, deltaPhi); } /// Constructor to create a new anonymous tube object with attribute initialization @@ -319,7 +319,7 @@ namespace DD4hep { class EllipticalTube: public Solid_type<TGeoEltu> { protected: /// Internal helper method to support object construction - void make(const std::string& name, double a, double b, double dz); + void make(double a, double b, double dz); public: /// Constructor to be used with an existing object @@ -329,12 +329,12 @@ namespace DD4hep { template <typename Q> EllipticalTube(const Handle<Q>& e) : Solid_type<TGeoEltu>(e) { } /// Constructor to create a new anonymous tube object with attribute initialization - EllipticalTube(double a, double b, double dz) { make("", a, b, dz); } + EllipticalTube(double a, double b, double dz) { make(a, b, dz); } /// Constructor to create a new anonymous tube object with attribute initialization template <typename A, typename B, typename DZ> EllipticalTube(const A& a, const B& b, const DZ& dz) { - make("", _toDouble(a), _toDouble(b), _toDouble(dz)); + make(_toDouble(a), _toDouble(b), _toDouble(dz)); } /// Set the tube dimensions @@ -353,7 +353,7 @@ namespace DD4hep { class Cone: public Solid_type<TGeoCone> { protected: /// Internal helper method to support object construction - void make(const std::string& name, double z, double rmin1, double rmax1, double rmin2, double rmax2); + void make(double z, double rmin1, double rmax1, double rmin2, double rmax2); public: /// Constructor to be used with an existing object @@ -368,12 +368,12 @@ namespace DD4hep { /// Constructor to create a new anonymous object with attribute initialization Cone(double z, double rmin1, double rmax1, double rmin2, double rmax2) { - make("", z, rmin1, rmax1, rmin2, rmax2); + make(z, rmin1, rmax1, rmin2, rmax2); } template <typename Z, typename RMIN1, typename RMAX1, typename RMIN2, typename RMAX2> Cone(const Z& z, const RMIN1& rmin1, const RMAX1& rmax1, const RMIN2& rmin2, const RMAX2& rmax2) { - make("", _toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); + make(_toDouble(z), _toDouble(rmin1), _toDouble(rmax1), _toDouble(rmin2), _toDouble(rmax2)); } /// Set the box dimensions @@ -524,7 +524,7 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - Sphere(const Sphere& e) + Sphere(const Sphere& e) : Solid_type<TGeoSphere>(e) { } @@ -615,8 +615,7 @@ namespace DD4hep { class PolyhedraRegular: public Solid_type<TGeoPgon> { protected: /// Helper function to create the polyhedron - void _create(const std::string& name, int nsides, double rmin, double rmax, double zpos, double zneg, double start, - double delta); + void _create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta); public: /// Constructor to be used with an existing object template <typename Q> PolyhedraRegular(const Q* p) @@ -624,7 +623,7 @@ namespace DD4hep { } /// Constructor to be used when passing an already created object - PolyhedraRegular(const PolyhedraRegular& e) + PolyhedraRegular(const PolyhedraRegular& e) : Solid_type<TGeoPgon>(e) { } diff --git a/DDCore/include/XML/DocumentHandler.h b/DDCore/include/XML/DocumentHandler.h index fe3d1d9b8d1c287ad82b8b77b778f7760c2df7d1..02b217030033d91db2a31f6e77824996112e1fcc 100644 --- a/DDCore/include/XML/DocumentHandler.h +++ b/DDCore/include/XML/DocumentHandler.h @@ -11,9 +11,7 @@ // Framework include files #include "XML/XMLElements.h" - -// C/C++ include files -#include <memory> +#include "DD4hep/Memory.h" /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -36,7 +34,8 @@ namespace DD4hep { class DocumentHandler { protected: /// Reference to the error handler object - std::auto_ptr<DocumentErrorHandler> m_errHdlr; + dd4hep_ptr<DocumentErrorHandler> m_errHdlr; + public: /// Default constructor DocumentHandler(); diff --git a/DDCore/include/XML/XMLDetector.h b/DDCore/include/XML/XMLDetector.h index d871acb199f1dd993be73ff33b7da6cfede0df08..09a060cafb0ad5fc22cb49c7e7dea7e8818a7219 100644 --- a/DDCore/include/XML/XMLDetector.h +++ b/DDCore/include/XML/XMLDetector.h @@ -81,8 +81,8 @@ namespace DD4hep { /// Helper to check a condition (for debugging) void check(bool condition, const std::string& msg) const; /// Access attribute by type - template <typename T> T attr(const XmlChar* tag) const { - return m_element.attr < T > (tag); + template <typename T> T attr(const XmlChar* tag_value) const { + return m_element.attr < T > (tag_value); } }; } diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index 62b3f80dd073202acbdbdf8a85a2b7aedae76a98..7faaa184de51c8f4a874cfa9b62b190cd51422cc 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -475,48 +475,48 @@ namespace DD4hep { #define INLINE inline typedef const XmlChar* cpXmlChar; - template <> INLINE Attribute Handle_t::attr<Attribute>(const XmlChar* tag) const { - return attr_ptr(tag); + template <> INLINE Attribute Handle_t::attr<Attribute>(const XmlChar* tag_value) const { + return attr_ptr(tag_value); } - template <> INLINE cpXmlChar Handle_t::attr<cpXmlChar>(const XmlChar* tag) const { - return attr_value(tag); + template <> INLINE cpXmlChar Handle_t::attr<cpXmlChar>(const XmlChar* tag_value) const { + return attr_value(tag_value); } - template <> INLINE bool Handle_t::attr<bool>(const XmlChar* tag) const { - return _toBool(attr_value(tag)); + template <> INLINE bool Handle_t::attr<bool>(const XmlChar* tag_value) const { + return _toBool(attr_value(tag_value)); } - template <> INLINE int Handle_t::attr<int>(const XmlChar* tag) const { - return _toInt(attr_value(tag)); + template <> INLINE int Handle_t::attr<int>(const XmlChar* tag_value) const { + return _toInt(attr_value(tag_value)); } - template <> INLINE float Handle_t::attr<float>(const XmlChar* tag) const { - return _toFloat(attr_value(tag)); + template <> INLINE float Handle_t::attr<float>(const XmlChar* tag_value) const { + return _toFloat(attr_value(tag_value)); } - template <> INLINE double Handle_t::attr<double>(const XmlChar* tag) const { - return _toDouble(attr_value(tag)); + template <> INLINE double Handle_t::attr<double>(const XmlChar* tag_value) const { + return _toDouble(attr_value(tag_value)); } - template <> INLINE std::string Handle_t::attr<std::string>(const XmlChar* tag) const { - return _toString(attr_value(tag)); + template <> INLINE std::string Handle_t::attr<std::string>(const XmlChar* tag_value) const { + return _toString(attr_value(tag_value)); } #if 0 - template<> INLINE bool Handle_t::attr<bool>(const Attribute tag) const - { return _toBool(attr_value(tag));} + template<> INLINE bool Handle_t::attr<bool>(const Attribute tag_value) const + { return _toBool(attr_value(tag_value));} - template<> INLINE int Handle_t::attr<int>(const Attribute tag) const - { return _toInt(attr_value(tag));} + template<> INLINE int Handle_t::attr<int>(const Attribute tag_value) const + { return _toInt(attr_value(tag_value));} - template<> INLINE float Handle_t::attr<float>(const Attribute tag) const - { return _toFloat(attr_value(tag));} + template<> INLINE float Handle_t::attr<float>(const Attribute tag_value) const + { return _toFloat(attr_value(tag_value));} - template<> INLINE double Handle_t::attr<double>(const Attribute tag) const - { return _toDouble(attr_value(tag));} + template<> INLINE double Handle_t::attr<double>(const Attribute tag_value) const + { return _toDouble(attr_value(tag_value));} - template<> INLINE std::string Handle_t::attr<std::string>(const Attribute tag) const - { return _toString(attr_value(tag));} + template<> INLINE std::string Handle_t::attr<std::string>(const Attribute tag_value) const + { return _toString(attr_value(tag_value));} #endif /// Class to support the access to collections of XmlNodes (or XmlElements) @@ -718,8 +718,8 @@ namespace DD4hep { return m_element.hasAttr(name); } /// Access attribute with implicit return type conversion - template <class T> T attr(const XmlChar* tag) const { - return m_element.attr<T>(tag); + template <class T> T attr(const XmlChar* tag_value) const { + return m_element.attr<T>(tag_value); } #ifndef __TIXML__ /// Access typed attribute value by it's name @@ -728,16 +728,16 @@ namespace DD4hep { } #endif /// Access attribute name (throws exception if not present) - const XmlChar* attr_name(const Attribute attr) const { - return m_element.attr_name(attr); + const XmlChar* attr_name(const Attribute a) const { + return m_element.attr_name(a); } /// Access attribute value by the attribute (throws exception if not present) - const XmlChar* attr_value(const Attribute attr) const { - return m_element.attr_value(attr); + const XmlChar* attr_value(const Attribute a) const { + return m_element.attr_value(a); } /// Access the number of children of this DOM element with a given tag name - size_t numChildren(const XmlChar* tag, bool exc = true) const { - return m_element.numChildren(tag, exc); + size_t numChildren(const XmlChar* tag_value, bool exc = true) const { + return m_element.numChildren(tag_value, exc); } /// Remove own attributes and copy all attributes from handle 'e' void setAttrs(Handle_t e) const { @@ -769,16 +769,16 @@ namespace DD4hep { /// Check if a child with the required tag exists - if not create it and add it to the current node Handle_t setChild(const XmlChar* tag) const; /// Access child by tag name. Thow an exception if required in case the child is not present - Handle_t child(const Strng_t& tag, bool except = true) const { - return m_element.child(tag, except); + Handle_t child(const Strng_t& tag_value, bool except = true) const { + return m_element.child(tag_value, except); } /// Remove a child node identified by its handle Handle_t remove(Handle_t node) const { return m_element.remove(node); } /// Check the existence of a child with a given tag name - bool hasChild(const XmlChar* tag) const { - return m_element.hasChild(tag); + bool hasChild(const XmlChar* tag_value) const { + return m_element.hasChild(tag_value); } /// Set the reference attribute to the node (adds attribute ref="ref-name") Attribute setRef(const XmlChar* tag, const XmlChar* refname) const; diff --git a/DDCore/src/BasicGrammarTypes.cpp b/DDCore/src/BasicGrammarTypes.cpp index a43e5f492623ad70cba415f85c8698063e5a9add..1f35683b60713a7b66cd8e5793309b46986b3d9c 100644 --- a/DDCore/src/BasicGrammarTypes.cpp +++ b/DDCore/src/BasicGrammarTypes.cpp @@ -9,26 +9,6 @@ // Framework include files #include "DD4hep/objects/BasicGrammar_inl.h" - -DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(char) -DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(short) - DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(int) - DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(long) - DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(long long) - - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(bool,eval_item) - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(float,eval_item) - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(double,eval_item) - - DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::string) - DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::vector<std::string>) - DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::list<std::string>) - DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::set<std::string>) - -// ROOT::Math Object instances - typedef std::map<std::string, int> map_string_int; -DD4HEP_DEFINE_PARSER_GRAMMAR(map_string_int,eval_obj) - namespace ROOT { namespace Math { static bool operator<(const XYZPoint& a, const XYZPoint& b) { @@ -52,6 +32,28 @@ namespace ROOT { } } } +template class std::less<ROOT::Math::XYZPoint>; +template class std::less<ROOT::Math::XYZVector>; +template class std::less<ROOT::Math::PxPyPzEVector>; + +DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(char) +DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(short) +DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(int) +DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(long) +DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT(long long) + +DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(bool,eval_item) +DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(float,eval_item) +DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(double,eval_item) + +DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::string) +DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::vector<std::string>) +DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::list<std::string>) +DD4HEP_DEFINE_PARSER_GRAMMAR_TYPE(std::set<std::string>) + +// ROOT::Math Object instances +typedef std::map<std::string, int> map_string_int; +DD4HEP_DEFINE_PARSER_GRAMMAR(map_string_int,eval_obj) DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(ROOT::Math::XYZPoint,eval_obj) DD4HEP_DEFINE_PARSER_GRAMMAR_CONT(ROOT::Math::XYZVector,eval_obj) diff --git a/DDCore/src/InstanceCount.cpp b/DDCore/src/InstanceCount.cpp index 6801fdc01375292ecdfb43b7d869a64e4ef0520d..3c532d548d2c34efe4a07327ba55f1353e96bd54 100644 --- a/DDCore/src/InstanceCount.cpp +++ b/DDCore/src/InstanceCount.cpp @@ -8,9 +8,9 @@ //==================================================================== #include "DD4hep/InstanceCount.h" #include "DD4hep/Handle.h" +#include "DD4hep/Memory.h" #include <iostream> #include <iomanip> -#include <memory> #include <cstdio> #include <cstdlib> #include <cstring> @@ -25,8 +25,8 @@ namespace { typedef std::map<const std::type_info*, COUNT*> TypeCounter; typedef std::map<const std::string*, COUNT*> StringCounter; static bool s_trace_instances = ::getenv("DD4HEP_TRACE") != 0; - static std::auto_ptr<TypeCounter> s_typCounts(new TypeCounter()); - static std::auto_ptr<StringCounter> s_strCounts(new StringCounter()); + static dd4hep_ptr<TypeCounter> s_typCounts(new TypeCounter()); + static dd4hep_ptr<StringCounter> s_strCounts(new StringCounter()); static InstanceCount::Counter s_nullCount; static InstanceCount::Counter s_thisCount; static InstanceCount s_counter; diff --git a/DDCore/src/Shapes.cpp b/DDCore/src/Shapes.cpp index d230bd8a78248756571b9ab5b96eac033e994f48..c582fe55206e86c5ff4f6c87de49fd7889221be0 100644 --- a/DDCore/src/Shapes.cpp +++ b/DDCore/src/Shapes.cpp @@ -159,13 +159,13 @@ template <typename T> const char* Solid_type<T>::name() const { return this->ptr()->GetName(); } -void Box::make(const string& name, double x, double y, double z) { - _assign(new TGeoBBox(x, y, z), name, "box", true); +void Box::make(double x_val, double y_val, double z_val) { + _assign(new TGeoBBox(x_val, y_val, z_val), "", "box", true); } /// Set the box dimensionsy -Box& Box::setDimensions(double x, double y, double z) { - double params[] = { x, y, z}; +Box& Box::setDimensions(double x_val, double y_val, double z_val) { + double params[] = { x_val, y_val, z_val}; _setDimensions(params); return *this; } @@ -262,8 +262,8 @@ Tube& Tube::setDimensions(double rmin, double rmax, double z, double startPhi, d } /// Constructor to be used when creating a new object with attribute initialization -void EllipticalTube::make(const string& name, double a, double b, double dz) { - _assign(new TGeoEltu(), name, "elliptic_tube", true); +void EllipticalTube::make(double a, double b, double dz) { + _assign(new TGeoEltu(), "", "elliptic_tube", true); setDimensions(a, b, dz); } @@ -275,8 +275,8 @@ EllipticalTube& EllipticalTube::setDimensions(double a, double b, double dz) { } /// Constructor to be used when creating a new object with attribute initialization -void Cone::make(const string& name, double z, double rmin1, double rmax1, double rmin2, double rmax2) { - _assign(new TGeoCone(z, rmin1, rmax1, rmin2, rmax2 ), name, "cone", true); +void Cone::make(double z, double rmin1, double rmax1, double rmin2, double rmax2) { + _assign(new TGeoCone(z, rmin1, rmax1, rmin2, rmax2 ), "", "cone", true); } Cone& Cone::setDimensions(double z, double rmin1, double rmax1, double rmin2, double rmax2) { @@ -378,30 +378,30 @@ Trap& Trap::setDimensions(double z, double theta, double phi, double y1, double } /// Helper function to create holy hedron -void PolyhedraRegular::_create(const string& name, int nsides, double rmin, double rmax, double zpos, double zneg, double start, +void PolyhedraRegular::_create(int nsides, double rmin, double rmax, double zpos, double zneg, double start, double delta) { if (rmin < 0e0 || rmin > rmax) throw runtime_error("DD4hep: PolyhedraRegular: Illegal argument rmin:<" + _toString(rmin) + "> is invalid!"); else if (rmax < 0e0) throw runtime_error("DD4hep: PolyhedraRegular: Illegal argument rmax:<" + _toString(rmax) + "> is invalid!"); - _assign(new TGeoPgon(), name, "polyhedra", false); + _assign(new TGeoPgon(), "", "polyhedra", false); double params[] = { start, delta, double(nsides), 2e0, zpos, rmin, rmax, zneg, rmin, rmax }; _setDimensions(¶ms[0]); } /// Constructor to be used when creating a new object PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zlen) { - _create("", nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 360.); + _create(nsides, rmin, rmax, zlen / 2, -zlen / 2, 0, 360.); } /// Constructor to be used when creating a new object PolyhedraRegular::PolyhedraRegular(int nsides, double phistart, double rmin, double rmax, double zlen) { - _create("", nsides, rmin, rmax, zlen / 2, -zlen / 2, phistart/dd4hep::deg, 360.); + _create(nsides, rmin, rmax, zlen / 2, -zlen / 2, phistart/dd4hep::deg, 360.); } /// Constructor to be used when creating a new object PolyhedraRegular::PolyhedraRegular(int nsides, double rmin, double rmax, double zplanes[2]) { - _create("", nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 360.); + _create(nsides, rmin, rmax, zplanes[0], zplanes[1], 0, 360.); } /// Creator method diff --git a/DDCore/src/XML/DocumentHandler.cpp b/DDCore/src/XML/DocumentHandler.cpp index 7e8c14f660032b0285c26a32251fb8402c03bb08..d5f7feb4fbe8bafa24af74b58507628206ff0399 100644 --- a/DDCore/src/XML/DocumentHandler.cpp +++ b/DDCore/src/XML/DocumentHandler.cpp @@ -56,7 +56,7 @@ namespace DD4hep { #if 0 // warning: unused function 'parse_document' [-Wunused-function] /// Helper function to parse a DOM document using an instance of the XercesC pareser Document parse_document(const void* bytes, size_t length, xercesc::ErrorHandler* err_handler) { - auto_ptr<XercesDOMParser> parser(make_parser(err_handler)); + dd4hep_ptr<XercesDOMParser> parser(make_parser(err_handler)); MemBufInputSource src((const XMLByte*) bytes, length, "memory"); parser->setValidationSchemaFullChecking(true); parser->parse(src); @@ -182,7 +182,7 @@ Document DocumentHandler::load(const std::string& fname) const { XMLURL xerurl = (const XMLCh*) Strng_t(fname); string path = _toString(xerurl.getPath()); string proto = _toString(xerurl.getProtocolName()); - auto_ptr < XercesDOMParser > parser(make_parser(m_errHdlr.get())); + dd4hep_ptr < XercesDOMParser > parser(make_parser(m_errHdlr.get())); printout(DEBUG,"DocumentHandler","+++ protocol:%s path:%s",proto.c_str(), path.c_str()); try { parser->parse(path.c_str()); @@ -203,7 +203,7 @@ Document DocumentHandler::load(const std::string& fname) const { /// Parse a standalong XML string into a document. Document DocumentHandler::parse(const char* bytes, size_t length) const { - auto_ptr < XercesDOMParser > parser(make_parser(m_errHdlr.get())); + dd4hep_ptr < XercesDOMParser > parser(make_parser(m_errHdlr.get())); MemBufInputSource src((const XMLByte*) bytes, length, "memory"); parser->setValidationSchemaFullChecking(true); parser->parse(src); diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp index 9af17febaf58072526dba3ecb78f682d9c77d242..37504865c21e551c49e5cd208cddb786e6d12922 100644 --- a/DDCore/src/plugins/Compact2Objects.cpp +++ b/DDCore/src/plugins/Compact2Objects.cpp @@ -617,7 +617,7 @@ template <> void Converter<Property>::operator()(xml_h e) const { prp.insert(make_pair(name, LCDD::PropertyValues())); } for (vector<xml_attr_t>::iterator i = a.begin(); i != a.end(); ++i) { - pair < string, string > val(xml_tag_t(e.attr_name(*i)), e.attr<string>(*i)); + pair < string, string > val(xml_tag_t(e.attr_name(*i)).str(), e.attr<string>(*i)); prp[name].insert(val); } } @@ -656,7 +656,7 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const { prp.insert(make_pair(props_name, CartesianField::PropertyValues())); } for (vector<xml_attr_t>::iterator i = a.begin(); i != a.end(); ++i) { - pair < string, string > val(xml_tag_t(c.attr_name(*i)), c.attr<string>(*i)); + pair < string, string > val(xml_tag_t(c.attr_name(*i)).str(), c.attr<string>(*i)); prp[props_name].insert(val); } if (c.hasAttr(_U(global)) && c.attr<bool>(_U(global))) { diff --git a/DDDetectors/CMakeLists.txt b/DDDetectors/CMakeLists.txt index 4b0b7a4e76d1d3ba4c93881e2b09feed0c3d21c7..e6d14b1af4daadfec21d96a7fbd580da09f25d1a 100644 --- a/DDDetectors/CMakeLists.txt +++ b/DDDetectors/CMakeLists.txt @@ -7,7 +7,11 @@ #----------------------------------------------------------------------------------- # #---Find ROOT----------------------------------------------------------------------- -find_package( ROOT REQUIRED COMPONENTS Geom Reflex ) +find_package( ROOT REQUIRED COMPONENTS Geom ) +#---Find and configure DD4hep basics------------------------------------------------ +include(DD4hep) +#---Find and configure Xerces------------------------------------------------------- +include(DD4hep_XML_setup) # #---Includedirs--------------------------------------------------------------------- include_directories(${CMAKE_SOURCE_DIR}/DDCore/include @@ -15,13 +19,11 @@ include_directories(${CMAKE_SOURCE_DIR}/DDCore/include ${CMAKE_SOURCE_DIR}/DDSurfaces/include ${CMAKE_SOURCE_DIR}/DDSegmentation/include ${ROOT_INCLUDE_DIR} ) -# #---Add Library--------------------------------------------------------------------- file(GLOB sources src/*.cpp ) -include(DD4hep_XML_setup) add_library( DD4hepDetectors SHARED ${sources}) -target_link_libraries( DD4hepDetectors DD4hepCore DD4hepRec ${ROOT_LIBRARIES} Reflex ) +target_link_libraries( DD4hepDetectors DD4hepCore DD4hepRec ${ROOT_LIBRARIES} ) # #---Rootmap generation-------------------------------------------------------------- dd4hep_generate_rootmap( DD4hepDetectors ) diff --git a/DDDetectors/src/LayeringExtensionPlugin.cpp b/DDDetectors/src/LayeringExtensionPlugin.cpp index 0f8b1745df87f6478acc8775698bf161f40a797f..d564117d9364132375b9d3c9ab30b84b92d77e80 100644 --- a/DDDetectors/src/LayeringExtensionPlugin.cpp +++ b/DDDetectors/src/LayeringExtensionPlugin.cpp @@ -36,7 +36,7 @@ namespace { /// Install volume information. Default implementation only prints! -template <typename T> void Installer<T>::install(DetElement de, PlacedVolume pv) { +template <typename T> void Installer<T>::install(DetElement de, PlacedVolume /* pv */) { if ( ::strstr(de.name(),"layer") != 0 ) { if ( !data.parent.isValid() ) { data.det = m_det; diff --git a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp index 3e5a62ee555c5c3a4689405ffbb129dc089b9a48..2d597708ae047432bc96a1b2e50d27f09642a68f 100644 --- a/DDDetectors/src/SiTrackerBarrel_surfaces.cpp +++ b/DDDetectors/src/SiTrackerBarrel_surfaces.cpp @@ -22,22 +22,15 @@ namespace{ for(int i=0; i<argc; ++i) { double value = -1; char* ptr = ::strchr(argv[i],'='); - if ( ptr ) { std::string name( argv[i] , ptr ) ; - value = DD4hep::Geometry::_toDouble(++ptr); - if( name=="dimension" ) data.dimension = value ; - std::cout << "DD4hep_SiTrackerBarrelSurfacePlugin: argument[" << i << "] = " << name << " = " << value << std::endl; } } - } - - - + } /// Install measurement surfaces template <typename UserData> @@ -67,9 +60,7 @@ namespace{ } else if( data.dimension != 2 ) { throw std::runtime_error("**** DD4hep_SiTrackerBarrelSurfacePlugin: no or wrong 'dimension' argument given - has to be 1 or 2") ; } - VolPlane surf(comp_vol, type, inner_thickness, outer_thickness, u, v, n, o); - addSurface(component,surf); } } diff --git a/DDDetectors/src/SiTrackerEndcap_surfaces.cpp b/DDDetectors/src/SiTrackerEndcap_surfaces.cpp index b8025f0886297ece0f27bc762a4f437d26f5f39c..bcd52d2c875745c28bec3e16820c4c4e4e03c318 100644 --- a/DDDetectors/src/SiTrackerEndcap_surfaces.cpp +++ b/DDDetectors/src/SiTrackerEndcap_surfaces.cpp @@ -24,7 +24,7 @@ void Installer<UserData>::install(DetElement component, PlacedVolume pv) { else if ( !handleUsingCache(component,comp_vol) ) { const double* trans = placementTranslation(component); double half_mod_thickness = mod_shape->GetDy1(); - double half_comp_thickness = comp_shape->GetDy1(); + //double half_comp_thickness = comp_shape->GetDy1(); double si_position = trans[1]; double outer_thickness = half_mod_thickness + si_position; double inner_thickness = half_mod_thickness - si_position; diff --git a/DDDetectors/src/SubdetectorExtensionPlugin.cpp b/DDDetectors/src/SubdetectorExtensionPlugin.cpp index ee32c42e60ef618d2d6bd6f2f3e1016c5b4a1e2d..4e904a4cb23d0e568fee6269aff439da855fbd05 100644 --- a/DDDetectors/src/SubdetectorExtensionPlugin.cpp +++ b/DDDetectors/src/SubdetectorExtensionPlugin.cpp @@ -12,7 +12,7 @@ #include "DD4hep/SurfaceInstaller.h" /// Install volume information. Default implementation only prints! -template <typename T> void Installer<T>::install(DetElement layer, PlacedVolume pv) { +template <typename T> void Installer<T>::install(DetElement /* layer */, PlacedVolume /* pv */) { using namespace DD4hep::DDRec; SubdetectorExtensionImpl* e = new SubdetectorExtensionImpl(m_det); m_det.addExtension<SubdetectorExtension>(e); diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 6a979e97e0d2b89db346bd87eba69b05ae779846..3b42c86abecfb27b2f32713a438e1408ac586e2d 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -1,6 +1,8 @@ #---Find Geant4------------------------------------------------------------------- find_package(Geant4 REQUIRED gdml ui_all vis_all) INCLUDE(${Geant4_USE_FILE}) # this also takes care of geant 4 definitions and include dirs +#---DD4hep functions and macros ------------------------------------------------------- +include( DD4hep ) #---Includedirs------------------------------------------------------------------- include_directories(${CMAKE_SOURCE_DIR}/DDCore/include ${CMAKE_SOURCE_DIR}/DDSegmentation/include @@ -15,17 +17,16 @@ file(GLOB sources src/*.cpp) if(NOT DD4HEP_USE_XERCESC) list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/src/Geant4XML.cpp) endif() -SET( CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") # add_library(DD4hepG4 SHARED ${sources}) -target_link_libraries(DD4hepG4 DD4hepCore ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) +target_link_libraries(DD4hepG4 DD4hepCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES}) SET_TARGET_PROPERTIES( DD4hepG4 PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) #----------------------------------------------------------------------------------- # No rootmap for link libraries! #--------------------------- Legacy libraries (for Frank) ------------------------- file(GLOB legacy_sources legacy/*.cpp) add_library(DD4hepG4Legacy SHARED ${legacy_sources}) -target_link_libraries(DD4hepG4Legacy DD4hepCore DD4hepG4 ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) +target_link_libraries(DD4hepG4Legacy DD4hepCore DD4hepG4 ${ROOT_LIBRARIES} ${Geant4_LIBRARIES}) SET_TARGET_PROPERTIES(DD4hepG4Legacy PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) dd4hep_generate_rootmap(DD4hepG4Legacy) @@ -36,7 +37,7 @@ root_generate_dictionary( G__DDG4 ${CMAKE_CURRENT_SOURCE_DIR}/python/DDG4Dict.C file(GLOB plugins_sources plugins/*.cpp) list(APPEND plugins_sources G__DDG4.cxx) add_library(DD4hepG4Plugins SHARED ${plugins_sources}) -target_link_libraries(DD4hepG4Plugins DD4hepCore DD4hepG4 ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) +target_link_libraries(DD4hepG4Plugins DD4hepCore DD4hepG4 ${ROOT_LIBRARIES} ${Geant4_LIBRARIES}) SET_TARGET_PROPERTIES(DD4hepG4Plugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) dd4hep_generate_rootmap(DD4hepG4Plugins) @@ -47,7 +48,7 @@ if(DD4HEP_USE_LCIO) include_directories( ${LCIO_INCLUDE_DIRS} ) file(GLOB lcio_sources lcio/*.cpp) add_library(DD4hepG4LCIO SHARED ${lcio_sources}) - target_link_libraries(DD4hepG4LCIO DD4hepCore DD4hepG4 ${Geant4_LIBRARIES} ${LCIO_LIBRARIES} ${ROOT_LIBRARIES} Reflex EG) + target_link_libraries(DD4hepG4LCIO DD4hepCore DD4hepG4 ${Geant4_LIBRARIES} ${LCIO_LIBRARIES} ${ROOT_LIBRARIES} EG) SET_TARGET_PROPERTIES(DD4hepG4LCIO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) dd4hep_generate_rootmap(DD4hepG4LCIO) endif() diff --git a/DDG4/g4gdmlDisplay.cpp b/DDG4/g4gdmlDisplay.cpp index 0d7808ff6ad76b54482096e625e73ef8bfeac227..a552703cc073eab41ddc6661b217224563c31656 100644 --- a/DDG4/g4gdmlDisplay.cpp +++ b/DDG4/g4gdmlDisplay.cpp @@ -53,10 +53,10 @@ int main(int argc, char** argv) { for(int i=1; i<argc;++i) { string nam = get_arg(argc,argv,i); if ( argv[i][0]=='-' ) { - string nam = argv[i]+1; - if ( strncmp(nam.c_str(),"gdml",4) == 0 ) + string n = argv[i]+1; + if ( ::strncmp(n.c_str(),"gdml",4) == 0 ) gdml = get_arg(argc,argv,++i); - else if ( strncmp(nam.c_str(),"guisetup",3) == 0 ) + else if ( ::strncmp(n.c_str(),"guisetup",3) == 0 ) setup = get_arg(argc,argv,++i); } } diff --git a/DDG4/include/DDG4/ComponentProperties_inl.h b/DDG4/include/DDG4/ComponentProperties_inl.h index 3eacb522811ebe0857c420f7a5c6372dd8385543..e0932cecab8aa80ddf01a9f6e30e3c2a3d8c65dc 100644 --- a/DDG4/include/DDG4/ComponentProperties_inl.h +++ b/DDG4/include/DDG4/ComponentProperties_inl.h @@ -34,11 +34,11 @@ namespace DD4hep { } /// Set value of this property - template <typename TYPE> void Property::set(const TYPE& value) { + template <typename TYPE> void Property::set(const TYPE& val) { const PropertyGrammar& g = grammar(); if (g.type() == typeid(TYPE)) - *(TYPE*) m_par = value; - else if (!g.fromString(m_par, BasicGrammar::instance< TYPE >().str(&value))) + *(TYPE*) m_par = val; + else if (!g.fromString(m_par, BasicGrammar::instance< TYPE >().str(&val))) PropertyGrammar::invalidConversion(typeid(TYPE), g.type()); } @@ -49,11 +49,11 @@ namespace DD4hep { } /// Retrieve value from stack (large values e.g. vectors etc.) - template <typename TYPE> void Property::value(TYPE& value) const { + template <typename TYPE> void Property::value(TYPE& val) const { const PropertyGrammar& g = grammar(); if (g.type() == typeid(TYPE)) - value = *(TYPE*) m_par; - else if (!BasicGrammar::instance< TYPE >().fromString(&value, this->str())) + val = *(TYPE*) m_par; + else if (!BasicGrammar::instance< TYPE >().fromString(&val, this->str())) PropertyGrammar::invalidConversion(g.type(), typeid(TYPE)); } diff --git a/DDG4/include/DDG4/DDG4Dict.h b/DDG4/include/DDG4/DDG4Dict.h index 3750db29d524c7d648b79f06ea23ab50aafe0ac9..d9525fcd0f806fb0e0cca7cdd7b3497cdf14a48c 100644 --- a/DDG4/include/DDG4/DDG4Dict.h +++ b/DDG4/include/DDG4/DDG4Dict.h @@ -37,19 +37,24 @@ namespace DD4hep { #pragma link C++ class DD4hep::Simulation::SimpleEvent+; #pragma link C++ class DD4hep::Simulation::DataExtension+; -#pragma link C++ class std::auto_ptr<DD4hep::Simulation::DataExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::DataExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::DataExtension>::base_t+; /// Dictionaires for Geant4 particles #pragma link C++ class DD4hep::Simulation::ParticleExtension+; -#pragma link C++ class std::auto_ptr<DD4hep::Simulation::ParticleExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::ParticleExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::ParticleExtension>::base_t+; #pragma link C++ class DD4hep::Simulation::Geant4Particle+; #pragma link C++ class std::vector<DD4hep::Simulation::Geant4Particle*>+; #pragma link C++ class std::map<int,DD4hep::Simulation::Geant4Particle*>+; #pragma link C++ class map<int,DD4hep::Simulation::Geant4Particle*>::iterator; #pragma link C++ class map<int,DD4hep::Simulation::Geant4Particle*>::const_iterator; + +#ifdef R__MACOSX +// We only need these declarations for the clang compiler #pragma link C++ function operator==( const map<int,DD4hep::Simulation::Geant4Particle*>::iterator&, const map<int,DD4hep::Simulation::Geant4Particle*>::iterator& ); #pragma link C++ function operator!=( const map<int,DD4hep::Simulation::Geant4Particle*>::iterator&, const map<int,DD4hep::Simulation::Geant4Particle*>::iterator& ); - +#endif /// Dictionaires for basic Hit data structures #pragma link C++ class DD4hep::Simulation::Geant4HitData+; diff --git a/DDG4/include/DDG4/Geant4Data.h b/DDG4/include/DDG4/Geant4Data.h index e3bb3969030fa63a1896fc72185867c558e51c8a..7047181c604653a59210d77aed966c50c8f265b7 100644 --- a/DDG4/include/DDG4/Geant4Data.h +++ b/DDG4/include/DDG4/Geant4Data.h @@ -10,11 +10,11 @@ #define DD4HEP_GEANT4DATA_H // Framework include files +#include "DD4hep/Memory.h" #include "Math/Vector3D.h" // C/C++ include files #include <set> -#include <memory> #include <vector> // Forward declarations @@ -104,7 +104,7 @@ namespace DD4hep { /// cellID long long int cellID; /// User data extension if required - std::auto_ptr<DataExtension> extension; + dd4hep_ptr<DataExtension> extension; /// Utility class describing the monte carlo contribution of a given particle to a hit. /** diff --git a/DDG4/include/DDG4/Geant4DataConversion.h b/DDG4/include/DDG4/Geant4DataConversion.h index 758c26b47bd856bac97da650787fa966958574e9..65d14693edf9b8973d7fe1eb7d6b8a7604c9d027 100644 --- a/DDG4/include/DDG4/Geant4DataConversion.h +++ b/DDG4/include/DDG4/Geant4DataConversion.h @@ -91,8 +91,8 @@ namespace DD4hep { typename Geant4Conversion<OUTPUT,ARGS>::Converters& Geant4Conversion<OUTPUT,ARGS>::conversions() { - static Converters m; - return m; + static Converters s_converter; + return s_converter; } template <typename OUTPUT, typename ARGS> diff --git a/DDG4/include/DDG4/Geant4HitCollection.h b/DDG4/include/DDG4/Geant4HitCollection.h index 8672a718d0ecf80f545b8d60239958e662327641..e4ebefad56bf48bf1d31e2603ab988210cbb5661 100644 --- a/DDG4/include/DDG4/Geant4HitCollection.h +++ b/DDG4/include/DDG4/Geant4HitCollection.h @@ -93,8 +93,8 @@ namespace DD4hep { obj.first = 0; } template <typename TYPE> static HitManipulator* instance() { - static HitManipulator m(ComponentCast::instance<TYPE>(), ComponentCast::instance<std::vector<TYPE*> >()); - return &m; + static HitManipulator hm(ComponentCast::instance<TYPE>(), ComponentCast::instance<std::vector<TYPE*> >()); + return &hm; } }; @@ -266,8 +266,8 @@ namespace DD4hep { return m_hits.at(which); } /// Add a new hit with a check, that the hit is of the same type - template <typename TYPE> void add(TYPE* hit) { - Geant4HitWrapper w(m_manipulator->castHit(hit)); + template <typename TYPE> void add(TYPE* hit_pointer) { + Geant4HitWrapper w(m_manipulator->castHit(hit_pointer)); m_hits.push_back(w); } /// Find hits in a collection by comparison of attributes diff --git a/DDG4/include/DDG4/Geant4Particle.h b/DDG4/include/DDG4/Geant4Particle.h index d7f9f1685bbf0a7f4a3dba7bbf7558886f4330ca..1ceed2b96d66529fd77954ae3f00075d53b70d2c 100644 --- a/DDG4/include/DDG4/Geant4Particle.h +++ b/DDG4/include/DDG4/Geant4Particle.h @@ -10,6 +10,7 @@ #define DD4HEP_GEANT4PARTICLE_H // Framework include files +#include "DD4hep/Memory.h" // ROOT includes #include "Math/Vector4D.h" @@ -21,7 +22,6 @@ class G4VProcess; // C/C++ include files #include <set> #include <map> -#include <memory> /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -116,7 +116,7 @@ namespace DD4hep { Particles daughters; /// User data extension if required - std::auto_ptr<ParticleExtension> extension; + dd4hep_ptr<ParticleExtension> extension; const G4VProcess *process; //! not persistent //const G4ParticleDefinition *definition; //! not persistent /// Default constructor diff --git a/DDG4/include/DDG4/Geant4Primary.h b/DDG4/include/DDG4/Geant4Primary.h index 416aa453942d7c7105706db945032366bd7fb900..562bd3d5a3931d5f6a549b09a0ffcf975d042a44 100644 --- a/DDG4/include/DDG4/Geant4Primary.h +++ b/DDG4/include/DDG4/Geant4Primary.h @@ -10,6 +10,7 @@ #define DD4HEP_GEANT4PRIMARY_H // Framework include files +#include "DD4hep/Memory.h" #include "DDG4/Geant4Vertex.h" #include "DDG4/Geant4Particle.h" @@ -81,11 +82,11 @@ namespace DD4hep { Geant4PrimaryInteraction& operator=(const Geant4PrimaryInteraction& c); public: - typedef Geant4Particle Particle; - typedef Geant4Vertex Vertex; - typedef std::map<int,Particle*> ParticleMap; - typedef std::map<int,Vertex*> VertexMap; - typedef std::auto_ptr<PrimaryExtension> ExtensionHandle; + typedef Geant4Particle Particle; + typedef Geant4Vertex Vertex; + typedef std::map<int,Particle*> ParticleMap; + typedef std::map<int,Vertex*> VertexMap; + typedef dd4hep_ptr<PrimaryExtension> ExtensionHandle; /// The map of primary vertices for the particles. VertexMap vertices; @@ -127,9 +128,9 @@ namespace DD4hep { Geant4PrimaryEvent& operator=(const Geant4PrimaryEvent& c); public: - typedef Geant4PrimaryInteraction Interaction; - typedef std::map<int,Interaction*> Interactions; - typedef std::auto_ptr<PrimaryExtension> ExtensionHandle; + typedef Geant4PrimaryInteraction Interaction; + typedef std::map<int,Interaction*> Interactions; + typedef dd4hep_ptr<PrimaryExtension> ExtensionHandle; protected: /// Set of primary interactions diff --git a/DDG4/include/DDG4/Geant4SensDetAction.inl b/DDG4/include/DDG4/Geant4SensDetAction.inl index ae979100cbb7d79e8c71072488dd2c57007eac14..b586965013e4fa51643dfab7e43329ae1cc718ce 100644 --- a/DDG4/include/DDG4/Geant4SensDetAction.inl +++ b/DDG4/include/DDG4/Geant4SensDetAction.inl @@ -1,76 +1,76 @@ - // $Id: $ - //==================================================================== - // AIDA Detector description implementation for LCD - //-------------------------------------------------------------------- - // - // Author : M.Frank - // - //==================================================================== +// $Id: $ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Author : M.Frank +// +//==================================================================== - // Framework include files - #ifndef DD4HEP_DDG4_GEANT4SENSDETACTION_H - #include "DDG4/Geant4SensDetAction.h" - #endif - #include "DD4hep/InstanceCount.h" - #include "DDG4/Geant4Data.h" +// Framework include files +#ifndef DD4HEP_DDG4_GEANT4SENSDETACTION_H +#include "DDG4/Geant4SensDetAction.h" +#endif +#include "DD4hep/InstanceCount.h" +#include "DDG4/Geant4Data.h" - namespace DD4hep { - namespace Simulation { +namespace DD4hep { + namespace Simulation { - /// Standard , initializing constructor - template <typename T> - Geant4SensitiveAction<T>::Geant4SensitiveAction(Geant4Context* context, - const std::string& name, - Geometry::DetElement det, - Geometry::LCDD& lcdd) - : Geant4Sensitive(context,name,det,lcdd), m_collectionID(0) - { - initialize(); - defineCollections(); - InstanceCount::increment(this); - } + /// Standard , initializing constructor + template <typename T> + Geant4SensitiveAction<T>::Geant4SensitiveAction(Geant4Context* ctxt, + const std::string& nam, + Geometry::DetElement det, + Geometry::LCDD& lcdd_ref) + : Geant4Sensitive(ctxt,nam,det,lcdd_ref), m_collectionID(0) + { + initialize(); + defineCollections(); + InstanceCount::increment(this); + } - /// Default destructor - template <typename T> Geant4SensitiveAction<T>::~Geant4SensitiveAction() { - finalize(); - InstanceCount::decrement(this); - } + /// Default destructor + template <typename T> Geant4SensitiveAction<T>::~Geant4SensitiveAction() { + finalize(); + InstanceCount::decrement(this); + } - /// Initialization overload for specialization - template <typename T> void Geant4SensitiveAction<T>::initialize() { - } + /// Initialization overload for specialization + template <typename T> void Geant4SensitiveAction<T>::initialize() { + } - /// Finalization overload for specialization - template <typename T> void Geant4SensitiveAction<T>::finalize() { - } + /// Finalization overload for specialization + template <typename T> void Geant4SensitiveAction<T>::finalize() { + } - /// G4VSensitiveDetector interface: Method invoked at the begining of each event. - template <typename T> void Geant4SensitiveAction<T>::begin(G4HCofThisEvent* hce) { - Geant4Sensitive::begin(hce); - } + /// G4VSensitiveDetector interface: Method invoked at the begining of each event. + template <typename T> void Geant4SensitiveAction<T>::begin(G4HCofThisEvent* hce) { + Geant4Sensitive::begin(hce); + } - /// G4VSensitiveDetector interface: Method invoked at the end of each event. - template <typename T> void Geant4SensitiveAction<T>::end(G4HCofThisEvent* hce) { - Geant4Sensitive::end(hce); - } + /// G4VSensitiveDetector interface: Method invoked at the end of each event. + template <typename T> void Geant4SensitiveAction<T>::end(G4HCofThisEvent* hce) { + Geant4Sensitive::end(hce); + } - /// G4VSensitiveDetector interface: Method for generating hit(s) using the G4Step object. - template <typename T> bool Geant4SensitiveAction<T>::process(G4Step* step,G4TouchableHistory* history) { - return Geant4Sensitive::process(step,history); - } + /// G4VSensitiveDetector interface: Method for generating hit(s) using the G4Step object. + template <typename T> bool Geant4SensitiveAction<T>::process(G4Step* step,G4TouchableHistory* history) { + return Geant4Sensitive::process(step,history); + } - /// G4VSensitiveDetector interface: Method invoked if the event was aborted. - template <typename T> void Geant4SensitiveAction<T>::clear(G4HCofThisEvent* hce) { - Geant4Sensitive::clear(hce); - } + /// G4VSensitiveDetector interface: Method invoked if the event was aborted. + template <typename T> void Geant4SensitiveAction<T>::clear(G4HCofThisEvent* hce) { + Geant4Sensitive::clear(hce); + } - // Forward declarations - typedef Geant4HitData::Contribution HitContribution; - } - } + // Forward declarations + typedef Geant4HitData::Contribution HitContribution; + } +} - #include "DD4hep/Printout.h" - #include "DDG4/Geant4TouchableHandler.h" - #include "DDG4/Geant4StepHandler.h" - #include "DDG4/Geant4VolumeManager.h" +#include "DD4hep/Printout.h" +#include "DDG4/Geant4TouchableHandler.h" +#include "DDG4/Geant4StepHandler.h" +#include "DDG4/Geant4VolumeManager.h" diff --git a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h index a8bbf2141e65257e7ef9f77d34dccb0c7e883598..9b1d8cf8223e1a8fd68ac67fd9c0b161f48089ac 100644 --- a/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h +++ b/DDG4/include/DDG4/Geant4SensitiveDetector_inline.h @@ -13,8 +13,8 @@ #include "DDG4/Geant4SensitiveDetector.h" /// Constructor. The sensitive detector element is identified by the detector name -template <class SD> DD4hep::Simulation::Geant4GenericSD<SD>::Geant4GenericSD(const std::string& name, LCDD& lcdd) -: Geant4SensitiveDetector(name, lcdd) { +template <class SD> DD4hep::Simulation::Geant4GenericSD<SD>::Geant4GenericSD(const std::string& nam, LCDD& lcdd_ref) +: Geant4SensitiveDetector(nam, lcdd_ref) { defineCollection(m_sensitive.hitsCollection()); } diff --git a/DDG4/include/DDG4/Geant4StackingAction.h b/DDG4/include/DDG4/Geant4StackingAction.h index 5066c4f217741040159fffbaf414f9a3484e5d7a..c7db44b4c66e91db2c21f6e4b9003f964c8f7d17 100644 --- a/DDG4/include/DDG4/Geant4StackingAction.h +++ b/DDG4/include/DDG4/Geant4StackingAction.h @@ -27,7 +27,7 @@ namespace DD4hep { class Geant4StackingAction: public Geant4Action { public: /// Standard constructor - Geant4StackingAction(Geant4Context* context, const std::string& name); + Geant4StackingAction(Geant4Context* ctxt, const std::string& name); /// Default destructor virtual ~Geant4StackingAction(); /// New-stage callback @@ -58,7 +58,7 @@ namespace DD4hep { Actors<Geant4StackingAction> m_actors; public: /// Standard constructor - Geant4StackingActionSequence(Geant4Context* context, const std::string& name); + Geant4StackingActionSequence(Geant4Context* ctxt, const std::string& name); /// Default destructor virtual ~Geant4StackingActionSequence(); /// Register begin-of-event callback. Types Q and T must be polymorph! diff --git a/DDG4/include/DDG4/Geant4Vertex.h b/DDG4/include/DDG4/Geant4Vertex.h index c705dffe4ae2e0e8bbc011bb4226b3a0de3e05a8..f025f9e00c6ddd5f2464fdf211fde410f1c27116 100644 --- a/DDG4/include/DDG4/Geant4Vertex.h +++ b/DDG4/include/DDG4/Geant4Vertex.h @@ -9,9 +9,11 @@ #ifndef DD4HEP_GEANT4VERTEX_H #define DD4HEP_GEANT4VERTEX_H +// Framework include files +#include "DD4hep/Memory.h" + // C/C++ include files #include <set> -#include <memory> /// Namespace for the AIDA detector description toolkit namespace DD4hep { @@ -50,7 +52,7 @@ namespace DD4hep { /// The list of incoming particles Particles in; /// User data extension if required - std::auto_ptr<VertexExtension> extension; + dd4hep_ptr<VertexExtension> extension; /// Default constructor Geant4Vertex(); diff --git a/DDG4/lcio/Geant4Output2LCIO.cpp b/DDG4/lcio/Geant4Output2LCIO.cpp index 2aa8ff6ded5a733769886ecf6bd34aab50425f84..248b04b4dcaa6fb5dc07328fa32debde16db0bee 100644 --- a/DDG4/lcio/Geant4Output2LCIO.cpp +++ b/DDG4/lcio/Geant4Output2LCIO.cpp @@ -44,7 +44,7 @@ namespace DD4hep { lcio::LCCollectionVec* saveParticles(Geant4ParticleMap* particles); public: /// Standard constructor - Geant4Output2LCIO(Geant4Context* context, const std::string& nam); + Geant4Output2LCIO(Geant4Context* ctxt, const std::string& nam); /// Default destructor virtual ~Geant4Output2LCIO(); /// Callback to store the Geant4 run information diff --git a/DDG4/lcio/LCIOConversions.cpp b/DDG4/lcio/LCIOConversions.cpp index be31bed962e390a1852ca533b807c6fc907b9e8b..7f5b75c3b0582a5a07559348ffaaf6b6c068a908 100644 --- a/DDG4/lcio/LCIOConversions.cpp +++ b/DDG4/lcio/LCIOConversions.cpp @@ -184,10 +184,10 @@ namespace DD4hep { for(Contributions::const_iterator j=hit->truth.begin(); j!=hit->truth.end(); ++j) { const Geant4HitData::Contribution& c = *j; int trackID = pm->particleID(c.trackID); - float pos[] = {float(c.x/mm), float(c.y/mm), float(c.z/mm)}; + float contrib_pos[] = {float(c.x/mm), float(c.y/mm), float(c.z/mm)}; EVENT::MCParticle* lc_mcp = (EVENT::MCParticle*)lc_parts->getElementAt(trackID); if ( hit_creation_mode == Geant4Sensitive::DETAILED_MODE ) - lc_hit->addMCParticleContribution(lc_mcp, c.deposit/GeV, c.time/ns, lc_mcp->getPDG(), pos); + lc_hit->addMCParticleContribution(lc_mcp, c.deposit/GeV, c.time/ns, lc_mcp->getPDG(), contrib_pos); else lc_hit->addMCParticleContribution(lc_mcp, c.deposit/GeV, c.time/ns); } diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp index 5bda98d11ec22d5971a62b790a5c48d1d6b7da57..7d42b5d7bd18df5764e9849f817c3d7fc325175f 100644 --- a/DDG4/lcio/LCIOEventReader.cpp +++ b/DDG4/lcio/LCIOEventReader.cpp @@ -61,11 +61,11 @@ LCIOEventReader::readParticles(int event_number, vector<Particle*>& particles) EventReaderStatus ret = EVENT_READER_OK; if ( hasDirectAccess() ) - ret = readParticles(event_number,&primaries); + ret = readParticleCollection(event_number,&primaries); else if ( m_numEvent == event_number ) - ret = readParticles(event_number,&primaries); + ret = readParticleCollection(event_number,&primaries); else - ret = readParticles(event_number,&primaries); + ret = readParticleCollection(event_number,&primaries); //ret = EVENT_READER_NO_DIRECT; ++m_numEvent; diff --git a/DDG4/lcio/LCIOEventReader.h b/DDG4/lcio/LCIOEventReader.h index fa9f0e8199032b3546607fc254260eb6830eb9ef..50eeff9d4474bbf545f279bbe22984cc8b758f4f 100644 --- a/DDG4/lcio/LCIOEventReader.h +++ b/DDG4/lcio/LCIOEventReader.h @@ -38,7 +38,7 @@ namespace DD4hep { /// Read an event and fill a vector of MCParticles. virtual EventReaderStatus readParticles(int event_number, std::vector<Particle*>& particles); /// Read an event and return a LCCollectionVec of MCParticles. - virtual EventReaderStatus readParticles(int event_number, EVENT::LCCollection** particles) = 0; + virtual EventReaderStatus readParticleCollection(int event_number, EVENT::LCCollection** particles) = 0; }; } /* End namespace Simulation */ diff --git a/DDG4/lcio/LCIOFileReader.cpp b/DDG4/lcio/LCIOFileReader.cpp index a5a2914ca251dfd7d0083f7e92936f55eaceaf16..16a7fc8efc60c5bd004b3b4f91dff3182ca9a1b6 100644 --- a/DDG4/lcio/LCIOFileReader.cpp +++ b/DDG4/lcio/LCIOFileReader.cpp @@ -36,7 +36,7 @@ namespace DD4hep { /// Default destructor virtual ~LCIOFileReader(); /// Read an event and fill a vector of MCParticles. - virtual EventReaderStatus readParticles(int event_number, EVENT::LCCollection** particles); + virtual EventReaderStatus readParticleCollection(int event_number, EVENT::LCCollection** particles); }; } } @@ -67,7 +67,7 @@ DD4hep::Simulation::LCIOFileReader::~LCIOFileReader() { /// Read an event and fill a vector of MCParticles. Geant4EventReader::EventReaderStatus -DD4hep::Simulation::LCIOFileReader::readParticles(int /*event_number */, EVENT::LCCollection** particles) { +DD4hep::Simulation::LCIOFileReader::readParticleCollection(int /*event_number */, EVENT::LCCollection** particles) { ::lcio::LCEvent* evt = m_reader->readNextEvent(); if ( evt ) { *particles = evt->getCollection(LCIO::MCPARTICLE); diff --git a/DDG4/lcio/LCIOSDTestActions.cpp b/DDG4/lcio/LCIOSDTestActions.cpp index e30c5dd3280997bb0fd489dd7d0a99b9142b1d34..05a7b108b780561262c48190f84cefb75d4c8334 100644 --- a/DDG4/lcio/LCIOSDTestActions.cpp +++ b/DDG4/lcio/LCIOSDTestActions.cpp @@ -45,8 +45,8 @@ namespace Tests { public: // typedef SimpleHit::Contribution HitContribution; // Standard , initializing constructor - Geant4SensitiveAction(Geant4Context* context, const std::string& name, DetElement det, LCDD& lcdd) - : Geant4Sensitive(context,name,det,lcdd), m_collectionID(0) { + Geant4SensitiveAction(Geant4Context* ctxt, const std::string& nam, DetElement det, LCDD& lcdd_ref) + : Geant4Sensitive(ctxt,nam,det,lcdd_ref), m_collectionID(0) { declareProperty("detailedHitsStoring", _detailedHitsStoring ) ; defineCollections(); InstanceCount::increment(this); @@ -116,9 +116,9 @@ namespace Tests { // HitContribution contrib = Hit::extractContribution(step); - VolumeID cellID = volumeID( step ) ; - hit->setCellID0( cellID & 0xffffffff ) ; - hit->setCellID1( ( cellID >> 32 ) & 0xffffffff ) ; + VolumeID cell = volumeID( step ) ; + hit->setCellID0( cell & 0xffffffff ) ; + hit->setCellID1( ( cell >> 32 ) & 0xffffffff ) ; printout(INFO,"LcioTestTracker","%s> Add hit with deposit:%f Pos:%f %f %f - cellID0: 0x%x cellID1: 0x%x", c_name(),step->GetTotalEnergyDeposit(),position.X(),position.Y(),position.Z() , hit->getCellID0() ,hit->getCellID1() ); diff --git a/DDG4/lcio/LCIOStdHepReader.cpp b/DDG4/lcio/LCIOStdHepReader.cpp index b1b61598c3055e154297ba5d76557cfd26f96120..556469c93a3ce409f45e3fa1cf2d4926a89bcaef 100644 --- a/DDG4/lcio/LCIOStdHepReader.cpp +++ b/DDG4/lcio/LCIOStdHepReader.cpp @@ -35,7 +35,7 @@ namespace DD4hep { /// Default destructor virtual ~LCIOStdHepReader(); /// Read an event and fill a vector of MCParticles. - virtual EventReaderStatus readParticles(int event_number, EVENT::LCCollection** particles); + virtual EventReaderStatus readParticleCollection(int event_number, EVENT::LCCollection** particles); }; } /* End namespace lcio */ } /* End namespace DD4hep */ @@ -61,7 +61,7 @@ LCIOStdHepReader::~LCIOStdHepReader() { /// Read an event and fill a vector of MCParticles. Geant4EventReader::EventReaderStatus -LCIOStdHepReader::readParticles(int /*event_number */, EVENT::LCCollection** particles) { +LCIOStdHepReader::readParticleCollection(int /*event_number */, EVENT::LCCollection** particles) { *particles = m_reader->readEvent(); if ( 0 == *particles ) return EVENT_READER_ERROR; return EVENT_READER_OK; diff --git a/DDG4/legacy/Geant4CalorimeterSD.cpp b/DDG4/legacy/Geant4CalorimeterSD.cpp index c65857d99843197ecb84f0c3dbfc1cd4e1d2b09b..331e7c52d490aeb0636dbe29ab0c0323e9880d03 100644 --- a/DDG4/legacy/Geant4CalorimeterSD.cpp +++ b/DDG4/legacy/Geant4CalorimeterSD.cpp @@ -67,8 +67,8 @@ namespace DD4hep { namespace Simulation { template <> class Geant4GenericSD<OpticalCalorimeter> : public Geant4GenericSD<Calorimeter> { public: /// Constructor. The sensitive detector element is identified by the detector name - Geant4GenericSD(const string& name, LCDD& lcdd) - : Geant4GenericSD<Calorimeter>(name,lcdd) { } + Geant4GenericSD(const string& nam, LCDD& lcdd_ref) + : Geant4GenericSD<Calorimeter>(nam,lcdd_ref) { } /// Initialize the sensitive detector for the usage of a single hit collection bool defineCollection(const string& coll_name) { diff --git a/DDG4/plugins/Geant4EscapeCounter.cpp b/DDG4/plugins/Geant4EscapeCounter.cpp index 3800729e715a95cd7491d25aff7efa635760697d..b472c60886689e7d5e5bf19e8ff45eebe52d1d26 100644 --- a/DDG4/plugins/Geant4EscapeCounter.cpp +++ b/DDG4/plugins/Geant4EscapeCounter.cpp @@ -34,7 +34,7 @@ namespace DD4hep { std::vector<std::string> m_detectorNames; public: /// Standard constructor - Geant4EscapeCounter(Geant4Context* context, const std::string& name, DetElement det, LCDD& lcdd); + Geant4EscapeCounter(Geant4Context* ctxt, const std::string& name, DetElement det, LCDD& lcdd); /// Default destructor virtual ~Geant4EscapeCounter(); /// G4VSensitiveDetector interface: Method for generating hit(s) using the information of G4Step object. @@ -71,8 +71,8 @@ using namespace DD4hep; using namespace DD4hep::Simulation; /// Standard constructor -Geant4EscapeCounter::Geant4EscapeCounter(Geant4Context* context, const string& nam, DetElement det, LCDD& lcdd) -: Geant4Sensitive(context, nam, det, lcdd) +Geant4EscapeCounter::Geant4EscapeCounter(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) +: Geant4Sensitive(ctxt, nam, det, lcdd_ref) { string coll_name = name()+"Hits"; m_needsControl = true; @@ -91,7 +91,7 @@ bool Geant4EscapeCounter::process(G4Step* step, G4TouchableHistory* /* history * Geant4StepHandler h(step); Geant4TrackHandler th(h.track); Geant4TouchableHandler handler(step); - string path = handler.path(); + string hdlr_path = handler.path(); Position prePos = h.prePos(); HitCollection* coll = collection(m_collectionID); SimpleTracker::Hit* hit = new SimpleTracker::Hit(th.id(),th.pdgID(),h.deposit(),th.time()); @@ -105,7 +105,7 @@ bool Geant4EscapeCounter::process(G4Step* step, G4TouchableHistory* /* history * print("+++ Track:%4d %8.2f MeV [%s] %s Geant4 path:%s", h.trkID(),h.trkEnergy()/CLHEP::MeV,th.name().c_str(), - th.creatorName().c_str(),path.c_str()); + th.creatorName().c_str(),hdlr_path.c_str()); // Kill track, so that it does no longer participate in the propagation h.track->SetTrackStatus(fStopAndKill); return true; diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index 6051f82c2e7324075e446ab2b3b8f707fc8dbc26..b7a53a7c580c9aff0139a4ae79ef6601bd130007 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -178,9 +178,9 @@ Geant4EventReaderHepMC::readParticles(int /* ev_id */, Particles& output) { return EVENT_READER_IO_ERROR; } else if ( m_events->read() ) { - EventStream::Particles& p = m_events->particles(); - output.reserve(p.size()); - transform(p.begin(),p.end(),back_inserter(output),reference2nd(p)); + EventStream::Particles& parts = m_events->particles(); + output.reserve(parts.size()); + transform(parts.begin(),parts.end(),back_inserter(output),reference2nd(parts)); m_events->clear(); for(Particles::const_iterator k=output.begin(); k != output.end(); ++k) { Geant4ParticleHandle p(*k); @@ -240,10 +240,10 @@ void HepMC::fix_particles(EventStream& info) { } } } - for(vector<Geant4Particle*>::iterator i=beam.begin(); i!=beam.end();++i) { - //cout << "Clear parents of " << (*i)->id << endl; - (*i)->parents.clear(); - (*i)->status = G4PARTICLE_GEN_DECAYED; + for(vector<Geant4Particle*>::iterator ipp=beam.begin(); ipp!=beam.end();++ipp) { + //cout << "Clear parents of " << (*ipp)->id << endl; + (*ipp)->parents.clear(); + (*ipp)->status = G4PARTICLE_GEN_DECAYED; } } @@ -597,33 +597,33 @@ bool HepMC::EventStream::read() { switch( value ) { case 'H': { int iotype = 0; - string key; - input_line >> key; + string key_value; + input_line >> key_value; // search for event listing key before first event only. - key = key.substr(0,key.find('\r')); - if ( key == "H" && (this->io_type == gen || this->io_type == extascii) ) { + key_value = key_value.substr(0,key_value.find('\r')); + if ( key_value == "H" && (this->io_type == gen || this->io_type == extascii) ) { read_heavy_ion(info, input_line); break; } - else if( key == "HepMC::IO_GenEvent-START_EVENT_LISTING" ) - this->set_io(gen,key); - else if( key == "HepMC::IO_Ascii-START_EVENT_LISTING" ) - this->set_io(ascii,key); - else if( key == "HepMC::IO_ExtendedAscii-START_EVENT_LISTING" ) - this->set_io(extascii,key); - else if( key == "HepMC::IO_Ascii-START_PARTICLE_DATA" ) - this->set_io(ascii_pdt,key); - else if( key == "HepMC::IO_ExtendedAscii-START_PARTICLE_DATA" ) - this->set_io(extascii_pdt,key); - else if( key == "HepMC::IO_GenEvent-END_EVENT_LISTING" ) + else if( key_value == "HepMC::IO_GenEvent-START_EVENT_LISTING" ) + this->set_io(gen,key_value); + else if( key_value == "HepMC::IO_Ascii-START_EVENT_LISTING" ) + this->set_io(ascii,key_value); + else if( key_value == "HepMC::IO_ExtendedAscii-START_EVENT_LISTING" ) + this->set_io(extascii,key_value); + else if( key_value == "HepMC::IO_Ascii-START_PARTICLE_DATA" ) + this->set_io(ascii_pdt,key_value); + else if( key_value == "HepMC::IO_ExtendedAscii-START_PARTICLE_DATA" ) + this->set_io(extascii_pdt,key_value); + else if( key_value == "HepMC::IO_GenEvent-END_EVENT_LISTING" ) iotype = gen; - else if( key == "HepMC::IO_Ascii-END_EVENT_LISTING" ) + else if( key_value == "HepMC::IO_Ascii-END_EVENT_LISTING" ) iotype = ascii; - else if( key == "HepMC::IO_ExtendedAscii-END_EVENT_LISTING" ) + else if( key_value == "HepMC::IO_ExtendedAscii-END_EVENT_LISTING" ) iotype = extascii; - else if( key == "HepMC::IO_Ascii-END_PARTICLE_DATA" ) + else if( key_value == "HepMC::IO_Ascii-END_PARTICLE_DATA" ) iotype = ascii_pdt; - else if( key == "HepMC::IO_ExtendedAscii-END_PARTICLE_DATA" ) + else if( key_value == "HepMC::IO_ExtendedAscii-END_PARTICLE_DATA" ) iotype = extascii_pdt; if( iotype != 0 && this->io_type != iotype ) { diff --git a/DDG4/plugins/Geant4FieldTrackingSetup.cpp b/DDG4/plugins/Geant4FieldTrackingSetup.cpp index ba72fb9714a6d4a69b1f6558d4b1cfef0d7d5b08..207022b07e9d29c183c0d5c93e717467cd2440f3 100644 --- a/DDG4/plugins/Geant4FieldTrackingSetup.cpp +++ b/DDG4/plugins/Geant4FieldTrackingSetup.cpp @@ -200,8 +200,8 @@ static long setup_fields(lcdd_t& lcdd, const DD4hep::Geometry::GeoHandler& /* cn } /// Standard constructor -Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* context, const std::string& nam) -: Geant4PhaseAction(context,nam), Geant4FieldTrackingSetup() +Geant4FieldTrackingSetupAction::Geant4FieldTrackingSetupAction(Geant4Context* ctxt, const std::string& nam) +: Geant4PhaseAction(ctxt,nam), Geant4FieldTrackingSetup() { declareProperty("equation", eq_typ); declareProperty("stepper", stepper_typ); diff --git a/DDG4/plugins/Geant4MaterialScanner.cpp b/DDG4/plugins/Geant4MaterialScanner.cpp index 59614677f46182214bdeaace2b84139529e7f1ac..e7f9599c4be5cf0f5851945a8ec97e77ea56fc67 100644 --- a/DDG4/plugins/Geant4MaterialScanner.cpp +++ b/DDG4/plugins/Geant4MaterialScanner.cpp @@ -118,8 +118,8 @@ Geant4MaterialScanner::StepInfo& Geant4MaterialScanner::StepInfo::operator=(cons } /// Standard constructor -Geant4MaterialScanner::Geant4MaterialScanner(Geant4Context* context, const string& name) -: Geant4SteppingAction(context,name) +Geant4MaterialScanner::Geant4MaterialScanner(Geant4Context* ctxt, const string& nam) +: Geant4SteppingAction(ctxt,nam) { m_needsControl = true; eventAction().callAtBegin(this,&Geant4MaterialScanner::beginEvent); @@ -197,9 +197,9 @@ void Geant4MaterialScanner::end(const G4Track* track) { double Zeff = 0.0; const char* fmt = radLen >= 1e5 ? fmt2 : fmt1; const double* fractions = m->GetFractionVector(); - for(size_t i=0; i<m->GetNumberOfElements(); ++i) { - Zeff += fractions[i]*(m->GetElement(i)->GetZ()); - Aeff += fractions[i]*(m->GetElement(i)->GetA())/gram; + for(size_t j=0; j<m->GetNumberOfElements(); ++j) { + Zeff += fractions[j]*(m->GetElement(j)->GetZ()); + Aeff += fractions[j]*(m->GetElement(j)->GetA())/gram; } m_sumX0 += nx0; m_sumLambda += nLambda; diff --git a/DDG4/plugins/Geant4SensDetFilters.cpp b/DDG4/plugins/Geant4SensDetFilters.cpp index 2f4c46f040c0bc888b1c5a4bf90ee34b4703a1ce..67cc1d0bd434bc8b07f1c2ccceaa4090caa00c37 100644 --- a/DDG4/plugins/Geant4SensDetFilters.cpp +++ b/DDG4/plugins/Geant4SensDetFilters.cpp @@ -130,8 +130,8 @@ DECLARE_GEANT4ACTION(ParticleRejectFilter) DECLARE_GEANT4ACTION(EnergyDepositMinimumCut) /// Constructor. - ParticleFilter::ParticleFilter(Geant4Context* context, const std::string& name) - : Geant4Filter(context,name), m_definition(0) + ParticleFilter::ParticleFilter(Geant4Context* ctxt, const std::string& nam) + : Geant4Filter(ctxt,nam), m_definition(0) { declareProperty("particle",m_particle); InstanceCount::increment(this); diff --git a/DDG4/plugins/Geant4TCUserParticleHandler.cpp b/DDG4/plugins/Geant4TCUserParticleHandler.cpp index 389136d74f620f535277c6598e8c7d6f4a9ee15c..cd335e68c797fe8a25c546692b1f14d9056e2315 100644 --- a/DDG4/plugins/Geant4TCUserParticleHandler.cpp +++ b/DDG4/plugins/Geant4TCUserParticleHandler.cpp @@ -46,6 +46,9 @@ namespace DD4hep { */ virtual void end(const G4Track* track, Particle& particle); + /// Post-event action callback: avoid warning (...) was hidden [-Woverloaded-virtual] + virtual void end(const G4Event* event); + }; } // End namespace Simulation } // End namespace DD4hep @@ -70,8 +73,8 @@ using namespace DD4hep::Simulation; DECLARE_GEANT4ACTION(Geant4TCUserParticleHandler) /// Standard constructor -Geant4TCUserParticleHandler::Geant4TCUserParticleHandler(Geant4Context* context, const std::string& nam) -: Geant4UserParticleHandler(context,nam) +Geant4TCUserParticleHandler::Geant4TCUserParticleHandler(Geant4Context* ctxt, const std::string& nam) +: Geant4UserParticleHandler(ctxt,nam) { declareProperty("TrackingVolume_Zmax",m_zTracker=1e100); declareProperty("TrackingVolume_Rmax",m_rTracker=1e100); @@ -102,3 +105,9 @@ void Geant4TCUserParticleHandler::end(const G4Track* /* track */, Particle& p) //fg: backscatter ?? // if( !starts_in_trk_vol && ends_in_trk_vol ){ keep ? } } + +/// Post-event action callback +void Geant4TCUserParticleHandler::end(const G4Event* /* event */) { + +} + diff --git a/DDG4/python/DDG4Dict.C b/DDG4/python/DDG4Dict.C index baba4aed4984a0723624412c9958c4320630ce92..e46db7536ec79f2279e88cb9b00d1b5bd8312fdd 100644 --- a/DDG4/python/DDG4Dict.C +++ b/DDG4/python/DDG4Dict.C @@ -19,8 +19,8 @@ /// Geant4 Vertex dictionaries #pragma link C++ class DD4hep::Simulation::VertexExtension+; -#pragma link C++ class std::auto_ptr<DD4hep::Simulation::VertexExtension>+; -#pragma link C++ class std::auto_ptr<DD4hep::Simulation::PrimaryExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::VertexExtension>+; +#pragma link C++ class DD4hep::dd4hep_ptr<DD4hep::Simulation::PrimaryExtension>+; #pragma link C++ class DD4hep::Simulation::Geant4Vertex+; #pragma link C++ class std::vector<DD4hep::Simulation::Geant4Vertex*>+; #pragma link C++ class std::map<int,DD4hep::Simulation::Geant4Vertex*>+; @@ -193,9 +193,17 @@ typedef DD4hep::Simulation::Geant4ActionCreation Geant4ActionCreation; #include "DD4hep/objects/DetectorInterna.h" // CINT configuration for DDG4 #if defined(__MAKECINT__) +namespace { + struct bla { + dd4hep_ptr<Geant4InputAction::Particles> __m1; + dd4hep_ptr<ParticleExtension> __m2; + dd4hep_ptr<DataExtension> __m3; + }; +} #pragma link C++ class PropertyResult; #pragma link C++ class Geant4InputAction::Particles; -#pragma link C++ class auto_ptr<Geant4InputAction::Particles>; +#pragma link C++ class dd4hep_ptr<Geant4InputAction::Particles>; +#pragma link C++ class dd4hep_ptr<Geant4InputAction::Particles>::base_t; #pragma link C++ class ActionHandle; #pragma link C++ class FilterHandle; diff --git a/DDG4/src/ComponentProperties.cpp b/DDG4/src/ComponentProperties.cpp index 42a4f3edafcbb1b21d830068587ac09ac5126d4e..59f1ee4935c58839c074bd11265e8d8c15b3fe01 100644 --- a/DDG4/src/ComponentProperties.cpp +++ b/DDG4/src/ComponentProperties.cpp @@ -184,9 +184,9 @@ const Property& PropertyManager::operator[](const string& name) const { } /// Add a new property -void PropertyManager::add(const string& name, const Property& property) { +void PropertyManager::add(const string& name, const Property& prop) { verifyNonExistence(name); - m_properties.insert(make_pair(name, property)); + m_properties.insert(make_pair(name, prop)); } /// Bulk set of all properties diff --git a/DDG4/src/Geant4Action.cpp b/DDG4/src/Geant4Action.cpp index 46deeba78900405e9c6d374bcc8653cf0cec7f99..31a3a740ab9e8b2f59041e3e32a86954022e9e26 100644 --- a/DDG4/src/Geant4Action.cpp +++ b/DDG4/src/Geant4Action.cpp @@ -49,12 +49,12 @@ void Geant4Action::ContextUpdate::operator()(Geant4Action* action) const { } /// Standard constructor -Geant4Action::Geant4Action(Geant4Context* context, const string& nam) +Geant4Action::Geant4Action(Geant4Context* ctxt, const string& nam) : m_context(0), m_control(0), m_outputLevel(INFO), m_needsControl(false), m_name(nam), m_refCount(1) { InstanceCount::increment(this); - if ( context ) m_context = *context; - m_outputLevel = context ? context->kernel().getOutputLevel(nam) : (printLevel()-1); + if ( ctxt ) m_context = *ctxt; + m_outputLevel = ctxt ? ctxt->kernel().getOutputLevel(nam) : (printLevel()-1); declareProperty("Name", m_name); declareProperty("name", m_name); declareProperty("OutputLevel", m_outputLevel); @@ -96,13 +96,13 @@ Geant4Action& Geant4Action::setProperties(PropertyConfigurator& setup) { } /// Check property for existence -bool Geant4Action::hasProperty(const string& name) const { - return m_properties.exists(name); +bool Geant4Action::hasProperty(const string& nam) const { + return m_properties.exists(nam); } /// Access single property -Property& Geant4Action::property(const string& name) { - return properties()[name]; +Property& Geant4Action::property(const string& nam) { + return properties()[nam]; } /// Install all control messenger if wanted diff --git a/DDG4/src/Geant4ActionPhase.cpp b/DDG4/src/Geant4ActionPhase.cpp index 418f6322adfb3f75aa061b97cfa54778010909c0..51ddd44992f3d6d377f53c5683bf935998050275 100644 --- a/DDG4/src/Geant4ActionPhase.cpp +++ b/DDG4/src/Geant4ActionPhase.cpp @@ -15,8 +15,8 @@ using namespace std; using namespace DD4hep::Simulation; /// Standard constructor -Geant4PhaseAction::Geant4PhaseAction(Geant4Context* context, const std::string& name) -: Geant4Action(context,name) +Geant4PhaseAction::Geant4PhaseAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt,nam) { } @@ -33,9 +33,9 @@ DD4hep::Callback Geant4PhaseAction::callback() { } /// Standard constructor -Geant4ActionPhase::Geant4ActionPhase(Geant4Context* context, const string& nam, const type_info& arg_type0, +Geant4ActionPhase::Geant4ActionPhase(Geant4Context* ctxt, const string& nam, const type_info& arg_type0, const type_info& arg_type1, const type_info& arg_type2) -: Geant4Action(context, nam) { +: Geant4Action(ctxt, nam) { m_argTypes[0] = &arg_type0; m_argTypes[1] = &arg_type1; m_argTypes[2] = &arg_type2; diff --git a/DDG4/src/Geant4Context.cpp b/DDG4/src/Geant4Context.cpp index 96e01b16d7b3d28e44b242d2cac382df03fbeaf4..936406b0e969996e3d06ca96f715df4728789c6f 100644 --- a/DDG4/src/Geant4Context.cpp +++ b/DDG4/src/Geant4Context.cpp @@ -17,8 +17,8 @@ using namespace DD4hep; using namespace DD4hep::Simulation; /// Intializing constructor -Geant4Run::Geant4Run(const G4Run* run) -: ObjectExtensions(typeid(Geant4Run)), m_run(run) +Geant4Run::Geant4Run(const G4Run* run_pointer) +: ObjectExtensions(typeid(Geant4Run)), m_run(run_pointer) { InstanceCount::increment(this); } @@ -41,8 +41,8 @@ Geant4Event::~Geant4Event() { } /// Default constructor -Geant4Context::Geant4Context(Geant4Kernel* kernel) -: m_kernel(kernel), m_run(0), m_event(0) { +Geant4Context::Geant4Context(Geant4Kernel* kernel_pointer) +: m_kernel(kernel_pointer), m_run(0), m_event(0) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index bcb736fdd97abf4ade3285d11c05975e0efcc01f..408b11aa157d40f69495451ecf2c9ebded9d089d 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -258,16 +258,16 @@ namespace { } /// Initializing Constructor -Geant4Converter::Geant4Converter(LCDD& lcdd) -: Geant4Mapping(lcdd), m_checkOverlaps(true) { +Geant4Converter::Geant4Converter(LCDD& lcdd_ref) +: Geant4Mapping(lcdd_ref), m_checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; m_outputLevel = PrintLevel(printLevel() - 1); } /// Initializing Constructor -Geant4Converter::Geant4Converter(LCDD& lcdd, PrintLevel level) -: Geant4Mapping(lcdd), m_checkOverlaps(true) { +Geant4Converter::Geant4Converter(LCDD& lcdd_ref, PrintLevel level) +: Geant4Mapping(lcdd_ref), m_checkOverlaps(true) { this->Geant4Mapping::init(); m_propagateRegions = true; m_outputLevel = level; @@ -890,12 +890,12 @@ void Geant4Converter::handleProperties(LCDD::Properties& prp) const { } } for (map<string, string>::const_iterator i = processors.begin(); i != processors.end(); ++i) { - const Geometry::GeoHandler* ptr = this; + const Geometry::GeoHandler* hdlr = this; string nam = (*i).second; const LCDD::PropertyValues& vals = prp[nam]; string type = vals.find("type")->second; string tag = type + "_Geant4_action"; - long result = PluginService::Create<long>(tag, &m_lcdd, ptr, &vals); + long result = PluginService::Create<long>(tag, &m_lcdd, hdlr, &vals); if (0 == result) { throw runtime_error("Failed to locate plugin to interprete files of type" " \"" + tag + "\" - no factory:" + type); diff --git a/DDG4/src/Geant4DetectorConstruction.cpp b/DDG4/src/Geant4DetectorConstruction.cpp index 6cc4a6a656940824fcc7eef4df1480c5868b1745..97fb0d5063525d354dde8df5e8969d0f27e15d9d 100644 --- a/DDG4/src/Geant4DetectorConstruction.cpp +++ b/DDG4/src/Geant4DetectorConstruction.cpp @@ -58,9 +58,9 @@ G4VPhysicalVolume* Geant4DetectorConstruction::Construct() { Geant4Mapping& g4map = Geant4Mapping::instance(); Geometry::DetElement world = m_lcdd.world(); Geant4Converter conv(m_lcdd, m_outputLevel); - Geant4GeometryInfo* info = conv.create(world).detach(); - g4map.attach(info); - m_world = info->world(); + Geant4GeometryInfo* geo_info = conv.create(world).detach(); + g4map.attach(geo_info); + m_world = geo_info->world(); m_lcdd.apply("DD4hepVolumeManager", 0, 0); // Create Geant4 volume manager g4map.volumeManager(); diff --git a/DDG4/src/Geant4EventAction.cpp b/DDG4/src/Geant4EventAction.cpp index c249521c26ba511f46deb666cedcc74ddbfa093f..468236930c2c18760cc6e9cdaef848f67437d27e 100644 --- a/DDG4/src/Geant4EventAction.cpp +++ b/DDG4/src/Geant4EventAction.cpp @@ -17,8 +17,8 @@ using namespace std; using namespace DD4hep::Simulation; /// Standard constructor -Geant4EventAction::Geant4EventAction(Geant4Context* context, const string& nam) -: Geant4Action(context, nam) { +Geant4EventAction::Geant4EventAction(Geant4Context* ctxt, const string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -36,8 +36,8 @@ void Geant4EventAction::end(const G4Event*) { } /// Standard constructor -Geant4EventActionSequence::Geant4EventActionSequence(Geant4Context* context, const string& name) -: Geant4Action(context, name) { +Geant4EventActionSequence::Geant4EventActionSequence(Geant4Context* ctxt, const string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Exec.cpp b/DDG4/src/Geant4Exec.cpp index 76bb84c0701561e317914f0e0b0e84b582988f60..db9807e82833b4d92c4afe67bf288efef8e06507 100644 --- a/DDG4/src/Geant4Exec.cpp +++ b/DDG4/src/Geant4Exec.cpp @@ -62,7 +62,7 @@ namespace DD4hep { SequenceHdl() : m_sequence(0), m_activeContext(0) { } - SequenceHdl(Geant4Context* context, T* seq) : m_sequence(0), m_activeContext(context) { + SequenceHdl(Geant4Context* ctxt, T* seq) : m_sequence(0), m_activeContext(ctxt) { _aquire(seq); } virtual ~SequenceHdl() { @@ -131,8 +131,8 @@ namespace DD4hep { public: Geant4UserEventAction* eventAction; /// Standard constructor - Geant4UserRunAction(Geant4Context* context, Geant4RunActionSequence* seq) - : Base(context, seq), eventAction(0) { + Geant4UserRunAction(Geant4Context* ctxt, Geant4RunActionSequence* seq) + : Base(ctxt, seq), eventAction(0) { } /// Default destructor virtual ~Geant4UserRunAction() { @@ -153,8 +153,8 @@ namespace DD4hep { public: Geant4UserRunAction* runAction; /// Standard constructor - Geant4UserEventAction(Geant4Context* context, Geant4EventActionSequence* seq) - : Base(context, seq), runAction(0) { + Geant4UserEventAction(Geant4Context* ctxt, Geant4EventActionSequence* seq) + : Base(ctxt, seq), runAction(0) { } /// Default destructor virtual ~Geant4UserEventAction() { @@ -174,8 +174,8 @@ namespace DD4hep { class Geant4UserTrackingAction : public G4UserTrackingAction, public SequenceHdl<Geant4TrackingActionSequence> { public: /// Standard constructor - Geant4UserTrackingAction(Geant4Context* context, Geant4TrackingActionSequence* seq) - : Base(context, seq) { + Geant4UserTrackingAction(Geant4Context* ctxt, Geant4TrackingActionSequence* seq) + : Base(ctxt, seq) { } /// Default destructor virtual ~Geant4UserTrackingAction() { @@ -203,8 +203,8 @@ namespace DD4hep { class Geant4UserStackingAction : public G4UserStackingAction, public SequenceHdl<Geant4StackingActionSequence> { public: /// Standard constructor - Geant4UserStackingAction(Geant4Context* context, Geant4StackingActionSequence* seq) - : Base(context, seq) { + Geant4UserStackingAction(Geant4Context* ctxt, Geant4StackingActionSequence* seq) + : Base(ctxt, seq) { } /// Default destructor virtual ~Geant4UserStackingAction() { @@ -232,8 +232,8 @@ namespace DD4hep { class Geant4UserGeneratorAction : public G4VUserPrimaryGeneratorAction, public SequenceHdl<Geant4GeneratorActionSequence> { public: /// Standard constructor - Geant4UserGeneratorAction(Geant4Context* context, Geant4GeneratorActionSequence* seq) - : G4VUserPrimaryGeneratorAction(), Base(context, seq) { + Geant4UserGeneratorAction(Geant4Context* ctxt, Geant4GeneratorActionSequence* seq) + : G4VUserPrimaryGeneratorAction(), Base(ctxt, seq) { } /// Default destructor virtual ~Geant4UserGeneratorAction() { @@ -255,8 +255,8 @@ namespace DD4hep { class Geant4UserSteppingAction : public G4UserSteppingAction, public SequenceHdl<Geant4SteppingActionSequence> { public: /// Standard constructor - Geant4UserSteppingAction(Geant4Context* context, Geant4SteppingActionSequence* seq) - : Base(context, seq) { + Geant4UserSteppingAction(Geant4Context* ctxt, Geant4SteppingActionSequence* seq) + : Base(ctxt, seq) { } /// Default destructor virtual ~Geant4UserSteppingAction() { diff --git a/DDG4/src/Geant4GeneratorAction.cpp b/DDG4/src/Geant4GeneratorAction.cpp index 3bf2c24f75503dcf293619f40e527e947cfefa36..35da73556bb6c86134f6cf70128556947ea57624 100644 --- a/DDG4/src/Geant4GeneratorAction.cpp +++ b/DDG4/src/Geant4GeneratorAction.cpp @@ -16,8 +16,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4GeneratorAction::Geant4GeneratorAction(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4GeneratorAction::Geant4GeneratorAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -27,8 +27,8 @@ Geant4GeneratorAction::~Geant4GeneratorAction() { } /// Standard constructor -Geant4GeneratorActionSequence::Geant4GeneratorActionSequence(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4GeneratorActionSequence::Geant4GeneratorActionSequence(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4GeneratorActionInit.cpp b/DDG4/src/Geant4GeneratorActionInit.cpp index 2671ac7329a88ac054c24b5d73d7f78dc888aef0..32af3b4c434ae6156be98a1c8097104c9ecf8445 100644 --- a/DDG4/src/Geant4GeneratorActionInit.cpp +++ b/DDG4/src/Geant4GeneratorActionInit.cpp @@ -19,12 +19,12 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4GeneratorActionInit::Geant4GeneratorActionInit(Geant4Context* context, const std::string& nam) -: Geant4GeneratorAction(context,nam), m_run(0), m_evtTotal(0), m_evtRun(0) +Geant4GeneratorActionInit::Geant4GeneratorActionInit(Geant4Context* ctxt, const std::string& nam) +: Geant4GeneratorAction(ctxt,nam), m_run(0), m_evtTotal(0), m_evtRun(0) { InstanceCount::increment(this); - context->kernel().runAction().callAtEnd(this,&Geant4GeneratorActionInit::end); - context->kernel().runAction().callAtBegin(this,&Geant4GeneratorActionInit::begin); + context()->kernel().runAction().callAtEnd(this,&Geant4GeneratorActionInit::end); + context()->kernel().runAction().callAtBegin(this,&Geant4GeneratorActionInit::begin); } /// Default destructor diff --git a/DDG4/src/Geant4InputAction.cpp b/DDG4/src/Geant4InputAction.cpp index 74d0042976421c52e0bfcff9b74d1f21db74a2d2..1605bbc2304ca10373973536aa256ce52613e246 100644 --- a/DDG4/src/Geant4InputAction.cpp +++ b/DDG4/src/Geant4InputAction.cpp @@ -69,8 +69,8 @@ Geant4EventReader::moveToEvent(int event_number) { } /// Standard constructor -Geant4InputAction::Geant4InputAction(Geant4Context* context, const string& name) -: Geant4GeneratorAction(context,name), m_reader(0) +Geant4InputAction::Geant4InputAction(Geant4Context* ctxt, const string& nam) +: Geant4GeneratorAction(ctxt,nam), m_reader(0) { declareProperty("Input", m_input); declareProperty("Sync", m_firstEvent=0); diff --git a/DDG4/src/Geant4InteractionMerger.cpp b/DDG4/src/Geant4InteractionMerger.cpp index bcc22fba8251d0460875dd29c1ba7d923ced2d92..a094999acbe4420d833b97537ddb9969a8e3b222 100644 --- a/DDG4/src/Geant4InteractionMerger.cpp +++ b/DDG4/src/Geant4InteractionMerger.cpp @@ -15,8 +15,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4InteractionMerger::Geant4InteractionMerger(Geant4Context* context, const std::string& nam) -: Geant4GeneratorAction(context,nam) +Geant4InteractionMerger::Geant4InteractionMerger(Geant4Context* ctxt, const std::string& nam) +: Geant4GeneratorAction(ctxt,nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4InteractionVertexBoost.cpp b/DDG4/src/Geant4InteractionVertexBoost.cpp index a1b3addc79f2327bbf39113c6d65202fe082e54c..9a3ba936614c3ff7bf3e13c6b3fb31458a518d50 100644 --- a/DDG4/src/Geant4InteractionVertexBoost.cpp +++ b/DDG4/src/Geant4InteractionVertexBoost.cpp @@ -16,8 +16,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4InteractionVertexBoost::Geant4InteractionVertexBoost(Geant4Context* context, const std::string& name) -: Geant4GeneratorAction(context, name) +Geant4InteractionVertexBoost::Geant4InteractionVertexBoost(Geant4Context* ctxt, const std::string& nam) +: Geant4GeneratorAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("Angle", m_angle = 0); diff --git a/DDG4/src/Geant4InteractionVertexSmear.cpp b/DDG4/src/Geant4InteractionVertexSmear.cpp index 856a34d987b12d647473da67e661dd800e65d2ef..114cfd722f9dc76154c78766fa85782fb436bc68 100644 --- a/DDG4/src/Geant4InteractionVertexSmear.cpp +++ b/DDG4/src/Geant4InteractionVertexSmear.cpp @@ -21,8 +21,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4InteractionVertexSmear::Geant4InteractionVertexSmear(Geant4Context* context, const std::string& name) -: Geant4GeneratorAction(context, name) +Geant4InteractionVertexSmear::Geant4InteractionVertexSmear(Geant4Context* ctxt, const std::string& nam) +: Geant4GeneratorAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("Offset", m_offset); diff --git a/DDG4/src/Geant4IsotropeGenerator.cpp b/DDG4/src/Geant4IsotropeGenerator.cpp index de5a9dc6d5760b5809d99c1a567ee3efaa456d6d..69852ad301f0febd50d58e5147717087ba6c0983 100644 --- a/DDG4/src/Geant4IsotropeGenerator.cpp +++ b/DDG4/src/Geant4IsotropeGenerator.cpp @@ -17,8 +17,8 @@ using namespace std; using namespace DD4hep::Simulation; /// Standard constructor -Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* context, const string& name) -: Geant4ParticleGenerator(context, name) +Geant4IsotropeGenerator::Geant4IsotropeGenerator(Geant4Context* ctxt, const string& nam) +: Geant4ParticleGenerator(ctxt, nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index 08369aacb44e62c7fc0b5c09af0893558926fbd8..bc59d3595a5bc471cff3270d12b82f755584f113 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -55,19 +55,19 @@ Geant4Kernel::PhaseSelector& Geant4Kernel::PhaseSelector::operator=(const PhaseS } /// Phase access to the map -Geant4ActionPhase& Geant4Kernel::PhaseSelector::operator[](const std::string& name) const { - Geant4ActionPhase* phase = m_kernel->getPhase(name); +Geant4ActionPhase& Geant4Kernel::PhaseSelector::operator[](const std::string& nam) const { + Geant4ActionPhase* phase = m_kernel->getPhase(nam); if (phase) { return *phase; } - throw runtime_error(format("Geant4Kernel", "Attempt to access the nonexisting phase '%s'", name.c_str())); + throw runtime_error(format("Geant4Kernel", "Attempt to access the nonexisting phase '%s'", nam.c_str())); } /// Standard constructor -Geant4Kernel::Geant4Kernel(LCDD& lcdd) +Geant4Kernel::Geant4Kernel(LCDD& lcdd_ref) : m_runManager(0), m_generatorAction(0), m_runAction(0), m_eventAction(0), m_trackingAction(0), m_steppingAction(0), m_stackingAction(0), m_sensDetActions(0), - m_physicsList(0), m_lcdd(lcdd), phase(this) { + m_physicsList(0), m_lcdd(lcdd_ref), phase(this) { #if 0 registerSequence(m_runAction, "RunAction"); registerSequence(m_eventAction, "EventAction"); diff --git a/DDG4/src/Geant4Mapping.cpp b/DDG4/src/Geant4Mapping.cpp index 6a82361824fe8ce3cbcea58a9c0400ee4d7be893..90a8d4cc5e3bce920f869aa81c14227a0b837e81 100644 --- a/DDG4/src/Geant4Mapping.cpp +++ b/DDG4/src/Geant4Mapping.cpp @@ -17,8 +17,8 @@ using namespace DD4hep::Geometry; using namespace std; /// Initializing Constructor -Geant4Mapping::Geant4Mapping(LCDD& lcdd) -: m_lcdd(lcdd), m_dataPtr(0) { +Geant4Mapping::Geant4Mapping(LCDD& lcdd_ref) +: m_lcdd(lcdd_ref), m_dataPtr(0) { } /// Standard destructor @@ -58,8 +58,8 @@ Geant4GeometryInfo* Geant4Mapping::detach() { } /// Set a new data block -void Geant4Mapping::attach(Geant4GeometryInfo* data) { - m_dataPtr = data; +void Geant4Mapping::attach(Geant4GeometryInfo* data_ptr) { + m_dataPtr = data_ptr; } /// Access the volume manager diff --git a/DDG4/src/Geant4Output2ROOT.cpp b/DDG4/src/Geant4Output2ROOT.cpp index 48714113d46679c8b327ff0e2018f1de286e93ba..8ce393026f16596cba2c458c775c76cc08e62db3 100644 --- a/DDG4/src/Geant4Output2ROOT.cpp +++ b/DDG4/src/Geant4Output2ROOT.cpp @@ -28,8 +28,8 @@ using namespace DD4hep; using namespace std; /// Standard constructor -Geant4Output2ROOT::Geant4Output2ROOT(Geant4Context* context, const string& nam) -: Geant4OutputAction(context, nam), m_file(0), m_tree(0) { +Geant4Output2ROOT::Geant4Output2ROOT(Geant4Context* ctxt, const string& nam) +: Geant4OutputAction(ctxt, nam), m_file(0), m_tree(0) { declareProperty("Section", m_section = "EVENT"); declareProperty("HandleMCTruth", m_handleMCTruth = true); InstanceCount::increment(this); @@ -39,7 +39,7 @@ Geant4Output2ROOT::Geant4Output2ROOT(Geant4Context* context, const string& nam) Geant4Output2ROOT::~Geant4Output2ROOT() { InstanceCount::decrement(this); if (m_file) { - TDirectory::TContext context(m_file); + TDirectory::TContext ctxt(m_file); m_tree->Write(); m_file->Close(); m_tree = 0; @@ -51,7 +51,7 @@ Geant4Output2ROOT::~Geant4Output2ROOT() { TTree* Geant4Output2ROOT::section(const string& nam) { Sections::const_iterator i = m_sections.find(nam); if (i == m_sections.end()) { - TDirectory::TContext context(m_file); + TDirectory::TContext ctxt(m_file); TTree* t = new TTree(nam.c_str(), ("Geant4 " + nam + " information").c_str()); m_sections.insert(make_pair(nam, t)); return t; @@ -62,7 +62,7 @@ TTree* Geant4Output2ROOT::section(const string& nam) { /// Callback to store the Geant4 run information void Geant4Output2ROOT::beginRun(const G4Run* run) { if (!m_file && !m_output.empty()) { - TDirectory::TContext context(TDirectory::CurrentDirectory()); + TDirectory::TContext ctxt(TDirectory::CurrentDirectory()); m_file = TFile::Open(m_output.c_str(), "RECREATE", "DD4hep Simulation data"); if (m_file->IsZombie()) { deletePtr (m_file); diff --git a/DDG4/src/Geant4Particle.cpp b/DDG4/src/Geant4Particle.cpp index 19529229fe9cc85c8c12678a16fc38f9cab402fa..2a6085b797212940712cfb03786863192f8c55ae 100644 --- a/DDG4/src/Geant4Particle.cpp +++ b/DDG4/src/Geant4Particle.cpp @@ -130,8 +130,12 @@ Geant4Particle& Geant4Particle::get_data(Geant4Particle& c) { //definition = c.definition; daughters = c.daughters; parents = c.parents; +#if __cplusplus >= 201103L + extension.swap(c.extension); +#else extension = c.extension; - //auto_ptr<ParticleExtension>(c.extension.release()); +#endif + //dd4hep_ptr<ParticleExtension>(c.extension.release()); } return *this; } diff --git a/DDG4/src/Geant4ParticleGenerator.cpp b/DDG4/src/Geant4ParticleGenerator.cpp index 338915db19ccfd0ef5f237890ed3ab56ae754486..a8b1759a9d0507df29429fe2722d3a83c899743d 100644 --- a/DDG4/src/Geant4ParticleGenerator.cpp +++ b/DDG4/src/Geant4ParticleGenerator.cpp @@ -28,8 +28,8 @@ using namespace std; using namespace DD4hep::Simulation; /// Standard constructor -Geant4ParticleGenerator::Geant4ParticleGenerator(Geant4Context* context, const string& name) - : Geant4GeneratorAction(context, name), m_direction(0,1,0), m_position(0,0,0), m_particle(0) +Geant4ParticleGenerator::Geant4ParticleGenerator(Geant4Context* ctxt, const string& nam) + : Geant4GeneratorAction(ctxt, nam), m_direction(0,1,0), m_position(0,0,0), m_particle(0) { InstanceCount::increment(this); m_needsControl = true; diff --git a/DDG4/src/Geant4ParticleGun.cpp b/DDG4/src/Geant4ParticleGun.cpp index 16d5b82fb6aa30933b76c82897370ac2b3e5c679..af411d32480eacaeb69e411e661c1f058636de58 100644 --- a/DDG4/src/Geant4ParticleGun.cpp +++ b/DDG4/src/Geant4ParticleGun.cpp @@ -31,8 +31,8 @@ using namespace std; using namespace DD4hep::Simulation; /// Standard constructor -Geant4ParticleGun::Geant4ParticleGun(Geant4Context* context, const string& name) -: Geant4GeneratorAction(context, name), m_position(0,0,0), m_direction(1,1,0.3), +Geant4ParticleGun::Geant4ParticleGun(Geant4Context* ctxt, const string& nam) +: Geant4GeneratorAction(ctxt,nam), m_position(0,0,0), m_direction(1,1,0.3), m_particle(0), m_shotNo(0) { InstanceCount::increment(this); diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 8d63cb3d8e11181ac43aa826994a2ad565c1c4f0..1aaa9e6cd7b70b04be171b5dd33060f429b88def 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -56,8 +56,8 @@ namespace { } /// Standard constructor -Geant4ParticleHandler::Geant4ParticleHandler(Geant4Context* context, const string& nam) -: Geant4GeneratorAction(context,nam), Geant4MonteCarloTruth(), m_userHandler(0), m_primaryMap(0) +Geant4ParticleHandler::Geant4ParticleHandler(Geant4Context* ctxt, const string& nam) +: Geant4GeneratorAction(ctxt,nam), Geant4MonteCarloTruth(), m_userHandler(0), m_primaryMap(0) { InstanceCount::increment(this); //generatorAction().adopt(this); @@ -128,18 +128,18 @@ void Geant4ParticleHandler::mark(const G4Track* track, int reason) { } /// Store a track produced in a step to be kept for later MC truth analysis -void Geant4ParticleHandler::mark(const G4Step* step, int reason) { - if ( step ) { - mark(step->GetTrack(),reason); +void Geant4ParticleHandler::mark(const G4Step* step_value, int reason) { + if ( step_value ) { + mark(step_value->GetTrack(),reason); return; } except("Cannot mark the G4Track if the step-pointer is invalid!", c_name()); } /// Mark a Geant4 track of the step to be kept for later MC truth analysis -void Geant4ParticleHandler::mark(const G4Step* step) { - if ( step ) { - mark(step->GetTrack()); +void Geant4ParticleHandler::mark(const G4Step* step_value) { + if ( step_value ) { + mark(step_value->GetTrack()); return; } except("Cannot mark the G4Track if the step-pointer is invalid!", c_name()); @@ -178,7 +178,7 @@ void Geant4ParticleHandler::operator()(G4Event* event) { } /// User stepping callback -void Geant4ParticleHandler::step(const G4Step* step, G4SteppingManager* mgr) { +void Geant4ParticleHandler::step(const G4Step* step_value, G4SteppingManager* mgr) { typedef vector<const G4Track*> _Sec; ++m_currTrack.steps; if ( (m_currTrack.reason&G4PARTICLE_ABOVE_ENERGY_THRESHOLD) ) { @@ -187,14 +187,14 @@ void Geant4ParticleHandler::step(const G4Step* step, G4SteppingManager* mgr) { // If these tracks produce hits or are selected due to another signature, // this criterium will anyhow take precedence. // - const _Sec* sec=step->GetSecondaryInCurrentStep(); + const _Sec* sec=step_value->GetSecondaryInCurrentStep(); if ( sec->size() > 0 ) { PropertyMask(m_currTrack.reason).set(G4PARTICLE_HAS_SECONDARIES); } } /// Update of the particle using the user handler if ( m_userHandler ) { - m_userHandler->step(step, mgr, m_currTrack); + m_userHandler->step(step_value, mgr, m_currTrack); } } @@ -427,38 +427,38 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { } } // (2) Re-evaluate the corresponding geant4 track equivalents using the new mapping - for(TrackEquivalents::iterator i=m_equivalentTracks.begin(),iend=m_equivalentTracks.end(); i!=iend; ++i) { - int g4_equiv = (*i).first; - ParticleMap::const_iterator ipar; + for(TrackEquivalents::iterator ie=m_equivalentTracks.begin(),ie_end=m_equivalentTracks.end(); ie!=ie_end; ++ie) { + int g4_equiv = (*ie).first; while( (ipar=m_particleMap.find(g4_equiv)) == m_particleMap.end() ) { TrackEquivalents::const_iterator iequiv = m_equivalentTracks.find(g4_equiv); - if ( iequiv == iend ) { + if ( iequiv == ie_end ) { break; // ERROR !! Will be handled by printout below because ipar==end() } g4_equiv = (*iequiv).second; } + TrackEquivalents::mapped_type equiv = (*ie).second; if ( ipar != m_particleMap.end() ) { - equivalents[(*i).first] = (*ipar).second->id; // requires (1) ! + equivalents[(*ie).first] = (*ipar).second->id; // requires (1) ! Geant4ParticleHandle p = (*ipar).second; const G4ParticleDefinition* def = p.definition(); int pdg = int(fabs(def->GetPDGEncoding())+0.1); if ( pdg != 0 && pdg<36 && !(pdg > 10 && pdg < 17) && pdg != 22 ) { - error("+++ ERROR: Geant4 particle for track:%d last known is:%d -- is gluon or quark!",(*i).second,g4_equiv); + error("+++ ERROR: Geant4 particle for track:%d last known is:%d -- is gluon or quark!",equiv,g4_equiv); } pdg = int(fabs(p->pdgID)+0.1); if ( pdg != 0 && pdg<36 && !(pdg > 10 && pdg < 17) && pdg != 22 ) { - error("+++ ERROR(2): Geant4 particle for track:%d last known is:%d -- is gluon or quark!",(*i).second,g4_equiv); + error("+++ ERROR(2): Geant4 particle for track:%d last known is:%d -- is gluon or quark!",equiv,g4_equiv); } } else { - error("+++ No Equivalent particle for track:%d last known is:%d",(*i).second,g4_equiv); + error("+++ No Equivalent particle for track:%d last known is:%d",equiv,g4_equiv); } } // (3) Compute the particle's parents and daughters. // Replace the original Geant4 track with the // equivalent particle still present in the record. - for(ParticleMap::const_iterator ipar, iend=m_particleMap.end(), i=m_particleMap.begin(); i!=iend; ++i) { + for(iend=m_particleMap.end(), i=m_particleMap.begin(); i!=iend; ++i) { Particle* p = (*i).second; if ( p->g4Parent > 0 ) { int equiv_id = equivalents[p->g4Parent]; diff --git a/DDG4/src/Geant4ParticlePrint.cpp b/DDG4/src/Geant4ParticlePrint.cpp index 31002bb66a38e5af9395be10fa433ca1d3a154ac..ddd3eda4110b6fd2209fd1b43e1ed6d8c8298fc6 100644 --- a/DDG4/src/Geant4ParticlePrint.cpp +++ b/DDG4/src/Geant4ParticlePrint.cpp @@ -24,8 +24,8 @@ using namespace DD4hep::Simulation; typedef ReferenceBitMask<const int> PropertyMask; /// Standard constructor -Geant4ParticlePrint::Geant4ParticlePrint(Geant4Context* context, const std::string& nam) -: Geant4EventAction(context,nam) +Geant4ParticlePrint::Geant4ParticlePrint(Geant4Context* ctxt, const std::string& nam) +: Geant4EventAction(ctxt,nam) { declareProperty("OutputType",m_outputType=3); declareProperty("PrintBegin",m_printBegin=false); diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp index 278ef825fda5b03df60c2d52359f23b853a0bce6..bbed22ebb73be3ef3a0801a1d27f80925794f0c4 100644 --- a/DDG4/src/Geant4PhysicsList.cpp +++ b/DDG4/src/Geant4PhysicsList.cpp @@ -89,8 +89,8 @@ Geant4PhysicsList::Process& Geant4PhysicsList::Process::operator=(const Process& } /// Standard constructor -Geant4PhysicsList::Geant4PhysicsList(Geant4Context* context, const string& nam) -: Geant4Action(context, nam) { +Geant4PhysicsList::Geant4PhysicsList(Geant4Context* ctxt, const string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -168,14 +168,14 @@ const Geant4PhysicsList::ParticleProcesses& Geant4PhysicsList::processes(const s } /// Callback to construct the physics list -void Geant4PhysicsList::constructProcess(Geant4UserPhysics* physics) { - printout(INFO, "Geant4PhysicsList", "%s> constructProcess %p", name().c_str(), physics); - constructPhysics(physics); - constructProcesses(physics); +void Geant4PhysicsList::constructProcess(Geant4UserPhysics* physics_pointer) { + printout(INFO, "Geant4PhysicsList", "%s> constructProcess %p", name().c_str(), physics_pointer); + constructPhysics(physics_pointer); + constructProcesses(physics_pointer); } /// Callback to construct particle decays -void Geant4PhysicsList::constructPhysics(Geant4UserPhysics* physics) { +void Geant4PhysicsList::constructPhysics(Geant4UserPhysics* physics_pointer) { for (PhysicsConstructors::const_iterator i = m_physics.begin(); i != m_physics.end(); ++i) { const PhysicsConstructors::value_type& ctor = *i; G4VPhysicsConstructor* p = PluginService::Create<G4VPhysicsConstructor*>(ctor); @@ -183,14 +183,14 @@ void Geant4PhysicsList::constructPhysics(Geant4UserPhysics* physics) { throw runtime_error(format("Geant4PhysicsList", "Failed to create the physics entities " "for the G4VPhysicsConstructor '%s'", ctor.c_str())); } - physics->RegisterPhysics(p); + physics_pointer->RegisterPhysics(p); printout(INFO, "Geant4PhysicsList", "%s> registered Geant4 physics %s", name().c_str(), ctor.c_str()); } } /// constructParticle callback -void Geant4PhysicsList::constructParticles(Geant4UserPhysics* physics) { - printout(INFO, "Geant4PhysicsList", "%s> constructParticles %p", name().c_str(), physics); +void Geant4PhysicsList::constructParticles(Geant4UserPhysics* physics_pointer) { + printout(INFO, "Geant4PhysicsList", "%s> constructParticles %p", name().c_str(), physics_pointer); /// Now define all particles for (ParticleConstructors::const_iterator i = m_particles.begin(); i != m_particles.end(); ++i) { const ParticleConstructors::value_type& ctor = *i; @@ -207,8 +207,8 @@ void Geant4PhysicsList::constructParticles(Geant4UserPhysics* physics) { } /// Callback to construct processes (uses the G4 particle table) -void Geant4PhysicsList::constructProcesses(Geant4UserPhysics* physics) { - printout(INFO, "Geant4PhysicsList", "%s> constructProcesses %p", name().c_str(), physics); +void Geant4PhysicsList::constructProcesses(Geant4UserPhysics* physics_pointer) { + printout(INFO, "Geant4PhysicsList", "%s> constructProcesses %p", name().c_str(), physics_pointer); for (PhysicsProcesses::const_iterator i = m_processes.begin(); i != m_processes.end(); ++i) { const string& part_name = (*i).first; const ParticleProcesses& procs = (*i).second; @@ -238,8 +238,8 @@ void Geant4PhysicsList::constructProcesses(Geant4UserPhysics* physics) { } /// Standard constructor -Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* context, const string& nam) -: Geant4Action(context, nam), m_transportation(false), m_decays(false) { +Geant4PhysicsListActionSequence::Geant4PhysicsListActionSequence(Geant4Context* ctxt, const string& nam) +: Geant4Action(ctxt, nam), m_transportation(false), m_decays(false) { declareProperty("transportation", m_transportation); declareProperty("extends", m_extends); declareProperty("decays", m_decays); @@ -280,30 +280,30 @@ void Geant4PhysicsListActionSequence::adopt(Geant4PhysicsList* action) { } /// begin-of-event callback -void Geant4PhysicsListActionSequence::constructParticles(Geant4UserPhysics* physics) { - m_particle(physics); - m_actors(&Geant4PhysicsList::constructParticles, physics); +void Geant4PhysicsListActionSequence::constructParticles(Geant4UserPhysics* physics_pointer) { + m_particle(physics_pointer); + m_actors(&Geant4PhysicsList::constructParticles, physics_pointer); } /// constructProcess callback -void Geant4PhysicsListActionSequence::constructProcess(Geant4UserPhysics* physics) { - m_actors(&Geant4PhysicsList::constructProcess, physics); - m_process(physics); +void Geant4PhysicsListActionSequence::constructProcess(Geant4UserPhysics* physics_pointer) { + m_actors(&Geant4PhysicsList::constructProcess, physics_pointer); + m_process(physics_pointer); if (m_decays) { - constructDecays(physics); + constructDecays(physics_pointer); } if (m_transportation) { - physics->AddTransportation(); + physics_pointer->AddTransportation(); } } /// Callback to construct particle decays -void Geant4PhysicsListActionSequence::constructDecays(Geant4UserPhysics* physics) { +void Geant4PhysicsListActionSequence::constructDecays(Geant4UserPhysics* physics_pointer) { G4ParticleTable* pt = G4ParticleTable::GetParticleTable(); G4ParticleTable::G4PTblDicIterator* iter = pt->GetIterator(); // Add Decay Process G4Decay* decay = new G4Decay(); - printout(INFO, "Geant4PhysicsList", "%s> constructDecays %p", name().c_str(), physics); + printout(INFO, "Geant4PhysicsList", "%s> constructDecays %p", name().c_str(), physics_pointer); iter->reset(); while ((*iter)()) { G4ParticleDefinition* p = iter->value(); diff --git a/DDG4/src/Geant4PrimaryHandler.cpp b/DDG4/src/Geant4PrimaryHandler.cpp index 49bfdde1cd7f78173abc4e6bd297b80bcc16fb55..978ac9028bc3f5097d5f9efa124fd59f9cbc5b8f 100644 --- a/DDG4/src/Geant4PrimaryHandler.cpp +++ b/DDG4/src/Geant4PrimaryHandler.cpp @@ -15,8 +15,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4PrimaryHandler::Geant4PrimaryHandler(Geant4Context* context, const std::string& nam) -: Geant4GeneratorAction(context,nam) +Geant4PrimaryHandler::Geant4PrimaryHandler(Geant4Context* ctxt, const std::string& nam) +: Geant4GeneratorAction(ctxt,nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4RunAction.cpp b/DDG4/src/Geant4RunAction.cpp index e7cd40ce0dd4d8861ecde33507107c595ea17785..b915ffe1066bf0a4a326c52a5b4cde18bbfa600b 100644 --- a/DDG4/src/Geant4RunAction.cpp +++ b/DDG4/src/Geant4RunAction.cpp @@ -16,8 +16,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4RunAction::Geant4RunAction(Geant4Context* context, const std::string& nam) -: Geant4Action(context, nam) { +Geant4RunAction::Geant4RunAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -35,8 +35,8 @@ void Geant4RunAction::end(const G4Run*) { } /// Standard constructor -Geant4RunActionSequence::Geant4RunActionSequence(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4RunActionSequence::Geant4RunActionSequence(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index 0914ded1e32c48c6dd89fe6d92599269c2ff49ec..46cf42d3f92226ce6d474313a5ad4b04fb2f7ff7 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -51,8 +51,8 @@ namespace { } /// Standard action constructor -Geant4ActionSD::Geant4ActionSD(const std::string& name) -: Geant4Action(0, name) { +Geant4ActionSD::Geant4ActionSD(const std::string& nam) +: Geant4Action(0, nam) { InstanceCount::increment(this); } @@ -62,8 +62,8 @@ Geant4ActionSD::~Geant4ActionSD() { } /// Standard constructor -Geant4Filter::Geant4Filter(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4Filter::Geant4Filter(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -78,17 +78,17 @@ bool Geant4Filter::operator()(const G4Step*) const { } /// Constructor. The detector element is identified by the name -Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& name, DetElement det, LCDD& lcdd) -: Geant4Action(ctxt, name), m_sensitiveDetector(0), m_sequence(0), - m_lcdd(lcdd), m_detector(det), m_sensitive(), m_readout(), m_segmentation() +Geant4Sensitive::Geant4Sensitive(Geant4Context* ctxt, const string& nam, DetElement det, LCDD& lcdd_ref) +: Geant4Action(ctxt, nam), m_sensitiveDetector(0), m_sequence(0), + m_lcdd(lcdd_ref), m_detector(det), m_sensitive(), m_readout(), m_segmentation() { InstanceCount::increment(this); if (!det.isValid()) { - throw runtime_error(format("Geant4Sensitive", "DDG4: Detector elemnt for %s is invalid.", name.c_str())); + throw runtime_error(format("Geant4Sensitive", "DDG4: Detector elemnt for %s is invalid.", nam.c_str())); } declareProperty("HitCreationMode", m_hitCreationMode = SIMPLE_MODE); - m_sequence = ctxt->kernel().sensitiveAction(m_detector.name()); - m_sensitive = lcdd.sensitiveDetector(det.name()); + m_sequence = context()->kernel().sensitiveAction(m_detector.name()); + m_sensitive = lcdd_ref.sensitiveDetector(det.name()); m_readout = m_sensitive.readout(); m_segmentation = m_readout.segmentation(); } @@ -204,20 +204,20 @@ long long int Geant4Sensitive::cellID(G4Step* s) { G4ThreeVector local = h.preTouchable()->GetHistory()->GetTopTransform().TransformPoint(global); Position loc(local.x()*MM_2_CM, local.y()*MM_2_CM, local.z()*MM_2_CM); Position glob(global.x()*MM_2_CM, global.y()*MM_2_CM, global.z()*MM_2_CM); - VolumeID cellID = m_segmentation.cellID(loc,glob,volID); - return cellID; + VolumeID cID = m_segmentation.cellID(loc,glob,volID); + return cID; } return volID; } /// Standard constructor -Geant4SensDetActionSequence::Geant4SensDetActionSequence(Geant4Context* context, const string& nam) -: Geant4Action(context, nam), m_hce(0) +Geant4SensDetActionSequence::Geant4SensDetActionSequence(Geant4Context* ctxt, const string& nam) +: Geant4Action(ctxt, nam), m_hce(0) { m_needsControl = true; - context->sensitiveActions().insert(name(), this); + context()->sensitiveActions().insert(name(), this); /// Update the sensitive detector type, so that the proper instance is created - m_sensitive = context->lcdd().sensitiveDetector(nam); + m_sensitive = context()->lcdd().sensitiveDetector(nam); m_sensitiveType = m_sensitive.type(); m_sensitive.setType("Geant4SensDet"); InstanceCount::increment(this); @@ -259,8 +259,8 @@ void Geant4SensDetActionSequence::adopt(Geant4Filter* filter) { } /// Initialize the usage of a hit collection. Returns the collection identifier -size_t Geant4SensDetActionSequence::defineCollection(Geant4Sensitive* owner, const std::string& name, create_t func) { - m_collections.push_back(make_pair(name, make_pair(owner,func))); +size_t Geant4SensDetActionSequence::defineCollection(Geant4Sensitive* owner, const std::string& collection_name, create_t func) { + m_collections.push_back(make_pair(collection_name, make_pair(owner,func))); return m_collections.size() - 1; } diff --git a/DDG4/src/Geant4SensitiveDetector.cpp b/DDG4/src/Geant4SensitiveDetector.cpp index 32f3dc2933104840dd21d3301a5115efd0ebcc1a..3fd235f5501b8ff00229c3e3579cc765dda1ef1a 100644 --- a/DDG4/src/Geant4SensitiveDetector.cpp +++ b/DDG4/src/Geant4SensitiveDetector.cpp @@ -30,10 +30,10 @@ using namespace DD4hep; using namespace DD4hep::Simulation; /// Constructor. The detector element is identified by the name -Geant4SensitiveDetector::Geant4SensitiveDetector(const string& name, LCDD& lcdd) -: G4VSensitiveDetector(name), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { - m_sensitive = lcdd.sensitiveDetector(name); - m_detector = lcdd.detector(name); +Geant4SensitiveDetector::Geant4SensitiveDetector(const string& nam, LCDD& lcdd) +: G4VSensitiveDetector(nam), m_lcdd(lcdd), m_detector(), m_sensitive(), m_readout(), m_hce(0) { + m_sensitive = lcdd.sensitiveDetector(nam); + m_detector = lcdd.detector(nam); m_readout = m_sensitive.readout(); } diff --git a/DDG4/src/Geant4StackingAction.cpp b/DDG4/src/Geant4StackingAction.cpp index b08d34cf4a5bff6c41f8439c447d12f3175c9480..9a929657e99232def2f223f7e96020c689044082 100644 --- a/DDG4/src/Geant4StackingAction.cpp +++ b/DDG4/src/Geant4StackingAction.cpp @@ -17,8 +17,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4StackingAction::Geant4StackingAction(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4StackingAction::Geant4StackingAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -28,8 +28,8 @@ Geant4StackingAction::~Geant4StackingAction() { } /// Standard constructor -Geant4StackingActionSequence::Geant4StackingActionSequence(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4StackingActionSequence::Geant4StackingActionSequence(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4SteppingAction.cpp b/DDG4/src/Geant4SteppingAction.cpp index 49856b7e0db5e2afb4591df11794027ae138ed5e..87794828b2b2ab44621179c7c83eca4b9e04edc3 100644 --- a/DDG4/src/Geant4SteppingAction.cpp +++ b/DDG4/src/Geant4SteppingAction.cpp @@ -13,8 +13,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4SteppingAction::Geant4SteppingAction(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4SteppingAction::Geant4SteppingAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -28,8 +28,8 @@ void Geant4SteppingAction::operator()(const G4Step*, G4SteppingManager*) { } /// Standard constructor -Geant4SteppingActionSequence::Geant4SteppingActionSequence(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4SteppingActionSequence::Geant4SteppingActionSequence(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4TouchableHandler.cpp b/DDG4/src/Geant4TouchableHandler.cpp index 4793a92648d358aec0fffd7a79feac46de2f504d..fc0dbe2b96716233d48ee6261211e1deb5c8f475 100644 --- a/DDG4/src/Geant4TouchableHandler.cpp +++ b/DDG4/src/Geant4TouchableHandler.cpp @@ -37,20 +37,20 @@ int Geant4TouchableHandler::depth() const { /// Helper: Generate placement path from touchable object Geant4TouchableHandler::Geant4PlacementPath Geant4TouchableHandler::placementPath(bool exception) const { - Geant4PlacementPath path; + Geant4PlacementPath path_val; if ( touchable ) { int i, n=touchable->GetHistoryDepth(); - path.reserve(n); + path_val.reserve(n); for (i=0; i < n; ++i) { G4VPhysicalVolume* pv = touchable->GetVolume(i); - path.push_back(pv); + path_val.push_back(pv); } - return path; + return path_val; } if ( exception ) { throw std::runtime_error("Attempt to access invalid G4 touchable object."); } - return path; + return path_val; } /// Helper: Access the placement path of a Geant4 touchable object as a string diff --git a/DDG4/src/Geant4TrackingAction.cpp b/DDG4/src/Geant4TrackingAction.cpp index 87082f99d41e5dda2e90690d9d7e3957c8eb9a5f..8dd92f184ddfb04d8ac8ceefa26630a9930ac39e 100644 --- a/DDG4/src/Geant4TrackingAction.cpp +++ b/DDG4/src/Geant4TrackingAction.cpp @@ -28,8 +28,8 @@ class G4Step; class G4TouchableHistory; /// Standard constructor -Geant4TrackingActionSequence::Geant4TrackingActionSequence(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4TrackingActionSequence::Geant4TrackingActionSequence(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { m_needsControl = true; InstanceCount::increment(this); } @@ -72,8 +72,8 @@ void Geant4TrackingActionSequence::end(const G4Track* track) { } /// Standard constructor -Geant4TrackingAction::Geant4TrackingAction(Geant4Context* context, const std::string& name) -: Geant4Action(context, name) { +Geant4TrackingAction::Geant4TrackingAction(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt, nam) { InstanceCount::increment(this); } @@ -132,10 +132,10 @@ bool Geant4TrackingAction::storeChildren() const { } /// Mark a single child of the track to be stored -bool Geant4TrackingAction::storeChild(Geant4TrackInformation* info) const { - if (0 != info) { - if (!info->storeTrack()) { - info->storeTrack(true); +bool Geant4TrackingAction::storeChild(Geant4TrackInformation* track_info) const { + if (0 != track_info) { + if (!track_info->storeTrack()) { + track_info->storeTrack(true); } return true; } diff --git a/DDG4/src/Geant4TrackingPostAction.cpp b/DDG4/src/Geant4TrackingPostAction.cpp index daab5c3f5b215fe23ee91d71415f9e7621d2838a..98804abca28e2176be15b1c09bcb027f00816aec 100644 --- a/DDG4/src/Geant4TrackingPostAction.cpp +++ b/DDG4/src/Geant4TrackingPostAction.cpp @@ -41,8 +41,8 @@ struct FindString { }; /// Standard constructor -Geant4TrackingPostAction::Geant4TrackingPostAction(Geant4Context* context, const std::string& name) -: Geant4TrackingAction(context, name) { +Geant4TrackingPostAction::Geant4TrackingPostAction(Geant4Context* ctxt, const std::string& nam) +: Geant4TrackingAction(ctxt, nam) { InstanceCount::increment(this); declareProperty("IgnoredProcesses", m_ignoredProcs); declareProperty("RequiredProcesses", m_requiredProcs); diff --git a/DDG4/src/Geant4TrackingPreAction.cpp b/DDG4/src/Geant4TrackingPreAction.cpp index b87b6243c36a4cde4eb38f6066e4163fe5befbc9..6719976fe3a1d31665b1c000c1472fa187b99c1e 100644 --- a/DDG4/src/Geant4TrackingPreAction.cpp +++ b/DDG4/src/Geant4TrackingPreAction.cpp @@ -16,8 +16,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4TrackingPreAction::Geant4TrackingPreAction(Geant4Context* context, const std::string& name) -: Geant4TrackingAction(context, name) { +Geant4TrackingPreAction::Geant4TrackingPreAction(Geant4Context* ctxt, const std::string& nam) +: Geant4TrackingAction(ctxt, nam) { InstanceCount::increment(this); } diff --git a/DDG4/src/Geant4UIManager.cpp b/DDG4/src/Geant4UIManager.cpp index a09725d5a6242dcfc38ac5ec7d83b6147b7a8aa7..8e3c77f1b659aba60da340f8d7dad8bab2a38e5d 100644 --- a/DDG4/src/Geant4UIManager.cpp +++ b/DDG4/src/Geant4UIManager.cpp @@ -23,8 +23,8 @@ using namespace DD4hep::Simulation; using namespace std; /// Initializing constructor -Geant4UIManager::Geant4UIManager(Geant4Context* context, const std::string& name) -: Geant4Action(context,name), m_vis(0), m_ui(0) +Geant4UIManager::Geant4UIManager(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt,nam), m_vis(0), m_ui(0) { declareProperty("SetupUI", m_uiSetup=""); declareProperty("SetupVIS", m_visSetup=""); diff --git a/DDG4/src/Geant4UserParticleHandler.cpp b/DDG4/src/Geant4UserParticleHandler.cpp index 65120b52f6df98cb6754888de53d243e9458e566..9ffb7a51b2f9f6148848e615858d9c1815d87651 100644 --- a/DDG4/src/Geant4UserParticleHandler.cpp +++ b/DDG4/src/Geant4UserParticleHandler.cpp @@ -16,8 +16,8 @@ using namespace DD4hep::Simulation; /// Standard constructor -Geant4UserParticleHandler::Geant4UserParticleHandler(Geant4Context* context, const std::string& nam) -: Geant4Action(context,nam) +Geant4UserParticleHandler::Geant4UserParticleHandler(Geant4Context* ctxt, const std::string& nam) +: Geant4Action(ctxt,nam) { InstanceCount::increment(this); declareProperty("MinimalKineticEnergy",m_kinEnergyCut = 100e0*CLHEP::MeV); diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index bc242e1780f0298278602f09aa4b955f175e6046..979922213dd8f2012e27fec2e9c45bf71b6c7527 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -249,10 +249,10 @@ void Geant4VolumeManager::volumeDescriptor(const PlacementPath& path, VolIDDescr G4LogicalVolume* lvol = path[0]->GetLogicalVolume(); if (lvol->GetSensitiveDetector()) { const G4VPhysicalVolume* node = path[0]; - const PlacementMap& m = ptr()->g4Placements; - for (PlacementMap::const_iterator i = m.begin(); i != m.end(); ++i) { - if ((*i).second == node) { - PlacedVolume pv = (*i).first; + const PlacementMap& pm = ptr()->g4Placements; + for (PlacementMap::const_iterator ipm = pm.begin(); ipm != pm.end(); ++ipm) { + if ((*ipm).second == node) { + PlacedVolume pv = (*ipm).first; Geometry::SensitiveDetector sd = pv.volume().sensitiveDetector(); Geometry::IDDescriptor dsc = sd.readout().idSpec(); vol_desc.first = vid; diff --git a/DDSegmentation/include/DDSegmentation/BitField64.h b/DDSegmentation/include/DDSegmentation/BitField64.h index 006e13cf7b8947145a77cd49d6204697d638d5dc..7c8ade2edf08194fea983d384230eae8f00017f9 100644 --- a/DDSegmentation/include/DDSegmentation/BitField64.h +++ b/DDSegmentation/include/DDSegmentation/BitField64.h @@ -80,9 +80,8 @@ namespace DDSegmentation { /** Set a new 64bit value given as high and low 32bit words. */ - void setValue(unsigned lowWord, unsigned highWord ) { - - setValue( ( lowWord & 0xffffffffULL ) | ( ( highWord & 0xffffffffULL ) << 32 ) ) ; + void setValue(unsigned low_Word, unsigned high_Word ) { + setValue( ( low_Word & 0xffffffffULL ) | ( ( high_Word & 0xffffffffULL ) << 32 ) ) ; } /** Operator for setting a new value and accessing the BitField directly */ @@ -94,14 +93,14 @@ namespace DDSegmentation { /** Acces to field through index */ - BitFieldValue& operator[](size_t index) { - return *_fields.at( index ) ; + BitFieldValue& operator[](size_t idx) { + return *_fields.at( idx ) ; } /** Const acces to field through index */ - const BitFieldValue& operator[](size_t index) const { - return *_fields.at( index ) ; + const BitFieldValue& operator[](size_t idx) const { + return *_fields.at( idx ) ; } /** Highest bit used in fields [0-63] diff --git a/DDSegmentation/include/DDSegmentation/Segmentation.h b/DDSegmentation/include/DDSegmentation/Segmentation.h index 08fade05ab99c365a5e9b5b081b373a38753e96e..b20b462ffae64fbc6d46fa195808ac6786c20cff 100644 --- a/DDSegmentation/include/DDSegmentation/Segmentation.h +++ b/DDSegmentation/include/DDSegmentation/Segmentation.h @@ -40,8 +40,8 @@ typedef long long int VolumeID; /// Simple container for a physics vector struct Vector3D { /// Default constructor - Vector3D(double x = 0., double y = 0., double z = 0.) : - X(x), Y(y), Z(z) { + Vector3D(double x_val = 0., double y_val = 0., double z_val = 0.) : + X(x_val), Y(y_val), Z(z_val) { } /// Constructor using a foreign vector class. Requires methods x(), y() and z() template<typename T> Vector3D(const T& v) { @@ -119,25 +119,20 @@ protected: Segmentation(BitField64* decoder); /// Add a parameter to this segmentation. Used by derived classes to define their parameters - template<typename TYPE> void registerParameter(const std::string& name, const std::string& description, - TYPE& parameter, const TYPE& defaultValue, UnitType unitType = SegmentationParameter::NoUnit, - bool isOptional = false) { - _parameters[name] = new TypedSegmentationParameter<TYPE>(name, description, parameter, defaultValue, unitType, - isOptional); + template<typename TYPE> void registerParameter(const std::string& nam, const std::string& desc, + TYPE& param, const TYPE& defaultVal, UnitType unitTyp = SegmentationParameter::NoUnit, + bool isOpt = false) { + _parameters[nam] = new TypedSegmentationParameter<TYPE>(nam,desc,param,defaultVal,unitTyp,isOpt); } /// Add a cell identifier to this segmentation. Used by derived classes to define their required identifiers - void registerIdentifier(const std::string& name, const std::string& description, std::string& identifier, - const std::string& defaultValue); + void registerIdentifier(const std::string& nam, const std::string& desc, std::string& ident, + const std::string& defaultVal); /// Helper method to convert a bin number to a 1D position static double binToPosition(CellID bin, double cellSize, double offset = 0.); /// Helper method to convert a 1D position to a cell ID static int positionToBin(double position, double cellSize, double offset = 0.); - /// The cell ID encoder and decoder - mutable BitField64* _decoder; - /// Keeps track of the decoder ownership - bool _ownsDecoder; /// The segmentation name std::string _name; /// The segmentation type @@ -148,6 +143,10 @@ protected: std::map<std::string, Parameter> _parameters; /// The indices used for the encoding std::map<std::string, StringParameter> _indexIdentifiers; + /// The cell ID encoder and decoder + mutable BitField64* _decoder; + /// Keeps track of the decoder ownership + bool _ownsDecoder; private: /// No copy constructor allowed diff --git a/DDSegmentation/include/DDSegmentation/SegmentationParameter.h b/DDSegmentation/include/DDSegmentation/SegmentationParameter.h index d435ecb02ae0939db924c7b5be79eaf99173a280..5d2fd2f55fb68083f2bb2fbb96d1dda064052914 100644 --- a/DDSegmentation/include/DDSegmentation/SegmentationParameter.h +++ b/DDSegmentation/include/DDSegmentation/SegmentationParameter.h @@ -126,9 +126,9 @@ public: } protected: /// Default constructor used by derived classes - SegmentationParameter(const std::string& name, const std::string& description, UnitType unitType = NoUnit, - bool isOptional = false) : - _name(name), _description(description), _unitType(unitType), _isOptional(isOptional) { + SegmentationParameter(const std::string& nam, const std::string& desc, UnitType unitTyp = NoUnit, + bool isOpt = false) : + _name(nam), _description(desc), _unitType(unitTyp), _isOptional(isOpt) { } /// The parameter name std::string _name; @@ -143,11 +143,11 @@ protected: template<typename TYPE> class TypedSegmentationParameter: public SegmentationParameter { public: /// Default constructor - TypedSegmentationParameter(const std::string& name, const std::string& description, TYPE& value, - const TYPE& defaultValue, SegmentationParameter::UnitType unitType = SegmentationParameter::NoUnit, - bool isOptional = false) : - SegmentationParameter(name, description, unitType, isOptional), _value(value), _defaultValue(defaultValue) { - _value = defaultValue; + TypedSegmentationParameter(const std::string& nam, const std::string& desc, TYPE& val, + const TYPE& default_Value, SegmentationParameter::UnitType unitTyp = SegmentationParameter::NoUnit, + bool isOpt = false) : + SegmentationParameter(nam, desc, unitTyp, isOpt), _value(val), _defaultValue(default_Value) { + _value = default_Value; } /// Access to the parameter value @@ -156,8 +156,8 @@ public: } /// Set the parameter value - void setTypedValue(const TYPE& value) { - _value = value; + void setTypedValue(const TYPE& val) { + _value = val; } /// Access to the parameter default value @@ -178,9 +178,9 @@ public: } /// Set the parameter value in string representation - void setValue(const std::string& value) { + void setValue(const std::string& val) { std::stringstream s; - s << value; + s << val; s >> _value; } @@ -199,11 +199,11 @@ protected: template<typename TYPE> class TypedSegmentationParameter<std::vector<TYPE> > : public SegmentationParameter { public: /// Default constructor - TypedSegmentationParameter(const std::string& name, const std::string& description, std::vector<TYPE>& value, - const std::vector<TYPE>& defaultValue, SegmentationParameter::UnitType unitType = - SegmentationParameter::NoUnit, bool isOptional = false) : - SegmentationParameter(name, description, unitType, isOptional), _value(value), _defaultValue(defaultValue) { - _value = defaultValue; + TypedSegmentationParameter(const std::string& nam, const std::string& desc, std::vector<TYPE>& val, + const std::vector<TYPE>& defaultVal, SegmentationParameter::UnitType unitTyp = + SegmentationParameter::NoUnit, bool isOpt = false) : + SegmentationParameter(nam, desc, unitTyp, isOpt), _value(val), _defaultValue(defaultVal) { + _value = defaultVal; } /// Access to the parameter value @@ -212,8 +212,8 @@ public: } /// Set the parameter value - void setTypedValue(const std::vector<TYPE>& value) { - _value = value; + void setTypedValue(const std::vector<TYPE>& val) { + _value = val; } /// Access to the parameter default value @@ -240,8 +240,8 @@ public: } /// Set the parameter value in string representation - void setValue(const std::string& value) { - std::vector<std::string> elements = splitString(value); + void setValue(const std::string& val) { + std::vector<std::string> elements = splitString(val); _value.clear(); for (std::vector<std::string>::const_iterator it = elements.begin(); it != elements.end(); ++it) { if (not it->empty()) { diff --git a/DDSegmentation/include/DDSegmentation/SegmentationUtil.h b/DDSegmentation/include/DDSegmentation/SegmentationUtil.h index 5f8798b2c0cfd1d9eb9d47031ebcaf072c3ba903..1c539bbec433c6aa1477625eb4692fc707ece0c3 100644 --- a/DDSegmentation/include/DDSegmentation/SegmentationUtil.h +++ b/DDSegmentation/include/DDSegmentation/SegmentationUtil.h @@ -58,22 +58,22 @@ Vector3D positionFromRPhiZ(double r, double phi, double z) { } /// calculates the radius in xyz from cylindrical coordinates -double magFromRPhiZ(double r, double phi, double z) { +double magFromRPhiZ(double r, double /* phi */, double z) { return std::sqrt(r * r + z * z); } /// calculates x from cylindrical coordinates -double xFromRPhiZ(double r, double phi, double z) { +double xFromRPhiZ(double r, double phi, double /* z */) { return r * std::cos(phi); } /// calculates y from cylindrical coordinates -double yFromRPhiZ(double r, double phi, double z) { +double yFromRPhiZ(double r, double phi, double /* z */) { return r * std::sin(phi); } /// calculates the polar angle theta from cylindrical coordinates -double thetaFromRPhiZ(double r, double phi, double z) { +double thetaFromRPhiZ(double r, double /* phi */, double z) { return r * std::atan(z / r); } diff --git a/DDSegmentation/src/CartesianGridXY.cpp b/DDSegmentation/src/CartesianGridXY.cpp index d8e5c3b0b0e4d084ea46563670cba33979f5d873..c079be45e4afe862eb7687a814d9b518769c0c82 100644 --- a/DDSegmentation/src/CartesianGridXY.cpp +++ b/DDSegmentation/src/CartesianGridXY.cpp @@ -43,7 +43,7 @@ Vector3D CartesianGridXY::position(const CellID& cellID) const { } /// determine the cell ID based on the position -CellID CartesianGridXY::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID CartesianGridXY::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); diff --git a/DDSegmentation/src/CartesianGridXYZ.cpp b/DDSegmentation/src/CartesianGridXYZ.cpp index 6ce8c65b9aa32a0e2d4010071aa4016b651f10a8..716cc14a4fd26fb90e553fcbda29a962dcd7edb6 100644 --- a/DDSegmentation/src/CartesianGridXYZ.cpp +++ b/DDSegmentation/src/CartesianGridXYZ.cpp @@ -41,7 +41,7 @@ Vector3D CartesianGridXYZ::position(const CellID& cellID) const { } /// determine the cell ID based on the position -CellID CartesianGridXYZ::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID CartesianGridXYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); diff --git a/DDSegmentation/src/CartesianGridXZ.cpp b/DDSegmentation/src/CartesianGridXZ.cpp index a98050a90aff54c026ab08e076580172593bc530..a2490733f736076b172cd2172bf506891203a781 100644 --- a/DDSegmentation/src/CartesianGridXZ.cpp +++ b/DDSegmentation/src/CartesianGridXZ.cpp @@ -46,7 +46,7 @@ Vector3D CartesianGridXZ::position(const CellID& cellID) const { } /// determine the cell ID based on the position -CellID CartesianGridXZ::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID CartesianGridXZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); (*_decoder)[_xId] = positionToBin(localPosition.X, _gridSizeX, _offsetX); (*_decoder)[_zId] = positionToBin(localPosition.Z, _gridSizeZ, _offsetZ); diff --git a/DDSegmentation/src/CartesianGridYZ.cpp b/DDSegmentation/src/CartesianGridYZ.cpp index 6a913998b0055d831addc0898b61b1768af0b367..52395855f74132342efb090d7ddaabd5e93105d7 100644 --- a/DDSegmentation/src/CartesianGridYZ.cpp +++ b/DDSegmentation/src/CartesianGridYZ.cpp @@ -44,7 +44,7 @@ Vector3D CartesianGridYZ::position(const CellID& cellID) const { } /// determine the cell ID based on the position -CellID CartesianGridYZ::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID CartesianGridYZ::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); (*_decoder)[_yId] = positionToBin(localPosition.Y, _gridSizeY, _offsetY); (*_decoder)[_zId] = positionToBin(localPosition.Z, _gridSizeZ, _offsetZ); diff --git a/DDSegmentation/src/PolarGridRPhi.cpp b/DDSegmentation/src/PolarGridRPhi.cpp index 8a29584e5d817f510735a6a1ccef0623433bde06..ee04360221b52037febea7d040f59824d73131c3 100644 --- a/DDSegmentation/src/PolarGridRPhi.cpp +++ b/DDSegmentation/src/PolarGridRPhi.cpp @@ -47,7 +47,7 @@ Vector3D PolarGridRPhi::position(const CellID& cellID) const { } /// determine the cell ID based on the position -CellID PolarGridRPhi::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID PolarGridRPhi::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); double phi = atan2(localPosition.Y,localPosition.X); double R = sqrt( localPosition.X * localPosition.X + localPosition.Y * localPosition.Y ); diff --git a/DDSegmentation/src/ProjectiveCylinder.cpp b/DDSegmentation/src/ProjectiveCylinder.cpp index cdbf281cc83cb1cc94f148c03e97a82bd0c956a0..1f2dd38b36343f034fa3448d276713098128db8c 100644 --- a/DDSegmentation/src/ProjectiveCylinder.cpp +++ b/DDSegmentation/src/ProjectiveCylinder.cpp @@ -45,7 +45,7 @@ Vector3D ProjectiveCylinder::position(const long64& cellID) const { } /// determine the cell ID based on the position -CellID ProjectiveCylinder::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, const VolumeID& volumeID) const { + CellID ProjectiveCylinder::cellID(const Vector3D& /* localPosition */, const Vector3D& globalPosition, const VolumeID& volumeID) const { _decoder->setValue(volumeID); double theta = thetaFromXYZ(globalPosition); double phi = phiFromXYZ(globalPosition); @@ -55,12 +55,12 @@ CellID ProjectiveCylinder::cellID(const Vector3D& localPosition, const Vector3D& } /// determine the polar angle theta based on the cell ID -double ProjectiveCylinder::theta(const long64& cellID) const { + double ProjectiveCylinder::theta(const long64& /* cellID */) const { int thetaIndex = (*_decoder)[_thetaID].value(); return M_PI * ((double) thetaIndex + 0.5) / (double) _thetaBins; } /// determine the azimuthal angle phi based on the cell ID -double ProjectiveCylinder::phi(const long64& cellID) const { + double ProjectiveCylinder::phi(const long64& /* cellID */) const { int phiIndex = (*_decoder)[_phiID].value(); return 2. * M_PI * ((double) phiIndex + 0.5) / (double) _phiBins; } diff --git a/DDSegmentation/src/TiledLayerSegmentation.cpp b/DDSegmentation/src/TiledLayerSegmentation.cpp index 567f9571d099a4a7e9363b10956d83539763adf3..e5357271ae1dc46889844c5e10851043eae4cd62 100644 --- a/DDSegmentation/src/TiledLayerSegmentation.cpp +++ b/DDSegmentation/src/TiledLayerSegmentation.cpp @@ -108,7 +108,7 @@ Vector3D TiledLayerSegmentation::position(const CellID& cellID) const { return Vector3D(localX, localY, 0.); } /// determine the cell ID based on the position -CellID TiledLayerSegmentation::cellID(const Vector3D& localPosition, const Vector3D& globalPosition, + CellID TiledLayerSegmentation::cellID(const Vector3D& localPosition, const Vector3D& /* globalPosition */, const VolumeID& volumeID) const { _decoder->setValue(volumeID); int layerIndex = (*_decoder)[_identifierLayer]; @@ -123,13 +123,13 @@ CellID TiledLayerSegmentation::cellID(const Vector3D& localPosition, const Vecto } /// helper method to calculate optimal cell size based on total size -double TiledLayerSegmentation::calculateOptimalCellSize(double nominalCellSize, double totalSize) { + double TiledLayerSegmentation::calculateOptimalCellSize(double /* nominalCellSize */, double /* totalSize */) { // TODO: implement algorithm to calculate optimal cell size return 1.; } /// helper method to calculate offset of bin 0 based on the total size -double TiledLayerSegmentation::calculateOffset(double cellSize, double totalSize) { +double TiledLayerSegmentation::calculateOffset(double /* cellSize */, double /* totalSize */) { // TODO: implement algorithm to calculate placement of bin 0 return 0.; }