Commit 4e13b36f authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DepositionGeant4: allow flat ellipses and sigma'd rectangles

parent f74eaf91
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ void DepositionGeant4Module::run(Event* event) {
                double deposited_energy = static_cast<double>(Units::convert(sensor->getDepositedEnergy(), "keV"));
                energy_per_event_[sensor->getName()]->Fill(deposited_energy);

                for(auto track_position : sensor->getTrackIncidentPositions()) {
                for(const auto& track_position : sensor->getTrackIncidentPositions()) {
                    incident_track_position_[sensor->getName()]->Fill(track_position.x(), track_position.y());
                }
            }
+6 −2
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config)
            try {
                beam_size = config_.get<ROOT::Math::XYVector>("beam_size");
            } catch(InvalidKeyError&) {
                auto size = config_.get<double>("beam_size", 0);
                const auto size = config_.get<double>("beam_size", 0);
                beam_size = {size, size};
            }

@@ -149,13 +149,17 @@ GeneratorActionG4::GeneratorActionG4(const Configuration& config)
                } else if(beam_shape == BeamShape::CIRCLE) {
                    single_source->GetPosDist()->SetPosDisShape("Circle");
                    single_source->GetPosDist()->SetRadius(beam_size.x());
                } else if(beam_shape == BeamShape::ELLIPSE) {
                    single_source->GetPosDist()->SetPosDisShape("Ellipse");
                    single_source->GetPosDist()->SetHalfX((beam_size.x()) / 2);
                    single_source->GetPosDist()->SetHalfY((beam_size.y()) / 2);
                } else {
                    throw InvalidValueError(config_, "beam_shape", "Cannot use this beam shape with flat beams");
                }
            } else {
                if(beam_shape == BeamShape::CIRCLE) {
                    single_source->GetPosDist()->SetBeamSigmaInR(beam_size.x());
                } else if(beam_shape == BeamShape::ELLIPSE) {
                } else if(beam_shape == BeamShape::ELLIPSE || beam_shape == BeamShape::RECTANGLE) {
                    single_source->GetPosDist()->SetBeamSigmaInX((beam_size.x()) / 2);
                    single_source->GetPosDist()->SetBeamSigmaInY((beam_size.y()) / 2);
                } else {