diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 97bb79422..038dc8dbd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v21.1.8 + rev: v22.1.0 hooks: - id: clang-format - repo: https://github.com/Lucas-C/pre-commit-hooks diff --git a/src/BarrelTOFTracker_geo.cpp b/src/BarrelTOFTracker_geo.cpp index cc90d3915..440b043a0 100644 --- a/src/BarrelTOFTracker_geo.cpp +++ b/src/BarrelTOFTracker_geo.cpp @@ -174,7 +174,7 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector xml_comp_t x_comp = mci; xml_comp_t x_pos = x_comp.position(false); xml_comp_t x_rot = x_comp.rotation(false); - auto make_box = [&](double width, double length, double thickness, double pos_x = 0, + auto make_box = [&](double width, double length, double thickness, double pos_x = 0, double pos_y = 0, double pos_z = 0, double rot_x = 0, double rot_y = 0, double rot_z = 0, bool z_stacking = true, int segmentation_id = 0, const std::string& suffix = "") { @@ -243,12 +243,12 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector // The two sides of the "U" Tube pipe_in(pipe_min_r, pipe_max_r, (length / 2 + std::fabs(bend_y)) / 2); Volume pipe_in_vol(ci_tube.nameStr() + "_pipe1" + suffix, pipe_in, - description.material(pipe_material)); + description.material(pipe_material)); m_vol.placeVolume(pipe_in_vol, - Transform3D(RotationZYX(0, 0, -M_PI / 2), - Position(pos_x - bend_r + pipe_offset_x, - pos_y - coord_factor * (bend_y - length / 2) / 2, - pos_z + zoff))); + Transform3D(RotationZYX(0, 0, -M_PI / 2), + Position(pos_x - bend_r + pipe_offset_x, + pos_y - coord_factor * (bend_y - length / 2) / 2, + pos_z + zoff))); SubtractionSolid c_sbox1( c_box, pipe_in, Transform3D( @@ -257,12 +257,12 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector // coolant inside the tube Tube coolant_in(0, pipe_min_r, (length / 2 + std::fabs(bend_y)) / 2); Volume coolant_in_vol(ci_tube.nameStr() + "_coolant1" + suffix, coolant_in, - description.material(coolant_material)); + description.material(coolant_material)); m_vol.placeVolume(coolant_in_vol, - Transform3D(RotationZYX(0, 0, -M_PI / 2), - Position(pos_x - bend_r + pipe_offset_x, - pos_y - coord_factor * (bend_y - length / 2) / 2, - pos_z + zoff))); + Transform3D(RotationZYX(0, 0, -M_PI / 2), + Position(pos_x - bend_r + pipe_offset_x, + pos_y - coord_factor * (bend_y - length / 2) / 2, + pos_z + zoff))); SubtractionSolid c_sbox2( c_sbox1, coolant_in, Transform3D( @@ -272,12 +272,12 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector // other long side of the tube Tube pipe_out(pipe_min_r, pipe_max_r, (length / 2 + std::fabs(bend_y)) / 2); Volume pipe_out_vol(ci_tube.nameStr() + "_pipe2" + suffix, pipe_out, - description.material(pipe_material)); + description.material(pipe_material)); m_vol.placeVolume(pipe_out_vol, - Transform3D(RotationZYX(0, 0, -M_PI / 2), - Position(pos_x + bend_r + pipe_offset_x, - pos_y - coord_factor * (bend_y - length / 2) / 2, - pos_z + zoff))); + Transform3D(RotationZYX(0, 0, -M_PI / 2), + Position(pos_x + bend_r + pipe_offset_x, + pos_y - coord_factor * (bend_y - length / 2) / 2, + pos_z + zoff))); SubtractionSolid c_sbox3( c_sbox2, pipe_out, Transform3D( @@ -286,12 +286,12 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector // coolant inside the tube Tube coolant_out(0, pipe_min_r, (length / 2 + std::fabs(bend_y)) / 2); Volume coolant_out_vol(ci_tube.nameStr() + "_coolant2" + suffix, coolant_out, - description.material(coolant_material)); + description.material(coolant_material)); m_vol.placeVolume(coolant_out_vol, - Transform3D(RotationZYX(0, 0, -M_PI / 2), - Position(pos_x + bend_r + pipe_offset_x, - pos_y - coord_factor * (bend_y - length / 2) / 2, - pos_z + zoff))); + Transform3D(RotationZYX(0, 0, -M_PI / 2), + Position(pos_x + bend_r + pipe_offset_x, + pos_y - coord_factor * (bend_y - length / 2) / 2, + pos_z + zoff))); SubtractionSolid c_sbox4( c_sbox3, coolant_out, Transform3D( @@ -300,28 +300,28 @@ static Ref_t create_TOFBarrel(Detector& description, xml_h e, SensitiveDetector // the U part of the U-shape Torus pipe_bend(bend_r, pipe_min_r, pipe_max_r + 0.001, direction == "left" ? M_PI : 0, - M_PI); + M_PI); Volume pipe_bend_vol(ci_tube.nameStr() + "_pipeU" + suffix, pipe_bend, - description.material(pipe_material)); + description.material(pipe_material)); m_vol.placeVolume(pipe_bend_vol, - Transform3D(RotationZYX(0, 0, 0), - Position(pos_x + pipe_offset_x, - pos_y - coord_factor * bend_y, pos_z + zoff))); + Transform3D(RotationZYX(0, 0, 0), + Position(pos_x + pipe_offset_x, + pos_y - coord_factor * bend_y, pos_z + zoff))); // coolant Torus coolant_bend(bend_r, 0, pipe_min_r, direction == "left" ? M_PI : 0, M_PI); Volume coolant_bend_vol(ci_tube.nameStr() + "_coolantU" + suffix, coolant_bend, - description.material(coolant_material)); + description.material(coolant_material)); m_vol.placeVolume(coolant_bend_vol, - Transform3D(RotationZYX(0, 0, 0), - Position(pos_x + pipe_offset_x, - pos_y - coord_factor * bend_y, pos_z + zoff))); + Transform3D(RotationZYX(0, 0, 0), + Position(pos_x + pipe_offset_x, + pos_y - coord_factor * bend_y, pos_z + zoff))); // carve out the U-bent from stave Torus coolant_bend_carveout(bend_r, 0, pipe_max_r, direction == "left" ? M_PI : 0, M_PI); SubtractionSolid c_sbox5(c_sbox4, coolant_bend_carveout, - Transform3D(RotationZYX(0, 0, 0), - Position(pipe_offset_x, -coord_factor * bend_y, 0))); + Transform3D(RotationZYX(0, 0, 0), + Position(pipe_offset_x, -coord_factor * bend_y, 0))); c_vol = Volume(c_nam, c_sbox5, description.material(x_comp.materialStr())); } else diff --git a/src/DRICH_geo.cpp b/src/DRICH_geo.cpp index 0006c6ca2..3c44cb9fa 100644 --- a/src/DRICH_geo.cpp +++ b/src/DRICH_geo.cpp @@ -369,7 +369,7 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec auto radiatorPos = Position(0., 0., radiatorFrontplane + 0.5 * aerogelThickness) + originFront; auto aerogelPlacement = Translation3D(radiatorPos) * // re-center to originFront RotationY(radiatorPitch); // change polar angle to specified pitch - auto aerogelPV = gasvolVol.placeVolume(aerogelVol, aerogelPlacement); + auto aerogelPV = gasvolVol.placeVolume(aerogelVol, aerogelPlacement); DetElement aerogelDE(det, "aerogel_de", 0); aerogelDE.setPlacement(aerogelPV); @@ -769,9 +769,9 @@ static Ref_t createDetector(Detector& desc, xml::Handle_t handle, SensitiveDetec pduAssemblyPlacement * // position of PDU in vessel sensorAssemblyPlacement * // position of SiPM in PDU pduOrigin; - auto pduPos = Translation3D(vesselPos) * // position of vessel in world - pduAssemblyPlacement * // position of PDU in vessel - pduOrigin; + auto pduPos = Translation3D(vesselPos) * // position of vessel in world + pduAssemblyPlacement * // position of PDU in vessel + pduOrigin; // - sensor surface basis: the orientation of the sensor surface // NOTE: all sensors of a single PDU have the same surface orientation, but to avoid // loss of generality downstream, define the basis for each sensor diff --git a/src/EndcapTOF_geo.cpp b/src/EndcapTOF_geo.cpp index 77305888f..5553f7cb2 100644 --- a/src/EndcapTOF_geo.cpp +++ b/src/EndcapTOF_geo.cpp @@ -227,7 +227,7 @@ static Ref_t create_detector(Detector& description, xml_h e, SensitiveDetector s float ycoord = envelope.rmax() - module_y / 2.; // y-center-coord of the top sensor. Start from the top row - int iy = 0; + int iy = 0; for (xml_coll_t lrow(x_layout, _Unicode(row)); lrow; ++lrow) { xml_comp_t x_row = lrow; diff --git a/src/FieldMapB.cpp b/src/FieldMapB.cpp index b58fc1eaf..a25d44aaf 100644 --- a/src/FieldMapB.cpp +++ b/src/FieldMapB.cpp @@ -245,9 +245,9 @@ void FieldMapB::fieldComponents(const double* pos, double* field) { // convert Br Bz to Bx By Bz and rotate field const float phi = atan2(p.y(), p.x()); - auto B = fieldRot.has_value() - ? fieldRot.value() * ROOT::Math::XYZPoint(Br * cos(phi), Br * sin(phi), Bz) - : ROOT::Math::XYZPoint(Br * cos(phi), Br * sin(phi), Bz); + auto B = fieldRot.has_value() + ? fieldRot.value() * ROOT::Math::XYZPoint(Br * cos(phi), Br * sin(phi), Bz) + : ROOT::Math::XYZPoint(Br * cos(phi), Br * sin(phi), Bz); field[0] += B.x(); field[1] += B.y(); field[2] += B.z(); diff --git a/src/InsertCalorimeter_geo.cpp b/src/InsertCalorimeter_geo.cpp index 611f11526..7568b2bd2 100644 --- a/src/InsertCalorimeter_geo.cpp +++ b/src/InsertCalorimeter_geo.cpp @@ -82,7 +82,7 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens */ double hole_radius_slope = (hole_radii_parameters.second - hole_radii_parameters.first) / (length - backplate_thickness); - double hole_radius_at_z = hole_radius_slope * z_pos + hole_radii_parameters.first; + double hole_radius_at_z = hole_radius_slope * z_pos + hole_radii_parameters.first; double hole_xpos_slope = (hole_x_parameters.second - hole_x_parameters.first) / (length - backplate_thickness); diff --git a/src/LFHCAL_geo.cpp b/src/LFHCAL_geo.cpp index 6ed7ae505..34c55276a 100644 --- a/src/LFHCAL_geo.cpp +++ b/src/LFHCAL_geo.cpp @@ -1162,8 +1162,8 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens Volume motherVol = desc.pickMotherVolume(det); phv = env_vol.placeVolume(assembly); - phv = motherVol.placeVolume(env_vol, - Transform3D(Position(pos.x(), pos.y(), pos.z() + length / 2.))); + phv = motherVol.placeVolume(env_vol, + Transform3D(Position(pos.x(), pos.y(), pos.z() + length / 2.))); phv.addPhysVolID("system", detID); det.setPlacement(phv); diff --git a/src/forwardEcal_geo.cpp b/src/forwardEcal_geo.cpp index a31ff4dd0..78651345d 100644 --- a/src/forwardEcal_geo.cpp +++ b/src/forwardEcal_geo.cpp @@ -31,10 +31,10 @@ double yBlock(int ns, int row) { } static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens) { - blocksize = desc.constant("EcalEndcapP_blockSize"); - blockgap = desc.constant("EcalEndcapP_spaceBetweenBlock"); - double nsgap = desc.constant("EcalEndcapP_xOffsetNorth") + - desc.constant("EcalEndcapP_xOffsetSouth"); + blocksize = desc.constant("EcalEndcapP_blockSize"); + blockgap = desc.constant("EcalEndcapP_spaceBetweenBlock"); + double nsgap = desc.constant("EcalEndcapP_xOffsetNorth") + + desc.constant("EcalEndcapP_xOffsetSouth"); double rmin = 0.0; // Dummy variable. Set to 0 since cutting out insert double rmax = desc.constant("EcalEndcapP_rmax"); double rmaxWithGap = desc.constant("EcalEndcapP_rmaxWithGap"); @@ -242,8 +242,8 @@ static Ref_t createDetector(Detector& desc, xml_h handle, SensitiveDetector sens double xrow = (xBlock(ns, r, 0) + xBlock(ns, r, nColBlock - 1)) / 2.0 - pm[ns] * nsgap / 2.0; double yrow = yBlock(ns, r); - pv = half_vol.placeVolume(row_vol, - Transform3D(RotationZYX(0, 0, 0), Position(xrow, yrow, 0))); + pv = half_vol.placeVolume(row_vol, + Transform3D(RotationZYX(0, 0, 0), Position(xrow, yrow, 0))); pv.addPhysVolID("blockrow", r); //column of blocks diff --git a/src/magnetVacuumFF.cpp b/src/magnetVacuumFF.cpp index 2f2676320..181811721 100644 --- a/src/magnetVacuumFF.cpp +++ b/src/magnetVacuumFF.cpp @@ -241,8 +241,8 @@ static Ref_t create_detector(Detector& det, xml_h e, SensitiveDetector /* sens * double specialGapLength = sqrt(pow(z_beg[0] - endOfCentralBeamPipe_z, 2) + pow(x_beg[0] - endOfCentralBeamPipe_x, 2)) - 0.1; - double specialGap_z = 0.5 * specialGapLength * cos(crossingAngle) + endOfCentralBeamPipe_z; - double specialGap_x = 0.5 * specialGapLength * sin(crossingAngle) + endOfCentralBeamPipe_x; + double specialGap_z = 0.5 * specialGapLength * cos(crossingAngle) + endOfCentralBeamPipe_z; + double specialGap_x = 0.5 * specialGapLength * sin(crossingAngle) + endOfCentralBeamPipe_x; std::string piece_name = Form("GapVacuum%d", numGaps + numMagnets);