diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp index 15f1e12a44156c3f5c01e277ebad48f7755abead..73a8293a7f17021d9f5a82e1dbdaf06cb6470581 100644 --- a/DDAlign/src/GlobalDetectorAlignment.cpp +++ b/DDAlign/src/GlobalDetectorAlignment.cpp @@ -103,7 +103,7 @@ namespace { GlobalAlignment _alignment(const GlobalDetectorAlignment& det) { dd4hep::DetElement::Object& e = det._data(); if ( !e.global_alignment.isValid() ) { - std::string path = dd4hep::detail::tools::placementPath(det); + std::string path = dd4hep::detail::tools::placementPath(det); e.global_alignment = dd4hep::Ref_t(new GlobalAlignmentData(path)); } dd4hep::Handle<GlobalAlignmentData> h(e.global_alignment); @@ -142,13 +142,13 @@ namespace { /// Initializing constructor GlobalDetectorAlignment::GlobalDetectorAlignment(DetElement e) - : DetElement(e) + : DetElement(std::move(e)) { } /// Initializing constructor GlobalDetectorAlignment::GlobalDetectorAlignment(DetElement&& e) - : DetElement(e) + : DetElement(std::move(e)) { } diff --git a/DDCore/include/DD4hep/GrammarParsed.h b/DDCore/include/DD4hep/GrammarParsed.h index d74dd6662b801b24c037c8688fe5e833c11d83cc..ea2c5485f0e552819cd37784caeccfd682a8ba8a 100644 --- a/DDCore/include/DD4hep/GrammarParsed.h +++ b/DDCore/include/DD4hep/GrammarParsed.h @@ -59,13 +59,13 @@ namespace dd4hep { TYPE temp; try { #ifdef DD4HEP_DEBUG_PROPERTIES - std::cout << "Parsing " << val << std::endl; + std::cout << "Parsing " << val << std::endl; #endif - sc = ::dd4hep::Parsers::parse(temp, val); - if ( sc ) { - *(TYPE*)ptr = temp; - return true; - } + sc = ::dd4hep::Parsers::parse(temp, val); + if ( sc ) { + *(TYPE*)ptr = std::move(temp); + return true; + } } catch (...) { } @@ -75,12 +75,12 @@ namespace dd4hep { if ( !sc ) sc = gr.evaluate(&temp,val); #ifdef DD4HEP_DEBUG_PROPERTIES std::cout << "Sc=" << sc << " Converting value: " << val - << " to type " << typeid(TYPE).name() - << std::endl; + << " to type " << typeid(TYPE).name() + << std::endl; #endif if ( sc ) { - *(TYPE*)ptr = temp; - return true; + *(TYPE*)ptr = std::move(temp); + return true; } BasicGrammar::invalidConversion(val, typeid(TYPE)); return false; @@ -97,20 +97,20 @@ namespace dd4hep { template <typename T> inline int eval_item(T* ptr, const std::string& val) { /// First try to parse the value with spirit. try { - T temp; - int sc = ::dd4hep::Parsers::parse(temp,val); - if ( sc ) { - *ptr = temp; - return 1; - } + T temp; + int sc = ::dd4hep::Parsers::parse(temp,val); + if ( sc ) { + *ptr = temp; + return 1; + } } catch (...) { } /// If this failed: try to evaluate it with the expression parser auto result = grammar_evaluate_item(val); if (result.first == tools::Evaluator::OK) { - *ptr = (T)result.second; - return 1; + *ptr = (T)result.second; + return 1; } /// This also failed: Return error. return 0; @@ -127,9 +127,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -139,9 +139,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -151,9 +151,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace(val); } return 1; } @@ -163,9 +163,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance<TYPE>(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -175,9 +175,9 @@ namespace dd4hep { std::pair<KEY,TYPE> val; const BasicGrammar& grammar = BasicGrammar::instance<std::pair<KEY,TYPE> >(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace(val); } return 1; } @@ -188,37 +188,37 @@ namespace dd4hep { p->clear(); int sc = Parsers::parse(buff,str); if ( sc ) { - return fill_data(p,buff); + return fill_data(p,buff); } else { - TYPE temp; - std::map<std::string,std::string> map_buff; - // If we get called from python, the values and keys are already in string form - sc = 0; - try { - sc = ::dd4hep::Parsers::parse(map_buff,str); - } - catch(...) { - } - if ( !sc ) { - // Otherwise stringyfy the values - std::string temp_str = grammar_pre_parse_map(str); - try { - sc = ::dd4hep::Parsers::parse(map_buff,temp_str); - } - catch(...) { - } - } - if ( sc ) { - for(const auto& _o : map_buff ) { - typename TYPE::key_type _k {}; - typename TYPE::mapped_type _v {}; - eval_item(&_k, _o.first); - eval_item(&_v, _o.second); - p->emplace(_k,_v); - } - return 1; - } + TYPE temp; + std::map<std::string,std::string> map_buff; + // If we get called from python, the values and keys are already in string form + sc = 0; + try { + sc = ::dd4hep::Parsers::parse(map_buff,str); + } + catch(...) { + } + if ( !sc ) { + // Otherwise stringyfy the values + std::string temp_str = grammar_pre_parse_map(str); + try { + sc = ::dd4hep::Parsers::parse(map_buff,temp_str); + } + catch(...) { + } + } + if ( sc ) { + for(const auto& _o : map_buff ) { + typename TYPE::key_type _k {}; + typename TYPE::mapped_type _v {}; + eval_item(&_k, _o.first); + eval_item(&_v, _o.second); + p->emplace(_k,_v); + } + return 1; + } } return 0; } @@ -228,29 +228,29 @@ namespace dd4hep { std::vector<std::string> buff; int sc = Parsers::parse(buff,str); if ( sc ) { - return fill_data(p,buff); + return fill_data(p,buff); } else { - TYPE temp; - /// First try with the simple object string transformation - std::string temp_str = grammar_pre_parse_obj(str); - sc = ::dd4hep::Parsers::parse(temp,temp_str); - if ( sc ) { - *p = temp; - return 1; - } - /// Now the more complicated one: - temp_str = grammar_pre_parse_cont(str); - sc = ::dd4hep::Parsers::parse(temp,temp_str); - if ( sc ) { - *p = temp; - return 1; - } - buff.clear(); - sc = Parsers::parse(buff,temp_str); - if ( sc ) { - return fill_data(p,buff); - } + TYPE temp; + /// First try with the simple object string transformation + std::string temp_str = grammar_pre_parse_obj(str); + sc = ::dd4hep::Parsers::parse(temp,temp_str); + if ( sc ) { + *p = std::move(temp); + return 1; + } + /// Now the more complicated one: + temp_str = grammar_pre_parse_cont(str); + sc = ::dd4hep::Parsers::parse(temp,temp_str); + if ( sc ) { + *p = std::move(temp); + return 1; + } + buff.clear(); + sc = Parsers::parse(buff,temp_str); + if ( sc ) { + return fill_data(p,buff); + } } return 0; } @@ -291,29 +291,29 @@ namespace dd4hep { #define DD4HEP_PARSER_GRAMMAR_CNAME(serial,name) namespace_dd4hep__grammar_##serial##_##name -#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ - namespace dd4hep { namespace detail { \ - template<> int grammar_eval<xx>(const BasicGrammar&, void* _p, const std::string& _v) {\ - return func ((xx*)_p,_v); \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ + namespace dd4hep { namespace detail { \ + template<> int grammar_eval<xx>(const BasicGrammar&, void* _p, const std::string& _v) { \ + return func ((xx*)_p,_v); \ }}} -#define DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(serial,xx) \ - namespace dd4hep { \ - template class Grammar< xx >; \ - template BasicGrammar const& BasicGrammar::instance< xx >(); \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(serial,xx) \ + namespace dd4hep { \ + template class Grammar< xx >; \ + template BasicGrammar const& BasicGrammar::instance< xx >(); \ template const GrammarRegistry& GrammarRegistry::pre_note<xx>(int); \ - } \ - namespace DD4HEP_PARSER_GRAMMAR_CNAME(serial,0) { \ - static auto s_reg = ::dd4hep::GrammarRegistry::pre_note< xx >(1); \ + } \ + namespace DD4HEP_PARSER_GRAMMAR_CNAME(serial,0) { \ + static auto s_reg = ::dd4hep::GrammarRegistry::pre_note< xx >(1); \ } -#define DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,ctxt,xx,func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,ctxt,xx,func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(DD4HEP_PARSER_GRAMMAR_CNAME(serial,ctxt),xx) #if defined(DD4HEP_HAVE_ALL_PARSERS) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,x,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector<xx>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list<xx>, eval_container) \ @@ -327,18 +327,18 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,11,dd4hep::detail::Primitive<xx>::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,12,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,12,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,13,std::vector<xx>,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,14,std::list<xx>,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) \ DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,unsigned xx,eval_item) #else -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector<xx>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list<xx>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,4,std::set<xx>, eval_container) \ @@ -348,7 +348,7 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,8,dd4hep::detail::Primitive<xx>::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_ROOTMATH(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector<xx>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list<xx>, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,4,std::set<xx>, eval_container) \ @@ -358,11 +358,11 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,8,dd4hep::detail::Primitive<xx>::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,9,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,9,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,10,std::vector<xx>,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,11,std::list<xx>,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) #endif diff --git a/DDCore/include/DD4hep/Path.h b/DDCore/include/DD4hep/Path.h index d5bfd0b03a9be5058efd8b899e5177c71f4f71ef..3b577b49408af9f49012fff47eede408a0ffb8da 100644 --- a/DDCore/include/DD4hep/Path.h +++ b/DDCore/include/DD4hep/Path.h @@ -48,15 +48,17 @@ namespace dd4hep { Path() : std::string() { } /// Initializing constructor Path(const std::string& copy) : std::string(copy) { } + /// Initializing constructor + Path(std::string&& copy) : std::string(std::move(copy)) { } /// Copy constructor Path(const Path& copy) : std::string(copy) { } /// Move constructor - Path(Path&& copy) : std::string(copy) { } + Path(Path&& copy) : std::string(std::move(copy)) { } /// Assigning constructor template <class Iter> Path(Iter _begin,Iter _end) { if ( _begin != _end ) { std::string str(_begin, _end); - this->std::string::operator=(str); + this->std::string::operator=(std::move(str)); } } /// Default destructor @@ -73,12 +75,12 @@ namespace dd4hep { } /// Move assignment operator from Path object Path& operator=(Path&& copy) { - this->std::string::operator=(copy); + this->std::string::operator=(std::move(copy)); return *this; } /// Assignment operator from string object Path& operator=(std::string&& copy) { - this->std::string::operator=(copy); + this->std::string::operator=(std::move(copy)); return *this; } /// Append operation diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index cb0f8b32a11d9b8711c106c451792f497dba7d4c..850be9646415e61ad2c917164728cf56277e77eb 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -152,7 +152,7 @@ namespace dd4hep { /// Direct assignment using the implementation pointer Solid_type(T* p) : Handle<T>(p) { } /// Move Constructor from handle - Solid_type(Handle<T>&& e) : Handle<T>(e) { } + Solid_type(Handle<T>&& e) : Handle<T>(std::move(e)) { } /// Copy Constructor from handle Solid_type(const Handle<T>& e) : Handle<T>(e) { } /// Constructor to be used when passing an already created object: need to check pointers diff --git a/DDCore/include/XML/Helper.h b/DDCore/include/XML/Helper.h index e0960f222f3c17a370614b1845e1bf58e3e12c5d..3a6770f012d619dd8fadc6d8ab42eafd70e472a8 100644 --- a/DDCore/include/XML/Helper.h +++ b/DDCore/include/XML/Helper.h @@ -28,7 +28,7 @@ namespace dd4hep { template <typename T> T getAttrOrDefault(const dd4hep::xml::Element& e, const dd4hep::xml::XmlChar* attr_name, T default_value) { - return (e.hasAttr(attr_name)) ? e.attr<T>(attr_name) : default_value; + return (e.hasAttr(attr_name)) ? e.attr<T>(attr_name) : std::move(default_value); } /// Namespace for implementation details of the AIDA detector description toolkit diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index 2db5332f913cb4f3624f3cb040509c22c70f2190..15e933fd297e6149fd67cf491ebc3e6390a690d8 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -567,7 +567,7 @@ namespace dd4hep { template <> INLINE Attribute Handle_t::attr<Attribute>(const XmlChar* tag_value, Attribute default_value) const { Attribute a = attr_nothrow(tag_value); - return a ? a : default_value; + return a ? a : std::move(default_value); } template <> INLINE bool Handle_t::attr<bool>(const XmlChar* tag_value, bool default_value) const { @@ -607,7 +607,7 @@ namespace dd4hep { template <> INLINE std::string Handle_t::attr<std::string>(const XmlChar* tag_value, std::string default_value) const { Attribute a = attr_nothrow(tag_value); - return a ? _toString(attr_value(a)) : default_value; + return a ? _toString(attr_value(a)) : std::move(default_value); } #if 0 diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp index bee5e7c10b00b5cac04c3bffc21db97fca488b4a..4ba769af91d40a0f152054ca9ef4ba2fe0dead50 100644 --- a/DDCore/src/DetectorTools.cpp +++ b/DDCore/src/DetectorTools.cpp @@ -262,21 +262,21 @@ static void detail::tools::makePlacementPath(PlacementPath det_nodes, PlacementP void detail::tools::placementPath(DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(element,det_nodes); - makePlacementPath(det_nodes, all_nodes); + makePlacementPath(std::move(det_nodes), all_nodes); } /// Collect detector elements placements to the parent detector element [no holes!] void detail::tools::placementPath(DetElement parent, DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(parent,element,det_nodes); - makePlacementPath(det_nodes, all_nodes); + makePlacementPath(std::move(det_nodes), all_nodes); } /// Assemble the path of the PlacedVolume selection std::string detail::tools::placementPath(DetElement element) { PlacementPath path; placementPath(element,path); - return placementPath(path); + return placementPath(std::move(path)); } /// Assemble the path of the PlacedVolume selection diff --git a/DDCore/src/FieldTypes.cpp b/DDCore/src/FieldTypes.cpp index 16b94b58f4cd18493c7f770f8d8b68fe9d49ee69..b5e16a4c8873b259bc2638c2abbcf6262f1c8bc8 100644 --- a/DDCore/src/FieldTypes.cpp +++ b/DDCore/src/FieldTypes.cpp @@ -122,7 +122,7 @@ void MultipoleField::fieldComponents(const double* pos, double* field) { this->transform.GetTranslation(this->translation); } Transform3D::Point p, p0(pos[0],pos[1],pos[2]); - if ( flag&FIELD_IDENTITY ) p = p0; + if ( flag&FIELD_IDENTITY ) p = std::move(p0); else if ( flag&FIELD_POSITION_ONLY ) p = p0 - this->translation; else p = this->inverse * p0; diff --git a/DDCore/src/Path.cpp b/DDCore/src/Path.cpp index b8b2e9b0ecba220426d003db397f6fb5a8d9d8ea..62c363393c41307fe29a9771083378c2ff93a3e3 100644 --- a/DDCore/src/Path.cpp +++ b/DDCore/src/Path.cpp @@ -139,7 +139,7 @@ Path Path::normalize() const { // ignore a name and following ".." if ( temp.empty() && itr_path.find(colon) != std::string::npos ) { - temp = itr_path; + temp = std::move(itr_path); continue; } else if (!temp.empty() diff --git a/DDCore/src/XML/Utilities.cpp b/DDCore/src/XML/Utilities.cpp index 98ae694b7677fa87ec22add2df429400cfefbed5..cf5345b3ee8093fcde0a871c32c7223c5edc88e1 100644 --- a/DDCore/src/XML/Utilities.cpp +++ b/DDCore/src/XML/Utilities.cpp @@ -117,7 +117,7 @@ dd4hep::Volume dd4hep::xml::createStdVolume(Detector& description, xml::Element elt.visStr("").c_str(), elt.regionStr("").c_str(), elt.limitsStr("").c_str()); - elt = x_s; + elt = std::move(x_s); } else if ( elt.hasAttr(_U(type)) ) { typ = elt.typeStr(); diff --git a/DDCore/src/plugins/DetectorCheck.cpp b/DDCore/src/plugins/DetectorCheck.cpp index 53b251e68e1f7da2d52063c0b76f535cb3e8527b..bde6c8d05ea8278a84cd4ce78326526af5cf86f0 100644 --- a/DDCore/src/plugins/DetectorCheck.cpp +++ b/DDCore/src/plugins/DetectorCheck.cpp @@ -203,7 +203,7 @@ void DetectorCheck::execute(DetElement sdet, size_t depth) { } if ( check_volmgr ) { - Chain chain; + Chain chain; PlacedVolume pv = m_det.placement(); VolIDs ids; @@ -219,7 +219,7 @@ void DetectorCheck::execute(DetElement sdet, size_t depth) { } m_sens_counters.reset(); m_current_detector = m_det; - checkManagerVolumeTree(m_det, pv, ids, chain, 1, depth); + checkManagerVolumeTree(m_det, pv, std::move(ids), chain, 1, depth); count_volmgr_place = m_place_counters; count_volmgr_sens = m_sens_counters; total += count_volmgr_place; @@ -623,7 +623,7 @@ void DetectorCheck::checkManagerVolumeTree(DetElement detector, PlacedVolume pv, child_chain.emplace_back(place); child_ids.insert(child_ids.end(), place.volIDs().begin(), place.volIDs().end()); checkManagerSingleVolume(de, place, child_ids, child_chain); - checkManagerVolumeTree(de, place, child_ids, child_chain, depth+1, mx_depth); + checkManagerVolumeTree(de, place, std::move(child_ids), child_chain, depth+1, mx_depth); } } } diff --git a/DDCore/src/plugins/DetectorChecksum.cpp b/DDCore/src/plugins/DetectorChecksum.cpp index 0a3f42f3552f01eb72244388b9adabb222c08ff7..6c2578d9b300f6b2423ee7cdd665fd58da68fa14 100644 --- a/DDCore/src/plugins/DetectorChecksum.cpp +++ b/DDCore/src/plugins/DetectorChecksum.cpp @@ -1472,11 +1472,11 @@ static long create_checksum(Detector& description, int argc, char** argv) { DetectorChecksum wr(description); DetElement de = description.world(); wr.precision = precision; - if ( !len_unit.empty() ) wr.m_len_unit_nam = len_unit; - if ( !ang_unit.empty() ) wr.m_ang_unit_nam = ang_unit; - if ( !ene_unit.empty() ) wr.m_ene_unit_nam = ene_unit; - if ( !dens_unit.empty() ) wr.m_densunit_nam = dens_unit; - if ( !atom_unit.empty() ) wr.m_atomunit_nam = atom_unit; + if ( !len_unit.empty() ) wr.m_len_unit_nam = std::move(len_unit); + if ( !ang_unit.empty() ) wr.m_ang_unit_nam = std::move(ang_unit); + if ( !ene_unit.empty() ) wr.m_ene_unit_nam = std::move(ene_unit); + if ( !dens_unit.empty() ) wr.m_densunit_nam = std::move(dens_unit); + if ( !atom_unit.empty() ) wr.m_atomunit_nam = std::move(atom_unit); if ( newline ) wr.newline = "\n"; wr.have_hash_strings = have_hash_strings; wr.write_files = write_files; diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index 212b1f151ec9574d671b7118f4c22211f2bcf9c4..e9f3c4fffda94c2470b3cf10ae300382c32be2f4 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -714,8 +714,8 @@ static Handle<TObject> create_BooleanShape(Detector&, xml_h element) { xml_comp_t x_shape2( c ) ; // and create solids - Solid solid1( xml_comp_t( x_shape1 ).createShape()) ; - Solid solid2( xml_comp_t( x_shape2 ).createShape()) ; + Solid solid1( xml_comp_t( std::move(x_shape1) ).createShape()) ; + Solid solid2( xml_comp_t( std::move(x_shape2) ).createShape()) ; std::string op = e.attr<std::string>(_U(operation)) ; diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 28a0018d2bff5c29adc005eece2e5fffc961ccbd..3b4fa7c81d65dfda26d8d1f637af7af1e93afd54 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1136,7 +1136,7 @@ static long dump_volume_tree(Detector& description, int argc, char** argv) { std::stringstream log; PlacedVolume pv(ideal); bool sensitive = false; - std::string opt_info, pref = prefix; + std::string opt_info, pref = std::move(prefix); if ( level >= m_printMaxLevel ) { return 1; @@ -1599,7 +1599,7 @@ template <int flag> long dump_detelement_tree(Detector& description, int argc, c IDDescriptor id_descriptor; Actor actor(description); actor.parse_args(argc, argv); - return actor.dump(description.world(), 0, id_descriptor, chain); + return actor.dump(description.world(), 0, id_descriptor, std::move(chain)); } DECLARE_APPLY(DD4hep_DetectorDump,dump_detelement_tree<0>) DECLARE_APPLY(DD4hep_DetectorVolumeDump,dump_detelement_tree<1>) diff --git a/DDDigi/include/DDDigi/DigiContainerProcessor.h b/DDDigi/include/DDDigi/DigiContainerProcessor.h index 9875baa170c37b45c8c64714616bf0b710103a9f..69193d94f0f8aeb30e0d512dcd657621701a4207 100644 --- a/DDDigi/include/DDDigi/DigiContainerProcessor.h +++ b/DDDigi/include/DDDigi/DigiContainerProcessor.h @@ -78,7 +78,7 @@ namespace dd4hep { predicate_t() = default; predicate_t(std::function<bool(const deposit_t&)> func, uint32_t i, const segmentation_t* s) - : callback(func), id(i), segmentation(s) {} + : callback(std::move(func)), id(i), segmentation(s) {} predicate_t(predicate_t&& copy) = default; predicate_t(const predicate_t& copy) = default; predicate_t& operator = (predicate_t&& copy) = default; diff --git a/DDDigi/include/DDDigi/DigiData.h b/DDDigi/include/DDDigi/DigiData.h index 3ec987f15dff063fef764e33db20fa7a602b805b..f0d529f7e628f86e77a9161d8a02264acbae13d9 100644 --- a/DDDigi/include/DDDigi/DigiData.h +++ b/DDDigi/include/DDDigi/DigiData.h @@ -1004,7 +1004,7 @@ namespace dd4hep { template <typename T> bool emplace(Key key, T&& data_item) { key.set_segment(this->id); data_item.key.set_segment(this->id); - return this->emplace_any(key, std::move(data_item)); + return this->emplace_any(std::move(key), std::move(data_item)); } /// Move data items other than std::any to the data segment template <typename DATA> bool put(Key key, DATA&& data); diff --git a/DDDigi/include/DDDigi/DigiROOTInput.h b/DDDigi/include/DDDigi/DigiROOTInput.h index a2e7ed4577c917e714ab6caa787612504d88a881..44a9bc37f644f3e606025b60d32e30b98fc8d133 100644 --- a/DDDigi/include/DDDigi/DigiROOTInput.h +++ b/DDDigi/include/DDDigi/DigiROOTInput.h @@ -50,7 +50,7 @@ namespace dd4hep { Key key; TBranch& branch; TClass& clazz; - container_t(Key k, TBranch& b, TClass& c) : key(k), branch(b), clazz(c) {} + container_t(Key k, TBranch& b, TClass& c) : key(std::move(k)), branch(b), clazz(c) {} }; class work_t { public: diff --git a/DDDigi/io/DigiIO.cpp b/DDDigi/io/DigiIO.cpp index e259a7865b93f3f56fced5bb11410120fc36919c..56bd3a0e4bc275813d5fe4cc1f26a4f32e0c57db 100644 --- a/DDDigi/io/DigiIO.cpp +++ b/DDDigi/io/DigiIO.cpp @@ -474,7 +474,7 @@ namespace dd4hep { const std::vector<sim::Geant4Particle*>& input, ParticleMapping& particles) { - Key mkey = key; + Key mkey = std::move(key); for( auto* part_ptr : input ) { std::shared_ptr<sim::Geant4Particle> p(part_ptr); Particle part; diff --git a/DDDigi/plugins/DigiResegment.cpp b/DDDigi/plugins/DigiResegment.cpp index 31197f16f15e4bb00435bdd6bda225be3e4f560c..81d4f65837e72ff723703d2c3a7ba75ac8d88785 100644 --- a/DDDigi/plugins/DigiResegment.cpp +++ b/DDDigi/plugins/DigiResegment.cpp @@ -131,7 +131,7 @@ namespace dd4hep { ); } EnergyDeposit d(dep.second); - d.position = global; + d.position = std::move(global); d.momentum = dep.second.momentum; m.emplace(new_cell, std::move(d)); } diff --git a/DDDigi/src/DigiData.cpp b/DDDigi/src/DigiData.cpp index 6ed37f59cac8a1a2eae440c71b1c3ca3b5bee26a..20f3afab6bd336981bb14a4be5406cd65fa1d582 100644 --- a/DDDigi/src/DigiData.cpp +++ b/DDDigi/src/DigiData.cpp @@ -96,8 +96,8 @@ const Particle& dd4hep::digi::get_history_particle(const DigiEvent& event, Key h key.set_segment(history_key.segment()); key.set_mask(history_key.mask()); key.set_item(item_key.item()); - const auto& particles = segment.get<ParticleMapping>(key); - return particles.get(history_key); + const auto& particles = segment.get<ParticleMapping>(std::move(key)); + return particles.get(std::move(history_key)); } const EnergyDeposit& dd4hep::digi::get_history_deposit(const DigiEvent& event, Key::itemkey_type container_item, Key history_key) { @@ -106,7 +106,7 @@ const EnergyDeposit& dd4hep::digi::get_history_deposit(const DigiEvent& event, K key.set_segment(history_key.segment()); key.set_item(container_item); key.set_mask(history_key.mask()); - const auto& hits = segment.get<DepositVector>(key); + const auto& hits = segment.get<DepositVector>(std::move(key)); return hits.at(history_key.item()); } @@ -160,8 +160,8 @@ void EnergyDeposit::update_deposit_weighted(const EnergyDeposit& upda) { double err = depositError + upda.depositError; Position pos = ((deposit / sum) * position) + ((upda.deposit / sum) * upda.position); Direction mom = ((deposit / sum) * momentum) + ((upda.deposit / sum) * upda.momentum); - position = pos; - momentum = mom; + position = std::move(pos); + momentum = std::move(mom); deposit = sum; depositError = err; history.update(upda.history); @@ -173,8 +173,8 @@ void EnergyDeposit::update_deposit_weighted(EnergyDeposit&& upda) { double err = depositError + upda.depositError; Position pos = ((deposit / sum) * position) + ((upda.deposit / sum) * upda.position); Direction mom = ((deposit / sum) * momentum) + ((upda.deposit / sum) * upda.momentum); - position = pos; - momentum = mom; + position = std::move(pos); + momentum = std::move(mom); deposit = sum; depositError = err; history.update(std::move(upda.history)); @@ -506,7 +506,7 @@ const std::any* DataSegment::get_item(Key key, bool exc) const { it = this->data.find(key); if (it != this->data.end()) return &it->second; - if ( exc ) throw std::runtime_error(invalid_request(key)); + if ( exc ) throw std::runtime_error(invalid_request(std::move(key))); return nullptr; } diff --git a/DDDigi/src/DigiStoreDump.cpp b/DDDigi/src/DigiStoreDump.cpp index 26b49cdee1fb317ede5e8eff84191478e22e3947..5f7893e1af99a1cf358731441ec9f06dc1112085 100644 --- a/DDDigi/src/DigiStoreDump.cpp +++ b/DDDigi/src/DigiStoreDump.cpp @@ -119,8 +119,8 @@ DigiStoreDump::dump_history(DigiContext& context, str << Key::key_name(container_key) << "[" << seq_no << "]:"; line = format("+----- %-30s Container: Segment:%04X Mask:%04X Item:%08X Cell:%016lX History: Hits:%ld Parts:%ld", - str.str().c_str(), container_key.segment(), container_key.mask(), container_key.item(), - cell, item.history.hits.size(), item.history.particles.size()); + str.str().c_str(), int(container_key.segment()), int(container_key.mask()), int(container_key.item()), + cell, item.history.hits.size(), item.history.particles.size()); records.emplace_back(line); for( std::size_t i=0; i<item.history.hits.size(); ++i ) { const auto& entry = item.history.hits[i]; diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 45ca5ff98718e36686fd7e99254d0dc655c0f9bd..5011528f6f7b3ea2782765465bc8187856a4bf52 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -584,8 +584,8 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { } } #endif - m_equivalentTracks = equivalents; - m_particleMap = finalParticles; + m_equivalentTracks = std::move(equivalents); + m_particleMap = std::move(finalParticles); } /// Default callback to be answered if the particle should be kept if NO user handler is installed