diff --git a/DDCond/src/ConditionsDependencyHandler.cpp b/DDCond/src/ConditionsDependencyHandler.cpp index 602b023dcd809911375ea82516c4055483e46e3b..d0f5fd672ef500272a7a6426551353cb5f440ea4 100644 --- a/DDCond/src/ConditionsDependencyHandler.cpp +++ b/DDCond/src/ConditionsDependencyHandler.cpp @@ -176,8 +176,8 @@ std::vector<Condition> ConditionsDependencyHandler::getByItem(Condition::itemkey Condition::itemkey_type key; item_selector(Condition::itemkey_type k) : key(k) {} int operator()(Condition cond) { - ConditionKey::KeyMaker km(cond->hash); - if ( km.values.item_key == key ) conditions.emplace_back(cond); + ConditionKey::KeyMaker maker(cond->hash); + if ( maker.values.item_key == key ) conditions.emplace_back(cond); return 1; } }; diff --git a/DDCond/src/plugins/ConditionsUserPool.cpp b/DDCond/src/plugins/ConditionsUserPool.cpp index 8d91dfad8918a0b74db72fa69a83dfaeb9068422..1805bf716c0316da23ba4dc02d5c245614152653 100644 --- a/DDCond/src/plugins/ConditionsUserPool.cpp +++ b/DDCond/src/plugins/ConditionsUserPool.cpp @@ -588,8 +588,8 @@ ConditionsMappedUserPool<MAPPING>::prepare(const IOV& required, } else if ( do_output_miss ) { copy(begin(cond_missing), last_cond, 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()); } } } diff --git a/DDCore/src/GeometryTreeDump.cpp b/DDCore/src/GeometryTreeDump.cpp index 43ae6f8bedd329264dc7d2978643afb78c4cbcd1..bef918f13f609948ddacc6a88ee11b72d85e116e 100644 --- a/DDCore/src/GeometryTreeDump.cpp +++ b/DDCore/src/GeometryTreeDump.cpp @@ -82,18 +82,17 @@ 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()); - TGeoVolume* v = n->GetVolume(); - TGeoMatrix* m = n->GetMatrix(); + TGeoNode* geo_nod = vol.ptr()->GetNode(vol->GetNode(i)->GetName()); + TGeoVolume* geo_vol = geo_nod->GetVolume(); + TGeoMatrix* geo_mat = geo_nod->GetMatrix(); m_output << "\t\t\t<physvol>" << endl; - m_output << "\t\t\t\t<volumeref ref=\"" << v->GetName() << "\"/>" << endl; - if (m) { - if (m->IsTranslation()) { - m_output << "\t\t\t\t<positionref ref=\"" << n->GetName() << "_pos\"/>" << endl; + m_output << "\t\t\t\t<volumeref ref=\"" << geo_vol->GetName() << "\"/>" << endl; + if (geo_mat) { + if (geo_mat->IsTranslation()) { + m_output << "\t\t\t\t<positionref ref=\"" << geo_nod->GetName() << "_pos\"/>" << endl; } - if (m->IsRotation()) { - m_output << "\t\t\t\t<rotationref ref=\"" << n->GetName() << "_rot\"/>" << endl; + if (geo_mat->IsRotation()) { + m_output << "\t\t\t\t<rotationref ref=\"" << geo_nod->GetName() << "_rot\"/>" << endl; } } m_output << "\t\t\t</physvol>" << endl; @@ -191,25 +190,25 @@ void* GeometryTreeDump::handleSolid(const string& name, const TGeoShape* shape) /// Dump structure information in GDML format to output stream void GeometryTreeDump::handleStructure(const std::set<Volume>& volset) const { m_output << "\t<structure>" << endl; - for (const auto v : volset) - handleVolume(v->GetName(), v); + for (const auto vol : volset) + handleVolume(vol->GetName(), vol); m_output << "\t</structure>" << endl; } /// Dump single volume transformation in GDML format to output stream -void* GeometryTreeDump::handleTransformation(const string& name, const TGeoMatrix* m) const { - if (m) { - if (m->IsTranslation()) { - const Double_t* f = m->GetTranslation(); +void* GeometryTreeDump::handleTransformation(const string& name, const TGeoMatrix* mat) const { + if (mat) { + if (mat->IsTranslation()) { + const Double_t* f = mat->GetTranslation(); m_output << indent << "\t\t<position "; if (!name.empty()) m_output << "name=\"" << name << "_pos\" "; m_output << "x=\"" << f[0] << "\" " << "y=\"" << f[1] << "\" " << "z=\"" << f[2] << "\" unit=\"cm\"/>" << endl; } - if (m->IsRotation()) { - const Double_t* mat = m->GetRotationMatrix(); + if (mat->IsRotation()) { + const Double_t* matrix = mat->GetRotationMatrix(); Double_t theta = 0.0, phi = 0.0, psi = 0.0; - getAngles(mat, theta, phi, psi); + getAngles(matrix, theta, phi, psi); m_output << indent << "\t\t<rotation "; if (!name.empty()) m_output << "name=\"" << name << "_rot\" "; @@ -238,8 +237,8 @@ void GeometryTreeDump::handleSolids(const std::set<TGeoShape*>& solids) const { /// Dump all constants in GDML format to output stream void GeometryTreeDump::handleDefines(const Detector::HandleMap& defs) const { m_output << "\t<define>" << endl; - for (const auto& d : defs ) - m_output << "\t\t<constant name=\"" << d.second->name << "\" value=\"" << d.second->type << "\" />" + for (const auto& def : defs ) + m_output << "\t\t<constant name=\"" << def.second->name << "\" value=\"" << def.second->type << "\" />" << endl; m_output << "\t</define>" << endl; } @@ -285,9 +284,9 @@ static void dumpDetectors(DetElement parent, int level) { ::printf(fmt, level, "", " ->logvol: ", pl->GetVolume()->GetName()); ::printf(fmt, level, "", " ->shape: ", pl->GetVolume()->GetShape()->GetName()); } - for (DetElement::Children::const_iterator i = children.begin(); i != children.end(); ++i) { - dumpDetectors((*i).second, level + 1); - } + for (const auto& c : children) + dumpDetectors(c.second, level + 1); + _path = _path.substr(0, _path.length() - 1 - strlen(parent.name())); } diff --git a/DDCore/src/GlobalAlignment.cpp b/DDCore/src/GlobalAlignment.cpp index 75b480414b134085e8fb5db0c33b48b089e1c5d1..89cfc54fb9fbb436ac556271625e41dfe5ce38cd 100644 --- a/DDCore/src/GlobalAlignment.cpp +++ b/DDCore/src/GlobalAlignment.cpp @@ -83,8 +83,8 @@ Transform3D GlobalAlignment::toGlobal(int level) const { Position GlobalAlignment::toGlobal(const Position& localPoint, int level) const { CheckHandle verify_handle(*this); Position result; - TGeoHMatrix* m = ptr()->GetMatrix(level); - m->LocalToMaster((Double_t*)&localPoint,(Double_t*)&result); + TGeoHMatrix* matrix = ptr()->GetMatrix(level); + matrix->LocalToMaster((Double_t*)&localPoint,(Double_t*)&result); return result; } diff --git a/DDCore/src/OpticalSurfaces.cpp b/DDCore/src/OpticalSurfaces.cpp index f1a1c6baf4cb7548a98c083b7f90f64b2d2ca621..8b423a6925e768a2d434627ebcf95fd966985602 100644 --- a/DDCore/src/OpticalSurfaces.cpp +++ b/DDCore/src/OpticalSurfaces.cpp @@ -106,8 +106,8 @@ BorderSurface::BorderSurface(Detector& detector, if ( de.isValid() ) { if ( lft.isValid() && rht.isValid() ) { if ( surf.isValid() ) { - unique_ptr<Object> s(new Object(nam.c_str(), surf->GetName(), surf.ptr(), lft.ptr(), rht.ptr())); - detector.surfaceManager().addBorderSurface(de, m_element=s.release()); + unique_ptr<Object> obj(new Object(nam.c_str(), surf->GetName(), surf.ptr(), lft.ptr(), rht.ptr())); + detector.surfaceManager().addBorderSurface(de, m_element=obj.release()); return; } except("BorderSurface","++ Cannot create BorderSurface %s without valid optical surface!",nam.c_str()); diff --git a/DDCore/src/SimpleGDMLWriter.cpp b/DDCore/src/SimpleGDMLWriter.cpp deleted file mode 100644 index 3cdd048f442db4c27c42393aa262e2f838cd4c6b..0000000000000000000000000000000000000000 --- a/DDCore/src/SimpleGDMLWriter.cpp +++ /dev/null @@ -1,302 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -// Framework include files -#include "DD4hep/World.h" -#include "DD4hep/Detector.h" -#include "SimpleGDMLWriter.h" - -// ROOT includes -#include "TROOT.h" -#include "TColor.h" -#include "TGeoShape.h" -#include "TGeoCone.h" -#include "TGeoParaboloid.h" -#include "TGeoPcon.h" -#include "TGeoPgon.h" -#include "TGeoSphere.h" -#include "TGeoTorus.h" -#include "TGeoTube.h" -#include "TGeoTrd1.h" -#include "TGeoTrd2.h" -#include "TGeoArb8.h" -#include "TGeoMatrix.h" -#include "TGeoBoolNode.h" -#include "TGeoCompositeShape.h" -#include "TClass.h" -#include "TMath.h" - -// C/C++ include files -#include <iostream> - -using namespace dd4hep::detail; -using namespace dd4hep; -using namespace std; - -namespace { - string indent = ""; - - void getAngles(const Double_t* m, Double_t &phi, Double_t &theta, Double_t &psi) { - // Retreive Euler angles. - // Check if theta is 0 or 180. - if (TMath::Abs(1. - TMath::Abs(m[8])) < 1.e-9) { - theta = TMath::ACos(m[8]) * RAD_2_DEGREE; - phi = TMath::ATan2(-m[8] * m[1], m[0]) * RAD_2_DEGREE; - psi = 0.; // convention, phi+psi matters - return; - } - // sin(theta) != 0 - phi = TMath::ATan2(m[2], -m[5]); - Double_t sphi = TMath::Sin(phi); - if (TMath::Abs(sphi) < 1.e-9) - theta = -TMath::ASin(m[5] / TMath::Cos(phi)) * RAD_2_DEGREE; - else - theta = TMath::ASin(m[2] / sphi) * RAD_2_DEGREE; - phi *= RAD_2_DEGREE; - psi = TMath::ATan2(m[6], m[7]) * RAD_2_DEGREE; - } -} - -/// Dump logical volume in GDML format to output stream -void* SimpleGDMLWriter::handleVolume(const string& name, const TGeoVolume* volume) const { - Volume vol(volume); - VisAttr vis = vol.visAttributes(); - TGeoShape* shape = volume->GetShape(); - TGeoMedium* medium = volume->GetMedium(); - int num = volume->GetNdaughters(); - - m_output << "\t\t<volume name=\"" << name << "\">" << endl; - m_output << "\t\t\t<solidref ref=\"" << shape->GetName() << "\"/>" << endl; - m_output << "\t\t\t<materialref ref=\"" - << (medium ? medium->GetName() : "UnknownMaterial") << "\"/>" << endl; - if (vis.isValid()) { - m_output << "\t\t\t<visref ref=\"" << vis.name() << "\"/>" << endl; - } - if (num > 0) { - for (int i = 0; i < num; ++i) { - TGeoNode* n = volume->GetNode(volume->GetNode(i)->GetName()); - TGeoVolume* v = n->GetVolume(); - TGeoMatrix* m = n->GetMatrix(); - m_output << "\t\t\t<physvol>" << endl; - m_output << "\t\t\t\t<volumeref ref=\"" << v->GetName() << "\"/>" << endl; - if (m) { - if (m->IsTranslation()) { - m_output << "\t\t\t\t<positionref ref=\"" << n->GetName() << "_pos\"/>" << endl; - } - if (m->IsRotation()) { - m_output << "\t\t\t\t<rotationref ref=\"" << n->GetName() << "_rot\"/>" << endl; - } - } - m_output << "\t\t\t</physvol>" << endl; - } - } - m_output << "\t\t</volume>" << endl; - return 0; -} - -/// Dump solid in GDML format to output stream -void* SimpleGDMLWriter::handleSolid(const string& name, const TGeoShape* shape) const { - if (shape) { - if (shape->IsA() == TGeoBBox::Class()) { - 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* 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* 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* 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* 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* 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* 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 < 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* sh = (const TGeoCompositeShape*) shape; - const TGeoBoolNode* boolean = sh->GetBoolNode(); - TGeoBoolNode::EGeoBoolType oper = boolean->GetBooleanOperator(); - - handleSolid(name + "_left", boolean->GetLeftShape()); - handleSolid(name + "_right", boolean->GetRightShape()); - - if (oper == TGeoBoolNode::kGeoSubtraction) - m_output << "\t\t<subtraction name=\"" << nn << "\">" << endl; - else if (oper == TGeoBoolNode::kGeoUnion) - m_output << "\t\t<union name=\"" << nn << "\">" << endl; - else if (oper == TGeoBoolNode::kGeoIntersection) - m_output << "\t\t<intersection name=\"" << nn << "\">" << endl; - - m_output << "\t\t\t<first ref=\"" << nn << "_left\"/>" << endl; - m_output << "\t\t\t<second ref=\"" << nn << "_right\"/>" << endl; - indent = "\t"; - handleTransformation("", boolean->GetRightMatrix()); - indent = ""; - - if (oper == TGeoBoolNode::kGeoSubtraction) - m_output << "\t\t</subtraction>" << endl; - else if (oper == TGeoBoolNode::kGeoUnion) - m_output << "\t\t</union>" << endl; - else if (oper == TGeoBoolNode::kGeoIntersection) - m_output << "\t\t</intersection>" << endl; - } - else { - cerr << "Failed to handle unknwon solid shape:" << shape->IsA()->GetName() << endl; - } - } - return 0; -} - -/// Dump structure information in GDML format to output stream -void SimpleGDMLWriter::handleStructure(const vector<Volume>& volset) const { - m_output << "\t<structure>" << endl; - for ( const auto v : volset ) - handleVolume(v->GetName(), v); - m_output << "\t</structure>" << endl; -} - -/// Dump single volume transformation in GDML format to output stream -void* SimpleGDMLWriter::handleTransformation(const string& name, const TGeoMatrix* m) const { - if (m) { - if (m->IsTranslation()) { - const Double_t* f = m->GetTranslation(); - m_output << indent << "\t\t<position "; - if (!name.empty()) - m_output << "name=\"" << name << "_pos\" "; - m_output << "x=\"" << f[0] << "\" " << "y=\"" << f[1] << "\" " << "z=\"" << f[2] << "\" unit=\"cm\"/>" << endl; - } - if (m->IsRotation()) { - const Double_t* mat = m->GetRotationMatrix(); - Double_t theta = 0.0, phi = 0.0, psi = 0.0; - getAngles(mat, theta, phi, psi); - m_output << indent << "\t\t<rotation "; - if (!name.empty()) - m_output << "name=\"" << name << "_rot\" "; - m_output << "x=\"" << theta << "\" " << "y=\"" << psi << "\" " << "z=\"" << phi << "\" unit=\"deg\"/>" << endl; - } - } - return 0; -} - -/// Dump Transformations in GDML format to output stream -void SimpleGDMLWriter::handleTransformations(const vector<pair<string, TGeoMatrix*> >& trafos) const { - m_output << "\t<define>" << endl; - for (const auto& t : trafos ) - handleTransformation(t.first, t.second); - m_output << "\t</define>" << endl; -} - -/// 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& 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 ) - m_output << "\t\t<constant name=\"" << i.second->GetName() << "\" value=\"" << i.second->GetTitle() << "\" />" - << endl; - m_output << "\t</define>" << endl; -} - -/// 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 ) { - if (v.isValid()) { - float red = 1., green = 1., blue = 1., alpha = 1.; - TColor *color = gROOT->GetColor(v.color()); - if (color) { - color->GetRGB(red, green, blue); - alpha = color->GetAlpha(); - } - const char* line_style = 0, *draw_style = 0; - switch (v.lineStyle()) { - case VisAttr::DASHED: - line_style = "broken"; - break; - case VisAttr::SOLID: - default: - line_style = "unbroken"; - break; - } - switch (v.drawingStyle()) { - case VisAttr::WIREFRAME: - draw_style = "wireframe"; - break; - default: - break; - } - - m_output << "\t\t<vis name=\"" << v.name() << "\" "; - if (line_style) - m_output << "linestyle=\"" << line_style << "\" "; - 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=\"" << red << "\" G=\"" << green << "\" B=\"" << blue << "\" alpha=\"" << alpha << "\" />" << endl - << "\t\t</vis>" << endl; - } - } - m_output << "\t</display>" << endl; -} - -void SimpleGDMLWriter::create(DetElement top) { - GeometryInfo geo; - World world = top.world(); - Detector& description = world.detectorDescription(); - collect(top, geo); - //handleSetup(description.header()); - handleDefines(description.constants()); - handleVisualisation(geo.vis); - handleTransformations(geo.trafos); - handleSolids(geo.solids); - handleStructure(geo.volumes); -} diff --git a/DDCore/src/SimpleGDMLWriter.h b/DDCore/src/SimpleGDMLWriter.h deleted file mode 100644 index 49bd97083674264a9df808691ce7de27291f16d9..0000000000000000000000000000000000000000 --- a/DDCore/src/SimpleGDMLWriter.h +++ /dev/null @@ -1,77 +0,0 @@ -//========================================================================== -// AIDA Detector description implementation -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see $DD4hepINSTALL/LICENSE. -// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. -// -// Author : M.Frank -// -//========================================================================== - -#ifndef DD4HEP_SIMPLEGDMLWRITER_H -#define DD4HEP_SIMPLEGDMLWRITER_H - -// Framework include files -#include "DD4hep/Detector.h" -#include "DD4hep/GeoHandler.h" - -// C/C++ include files -#include <set> -#include <map> -#include <vector> - -// Forward declarations -class TGeoVolume; -class TGeoNode; - -/// Namespace for the AIDA detector description toolkit -namespace dd4hep { - - /// Namespace for implementation details of the AIDA detector description toolkit - namespace detail { - - /// Simple GDML creator from TGeo geometries in memory - /** - * \author M.Frank - * \version 1.0 - * \ingroup DD4HEP_CORE - */ - class SimpleGDMLWriter: public GeoHandler { - public: - /// Reference to output stream - std::ostream& m_output; - - SimpleGDMLWriter(std::ostream& os) - : m_output(os) { - } - /// Standard destructor - virtual ~SimpleGDMLWriter() { - } - /// Main entry point: create required object(s) - void create(DetElement top); - - /// Dump logical volume in GDML format to output stream - virtual void* handleVolume(const std::string& name, const TGeoVolume* volume) const; - /// Dump single volume transformation in GDML format to output stream - virtual void* handleTransformation(const std::string& name, const TGeoMatrix* matrix) const; - /// Dump solid in GDML format to output stream - virtual void* handleSolid(const std::string& name, const TGeoShape* volume) const; - - /// Dump all constants in GDML format to output stream - virtual void handleDefines(const Detector::HandleMap& defs) const; - /// Dump all visualisation specs in Detector format to output stream - void handleVisualisation(const std::set<VisAttr>& vis) const; - /// Dump all solids in GDML format to output stream - virtual void handleSolids(const std::set<TGeoShape*>& solids) const; - /// Dump Transformations in GDML format to output stream - virtual void handleTransformations(const std::vector<std::pair<std::string, TGeoMatrix*> >& trafos) const; - /// Dump structure information in GDML format to output stream - virtual void handleStructure(const std::vector<Volume>& volset) const; - }; - } // End namespace detail -} // End namespace dd4hep - -#endif // DD4HEP_SIMPLEGDMLWRITER_H diff --git a/DDCore/src/VolumeManager.cpp b/DDCore/src/VolumeManager.cpp index c30cc39277806b6ad1597a7eb382ae312c93ca4c..603eee3b9e2abc964aaba2891ab3b4a5ab2a08da 100644 --- a/DDCore/src/VolumeManager.cpp +++ b/DDCore/src/VolumeManager.cpp @@ -389,19 +389,19 @@ VolumeManager VolumeManager::addSubdetector(DetElement det, Readout ro) { i = o.subdetectors.emplace(det, VolumeManager(det,ro)).first; const auto& id = (*vit); - VolumeManager m = (*i).second; + VolumeManager mgr = (*i).second; const BitFieldElement* field = ro.idSpec().field(id.first); if (!field) { throw runtime_error("dd4hep: VolumeManager::addSubdetector: IdDescriptor of " + string(det.name()) + " has no field " + id.first); } - Object& mo = m._data(); + Object& mo = mgr._data(); mo.top = o.top; mo.flags = o.flags; mo.system = field; mo.sysID = id.second; mo.detMask = mo.sysID; - o.managers[mo.sysID] = m; + o.managers[mo.sysID] = mgr; det.callAtUpdate(DetElement::PLACEMENT_CHANGED|DetElement::PLACEMENT_DETECTOR, &mo,&Object::update); } @@ -521,8 +521,8 @@ bool VolumeManager::adoptPlacement(VolumeManagerContext* context) { return top.adoptPlacement(context); } for( auto& j : o.managers ) { - Object& m = j.second._data(); - VolumeID sid = m.system->value(context->identifier); + Object& mgr = j.second._data(); + VolumeID sid = mgr.system->value(context->identifier); if ( j.first == sid ) { return j.second.adoptPlacement(sid, context); } @@ -621,8 +621,8 @@ VolumeManager::worldTransformation(const ConditionsMap& mapping, } /// Enable printouts for debugging -std::ostream& dd4hep::operator<<(std::ostream& os, const VolumeManager& m) { - const VolumeManager::Object& o = *m.data<VolumeManager::Object>(); +std::ostream& dd4hep::operator<<(std::ostream& os, const VolumeManager& mgr) { + const VolumeManager::Object& o = *mgr.data<VolumeManager::Object>(); VolumeManager::Object* top = dynamic_cast<VolumeManager::Object*>(o.top); bool isTop = top == &o; //bool hasTop = (o.flags & VolumeManager::ONE) == VolumeManager::ONE; diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 7e760629f70442d0fbb450a6297470787e0e759a..0dc88e0ca6aebb010999dbc22cce633ffdd8fea4 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1489,30 +1489,6 @@ static long exec_GeometryTreeDump(Detector& description, int, char** ) { } DECLARE_APPLY(DD4hep_GeometryTreeDump,exec_GeometryTreeDump) -/// Basic entry point to dump the geometry in GDML format -/** - * Factory: dd4hepSimpleGDMLWriter - * - * \author M.Frank - * \version 1.0 - * \date 01/04/2014 - */ -#include "../SimpleGDMLWriter.h" -static long exec_SimpleGDMLWriter(Detector& description, int argc, char** argv) { - if ( argc > 1 ) { - string output = argv[1]; - ofstream out(output.c_str()+1,ios_base::out); - SimpleGDMLWriter dmp(out); - dmp.create(description.world()); - } - else { - SimpleGDMLWriter dmp(cout); - dmp.create(description.world()); - } - return 1; -} -DECLARE_APPLY(DD4hep_SimpleGDMLWriter,exec_SimpleGDMLWriter) - /// Basic entry point to print out detector type map /** * Factory: DD4hep_DetectorTypes diff --git a/DDEve/src/View.cpp b/DDEve/src/View.cpp index 0dd245d9341fb5fb8318b3e9fea4a99ec3d9ddff..b2828f4b072ce6b01392dc932a425b3414a6f692 100644 --- a/DDEve/src/View.cpp +++ b/DDEve/src/View.cpp @@ -91,9 +91,9 @@ TEveElementList* View::AddToGlobalItems(const string& nam) { /// Call an element to a event element list TEveElement* View::ImportGeoElement(TEveElement* el, TEveElementList* list) { - TEveScene* s = dynamic_cast<TEveScene*>(el); - if ( s ) { - printf("ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",s->GetName()); + TEveScene* scene = dynamic_cast<TEveScene*>(el); + if ( scene ) { + printf("ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",scene->GetName()); } if ( el ) list->AddElement(el); return el; @@ -106,13 +106,13 @@ TEveElement* View::ImportGeoTopic(TEveElement* element, TEveElementList* list) /// Call an element to a event element list TEveElement* View::ImportEventElement(TEveElement* el, TEveElementList* list) { - TEveScene* s = dynamic_cast<TEveScene*>(el); - if ( s ) { - printf("ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",s->GetName()); + TEveScene* scene = dynamic_cast<TEveScene*>(el); + if ( scene ) { + printf("ERROR: Adding a Scene [%s] to a list. This is BAD and causes crashes!\n",scene->GetName()); } if ( el ) { printout(INFO,"View","ImportElement %s [%s] into list: %s", - Utilities::GetName(el),el->IsA()->GetName(),list->GetName()); + Utilities::GetName(el), el->IsA()->GetName(), list->GetName()); list->AddElement(el); } return el; diff --git a/DDG4/src/Geant4SensDetAction.cpp b/DDG4/src/Geant4SensDetAction.cpp index 15b001acac81935b6448e583aa04ebbf0a305a8f..e392269bbdf265d2be890dfd35e55eaac20094e7 100644 --- a/DDG4/src/Geant4SensDetAction.cpp +++ b/DDG4/src/Geant4SensDetAction.cpp @@ -358,9 +358,9 @@ bool Geant4SensDetActionSequence::accept(const G4Step* step) const { bool Geant4SensDetActionSequence::process(G4Step* step, G4TouchableHistory* hist) { bool result = false; for (vector<Geant4Sensitive*>::iterator i = m_actors->begin(); i != m_actors->end(); ++i) { - Geant4Sensitive* s = *i; - if (s->accept(step)) - result |= s->process(step, hist); + Geant4Sensitive* sensitive = *i; + if (sensitive->accept(step)) + result |= sensitive->process(step, hist); } m_process(step, hist); return result; @@ -374,9 +374,9 @@ void Geant4SensDetActionSequence::begin(G4HCofThisEvent* hce) { m_hce = hce; for (size_t count = 0; count < m_collections.size(); ++count) { const HitCollection& cr = m_collections[count]; - Geant4HitCollection* c = (*cr.second.second)(name(), cr.first, cr.second.first); + Geant4HitCollection* col = (*cr.second.second)(name(), cr.first, cr.second.first); int id = m_detector->GetCollectionID(count); - m_hce->AddHitsCollection(id, c); + m_hce->AddHitsCollection(id, col); } m_actors(&Geant4Sensitive::begin, m_hce); m_begin (m_hce); diff --git a/examples/DDCMS/src/DDCMS.cpp b/examples/DDCMS/src/DDCMS.cpp index 8fabc3bcab592130ad18d6ba21d00319470c70e3..cf46e03f3197bf26aa13f155bb93d12deb4be803 100644 --- a/examples/DDCMS/src/DDCMS.cpp +++ b/examples/DDCMS/src/DDCMS.cpp @@ -332,10 +332,10 @@ xml_h AlgoArguments::raw_arg(const string& nam) const { /// Access namespace resolved argument as a string by name string AlgoArguments::resolved_scalar_arg(const string& nam) const { - Namespace ns(context); + Namespace name_space(context); xml_h arg = raw_arg(nam); string val = arg.attr<string>(_U(value)); - return ns.real_name(val); + return name_space.real_name(val); } namespace {