diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index 75851c04526d6828580433c1eb814e2a188f1831..a27da8b3b913033c3c31705130a67eebee1df3e3 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -77,11 +77,11 @@ namespace { ~Instances() = default; Detector* get(const string& name) { auto i = detectors.find(name); - return i==detectors.end() ? 0 : (*i).second; + return i == detectors.end() ? 0 : (*i).second; } void insert(const string& name, Detector* detector) { auto i = detectors.find(name); - if ( i==detectors.end() ) { + if ( i == detectors.end() ) { detectors.emplace(name,detector); return; } @@ -89,7 +89,7 @@ namespace { } Detector* remove(const string& name) { auto i = detectors.find(name); - if ( i==detectors.end() ) { + if ( i != detectors.end() ) { Detector* det = (*i).second; detectors.erase(i); return det; diff --git a/DDCore/src/plugins/CodeGenerator.cpp b/DDCore/src/plugins/CodeGenerator.cpp index 456fdaa68050d3efb67fd12de8bdab4dcae68399..2143587c8bfb193b89e73d23114f0cd220c524cc 100644 --- a/DDCore/src/plugins/CodeGenerator.cpp +++ b/DDCore/src/plugins/CodeGenerator.cpp @@ -406,14 +406,12 @@ namespace { ostream& Actor::handleMatrix(ostream& log, TGeoMatrix* mat) { if ( mat && matrices.find(mat) == matrices.end() ) { - const Double_t* rot = mat->GetRotationMatrix(); - const Double_t* tra = mat->GetTranslation(); - const Double_t* sca = mat->GetScale(); string name = obj_name("matrix",mat); log << "{" << newline << "\t TGeoHMatrix* mat = new TGeoHMatrix(\"" << mat->GetName() << "\");" << newline << "\t matrices[" << pointer(mat) << "] = mat;" << newline; if ( mat->IsTranslation() ) { + const Double_t* tra = mat->GetTranslation(); log << "\t Double_t trans[] = {"; for(size_t i=0; tra && i<3; ++i) { log << tra[i]; @@ -422,7 +420,8 @@ namespace { log << newline << "\t mat->SetTranslation(trans);" << newline; } if ( mat->IsRotation() ) { - if ( rot[0] != 1e0 || rot[4] != 1e0 || rot[8] != 1e0) { + const Double_t* rot = mat->GetRotationMatrix(); + if ( rot && (rot[0] != 1e0 || rot[4] != 1e0 || rot[8] != 1e0) ) { log << "\t Double_t rot[] = {"; for(size_t i=0; rot && i<9; ++i) { log << rot[i]; @@ -432,6 +431,7 @@ namespace { } } if ( mat->IsScale() ) { + const Double_t* sca = mat->GetScale(); log << "\t Double_t scale[] = {"; for(size_t i=0; sca && i<3; ++i) { log << sca[i];