Skip to content

Commit

Permalink
Fix a few warnings about unused variables and shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell authored and MarkusFrankATcernch committed Jul 1, 2024
1 parent 3ccf907 commit c5e1f31
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 26 deletions.
5 changes: 2 additions & 3 deletions DDCore/src/plugins/CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,8 @@ static long generate_cxx(Detector& description, int argc, char** argv) {

for(int i=0; i<argc; ++i) {
char c = ::tolower(argv[i][0]);
char* p = argv[i];
if ( c == '-' ) { ++p; c = ::tolower(argv[i][1]); }
if ( c == '-' ) { ++p; c = ::tolower(argv[i][1]); }
if ( c == '-' ) { c = ::tolower(argv[i][1]); }
if ( c == '-' ) { c = ::tolower(argv[i][1]); }
if ( c == 'o' && i+1<argc )
output = argv[++i];
else if ( c == 'f' && i+1<argc )
Expand Down
5 changes: 2 additions & 3 deletions DDCore/src/plugins/TGeoCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,8 @@ static long generate_cxx(Detector& description, int argc, char** argv) {

for(int i=0; i<argc; ++i) {
char c = ::tolower(argv[i][0]);
char* p = argv[i];
if ( c == '-' ) { ++p; c = ::tolower(argv[i][1]); }
if ( c == '-' ) { ++p; c = ::tolower(argv[i][1]); }
if ( c == '-' ) { c = ::tolower(argv[i][1]); }
if ( c == '-' ) { c = ::tolower(argv[i][1]); }
if ( c == 'o' && i+1<argc )
output = argv[++i];
else if ( c == 'f' && i+1<argc )
Expand Down
2 changes: 0 additions & 2 deletions DDDigi/src/DigiSegmentSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ std::vector<std::string> 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();
Expand Down Expand Up @@ -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!");
}
Expand Down
4 changes: 2 additions & 2 deletions DDEve/src/ElementList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions DDEve/src/ParticleActors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 0 additions & 5 deletions DDG4/plugins/Geant4EventReaderHepMC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions DDG4/src/Geant4ParticleHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

// C/C++ include files
#include <set>
#include <stdexcept>
#include <algorithm>

using namespace dd4hep::sim;
Expand Down Expand Up @@ -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);
}
Expand Down
13 changes: 7 additions & 6 deletions UtilityApps/src/materialBudget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit c5e1f31

Please sign in to comment.