Commit 41f2c1af authored by Paul Schütze's avatar Paul Schütze
Browse files

Merge branch 'focus' into 'master'

Added Focused Beam and peek material to Allpix-Squared

See merge request allpix-squared/allpix-squared!1104
parents 829edf0e 342ae51e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ The following authors, in alphabetical order, have developed or contributed to A
* Liejian Chen, Institute of High Energy Physics Beijing, [chenlj](https://github.com/chenlj)
* Naomi Davis, DESY, [naomi](https://gitlab.cern.ch/naomi)
* Manuel Alejandro Del Rio Viera, DESY, [mdelriov](https://gitlab.cern.ch/mdelriov)
* Malinda de Silva, DESY, [ldesilva](https://gitlab.cern.ch/ldesilva)
* Katharina Dort, University of Gießen, [kdort](https://gitlab.cern.ch/kdort)
* Neal Gauvin, Université de Genève, [ngauvin](https://gitlab.cern.ch/ngauvin)
* Yajun He, DESY, [yajun](https://gitlab.cern.ch/yajun)
+21 −8
Original line number Diff line number Diff line
@@ -171,6 +171,18 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config)
            single_source->GetPosDist()->SetPosRot1(angref1);
            single_source->GetPosDist()->SetPosRot2(angref2);

            if(config_.count({"beam_divergence", "focus_point"}) > 1) {
                throw InvalidCombinationError(config_,
                                              {"beam_divergence", "focus_point"},
                                              "Beam divergence and beam focus point are mutually exclusive!");
            }

            if(config_.has("focus_point")) {
                // Set beam to focus
                single_source->GetAngDist()->SetAngDistType("focused");
                auto focus_point = config_.get<G4ThreeVector>("focus_point");
                single_source->GetAngDist()->SetFocusPoint(focus_point);
            } else {
                // Set angle distribution parameters
                // NOTE beam2d will always fire in the -z direction of the system
                single_source->GetAngDist()->SetAngDistType("beam2d");
@@ -179,6 +191,7 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config)
                auto divergence = config_.get<G4TwoVector>("beam_divergence", G4TwoVector(0., 0.));
                single_source->GetAngDist()->SetBeamSigmaInAngX(divergence.x());
                single_source->GetAngDist()->SetBeamSigmaInAngY(divergence.y());
            }

        } else if(source_type == SourceType::SPHERE) {

+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ Note: Neutrons have a lifetime of 882 seconds and will not be propagated in the
* `beam_shape` : Shape of the beam, can be either `circle`, `ellipse` or `rectangle`. Defaults to `circle`
* `beam_size` : Width of the Gaussian beam profile. With `beam_shape = ellipse` or `beam_shape = rectangle`, this requires two values for the width in x and y.
* `beam_divergence` : Standard deviation of the particle angles in x and y from the particle beam
* `focus_point` : Focus point of the beam. This parameter is mutually exclusive with `beam_divergence`.
* `beam_direction` : Direction of the beam as a unit vector.
* `flat_beam` : Boolean to change your Gaussian beam profile to a flat beam profile. If true, the `beam_size` gives the radius of the beam profile. Defaults to false.