From 3877263ba37a5f8a8757ecf310ae9d0f39fe7041 Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Wed, 10 Jul 2019 16:58:19 +0200
Subject: [PATCH] Optimize STL containers: replace insert/push with emplace

---
 DDAlign/src/AlignmentsCalib.cpp               |   2 +-
 DDAlign/src/GlobalAlignmentCache.cpp          |   4 +-
 DDAlign/src/GlobalAlignmentOperators.cpp      |   6 +-
 DDAlign/src/GlobalAlignmentStack.cpp          |   2 +-
 DDAlign/src/GlobalDetectorAlignment.cpp       |   4 +-
 DDCond/src/ConditionsContent.cpp              |  10 +-
 DDCond/src/Type1/Manager_Type1.cpp            |   2 +-
 DDCond/src/plugins/ConditionsUserPool.cpp     |  16 +--
 DDCore/include/DD4hep/DetectorData.h          |   2 +-
 .../include/DD4hep/detail/ContainerHelpers.h  |  22 ++--
 DDCore/src/AlignmentNominalMap.cpp            |   2 +-
 DDCore/src/AlignmentsCalculator.cpp           |  14 +--
 DDCore/src/BasicGrammar.cpp                   |   2 +-
 DDCore/src/ComponentProperties.cpp            |   2 +-
 DDCore/src/ConditionsMap.cpp                  |   4 +-
 DDCore/src/DetectorImp.cpp                    |   4 +-
 DDCore/src/DetectorInterna.cpp                |   4 +-
 DDCore/src/GeoHandler.cpp                     |  14 +--
 DDCore/src/OpaqueDataBinder.cpp               | 118 +++++++++---------
 DDCore/src/OpticalSurfaceManager.cpp          |   6 +-
 DDCore/src/PluginTester.cpp                   |   2 +-
 DDCore/src/VolumeManager.cpp                  |   2 +-
 DDCore/src/Volumes.cpp                        |   2 +-
 DDCore/src/XML/VolumeBuilder.cpp              |  16 +--
 DDCore/src/XML/XMLElements.cpp                |   2 +-
 DDCore/src/gdml/DetElementCreator.cpp         |   2 +-
 DDCore/src/plugins/CodeGenerator.cpp          |  10 +-
 DDCore/src/plugins/Compact2Objects.cpp        |   8 +-
 DDCore/src/python/PythonPlugin.cpp            |  12 +-
 DDEve/src/ContextMenu.cpp                     |   2 +-
 DDEve/src/DDG4EventHandler.cpp                |   2 +-
 DDEve/src/Display.cpp                         |   2 +-
 DDEve/src/ParticleActors.cpp                  |   4 +-
 DDG4/include/DDG4/Geant4DataConversion.h      |   2 +-
 DDG4/include/DDG4/Geant4HitCollection.h       |   2 +-
 DDG4/lcio/LCIOEventReader.cpp                 |   4 +-
 DDG4/plugins/Geant4EventReaderGuineaPig.cpp   |   4 +-
 DDG4/plugins/Geant4EventReaderHepEvt.cpp      |   8 +-
 DDG4/plugins/Geant4EventReaderHepMC.cpp       |   4 +-
 DDG4/plugins/Geant4HitDumpAction.cpp          |   4 +-
 DDG4/src/Geant4Converter.cpp                  |   4 +-
 DDG4/src/Geant4InputAction.cpp                |   2 +-
 DDG4/src/Geant4InputHandling.cpp              |   4 +-
 DDG4/src/Geant4Kernel.cpp                     |   2 +-
 DDG4/src/Geant4Output2ROOT.cpp                |   4 +-
 DDG4/src/Geant4PhysicsList.cpp                |   4 +-
 DDG4/src/Geant4Primary.cpp                    |   2 +-
 DDG4/src/Geant4VolumeManager.cpp              |   2 +-
 DDRec/src/MaterialManager.cpp                 |  14 +--
 DDRec/src/MaterialScan.cpp                    |   2 +-
 DDRec/src/Surface.cpp                         |  62 ++++-----
 DDRec/src/SurfaceManager.cpp                  |  38 +++---
 52 files changed, 236 insertions(+), 238 deletions(-)

diff --git a/DDAlign/src/AlignmentsCalib.cpp b/DDAlign/src/AlignmentsCalib.cpp
index 3ce1c5617..60a6fa36b 100644
--- a/DDAlign/src/AlignmentsCalib.cpp
+++ b/DDAlign/src/AlignmentsCalib.cpp
@@ -98,7 +98,7 @@ AlignmentsCalib::_set(DetElement detector, const Delta& delta)   {
   entry->source   = src_cond;
   entry->target   = tar_key.hash;
   entry->dirty    = 1;
-  return *(used.insert(make_pair(tar_key,entry.release())).first);
+  return *(used.emplace(tar_key,entry.release()).first);
 }
 
 /// (1) Add a new entry to an existing DetElement structure.
diff --git a/DDAlign/src/GlobalAlignmentCache.cpp b/DDAlign/src/GlobalAlignmentCache.cpp
index c177f8c0f..28b4a4235 100644
--- a/DDAlign/src/GlobalAlignmentCache.cpp
+++ b/DDAlign/src/GlobalAlignmentCache.cpp
@@ -177,7 +177,7 @@ GlobalAlignmentCache* GlobalAlignmentCache::subdetectorAlignments(const string&
   SubdetectorAlignments::const_iterator i = m_detectors.find(nam);
   if ( i == m_detectors.end() )   {
     GlobalAlignmentCache* ptr = new GlobalAlignmentCache(m_detDesc,nam,false);
-    m_detectors.insert(make_pair(nam,ptr));
+    m_detectors.emplace(nam,ptr);
     return ptr;
   }
   return (*i).second;
@@ -196,7 +196,7 @@ void GlobalAlignmentCache::apply(GlobalAlignmentStack& stack)    {
     DetElement det = _detector(e->detector);
     all[det].emplace_back(e);
     if ( stack.hasMatrix(*e) || stack.needsReset(*e) || stack.resetChildren(*e) )  {
-      detelt_updates.insert(make_pair(e->detector.path(),e->detector));
+      detelt_updates.emplace(e->detector.path(),e->detector);
     }
   }
   for(sd_entries_t::iterator i=all.begin(); i!=all.end(); ++i)  {
diff --git a/DDAlign/src/GlobalAlignmentOperators.cpp b/DDAlign/src/GlobalAlignmentOperators.cpp
index 5d3fff15a..5e64fcd6e 100644
--- a/DDAlign/src/GlobalAlignmentOperators.cpp
+++ b/DDAlign/src/GlobalAlignmentOperators.cpp
@@ -33,7 +33,7 @@ void GlobalAlignmentOperator::insert(GlobalAlignment alignment)  const   {
 
 void GlobalAlignmentSelector::operator()(Entries::value_type e)  const {
   TGeoPhysicalNode* pn = 0;
-  nodes.insert(make_pair(e->path,make_pair(pn,e)));
+  nodes.emplace(e->path,make_pair(pn,e));
 }
 
 void GlobalAlignmentSelector::operator()(const Cache::value_type& entry)  const {
@@ -44,11 +44,11 @@ void GlobalAlignmentSelector::operator()(const Cache::value_type& entry)  const
       const char* p = pn->GetName();
       bool reset_children = GlobalAlignmentStack::resetChildren(*e);
       if ( reset_children && ::strstr(p,e->path.c_str()) == p )   {
-        nodes.insert(make_pair(p,make_pair(pn,e)));
+        nodes.emplace(p,make_pair(pn,e));
         break;
       }
       else if ( e->path == p )  {
-        nodes.insert(make_pair(p,make_pair(pn,e)));
+        nodes.emplace(p,make_pair(pn,e));
         break;
       }
     }
diff --git a/DDAlign/src/GlobalAlignmentStack.cpp b/DDAlign/src/GlobalAlignmentStack.cpp
index 1a87663a7..292594bf5 100644
--- a/DDAlign/src/GlobalAlignmentStack.cpp
+++ b/DDAlign/src/GlobalAlignmentStack.cpp
@@ -146,7 +146,7 @@ bool GlobalAlignmentStack::add(dd4hep_ptr<StackEntry>& entry)  {
         throw runtime_error("GlobalAlignmentStack> Invalid alignment entry [No such detector]");
       }
       printout(INFO,"GlobalAlignmentStack","Add node:%s",e->path.c_str());
-      m_stack.insert(make_pair(e->path,entry.release()));
+      m_stack.emplace(e->path,entry.release());
       return true;
     }
     throw runtime_error("GlobalAlignmentStack> The entry with path "+entry->path+
diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp
index 35b26fb4e..57fcecc4d 100644
--- a/DDAlign/src/GlobalDetectorAlignment.cpp
+++ b/DDAlign/src/GlobalDetectorAlignment.cpp
@@ -130,11 +130,11 @@ namespace {
       //           << " " << string((*j)->GetName()) << " ";
       if ( ::strcmp((*j).ptr()->GetName(),(*k).placement().ptr()->GetName()) )  {
         //cout << "[DE]";
-        elements.emplace_back(make_pair(level,*k));
+        elements.emplace_back(level,*k);
         ++k;
       }
       else  {
-        //elements.emplace_back(make_pair(level,DetElement()));
+        //elements.emplace_back(level,DetElement());
       }
       //cout << " ";
     }
diff --git a/DDCond/src/ConditionsContent.cpp b/DDCond/src/ConditionsContent.cpp
index 27c9e6df3..d66ada4ae 100644
--- a/DDCond/src/ConditionsContent.cpp
+++ b/DDCond/src/ConditionsContent.cpp
@@ -54,7 +54,7 @@ void ConditionsContent::merge(const ConditionsContent& to_add)    {
   auto& cond  = to_add.conditions();
   auto& deriv = to_add.derived();
   for( const auto& c : cond )   {
-    auto ret = m_conditions.insert(c);
+    auto ret = m_conditions.emplace(c);
     if ( ret.second )  {
       c.second->addRef();
       continue;
@@ -66,7 +66,7 @@ void ConditionsContent::merge(const ConditionsContent& to_add)    {
              
   }
   for( const auto& d : deriv )   {
-    auto ret = m_derived.insert(d);
+    auto ret = m_derived.emplace(d);
     if ( ret.second )  {
       d.second->addRef();
       continue;
@@ -97,7 +97,7 @@ bool ConditionsContent::remove(Condition::key_type hash)   {
 
 pair<Condition::key_type, ConditionsLoadInfo*>
 ConditionsContent::insertKey(Condition::key_type hash)   {
-  auto ret = m_conditions.insert(make_pair(hash,(ConditionsLoadInfo*)0));
+  auto ret = m_conditions.emplace(hash,(ConditionsLoadInfo*)0);
   if ( ret.second )  return pair<Condition::key_type, ConditionsLoadInfo*>(hash,0);
   return pair<Condition::key_type, ConditionsLoadInfo*>(0,0);
 }
@@ -106,7 +106,7 @@ ConditionsContent::insertKey(Condition::key_type hash)   {
 pair<Condition::key_type, ConditionsLoadInfo*>
 ConditionsContent::addLocationInfo(Condition::key_type hash, ConditionsLoadInfo* info)   {
   if ( info )   {
-    auto ret = m_conditions.insert(make_pair(hash,info));
+    auto ret = m_conditions.emplace(hash,info);
     if ( ret.second )  {
       info->addRef();
       return *(ret.first);
@@ -120,7 +120,7 @@ ConditionsContent::addLocationInfo(Condition::key_type hash, ConditionsLoadInfo*
 pair<Condition::key_type, ConditionDependency*>
 ConditionsContent::addDependency(ConditionDependency* dep)
 {
-  auto ret = m_derived.insert(make_pair(dep->key(),dep));
+  auto ret = m_derived.emplace(dep->key(),dep);
   if ( ret.second )  {
     dep->addRef();
     return *(ret.first);
diff --git a/DDCond/src/Type1/Manager_Type1.cpp b/DDCond/src/Type1/Manager_Type1.cpp
index ef655e8e1..c3ae16fe8 100644
--- a/DDCond/src/Type1/Manager_Type1.cpp
+++ b/DDCond/src/Type1/Manager_Type1.cpp
@@ -230,7 +230,7 @@ ConditionsPool* Manager_Type1::registerIOV(const IOVType& typ, IOV::Key key)   {
   iov->keyData   = key;
   const void* argv_pool[] = {this, iov, 0};
   shared_ptr<ConditionsPool> cond_pool(createPlugin<ConditionsPool>(m_poolType,m_detDesc,2,argv_pool));
-  pool->elements.insert(make_pair(key,cond_pool));
+  pool->elements.emplace(key,cond_pool);
   printout(INFO,"ConditionsMgr","Created IOV Pool for:%s",iov->str().c_str());
   return cond_pool.get();
 }
diff --git a/DDCond/src/plugins/ConditionsUserPool.cpp b/DDCond/src/plugins/ConditionsUserPool.cpp
index 878cbb111..68e206198 100644
--- a/DDCond/src/plugins/ConditionsUserPool.cpp
+++ b/DDCond/src/plugins/ConditionsUserPool.cpp
@@ -186,10 +186,10 @@ namespace {
     T& m;
     MapSelector(T& o) : m(o) {}
     bool operator()(Condition::Object* o)  const
-    { return m.insert(make_pair(o->hash,o)).second;    }
+    { return m.emplace(o->hash,o).second;    }
   };
   template <typename T> MapSelector<T> mapSelector(T& container)
-  {  return MapSelector<T>(container);   }
+  {  return MapSelector<T>(container);       }
 
   template <typename T> struct Inserter {
     T& m;
@@ -197,7 +197,7 @@ namespace {
     Inserter(T& o, IOV* i=0) : m(o), iov(i) {}
     void operator()(const Condition& c)  {
       Condition::Object* o = c.ptr();
-      m.insert(make_pair(o->hash,o));
+      m.emplace(o->hash,o);
       if ( iov ) iov->iov_intersection(o->iov->key());
     }
     void operator()(const pair<Condition::key_type,Condition>& e) { (*this)(e.second);  }
@@ -242,7 +242,7 @@ ConditionsMappedUserPool<MAPPING>::i_findCondition(Condition::key_type key)  con
 
 template<typename MAPPING> inline bool
 ConditionsMappedUserPool<MAPPING>::i_insert(Condition::Object* o)   {
-  int ret = m_conditions.insert(make_pair(o->hash,o)).second;
+  int ret = m_conditions.emplace(o->hash,o).second;
   if ( flags&PRINT_INSERT )  {
     printout(INFO,"UserPool","++ %s condition [%016llX]: %s.",
              ret ? "Successfully inserted" : "FAILED to insert", o->hash,
@@ -461,7 +461,7 @@ size_t ConditionsMappedUserPool<MAPPING>::compute(const Dependencies& deps,
             /// This condition is no longer valid. remove it!
             /// It will be added again by the handler.
             m_conditions.erase(j);
-            missing.insert(i);
+            missing.emplace(i);
           }
           continue;
         }
@@ -469,7 +469,7 @@ size_t ConditionsMappedUserPool<MAPPING>::compute(const Dependencies& deps,
           m_conditions.erase(j);
         }
       }
-      missing.insert(i);
+      missing.emplace(i);
     }
     if ( !missing.empty() )  {
       ConditionsManagerObject*    m(m_manager.access());
@@ -615,7 +615,7 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV&                  required,
         for( auto i = calc_missing.begin(); i != last_calc; ++i )   {
           typename MAPPING::iterator j = m_conditions.find((*i).first);
           if ( j == m_conditions.end() )
-            slice_miss_calc.insert(*i);
+            slice_miss_calc.emplace(*i);
         }
       }
     }
@@ -758,7 +758,7 @@ ConditionsMappedUserPool<MAPPING>::compute(const IOV&                  required,
         for(auto i=calc_missing.begin(); i != last_calc; ++i)   {
           typename MAPPING::iterator j = m_conditions.find((*i).first);
           if ( j == m_conditions.end() )
-            slice_miss_calc.insert(*i);
+            slice_miss_calc.emplace(*i);
         }
       }
     }
diff --git a/DDCore/include/DD4hep/DetectorData.h b/DDCore/include/DD4hep/DetectorData.h
index 976ba15b6..5208a2c7b 100644
--- a/DDCore/include/DD4hep/DetectorData.h
+++ b/DDCore/include/DD4hep/DetectorData.h
@@ -64,7 +64,7 @@ namespace dd4hep {
       void append(const Handle<NamedObject>& e, bool throw_on_doubles = true) {
         if (e.isValid()) {
           std::string n = e.name();
-          std::pair<iterator, bool> r = this->insert(std::make_pair(n, e.ptr()));
+          std::pair<iterator, bool> r = this->emplace(n, e.ptr());
           if (!throw_on_doubles || r.second) {
             if (not r.second) {
               printout(WARNING,"Detector","+++ Object '%s' is already defined and new one will be ignored", n.c_str());
diff --git a/DDCore/include/DD4hep/detail/ContainerHelpers.h b/DDCore/include/DD4hep/detail/ContainerHelpers.h
index 2f3de195c..9ba202369 100644
--- a/DDCore/include/DD4hep/detail/ContainerHelpers.h
+++ b/DDCore/include/DD4hep/detail/ContainerHelpers.h
@@ -62,51 +62,51 @@ namespace dd4hep {
 
   template <typename Q, typename T>
   void insert_item(std::map<Q,T>&  c, Q de, const T& d)  {
-    c.insert(std::make_pair(de,d));
+    c.emplace(de,d);
   }
   template <typename Q, typename T>
   void insert_item(std::map<T,Q>&  c, Q de, const T& d)  {
-    c.insert(std::make_pair(d,de));
+    c.emplace(d,de);
   }
     
   template <typename Q, typename T>
   void insert_item(std::vector<std::pair<Q,T> >& c, Q de, const T& d)  {
-    c.emplace_back(std::make_pair(de,d));
+    c.emplace_back(de,d);
   }
   template <typename Q, typename T>
   void insert_item(std::vector<std::pair<std::string,T> >& c, Q de, const T& d)  {
-    c.emplace_back(std::make_pair(de.path(),d));
+    c.emplace_back(de.path(),d);
   }
 
   template <typename Q, typename T>
   void insert_item(std::list<std::pair<Q,T> >& c, Q de, const T& d)  {
-    c.emplace_back(std::make_pair(de,d));
+    c.emplace_back(de,d);
   }
   template <typename Q, typename T>
   void insert_item(std::list<std::pair<std::string,T> >& c, Q de, const T& d)  {
-    c.emplace_back(std::make_pair(de.path(),d));
+    c.emplace_back(de.path(),d);
   }
 
   template <typename Q, typename T>
   void insert_item(std::set<std::pair<Q,T> >& c, Q de, const T& d)  {
-    c.insert(std::make_pair(de,d));
+    c.emplace(de,d);
   }
   template <typename Q, typename T>
   void insert_item(std::set<std::pair<std::string,T> >& c, Q de, const T& d)  {
-    c.insert(std::make_pair(de.path(),d));
+    c.emplace(de.path(),d);
   }
 
   template <typename Q, typename T>
   void insert_item(std::multimap<Q,T>& c, Q de, const T& d)  {
-    c.insert(std::make_pair(de,d));
+    c.emplace(de,d);
   }
   template <typename Q, typename T>
   void insert_item(std::map<std::string,T>& c, Q de, const T& d)  {
-    c.insert(std::make_pair(de.path(),d));
+    c.emplace(de.path(),d);
   }
   template <typename Q, typename T>
   void insert_item(std::multimap<std::string,T>& c, Q de, const T& d)  {
-    c.insert(std::make_pair(de.path(),d));
+    c.emplace(de.path(),d);
   }
 }      // End namespace dd4hep
 #endif // DD4HEP_DD4HEP_CONTAINERHELPERS_H
diff --git a/DDCore/src/AlignmentNominalMap.cpp b/DDCore/src/AlignmentNominalMap.cpp
index 46b055f43..547ebb5ac 100644
--- a/DDCore/src/AlignmentNominalMap.cpp
+++ b/DDCore/src/AlignmentNominalMap.cpp
@@ -29,7 +29,7 @@ AlignmentsNominalMap::AlignmentsNominalMap(DetElement wrld) : world(wrld) {
 bool AlignmentsNominalMap::insert(DetElement              detector,
                                   Condition::itemkey_type key,
                                   Condition               condition)   {
-  auto res = data.insert(std::make_pair(ConditionKey(detector,key).hash,condition));
+  auto res = data.emplace(ConditionKey(detector,key).hash,condition);
   return res.second;
 }
 
diff --git a/DDCore/src/AlignmentsCalculator.cpp b/DDCore/src/AlignmentsCalculator.cpp
index 491dfb922..b186591ea 100644
--- a/DDCore/src/AlignmentsCalculator.cpp
+++ b/DDCore/src/AlignmentsCalculator.cpp
@@ -89,9 +89,9 @@ namespace dd4hep {
         void insert(DetElement det, const Delta* delta)   {
           if ( det.isValid() )  {
             Entry entry(det,delta);
-            detectors.insert(std::make_pair(det, entries.size()));
-            keys.insert(std::make_pair(entry.key, entries.size()));
-            entries.insert(entries.end(), entry);
+            detectors.emplace(det, entries.size());
+            keys.emplace(entry.key, entries.size());
+            entries.emplace_back(entry);
             return;
           }
           except("AlignContext","Failed to add entry: invalid detector handle!");
@@ -112,7 +112,7 @@ int AlignmentsCalculator::Scanner::operator()(DetElement de, int)  const  {
     Condition c = context.condition(key, false);
     if ( c.isValid() )  {
       const Delta& d = c.get<Delta>();
-      deltas.insert(std::make_pair(de,&d));
+      deltas.emplace(de,&d);
       if ( iov ) iov->iov_intersection(c->iov->key());
     }
     return 1;
@@ -229,7 +229,7 @@ Result AlignmentsCalculator::compute(const std::map<DetElement, Delta>& deltas,
   //
   OrderedDeltas ordered_deltas;
   for( const auto& i : deltas )
-    ordered_deltas.insert(std::make_pair(i.first, &i.second));
+    ordered_deltas.emplace(i.first, &i.second);
   return compute(ordered_deltas, alignments);
 }
 
@@ -285,7 +285,7 @@ size_t AlignmentsCalculator::extract_deltas(DetElement start,
           if ( idd != extract_context.end() )   {
             const Delta& d  = c.get<Delta>();
             DetElement   de = idd->second;
-            delta_conditions.insert(std::make_pair(de,&d));
+            delta_conditions.emplace(de,&d);
             if (effective_iov) effective_iov->iov_intersection(c->iov->key());
             return 1;
           }
@@ -300,7 +300,7 @@ size_t AlignmentsCalculator::extract_deltas(DetElement start,
     return deltas.size();
   }
   DetectorScanner().scan(AlignmentsCalculator::Scanner(ctxt,deltas,effective_iov),start);
-  for( const auto& d : deltas ) extract_context.insert(std::make_pair(d.first.key(), d.first));
+  for( const auto& d : deltas ) extract_context.emplace(d.first.key(), d.first);
   return deltas.size();
 }
 
diff --git a/DDCore/src/BasicGrammar.cpp b/DDCore/src/BasicGrammar.cpp
index bca5abee2..431aa0565 100644
--- a/DDCore/src/BasicGrammar.cpp
+++ b/DDCore/src/BasicGrammar.cpp
@@ -42,7 +42,7 @@ namespace {
 dd4hep::BasicGrammar::BasicGrammar(const std::string& typ)
   : name(typ), hash_value(dd4hep::detail::hash64(typ))
 {
-  if ( !registry().insert(std::make_pair(hash_value,this)).second )  {
+  if ( !registry().emplace(hash_value,this).second )  {
     // Error: Already existing grammar.
     dd4hep::except("BasicGrammar","FAILED to add existent registry: %s [%016llX]",name.c_str(), hash_value);    
   }
diff --git a/DDCore/src/ComponentProperties.cpp b/DDCore/src/ComponentProperties.cpp
index 6befee4c0..f3662acad 100644
--- a/DDCore/src/ComponentProperties.cpp
+++ b/DDCore/src/ComponentProperties.cpp
@@ -201,7 +201,7 @@ const Property& PropertyManager::operator[](const string& name) const {
 /// Add a new property
 void PropertyManager::add(const string& name, const Property& prop) {
   verifyNonExistence(name);
-  m_properties.insert(make_pair(name, prop));
+  m_properties.emplace(name, prop);
 }
 
 /// Bulk set of all properties
diff --git a/DDCore/src/ConditionsMap.cpp b/DDCore/src/ConditionsMap.cpp
index fe2942ba0..c9f496a11 100644
--- a/DDCore/src/ConditionsMap.cpp
+++ b/DDCore/src/ConditionsMap.cpp
@@ -96,7 +96,7 @@ std::vector<Condition> ConditionsMap::get(DetElement detector,
 /// Insert a new entry to the map
 template <typename T>
 bool ConditionsMapping<T>::insert(DetElement detector, Condition::itemkey_type key, Condition condition)   {
-  auto res = data.insert(std::make_pair(ConditionKey(detector,key).hash,condition));
+  auto res = data.emplace(ConditionKey(detector,key).hash,condition);
   return res.second;
 }
 
@@ -140,7 +140,7 @@ namespace dd4hep {
   template <>
   bool ConditionsMapping<std::multimap<Condition::key_type,Condition> >
   ::insert(DetElement detector, Condition::itemkey_type key, Condition condition)   {
-    data.insert(std::make_pair(ConditionKey(detector,key).hash,condition));
+    data.emplace(ConditionKey(detector,key).hash,condition);
     return true;
   }
 
diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp
index 14b28c64f..6b9f98b57 100644
--- a/DDCore/src/DetectorImp.cpp
+++ b/DDCore/src/DetectorImp.cpp
@@ -82,7 +82,7 @@ namespace {
     void insert(const string& name, Detector* detector)   {
       auto i = detectors.find(name);
       if ( i==detectors.end() )   {
-        detectors.insert(make_pair(name,detector));
+        detectors.emplace(name,detector);
         return;
       }
       except("DD4hep","Cannot insert detector instance %s [Already present]",name.c_str());
@@ -261,7 +261,7 @@ void DetectorImp::declareParent(const string& detector_name, const DetElement& p
       if (i == m_detectorParents.end())   {
         Volume parent_volume = parent.placement().volume();
         if ( parent_volume.isValid() )   {
-          m_detectorParents.insert(make_pair(detector_name,parent));
+          m_detectorParents.emplace(detector_name,parent);
           return;
         }
         except("DD4hep","+++ Failed to access valid parent volume of %s from %s",
diff --git a/DDCore/src/DetectorInterna.cpp b/DDCore/src/DetectorInterna.cpp
index 9fad854e4..e7f89d39e 100644
--- a/DDCore/src/DetectorInterna.cpp
+++ b/DDCore/src/DetectorInterna.cpp
@@ -121,8 +121,8 @@ DetElementObject* DetElementObject::clone(int new_id, int flg) const {
     DetElement c = d.clone(d.id, DetElement::COPY_PLACEMENT);
     c->SetName(d.GetName());
     c->SetTitle(d.GetTitle());
-    pair<DetElement::Children::iterator, bool> r = obj->children.insert(make_pair(c.name(), c));
-    if (r.second) {
+    bool r = obj->children.emplace(c.name(), c).second;
+    if ( r ) {
       c._data().parent = obj;
     }
     else {
diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp
index faea76e28..d5785b506 100644
--- a/DDCore/src/GeoHandler.cpp
+++ b/DDCore/src/GeoHandler.cpp
@@ -93,11 +93,11 @@ GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) {
         Volume   vol(v);
         // Note : assemblies and the world do not have a real volume nor a material
         if (info.volumeSet.find(vol) == info.volumeSet.end()) {
-          info.volumeSet.insert(vol);
+          info.volumeSet.emplace(vol);
           info.volumes.emplace_back(vol);
         }
         if (m.isValid())
-          info.materials.insert(m);
+          info.materials.emplace(m);
         if (dynamic_cast<Volume::Object*>(v)) {
           VisAttr vis = vol.visAttributes();
           //Region      reg = vol.region();
@@ -105,10 +105,10 @@ GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) {
           //SensitiveDetector det = vol.sensitiveDetector();
 
           if (vis.isValid())
-            info.vis.insert(vis);
-          //if ( lim.isValid() ) info.limits[lim.ptr()].insert(v);
-          //if ( reg.isValid() ) info.regions[reg.ptr()].insert(v);
-          //if ( det.isValid() ) info.sensitives[det.ptr()].insert(v);
+            info.vis.emplace(vis);
+          //if ( lim.isValid() ) info.limits[lim.ptr()].emplace(v);
+          //if ( reg.isValid() ) info.regions[reg.ptr()].emplace(v);
+          //if ( det.isValid() ) info.sensitives[det.ptr()].emplace(v);
         }
         collectSolid(info, v->GetName(), n->GetName(), v->GetShape(), n->GetMatrix());
       }
@@ -135,7 +135,7 @@ GeoHandler& GeoHandler::i_collect(const TGeoNode* current, int level, Region rg,
       vol.setLimitSet(limits);
     }
   }
-  (*m_data)[level].insert(current);
+  (*m_data)[level].emplace(current);
   //printf("GeoHandler: collect level:%d %s\n",level,current->GetName());
   if (num_children > 0) {
     for (int i = 0; i < num_children; ++i) {
diff --git a/DDCore/src/OpaqueDataBinder.cpp b/DDCore/src/OpaqueDataBinder.cpp
index 554e1a230..7d30173f5 100644
--- a/DDCore/src/OpaqueDataBinder.cpp
+++ b/DDCore/src/OpaqueDataBinder.cpp
@@ -136,11 +136,11 @@ namespace dd4hep {
     }
   
     template<typename BINDER, typename OBJECT, typename KEY, typename VAL>
-    static void insert_map_item(const BINDER&,
-                                OBJECT& object,
-                                const KEY& k,
-                                const string& val,
-                                const VAL*)
+    static void emplace_map_item(const BINDER&,
+                                 OBJECT& object,
+                                 const KEY& k,
+                                 const string& val,
+                                 const VAL*)
     {
       typedef map<KEY,VAL> map_t;
       map_t& m = object.template get<map_t>();
@@ -148,49 +148,49 @@ namespace dd4hep {
       if ( !BasicGrammar::instance<VAL>().fromString(&v, val) )  {
         except("OpaqueDataBinder","++ Failed to convert conditions map entry.");
       }
-      m.insert(make_pair(k,v));
+      m.emplace(k,v);
     }
 
     template<typename BINDER, typename OBJECT, typename KEY> 
-    static void insert_map_key(const BINDER& b,
-                               OBJECT& object,
-                               const string& key_val,
-                               const string& val_type,
-                               const string& val,
-                               const KEY*)
+    static void emplace_map_key(const BINDER& b,
+                                OBJECT& object,
+                                const string& key_val,
+                                const string& val_type,
+                                const string& val,
+                                const KEY*)
     {
       KEY key;
       BasicGrammar::instance<KEY>().fromString(&key, key_val);
       // Short and char is not part of the standard dictionaries. Fall back to 'int'.
       if ( val_type.substr(0,4) == "char" )
-        insert_map_item(b, object, key, val, (int*)0);
+        emplace_map_item(b, object, key, val, (int*)0);
       else if ( val_type.substr(0,5) == "short" )
-        insert_map_item(b, object, key, val, (int*)0);
+        emplace_map_item(b, object, key, val, (int*)0);
       else if ( val_type.substr(0,3) == "int" )
-        insert_map_item(b, object, key, val, (int*)0);
+        emplace_map_item(b, object, key, val, (int*)0);
       else if ( val_type.substr(0,4) == "long" )
-        insert_map_item(b, object, key, val, (long*)0);
+        emplace_map_item(b, object, key, val, (long*)0);
       else if ( val_type.substr(0,5) == "float" )
-        insert_map_item(b, object, key, val, (float*)0);
+        emplace_map_item(b, object, key, val, (float*)0);
       else if ( val_type.substr(0,6) == "double" )
-        insert_map_item(b, object, key, val, (double*)0);
+        emplace_map_item(b, object, key, val, (double*)0);
       else if ( val_type.substr(0,6) == "string" )
-        insert_map_item(b, object, key, val, (string*)0);
+        emplace_map_item(b, object, key, val, (string*)0);
       else if ( val_type == "std::string" )
-        insert_map_item(b, object, key, val, (string*)0);
+        emplace_map_item(b, object, key, val, (string*)0);
       else {
         printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s",
                  val_type.c_str(),val.c_str());
-        insert_map_item(b, object, key, val, (string*)0);
+        emplace_map_item(b, object, key, val, (string*)0);
       }
     }
 
     template<typename BINDER, typename OBJECT, typename KEY, typename VAL>
-    static void insert_map_pair(const BINDER&,
-                                OBJECT& object,
-                                const string& data,
-                                const KEY*,
-                                const VAL*)
+    static void emplace_map_pair(const BINDER&,
+                                 OBJECT& object,
+                                 const string& data,
+                                 const KEY*,
+                                 const VAL*)
     {
       typedef map<KEY,VAL> map_t;
       pair<KEY,VAL> entry;
@@ -198,37 +198,37 @@ namespace dd4hep {
       if ( !BasicGrammar::instance<pair<KEY,VAL> >().fromString(&entry,data) )  {
         except("OpaqueDataBinder","++ Failed to convert conditions map entry.");
       }
-      m.insert(entry);
+      m.emplace(entry);
     }
 
     template<typename BINDER, typename OBJECT, typename KEY> 
-    static void insert_map_data(const BINDER& b,
-                                OBJECT& object,
-                                const string& val_type,
-                                const string& pair_data,
-                                const KEY*)
+    static void emplace_map_data(const BINDER& b,
+                                 OBJECT& object,
+                                 const string& val_type,
+                                 const string& pair_data,
+                                 const KEY*)
     {
       // Short and char is not part of the standard dictionaries. Fall back to 'int'.
       if ( val_type.substr(0,4) == "char" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
       else if ( val_type.substr(0,5) == "short" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
       else if ( val_type.substr(0,3) == "int" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (int*)0);
       else if ( val_type.substr(0,4) == "long" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (long*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (long*)0);
       else if ( val_type.substr(0,5) == "float" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (float*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (float*)0);
       else if ( val_type.substr(0,6) == "double" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (double*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (double*)0);
       else if ( val_type.substr(0,6) == "string" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
       else if ( val_type == "std::string" )
-        insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
       else {
         printout(INFO,"Param","++ Unknown conditions parameter type:%s data:%s",
                  val_type.c_str(),pair_data.c_str());
-        insert_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
+        emplace_map_pair(b, object, pair_data, (KEY*)0, (string*)0);
       }
     }
 
@@ -308,27 +308,27 @@ namespace dd4hep {
                                       const string& val_type, const string& val)
     {
       if ( key_type.substr(0,3) == "int" )
-        insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
 #if defined(DD4HEP_HAVE_ALL_PARSERS)
       // Short and char is not part of the standard dictionaries. Fall back to 'int'.
       else if ( key_type.substr(0,4) == "char" )
-        insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
       else if ( key_type.substr(0,5) == "short" )
-        insert_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<int>::null_pointer());
       else if ( key_type.substr(0,4) == "long" )
-        insert_map_key(b, object, key, val_type, val, Primitive<long>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<long>::null_pointer());
       else if ( key_type.substr(0,5) == "float" )
-        insert_map_key(b, object, key, val_type, val, Primitive<float>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<float>::null_pointer());
       else if ( key_type.substr(0,6) == "double" )
-        insert_map_key(b, object, key, val_type, val, Primitive<double>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<double>::null_pointer());
 #endif
       else if ( key_type.substr(0,6) == "string" )
-        insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
       else if ( key_type == "std::string" )
-        insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
       else {
         printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str());
-        insert_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
+        emplace_map_key(b, object, key, val_type, val, Primitive<string>::null_pointer());
       }
       return true;
     }
@@ -340,27 +340,27 @@ namespace dd4hep {
                                       const std::string& pair_data)
     {
       if ( key_type.substr(0,3) == "int" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
 #if defined(DD4HEP_HAVE_ALL_PARSERS)
       // Short and char is not part of the standard dictionaries. Fall back to 'int'.
       else if ( key_type.substr(0,4) == "char" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
       else if ( key_type.substr(0,5) == "short" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<int>::null_pointer());
       else if ( key_type.substr(0,4) == "long" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<long>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<long>::null_pointer());
       else if ( key_type.substr(0,5) == "float" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<float>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<float>::null_pointer());
       else if ( key_type.substr(0,6) == "double" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<double>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<double>::null_pointer());
 #endif
       else if ( key_type.substr(0,6) == "string" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
       else if ( key_type == "std::string" )
-        insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
       else {
         printout(INFO,"OpaqueDataBinder","++ Unknown MAP-conditions key-type:%s",key_type.c_str());
-        insert_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
+        emplace_map_data(b, object, val_type, pair_data, Primitive<string>::null_pointer());
       }
       return true;
     }
diff --git a/DDCore/src/OpticalSurfaceManager.cpp b/DDCore/src/OpticalSurfaceManager.cpp
index 1e43b4144..e78446877 100644
--- a/DDCore/src/OpticalSurfaceManager.cpp
+++ b/DDCore/src/OpticalSurfaceManager.cpp
@@ -97,7 +97,7 @@ OpticalSurface OpticalSurfaceManager::opticalSurface(const string& full_nam)  co
 
 /// Add skin surface to manager
 void OpticalSurfaceManager::addSkinSurface(DetElement de, SkinSurface surf)  const   {
-  if ( access()->skinSurfaces.insert(make_pair(make_pair(de,surf->GetName()), surf)).second )
+  if ( access()->skinSurfaces.emplace(make_pair(de,surf->GetName()), surf).second )
     return;
   except("OpticalSurfaceManager","++ Skin surface %s already present for DE:%s.",
          surf->GetName(), de.name());
@@ -105,7 +105,7 @@ void OpticalSurfaceManager::addSkinSurface(DetElement de, SkinSurface surf)  con
 
 /// Add border surface to manager
 void OpticalSurfaceManager::addBorderSurface(DetElement de, BorderSurface surf)  const   {
-  if ( access()->borderSurfaces.insert(make_pair(make_pair(de,surf->GetName()), surf)).second )
+  if ( access()->borderSurfaces.emplace(make_pair(de,surf->GetName()), surf).second )
     return;
   except("OpticalSurfaceManager","++ Border surface %s already present for DE:%s.",
          surf->GetName(), de.name());
@@ -113,7 +113,7 @@ void OpticalSurfaceManager::addBorderSurface(DetElement de, BorderSurface surf)
 
 /// Add optical surface data to manager
 void OpticalSurfaceManager::addOpticalSurface(OpticalSurface surf)  const   {
-  if ( access()->opticalSurfaces.insert(make_pair(surf->GetName(), surf)).second )
+  if ( access()->opticalSurfaces.emplace(surf->GetName(), surf).second )
     return;
   except("OpticalSurfaceManager","++ Optical surface %s already present.",
          surf->GetName());
diff --git a/DDCore/src/PluginTester.cpp b/DDCore/src/PluginTester.cpp
index 951cc12b3..8607486f5 100644
--- a/DDCore/src/PluginTester.cpp
+++ b/DDCore/src/PluginTester.cpp
@@ -67,7 +67,7 @@ void* PluginTester::addExtension(void* ptr, const std::string& name, const std::
       Entry entry;
       entry.destruct = dtor;
       entry.id = ++s_extensionID;
-      extensionMap->insert(make_pair(&info, entry));
+      extensionMap->emplace(&info, entry);
     }
     return extensions[key] = ptr;
   }
diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp
index d30073f25..19a5b5105 100644
--- a/DDCore/src/VolumeManager.cpp
+++ b/DDCore/src/VolumeManager.cpp
@@ -402,7 +402,7 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) {
                             "valid placement VolIDs are allowed. [Invalid DetElement:" + det_name + "]");
       }
 
-      i = o.subdetectors.insert(make_pair(det, VolumeManager(det,ro))).first;
+      i = o.subdetectors.emplace(det, VolumeManager(det,ro)).first;
       const auto& id = (*vit);
       VolumeManager m = (*i).second;
       const BitFieldElement* field = ro.idSpec().field(id.first);
diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp
index 5e0502d50..492bb47dc 100644
--- a/DDCore/src/Volumes.cpp
+++ b/DDCore/src/Volumes.cpp
@@ -407,7 +407,7 @@ PlacedVolumeExtension::VolIDs::insert(const string& name, int value) {
   if (i != this->Base::end()) {
     return make_pair(i, false);
   }
-  i = this->Base::insert(this->Base::end(), make_pair(name, value));
+  i = this->Base::emplace(this->Base::end(), name, value);
   return make_pair(i, true);
 }
 
diff --git a/DDCore/src/XML/VolumeBuilder.cpp b/DDCore/src/XML/VolumeBuilder.cpp
index add297ba7..bf24c8620 100644
--- a/DDCore/src/XML/VolumeBuilder.cpp
+++ b/DDCore/src/XML/VolumeBuilder.cpp
@@ -143,7 +143,7 @@ Solid VolumeBuilder::makeShape(xml_h handle)   {
     if ( !buildMatch(build,buildType) )  {
       printout(INFO,"VolumeBuilder",
                "+++ Shape %s does NOT match build requirements. [Ignored]",nam.c_str());
-      if ( !nam.empty() ) shape_veto.insert(nam);
+      if ( !nam.empty() ) shape_veto.emplace(nam);
       return Solid();
     }
   }
@@ -157,7 +157,7 @@ Solid VolumeBuilder::makeShape(xml_h handle)   {
   /// And register it if it is not anonymous
   if ( !nam.empty() )   {
     solid.setName(nam);
-    shapes.insert(make_pair(nam,make_pair(handle,solid)));
+    shapes.emplace(nam,make_pair(handle,solid));
   }
   printout(debug ? ALWAYS : DEBUG, "VolumeBuilder",
            "+++ Created shape of type: %s name: %s",type.c_str(), nam.c_str());
@@ -179,7 +179,7 @@ size_t VolumeBuilder::buildShapes(xml_h handle)    {
         if ( !buildMatch(build,buildType) )  {
           printout(INFO,"VolumeBuilder",
                    "+++ Shape %s does NOT match build requirements. [Ignored]",nam.c_str());
-          shape_veto.insert(nam);
+          shape_veto.emplace(nam);
           continue;
         }
       }
@@ -192,7 +192,7 @@ size_t VolumeBuilder::buildShapes(xml_h handle)    {
       printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
                "+++ Building shape  from XML: %s of type: %s",
                nam.c_str(), solid->IsA()->GetName());
-      shapes.insert(make_pair(nam,make_pair(c,solid)));
+      shapes.emplace(nam,make_pair(c,solid));
       continue;
     }
     except("VolumeBuilder","+++ Shape %s is already known to this builder unit. "
@@ -225,7 +225,7 @@ size_t VolumeBuilder::buildVolumes(xml_h handle)    {
       string typ = c.attr<string>(attr);
       Volume vol = xml::createVolume(description, typ, c);
       vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
-      volumes.insert(make_pair(nam,make_pair(c,vol)));
+      volumes.emplace(nam,make_pair(c,vol));
       /// Check if the volume is sensitive
       if ( is_sensitive )   {
         vol.setSensitiveDetector(sensitive);
@@ -255,7 +255,7 @@ size_t VolumeBuilder::buildVolumes(xml_h handle)    {
       Volume    vol(nam, solid, mat);
       placeDaughters(detector, vol, x);
       vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
-      volumes.insert(make_pair(nam,make_pair(c,vol)));
+      volumes.emplace(nam,make_pair(c,vol));
       /// Check if the volume is sensitive
       if ( is_sensitive )   {
         vol.setSensitiveDetector(sensitive);
@@ -274,7 +274,7 @@ size_t VolumeBuilder::buildVolumes(xml_h handle)    {
       Assembly vol(nam);
       placeDaughters(detector, vol, x);
       vol.setAttributes(description,x.regionStr(),x.limitsStr(),x.visStr());
-      volumes.insert(make_pair(nam,make_pair(c,vol)));
+      volumes.emplace(nam,make_pair(c,vol));
       printout(debug ? ALWAYS : DEBUG,"VolumeBuilder",
                "+++ Building assembly from XML: %-20s shape:%-24s vis:%s",
                nam.c_str(), vol->GetShape()->IsA()->GetName(), x.visStr().c_str());
@@ -465,7 +465,7 @@ size_t VolumeBuilder::buildTransformations(Handle_t handle)   {
   size_t len = transformations.size();
   for( xml_coll_t c(handle,_U(transformation)); c; ++c )   {
     string nam = xml_comp_t(c).nameStr();
-    transformations.insert(make_pair(nam,make_pair(c,xml::createTransformation(c))));
+    transformations.emplace(nam,make_pair(c,xml::createTransformation(c)));
   }
   return transformations.size() - len;
 }
diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp
index 8b4f2b4ed..f9b996140 100644
--- a/DDCore/src/XML/XMLElements.cpp
+++ b/DDCore/src/XML/XMLElements.cpp
@@ -1032,7 +1032,7 @@ unsigned int Handle_t::checksum(unsigned int param, fcn_t fcn) const {
       map<string,string> m;
       TiXmlElement* e = n->ToElement();
       TiXmlAttribute* p=e->FirstAttribute();
-      for(; p; p=p->Next()) m.insert(make_pair(p->Name(),p->Value()));
+      for(; p; p=p->Next()) m.emplace(p->Name(),p->Value());
       param = (*fcn)(param,e->Value(),::strlen(e->Value()));
       for(StringMap::const_iterator i=m.begin();i!=m.end();++i) {
         param = (*fcn)(param,(*i).first.c_str(),(*i).first.length());
diff --git a/DDCore/src/gdml/DetElementCreator.cpp b/DDCore/src/gdml/DetElementCreator.cpp
index 392b3c2b2..8223c2079 100644
--- a/DDCore/src/gdml/DetElementCreator.cpp
+++ b/DDCore/src/gdml/DetElementCreator.cpp
@@ -271,7 +271,7 @@ DetElement DetElementCreator::addSubdetector(const std::string& nam, PlacedVolum
     if ( volid )  {
       det.placement().addPhysVolID("system",det.id());
     }
-    idet = subdetectors.insert(make_pair(nam,det)).first;
+    idet = subdetectors.emplace(nam,det).first;
     description.add(det);
     printout(printLevel,"DetElementCreator","++ Added sub-detector element: %s",det.path().c_str());
   }
diff --git a/DDCore/src/plugins/CodeGenerator.cpp b/DDCore/src/plugins/CodeGenerator.cpp
index 68378147c..adb222d07 100644
--- a/DDCore/src/plugins/CodeGenerator.cpp
+++ b/DDCore/src/plugins/CodeGenerator.cpp
@@ -280,7 +280,7 @@ namespace {
   ostream& Actor::handleStructure(ostream& log, DetElement parent, DetElement de)   {
     if ( de.isValid() && detelements.find(de) == detelements.end() )  {
       string name = obj_name("de", de.ptr());
-      detelements.insert(make_pair(de,name));
+      detelements.emplace(de,name);
       if ( !parent.isValid() )   {
         cout << "No parent: " << de.path() << " " << pointer(de) << " " << pointer(detector.world()) << endl;
         log << endl
@@ -320,12 +320,12 @@ namespace {
       TGeoMatrix* mat = node->GetMatrix();
 
       string name = obj_name("vol", vol);
-      placements.insert(make_pair(node,name));
+      placements.emplace(node,name);
 
       handleMatrix(log, mat);
 
       if ( vol && volumes.find(vol) == volumes.end() )  {
-        volumes.insert(make_pair(vol,name));
+        volumes.emplace(vol,name);
         if ( vol->IsA() == TGeoVolumeAssembly::Class() )    {
           log << "{" << newline;
           log << "\t Assembly vol(\"" << vol->GetName() << "\");" << newline;
@@ -384,7 +384,7 @@ namespace {
   ostream& Actor::handleMaterial(ostream& log, TGeoMedium* medium)   {
     if ( medium && materials.find(medium) == materials.end() )  {
       string name = obj_name("material",medium);
-      materials.insert(make_pair(medium,name));
+      materials.emplace(medium,name);
       TGeoMaterial* material = medium->GetMaterial();
       log << "{" << newline
           << "\t TGeoManager& mgr = detector.manager();" << newline
@@ -456,7 +456,7 @@ namespace {
       return log;
     }
 
-    shapes.insert(make_pair(shape,name));
+    shapes.emplace(shape,name);
 
     TClass* cl = shape->IsA();
     log << "{" << newline;
diff --git a/DDCore/src/plugins/Compact2Objects.cpp b/DDCore/src/plugins/Compact2Objects.cpp
index 80858ded8..5793f0eed 100644
--- a/DDCore/src/plugins/Compact2Objects.cpp
+++ b/DDCore/src/plugins/Compact2Objects.cpp
@@ -1032,10 +1032,10 @@ template <> void Converter<Property>::operator()(xml_h e) const {
 
   vector<xml_attr_t> a = e.attributes();
   if ( prp.find(name) == prp.end() )
-    prp.insert(make_pair(name, Detector::PropertyValues()));
+    prp.emplace(name, Detector::PropertyValues());
 
   for (xml_attr_t i : a )
-    prp[name].insert(make_pair(xml_tag_t(e.attr_name(i)).str(),e.attr<string>(i)));
+    prp[name].emplace(xml_tag_t(e.attr_name(i)).str(),e.attr<string>(i));
 }
 
 /** Specialized converter for electric and magnetic fields
@@ -1069,10 +1069,10 @@ template <> void Converter<CartesianField>::operator()(xml_h e) const {
     string props_name = c.attr<string>(_U(name));
     vector<xml_attr_t>a = c.attributes();
     if ( prp.find(props_name) == prp.end() ) {
-      prp.insert(make_pair(props_name, Detector::PropertyValues()));
+      prp.emplace(props_name, Detector::PropertyValues());
     }
     for ( xml_attr_t i : a )
-      prp[props_name].insert(make_pair(xml_tag_t(c.attr_name(i)).str(), c.attr<string>(i)));
+      prp[props_name].emplace(xml_tag_t(c.attr_name(i)).str(), c.attr<string>(i));
 
     if (c.hasAttr(_U(global)) && c.attr<bool>(_U(global))) {
       description.field().properties() = prp;
diff --git a/DDCore/src/python/PythonPlugin.cpp b/DDCore/src/python/PythonPlugin.cpp
index 1a0e2beae..70ecfe17d 100644
--- a/DDCore/src/python/PythonPlugin.cpp
+++ b/DDCore/src/python/PythonPlugin.cpp
@@ -56,17 +56,17 @@ namespace  {
       vector<pair<string, string> > commands;
       for(int i = 0; i < argc && argv[i]; ++i)  {
         if ( 0 == ::strncmp("-import",argv[i],2) )
-          commands.emplace_back(make_pair("import",argv[++i]));
+          commands.emplace_back("import",argv[++i]);
         else if ( 0 == ::strncmp("-dd4hep", argv[i],2) )
-          commands.emplace_back(make_pair("exec","import dd4hep"));
+          commands.emplace_back("exec","import dd4hep");
         else if ( 0 == ::strncmp("-macro", argv[i],2) )
-          commands.emplace_back(make_pair("macro",argv[++i]));
+          commands.emplace_back("macro",argv[++i]);
         else if ( 0 == ::strncmp("-exec", argv[i],2) )
-          commands.emplace_back(make_pair("exec",argv[++i]));
+          commands.emplace_back("exec",argv[++i]);
         else if ( 0 == ::strncmp("-eval", argv[i],2) )
-          commands.emplace_back(make_pair("calc",argv[++i]));
+          commands.emplace_back("calc",argv[++i]);
         else if ( 0 == ::strncmp("-prompt", argv[i],2) )
-          commands.emplace_back(make_pair("prompt",""));
+          commands.emplace_back("prompt","");
         else
           usage(argc, argv);
       }
diff --git a/DDEve/src/ContextMenu.cpp b/DDEve/src/ContextMenu.cpp
index 1089a96c5..c7744e5ec 100644
--- a/DDEve/src/ContextMenu.cpp
+++ b/DDEve/src/ContextMenu.cpp
@@ -68,7 +68,7 @@ ContextMenu& ContextMenu::instance(TClass* cl)  {
   Contexts::const_iterator i = mapped_entries().find(cl->GetName());
   if ( i != mapped_entries().end() ) return *((*i).second);
   ContextMenu* m = new ContextMenu(cl);
-  mapped_entries().insert(make_pair(cl->GetName(),m));
+  mapped_entries().emplace(cl->GetName(),m);
   return *m;
 }
 
diff --git a/DDEve/src/DDG4EventHandler.cpp b/DDEve/src/DDG4EventHandler.cpp
index 69b51e11b..e5ba92b91 100644
--- a/DDEve/src/DDG4EventHandler.cpp
+++ b/DDEve/src/DDG4EventHandler.cpp
@@ -175,7 +175,7 @@ Int_t DDG4EventHandler::ReadEvent(Long64_t event_number)   {
       for(Branches::const_iterator i=m_branches.begin(); i != m_branches.end(); ++i)  {
         TBranch* b = (*i).second.first;
         std::vector<void*>* ptr_data = *(std::vector<void*>**)b->GetAddress();
-        m_data[b->GetClassName()].push_back(make_pair(b->GetName(),ptr_data->size()));
+        m_data[b->GetClassName()].emplace_back(b->GetName(),ptr_data->size());
       }
       m_hasEvent = true;
       return nbytes;
diff --git a/DDEve/src/Display.cpp b/DDEve/src/Display.cpp
index c56b594c9..d68d1dd95 100644
--- a/DDEve/src/Display.cpp
+++ b/DDEve/src/Display.cpp
@@ -232,7 +232,7 @@ Display::CalodataContext& Display::GetCaloHistogram(const string& nam)   {
         ctx.config.hits = hits;
         ctx.config.name = nam;
       }
-      i = m_calodata.insert(make_pair(nam,ctx)).first;
+      i = m_calodata.emplace(nam,ctx).first;
       return (*i).second;      
     }
     throw runtime_error("Cannot access calodata configuration "+nam);
diff --git a/DDEve/src/ParticleActors.cpp b/DDEve/src/ParticleActors.cpp
index cd9b63176..56aaea7d7 100644
--- a/DDEve/src/ParticleActors.cpp
+++ b/DDEve/src/ParticleActors.cpp
@@ -67,7 +67,7 @@ void MCParticleCreator::addCompound(const std::string& name, TEveLine* e)   {
     static int icol = 0;
     TEveCompound* o = new TEveCompound(name.c_str(),name.c_str());
     particles->AddElement(o);
-    i = types.insert(make_pair(name,o)).first;
+    i = types.emplace(name,o).first;
     Color_t col = Colors[icol%(sizeof(Colors)/sizeof(Colors[0]))];
     col += icol/sizeof(Colors)/sizeof(Colors[0]);
     o->SetMainColor(col);
@@ -86,7 +86,7 @@ void MCParticleCreator::addCompoundLight(const std::string& name, TEveLine* e)
     static int icol = 0;
     TEveCompound* o = new TEveCompound(name.c_str(),name.c_str());
     particles->AddElement(o);
-    i = types.insert(make_pair(name,o)).first;
+    i = types.emplace(name,o).first;
     o->SetMainColor(kBlack);
     o->CSCApplyMainColorToAllChildren();
     ++icol;
diff --git a/DDG4/include/DDG4/Geant4DataConversion.h b/DDG4/include/DDG4/Geant4DataConversion.h
index 4d683466e..189b38d4d 100644
--- a/DDG4/include/DDG4/Geant4DataConversion.h
+++ b/DDG4/include/DDG4/Geant4DataConversion.h
@@ -129,7 +129,7 @@ namespace dd4hep {
       typedef Geant4Conversion<output_t,arg_t> self_t;
       Geant4DataConversion(void*) : Geant4Conversion<OUTPUT,ARGS>()
       {
-        this->self_t::conversions().insert(make_pair(&typeid(TAG),this));
+        this->self_t::conversions().emplace(&typeid(TAG),this);
         //std::cout << "Registered " << typeName(typeid(*this)) << std::endl;
       }
       virtual OUTPUT* operator()(const ARGS& args) const;
diff --git a/DDG4/include/DDG4/Geant4HitCollection.h b/DDG4/include/DDG4/Geant4HitCollection.h
index dde711f12..9e25b178c 100644
--- a/DDG4/include/DDG4/Geant4HitCollection.h
+++ b/DDG4/include/DDG4/Geant4HitCollection.h
@@ -338,7 +338,7 @@ namespace dd4hep {
       /// Add a new hit with a check, that the hit is of the same type
       template <typename TYPE> void add(VolumeID key, TYPE* hit_pointer) {
         m_lastHit = m_hits.size();
-        std::pair<Keys::iterator,bool> ret = m_keys.insert(std::make_pair(key,m_lastHit));
+        std::pair<Keys::iterator,bool> ret = m_keys.emplace(key,m_lastHit);
         if ( ret.second )  {
           Geant4HitWrapper w(m_manipulator->castHit(hit_pointer));
           m_hits.emplace_back(w);
diff --git a/DDG4/lcio/LCIOEventReader.cpp b/DDG4/lcio/LCIOEventReader.cpp
index 64aedadaa..ae0a8a9c4 100644
--- a/DDG4/lcio/LCIOEventReader.cpp
+++ b/DDG4/lcio/LCIOEventReader.cpp
@@ -140,7 +140,7 @@ LCIOEventReader::readParticles(int event_number,
     if ( p->parents.size() == 0 )  {
 
       Geant4Vertex* vtx = new Geant4Vertex ;
-      vertices.push_back( vtx );
+      vertices.emplace_back( vtx );
       vtx->x = p->vsx;
       vtx->y = p->vsy;
       vtx->z = p->vsz;
@@ -157,7 +157,7 @@ LCIOEventReader::readParticles(int event_number,
     if ( mcp->hasLeftDetector() )             status.set(G4PARTICLE_SIM_LEFT_DETECTOR);
     if ( mcp->isStopped() )                   status.set(G4PARTICLE_SIM_STOPPED);
     if ( mcp->isOverlay() )                   status.set(G4PARTICLE_SIM_OVERLAY);
-    particles.push_back(p);
+    particles.emplace_back(p);
   }
   return EVENT_READER_OK;
 }
diff --git a/DDG4/plugins/Geant4EventReaderGuineaPig.cpp b/DDG4/plugins/Geant4EventReaderGuineaPig.cpp
index c7b4c4ef8..61087b840 100644
--- a/DDG4/plugins/Geant4EventReaderGuineaPig.cpp
+++ b/DDG4/plugins/Geant4EventReaderGuineaPig.cpp
@@ -258,10 +258,10 @@ Geant4EventReaderGuineaPig::readParticles(int /* event_number */,
 
 
     //  Add the particle to the collection vector
-    particles.push_back(p);
+    particles.emplace_back(p);
 
     // create a new vertex for this particle
-    vertices.push_back( vtx) ;
+    vertices.emplace_back(vtx);
 
 
   } // End loop over particles
diff --git a/DDG4/plugins/Geant4EventReaderHepEvt.cpp b/DDG4/plugins/Geant4EventReaderHepEvt.cpp
index 1cac6db73..68395917b 100644
--- a/DDG4/plugins/Geant4EventReaderHepEvt.cpp
+++ b/DDG4/plugins/Geant4EventReaderHepEvt.cpp
@@ -183,7 +183,7 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
   
   //fg: for now we create exactly one event vertex here ( as before )
   Geant4Vertex* vtx = new Geant4Vertex ;
-  vertices.push_back( vtx );
+  vertices.emplace_back( vtx );
   vtx->x = 0;
   vtx->y = 0;
   vtx->z = 0;
@@ -280,11 +280,11 @@ Geant4EventReaderHepEvt::readParticles(int /* event_number */,
 
     //
     // Keep daughters information for later
-    daughter1.push_back(JDAHEP1);
-    daughter2.push_back(JDAHEP2);
+    daughter1.emplace_back(JDAHEP1);
+    daughter2.emplace_back(JDAHEP2);
     //
     //  Add the particle to the collection vector
-    particles.push_back(p);
+    particles.emplace_back(p);
     //
   }// End loop over particles
 
diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp
index 40101c561..e1d0c7560 100644
--- a/DDG4/plugins/Geant4EventReaderHepMC.cpp
+++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp
@@ -502,7 +502,7 @@ int HepMC::read_vertex(EventStream &info, istream& is, istringstream & input)
       return 0;
     }
   }
-  info.vertices().insert(make_pair(id,v));
+  info.vertices().emplace(id,v);
   for(char value = is.peek(); value=='P'; value=is.peek())  {
     value = get_input(is,input);
     if( !input || value < 0 )
@@ -514,7 +514,7 @@ int HepMC::read_vertex(EventStream &info, istream& is, istringstream & input)
       delete p;
       return 0;
     }
-    info.particles().insert(make_pair(p->id,p));
+    info.particles().emplace(p->id,p);
     p->pex = p->psx;
     p->pey = p->psy;
     p->pez = p->psz;
diff --git a/DDG4/plugins/Geant4HitDumpAction.cpp b/DDG4/plugins/Geant4HitDumpAction.cpp
index f9e75bd1b..e5889ed7e 100644
--- a/DDG4/plugins/Geant4HitDumpAction.cpp
+++ b/DDG4/plugins/Geant4HitDumpAction.cpp
@@ -118,11 +118,11 @@ void Geant4HitDumpAction::dumpCollection(G4VHitsCollection* collection)  {
       Geant4HitData* h = coll->hit(i);
       Geant4Tracker::Hit* trk_hit = dynamic_cast<Geant4Tracker::Hit*>(h);
       if ( 0 != trk_hit )   {
-        trk_hits.push_back(trk_hit);
+        trk_hits.emplace_back(trk_hit);
       }
       Geant4Calorimeter::Hit* cal_hit = dynamic_cast<Geant4Calorimeter::Hit*>(h);
       if ( 0 != cal_hit )   {
-        cal_hits.push_back(cal_hit);
+        cal_hits.emplace_back(cal_hit);
       }
     }
     if ( !trk_hits.empty() )
diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp
index 384573d1f..22721f285 100644
--- a/DDG4/src/Geant4Converter.cpp
+++ b/DDG4/src/Geant4Converter.cpp
@@ -203,7 +203,7 @@ void Geant4AssemblyVolume::imprint(Geant4GeometryInfo& info,
       // Register the physical volume created by us so we can delete it later
       //
       //fPVStore.emplace_back( pvPlaced.first );
-      info.g4VolumeImprints[vol].emplace_back(make_pair(new_chain,pvPlaced.first));
+      info.g4VolumeImprints[vol].emplace_back(new_chain,pvPlaced.first);
 #if 0
       cout << " Assembly:Parent:" << parent->GetName() << " " << node->GetName()
            << " " <<  (void*)node << " G4:" << pvName.str() << " Daughter:"
@@ -1167,7 +1167,7 @@ void Geant4Converter::handleProperties(Detector::Properties& prp) const {
         ::snprintf(txt, sizeof(txt), "%d", ++s_idd);
         id = txt;
       }
-      processors.insert(make_pair(id, nam));
+      processors.emplace(id, nam);
     }
   }
   for (map<string, string>::const_iterator i = processors.begin(); i != processors.end(); ++i) {
diff --git a/DDG4/src/Geant4InputAction.cpp b/DDG4/src/Geant4InputAction.cpp
index d2c061a6a..999962518 100644
--- a/DDG4/src/Geant4InputAction.cpp
+++ b/DDG4/src/Geant4InputAction.cpp
@@ -270,7 +270,7 @@ void Geant4InputAction::operator()(G4Event* event)   {
     // //     vtx->out.insert(p->id); // Stuff, to be given to Geant4 together with daughters
     // // }
 
-    inter->particles.insert(make_pair(p->id,p));
+    inter->particles.emplace(p->id,p);
     p.dumpWithMomentumAndVertex(outputLevel()-1,name(),"->");
   }
 }
diff --git a/DDG4/src/Geant4InputHandling.cpp b/DDG4/src/Geant4InputHandling.cpp
index e1cc9fb19..902a43f5f 100644
--- a/DDG4/src/Geant4InputHandling.cpp
+++ b/DDG4/src/Geant4InputHandling.cpp
@@ -94,7 +94,7 @@ static void collectPrimaries(Geant4PrimaryMap*         pm,
   PropertyMask status(p->status);
   int mask = interaction->mask;
   
-  interaction->particles.insert(make_pair(p->id,p));
+  interaction->particles.emplace(p->id,p);
   status.set(G4PARTICLE_PRIMARY);
   p->mask = mask;
   particle_origine->out.insert(p->id);
@@ -176,7 +176,7 @@ static void appendInteraction(const Geant4Action* caller,
   Geant4PrimaryInteraction::ParticleMap::iterator ip, ipend;
   for( ip=input->particles.begin(), ipend=input->particles.end(); ip != ipend; ++ip )  {
     Geant4Particle* p = (*ip).second;
-    output->particles.insert(make_pair(p->id,p->addRef()));
+    output->particles.emplace(p->id,p->addRef());
   }
   Geant4PrimaryInteraction::VertexMap::iterator ivfnd, iv, ivend;
   for( iv=input->vertices.begin(), ivend=input->vertices.end(); iv != ivend; ++iv )   {
diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp
index 46e9cf5f8..0d3b89abb 100644
--- a/DDG4/src/Geant4Kernel.cpp
+++ b/DDG4/src/Geant4Kernel.cpp
@@ -444,7 +444,7 @@ Geant4ActionPhase* Geant4Kernel::addPhase(const std::string& nam, const type_inf
   Phases::const_iterator i = m_phases.find(nam);
   if (i == m_phases.end()) {
     Geant4ActionPhase* p = new Geant4ActionPhase(workerContext(), nam, arg0, arg1, arg2);
-    m_phases.insert(make_pair(nam, p));
+    m_phases.emplace(nam, p);
     return p;
   }
   else if (throw_on_exist) {
diff --git a/DDG4/src/Geant4Output2ROOT.cpp b/DDG4/src/Geant4Output2ROOT.cpp
index 03b05dcac..db3b74adf 100644
--- a/DDG4/src/Geant4Output2ROOT.cpp
+++ b/DDG4/src/Geant4Output2ROOT.cpp
@@ -59,7 +59,7 @@ TTree* Geant4Output2ROOT::section(const string& nam) {
   if (i == m_sections.end()) {
     TDirectory::TContext ctxt(m_file);
     TTree* t = new TTree(nam.c_str(), ("Geant4 " + nam + " information").c_str());
-    m_sections.insert(make_pair(nam, t));
+    m_sections.emplace(nam, t);
     return t;
   }
   return (*i).second;
@@ -89,7 +89,7 @@ int Geant4Output2ROOT::fill(const string& nam, const ComponentCast& type, void*
       if (cl) {
         b = m_tree->Branch(nam.c_str(), cl->GetName(), (void*) 0);
         b->SetAutoDelete(false);
-        m_branches.insert(make_pair(nam, b));
+        m_branches.emplace(nam, b);
       }
       else {
         throw runtime_error("No ROOT TClass object availible for object type:" + typeName(type.type));
diff --git a/DDG4/src/Geant4PhysicsList.cpp b/DDG4/src/Geant4PhysicsList.cpp
index 3b84e549f..0ebc668a7 100644
--- a/DDG4/src/Geant4PhysicsList.cpp
+++ b/DDG4/src/Geant4PhysicsList.cpp
@@ -178,7 +178,7 @@ Geant4PhysicsList::ParticleProcesses& Geant4PhysicsList::processes(const string&
   if (i != m_processes.end())  {
     return (*i).second;
   }
-  pair<PhysicsProcesses::iterator, bool> ret = m_processes.insert(make_pair(nam, ParticleProcesses()));
+  auto ret = m_processes.emplace(nam, ParticleProcesses());
   return (*(ret.first)).second;
 }
 
@@ -198,7 +198,7 @@ Geant4PhysicsList::ParticleProcesses& Geant4PhysicsList::discreteProcesses(const
   if (i != m_discreteProcesses.end())  {
     return (*i).second;
   }
-  pair<PhysicsProcesses::iterator, bool> ret = m_discreteProcesses.insert(make_pair(nam, ParticleProcesses()));
+  pair<PhysicsProcesses::iterator, bool> ret = m_discreteProcesses.emplace(nam, ParticleProcesses());
   return (*(ret.first)).second;
 }
 
diff --git a/DDG4/src/Geant4Primary.cpp b/DDG4/src/Geant4Primary.cpp
index 0682ab7e5..f18280377 100644
--- a/DDG4/src/Geant4Primary.cpp
+++ b/DDG4/src/Geant4Primary.cpp
@@ -38,7 +38,7 @@ Geant4PrimaryMap::~Geant4PrimaryMap()   {
 
 /// Add a new object pair (G4 primary particle, DDG4 particle) into the maps
 void Geant4PrimaryMap::insert(G4PrimaryParticle* g4,Geant4Particle* p)   {
-  m_primaryMap.insert(std::make_pair(g4,p->addRef()));
+  m_primaryMap.emplace(g4,p->addRef());
 }
 
 /// Access DDG4 particle by G4 primary particle
diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp
index 00f6bcca7..7d1a6ec46 100644
--- a/DDG4/src/Geant4VolumeManager.cpp
+++ b/DDG4/src/Geant4VolumeManager.cpp
@@ -157,7 +157,7 @@ namespace {
                    (void*)code, Geant4GeometryInfo::placementPath(path).c_str());
           if (m_geo.g4Paths.find(path) == m_geo.g4Paths.end()) {
             m_geo.g4Paths[path] = code;
-            m_entries.insert(make_pair(code,path));
+            m_entries.emplace(code,path);
             return;
           }
           printout(ERROR, "Geant4VolumeManager", "populate: Severe error: Duplicated Geant4 path!!!! %s %s",
diff --git a/DDRec/src/MaterialManager.cpp b/DDRec/src/MaterialManager.cpp
index 7d73acdee..70e825cab 100644
--- a/DDRec/src/MaterialManager.cpp
+++ b/DDRec/src/MaterialManager.cpp
@@ -24,12 +24,9 @@
 namespace dd4hep {
   namespace rec {
 
-
     MaterialManager::MaterialManager(Volume world) : _mV(0), _m( Material() ), _p0(),_p1(),_pos() {
       _tgeoMgr = world->GetGeoManager();
     }
-
-
     
     MaterialManager::~MaterialManager(){
       
@@ -129,8 +126,8 @@ namespace dd4hep {
 	    
 	    
             if( length > epsilon )   {
-              _mV.push_back( std::make_pair( Material( node1->GetMedium() ) , length )  ) ; 
-              _placeV.push_back(std::make_pair(node1,length));
+              _mV.emplace_back(node1->GetMedium(), length ); 
+              _placeV.emplace_back(node1,length);
             }
             break;
           }
@@ -138,8 +135,8 @@ namespace dd4hep {
           track->AddPoint( position[0], position[1], position[2], 0.);
 	  
           if( length > epsilon )   {
-            _mV.push_back( std::make_pair( Material( node1->GetMedium() ), length  )  ) ; 
-            _placeV.push_back(std::make_pair(node1,length));
+            _mV.emplace_back(node1->GetMedium(), length); 
+            _placeV.emplace_back(node1,length);
           }
           node1 = node2;
         }
@@ -147,7 +144,8 @@ namespace dd4hep {
 
         //fg: protect against empty list:
         if( _mV.empty() ){
-          _mV.push_back( std::make_pair( Material( node1->GetMedium() ), totDist  )  ) ; 
+          _mV.emplace_back(node1->GetMedium(), totDist); 
+          _placeV.emplace_back(node1,totDist);
         }
 
 
diff --git a/DDRec/src/MaterialScan.cpp b/DDRec/src/MaterialScan.cpp
index 5a4130e74..d2969755c 100644
--- a/DDRec/src/MaterialScan.cpp
+++ b/DDRec/src/MaterialScan.cpp
@@ -213,7 +213,7 @@ void MaterialScan::print(const Vector3D& p0, const Vector3D& p1, double epsilon)
     sum_x0        += nx0;
     sum_lambda    += nLambda;
     path_length   += length;
-    materials.push_back(std::make_pair(placements[i].first->GetMedium(),length));
+    materials.emplace_back(placements[i].first->GetMedium(),length);
     const char* fmt = mat->GetRadLen() >= 1e5 ? fmt2 : fmt1;
     ::printf(fmt, i+1, mat->GetName(), mat->GetZ(), mat->GetA(),
              mat->GetDensity(), mat->GetRadLen(), mat->GetIntLen(), 
diff --git a/DDRec/src/Surface.cpp b/DDRec/src/Surface.cpp
index fcc987227..144e2b09a 100644
--- a/DDRec/src/Surface.cpp
+++ b/DDRec/src/Surface.cpp
@@ -497,10 +497,10 @@ namespace dd4hep {
 	Vector3D pl2 = -zv + r0v1  ;
 	Vector3D pl3 = -zv + r0v0 ;
 	
-	lines.push_back( std::make_pair( pl0, pl1 ) ) ;
-	lines.push_back( std::make_pair( pl1, pl2 ) ) ;
-	lines.push_back( std::make_pair( pl2, pl3 ) ) ;
-	lines.push_back( std::make_pair( pl3, pl0 ) ) ;
+	lines.emplace_back( pl0, pl1 );
+	lines.emplace_back( pl1, pl2 );
+	lines.emplace_back( pl2, pl3 );
+	lines.emplace_back( pl3, pl0 );
       } 
       return lines; 
     }
@@ -542,7 +542,7 @@ namespace dd4hep {
     bool findVolume( PlacedVolume pv,  Volume theVol, std::list< PlacedVolume >& volList ) {
       
 
-      volList.push_back( pv ) ;
+      volList.emplace_back( pv ) ;
       
       //   unsigned count = volList.size() ;
       //   for(unsigned i=0 ; i < count ; ++i) {
@@ -854,7 +854,7 @@ namespace dd4hep {
 	  _wtM->LocalToMaster( local_lines[i].first ,  av.array() ) ;
 	  _wtM->LocalToMaster( local_lines[i].second , bv.array() ) ;
 	  
-	  lines.push_back( std::make_pair( av, bv ) );
+	  lines.emplace_back( av, bv );
 	}
 	
 	return lines ;
@@ -917,10 +917,10 @@ namespace dd4hep {
 	    
             lines.reserve(4) ;
 	    
-            lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ,  _o - boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ) ) ;
-            lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ,  _o - boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ) ) ;
-            lines.push_back( std::make_pair( _o - boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ,  _o + boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ) ) ;
-            lines.push_back( std::make_pair( _o + boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ,  _o + boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ) ) ;
+            lines.emplace_back(_o + boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ,  _o - boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb );
+            lines.emplace_back(_o - boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb ,  _o - boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb );
+            lines.emplace_back(_o - boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ,  _o + boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb );
+            lines.emplace_back(_o + boxDim[ uidx ] * ub  - boxDim[ vidx ] * vb ,  _o + boxDim[ uidx ] * ub  + boxDim[ vidx ] * vb );
 	    
             return lines ;
           }	    
@@ -990,8 +990,8 @@ namespace dd4hep {
               _wtM->LocalToMaster( pl2, pg2.array() ) ;
               _wtM->LocalToMaster( pl3, pg3.array() ) ;
 	      
-              lines.push_back( std::make_pair( pg0, pg1 ) ) ;
-              lines.push_back( std::make_pair( pg2, pg3 ) ) ;
+              lines.emplace_back( pg0, pg1 );
+              lines.emplace_back( pg2, pg3 );
             }
 
             //add some vertical and horizontal lines so that the disc is seen in the rho-z projection
@@ -1011,7 +1011,7 @@ namespace dd4hep {
               _wtM->LocalToMaster( pl0, pg0.array() ) ;
               _wtM->LocalToMaster( pl1, pg1.array() ) ;
 	      
-              lines.push_back( std::make_pair( pg0, pg1 ) ) ;
+              lines.emplace_back(pg0, pg1);
             }
 
           }
@@ -1040,10 +1040,10 @@ namespace dd4hep {
           //the trapezoid is drawn as a set of four lines connecting its four corners
           lines.reserve(4) ;
           //_o is vector to the origin
-          lines.push_back( std::make_pair( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb) ) ;
-          lines.push_back( std::make_pair( _o - dx1 * ub  - dz * vb , _o + dx1 * ub  - dz * vb) ) ;
+          lines.emplace_back( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb);
+          lines.emplace_back( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb);
+          lines.emplace_back( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb);
+          lines.emplace_back( _o - dx1 * ub  - dz * vb ,  _o + dx1 * ub  - dz * vb);
 
           return lines;
         }
@@ -1071,10 +1071,10 @@ namespace dd4hep {
           //the trapezoid is drawn as a set of four lines connecting its four corners
           lines.reserve(4) ;
           //_o is vector to the origin
-          lines.push_back( std::make_pair( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb) ) ;
-          lines.push_back( std::make_pair( _o - dx1 * ub  - dz * vb , _o + dx1 * ub  - dz * vb) ) ;
+          lines.emplace_back( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb);
+          lines.emplace_back( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb);
+          lines.emplace_back( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb);
+          lines.emplace_back( _o - dx1 * ub  - dz * vb ,  _o + dx1 * ub  - dz * vb);
 
           return lines;
         }
@@ -1103,10 +1103,10 @@ namespace dd4hep {
           //the trapezoid is drawn as a set of four lines connecting its four corners
           lines.reserve(4) ;
           //_o is vector to the origin
-          lines.push_back( std::make_pair( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb ) ) ;
-          lines.push_back( std::make_pair( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb) ) ;
-          lines.push_back( std::make_pair( _o - dx1 * ub  - dz * vb , _o + dx1 * ub  - dz * vb) ) ;
+          lines.emplace_back( _o + dx1 * ub  - dz * vb ,  _o + dx2 * ub  + dz * vb);
+          lines.emplace_back( _o + dx2 * ub  + dz * vb ,  _o - dx2 * ub  + dz * vb);
+          lines.emplace_back( _o - dx2 * ub  + dz * vb ,  _o - dx1 * ub  - dz * vb);
+          lines.emplace_back( _o - dx1 * ub  - dz * vb ,  _o + dx1 * ub  - dz * vb);
 
           return lines;
         }
@@ -1160,13 +1160,13 @@ namespace dd4hep {
 	  
 
           if( i >  0 ) 
-            lines.push_back( std::make_pair( previous, gp )  ) ;
+            lines.emplace_back(previous, gp);
           else
             first = gp ;
 
           previous = gp ;
         }
-        lines.push_back( std::make_pair( previous, first )  ) ;
+        lines.emplace_back(previous, first);
 
 
       } else if( type().isCylinder() ) {  
@@ -1206,10 +1206,10 @@ namespace dd4hep {
             _wtM->LocalToMaster( pl2, pg2.array() ) ;
             _wtM->LocalToMaster( pl3, pg3.array() ) ;
 
-            lines.push_back( std::make_pair( pg0, pg1 ) ) ;
-            lines.push_back( std::make_pair( pg1, pg2 ) ) ;
-            lines.push_back( std::make_pair( pg2, pg3 ) ) ;
-            lines.push_back( std::make_pair( pg3, pg0 ) ) ;
+            lines.emplace_back( pg0, pg1 );
+            lines.emplace_back( pg1, pg2 );
+            lines.emplace_back( pg2, pg3 );
+            lines.emplace_back( pg3, pg0 );
           }
         }
       }
diff --git a/DDRec/src/SurfaceManager.cpp b/DDRec/src/SurfaceManager.cpp
index 1fe1d2e48..fd83a4d08 100644
--- a/DDRec/src/SurfaceManager.cpp
+++ b/DDRec/src/SurfaceManager.cpp
@@ -46,7 +46,7 @@ namespace dd4hep {
 
       if( it != _map.end() ){
 
-	return & it->second ;
+        return & it->second ;
       }
 
       return 0 ;
@@ -58,33 +58,33 @@ namespace dd4hep {
 
       for(unsigned i=0,N=types.size();i<N;++i){
 
-	const std::vector<DetElement>& dets = description.detectors( types[i] ) ;  
+        const std::vector<DetElement>& dets = description.detectors( types[i] ) ;  
 
-	for(unsigned j=0,M=dets.size();j<M;++j){
+        for(unsigned j=0,M=dets.size();j<M;++j){
 
-	  std::string name = dets[j].name() ;
+          std::string name = dets[j].name() ;
 
-	  SurfaceHelper surfH( dets[j] ) ;
+          SurfaceHelper surfH( dets[j] ) ;
 	  
-	  const SurfaceList& detSL = surfH.surfaceList() ;
+          const SurfaceList& detSL = surfH.surfaceList() ;
   
-	  // add an empty map for this detector in case there are no surfaces attached 
-	  _map.insert(  std::make_pair( name , SurfaceMap() ) )  ;
+          // add an empty map for this detector in case there are no surfaces attached 
+          _map.emplace(name , SurfaceMap());
 
-	  for( SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){
-	    ISurface* surf =  *it ;
+          for( SurfaceList::const_iterator it = detSL.begin() ; it != detSL.end() ; ++it ){
+            ISurface* surf =  *it ;
 	    
-	    // enter surface into map for this detector
-	    _map[ name ].insert( std::make_pair( surf->id(), surf )  ) ;
+            // enter surface into map for this detector
+            _map[ name ].emplace(surf->id(), surf );
 
-	    // enter surface into map for detector type
-	    _map[ types[i] ].insert( std::make_pair( surf->id(), surf )  ) ;
+            // enter surface into map for detector type
+            _map[ types[i] ].emplace(surf->id(), surf );
 
-	    // enter surface into world map 
-	    _map[ "world" ].insert( std::make_pair( surf->id(), surf )  ) ;
+            // enter surface into world map 
+            _map[ "world" ].emplace(surf->id(), surf );
 
-	  }
-	}
+          }
+        }
       }
 
     }
@@ -97,7 +97,7 @@ namespace dd4hep {
  
       for( SurfaceMapsMap::const_iterator mi = _map.begin() ; mi != _map.end() ; ++mi ) {
 	
-	sstr << "  key: " <<  mi->first << " \t number of surfaces : " << mi->second.size() << std::endl ; 
+        sstr << "  key: " <<  mi->first << " \t number of surfaces : " << mi->second.size() << std::endl ; 
       }
       sstr << "---------------------------------------------------------------- " << std::endl ;
 
-- 
GitLab