Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:07

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file scavenger/include/PrimaryKiller.hh
0027 /// \brief Definition of the scavenger::PrimaryKiller class
0028 
0029 #ifndef SCAVENGER_PKiller_h
0030 #define SCAVENGER_PKiller_h 1
0031 
0032 #include "G4SystemOfUnits.hh"
0033 
0034 #include <G4THitsMap.hh>
0035 #include <G4UImessenger.hh>
0036 #include <G4VPrimitiveScorer.hh>
0037 #include <memory>
0038 
0039 class G4UIcmdWithADoubleAndUnit;
0040 
0041 class G4UIcmdWith3VectorAndUnit;
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 namespace scavenger
0045 {
0046 
0047 /// Kill the primary particle:
0048 /// - either after a given energy loss
0049 /// - or after the primary particle has reached a given energy
0050 
0051 class PrimaryKiller : public G4VPrimitiveScorer, public G4UImessenger
0052 {
0053   public:
0054     explicit PrimaryKiller(const G4String& name, const G4int& depth = 0);
0055 
0056     ~PrimaryKiller() override = default;
0057 
0058     /** Set the energy loss from which the primary is
0059      killed*/
0060     inline void SetMinLossEnergyLimit(const G4double& energy) { fELossRange_Min = energy; }
0061 
0062     /** Set the energy loss from which the event is
0063      aborted*/
0064     inline void SetMaxLossEnergyLimit(const G4double& energy) { fELossRange_Max = energy; }
0065 
0066     /** Method related to G4UImessenger
0067      used to control energy cuts through macro file*/
0068     void SetNewValue(G4UIcommand* command, G4String newValue) override;
0069 
0070     void Initialize(G4HCofThisEvent*) override;
0071 
0072     void EndOfEvent(G4HCofThisEvent*) override {};
0073 
0074     G4bool ProcessHits(G4Step*, G4TouchableHistory*) override;
0075 
0076   private:
0077     G4double fELoss = 0;  // total energy loss by the primary
0078     G4double fELossRange_Min = DBL_MAX;  // fELoss from which the primary is killed
0079     G4double fELossRange_Max = DBL_MAX;  // fELoss from which the event is aborted
0080     G4double fKineticE_Min = 0;  // kinetic energy below which the primary is killed
0081     G4ThreeVector fPhantomSize = G4ThreeVector(1 * km, 1 * km, 1 * km);
0082     std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpELossUI;
0083     std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpAbortEventIfELossUpperThan;
0084     std::unique_ptr<G4UIcmdWithADoubleAndUnit> fpMinKineticE;
0085     std::unique_ptr<G4UIcmdWith3VectorAndUnit> fpSizeUI;
0086 };
0087 
0088 }  // namespace scavenger
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 #endif