diff --git a/DDCore/include/XML/detail/Detector.imp b/DDCore/include/XML/detail/Detector.imp index d08bda102db75abceef02ad7762e755730e73463..bc983bea5e131e6e321c7136edbf50ed864e9815 100644 --- a/DDCore/include/XML/detail/Detector.imp +++ b/DDCore/include/XML/detail/Detector.imp @@ -24,22 +24,20 @@ #include "DD4hep/Plugins.h" #include "DD4hep/Detector.h" -using namespace std; - namespace detail { class Detector; } -string Component::materialStr() const { - return m_element.attr < string > (_U(material)); +std::string Component::materialStr() const { + return m_element.attr < std::string > (_U(material)); } bool Component::isSensitive() const { - char val = m_element.hasAttr(_U(sensitive)) ? m_element.attr < string > (_U(sensitive))[0] : 'f'; + char val = m_element.hasAttr(_U(sensitive)) ? m_element.attr < std::string > (_U(sensitive))[0] : 'f'; val = ::toupper(val); return val == 'T' || val == 'Y'; } bool Component::isRadiator() const { - char val = m_element.hasAttr(_U(radiator)) ? m_element.attr < string > (_U(radiator))[0] : 'f'; + char val = m_element.hasAttr(_U(radiator)) ? m_element.attr < std::string > (_U(radiator))[0] : 'f'; val = ::toupper(val); return val == 'T' || val == 'Y'; } @@ -47,15 +45,15 @@ bool Component::isRadiator() const { dd4hep::NamedObject* Component::createShape() const { using namespace dd4hep::detail; Dimension child_dim(m_element); - string typ = child_dim.typeStr(); - string fac = typ + "__shape_constructor"; + std::string typ = child_dim.typeStr(); + std::string fac = typ + "__shape_constructor"; Handle_t solid_elt = m_element; Detector* description = 0; NamedObject* solid = PluginService::Create<NamedObject*>(fac, description, &solid_elt); if ( !solid ) { PluginDebug dbg; PluginService::Create<NamedObject*>(typ, description, &solid_elt); - throw runtime_error("Failed to create solid of type " + typ + ". " + dbg.missingFactory(typ)); + throw std::runtime_error("Failed to create solid of type " + typ + ". " + dbg.missingFactory(typ)); } return solid; } @@ -65,29 +63,29 @@ int DetElement::id() const { } bool DetElement::isSensitive() const { - char val = m_element.hasAttr(_U(sensitive)) ? m_element.attr < string > (_U(sensitive))[0] : 'f'; + char val = m_element.hasAttr(_U(sensitive)) ? m_element.attr < std::string > (_U(sensitive))[0] : 'f'; val = ::toupper(val); return val == 'T' || val == 'Y'; } -string DetElement::materialStr() const { +std::string DetElement::materialStr() const { Handle_t h = m_element.child(_U(material)); if (h && h.hasAttr(_U(name))) { - return h.attr < string > (_U(name)); + return h.attr < std::string > (_U(name)); } return ""; } -void DetElement::check(bool condition, const string& msg) const { +void DetElement::check(bool condition, const std::string& msg) const { if (condition) { - throw runtime_error(msg); + throw std::runtime_error(msg); } } bool DetElement::isTracker() const { if (m_element) { - string typ = attr < string > (_U(type)); - if (typ.find("Tracker") != string::npos && hasAttr(_U(readout))) { + std::string typ = attr < std::string > (_U(type)); + if (typ.find("Tracker") != std::string::npos && hasAttr(_U(readout))) { return true; } } @@ -96,8 +94,8 @@ bool DetElement::isTracker() const { bool DetElement::isCalorimeter() const { if (m_element) { - string typ = attr < string > (_U(type)); - if (typ.find("Calorimeter") != string::npos && hasAttr(_U(readout))) { + std::string typ = attr < std::string > (_U(type)); + if (typ.find("Calorimeter") != std::string::npos && hasAttr(_U(readout))) { return true; } } diff --git a/DDCore/src/plugins/LCDDConverter.cpp b/DDCore/src/plugins/LCDDConverter.cpp index 79ff884e4559db976008f6e655cf0d0ebcabe0d6..dfbb8d3c84335fb54b8be42d9c6a110dd9dde1bd 100644 --- a/DDCore/src/plugins/LCDDConverter.cpp +++ b/DDCore/src/plugins/LCDDConverter.cpp @@ -161,8 +161,8 @@ xml_h LCDDConverter::handleMaterial(const string& name, Material medium) const { xml_h mat = geo.xmlMaterials[medium]; if (!mat) { xml_h obj; - TGeoMaterial* m = medium->GetMaterial(); - double d = m->GetDensity(); //*(gram/cm3); + TGeoMaterial* geo_mat = medium->GetMaterial(); + double d = geo_mat->GetDensity(); //*(gram/cm3); if (d < 1e-10) d = 1e-10; mat = xml_elt_t(geo.doc, _U(material)); mat.setAttr(_U(name), medium->GetName()); @@ -173,10 +173,10 @@ xml_h LCDDConverter::handleMaterial(const string& name, Material medium) const { geo.checkMaterial(name, medium); - if (m->IsMixture()) { - TGeoMixture *mix = (TGeoMixture*) m; + if (geo_mat->IsMixture()) { + TGeoMixture *mix = (TGeoMixture*)geo_mat; const double *wmix = mix->GetWmixt(); - const int *nmix = mix->GetNmixt(); + const int *nmix = mix->GetNmixt(); double sum = 0e0; for (int i = 0, n = mix->GetNelements(); i < n; i++) { TGeoElement *elt = mix->GetElement(i); @@ -200,15 +200,15 @@ xml_h LCDDConverter::handleMaterial(const string& name, Material medium) const { else if ( name != "dummy" ) { // Do not exactly know where dummy comes from, // but it causes havoc in Geant4 later - TGeoElement *elt = m->GetElement(0); + TGeoElement *elt = geo_mat->GetElement(0); printout(INFO,"++ Converting non mixing material: %s",name.c_str()); xml_elt_t atom(geo.doc, _U(atom)); handleElement(elt->GetName(), Atom(elt)); mat.append(atom); - mat.setAttr(_U(Z), m->GetZ()); + mat.setAttr(_U(Z), geo_mat->GetZ()); atom.setAttr(_U(type), "A"); atom.setAttr(_U(unit), "g/mol"); - atom.setAttr(_U(value), m->GetA() /* *(g/mole) */); + atom.setAttr(_U(value), geo_mat->GetA() /* *(g/mole) */); } geo.doc_materials.append(mat); geo.xmlMaterials[medium] = mat; @@ -486,7 +486,7 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con TGeoShape* rs = boolean->GetRightShape(); xml_h left = handleSolid(ls->GetName(), ls); xml_h right = handleSolid(rs->GetName(), rs); - xml_h first(0), second(0); + xml_h first_solid(0), second_solid(0); if (!left) { throw runtime_error("G4Converter: No left Detector Solid present for composite shape:" + name); } @@ -536,13 +536,13 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con string rnam = right.attr<string>(_U(name)); geo.doc_solids.append(solid); - solid.append(first = xml_elt_t(geo.doc, _U(first))); + solid.append(first_solid = xml_elt_t(geo.doc, _U(first))); solid.setAttr(_U(name), Unicode(shape_name)); - first.setAttr(_U(ref), lnam); + first_solid.setAttr(_U(ref), lnam); const double *tr = lm->GetTranslation(); if ((tr[0] != 0.0) || (tr[1] != 0.0) || (tr[2] != 0.0)) { - first.append(obj = xml_elt_t(geo.doc, _U(firstposition))); + first_solid.append(obj = xml_elt_t(geo.doc, _U(firstposition))); obj.setAttr(_U(name), name+"_"+lnam+"_pos"); obj.setAttr(_U(x), tr[0]); obj.setAttr(_U(y), tr[1]); @@ -551,9 +551,9 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con } if (lm->IsRotation()) { TGeoMatrix& linv = lm->Inverse(); - XYZRotation rot = getXYZangles(linv.GetRotationMatrix()); + XYZRotation rot = getXYZangles(linv.GetRotationMatrix()); if ((rot.X() != 0.0) || (rot.Y() != 0.0) || (rot.Z() != 0.0)) { - first.append(obj = xml_elt_t(geo.doc, _U(firstrotation))); + first_solid.append(obj = xml_elt_t(geo.doc, _U(firstrotation))); obj.setAttr(_U(name), name+"_"+lnam+"_rot"); obj.setAttr(_U(x), rot.X()); obj.setAttr(_U(y), rot.Y()); @@ -562,8 +562,8 @@ xml_h LCDDConverter::handleSolid(const string& name, const TGeoShape* shape) con } } tr = rm->GetTranslation(); - solid.append(second = xml_elt_t(geo.doc, _U(second))); - second.setAttr(_U(ref), rnam); + solid.append(second_solid = xml_elt_t(geo.doc, _U(second))); + second_solid.setAttr(_U(ref), rnam); if ((tr[0] != 0.0) || (tr[1] != 0.0) || (tr[2] != 0.0)) { xml_ref_t pos = handlePosition(rnam+"_pos", rm); solid.setRef(_U(positionref), pos.name()); @@ -962,7 +962,7 @@ xml_h LCDDConverter::handleVis(const string& /* name */, VisAttr attr) const { GeometryInfo& geo = data(); xml_h vis = geo.xmlVis[attr]; if (!vis) { - float r = 0, g = 0, b = 0; + float red = 0, green = 0, blue = 0; int style = attr.lineStyle(); int draw = attr.drawingStyle(); @@ -980,11 +980,11 @@ xml_h LCDDConverter::handleVis(const string& /* name */, VisAttr attr) const { vis.setAttr(_U(drawing_style), "wireframe"); xml_h col = xml_elt_t(geo.doc, _U(color)); - attr.rgb(r, g, b); + attr.rgb(red, green, blue); col.setAttr(_U(alpha), attr.alpha()); - col.setAttr(_U(R), r); - col.setAttr(_U(G), g); - col.setAttr(_U(B), b); + col.setAttr(_U(R), red); + col.setAttr(_U(B), blue); + col.setAttr(_U(G), green); vis.append(col); geo.xmlVis[attr] = vis; } diff --git a/DDDetectors/src/CylinderShell_geo.cpp b/DDDetectors/src/CylinderShell_geo.cpp index 453f4c8aef06b87bc3f066eb4ad3dd9361d1054a..8029d6876e4147a1d3523aeee990946d86439190 100644 --- a/DDDetectors/src/CylinderShell_geo.cpp +++ b/DDDetectors/src/CylinderShell_geo.cpp @@ -1,4 +1,3 @@ -// $Id$ //==================================================================== // AIDA Detector description implementation //-------------------------------------------------------------------- @@ -55,12 +54,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s PlacedVolume pv; sensitive.setType("escape_counter"); - for(xml_coll_t m(e,_U(module)); m; ++m) { - xml_comp_t mod = m; + for(xml_coll_t xm(e,_U(module)); xm; ++xm) { + xml_comp_t mod = xm; vector<double> rmin,rmax,z; string vis = mod.visStr().empty() ? x_det.visStr() : mod.visStr(); int num = 0; - for(xml_coll_t c(m,_U(zplane)); c; ++c, ++num) { + for(xml_coll_t c(mod,_U(zplane)); c; ++c, ++num) { xml_comp_t dim(c); rmin.push_back(dim.rmin()); rmax.push_back(dim.rmax()); diff --git a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp index 6256d2ff5eac694e9e0a4748f43cd60df4ae26b3..83f6e1df76b9bd3fa628dd75c55f3d181c46e1c0 100644 --- a/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalBarrelCalorimeter_geo.cpp @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation //-------------------------------------------------------------------------- @@ -36,17 +35,17 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s for(xml_coll_t c(x_det,_U(layer)); c; ++c) { xml_comp_t x_layer = c; - for(int i=0, m=0, repeat=x_layer.repeat(); i<repeat; ++i, m=0) { + for(int i=0, im=0, repeat=x_layer.repeat(); i<repeat; ++i, im=0) { string layer_name = det_name + _toString(n,"_layer%d"); double rlayer = r; Tube layer_tub(rmin,rlayer,2*z); Volume layer_vol(layer_name,layer_tub,air); - for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++m) { + for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++im) { xml_comp_t x_slice = l; double router = r + x_slice.thickness(); Material slice_mat = description.material(x_slice.materialStr()); - string slice_name = layer_name + _toString(m,"slice%d"); + string slice_name = layer_name + _toString(im,"slice%d"); Tube slice_tube(r,router,z*2); Volume slice_vol (slice_name,slice_tube,slice_mat); diff --git a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp index 4530d1836a3f9c72ba6a6911d0178e5c97c237f2..ff9417d5147cb81d1d54df35c38ab0edb7461361 100644 --- a/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp +++ b/DDDetectors/src/CylindricalEndcapCalorimeter_geo.cpp @@ -1,4 +1,3 @@ -// $Id: $ //========================================================================== // AIDA Detector description implementation //-------------------------------------------------------------------------- @@ -45,12 +44,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s double layerWidth = 0; for(xml_coll_t l(x_layer,_U(slice)); l; ++l) layerWidth += xml_comp_t(l).thickness(); - for(int i=0, m=0, repeat=x_layer.repeat(); i<repeat; ++i) { + for(int i=0, im=0, repeat=x_layer.repeat(); i<repeat; ++i) { double zlayer = z; string layer_name = det_name + _toString(layer_num,"_layer%d"); Volume layer_vol(layer_name,Tube(rmin,rmax,layerWidth),air); - for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++m) { + for(xml_coll_t l(x_layer,_U(slice)); l; ++l, ++im) { xml_comp_t x_slice = l; double w = x_slice.thickness(); string slice_name = layer_name + _toString(m+1,"slice%d"); diff --git a/DDDetectors/src/MultiLayerTracker_geo.cpp b/DDDetectors/src/MultiLayerTracker_geo.cpp index 114dd3706cd3c8016e335fdc07a694086d3db213..4798586af1f5f73fa3ef8d33dec1a87bb3ca393b 100644 --- a/DDDetectors/src/MultiLayerTracker_geo.cpp +++ b/DDDetectors/src/MultiLayerTracker_geo.cpp @@ -38,12 +38,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s DetElement layer(sdet,_toString(n,"layer%d"),x_layer.id()); Tube l_tub (rmin,2*rmin,z); Volume l_vol(l_name,l_tub,air); - int m = 0; + int im = 0; - for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++m) { + for(xml_coll_t j(x_layer,_U(slice)); j; ++j, ++im) { xml_comp_t x_slice = j; Material mat = description.material(x_slice.materialStr()); - string s_name= l_name+_toString(m,"_slice%d"); + string s_name= l_name+_toString(im,"_slice%d"); double thickness = x_slice.thickness(); Tube s_tub(r,r+thickness,z,2*M_PI); Volume s_vol(s_name, s_tub, mat); @@ -57,7 +57,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s s_vol.setAttributes(description,x_slice.regionStr(),x_slice.limitsStr(),x_slice.visStr()); pv = l_vol.placeVolume(s_vol); // Slices have no extra id. Take the ID of the layer! - pv.addPhysVolID("slice",m); + pv.addPhysVolID("slice",im); } l_tub.setDimensions(rmin,r,z); //cout << l_name << " " << rmin << " " << r << " " << z << endl; diff --git a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp index c5b6eb8215eddb9e4fb0c3f4dfbd74ac00c8e7da..8d92071d07c931d78e4ac9e24dc3609d83cfb51c 100644 --- a/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp +++ b/DDDetectors/src/PolyhedraEndcapCalorimeter2_geo.cpp @@ -65,9 +65,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s PlacedVolume s_phv = l_vol.placeVolume(s_vol,Position(0,0,sliceZ)); s_phv.addPhysVolID("slice",s_num); if ( x_slice.isSensitive() ) { - sens.setType("calorimeter"); - s_vol.setSensitiveDetector(sens); - sensitives.push_back(s_phv); + sens.setType("calorimeter"); + s_vol.setSensitiveDetector(sens); + sensitives.push_back(s_phv); } sliceZ += s_thick/2; s_num++; @@ -82,9 +82,9 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s pv.addPhysVolID("layer", l_num); layer_elt.setPlacement(pv); for(size_t ic=0; ic<sensitives.size(); ++ic) { - PlacedVolume sens_pv = sensitives[ic]; - DetElement comp_elt(layer_elt,sens_pv.volume().name(),l_num); - comp_elt.setPlacement(sens_pv); + PlacedVolume sens_pv = sensitives[ic]; + DetElement comp_elt(layer_elt,sens_pv.volume().name(),l_num); + comp_elt.setPlacement(sens_pv); } layerZ += l_thick/2; ++l_num; @@ -104,12 +104,12 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s DetElement sdetB = endcap.clone(det_name+"_B",x_det.id()); pv = assembly.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,0,0), - Position(0,0,z_pos))); + Position(0,0,z_pos))); pv.addPhysVolID("barrel", 1); sdetA.setPlacement(pv); pv = assembly.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,M_PI,0), - Position(0,0,-z_pos))); + Position(0,0,-z_pos))); pv.addPhysVolID("barrel", 2); sdetB.setPlacement(pv); @@ -122,7 +122,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s } Volume motherVol = description.pickMotherVolume(endcap); pv = motherVol.placeVolume(endcapVol,Transform3D(RotationZYX(M_PI/numsides,0,0), - Position(0,0,z_pos))); + Position(0,0,z_pos))); pv.addPhysVolID("system", det_id); pv.addPhysVolID("barrel", 1); endcap.setPlacement(pv); diff --git a/DDG4/src/Geant4Converter.cpp b/DDG4/src/Geant4Converter.cpp index bcd500e16bad3035a32607103fc680be66639f7f..aa62584ecaf969ed293991214840500b99e7fa71 100644 --- a/DDG4/src/Geant4Converter.cpp +++ b/DDG4/src/Geant4Converter.cpp @@ -416,103 +416,103 @@ void* Geant4Converter::handleSolid(const string& name, const TGeoShape* shape) c return solid; } else if (shape->IsA() == TGeoBBox::Class()) { - const TGeoBBox* s = (const TGeoBBox*) shape; - solid = new G4Box(name, s->GetDX() * CM_2_MM, s->GetDY() * CM_2_MM, s->GetDZ() * CM_2_MM); + const TGeoBBox* sh = (const TGeoBBox*) shape; + solid = new G4Box(name, sh->GetDX() * CM_2_MM, sh->GetDY() * CM_2_MM, sh->GetDZ() * CM_2_MM); } else if (shape->IsA() == TGeoTube::Class()) { - const TGeoTube* s = (const TGeoTube*) shape; - solid = new G4Tubs(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetDz() * CM_2_MM, 0, 2. * M_PI); + const TGeoTube* sh = (const TGeoTube*) shape; + solid = new G4Tubs(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetDz() * CM_2_MM, 0, 2. * M_PI); } else if (shape->IsA() == TGeoTubeSeg::Class()) { - const TGeoTubeSeg* s = (const TGeoTubeSeg*) shape; - solid = new G4Tubs(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetDz() * CM_2_MM, - s->GetPhi1() * DEGREE_2_RAD, (s->GetPhi2()-s->GetPhi1()) * DEGREE_2_RAD); + const TGeoTubeSeg* sh = (const TGeoTubeSeg*) shape; + solid = new G4Tubs(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetDz() * CM_2_MM, + sh->GetPhi1() * DEGREE_2_RAD, (sh->GetPhi2()-sh->GetPhi1()) * DEGREE_2_RAD); } else if (shape->IsA() == TGeoEltu::Class()) { - const TGeoEltu* s = (const TGeoEltu*) shape; - solid = new G4EllipticalTube(name,s->GetA() * CM_2_MM, s->GetB() * CM_2_MM, s->GetDz() * CM_2_MM); + const TGeoEltu* sh = (const TGeoEltu*) shape; + solid = new G4EllipticalTube(name,sh->GetA() * CM_2_MM, sh->GetB() * CM_2_MM, sh->GetDz() * CM_2_MM); } else if (shape->IsA() == TGeoTrd1::Class()) { - const TGeoTrd1* s = (const TGeoTrd1*) shape; - solid = new G4Trd(name, s->GetDx1() * CM_2_MM, s->GetDx2() * CM_2_MM, s->GetDy() * CM_2_MM, s->GetDy() * CM_2_MM, - s->GetDz() * CM_2_MM); + const TGeoTrd1* sh = (const TGeoTrd1*) shape; + solid = new G4Trd(name, sh->GetDx1() * CM_2_MM, sh->GetDx2() * CM_2_MM, sh->GetDy() * CM_2_MM, sh->GetDy() * CM_2_MM, + sh->GetDz() * CM_2_MM); } else if (shape->IsA() == TGeoTrd2::Class()) { - const TGeoTrd2* s = (const TGeoTrd2*) shape; - solid = new G4Trd(name, s->GetDx1() * CM_2_MM, s->GetDx2() * CM_2_MM, s->GetDy1() * CM_2_MM, s->GetDy2() * CM_2_MM, - s->GetDz() * CM_2_MM); + const TGeoTrd2* sh = (const TGeoTrd2*) shape; + solid = new G4Trd(name, sh->GetDx1() * CM_2_MM, sh->GetDx2() * CM_2_MM, sh->GetDy1() * CM_2_MM, sh->GetDy2() * CM_2_MM, + sh->GetDz() * CM_2_MM); } else if (shape->IsA() == TGeoHype::Class()) { - const TGeoHype* s = (const TGeoHype*) shape; - solid = new G4Hype(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, - s->GetStIn() * DEGREE_2_RAD, s->GetStOut() * DEGREE_2_RAD, - s->GetDz() * CM_2_MM); + const TGeoHype* sh = (const TGeoHype*) shape; + solid = new G4Hype(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, + sh->GetStIn() * DEGREE_2_RAD, sh->GetStOut() * DEGREE_2_RAD, + sh->GetDz() * CM_2_MM); } else if (shape->IsA() == TGeoPgon::Class()) { - const TGeoPgon* s = (const TGeoPgon*) shape; - double phi_start = s->GetPhi1() * DEGREE_2_RAD; - double phi_total = (s->GetDphi() + s->GetPhi1()) * DEGREE_2_RAD; + const TGeoPgon* sh = (const TGeoPgon*) shape; + double phi_start = sh->GetPhi1() * DEGREE_2_RAD; + double phi_total = (sh->GetDphi() + sh->GetPhi1()) * DEGREE_2_RAD; vector<double> rmin, rmax, z; - for (Int_t i = 0; i < s->GetNz(); ++i) { - rmin.push_back(s->GetRmin(i) * CM_2_MM); - rmax.push_back(s->GetRmax(i) * CM_2_MM); - z.push_back(s->GetZ(i) * CM_2_MM); + for (Int_t i = 0; i < sh->GetNz(); ++i) { + rmin.push_back(sh->GetRmin(i) * CM_2_MM); + rmax.push_back(sh->GetRmax(i) * CM_2_MM); + z.push_back(sh->GetZ(i) * CM_2_MM); } - solid = new G4Polyhedra(name, phi_start, phi_total, s->GetNedges(), s->GetNz(), &z[0], &rmin[0], &rmax[0]); + solid = new G4Polyhedra(name, phi_start, phi_total, sh->GetNedges(), sh->GetNz(), &z[0], &rmin[0], &rmax[0]); } else if (shape->IsA() == TGeoPcon::Class()) { - const TGeoPcon* s = (const TGeoPcon*) shape; - double phi_start = s->GetPhi1() * DEGREE_2_RAD; - double phi_total = (s->GetDphi() + s->GetPhi1()) * DEGREE_2_RAD; + const TGeoPcon* sh = (const TGeoPcon*) shape; + double phi_start = sh->GetPhi1() * DEGREE_2_RAD; + double phi_total = (sh->GetDphi() + sh->GetPhi1()) * DEGREE_2_RAD; vector<double> rmin, rmax, z; - for (Int_t i = 0; i < s->GetNz(); ++i) { - rmin.push_back(s->GetRmin(i) * CM_2_MM); - rmax.push_back(s->GetRmax(i) * CM_2_MM); - z.push_back(s->GetZ(i) * CM_2_MM); + for (Int_t i = 0; i < sh->GetNz(); ++i) { + rmin.push_back(sh->GetRmin(i) * CM_2_MM); + rmax.push_back(sh->GetRmax(i) * CM_2_MM); + z.push_back(sh->GetZ(i) * CM_2_MM); } - solid = new G4Polycone(name, phi_start, phi_total, s->GetNz(), &z[0], &rmin[0], &rmax[0]); + solid = new G4Polycone(name, phi_start, phi_total, sh->GetNz(), &z[0], &rmin[0], &rmax[0]); } else if (shape->IsA() == TGeoCone::Class()) { - const TGeoCone* s = (const TGeoCone*) shape; - solid = new G4Cons(name, s->GetRmin1() * CM_2_MM, s->GetRmax1() * CM_2_MM, s->GetRmin2() * CM_2_MM, - s->GetRmax2() * CM_2_MM, s->GetDz() * CM_2_MM, 0.0, 2.*M_PI); + const TGeoCone* sh = (const TGeoCone*) shape; + solid = new G4Cons(name, sh->GetRmin1() * CM_2_MM, sh->GetRmax1() * CM_2_MM, sh->GetRmin2() * CM_2_MM, + sh->GetRmax2() * CM_2_MM, sh->GetDz() * CM_2_MM, 0.0, 2.*M_PI); } else if (shape->IsA() == TGeoConeSeg::Class()) { - const TGeoConeSeg* s = (const TGeoConeSeg*) shape; - solid = new G4Cons(name, s->GetRmin1() * CM_2_MM, s->GetRmax1() * CM_2_MM, - s->GetRmin2() * CM_2_MM, s->GetRmax2() * CM_2_MM, - s->GetDz() * CM_2_MM, - s->GetPhi1() * DEGREE_2_RAD, (s->GetPhi2()-s->GetPhi1()) * DEGREE_2_RAD); + const TGeoConeSeg* sh = (const TGeoConeSeg*) shape; + solid = new G4Cons(name, sh->GetRmin1() * CM_2_MM, sh->GetRmax1() * CM_2_MM, + sh->GetRmin2() * CM_2_MM, sh->GetRmax2() * CM_2_MM, + sh->GetDz() * CM_2_MM, + sh->GetPhi1() * DEGREE_2_RAD, (sh->GetPhi2()-sh->GetPhi1()) * DEGREE_2_RAD); } else if (shape->IsA() == TGeoParaboloid::Class()) { - const TGeoParaboloid* s = (const TGeoParaboloid*) shape; - solid = new G4Paraboloid(name, s->GetDz() * CM_2_MM, s->GetRlo() * CM_2_MM, s->GetRhi() * CM_2_MM); + const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; + solid = new G4Paraboloid(name, sh->GetDz() * CM_2_MM, sh->GetRlo() * CM_2_MM, sh->GetRhi() * CM_2_MM); } #if 0 /* Not existent */ else if (shape->IsA() == TGeoEllisoid::Class()) { - const TGeoParaboloid* s = (const TGeoParaboloid*) shape; - solid = new G4Paraboloid(name, s->GetDz() * CM_2_MM, s->GetRlo() * CM_2_MM, s->GetRhi() * CM_2_MM); + const TGeoParaboloid* sh = (const TGeoParaboloid*) shape; + solid = new G4Paraboloid(name, sh->GetDz() * CM_2_MM, sh->GetRlo() * CM_2_MM, sh->GetRhi() * CM_2_MM); } #endif else if (shape->IsA() == TGeoSphere::Class()) { - const TGeoSphere* s = (const TGeoSphere*) shape; - solid = new G4Sphere(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetPhi1() * DEGREE_2_RAD, - s->GetPhi2() * DEGREE_2_RAD, s->GetTheta1() * DEGREE_2_RAD, s->GetTheta2() * DEGREE_2_RAD); + const TGeoSphere* sh = (const TGeoSphere*) shape; + solid = new G4Sphere(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetPhi1() * DEGREE_2_RAD, + sh->GetPhi2() * DEGREE_2_RAD, sh->GetTheta1() * DEGREE_2_RAD, sh->GetTheta2() * DEGREE_2_RAD); } else if (shape->IsA() == TGeoTorus::Class()) { - const TGeoTorus* s = (const TGeoTorus*) shape; - solid = new G4Torus(name, s->GetRmin() * CM_2_MM, s->GetRmax() * CM_2_MM, s->GetR() * CM_2_MM, - s->GetPhi1() * DEGREE_2_RAD, s->GetDphi() * DEGREE_2_RAD); + const TGeoTorus* sh = (const TGeoTorus*) shape; + solid = new G4Torus(name, sh->GetRmin() * CM_2_MM, sh->GetRmax() * CM_2_MM, sh->GetR() * CM_2_MM, + sh->GetPhi1() * DEGREE_2_RAD, sh->GetDphi() * DEGREE_2_RAD); } else if (shape->IsA() == TGeoTrap::Class()) { - const TGeoTrap* s = (const TGeoTrap*) shape; - solid = new G4Trap(name, s->GetDz() * CM_2_MM, s->GetTheta(), s->GetPhi(), - s->GetH1() * CM_2_MM, s->GetBl1() * CM_2_MM, s->GetTl1() * CM_2_MM, s->GetAlpha1() * DEGREE_2_RAD, - s->GetH2() * CM_2_MM, s->GetBl2() * CM_2_MM, s->GetTl2() * CM_2_MM, s->GetAlpha2() * DEGREE_2_RAD); + const TGeoTrap* sh = (const TGeoTrap*) shape; + solid = new G4Trap(name, sh->GetDz() * CM_2_MM, sh->GetTheta(), sh->GetPhi(), + sh->GetH1() * CM_2_MM, sh->GetBl1() * CM_2_MM, sh->GetTl1() * CM_2_MM, sh->GetAlpha1() * DEGREE_2_RAD, + sh->GetH2() * CM_2_MM, sh->GetBl2() * CM_2_MM, sh->GetTl2() * CM_2_MM, sh->GetAlpha2() * DEGREE_2_RAD); } else if (shape->IsA() == TGeoCompositeShape::Class()) { - 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(); TGeoMatrix* m = boolean->GetRightMatrix(); G4VSolid* left = (G4VSolid*) handleSolid(name + "_left", boolean->GetLeftShape()); @@ -598,12 +598,12 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume PrintLevel lvl = debugVolumes ? ALWAYS : outputLevel; const TGeoVolume* v = volume; Volume _v = Ref_t(v); - string n = v->GetName(); - TGeoMedium* m = v->GetMedium(); - TGeoShape* s = v->GetShape(); - G4VSolid* solid = (G4VSolid*) handleSolid(s->GetName(), s); + string n = v->GetName(); + TGeoMedium* med = v->GetMedium(); + TGeoShape* sh = v->GetShape(); + G4VSolid* solid = (G4VSolid*) handleSolid(sh->GetName(), sh); G4Material* medium = 0; - bool assembly = s->IsA() == TGeoShapeAssembly::Class() || v->IsA() == TGeoVolumeAssembly::Class(); + bool assembly = sh->IsA() == TGeoShapeAssembly::Class() || v->IsA() == TGeoVolumeAssembly::Class(); LimitSet lim = _v.limitSet(); G4UserLimits* user_limits = 0; @@ -629,13 +629,13 @@ void* Geant4Converter::handleVolume(const string& name, const TGeoVolume* volume } } printout(lvl, "Geant4Converter", "++ Convert Volume %-32s: %p %s/%s assembly:%s", - n.c_str(), v, s->IsA()->GetName(), v->IsA()->GetName(), yes_no(assembly)); + n.c_str(), v, sh->IsA()->GetName(), v->IsA()->GetName(), yes_no(assembly)); if (assembly) { //info.g4AssemblyVolumes[v] = new Geant4AssemblyVolume(); return 0; } - medium = (G4Material*) handleMaterial(m->GetName(), Material(m)); + medium = (G4Material*) handleMaterial(med->GetName(), Material(med)); if (!solid) { throw runtime_error("G4Converter: No Geant4 Solid present for volume:" + n); } @@ -884,10 +884,10 @@ void* Geant4Converter::handleVis(const string& /* name */, VisAttr attr) const { Geant4GeometryInfo& info = data(); G4VisAttributes* g4 = info.g4Vis[attr]; if (!g4) { - float r = 0, g = 0, b = 0; + float red = 0, green = 0, blue = 0; int style = attr.lineStyle(); - attr.rgb(r, g, b); - g4 = new G4VisAttributes(attr.visible(), G4Colour(r, g, b, attr.alpha())); + attr.rgb(red, green, blue); + g4 = new G4VisAttributes(attr.visible(), G4Colour(red, green, blue, attr.alpha())); //g4->SetLineWidth(attr->GetLineWidth()); g4->SetDaughtersInvisible(!attr.showDaughters()); if (style == VisAttr::SOLID) {