diff --git a/src/BarrelBarDetectorWithSideFrame_geo.cpp b/src/BarrelBarDetectorWithSideFrame_geo.cpp index 921a0ec0c8a06cfbee24ce56cad5fe6a221792c0..2b014e90e8535a3c42d14e070154d6c2c4a56725 100644 --- a/src/BarrelBarDetectorWithSideFrame_geo.cpp +++ b/src/BarrelBarDetectorWithSideFrame_geo.cpp @@ -93,8 +93,8 @@ static Ref_t create_BarrelBarDetectorWithSideFrame(Detector& description, xml_h double thickness_so_far = 0.0; double thickness_sum = -total_thickness / 2.0; double max_component_width = 0; - for (xml_coll_t ci(x_mod, _U(module_component)); ci; ++ci, ++ncomponents) { - xml_comp_t x_comp = ci; + for (xml_coll_t mci(x_mod, _U(module_component)); mci; ++mci, ++ncomponents) { + xml_comp_t x_comp = mci; string c_nam = _toString(ncomponents, "component%d"); double box_width = x_comp.width() - 2 * frame_width; diff --git a/src/BarrelCalorimeterInterlayers_geo.cpp b/src/BarrelCalorimeterInterlayers_geo.cpp index 848e5b7395f0c6fa0bca28b02ccdd5c5fb09ad26..7199e54f9c479bd2a33b64c327dd5e69a3bb44c7 100644 --- a/src/BarrelCalorimeterInterlayers_geo.cpp +++ b/src/BarrelCalorimeterInterlayers_geo.cpp @@ -52,8 +52,8 @@ static Ref_t create_detector(Detector& desc, xml_h e, SensitiveDetector sens) Volume motherVol = desc.pickMotherVolume(sdet); Assembly envelope(det_name); - Transform3D tr = Translation3D(0, 0, offset) * RotationZ(hphi); - PlacedVolume env_phv = motherVol.placeVolume(envelope, tr); + Transform3D tr_global = Translation3D(0, 0, offset) * RotationZ(hphi); + PlacedVolume env_phv = motherVol.placeVolume(envelope, tr_global); sens.setType("calorimeter"); env_phv.addPhysVolID("system", det_id); @@ -179,7 +179,7 @@ void buildFibers(Detector& desc, SensitiveDetector& sens, Volume& s_vol, xml_com double f_spacing_x = getAttrOrDefault(x_fiber, _Unicode(spacing_x), 0.122 * cm); double f_spacing_z = getAttrOrDefault(x_fiber, _Unicode(spacing_z), 0.134 * cm); std::string f_id_grid = getAttrOrDefault<std::string>(x_fiber, _Unicode(identifier_grid), "grid"); - std::string f_id_fiber = getAttrOrDefault<std::string>(x_fiber, _Unicode(identifier_fiber), "fiber"); + std::string f_id_fiber = getAttrOrDefault<std::string>(x_fiber, _Unicode(identifier_fiber), "fiber"); // Set up the readout grid for the fiber layers // Trapezoid is divided into segments with equal dz and equal number of divisions in x diff --git a/src/BarrelTrackerWithFrame_geo.cpp b/src/BarrelTrackerWithFrame_geo.cpp index e582a5d74bdee0900e04b60f87b9cad1513770c3..d789e71e8c3a6b6f5e358a7c93980abcc302cdf5 100644 --- a/src/BarrelTrackerWithFrame_geo.cpp +++ b/src/BarrelTrackerWithFrame_geo.cpp @@ -166,8 +166,8 @@ static Ref_t create_BarrelTrackerWithFrame(Detector& description, xml_h e, Sensi double thickness_so_far = 0.0; double thickness_sum = -total_thickness / 2.0; - for (xml_coll_t ci(x_mod, _U(module_component)); ci; ++ci, ++ncomponents) { - xml_comp_t x_comp = ci; + for (xml_coll_t mci(x_mod, _U(module_component)); mci; ++mci, ++ncomponents) { + xml_comp_t x_comp = mci; xml_comp_t x_pos = x_comp.position(false); xml_comp_t x_rot = x_comp.rotation(false); const string c_nam = _toString(ncomponents, "component%d"); diff --git a/src/DIRC_geo.cpp b/src/DIRC_geo.cpp index e7d9dfa813cd632b2dc0c8a5964888f2c076cf52..e622f362cf6b11b804c01875a3e687d8fe469c63 100644 --- a/src/DIRC_geo.cpp +++ b/src/DIRC_geo.cpp @@ -49,8 +49,8 @@ static Ref_t createDetector(Detector& desc, xml_h e, SensitiveDetector sens) DetElement det(det_name, det_id); Volume mother_vol = desc.pickMotherVolume(det); - Transform3D tr(RotationZYX(0, dirc_rot.theta(), 0.0), Position(0.0, 0.0, dirc_pos.z())); - PlacedVolume det_plvol = mother_vol.placeVolume(det_volume, tr); + Transform3D tr_global(RotationZYX(0, dirc_rot.theta(), 0.0), Position(0.0, 0.0, dirc_pos.z())); + PlacedVolume det_plvol = mother_vol.placeVolume(det_volume, tr_global); det_plvol.addPhysVolID("system", det_id); det.setPlacement(det_plvol); diff --git a/src/GaseousRICH_geo.cpp b/src/GaseousRICH_geo.cpp index 3dde6911d1b6ccaf9382f5f9aa4bd51b773fe1f7..10bb242ab09b61be4f4949f90e35e52a9d3aa021 100644 --- a/src/GaseousRICH_geo.cpp +++ b/src/GaseousRICH_geo.cpp @@ -109,7 +109,8 @@ void build_mirrors(Detector& desc, DetElement& sdet, Volume& env, xml::Component // optical surface OpticalSurfaceManager surfMgr = desc.surfaceManager(); - auto surf = surfMgr.opticalSurface(dd4hep::getAttrOrDefault<std::string>(plm, _Unicode(surface), "MirrorOpticalSurface")); + auto surf = + surfMgr.opticalSurface(dd4hep::getAttrOrDefault<std::string>(plm, _Unicode(surface), "MirrorOpticalSurface")); // placements auto gpos = get_xml_xyz(plm, _Unicode(position)) + offset; diff --git a/src/MRich_geo.cpp b/src/MRich_geo.cpp index 0a9d1e4d0565ede074517e939971ef0073366519..675dfa0611ed2b0be1d513a9196ae0fffd8e7a3e 100644 --- a/src/MRich_geo.cpp +++ b/src/MRich_geo.cpp @@ -136,8 +136,8 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet z_placement += aerogel_length / 2.0; // optical surfaces - auto aerogel_surf = - surfMgr.opticalSurface(dd4hep::getAttrOrDefault<std::string>(x_aerogel, _Unicode(surface), "MRICH_AerogelOpticalSurface")); + auto aerogel_surf = surfMgr.opticalSurface( + dd4hep::getAttrOrDefault<std::string>(x_aerogel, _Unicode(surface), "MRICH_AerogelOpticalSurface")); SkinSurface skin_surf(description, aerogel_de, Form("MRICH_aerogel_skin_surface_%d", 1), aerogel_surf, aerogel_vol); skin_surf.isValid(); } @@ -204,8 +204,8 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet z_placement += lens_thickness / 2.0; // optical surfaces - auto lens_surf = - surfMgr.opticalSurface(dd4hep::getAttrOrDefault<std::string>(x_lens, _Unicode(surface), "MRICH_LensOpticalSurface")); + auto lens_surf = surfMgr.opticalSurface( + dd4hep::getAttrOrDefault<std::string>(x_lens, _Unicode(surface), "MRICH_LensOpticalSurface")); SkinSurface skin_surf(description, lens_de, Form("MRichFresnelLens_skin_surface_%d", 1), lens_surf, lens_vol); skin_surf.isValid(); } @@ -243,8 +243,8 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet z_placement += mirror_length / 2.0; // optical surfaces - auto mirror_surf = - surfMgr.opticalSurface(dd4hep::getAttrOrDefault<std::string>(x_mirror, _Unicode(surface), "MRICH_MirrorOpticalSurface")); + auto mirror_surf = surfMgr.opticalSurface( + dd4hep::getAttrOrDefault<std::string>(x_mirror, _Unicode(surface), "MRICH_MirrorOpticalSurface")); SkinSurface skin_surf(description, mirror_de, Form("MRICH_mirror_skin_surface_%d", 1), mirror_surf, mirror_vol); skin_surf.isValid(); } @@ -353,17 +353,20 @@ static Ref_t createDetector(Detector& description, xml::Handle_t e, SensitiveDet // place modules int i_mod = 1; // starts at 1 - for (auto& p : positions) { + for (auto& position : positions) { // get positions in one quadrant - double x = std::get<0>(p); - double y = std::get<1>(p); - double z0 = std::get<2>(p); + double position_x = std::get<0>(position); + double position_y = std::get<1>(position); + double position_z0 = std::get<2>(position); - // and place in all quadrants (intentional shadowing) - for (auto& p : decltype(positions){{x, y, z0}, {y, -x, z0}, {-x, -y, z0}, {-y, x, z0}}) { + // and place in all quadrants + for (auto& p : decltype(positions){{position_x, position_y, position_z0}, + {position_y, -position_x, position_z0}, + {-position_x, -position_y, position_z0}, + {-position_y, position_x, position_z0}}) { - // get positions (intentional shadowing) + // get positions double x = std::get<0>(p); double y = std::get<1>(p); double z0 = std::get<2>(p); diff --git a/src/PFRICH_geo.cpp b/src/PFRICH_geo.cpp index 86bc6a9cb32f2a0284643bc0679514d9ced006f5..d78fb945d2f28c27ca583ca1afa3ea62d7526389 100644 --- a/src/PFRICH_geo.cpp +++ b/src/PFRICH_geo.cpp @@ -272,9 +272,8 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec service_vol.setVisAttributes(desc, x_service.visStr()); // Compute service total thickness from components - double total_thickness = 0; - xml_coll_t ci(x_service, _Unicode(component)); - for (ci.reset(), total_thickness = 0.0; ci; ++ci) { + double total_thickness = 0; + for (xml_coll_t ci(x_service, _Unicode(component)); ci; ++ci) { total_thickness += xml_comp_t(ci).thickness(); } diff --git a/src/SciGlassCalorimeter_geo.cpp b/src/SciGlassCalorimeter_geo.cpp index 12d41b645fc10c5c1614420c175e329fe4d071ff..c0b909a148f05610d611f19113de95a7d4e4fa1d 100644 --- a/src/SciGlassCalorimeter_geo.cpp +++ b/src/SciGlassCalorimeter_geo.cpp @@ -217,20 +217,20 @@ static Ref_t create_detector(Detector& desc, xml::Handle_t handle, SensitiveDete // place around phi for (size_t j_phi = 0; j_phi < n_phi; j_phi++) { // azimuthal and polar angles - const auto phi = dphi * j_phi; - const auto theta = 0.5 * (theta_min + theta_max); + const auto phi = dphi * j_phi; + const auto avg_theta = 0.5 * (theta_min + theta_max); // module center position - const auto r = rmin + 0.5 * mod_x1 * sin(mod_phi_projectivity_tilt) + 0.5 * mod_y1 * sin(theta) + - 0.5 * mod_length * cos(theta); + const auto r = rmin + 0.5 * mod_x1 * sin(mod_phi_projectivity_tilt) + 0.5 * mod_y1 * sin(avg_theta) + + 0.5 * mod_length * cos(avg_theta); const auto x = r * cos(phi); const auto y = r * sin(phi); - const auto z = r / tan(M_PI_2 - theta); + const auto z = r / tan(M_PI_2 - avg_theta); // place negative module if (k_eta < n_eta_neg) { Transform3D tr_neg = Translation3D(x, y, -det_pos.z() + mod_eta_projectivity_offset - z) * - RotationZ(phi + mod_phi_projectivity_tilt) * RotationY(M_PI_2 + theta); + RotationZ(phi + mod_phi_projectivity_tilt) * RotationY(M_PI_2 + avg_theta); auto pv_neg = env.placeVolume(mod_env, tr_neg); pv_neg.addPhysVolID("sector", n_eta_neg + n_eta_pos - k_eta - 1); pv_neg.addPhysVolID("module", j_phi); @@ -239,7 +239,7 @@ static Ref_t create_detector(Detector& desc, xml::Handle_t handle, SensitiveDete // place positive module if (k_eta < n_eta_pos) { Transform3D tr_pos = Translation3D(x, y, -det_pos.z() + mod_eta_projectivity_offset + z) * - RotationZ(phi + mod_phi_projectivity_tilt) * RotationY(M_PI_2 - theta); + RotationZ(phi + mod_phi_projectivity_tilt) * RotationY(M_PI_2 - avg_theta); auto pv_pos = env.placeVolume(mod_env, tr_pos); pv_pos.addPhysVolID("sector", k_eta); pv_pos.addPhysVolID("module", j_phi);