Commit d7a37f5c authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

Merge branch 'b-passive-setters' into 'v3.1-stable'

[v3.1-stable] Passive Models: remove private setter functions

See merge request allpix-squared/allpix-squared!1184
parents 9422df58 2ab23bd0
Loading
Loading
Loading
Loading
+6 −17
Original line number Diff line number Diff line
@@ -38,15 +38,15 @@ namespace allpix {
            : PassiveMaterialModel(config, geo_manager) {

            // Set the box specifications
            setOuterSize(config_.get<ROOT::Math::XYZVector>("size"));
            setInnerSize(config_.get<ROOT::Math::XYZVector>("inner_size", ROOT::Math::XYZVector()));
            outer_size_ = config_.get<ROOT::Math::XYZVector>("size");
            inner_size_ = config_.get<ROOT::Math::XYZVector>("inner_size", ROOT::Math::XYZVector());
            auto thickness = config_.get<double>("thickness", 0);
            if(thickness != 0) {
                if(inner_size_ != ROOT::Math::XYZVector()) {
                    throw InvalidValueError(config_, "thickness", "cannot have both 'thickness' and 'inner_size'");
                }

                setInnerSize({outer_size_.x() - thickness, outer_size_.y() - thickness, outer_size_.z() - thickness});
                inner_size_ = {outer_size_.x() - thickness, outer_size_.y() - thickness, outer_size_.z() - thickness};
            }

            std::string name = config_.getName();
@@ -58,13 +58,13 @@ namespace allpix {
            // Add infinitesimal amount of material if the inner and outer size are equal to avoid artificial remnant
            // surfaces
            if(outer_size_.x() - inner_size_.x() < std::numeric_limits<double>::epsilon()) {
                setInnerSize(ROOT::Math::XYZVector(inner_size_.x() * 2, inner_size_.y(), inner_size_.z()));
                inner_size_ = ROOT::Math::XYZVector(inner_size_.x() * 2, inner_size_.y(), inner_size_.z());
            }
            if(outer_size_.y() - inner_size_.y() < std::numeric_limits<double>::epsilon()) {
                setInnerSize(ROOT::Math::XYZVector(inner_size_.x(), inner_size_.y() * 2, inner_size_.z()));
                inner_size_ = ROOT::Math::XYZVector(inner_size_.x(), inner_size_.y() * 2, inner_size_.z());
            }
            if(outer_size_.z() - inner_size_.z() < std::numeric_limits<double>::epsilon()) {
                setInnerSize(ROOT::Math::XYZVector(inner_size_.x(), inner_size_.y(), inner_size_.z() * 2));
                inner_size_ = ROOT::Math::XYZVector(inner_size_.x(), inner_size_.y(), inner_size_.z() * 2);
            }

            // Create the G4VSolids which make the Box
@@ -101,17 +101,6 @@ namespace allpix {
        // G4VSolid specifications
        ROOT::Math::XYZVector outer_size_;
        ROOT::Math::XYZVector inner_size_;

        /**
         * @brief Set the XYZ-value of the outer size of the box
         * @param val Outer size of the box
         */
        void setOuterSize(ROOT::Math::XYZVector val) { outer_size_ = std::move(val); }
        /**
         * @brief Set the XYZ-value of the inner size of the box
         * @param val Inner size of the box
         */
        void setInnerSize(ROOT::Math::XYZVector val) { inner_size_ = std::move(val); }
    };
} // namespace allpix

+6 −32
Original line number Diff line number Diff line
@@ -36,18 +36,18 @@ namespace allpix {
            : PassiveMaterialModel(config, geo_manager) {

            // Set the cylinder specifications
            setOuterRadius(config_.get<double>("outer_radius"));
            setInnerRadius(config_.get<double>("inner_radius", 0));
            outer_radius_ = config_.get<double>("outer_radius");
            inner_radius_ = config_.get<double>("inner_radius", 0);
            auto thickness = config_.get<double>("thickness", 0);
            if(thickness != 0) {
                if(inner_radius_ != 0) {
                    throw InvalidValueError(config_, "thickness", "cannot have both 'thickness' and 'inner_radius'");
                }
                setInnerRadius(outer_radius_ - thickness);
                inner_radius_ = outer_radius_ - thickness;
            }
            setLength(config_.get<double>("length"));
            setStartingAngle(config_.get<double>("starting_angle", 0));
            setArcLength(config_.get<double>("arc_length", 360 * CLHEP::deg));
            length_ = config_.get<double>("length");
            starting_angle_ = config_.get<double>("starting_angle", 0);
            arc_length_ = config_.get<double>("arc_length", 360 * CLHEP::deg);
            std::string name = config_.getName();

            // Limit the values that can be given
@@ -84,32 +84,6 @@ namespace allpix {
        double length_;
        double starting_angle_;
        double arc_length_;

        /**
         * @brief Set the inner radius of the cylinder in the XY-plane
         * @param val Inner radius of the cylinder
         */
        void setInnerRadius(double val) { inner_radius_ = val; }
        /**
         * @brief Set the outer radius of the cylinder in the XY-plane
         * @param val Outer radius of the cylinder
         */
        void setOuterRadius(double val) { outer_radius_ = val; }
        /**
         * @brief Set the length of the cylinder in the Z-directior
         * @param val Offset from the pixel grid center
         */
        void setLength(double val) { length_ = val; }
        /**
         * @brief Set starting angle of the circumference of the cylinder in degrees
         * @param val Starting angle of the cylinder
         */
        void setStartingAngle(double val) { starting_angle_ = val; }
        /**
         * @brief Set arc length of the circumference in degrees
         * @param val Arc length of the cylinder
         */
        void setArcLength(double val) { arc_length_ = val; }
    };
} // namespace allpix

+8 −39
Original line number Diff line number Diff line
@@ -36,19 +36,19 @@ namespace allpix {
            : PassiveMaterialModel(config, geo_manager) {

            // Set the cylinder specifications
            setOuterRadius(config_.get<double>("outer_radius"));
            setInnerRadius(config_.get<double>("inner_radius", 0));
            outer_radius_ = config_.get<double>("outer_radius");
            inner_radius_ = config_.get<double>("inner_radius", 0);
            auto thickness = config_.get<double>("thickness", 0);
            if(thickness != 0) {
                if(inner_radius_ != 0) {
                    throw InvalidValueError(config_, "thickness", "cannot have both 'thickness' and 'inner_radius'");
                }
                setInnerRadius(outer_radius_ - thickness);
                inner_radius_ = outer_radius_ - thickness;
            }
            setStartingAnglePhi(config_.get<double>("starting_angle_phi", 0));
            setArcLengthPhi(config_.get<double>("arc_length_phi", 360 * CLHEP::deg));
            setStartingAngleTheta(config_.get<double>("starting_angle_theta", 0));
            setArcLengthTheta(config_.get<double>("arc_length_theta", 180 * CLHEP::deg));
            starting_angle_phi_ = config_.get<double>("starting_angle_phi", 0);
            arc_length_phi_ = config_.get<double>("arc_length_phi", 360 * CLHEP::deg);
            starting_angle_theta_ = config_.get<double>("starting_angle_theta", 0);
            arc_length_theta_ = config_.get<double>("arc_length_theta", 180 * CLHEP::deg);
            std::string name = config_.getName();

            // Limit the values that can be given
@@ -66,7 +66,7 @@ namespace allpix {
                LOG(WARNING) << "starting_angle_theta and arc_length_theta combined cannot be larger than 180 degrees for '"
                             << name << "'. arc_length_theta will be set to 180deg - starting_angle_theta = "
                             << Units::display(180 * CLHEP::deg - starting_angle_theta_, "deg");
                setArcLengthTheta(180 * CLHEP::deg - starting_angle_theta_);
                arc_length_theta_ = 180 * CLHEP::deg - starting_angle_theta_;
            }
            // Create the G4VSolids which make the sphere
            solid_ = make_shared_no_delete<G4Sphere>(name + "_volume",
@@ -100,37 +100,6 @@ namespace allpix {
        double arc_length_phi_;
        double starting_angle_theta_;
        double arc_length_theta_;

        /**
         * @brief Set the inner radius of the sphere
         * @param val Inner radius of the sphere
         */
        void setInnerRadius(double val) { inner_radius_ = val; }
        /**
         * @brief Set the outer radius of the sphere
         * @param val Outer radius of the sphere
         */
        void setOuterRadius(double val) { outer_radius_ = val; }
        /**
         * @brief Set starting angle for the  azimuthal angle of the sphere in degrees
         * @param val Starting angle phi of the sphere
         */
        void setStartingAnglePhi(double val) { starting_angle_phi_ = val; }
        /**
         * @brief Set arc length of the azimuthal circumference in degrees
         * @param val Arc length phi of the sphere
         */
        void setArcLengthPhi(double val) { arc_length_phi_ = val; }
        /**
         * @brief Set starting angle of the Polar Angle of the sphere degrees
         * @param val Starting angle theta of the sphere
         */
        void setStartingAngleTheta(double val) { starting_angle_theta_ = val; }
        /**
         * @brief Set arc length of the polar circumference in degrees
         * @param val Arc length theta of the sphere
         */
        void setArcLengthTheta(double val) { arc_length_theta_ = val; }
    };
} // namespace allpix