From c5e1f31c10a22ec22da2d250fd2ea24481902d26 Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 1 Jul 2024 08:51:12 +0200 Subject: [PATCH] Fix a few warnings about unused variables and shadowing --- DDCore/src/plugins/CodeGenerator.cpp | 5 ++--- DDCore/src/plugins/TGeoCodeGenerator.cpp | 5 ++--- DDDigi/src/DigiSegmentSplitter.cpp | 2 -- DDEve/src/ElementList.cpp | 4 ++-- DDEve/src/ParticleActors.cpp | 2 -- DDG4/plugins/Geant4EventReaderHepMC.cpp | 5 ----- DDG4/src/Geant4ParticleHandler.cpp | 5 ++--- UtilityApps/src/materialBudget.cpp | 13 +++++++------ 8 files changed, 15 insertions(+), 26 deletions(-) diff --git a/DDCore/src/plugins/CodeGenerator.cpp b/DDCore/src/plugins/CodeGenerator.cpp index d9044132b..349efcf35 100644 --- a/DDCore/src/plugins/CodeGenerator.cpp +++ b/DDCore/src/plugins/CodeGenerator.cpp @@ -667,9 +667,8 @@ static long generate_cxx(Detector& description, int argc, char** argv) { for(int i=0; i DigiSegmentSplitter::collection_names() const { /// Initialization function void DigiSegmentSplitter::initialize() { char text[256]; - std::size_t count = 0; m_split_tool.set_detector(m_detector_name); m_keys = m_split_tool.collection_keys(); @@ -135,7 +134,6 @@ void DigiSegmentSplitter::initialize() { auto* w = new worker_t(proc, m_split_context); w->options.enable(id); m_workers.insert(w); - ++count; } info("+++ Detector splitter is now fully initialized!"); } diff --git a/DDEve/src/ElementList.cpp b/DDEve/src/ElementList.cpp index caaaa5ed5..23c01ba20 100644 --- a/DDEve/src/ElementList.cpp +++ b/DDEve/src/ElementList.cpp @@ -55,8 +55,8 @@ TEveElementList* ElementList::CloneElement() const { /// Instantiator ElementListContextMenu& ElementListContextMenu::install(Display* disp) { - static ElementListContextMenu s(disp); - return s; + static ElementListContextMenu menu(disp); + return menu; } /// Initializing constructor diff --git a/DDEve/src/ParticleActors.cpp b/DDEve/src/ParticleActors.cpp index 71b5f0284..f60577109 100644 --- a/DDEve/src/ParticleActors.cpp +++ b/DDEve/src/ParticleActors.cpp @@ -89,13 +89,11 @@ void MCParticleCreator::addCompound(const std::string& name, TEveLine* e) { void MCParticleCreator::addCompoundLight(const std::string& name, TEveLine* e) { Compounds::const_iterator i = types.find(name); if ( i == types.end() ) { - static int icol = 0; TEveCompound* o = new TEveCompound(name.c_str(),name.c_str()); particles->AddElement(o); i = types.emplace(name,o).first; o->SetMainColor(kBlack); o->CSCApplyMainColorToAllChildren(); - ++icol; } TEveCompound* c = (*i).second; e->SetLineWidth(1); diff --git a/DDG4/plugins/Geant4EventReaderHepMC.cpp b/DDG4/plugins/Geant4EventReaderHepMC.cpp index a761ad0a2..f83978fa3 100644 --- a/DDG4/plugins/Geant4EventReaderHepMC.cpp +++ b/DDG4/plugins/Geant4EventReaderHepMC.cpp @@ -728,17 +728,13 @@ void HepMC::EventStream::clear() { bool HepMC::EventStream::read() { EventStream& info = *this; bool event_read = false; - static int num_evt = 0; - int num_line = 0, num_line_accepted = 0; detail::releaseObjects(vertices()); detail::releaseObjects(particles()); - ++num_evt; while( instream.good() ) { char value = instream.peek(); std::istringstream input_line; - ++num_line; if ( value == 'E' && event_read ) break; else if ( instream.eof() && event_read ) @@ -755,7 +751,6 @@ bool HepMC::EventStream::read() { if( !input_line || value < 0 ) goto Skip; - ++num_line_accepted; switch( value ) { case 'H': { int iotype = 0; diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp index 5011528f6..b0a9353b8 100644 --- a/DDG4/src/Geant4ParticleHandler.cpp +++ b/DDG4/src/Geant4ParticleHandler.cpp @@ -37,7 +37,6 @@ // C/C++ include files #include -#include #include using namespace dd4hep::sim; @@ -508,11 +507,11 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { Geant4ParticleHandle p = (*ipar).second; equivalents[(*ie).first] = p->id; // requires (1) to be filled properly! const G4ParticleDefinition* def = p.definition(); - int pdg = int(fabs(def->GetPDGEncoding())+0.1); + int pdg = int(std::abs(def->GetPDGEncoding())+0.1); if ( pdg != 0 && pdg<36 && !(pdg > 10 && pdg < 17) && pdg != 22 ) { error("+++ ERROR: Geant4 particle for track:%d last known is:%d -- is gluon or quark!",equiv,g4_equiv); } - pdg = int(fabs(p->pdgID)+0.1); + pdg = int(std::abs(p->pdgID)+0.1); if ( pdg != 0 && pdg<36 && !(pdg > 10 && pdg < 17) && pdg != 22 ) { error("+++ ERROR(2): Geant4 particle for track:%d last known is:%d -- is gluon or quark!",equiv,g4_equiv); } diff --git a/UtilityApps/src/materialBudget.cpp b/UtilityApps/src/materialBudget.cpp index 47960495f..8bfc6b500 100644 --- a/UtilityApps/src/materialBudget.cpp +++ b/UtilityApps/src/materialBudget.cpp @@ -217,14 +217,15 @@ int main_wrapper(int argc, char** argv) { for(int i=0 ; i< nbins ;++i){ double theta = ( etaMax > 0. ? 2. * atan ( exp ( - ( etaMin + (0.5+i)*dEta) ) ) : ( thetaMin + (0.5+i)*dTheta ) ) ; - std::stringstream line; + std::stringstream paramLine; - line << std::scientific << theta << " " ; + paramLine << std::scientific << theta << " " ; for( auto& det : subdets ) { Vector3D p0 = pointOnCylinder( theta, det.r0 , det.z0 , phi0 ) ;// double theta, double r, double z, double phi) Vector3D p1 = pointOnCylinder( theta, det.r1 , det.z1 , phi0 ) ;// double theta, double r, double z, double phi) const MaterialVec& materials = matMgr.materialsBetween(p0, p1); - double sum_x0(0.), sum_lambda(0.),path_length(0.); + double sum_x0(0.), sum_lambda(0.); + // double path_length(0.); for( auto amat : materials ) { TGeoMaterial* mat = amat.first->GetMaterial(); @@ -233,15 +234,15 @@ int main_wrapper(int argc, char** argv) { sum_x0 += nx0; double nLambda = length / mat->GetIntLen(); sum_lambda += nLambda; - path_length += length; + // path_length += length; } double binX = ( etaMax > 0. ? (etaMin + (0.5+i)*dEta) : -theta/M_PI*180. ) ; det.hx->Fill( binX , sum_x0 ) ; det.hl->Fill( binX , sum_lambda ) ; - line << std::scientific << sum_x0 << " " << sum_lambda << " " ; // << path_length ; + paramLine << std::scientific << sum_x0 << " " << sum_lambda << " " ; // << path_length ; } - std::cout << line.str() << std::endl; + std::cout << paramLine.str() << std::endl; } std::cout << "====================================================================================================" << std::endl ; rootFile->Write();