Loading...
Searching...
No Matches
PrimaryKiller.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26/// \file scavenger/include/PrimaryKiller.hh
27/// \brief Definition of the scavenger::PrimaryKiller class
28
29#ifndef SCAVENGER_PKiller_h
30#define SCAVENGER_PKiller_h 1
31
32#include <G4VPrimitiveScorer.hh>
33#include <G4UImessenger.hh>
34#include <G4THitsMap.hh>
35#include <memory>
36#include "G4SystemOfUnits.hh"
37
39
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43namespace scavenger
44{
45
46/// Kill the primary particle:
47/// - either after a given energy loss
48/// - or after the primary particle has reached a given energy
49
50class PrimaryKiller : public G4VPrimitiveScorer,
51 public G4UImessenger {
52public:
53 explicit PrimaryKiller(const G4String &name, const G4int &depth = 0);
54
55 ~PrimaryKiller() override = default;
56
57 /** Set the energy loss from which the primary is
58 killed*/
59 inline void SetMinLossEnergyLimit(const G4double &energy) {
60 fELossRange_Min = energy;
61 }
62
63 /** Set the energy loss from which the event is
64 aborted*/
65 inline void SetMaxLossEnergyLimit(const G4double &energy) {
66 fELossRange_Max = energy;
67 }
68
69 /** Method related to G4UImessenger
70 used to control energy cuts through macro file*/
71 void SetNewValue(G4UIcommand *command, G4String newValue) override;
72
73 void Initialize(G4HCofThisEvent *) override;
74
75 void EndOfEvent(G4HCofThisEvent *) override {};
76
77 G4bool ProcessHits(G4Step *, G4TouchableHistory *) override;
78
79private:
80 G4double fELoss = 0; // total energy loss by the primary
81 G4double fELossRange_Min = DBL_MAX; // fELoss from which the primary is killed
82 G4double fELossRange_Max = DBL_MAX; // fELoss from which the event is aborted
83 G4double fKineticE_Min = 0; // kinetic energy below which the primary is killed
84 G4ThreeVector fPhantomSize = G4ThreeVector(1 * km, 1 * km, 1 * km);
85 std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpELossUI;
86 std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpAbortEventIfELossUpperThan;
87 std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpMinKineticE;
88 std::unique_ptr<G4UIcmdWith3VectorAndUnit> fpSizeUI;
89};
90
91}
92
93//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94
95#endif
std::unique_ptr< G4UIcmdWithADoubleAndUnit > fpMinKineticE
void SetNewValue(G4UIcommand *command, G4String newValue) override
Method related to G4UImessenger used to control energy cuts through macro file.
void EndOfEvent(G4HCofThisEvent *) override
PrimaryKiller(const G4String &name, const G4int &depth=0)
~PrimaryKiller() override=default
G4bool ProcessHits(G4Step *, G4TouchableHistory *) override
std::unique_ptr< G4UIcmdWithADoubleAndUnit > fpELossUI
std::unique_ptr< G4UIcmdWithADoubleAndUnit > fpAbortEventIfELossUpperThan
void SetMinLossEnergyLimit(const G4double &energy)
Set the energy loss from which the primary is killed.
void SetMaxLossEnergyLimit(const G4double &energy)
Set the energy loss from which the event is aborted.
std::unique_ptr< G4UIcmdWith3VectorAndUnit > fpSizeUI
void Initialize()
Definition errProp.cc:100

Applications | User Support | Publications | Collaboration