From 94cf8fca1a75ffd951f7b4921f6cee15e94f73cc Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 3 Sep 2020 18:34:52 +0200 Subject: [PATCH] Remove shadow warnings --- DDAlign/src/AlignmentsCalib.cpp | 3 +- DDAlign/src/GlobalAlignmentOperators.cpp | 26 +++---- DDAlign/src/GlobalAlignmentStack.cpp | 6 +- DDCond/src/ConditionsContent.cpp | 4 +- DDCond/src/ConditionsSlice.cpp | 7 +- DDCond/src/Type1/Manager_Type1.cpp | 3 +- .../plugins/ConditionsSnapshotRootLoader.cpp | 8 +-- DDCond/src/plugins/ConditionsUserPool.cpp | 15 ++-- DDCore/src/DD4hepUI.cpp | 6 +- DDCore/src/DetectorData.cpp | 34 ++++----- DDCore/src/DetectorHelper.cpp | 22 +++--- DDCore/src/DetectorTools.cpp | 34 +++++---- DDCore/src/GeoHandler.cpp | 6 +- DDCore/src/GeometryTreeDump.cpp | 58 +++++++-------- DDCore/src/GlobalAlignment.cpp | 16 ++--- DDCore/src/IDDescriptor.cpp | 12 ++-- DDCore/src/Objects.cpp | 48 ++++++------- DDCore/src/OpticalSurfaceManager.cpp | 28 ++++---- DDCore/src/OpticalSurfaces.cpp | 9 ++- DDCore/src/PropertyTable.cpp | 6 +- DDCore/src/SimpleGDMLWriter.cpp | 72 +++++++++---------- DDCore/src/Volumes.cpp | 50 ++++++------- DDEve/lcio/LCIOEventHandler.cpp | 20 +++--- DDEve/src/DD4hepMenu.cpp | 48 ++++++------- DDEve/src/Display.cpp | 18 ++--- DDEve/src/ElementList.cpp | 4 +- DDEve/src/EveUserContextMenu.cpp | 26 +++---- DDEve/src/Utilities.cpp | 34 +++++---- DDEve/src/View.cpp | 8 +-- DDEve/src/ViewMenu.cpp | 8 +-- DDG4/src/Geant4GeometryInfo.cpp | 8 +-- DDG4/src/Geant4HierarchyDump.cpp | 5 +- DDG4/src/Geant4Kernel.cpp | 4 +- DDG4/src/Geant4Mapping.cpp | 5 +- DDG4/src/Geant4ParticleHandler.cpp | 30 ++++---- DDG4/src/Geant4ReadoutVolumeFilter.cpp | 8 +-- DDG4/src/Geant4SensDetAction.cpp | 10 +-- DDG4/src/Geant4VolumeManager.cpp | 14 ++-- .../AlignDet/src/AlignmentExample_nominal.cpp | 4 +- .../src/TestConstantMultiplier.cpp | 2 +- examples/DDCMS/src/DDCMS.cpp | 28 ++++---- examples/DDDB/src/plugins/DDDBPlugins.cpp | 4 +- examples/Persistency/src/PersistencySetup.cpp | 6 +- 43 files changed, 383 insertions(+), 384 deletions(-) diff --git a/DDAlign/src/AlignmentsCalib.cpp b/DDAlign/src/AlignmentsCalib.cpp index 60a6fa36b..aaa01c8e7 100644 --- a/DDAlign/src/AlignmentsCalib.cpp +++ b/DDAlign/src/AlignmentsCalib.cpp @@ -46,7 +46,8 @@ public: }; /// Initializing constructor -AlignmentsCalib::AlignmentsCalib(Detector& l, ConditionsMap& m) : description(l), slice(m) +AlignmentsCalib::AlignmentsCalib(Detector& det, ConditionsMap& cond_map) + : description(det), slice(cond_map) { } diff --git a/DDAlign/src/GlobalAlignmentOperators.cpp b/DDAlign/src/GlobalAlignmentOperators.cpp index 5e64fcd6e..2488f3d75 100644 --- a/DDAlign/src/GlobalAlignmentOperators.cpp +++ b/DDAlign/src/GlobalAlignmentOperators.cpp @@ -79,18 +79,18 @@ template <> void GlobalAlignmentActor<DDAlign_standard_operations::node_reset>:: if ( p->IsAligned() ) { for (Int_t i=0, nLvl=p->GetLevel(); i<=nLvl; i++) { TGeoNode* node = p->GetNode(i); - TGeoMatrix* mm = node->GetMatrix(); // Node's relative matrix + TGeoMatrix* mat = node->GetMatrix(); // Node's relative matrix np += string("/")+node->GetName(); - if ( !mm->IsIdentity() && i > 0 ) { // Ignore the 'world', is identity anyhow + if ( !mat->IsIdentity() && i > 0 ) { // Ignore the 'world', is identity anyhow GlobalAlignment a = cache.get(np); if ( a.isValid() ) { printout(ALWAYS,"GlobalAlignmentActor<reset>","Correct path:%s leaf:%s",p->GetName(),np.c_str()); TGeoHMatrix* glob = p->GetMatrix(i-1); if ( a.isValid() && i!=nLvl ) { - *mm = *(a->GetOriginalMatrix()); + *mat = *(a->GetOriginalMatrix()); } else if ( i==nLvl ) { - TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mm); + TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mat); TGeoMatrix* org = p->GetOriginalMatrix(); if ( hm && org ) { hm->SetTranslation(org->GetTranslation()); @@ -101,7 +101,7 @@ template <> void GlobalAlignmentActor<DDAlign_standard_operations::node_reset>:: "Invalid operation: %p %p", (void*)hm, (void*)org); } } - *glob *= *mm; + *glob *= *mat; } } } @@ -165,38 +165,38 @@ void alignment_reset_dbg(const string& path, const GlobalAlignment& a) { string np; if ( n->IsAligned() ) { for (Int_t i=0; i<=n->GetLevel(); i++) { - TGeoMatrix* mm = n->GetNode(i)->GetMatrix(); + TGeoMatrix* mat = n->GetNode(i)->GetMatrix(); np += "/"; np += n->GetNode(i)->GetName(); - if ( mm->IsIdentity() ) continue; + if ( mat->IsIdentity() ) continue; if ( i == 0 ) continue; TGeoHMatrix* glob = n->GetMatrix(i-1); NodeMap::const_iterator j=original_matrices.find(np); if ( j != original_matrices.end() && i!=n->GetLevel() ) { cout << " +++++ Patch Level: " << i << np << endl; - *mm = *((*j).second); + *mat = *((*j).second); } else { if ( i==n->GetLevel() ) { cout << " +++++ Level: " << i << np << " --- Original matrix: " << endl; n->GetOriginalMatrix()->Print(); cout << " +++++ Level: " << i << np << " --- Local matrix: " << endl; - mm->Print(); - TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mm); + mat->Print(); + TGeoHMatrix* hm = dynamic_cast<TGeoHMatrix*>(mat); hm->SetTranslation(n->GetOriginalMatrix()->GetTranslation()); hm->SetRotation(n->GetOriginalMatrix()->GetRotationMatrix()); cout << " +++++ Level: " << i << np << " --- New local matrix" << endl; - mm->Print(); + mat->Print(); } else { cout << " +++++ Level: " << i << np << " --- Keep matrix " << endl; - mm->Print(); + mat->Print(); } } cout << " +++++ Level: " << i << np << " --- Global matrix: " << endl; glob->Print(); - *glob *= *mm; + *glob *= *mat; cout << " +++++ Level: " << i << np << " --- New global matrix: " << endl; glob->Print(); } diff --git a/DDAlign/src/GlobalAlignmentStack.cpp b/DDAlign/src/GlobalAlignmentStack.cpp index 292594bf5..5b88c51de 100644 --- a/DDAlign/src/GlobalAlignmentStack.cpp +++ b/DDAlign/src/GlobalAlignmentStack.cpp @@ -27,9 +27,9 @@ static dd4hep_ptr<GlobalAlignmentStack>& _stack() { return s; } static dd4hep_ptr<GlobalAlignmentStack>& _stack(GlobalAlignmentStack* obj) { - dd4hep_ptr<GlobalAlignmentStack>& s = _stack(); - s.adopt(obj); - return s; + dd4hep_ptr<GlobalAlignmentStack>& stk = _stack(); + stk.adopt(obj); + return stk; } /// Constructor with partial initialization diff --git a/DDCond/src/ConditionsContent.cpp b/DDCond/src/ConditionsContent.cpp index c83a276b3..3e15a1d9f 100644 --- a/DDCond/src/ConditionsContent.cpp +++ b/DDCond/src/ConditionsContent.cpp @@ -125,7 +125,7 @@ ConditionsContent::addDependency(ConditionDependency* dep) dep->addRef(); return *(ret.first); } - ConditionKey::KeyMaker km(dep->target.hash); + ConditionKey::KeyMaker maker(dep->target.hash); #if defined(DD4HEP_CONDITIONS_DEBUG) DetElement de(dep->detector); const char* path = de.isValid() ? de.path().c_str() : "(global)"; @@ -135,7 +135,7 @@ ConditionsContent::addDependency(ConditionDependency* dep) dep->release(); except("DeConditionsRequests", "++ Dependency already exists: %s [%08X] [%016llX]", - path, km.values.item_key, km.hash); + path, maker.values.item_key, maker.hash); return pair<Condition::key_type, ConditionDependency*>(0,0); } diff --git a/DDCond/src/ConditionsSlice.cpp b/DDCond/src/ConditionsSlice.cpp index 4dc18ff4d..f342cab19 100644 --- a/DDCond/src/ConditionsSlice.cpp +++ b/DDCond/src/ConditionsSlice.cpp @@ -22,14 +22,15 @@ using namespace dd4hep; using namespace dd4hep::cond; /// Initializing constructor -ConditionsSlice::ConditionsSlice(ConditionsManager m) : manager(m) +ConditionsSlice::ConditionsSlice(ConditionsManager mgr) : manager(mgr) { InstanceCount::increment(this); } /// Initializing constructor -ConditionsSlice::ConditionsSlice(ConditionsManager m, const shared_ptr<ConditionsContent>& c) - : manager(m), content(c) +ConditionsSlice::ConditionsSlice(ConditionsManager mgr, + const shared_ptr<ConditionsContent>& cont) + : manager(mgr), content(cont) { InstanceCount::increment(this); } diff --git a/DDCond/src/Type1/Manager_Type1.cpp b/DDCond/src/Type1/Manager_Type1.cpp index c3ae16fe8..f61056e58 100644 --- a/DDCond/src/Type1/Manager_Type1.cpp +++ b/DDCond/src/Type1/Manager_Type1.cpp @@ -290,7 +290,6 @@ size_t Manager_Type1::blockRegister(ConditionsPool& pool, const vector<Condition Condition Manager_Type1::__queue_update(cond::Entry* e) { if ( e ) { ConditionsPool* p = this->ConditionsManagerObject::registerIOV(e->validity); - ConditionKey::KeyMaker m(e->detector,e->name); Condition condition(e->name,e->type); Condition::Object* c = condition.ptr(); c->value = e->value; @@ -300,7 +299,7 @@ Condition Manager_Type1::__queue_update(cond::Entry* e) { c->validity = e->validity; #endif c->iov = p->iov; - c->hash = m.hash; + c->hash = ConditionKey::KeyMaker(e->detector,e->name).hash; p->insert(c); if ( s_debug > INFO ) { #if defined(DD4HEP_MINIMAL_CONDITIONS) diff --git a/DDCond/src/plugins/ConditionsSnapshotRootLoader.cpp b/DDCond/src/plugins/ConditionsSnapshotRootLoader.cpp index 4289fa20b..1c4425987 100644 --- a/DDCond/src/plugins/ConditionsSnapshotRootLoader.cpp +++ b/DDCond/src/plugins/ConditionsSnapshotRootLoader.cpp @@ -109,8 +109,8 @@ size_t ConditionsSnapshotRootLoader::load_single(key_type /* key */, RangeConditions& conditions) { size_t len = conditions.size(); - for(const auto& s : m_sources ) - load_source(s.first); + for(const auto& src : m_sources ) + load_source(src.first); m_sources.clear(); return conditions.size()-len; @@ -121,8 +121,8 @@ size_t ConditionsSnapshotRootLoader::load_range(key_type /* key */, RangeConditions& conditions) { size_t len = conditions.size(); - for(const auto& s : m_sources ) - load_source(s.first); + for(const auto& src : m_sources ) + load_source(src.first); m_sources.clear(); return conditions.size()-len; } diff --git a/DDCond/src/plugins/ConditionsUserPool.cpp b/DDCond/src/plugins/ConditionsUserPool.cpp index 68e206198..8d91dfad8 100644 --- a/DDCond/src/plugins/ConditionsUserPool.cpp +++ b/DDCond/src/plugins/ConditionsUserPool.cpp @@ -358,16 +358,14 @@ template<typename MAPPING> bool ConditionsMappedUserPool<MAPPING>::insert(DetElement detector, unsigned int item_key, Condition cond) { - ConditionKey::KeyMaker m(detector.key(),item_key); - cond->hash = m.hash; + cond->hash = ConditionKey::KeyMaker(detector.key(),item_key).hash; return insert(cond); } /// ConditionsMap overload: Access a condition template<typename MAPPING> Condition ConditionsMappedUserPool<MAPPING>::get(DetElement detector, unsigned int item_key) const { - ConditionKey::KeyMaker m(detector.key(), item_key); - return get(m.hash); + return get(ConditionKey::KeyMaker(detector.key(), item_key).hash); } /// No ConditionsMap overload: Access all conditions within a key range in the interval [lower,upper] @@ -472,8 +470,8 @@ size_t ConditionsMappedUserPool<MAPPING>::compute(const Dependencies& deps, missing.emplace(i); } if ( !missing.empty() ) { - ConditionsManagerObject* m(m_manager.access()); - ConditionsDependencyHandler handler(m, *this, missing, user_param); + ConditionsManagerObject* mgr(m_manager.access()); + ConditionsDependencyHandler handler(mgr, *this, missing, user_param); /// 1rst pass: Compute/create the missing condiions handler.compute(); /// 2nd pass: Resolve missing dependencies @@ -560,7 +558,6 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, if ( num_cond_miss > 0 ) { if ( do_load ) { ConditionsDataLoader::LoadedItems loaded; - //size_t updates = m_loader->load_many(required, cond_missing, loaded, pool_iov); size_t updates = m_loader->load_many(required, cond_missing, loaded, pool_iov); if ( updates > 0 ) { // Need to compute the intersection: All missing entries are required.... @@ -575,8 +572,8 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, num_load_miss, loaded.size()); if ( do_output_miss ) { copy(begin(load_missing), load_last, inserter(slice_miss_cond, slice_miss_cond.begin())); - for ( const auto& m : slice_miss_cond ) { - printout (ERROR, "TEST", "Unloaded: %s",m.second->toString().c_str()); + for ( const auto& missing : slice_miss_cond ) { + printout (ERROR, "TEST", "Unloaded: %s",missing.second->toString().c_str()); } } for_each(loaded.begin(),loaded.end(),Inserter<MAPPING>(m_conditions,&m_iov)); diff --git a/DDCore/src/DD4hepUI.cpp b/DDCore/src/DD4hepUI.cpp index 1b2c996b0..bd58a2fce 100644 --- a/DDCore/src/DD4hepUI.cpp +++ b/DDCore/src/DD4hepUI.cpp @@ -118,13 +118,15 @@ void DD4hepUI::redraw() const { /// Detector interface: Draw detector sub-tree the scene on a OpenGL pane void DD4hepUI::drawSubtree(const char* path) const { - const void* av[] = {"-detector", path, "-option", "ogl", "-level", _visLevel(visLevel).c_str(), 0}; + string vis = _visLevel(visLevel); + const void* av[] = {"-detector", path, "-option", "ogl", "-level", vis.c_str(), 0}; m_detDesc.apply("DD4hep_GeometryDisplay", 2, (char**)av); } /// Detector interface: Re-draw the entire sub-tree scene void DD4hepUI::redrawSubtree(const char* path) const { - const void* av[] = {"-detector", path, "-option", "oglsame", "-level", _visLevel(visLevel).c_str(), 0}; + string vis = _visLevel(visLevel); + const void* av[] = {"-detector", path, "-option", "oglsame", "-level", vis.c_str(), 0}; m_detDesc.apply("DD4hep_GeometryDisplay", 4, (char**)av); } diff --git a/DDCore/src/DetectorData.cpp b/DDCore/src/DetectorData.cpp index 348fb626b..3c8e143ec 100644 --- a/DDCore/src/DetectorData.cpp +++ b/DDCore/src/DetectorData.cpp @@ -114,10 +114,10 @@ namespace { //printout(INFO,"OpaqueData"," Data type:%s [%016llX]",gr.name.c_str(),key); void* ptr = block->ptr(); if ( !ptr ) { // Some blocks are already bound. Skip those. - if ( !gr.specialization.bind ) { - except("stream_opaque_datablock","Object cannot be handled by ROOT persistency. " - "Grammar %s does not allow for ROOT persistency.",gr.type_name().c_str()); - } + if ( !gr.specialization.bind ) { + except("stream_opaque_datablock","Object cannot be handled by ROOT persistency. " + "Grammar %s does not allow for ROOT persistency.",gr.type_name().c_str()); + } ptr = block->bind(&gr); gr.specialization.bind(ptr); } @@ -183,24 +183,24 @@ DetectorData::~DetectorData() { /// Patch the ROOT streamers to adapt for DD4hep void DetectorData::patchRootStreamer(TClass* cl) { - TDataMember* m = 0; + TDataMember* dm = 0; printout(INFO,"PersistencyIO", "+++ Set data member %s.fUserExtension as PERSISTENT.", cl->GetName()); - m = cl->GetDataMember("fUserExtension"); - m->SetTitle(m->GetTitle()+2); - m->SetBit(BIT(2)); + dm = cl->GetDataMember("fUserExtension"); + dm->SetTitle(dm->GetTitle()+2); + dm->SetBit(BIT(2)); } /// UNPatch the ROOT streamers to adapt for DD4hep void DetectorData::unpatchRootStreamer(TClass* cl) { - TDataMember* m = 0; + TDataMember* dm = 0; printout(INFO,"PersistencyIO", "+++ Set data member %s.fUserExtension as TRANSIENT.", cl->GetName()); - m = cl->GetDataMember("fUserExtension"); - m->SetTitle((std::string("! ")+m->GetTitle()).c_str()); - m->ResetBit(BIT(2)); + dm = cl->GetDataMember("fUserExtension"); + dm->SetTitle((std::string("! ")+dm->GetTitle()).c_str()); + dm->ResetBit(BIT(2)); } /// Clear data content: releases all allocated resources @@ -220,11 +220,11 @@ void DetectorData::destroyData(bool destroy_mgr) { destroyHandles(m_fields); destroyHandles(m_define); #if 0 - for(const auto& d : m_define) { - auto c = d; - std::cout << "Delete " << d.first << std::endl; - //if ( d.first == "world_side" ) continue; - delete d.second.ptr(); + for(const auto& def : m_define) { + auto c = def; + std::cout << "Delete " << def.first << std::endl; + //if ( def.first == "world_side" ) continue; + delete def.second.ptr(); } #endif destroyHandle(m_volManager); diff --git a/DDCore/src/DetectorHelper.cpp b/DDCore/src/DetectorHelper.cpp index c1db30a24..a9bce443c 100644 --- a/DDCore/src/DetectorHelper.cpp +++ b/DDCore/src/DetectorHelper.cpp @@ -47,9 +47,9 @@ SensitiveDetector DetectorHelper::sensitiveDetector(DetElement detector) const /// Find a detector element by it's system ID DetElement DetectorHelper::detectorByID(int id) const { - const Detector::HandleMap& dets = ptr()->detectors(); - for(const auto& i : dets ) { - DetElement de(i.second); + const Detector::HandleMap& detectors = ptr()->detectors(); + for(const auto& det : detectors ) { + DetElement de(det.second); if ( de.id() == id ) return de; } return DetElement(); @@ -79,19 +79,19 @@ Atom DetectorHelper::element(const std::string& nam) const { /// Access a material from the material table by name Material DetectorHelper::material(const std::string& nam) const { TGeoManager& mgr = access()->manager(); - TGeoMedium* m = mgr.GetMedium(nam.c_str()); - if ( !m ) { + TGeoMedium* med = mgr.GetMedium(nam.c_str()); + if ( !med ) { string n = nam; transform(n.begin(), n.end(), n.begin(), ::toupper); - m = mgr.GetMedium(n.c_str()); // Check for IRON - if ( !m ) { + med = mgr.GetMedium(n.c_str()); // Check for IRON + if ( !med ) { transform(n.begin(), n.end(), n.begin(), ::tolower); - m = mgr.GetMedium(n.c_str()); // Check for iron - if ( !m ) { + med = mgr.GetMedium(n.c_str()); // Check for iron + if ( !med ) { n[0] = ::toupper(n[0]); - m = mgr.GetMedium(n.c_str()); // Check for Iron + med = mgr.GetMedium(n.c_str()); // Check for Iron } } } - return m; + return med; } diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp index 0626e6a3f..6c4eaad30 100644 --- a/DDCore/src/DetectorTools.cpp +++ b/DDCore/src/DetectorTools.cpp @@ -178,30 +178,30 @@ void detail::tools::elementPath(DetElement element, PlacementPath& det_nodes) { /// Assemble the path of the PlacedVolume selection string detail::tools::elementPath(const PlacementPath& nodes, bool reverse) { - string s = ""; + string path = ""; if ( reverse ) { for(auto i=nodes.rbegin(); i != nodes.rend(); ++i) - s += "/" + string((*i).name()); + path += "/" + string((*i).name()); } else { for(auto i=begin(nodes); i != end(nodes); ++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } - return s; + return path; } /// Assemble the path of the PlacedVolume selection string detail::tools::elementPath(const ElementPath& nodes, bool reverse) { - string s = ""; + string path = ""; if ( reverse ) { for(ElementPath::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } else { for(ElementPath::const_iterator i=nodes.begin();i!=nodes.end();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } - return s; + return path; } /// Assemble the path of a particular detector element @@ -282,30 +282,30 @@ string detail::tools::placementPath(DetElement element) { /// Assemble the path of the PlacedVolume selection string detail::tools::placementPath(const PlacementPath& nodes, bool reverse) { - string s=""; + string path = ""; if ( reverse ) { for(PlacementPath::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } else { for(PlacementPath::const_iterator i=nodes.begin();i!=nodes.end();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } - return s; + return path; } /// Assemble the path of the PlacedVolume selection string detail::tools::placementPath(const vector<const TGeoNode*>& nodes, bool reverse) { - string s=""; + string path = ""; if ( reverse ) { for(vector<const TGeoNode*>::const_reverse_iterator i=nodes.rbegin();i!=nodes.rend();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } else { for(vector<const TGeoNode*>::const_iterator i=nodes.begin();i!=nodes.end();++i) - s += "/" + string((*i)->GetName()); + path += "/" + string((*i)->GetName()); } - return s; + return path; } /// Update cached matrix to transform to positions to an upper level Placement @@ -411,5 +411,3 @@ vector<string> detail::tools::pathElements(const string& path) { } return result; } - - diff --git a/DDCore/src/GeoHandler.cpp b/DDCore/src/GeoHandler.cpp index d5785b506..6b4aae5c5 100644 --- a/DDCore/src/GeoHandler.cpp +++ b/DDCore/src/GeoHandler.cpp @@ -89,15 +89,15 @@ GeoHandler& GeoHandler::collect(DetElement element, GeometryInfo& info) { for (const TGeoNode* n : mapped ) { TGeoVolume* v = n->GetVolume(); if (v) { - Material m(v->GetMedium()); + Material mat(v->GetMedium()); 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.emplace(vol); info.volumes.emplace_back(vol); } - if (m.isValid()) - info.materials.emplace(m); + if ( mat.isValid() ) + info.materials.emplace(mat); if (dynamic_cast<Volume::Object*>(v)) { VisAttr vis = vol.visAttributes(); //Region reg = vol.region(); diff --git a/DDCore/src/GeometryTreeDump.cpp b/DDCore/src/GeometryTreeDump.cpp index fb039710b..43ae6f8be 100644 --- a/DDCore/src/GeometryTreeDump.cpp +++ b/DDCore/src/GeometryTreeDump.cpp @@ -83,7 +83,7 @@ void* GeometryTreeDump::handleVolume(const string& name, Volume vol) const { if (num > 0) { for (int i = 0; i < num; ++i) { //TGeoNode* n = volume->GetNode(i); - TGeoNode* n = vol.ptr()->GetNode(vol->GetNode(i)->GetName()); + TGeoNode* n = vol.ptr()->GetNode(vol->GetNode(i)->GetName()); TGeoVolume* v = n->GetVolume(); TGeoMatrix* m = n->GetMatrix(); m_output << "\t\t\t<physvol>" << endl; @@ -107,55 +107,55 @@ void* GeometryTreeDump::handleVolume(const string& name, Volume vol) const { void* GeometryTreeDump::handleSolid(const string& name, const TGeoShape* shape) const { if (shape) { if (shape->IsA() == TGeoBBox::Class()) { - const TGeoBBox* s = (const TGeoBBox*) shape; - m_output << "\t\t<box name=\"" << name << "_shape\" x=\"" << s->GetDX() << "\" y=\"" << s->GetDY() << "\" z=\"" - << s->GetDZ() << "\" lunit=\"cm\"/>" << endl; + const TGeoBBox* sh = (const TGeoBBox*) shape; + m_output << "\t\t<box name=\"" << name << "_shape\" x=\"" << sh->GetDX() << "\" y=\"" << sh->GetDY() << "\" z=\"" + << sh->GetDZ() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTube::Class()) { - const TGeoTube* s = (const TGeoTube*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << s->GetRmin() << "\" rmax=\"" << s->GetRmax() << "\" z=\"" - << s->GetDz() << "\" startphi=\"0.0\" deltaphi=\"360.0\" aunit=\"deg\" lunit=\"cm\"/>" << endl; + const TGeoTube* sh = (const TGeoTube*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << sh->GetRmin() << "\" rmax=\"" << sh->GetRmax() << "\" z=\"" + << sh->GetDz() << "\" startphi=\"0.0\" deltaphi=\"360.0\" aunit=\"deg\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTubeSeg::Class()) { - const TGeoTubeSeg* s = (const TGeoTubeSeg*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << s->GetRmin() << "\" rmax=\"" << s->GetRmax() << "\" z=\"" - << s->GetDz() << "\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetPhi2() + const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << sh->GetRmin() << "\" rmax=\"" << sh->GetRmax() << "\" z=\"" + << sh->GetDz() << "\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetPhi2() << "\" aunit=\"deg\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTrd1::Class()) { - const TGeoTrd1* s = (const TGeoTrd1*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << s->GetDx1() << "\" x2=\"" << s->GetDx2() << "\" y1=\"" - << s->GetDy() << "\" y2=\"" << s->GetDy() << "\" z=\"" << s->GetDz() << "\" lunit=\"cm\"/>" << endl; + const TGeoTrd1* sh = (const TGeoTrd1*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << sh->GetDx1() << "\" x2=\"" << sh->GetDx2() << "\" y1=\"" + << sh->GetDy() << "\" y2=\"" << sh->GetDy() << "\" z=\"" << sh->GetDz() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTrd2::Class()) { - const TGeoTrd2* s = (const TGeoTrd2*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << s->GetDx1() << "\" x2=\"" << s->GetDx2() << "\" y1=\"" - << s->GetDy1() << "\" y2=\"" << s->GetDy2() << "\" z=\"" << s->GetDz() << "\" lunit=\"cm\"/>" << endl; + const TGeoTrd2* sh = (const TGeoTrd2*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << sh->GetDx1() << "\" x2=\"" << sh->GetDx2() << "\" y1=\"" + << sh->GetDy1() << "\" y2=\"" << sh->GetDy2() << "\" z=\"" << sh->GetDz() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoPgon::Class()) { - const TGeoPgon* s = (const TGeoPgon*) shape; - m_output << "\t\t<polyhedra name=\"" << name << "_shape\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetDphi() - << "\" numsides=\"" << s->GetNedges() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; - for (int i = 0; i < s->GetNz(); ++i) { - m_output << "\t\t\t<zplane z=\"" << s->GetZ(i) << "\" rmin=\"" << s->GetRmin(i) << "\" rmax=\"" << s->GetRmax(i) + const TGeoPgon* sh = (const TGeoPgon*) shape; + m_output << "\t\t<polyhedra name=\"" << name << "_shape\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetDphi() + << "\" numsides=\"" << sh->GetNedges() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; + for (int i = 0; i < sh->GetNz(); ++i) { + m_output << "\t\t\t<zplane z=\"" << sh->GetZ(i) << "\" rmin=\"" << sh->GetRmin(i) << "\" rmax=\"" << sh->GetRmax(i) << "\" lunit=\"cm\"/>" << endl; } m_output << "\t\t</polyhedra>" << endl; } else if (shape->IsA() == TGeoPcon::Class()) { - const TGeoPcon* s = (const TGeoPcon*) shape; - m_output << "\t\t<polycone name=\"" << name << "_shape\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetDphi() + const TGeoPcon* sh = (const TGeoPcon*) shape; + m_output << "\t\t<polycone name=\"" << name << "_shape\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetDphi() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; - for (int i = 0; i < s->GetNz(); ++i) { - m_output << "\t\t\t<zplane z=\"" << s->GetZ(i) << "\" rmin=\"" << s->GetRmin(i) << "\" rmax=\"" << s->GetRmax(i) + for (int i = 0; i < sh->GetNz(); ++i) { + m_output << "\t\t\t<zplane z=\"" << sh->GetZ(i) << "\" rmin=\"" << sh->GetRmin(i) << "\" rmax=\"" << sh->GetRmax(i) << "\" lunit=\"cm\"/>" << endl; } m_output << "\t\t</polycone>" << endl; } else if (shape->IsA() == TGeoCompositeShape::Class()) { string nn = name; - const TGeoCompositeShape* s = (const TGeoCompositeShape*) shape; - const TGeoBoolNode* boolean = s->GetBoolNode(); + const TGeoCompositeShape* sh = (const TGeoCompositeShape*) shape; + const TGeoBoolNode* boolean = sh->GetBoolNode(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); handleSolid(name + "_left", boolean->GetLeftShape()); @@ -230,8 +230,8 @@ void GeometryTreeDump::handleTransformations(const std::vector<std::pair<std::st /// Dump all solids in GDML format to output stream void GeometryTreeDump::handleSolids(const std::set<TGeoShape*>& solids) const { m_output << "\t<solids>" << endl; - for (const auto s : solids ) - handleSolid(s->GetName(), s); + for (const auto sh : solids ) + handleSolid(sh->GetName(), sh); m_output << "\t</solids>" << endl; } diff --git a/DDCore/src/GlobalAlignment.cpp b/DDCore/src/GlobalAlignment.cpp index 3daa25836..75b480414 100644 --- a/DDCore/src/GlobalAlignment.cpp +++ b/DDCore/src/GlobalAlignment.cpp @@ -92,8 +92,8 @@ Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const Position GlobalAlignment::globalToLocal(const Position& globalPoint, int level) const { CheckHandle verify_handle(*this); Position result; - TGeoHMatrix* m = ptr()->GetMatrix(level); - m->MasterToLocal((Double_t*)&globalPoint,(Double_t*)&result); + TGeoHMatrix* matrix = ptr()->GetMatrix(level); + matrix->MasterToLocal((Double_t*)&globalPoint,(Double_t*)&result); return result; } @@ -115,9 +115,9 @@ Transform3D GlobalAlignment::delta() const { CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); // T = T_0 * Delta -> Delta = T_0^-1 * T - TGeoHMatrix mat(n->GetOriginalMatrix()->Inverse()); - mat.Multiply(n->GetNode()->GetMatrix()); - return detail::matrix::_transform(&mat); + TGeoHMatrix matrix(n->GetOriginalMatrix()->Inverse()); + matrix.Multiply(n->GetNode()->GetMatrix()); + return detail::matrix::_transform(&matrix); } /// Access the inverse of the currently applied correction matrix (delta) (mother to daughter) @@ -126,7 +126,7 @@ Transform3D GlobalAlignment::invDelta() const { CheckHandle verify_handle(*this); TGeoPhysicalNode* n = ptr(); // T = T_0 * Delta -> Delta^-1 = T^-1 * T_0 - TGeoHMatrix mat(n->GetNode()->GetMatrix()->Inverse()); - mat.Multiply(n->GetOriginalMatrix()); - return detail::matrix::_transform(&mat); + TGeoHMatrix matrix(n->GetNode()->GetMatrix()->Inverse()); + matrix.Multiply(n->GetOriginalMatrix()); + return detail::matrix::_transform(&matrix); } diff --git a/DDCore/src/IDDescriptor.cpp b/DDCore/src/IDDescriptor.cpp index 75ad66f06..7014fd44b 100644 --- a/DDCore/src/IDDescriptor.cpp +++ b/DDCore/src/IDDescriptor.cpp @@ -90,8 +90,8 @@ const IDDescriptor::FieldMap& IDDescriptor::fields() const { /// Get the field descriptor of one field by name const BitFieldElement* IDDescriptor::field(const string& field_name) const { - const FieldMap& m = fields(); // This already checks the object validity - for (const auto& i : m ) + const FieldMap& fm = fields(); // This already checks the object validity + for (const auto& i : fm ) if (i.first == field_name) return i.second; except("IDDescriptor","dd4hep: %s: This ID descriptor has no field with the name: %s", @@ -101,14 +101,14 @@ const BitFieldElement* IDDescriptor::field(const string& field_name) const { /// Get the field descriptor of one field by its identifier const BitFieldElement* IDDescriptor::field(size_t identifier) const { - const FieldMap& m = fields(); // This already checks the object validity - return m[identifier].second; + const FieldMap& fm = fields(); // This already checks the object validity + return fm[identifier].second; } /// Get the field identifier of one field by name size_t IDDescriptor::fieldID(const string& field_name) const { - const FieldIDs& m = ids(); // This already checks the object validity - for (const auto& i : m ) + const FieldIDs& fm = ids(); // This already checks the object validity + for (const auto& i : fm ) if (i.second == field_name) return i.first; except("IDDescriptor","dd4hep: %s: This ID descriptor has no field with the name: %s", diff --git a/DDCore/src/Objects.cpp b/DDCore/src/Objects.cpp index c115f074e..f6880561d 100644 --- a/DDCore/src/Objects.cpp +++ b/DDCore/src/Objects.cpp @@ -165,7 +165,7 @@ string Constant::toString() const { /// Constructor to be used when creating a new DOM tree Atom::Atom(const string& nam, const string& formula, int Z, int N, double density) { TGeoElementTable* t = TGeoElement::GetElementTable(); - TGeoElement* e = t->FindElement(nam.c_str()); + TGeoElement* e = t->FindElement(nam.c_str()); if (!e) { t->AddElement(nam.c_str(), formula.c_str(), Z, N, density); e = t->FindElement(nam.c_str()); @@ -177,9 +177,9 @@ Atom::Atom(const string& nam, const string& formula, int Z, int N, double densit double Material::Z() const { Handle < TGeoMedium > val(*this); if (val.isValid()) { - TGeoMaterial* m = val->GetMaterial(); - if (m) - return m->GetZ(); + TGeoMaterial* mat = val->GetMaterial(); + if ( mat ) + return mat->GetZ(); throw runtime_error("dd4hep: The medium " + string(val->GetName()) + " has an invalid material reference!"); } throw runtime_error("dd4hep: Attempt to access proton number from invalid material handle!"); @@ -188,9 +188,9 @@ double Material::Z() const { /// atomic number of the underlying material double Material::A() const { if ( isValid() ) { - TGeoMaterial* m = ptr()->GetMaterial(); - if (m) - return m->GetA(); + TGeoMaterial* mat = ptr()->GetMaterial(); + if ( mat ) + return mat->GetA(); throw runtime_error("dd4hep: The medium " + string(ptr()->GetName()) + " has an invalid material reference!"); } throw runtime_error("dd4hep: Attempt to access atomic number from invalid material handle!"); @@ -199,9 +199,9 @@ double Material::A() const { /// density of the underlying material double Material::density() const { if ( isValid() ) { - TGeoMaterial* m = ptr()->GetMaterial(); - if (m) - return m->GetDensity(); + TGeoMaterial* mat = ptr()->GetMaterial(); + if ( mat ) + return mat->GetDensity(); throw runtime_error("dd4hep: The medium " + string(ptr()->GetName()) + " has an invalid material reference!"); } throw runtime_error("dd4hep: Attempt to access density from invalid material handle!"); @@ -210,9 +210,9 @@ double Material::density() const { /// Access the radiation length of the underlying material double Material::radLength() const { if ( isValid() ) { - TGeoMaterial* m = ptr()->GetMaterial(); - if (m) - return m->GetRadLen(); + TGeoMaterial* mat = ptr()->GetMaterial(); + if ( mat ) + return mat->GetRadLen(); throw runtime_error("dd4hep: The medium " + string(ptr()->GetName()) + " has an invalid material reference!"); } throw runtime_error("dd4hep: Attempt to access radiation length from invalid material handle!"); @@ -221,9 +221,9 @@ double Material::radLength() const { /// Access the radiation length of the underlying material double Material::intLength() const { if ( isValid() ) { - TGeoMaterial* m = ptr()->GetMaterial(); - if (m) - return m->GetIntLen(); + TGeoMaterial* mat = ptr()->GetMaterial(); + if ( mat ) + return mat->GetIntLen(); throw runtime_error("The medium " + string(ptr()->GetName()) + " has an invalid material reference!"); } throw runtime_error("Attempt to access interaction length from invalid material handle!"); @@ -232,20 +232,20 @@ double Material::intLength() const { /// Access the fraction of an element within the material double Material::fraction(Atom atom) const { double frac = 0e0, tot = 0e0; - TGeoElement* elt = atom.access(); - TGeoMaterial* m = access()->GetMaterial(); - for ( int i=0, n=m->GetNelements(); i<n; ++i ) { - TGeoElement* e = m->GetElement(i); - if ( m->IsMixture() ) { - TGeoMixture* mix = (TGeoMixture*)m; + TGeoElement* elt = atom.access(); + TGeoMaterial* mat = access()->GetMaterial(); + for ( int i=0, n=mat->GetNelements(); i<n; ++i ) { + TGeoElement* e = mat->GetElement(i); + if ( mat->IsMixture() ) { + TGeoMixture* mix = (TGeoMixture*)mat; tot += mix->GetWmixt()[i]; } else { tot = 1e0; } if ( e == elt ) { - if ( m->IsMixture() ) { - TGeoMixture* mix = (TGeoMixture*)m; + if ( mat->IsMixture() ) { + TGeoMixture* mix = (TGeoMixture*)mat; frac += mix->GetWmixt()[i]; } else { diff --git a/DDCore/src/OpticalSurfaceManager.cpp b/DDCore/src/OpticalSurfaceManager.cpp index e78446877..d991f4e97 100644 --- a/DDCore/src/OpticalSurfaceManager.cpp +++ b/DDCore/src/OpticalSurfaceManager.cpp @@ -123,27 +123,25 @@ void OpticalSurfaceManager::addOpticalSurface(OpticalSurface surf) const { void OpticalSurfaceManager::registerSurfaces(DetElement subdetector) { Object* o = access(); unique_ptr<Object> extension(new Object(o->detector)); - for(auto& s : o->opticalSurfaces) { - //string n = s.first.first.path() + '#' + s.first.second; - //s.second->SetName(n.c_str()); - o->detector.manager().AddOpticalSurface(s.second.ptr()); - extension->opticalSurfaces.insert(s); + for(auto& optical : o->opticalSurfaces) { + o->detector.manager().AddOpticalSurface(optical.second.ptr()); + extension->opticalSurfaces.insert(optical); } o->opticalSurfaces.clear(); - for(auto& s : o->skinSurfaces) { - string n = s.first.first.path() + '#' + s.first.second; - s.second->SetName(n.c_str()); - o->detector.manager().AddSkinSurface(s.second.ptr()); - extension->skinSurfaces.insert(s); + for(auto& skin : o->skinSurfaces) { + string n = skin.first.first.path() + '#' + skin.first.second; + skin.second->SetName(n.c_str()); + o->detector.manager().AddSkinSurface(skin.second.ptr()); + extension->skinSurfaces.insert(skin); } o->skinSurfaces.clear(); - for(auto& s : o->borderSurfaces) { - string n = s.first.first.path() + '#' + s.first.second; - s.second->SetName(n.c_str()); - o->detector.manager().AddBorderSurface(s.second.ptr()); - extension->borderSurfaces.insert(s); + for(auto& border : o->borderSurfaces) { + string n = border.first.first.path() + '#' + border.first.second; + border.second->SetName(n.c_str()); + o->detector.manager().AddBorderSurface(border.second.ptr()); + extension->borderSurfaces.insert(border); } o->borderSurfaces.clear(); diff --git a/DDCore/src/OpticalSurfaces.cpp b/DDCore/src/OpticalSurfaces.cpp index 81374d7e8..f1a1c6baf 100644 --- a/DDCore/src/OpticalSurfaces.cpp +++ b/DDCore/src/OpticalSurfaces.cpp @@ -41,9 +41,8 @@ OpticalSurface::OpticalSurface(Detector& detector, EType type, double value) { - unique_ptr<Object> s(new Object(full_name.c_str(), model, finish, type, value)); - //detector.surfaceManager().addOpticalSurface(m_element=s.release()); - detector.manager().AddOpticalSurface(m_element=s.release()); + unique_ptr<Object> obj(new Object(full_name.c_str(), model, finish, type, value)); + detector.manager().AddOpticalSurface(m_element=obj.release()); } /// Access to tabular properties of the surface @@ -62,8 +61,8 @@ SkinSurface::SkinSurface(Detector& detector, DetElement de, const string& nam, O if ( de.isValid() ) { if ( vol.isValid() ) { if ( surf.isValid() ) { - unique_ptr<Object> s(new Object(nam.c_str(), surf->GetName(), surf.ptr(), vol.ptr())); - detector.surfaceManager().addSkinSurface(de, m_element=s.release()); + unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), vol.ptr())); + detector.surfaceManager().addSkinSurface(de, m_element=obj.release()); return; } except("SkinSurface","++ Cannot create SkinSurface %s without valid optical surface!",nam.c_str()); diff --git a/DDCore/src/PropertyTable.cpp b/DDCore/src/PropertyTable.cpp index d42e43d61..b0047e6d5 100644 --- a/DDCore/src/PropertyTable.cpp +++ b/DDCore/src/PropertyTable.cpp @@ -37,8 +37,8 @@ PropertyTable::PropertyTable(Detector& description, size_t num_rows, size_t num_cols) { - unique_ptr<Object> s(new Object(table_name.c_str(), num_rows, num_cols)); - s->SetTitle(property_name.c_str()); - description.manager().AddGDMLMatrix(m_element=s.release()); + unique_ptr<Object> table(new Object(table_name.c_str(), num_rows, num_cols)); + table->SetTitle(property_name.c_str()); + description.manager().AddGDMLMatrix(m_element=table.release()); } #endif diff --git a/DDCore/src/SimpleGDMLWriter.cpp b/DDCore/src/SimpleGDMLWriter.cpp index 8e1edaea1..3cdd048f4 100644 --- a/DDCore/src/SimpleGDMLWriter.cpp +++ b/DDCore/src/SimpleGDMLWriter.cpp @@ -84,8 +84,7 @@ void* SimpleGDMLWriter::handleVolume(const string& name, const TGeoVolume* volum } if (num > 0) { for (int i = 0; i < num; ++i) { - //TGeoNode* n = volume->GetNode(i); - TGeoNode* n = volume->GetNode(volume->GetNode(i)->GetName()); + TGeoNode* n = volume->GetNode(volume->GetNode(i)->GetName()); TGeoVolume* v = n->GetVolume(); TGeoMatrix* m = n->GetMatrix(); m_output << "\t\t\t<physvol>" << endl; @@ -109,55 +108,55 @@ void* SimpleGDMLWriter::handleVolume(const string& name, const TGeoVolume* volum void* SimpleGDMLWriter::handleSolid(const string& name, const TGeoShape* shape) const { if (shape) { if (shape->IsA() == TGeoBBox::Class()) { - const TGeoBBox* s = (const TGeoBBox*) shape; - m_output << "\t\t<box name=\"" << name << "_shape\" x=\"" << s->GetDX() << "\" y=\"" << s->GetDY() << "\" z=\"" - << s->GetDZ() << "\" lunit=\"cm\"/>" << endl; + const TGeoBBox* sh = (const TGeoBBox*) shape; + m_output << "\t\t<box name=\"" << name << "_shape\" x=\"" << sh->GetDX() << "\" y=\"" << sh->GetDY() << "\" z=\"" + << sh->GetDZ() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTube::Class()) { - const TGeoTube* s = (const TGeoTube*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << s->GetRmin() << "\" rmax=\"" << s->GetRmax() << "\" z=\"" - << s->GetDz() << "\" startphi=\"0.0\" deltaphi=\"360.0\" aunit=\"deg\" lunit=\"cm\"/>" << endl; + const TGeoTube* sh = (const TGeoTube*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << sh->GetRmin() << "\" rmax=\"" << sh->GetRmax() << "\" z=\"" + << sh->GetDz() << "\" startphi=\"0.0\" deltaphi=\"360.0\" aunit=\"deg\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTubeSeg::Class()) { - const TGeoTubeSeg* s = (const TGeoTubeSeg*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << s->GetRmin() << "\" rmax=\"" << s->GetRmax() << "\" z=\"" - << s->GetDz() << "\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetPhi2() + const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" rmin=\"" << sh->GetRmin() << "\" rmax=\"" << sh->GetRmax() << "\" z=\"" + << sh->GetDz() << "\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetPhi2() << "\" aunit=\"deg\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTrd1::Class()) { - const TGeoTrd1* s = (const TGeoTrd1*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << s->GetDx1() << "\" x2=\"" << s->GetDx2() << "\" y1=\"" - << s->GetDy() << "\" y2=\"" << s->GetDy() << "\" z=\"" << s->GetDz() << "\" lunit=\"cm\"/>" << endl; + const TGeoTrd1* sh = (const TGeoTrd1*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << sh->GetDx1() << "\" x2=\"" << sh->GetDx2() << "\" y1=\"" + << sh->GetDy() << "\" y2=\"" << sh->GetDy() << "\" z=\"" << sh->GetDz() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoTrd2::Class()) { - const TGeoTrd2* s = (const TGeoTrd2*) shape; - m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << s->GetDx1() << "\" x2=\"" << s->GetDx2() << "\" y1=\"" - << s->GetDy1() << "\" y2=\"" << s->GetDy2() << "\" z=\"" << s->GetDz() << "\" lunit=\"cm\"/>" << endl; + const TGeoTrd2* sh = (const TGeoTrd2*) shape; + m_output << "\t\t<tube name=\"" << name << "_shape\" x1=\"" << sh->GetDx1() << "\" x2=\"" << sh->GetDx2() << "\" y1=\"" + << sh->GetDy1() << "\" y2=\"" << sh->GetDy2() << "\" z=\"" << sh->GetDz() << "\" lunit=\"cm\"/>" << endl; } else if (shape->IsA() == TGeoPgon::Class()) { - const TGeoPgon* s = (const TGeoPgon*) shape; - m_output << "\t\t<polyhedra name=\"" << name << "_shape\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetDphi() - << "\" numsides=\"" << s->GetNedges() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; - for (int i = 0; i < s->GetNz(); ++i) { - m_output << "\t\t\t<zplane z=\"" << s->GetZ(i) << "\" rmin=\"" << s->GetRmin(i) << "\" rmax=\"" << s->GetRmax(i) + const TGeoPgon* sh = (const TGeoPgon*) shape; + m_output << "\t\t<polyhedra name=\"" << name << "_shape\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetDphi() + << "\" numsides=\"" << sh->GetNedges() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; + for (int i = 0; i < sh->GetNz(); ++i) { + m_output << "\t\t\t<zplane z=\"" << sh->GetZ(i) << "\" rmin=\"" << sh->GetRmin(i) << "\" rmax=\"" << sh->GetRmax(i) << "\" lunit=\"cm\"/>" << endl; } m_output << "\t\t</polyhedra>" << endl; } else if (shape->IsA() == TGeoPcon::Class()) { - const TGeoPcon* s = (const TGeoPcon*) shape; - m_output << "\t\t<polycone name=\"" << name << "_shape\" startphi=\"" << s->GetPhi1() << "\" deltaphi=\"" << s->GetDphi() + const TGeoPcon* sh = (const TGeoPcon*) shape; + m_output << "\t\t<polycone name=\"" << name << "_shape\" startphi=\"" << sh->GetPhi1() << "\" deltaphi=\"" << sh->GetDphi() << "\" aunit=\"deg\" lunit=\"cm\">" << endl; - for (int i = 0; i < s->GetNz(); ++i) { - m_output << "\t\t\t<zplane z=\"" << s->GetZ(i) << "\" rmin=\"" << s->GetRmin(i) << "\" rmax=\"" << s->GetRmax(i) + for (int i = 0; i < sh->GetNz(); ++i) { + m_output << "\t\t\t<zplane z=\"" << sh->GetZ(i) << "\" rmin=\"" << sh->GetRmin(i) << "\" rmax=\"" << sh->GetRmax(i) << "\" lunit=\"cm\"/>" << endl; } m_output << "\t\t</polycone>" << endl; } else if (shape->IsA() == TGeoCompositeShape::Class()) { string nn = name; - const TGeoCompositeShape* s = (const TGeoCompositeShape*) shape; - const TGeoBoolNode* boolean = s->GetBoolNode(); + const TGeoCompositeShape* sh = (const TGeoCompositeShape*) shape; + const TGeoBoolNode* boolean = sh->GetBoolNode(); TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); handleSolid(name + "_left", boolean->GetLeftShape()); @@ -232,15 +231,15 @@ void SimpleGDMLWriter::handleTransformations(const vector<pair<string, TGeoMatri /// Dump all solids in GDML format to output stream void SimpleGDMLWriter::handleSolids(const set<TGeoShape*>& solids) const { m_output << "\t<solids>" << endl; - for (const auto s : solids ) - handleSolid(s->GetName(), s); + for (const auto& sh : solids ) + handleSolid(sh->GetName(), sh); m_output << "\t</solids>" << endl; } /// Dump all constants in GDML format to output stream void SimpleGDMLWriter::handleDefines(const Detector::HandleMap& defs) const { m_output << "\t<define>" << endl; - for (const auto i : defs ) + for (const auto& i : defs ) m_output << "\t\t<constant name=\"" << i.second->GetName() << "\" value=\"" << i.second->GetTitle() << "\" />" << endl; m_output << "\t</define>" << endl; @@ -249,12 +248,12 @@ void SimpleGDMLWriter::handleDefines(const Detector::HandleMap& defs) const { /// Dump all visualisation specs in Detector format to output stream void SimpleGDMLWriter::handleVisualisation(const set<VisAttr>& vis) const { m_output << "\t<display>" << endl; - for (const auto v : vis ) { + for (const auto& v : vis ) { if (v.isValid()) { - float r = 1., g = 1., b = 1., alpha = 1.; + float red = 1., green = 1., blue = 1., alpha = 1.; TColor *color = gROOT->GetColor(v.color()); if (color) { - color->GetRGB(r, g, b); + color->GetRGB(red, green, blue); alpha = color->GetAlpha(); } const char* line_style = 0, *draw_style = 0; @@ -281,8 +280,9 @@ void SimpleGDMLWriter::handleVisualisation(const set<VisAttr>& vis) const { if (draw_style) m_output << "drawingStyle=\"" << draw_style << "\" "; m_output << "show_daughters=\"" << (const char*) (v.showDaughters() ? "true" : "false") << "\" " << "visible=\"" - << (const char*) (v.visible() ? "true" : "false") << "\" >" << endl << "\t\t\t<color R=\"" << r << "\" G=\"" << g - << "\" B=\"" << b << "\" alpha=\"" << alpha << "\" />" << endl << "\t\t</vis>" << endl; + << (const char*) (v.visible() ? "true" : "false") << "\" >" << endl + << "\t\t\t<color R=\"" << red << "\" G=\"" << green << "\" B=\"" << blue << "\" alpha=\"" << alpha << "\" />" << endl + << "\t\t</vis>" << endl; } } m_output << "\t</display>" << endl; diff --git a/DDCore/src/Volumes.cpp b/DDCore/src/Volumes.cpp index d525079f3..03dac1cd0 100644 --- a/DDCore/src/Volumes.cpp +++ b/DDCore/src/Volumes.cpp @@ -405,15 +405,15 @@ Position PlacedVolume::position() const { /// String dump string PlacedVolume::toString() const { - stringstream s; + stringstream str; Object* obj = _data(*this); - s << m_element->GetName() << ": vol='" << m_element->GetVolume()->GetName() - << "' mat:'" << m_element->GetMatrix()->GetName() - << "' volID[" << obj->volIDs.size() << "] "; + str << m_element->GetName() << ": vol='" << m_element->GetVolume()->GetName() + << "' mat:'" << m_element->GetMatrix()->GetName() + << "' volID[" << obj->volIDs.size() << "] "; for (VolIDs::const_iterator i = obj->volIDs.begin(); i != obj->volIDs.end(); ++i) - s << (*i).first << "=" << (*i).second << " "; - s << ends; - return s.str(); + str << (*i).first << "=" << (*i).second << " "; + str << ends; + return str.str(); } /// Enable ROOT persistency @@ -476,13 +476,13 @@ Volume::Volume(const string& nam, const string& title) { } /// Constructor to be used when creating a new geometry tree. Also sets materuial and solid attributes -Volume::Volume(const string& nam, const Solid& s, const Material& m) { - m_element = _createTGeoVolume(nam,s.ptr(),m.ptr()); +Volume::Volume(const string& nam, const Solid& sol, const Material& mat) { + m_element = _createTGeoVolume(nam, sol.ptr(), mat.ptr()); } /// Constructor to be used when creating a new geometry tree. Also sets materuial and solid attributes -Volume::Volume(const string& nam, const string& title, const Solid& s, const Material& m) { - m_element = _createTGeoVolume(nam,s.ptr(),m.ptr()); +Volume::Volume(const string& nam, const string& title, const Solid& sol, const Material& mat) { + m_element = _createTGeoVolume(nam, sol.ptr(), mat.ptr()); m_element->SetTitle(title.c_str()); } @@ -627,8 +627,8 @@ PlacedVolume _addNode(TGeoVolume* par, Volume daughter, int copy_nr, const Rotat double elements[9]; rot3D.GetComponents(elements); r.SetMatrix(elements); - auto m = make_unique<TGeoCombiTrans>(TGeoTranslation(0,0,0),r); - return _addNode(par, daughter, copy_nr, m.release()); + auto matrix = make_unique<TGeoCombiTrans>(TGeoTranslation(0,0,0),r); + return _addNode(par, daughter, copy_nr, matrix.release()); } PlacedVolume _addNode(TGeoVolume* par, Volume daughter, int copy_nr, const Transform3D& tr) { @@ -649,8 +649,8 @@ PlacedVolume _addNode(TGeoVolume* par, Volume daughter, int copy_nr, const Trans double elements[9]; rot3D.GetComponents(elements); r.SetMatrix(elements); - auto m = make_unique<TGeoCombiTrans>(TGeoTranslation(pos3D.x(), pos3D.y(), pos3D.z()),r); - return _addNode(par, daughter, copy_nr, m.release()); + auto matrix = make_unique<TGeoCombiTrans>(TGeoTranslation(pos3D.x(), pos3D.y(), pos3D.z()),r); + return _addNode(par, daughter, copy_nr, matrix.release()); } /// Place daughter volume according to generic Transform3D @@ -742,14 +742,14 @@ string Volume::option() const { } /// Set the volume's material -const Volume& Volume::setMaterial(const Material& m) const { - if (m.isValid()) { - TGeoMedium* medium = m._ptr<TGeoMedium>(); +const Volume& Volume::setMaterial(const Material& mat) const { + if (mat.isValid()) { + TGeoMedium* medium = mat._ptr<TGeoMedium>(); if (medium) { m_element->SetMedium(medium); return *this; } - throw runtime_error("dd4hep: Volume: Medium " + string(m.name()) + " is not registered with geometry manager."); + throw runtime_error("dd4hep: Volume: Medium " + string(mat.name()) + " is not registered with geometry manager."); } throw runtime_error("dd4hep: Volume: Attempt to assign invalid material."); } @@ -884,8 +884,8 @@ VisAttr Volume::visAttributes() const { } /// Set the volume's solid shape -const Volume& Volume::setSolid(const Solid& s) const { - m_element->SetShape(s); +const Volume& Volume::setSolid(const Solid& sol) const { + m_element->SetShape(sol); return *this; } @@ -978,14 +978,14 @@ VolumeMulti::VolumeMulti(const string& nam, Material mat) { void VolumeMulti::verifyVolumeMulti() { if ( m_element ) { // This will lead to an exception if the type is not TGeoVolumeMulti - TGeoVolumeMulti* m = detail::safe_cast<TGeoVolumeMulti>::cast(m_element); - if ( m ) { + TGeoVolumeMulti* multi = detail::safe_cast<TGeoVolumeMulti>::cast(m_element); + if ( multi ) { import(); return; } // Force a bad cast exception - Handle<TGeoVolumeMulti> h(m_element); - if ( h.isValid() ) {} + Handle<TGeoVolumeMulti> handle(m_element); + if ( handle.isValid() ) {} } } diff --git a/DDEve/lcio/LCIOEventHandler.cpp b/DDEve/lcio/LCIOEventHandler.cpp index 933ae60dc..2c7b84a69 100644 --- a/DDEve/lcio/LCIOEventHandler.cpp +++ b/DDEve/lcio/LCIOEventHandler.cpp @@ -36,21 +36,21 @@ using namespace dd4hep; using namespace EVENT; using namespace IMPL; -const void* _fill(const SimTrackerHit* s, DDEveHit* target) { - const double* p = s->getPosition(); +const void* _fill(const SimTrackerHit* hit, DDEveHit* target) { + const double* p = hit->getPosition(); target->x = p[0]; target->y = p[1]; target->z = p[2]; - target->deposit = s->getEDep(); - return s; + target->deposit = hit->getEDep(); + return hit; } -const void* _fill(const SimCalorimeterHit* s, DDEveHit* target) { - const float* p = s->getPosition(); +const void* _fill(const SimCalorimeterHit* hit, DDEveHit* target) { + const float* p = hit->getPosition(); target->x = p[0]; target->y = p[1]; target->z = p[2]; - target->deposit = s->getEnergy(); - return s; + target->deposit = hit->getEnergy(); + return hit; } static const void* _convertHitFunc(const LCObject* source, DDEveHit* target) { @@ -66,8 +66,8 @@ static const void* _convertParticleFunc(const LCObject* source, DDEveParticle* t } static void* _create(const char*) { - EventHandler* h = new LCIOEventHandler(); - return h; + EventHandler* eh = new LCIOEventHandler(); + return eh; } using namespace dd4hep::detail; DECLARE_CONSTRUCTOR(DDEve_LCIOEventHandler,_create) diff --git a/DDEve/src/DD4hepMenu.cpp b/DDEve/src/DD4hepMenu.cpp index 9f0e23792..32ae2e0c2 100644 --- a/DDEve/src/DD4hepMenu.cpp +++ b/DDEve/src/DD4hepMenu.cpp @@ -54,31 +54,31 @@ DD4hepMenu::~DD4hepMenu() { } /// Add the menu to the menu bar -void DD4hepMenu::Build(TGMenuBar* bar, int hints) { +void DD4hepMenu::Build(TGMenuBar* menubar, int hints) { int id; - PopupMenu& m = *this; - m.AddEntry("&Load XML", this, &DD4hepMenu::OnLoadXML); - //Not for now: m.AddEntry("&Load ROOT Geometry",this, &DD4hepMenu::OnLoadRootGeometry); - id = m.AddEntry("&Show Event I/O", this, &DD4hepMenu::OnCreateEventIO); - m.menu().DisableEntry(id); - id = m.AddEntry("&Open Event Data", this, &DD4hepMenu::OnOpenEventData); - m.menu().DisableEntry(id); - id = m.AddEntry("&Next Event", this, &DD4hepMenu::OnNextEvent); - m.menu().DisableEntry(id); - id = m.AddEntry("&Previous Event", this, &DD4hepMenu::OnPreviousEvent); - m.menu().DisableEntry(id); - m.AddEntry("&Exit", this, &DD4hepMenu::OnExit); - bar->AddPopup("&dd4hep",*this, new TGLayoutHints(hints, 0, 4, 0, 0)); + PopupMenu& pm = *this; + pm.AddEntry("&Load XML", this, &DD4hepMenu::OnLoadXML); + //Not for now: pm.AddEntry("&Load ROOT Geometry",this, &DD4hepMenu::OnLoadRootGeometry); + id = pm.AddEntry("&Show Event I/O", this, &DD4hepMenu::OnCreateEventIO); + pm.menu().DisableEntry(id); + id = pm.AddEntry("&Open Event Data", this, &DD4hepMenu::OnOpenEventData); + pm.menu().DisableEntry(id); + id = pm.AddEntry("&Next Event", this, &DD4hepMenu::OnNextEvent); + pm.menu().DisableEntry(id); + id = pm.AddEntry("&Previous Event", this, &DD4hepMenu::OnPreviousEvent); + pm.menu().DisableEntry(id); + pm.AddEntry("&Exit", this, &DD4hepMenu::OnExit); + menubar->AddPopup("&dd4hep",*this, new TGLayoutHints(hints, 0, 4, 0, 0)); } /// Callback when the geometry was loaded void DD4hepMenu::OnGeometryLoaded() { - TGPopupMenu& m = menu(); - m.DisableEntry(m.GetEntry("Load XML")->GetEntryId()); - m.EnableEntry(m.GetEntry("Show Event I/O")->GetEntryId()); - m.EnableEntry(m.GetEntry("Open Event Data")->GetEntryId()); - m.DisableEntry(m.GetEntry("Next Event")->GetEntryId()); - m.DisableEntry(m.GetEntry("Previous Event")->GetEntryId()); + TGPopupMenu& pm = menu(); + pm.DisableEntry(pm.GetEntry("Load XML")->GetEntryId()); + pm.EnableEntry(pm.GetEntry("Show Event I/O")->GetEntryId()); + pm.EnableEntry(pm.GetEntry("Open Event Data")->GetEntryId()); + pm.DisableEntry(pm.GetEntry("Next Event")->GetEntryId()); + pm.DisableEntry(pm.GetEntry("Previous Event")->GetEntryId()); } /// Callback when loading the configuration @@ -117,10 +117,10 @@ void DD4hepMenu::OnOpenEventData(TGMenuEntry* /* entry */, void* /* ptr */) { OnCreateEventIO(0,0); } if ( m_evtCtrl->Open() ) { - TGPopupMenu& m = menu(); - m.EnableEntry(m.GetEntry("Open Event Data")->GetEntryId()); - m.EnableEntry(m.GetEntry("Next Event")->GetEntryId()); - m.EnableEntry(m.GetEntry("Previous Event")->GetEntryId()); + TGPopupMenu& pm = menu(); + pm.EnableEntry(pm.GetEntry("Open Event Data")->GetEntryId()); + pm.EnableEntry(pm.GetEntry("Next Event")->GetEntryId()); + pm.EnableEntry(pm.GetEntry("Previous Event")->GetEntryId()); } } diff --git a/DDEve/src/Display.cpp b/DDEve/src/Display.cpp index d68d1dd95..c2344b352 100644 --- a/DDEve/src/Display.cpp +++ b/DDEve/src/Display.cpp @@ -89,7 +89,7 @@ Display::Display(TEveManager* eve) m_viewMenu(0), m_dd4Menu(0), m_visLevel(7), m_loadLevel(1) { TEveBrowser* br = m_eve->GetBrowser(); - TGMenuBar* bar = br->GetMenuBar(); + TGMenuBar* menu = br->GetMenuBar(); EveShapeContextMenu::install(this); EvePgonSetProjectedContextMenu::install(this); ElementListContextMenu::install(this); @@ -100,7 +100,7 @@ Display::Display(TEveManager* eve) br->ShowCloseTab(kFALSE); m_eve->GetViewers()->SwitchColorSet(); TFile::SetCacheFileDir("."); - BuildMenus(bar); + BuildMenus(menu); br->SetTabTitle("Global Scene",TRootBrowser::kRight,0); } @@ -170,9 +170,9 @@ GenericEventHandler& Display::eventHandler() const { } /// Add new menu to the main menu bar -void Display::AddMenu(TGMenuBar* bar, PopupMenu* menu, int hints) { +void Display::AddMenu(TGMenuBar* menubar, PopupMenu* menu, int hints) { m_menus.insert(menu); - menu->Build(bar, hints); + menu->Build(menubar, hints); m_eve->FullRedraw3D(kTRUE); // Reset camera and redraw } @@ -327,17 +327,17 @@ string Display::OpenEventFileDialog(const string& default_dir) const { } /// Build the DDEve specific menues -void Display::BuildMenus(TGMenuBar* bar) { - if ( 0 == bar ) { - bar = m_eve->GetBrowser()->GetMenuBar(); +void Display::BuildMenus(TGMenuBar* menubar) { + if ( 0 == menubar ) { + menubar = m_eve->GetBrowser()->GetMenuBar(); } if ( 0 == m_dd4Menu ) { m_dd4Menu = new DD4hepMenu(this); - AddMenu(bar, m_dd4Menu); + AddMenu(menubar, m_dd4Menu); } if ( 0 == m_viewMenu && !m_viewConfigs.empty() ) { m_viewMenu = new ViewMenu(this,"&Views"); - AddMenu(bar, m_viewMenu, kLHintsRight); + AddMenu(menubar, m_viewMenu, kLHintsRight); } } diff --git a/DDEve/src/ElementList.cpp b/DDEve/src/ElementList.cpp index 3ab4ddd2a..6f0f040a3 100644 --- a/DDEve/src/ElementList.cpp +++ b/DDEve/src/ElementList.cpp @@ -55,8 +55,8 @@ TEveElementList* ElementList::CloneElement() const { } /// Instantiator -ElementListContextMenu& ElementListContextMenu::install(Display* m) { - static ElementListContextMenu s(m); +ElementListContextMenu& ElementListContextMenu::install(Display* disp) { + static ElementListContextMenu s(disp); return s; } diff --git a/DDEve/src/EveUserContextMenu.cpp b/DDEve/src/EveUserContextMenu.cpp index 6b79eeb11..c6aaea7b3 100644 --- a/DDEve/src/EveUserContextMenu.cpp +++ b/DDEve/src/EveUserContextMenu.cpp @@ -30,7 +30,7 @@ using namespace dd4hep; ClassImp(EveUserContextMenu) /// Initializing constructor -EveUserContextMenu::EveUserContextMenu(Display* m) : m_display(m) { +EveUserContextMenu::EveUserContextMenu(Display* disp) : m_display(disp) { } /// Default destructor @@ -104,16 +104,16 @@ void EveUserContextMenu::DeepLoadChildren(TObject* target, void* /* user_param * /// Install the geometry context menu void EveUserContextMenu::InstallGeometryContextMenu(TClass* cl) { - ContextMenu& m = ContextMenu::instance(cl); - m.Clear(); - m.Add("Show Children Recursive",this,&EveUserContextMenu::ShowAll); - m.Add("Hide Children Recursive",this,&EveUserContextMenu::HideAll); - m.AddSeparator(); - m.Add("Show Children",this,&EveUserContextMenu::ShowChildren); - m.Add("Hide Children",this,&EveUserContextMenu::HideChildren); - m.Add("Show Self",this,&EveUserContextMenu::ShowSelf); - m.Add("Hide Self",this,&EveUserContextMenu::HideSelf); - m.AddSeparator(); - m.Add("Load Children",this,&EveUserContextMenu::LoadChildren); - m.Add("Deep Load",this,&EveUserContextMenu::DeepLoadChildren); + ContextMenu& menu = ContextMenu::instance(cl); + menu.Clear(); + menu.Add("Show Children Recursive",this,&EveUserContextMenu::ShowAll); + menu.Add("Hide Children Recursive",this,&EveUserContextMenu::HideAll); + menu.AddSeparator(); + menu.Add("Show Children",this,&EveUserContextMenu::ShowChildren); + menu.Add("Hide Children",this,&EveUserContextMenu::HideChildren); + menu.Add("Show Self",this,&EveUserContextMenu::ShowSelf); + menu.Add("Hide Self",this,&EveUserContextMenu::HideSelf); + menu.AddSeparator(); + menu.Add("Load Children",this,&EveUserContextMenu::LoadChildren); + menu.Add("Deep Load",this,&EveUserContextMenu::DeepLoadChildren); } diff --git a/DDEve/src/Utilities.cpp b/DDEve/src/Utilities.cpp index 2808a0d9f..88b357acc 100644 --- a/DDEve/src/Utilities.cpp +++ b/DDEve/src/Utilities.cpp @@ -56,25 +56,31 @@ void Utilities::SetRnrAll(TEveElementList* l, bool b) { /// Make a set of nodes starting from a top element (in-)visible with a given depth void Utilities::MakeNodesVisible(TEveElement* e, bool visible, int level) { - TEveElementList* s = dynamic_cast<TEveElementList*>(e); - if ( !s ) { + TEveElementList* lst = dynamic_cast<TEveElementList*>(e); + if ( !lst ) { return; } else if ( level == 1 ) { - SetRnrChildren(s, visible); - s->SetRnrSelf(true); + SetRnrChildren(lst, visible); + lst->SetRnrSelf(true); } else if ( level == 0 ) { - s->SetRnrSelf(visible); + lst->SetRnrSelf(visible); } else { - SetRnrAll(s, visible); - s->SetRnrSelf(visible); + SetRnrAll(lst, visible); + lst->SetRnrSelf(visible); } } std::pair<bool,TEveElement*> -Utilities::createEveShape(int level, int max_level, TEveElement* p, TGeoNode* n, const TGeoHMatrix& mat, const std::string& nam) { +Utilities::createEveShape(int level, + int max_level, + TEveElement* p, + TGeoNode* n, + const TGeoHMatrix& mat, + const std::string& nam) +{ TGeoVolume* vol = n ? n->GetVolume() : 0; bool created = false; @@ -106,9 +112,9 @@ Utilities::createEveShape(int level, int max_level, TEveElement* p, TGeoNode* n, shape->SetMainAlpha(0.2); shape->SetPickable(kTRUE); if ( vis.isValid() ) { - float r,g,b; - vis.rgb(r,g,b); - shape->SetMainColorRGB(r,g,b); + float red, green, blue; + vis.rgb(red, green, blue); + shape->SetMainColorRGB(red, green, blue); } element = shape; created = true; @@ -120,9 +126,9 @@ Utilities::createEveShape(int level, int max_level, TEveElement* p, TGeoNode* n, //n->GetName(),geoShape->IsA()->GetName(),n); created = true; if ( vis.isValid() ) { - float r,g,b; - vis.rgb(r,g,b); - shape->SetMainColorRGB(r,g,b); + float red, green, blue; + vis.rgb(red, green, blue); + shape->SetMainColorRGB(red, green, blue); } shape->SetMainTransparency(true); shape->SetMainAlpha(0.2); diff --git a/DDEve/src/View.cpp b/DDEve/src/View.cpp index 5e128b070..0dd245d93 100644 --- a/DDEve/src/View.cpp +++ b/DDEve/src/View.cpp @@ -30,10 +30,10 @@ using namespace std; using namespace dd4hep; template <typename T> -static inline typename T::const_iterator find(const T& c,const string& s) { - for(typename T::const_iterator i=c.begin(); i!=c.end(); ++i) - if ( (*i).name == s ) return i; - return c.end(); +static inline typename T::const_iterator find(const T& cont,const string& str) { + for(typename T::const_iterator i=cont.begin(); i!=cont.end(); ++i) + if ( (*i).name == str ) return i; + return cont.end(); } /// Initializing constructor diff --git a/DDEve/src/ViewMenu.cpp b/DDEve/src/ViewMenu.cpp index 12e9fc633..3c9b5b66a 100644 --- a/DDEve/src/ViewMenu.cpp +++ b/DDEve/src/ViewMenu.cpp @@ -51,7 +51,7 @@ ViewMenu::~ViewMenu() { } /// Add the menu to the menu bar -void ViewMenu::Build(TGMenuBar* bar, int hints) { +void ViewMenu::Build(TGMenuBar* menubar, int hints) { pair<string,string>* p = 0; PopupMenu* view_menu = this; view_menu->AddEntry("3&D View", this, &ViewMenu::CreateView, p=new pair<string,string>("DD4hep_DDEve_View3D","3D")); @@ -62,7 +62,7 @@ void ViewMenu::Build(TGMenuBar* bar, int hints) { const Display::ViewConfig& v = (*i).second; view_menu->AddEntry(v.name.c_str(), this, &ViewMenu::CreateView,p=new pair<string,string>("DD4hep_DDEve_"+v.type,v.name)); } - bar->AddPopup(m_title.c_str(),*view_menu, new TGLayoutHints(hints, 0, 4, 0, 0)); + menubar->AddPopup(m_title.c_str(),*view_menu, new TGLayoutHints(hints, 0, 4, 0, 0)); } /// Create a new generic view @@ -95,8 +95,8 @@ View* ViewMenu::CreateRhoPhiProjection(const std::string& title ) { /// Import Geometry data void ViewMenu::BuildView(View* v) const { - TEveManager& m = m_display->manager(); - TEveBrowser *browser = m.GetBrowser(); + TEveManager& mgr = m_display->manager(); + TEveBrowser *browser = mgr.GetBrowser(); TGTab *right = browser->GetTabRight(); TEveWindowSlot *slot = TEveWindow::CreateWindowInTab(right); v->Build(slot); diff --git a/DDG4/src/Geant4GeometryInfo.cpp b/DDG4/src/Geant4GeometryInfo.cpp index 06a1367a4..aa9e99421 100644 --- a/DDG4/src/Geant4GeometryInfo.cpp +++ b/DDG4/src/Geant4GeometryInfo.cpp @@ -25,18 +25,18 @@ using namespace dd4hep::sim; string Geant4GeometryInfo::placementPath(const Geant4PlacementPath& path, bool reverse) { - string s; + string path_name; if ( reverse ) { for (Geant4PlacementPath::const_reverse_iterator pIt = path.rbegin(); pIt != path.rend(); ++pIt) { - s += "/"; s += (*pIt)->GetName(); + path_name += "/"; path_name += (*pIt)->GetName(); } } else { for (Geant4PlacementPath::const_iterator pIt = path.begin(); pIt != path.end(); ++pIt) { - s += "/"; s += (*pIt)->GetName(); + path_name += "/"; path_name += (*pIt)->GetName(); } } - return s; + return path_name; } /// Default constructor diff --git a/DDG4/src/Geant4HierarchyDump.cpp b/DDG4/src/Geant4HierarchyDump.cpp index 74412bf39..390d45204 100644 --- a/DDG4/src/Geant4HierarchyDump.cpp +++ b/DDG4/src/Geant4HierarchyDump.cpp @@ -63,10 +63,9 @@ using namespace dd4hep::sim; using namespace dd4hep; using namespace std; -static const char* _T(const std::string& s) { - return s.c_str(); +static const char* _T(const std::string& str) { + return str.c_str(); } -//static const char* _T(const char* s) { return s; } enum { G4DUMP_ALL = 0xFFFFFFFF, diff --git a/DDG4/src/Geant4Kernel.cpp b/DDG4/src/Geant4Kernel.cpp index 0d3b89abb..4abc60110 100644 --- a/DDG4/src/Geant4Kernel.cpp +++ b/DDG4/src/Geant4Kernel.cpp @@ -95,9 +95,9 @@ Geant4Kernel::Geant4Kernel(Detector& description_ref) } /// Standard constructor -Geant4Kernel::Geant4Kernel(Geant4Kernel* m, unsigned long ident) +Geant4Kernel::Geant4Kernel(Geant4Kernel* krnl, unsigned long ident) : Geant4ActionContainer(), m_runManager(0), m_control(0), m_trackMgr(0), m_detDesc(0), - m_numThreads(1), m_id(ident), m_master(m), m_shared(0), + m_numThreads(1), m_id(ident), m_master(krnl), m_shared(0), m_threadContext(0), phase(this) { char text[64]; diff --git a/DDG4/src/Geant4Mapping.cpp b/DDG4/src/Geant4Mapping.cpp index 0521bdccc..39d71acaa 100644 --- a/DDG4/src/Geant4Mapping.cpp +++ b/DDG4/src/Geant4Mapping.cpp @@ -73,7 +73,6 @@ void Geant4Mapping::attach(Geant4GeometryInfo* data_ptr) { Geant4VolumeManager Geant4Mapping::volumeManager() const { if ( m_dataPtr ) { if ( m_dataPtr->g4Paths.empty() ) { - //VolumeManager::getVolumeManager(m_detDesc); return Geant4VolumeManager(m_detDesc, m_dataPtr); } return Geant4VolumeManager(Handle < Geant4GeometryInfo > (m_dataPtr)); @@ -84,8 +83,8 @@ Geant4VolumeManager Geant4Mapping::volumeManager() const { /// Accessor to resolve geometry placements PlacedVolume Geant4Mapping::placement(const G4VPhysicalVolume* node) const { checkValidity(); - const Geant4GeometryMaps::PlacementMap& m = m_dataPtr->g4Placements; - for (Geant4GeometryMaps::PlacementMap::const_iterator i = m.begin(); i != m.end(); ++i) + const Geant4GeometryMaps::PlacementMap& pm = m_dataPtr->g4Placements; + for (Geant4GeometryMaps::PlacementMap::const_iterator i = pm.begin(); i != pm.end(); ++i) if ((*i).second == node) return PlacedVolume((*i).first); return PlacedVolume(0); diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index f8ff7bc0e..ff871ba0a 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -204,11 +204,11 @@ void Geant4ParticleHandler::step(const G4Step* step_value, G4SteppingManager* mg /// Pre-track action callback void Geant4ParticleHandler::begin(const G4Track* track) { - Geant4TrackHandler h(track); - double kine = h.kineticEnergy(); - G4ThreeVector m = h.momentum(); + Geant4TrackHandler h(track); + double kine = h.kineticEnergy(); + G4ThreeVector mom = h.momentum(); const G4ThreeVector& v = h.vertex(); - int reason = (kine > m_kinEnergyCut) ? G4PARTICLE_ABOVE_ENERGY_THRESHOLD : 0; + int reason = (kine > m_kinEnergyCut) ? G4PARTICLE_ABOVE_ENERGY_THRESHOLD : 0; const G4PrimaryParticle* prim = h.primary(); Particle* prim_part = 0; @@ -266,9 +266,9 @@ void Geant4ParticleHandler::begin(const G4Track* track) { m_currTrack.vex = 0.0; m_currTrack.vey = 0.0; m_currTrack.vez = 0.0; - m_currTrack.psx = m.x(); - m_currTrack.psy = m.y(); - m_currTrack.psz = m.z(); + m_currTrack.psx = mom.x(); + m_currTrack.psy = mom.y(); + m_currTrack.psz = mom.z(); m_currTrack.pex = 0.0; m_currTrack.pey = 0.0; m_currTrack.pez = 0.0; @@ -297,14 +297,14 @@ void Geant4ParticleHandler::end(const G4Track* track) { int track_reason = m_currTrack.reason; PropertyMask mask(m_currTrack.reason); // Update vertex end point and final momentum - G4ThreeVector m = track->GetMomentum(); - const G4ThreeVector& p = track->GetPosition(); - ph->pex = m.x(); - ph->pey = m.y(); - ph->pez = m.z(); - ph->vex = p.x(); - ph->vey = p.y(); - ph->vez = p.z(); + G4ThreeVector mom = track->GetMomentum(); + const G4ThreeVector& pos = track->GetPosition(); + ph->pex = mom.x(); + ph->pey = mom.y(); + ph->pez = mom.z(); + ph->vex = pos.x(); + ph->vey = pos.y(); + ph->vez = pos.z(); // Set the simulator status bits PropertyMask simStatus(m_currTrack.status); diff --git a/DDG4/src/Geant4ReadoutVolumeFilter.cpp b/DDG4/src/Geant4ReadoutVolumeFilter.cpp index 39219523f..7423d5e6f 100644 --- a/DDG4/src/Geant4ReadoutVolumeFilter.cpp +++ b/DDG4/src/Geant4ReadoutVolumeFilter.cpp @@ -48,11 +48,11 @@ Geant4ReadoutVolumeFilter::~Geant4ReadoutVolumeFilter() { } /// Filter action. Return true if hits should be processed -bool Geant4ReadoutVolumeFilter::operator()(const G4Step* s) const { - Geant4StepHandler step(s); +bool Geant4ReadoutVolumeFilter::operator()(const G4Step* step) const { + Geant4StepHandler stepH(step); Geant4VolumeManager volMgr = Geant4Mapping::instance().volumeManager(); - VolumeID id = volMgr.volumeID(step.preTouchable()); - long64 key = m_key->value(id); + VolumeID id = volMgr.volumeID(stepH.preTouchable()); + long64 key = m_key->value(id); if ( m_collection->key_min <= key && m_collection->key_max >= key ) return true; return false; diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index 9b3afa58f..15b001aca 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -220,16 +220,16 @@ void Geant4Sensitive::mark(const G4Step* step) const { } /// Returns the volumeID of the sensitive volume corresponding to the step -long long int Geant4Sensitive::volumeID(const G4Step* s) { - Geant4StepHandler step(s); +long long int Geant4Sensitive::volumeID(const G4Step* step) { + Geant4StepHandler stepH(step); Geant4VolumeManager volMgr = Geant4Mapping::instance().volumeManager(); - VolumeID id = volMgr.volumeID(step.preTouchable()); + VolumeID id = volMgr.volumeID(stepH.preTouchable()); return id; } /// Returns the cellID(volumeID+local coordinate encoding) of the sensitive volume corresponding to the step -long long int Geant4Sensitive::cellID(const G4Step* s) { - Geant4StepHandler h(s); +long long int Geant4Sensitive::cellID(const G4Step* step) { + Geant4StepHandler h(step); Geant4VolumeManager volMgr = Geant4Mapping::instance().volumeManager(); VolumeID volID = volMgr.volumeID(h.preTouchable()); if ( m_segmentation.isValid() ) { diff --git a/DDG4/src/Geant4VolumeManager.cpp b/DDG4/src/Geant4VolumeManager.cpp index 7d1a6ec46..98c57e3f8 100644 --- a/DDG4/src/Geant4VolumeManager.cpp +++ b/DDG4/src/Geant4VolumeManager.cpp @@ -220,9 +220,9 @@ bool Geant4VolumeManager::checkValidity() const { /// Access CELLID by placement path VolumeID Geant4VolumeManager::volumeID(const vector<const G4VPhysicalVolume*>& path) const { if (!path.empty() && checkValidity()) { - const auto& m = ptr()->g4Paths; - auto i = m.find(path); - if (i != m.end()) + const auto& mapping = ptr()->g4Paths; + auto i = mapping.find(path); + if (i != mapping.end()) return (*i).second; if (!path[0]) return InvalidPath; @@ -247,9 +247,9 @@ void Geant4VolumeManager::volumeDescriptor(const vector<const G4VPhysicalVolume* vol_desc.second.clear(); vol_desc.first = NonExisting; if (!path.empty() && checkValidity()) { - const auto& m = ptr()->g4Paths; - auto i = m.find(path); - if (i != m.end()) { + const auto& mapping = ptr()->g4Paths; + auto i = mapping.find(path); + if (i != mapping.end()) { VolumeID vid = (*i).second; G4LogicalVolume* lvol = path[0]->GetLogicalVolume(); if (lvol->GetSensitiveDetector()) { @@ -280,7 +280,7 @@ void Geant4VolumeManager::volumeDescriptor(const vector<const G4VPhysicalVolume* /// Access fully decoded volume fields by Geant4 touchable object void Geant4VolumeManager::volumeDescriptor(const G4VTouchable* touchable, - VolIDDescriptor& vol_desc) const { + VolIDDescriptor& vol_desc) const { volumeDescriptor(placementPath(touchable), vol_desc); } diff --git a/examples/AlignDet/src/AlignmentExample_nominal.cpp b/examples/AlignDet/src/AlignmentExample_nominal.cpp index c89850602..f96732671 100644 --- a/examples/AlignDet/src/AlignmentExample_nominal.cpp +++ b/examples/AlignDet/src/AlignmentExample_nominal.cpp @@ -50,8 +50,8 @@ static int alignment_example (Detector& description, int argc, char** argv) { public: map<DetElement, Delta>& deltas; ConditionsMap& mapping; - Collector(map<DetElement, Delta>& d, ConditionsMap& m) - : deltas(d), mapping(m) {} + Collector(map<DetElement, Delta>& del, ConditionsMap& cm) + : deltas(del), mapping(cm) {} // Here we test the ConditionsMap interface of the AlignmentsNominalMap int operator()(DetElement de, int ) const { Alignment a = mapping.get(de, align::Keys::alignmentKey); diff --git a/examples/ClientTests/src/TestConstantMultiplier.cpp b/examples/ClientTests/src/TestConstantMultiplier.cpp index 44e588e01..fe71d39c3 100644 --- a/examples/ClientTests/src/TestConstantMultiplier.cpp +++ b/examples/ClientTests/src/TestConstantMultiplier.cpp @@ -59,7 +59,7 @@ static int multiply_constants (Detector& detector, int argc, char** argv) { } int num_test = 0; const auto& constants = detector.constants(); - for(const auto e : constants) { + for(const auto& e : constants) { Constant c = e.second; if ( c.dataType() == "number" ) { try { diff --git a/examples/DDCMS/src/DDCMS.cpp b/examples/DDCMS/src/DDCMS.cpp index 9526686b8..8fabc3bca 100644 --- a/examples/DDCMS/src/DDCMS.cpp +++ b/examples/DDCMS/src/DDCMS.cpp @@ -213,27 +213,27 @@ const Rotation3D& Namespace::rotation(const string& nam) const { /// Add rotation matrix to current namespace Volume Namespace::addVolumeNS(Volume vol) const { - string n = vol.name(); - Solid s = vol.solid(); - Material m = vol.material(); - vol->SetName(n.c_str()); - context->volumes[n] = vol; + string nam = vol.name(); + Solid sol = vol.solid(); + Material mat = vol.material(); + vol->SetName(nam.c_str()); + context->volumes[nam] = vol; printout(context->debug_volumes ? ALWAYS : DEBUG, "DDCMS", "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s", - vol.name(), s.name(), s.type(), m.name()); + vol.name(), sol.name(), sol.type(), mat.name()); return vol; } /// Add rotation matrix to current namespace Volume Namespace::addVolume(Volume vol) const { - string n = prepend(vol.name()); - Solid s = vol.solid(); - Material m = vol.material(); - vol->SetName(n.c_str()); - context->volumes[n] = vol; + string nam = prepend(vol.name()); + Solid sol = vol.solid(); + Material mat = vol.material(); + vol->SetName(nam.c_str()); + context->volumes[nam] = vol; printout(context->debug_volumes ? ALWAYS : DEBUG, "DDCMS", "+++ Add volume:%-38s Solid:%-26s[%-16s] Material:%s", - vol.name(), s.name(), s.type(), m.name()); + vol.name(), sol.name(), sol.type(), mat.name()); return vol; } @@ -344,14 +344,14 @@ namespace { vector<string> raw_vector(const AlgoArguments* a, xml_h arg) { xml_dim_t xp(arg); vector<string> data; - Namespace ns(a->context); + Namespace name_space(a->context); string val = xp.text(); string nam = xp.nameStr(); string typ = xp.typeStr(); int num = xp.attr<int>(_CMU(nEntries)); const BasicGrammar& gr = BasicGrammar::instance<vector<string> >(); - val = '['+ns.real_name(val)+']'; + val = '['+name_space.real_name(val)+']'; val = remove_whitespace(val); int res = gr.fromString(&data,val); if ( !res ) { diff --git a/examples/DDDB/src/plugins/DDDBPlugins.cpp b/examples/DDDB/src/plugins/DDDBPlugins.cpp index 8c13dc423..05487e1fd 100644 --- a/examples/DDDB/src/plugins/DDDBPlugins.cpp +++ b/examples/DDDB/src/plugins/DDDBPlugins.cpp @@ -62,7 +62,7 @@ DECLARE_APPLY(DDDB_ConditionsSummary,dddb_dump_conditions_summary) /// Plugin function static void* create_dddb_loader(Detector& description, int argc, char** argv) { const char* name = argc>0 ? argv[0] : "DDDBLoader"; - cond::ConditionsManagerObject* m = (cond::ConditionsManagerObject*)(argc>0 ? argv[1] : 0); - return new DDDB::DDDBConditionsLoader(description,m,name); + cond::ConditionsManagerObject* mgr = (cond::ConditionsManagerObject*)(argc>0 ? argv[1] : 0); + return new DDDB::DDDBConditionsLoader(description,mgr,name); } DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_Conditions_dddb_Loader,create_dddb_loader) diff --git a/examples/Persistency/src/PersistencySetup.cpp b/examples/Persistency/src/PersistencySetup.cpp index 95f170b08..bc254a892 100644 --- a/examples/Persistency/src/PersistencySetup.cpp +++ b/examples/Persistency/src/PersistencySetup.cpp @@ -62,9 +62,9 @@ int dd4hep::PersistencyExamples::printCondition(Condition cond) { result += int(cond.get<vector<string> >().size()); else if ( gr->type() == typeid(map<string,int>) ) { - const map<string,int>& m = cond.get<map<string,int> >(); - result += int(m.size()); - for(const auto& i : m ) { + const map<string,int>& mapping = cond.get<map<string,int> >(); + result += int(mapping.size()); + for(const auto& i : mapping ) { result += i.second; printout(INFO,"Data","\t\tMap: %s [%s] -> %d",cond.name(), i.first.c_str(),i.second); } -- GitLab