├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── ElectronEnergyDeposition ├── CMakeLists.txt ├── Doxyfile ├── README.md ├── analysis.py ├── eDep.mac ├── electronEDep.cc ├── include │ ├── Analysis.hh │ ├── DetectorConstruction.hh │ ├── DetectorMessenger.hh │ ├── EventAction.hh │ ├── Materials.hh │ ├── PhysicsList.hh │ ├── PhysicsListMessenger.hh │ ├── PrimaryGeneratorAction.hh │ ├── RunAction.hh │ └── SteppingAction.hh └── src │ ├── Analysis.cc │ ├── DetectorConstruction.cc │ ├── DetectorMessenger.cc │ ├── EventAction.cc │ ├── Materials.cc │ ├── PhysicsList.cc │ ├── PhysicsListMessenger.cc │ ├── PrimaryGeneratorAction.cc │ ├── RunAction.cc │ └── SteppingAction.cc ├── EnergyDeposition ├── CMakeLists.txt ├── README.md ├── analysis.py ├── gui.mac ├── include │ ├── Analysis.hh │ ├── CaloHit.hh │ ├── CaloSensitiveDetector.hh │ ├── DetectorConstruction.hh │ ├── DetectorMessenger.hh │ ├── EventAction.hh │ ├── HadronicPhysics.hh │ ├── HistoManager.hh │ ├── PhysicsList.hh │ ├── PrimaryGeneratorAction.hh │ └── RunAction.hh ├── macros │ ├── co60Source.mac │ ├── gRun.mac │ ├── nRun.mac │ └── neutronSource.mac ├── polymerFilm.cc ├── src │ ├── Analysis.cc │ ├── CaloHit.cc │ ├── CaloSensitiveDetector.cc │ ├── DetectorConstruction.cc │ ├── DetectorMessenger.cc │ ├── EventAction.cc │ ├── HadronicPhysics.cc │ ├── HistoManager.cc │ ├── PhysicsList.cc │ ├── PrimaryGeneratorAction.cc │ └── RunAction.cc ├── subJob.sh └── vis.mac ├── G4MPIInstructions.md ├── LICENSE ├── LightQuenching ├── 7LiRun.mac ├── CMakeLists.txt ├── Doxyfile ├── LightQuench.C ├── README.md ├── alphaRun.mac ├── demoRun.mac ├── eRun.mac ├── gui.mac ├── include │ ├── DetectorConstruction.hh │ ├── EventAction.hh │ ├── HadronicPhysics.hh │ ├── HistoManager.hh │ ├── Materials.hh │ ├── PhysicsList.hh │ ├── PrimaryGeneratorAction.hh │ ├── RunAction.hh │ └── StackingAction.hh ├── lightYield.cc ├── src │ ├── DetectorConstruction.cc │ ├── EventAction.cc │ ├── HistoManager.cc │ ├── Materials.cc │ ├── PhysicsList.cc │ ├── PrimaryGeneratorAction.cc │ ├── RunAction.cc │ └── StackingAction.cc ├── subJob.sh ├── tritonRun.mac └── vis.mac ├── LightValidation ├── BirksConstant │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── README.md │ ├── analysis.py │ ├── birksConstant.cc │ ├── birksConstant.sh │ ├── cleanUp.sh │ ├── gui.mac │ ├── include │ │ ├── Analysis.hh │ │ ├── DetectorConstruction.hh │ │ ├── DetectorMessenger.hh │ │ ├── EventAction.hh │ │ ├── HadronicPhysics.hh │ │ ├── HistoManager.hh │ │ ├── Materials.hh │ │ ├── PhysicsList.hh │ │ ├── PrimaryGeneratorAction.hh │ │ ├── RunAction.hh │ │ └── StackingAction.hh │ ├── macros │ │ ├── BirksConstant.mac │ │ ├── co60Source.mac │ │ ├── gRun.mac │ │ ├── nRun.mac │ │ └── neutronSource.mac │ ├── src │ │ ├── Analysis.cc │ │ ├── DetectorConstruction.cc │ │ ├── DetectorMessenger.cc │ │ ├── EventAction.cc │ │ ├── HistoManager.cc │ │ ├── Material.cc │ │ ├── PhysicsList.cc │ │ ├── PrimaryGeneratorAction.cc │ │ ├── RunAction.cc │ │ └── StackingAction.cc │ ├── subJob.sh │ └── vis.mac ├── CMakeLists.txt ├── GS20Calibration │ ├── Analysis.C │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── README.md │ ├── cleanUp.sh │ ├── gui.mac │ ├── include │ │ ├── AbsorberHit.hh │ │ ├── AbsorberSD.hh │ │ ├── Analysis.hh │ │ ├── DetectorConstruction.hh │ │ ├── DetectorMessenger.hh │ │ ├── EventAction.hh │ │ ├── HadronicPhysics.hh │ │ ├── HistoManager.hh │ │ ├── Materials.hh │ │ ├── PMTSD.hh │ │ ├── PhotonHit.hh │ │ ├── PhysicsList.hh │ │ ├── PrimaryGeneratorAction.hh │ │ ├── RunAction.hh │ │ └── StackingAction.hh │ ├── lightYieldCal.cc │ ├── macros │ │ ├── co60Source.mac │ │ ├── gRun.mac │ │ ├── nRun.mac │ │ └── neutronSource.mac │ ├── src │ │ ├── AbsorberHit.cc │ │ ├── AbsorberSD.cc │ │ ├── Analysis.cc │ │ ├── DetectorConstruction.cc │ │ ├── DetectorMessenger.cc │ │ ├── EventAction.cc │ │ ├── HistoManager.cc │ │ ├── Material.cc │ │ ├── PMTSD.cc │ │ ├── PhotonHit.cc │ │ ├── PhysicsList.cc │ │ ├── PrimaryGeneratorAction.cc │ │ ├── RunAction.cc │ │ └── StackingAction.cc │ ├── subJob.sh │ └── vis.mac ├── LayeredDetectorCalibration │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── README.md │ ├── cleanUp.sh │ ├── gui.mac │ ├── include │ │ ├── Analysis.hh │ │ ├── DetectorConstruction.hh │ │ ├── DetectorMessenger.hh │ │ ├── EventAction.hh │ │ ├── HadronicPhysics.hh │ │ ├── HistoManager.hh │ │ ├── Materials.hh │ │ ├── PMTSD.hh │ │ ├── PhotonHit.hh │ │ ├── PhysicsList.hh │ │ ├── PrimaryGeneratorAction.hh │ │ ├── RunAction.hh │ │ └── StackingAction.hh │ ├── macros │ │ ├── co60Source.mac │ │ ├── gRun.mac │ │ ├── nRun.mac │ │ ├── neutronSource.mac │ │ └── volumeSource.mac │ ├── scintSlabCal.cc │ ├── src │ │ ├── Analysis.cc │ │ ├── DetectorConstruction.cc │ │ ├── DetectorMessenger.cc │ │ ├── EventAction.cc │ │ ├── HistoManager.cc │ │ ├── Material.cc │ │ ├── PMTSD.cc │ │ ├── PhotonHit.cc │ │ ├── PhysicsList.cc │ │ ├── PrimaryGeneratorAction.cc │ │ ├── RunAction.cc │ │ └── StackingAction.cc │ ├── subJob.sh │ └── vis.mac ├── OpticalProperties.txt ├── PSCalibration │ ├── Analysis.C │ ├── CMakeLists.txt │ ├── Doxyfile │ ├── README.md │ ├── cleanUp.sh │ ├── gui.mac │ ├── include │ │ ├── AbsorberHit.hh │ │ ├── AbsorberSD.hh │ │ ├── Analysis.hh │ │ ├── DetectorConstruction.hh │ │ ├── DetectorMessenger.hh │ │ ├── EventAction.hh │ │ ├── HadronicPhysics.hh │ │ ├── HistoManager.hh │ │ ├── Materials.hh │ │ ├── PMTSD.hh │ │ ├── PhotonHit.hh │ │ ├── PhysicsList.hh │ │ ├── PrimaryGeneratorAction.hh │ │ ├── RunAction.hh │ │ └── StackingAction.hh │ ├── lightYieldCal.cc │ ├── macros │ │ ├── co60Source.mac │ │ ├── gRun.mac │ │ ├── nRun.mac │ │ └── neutronSource.mac │ ├── src │ │ ├── AbsorberHit.cc │ │ ├── AbsorberSD.cc │ │ ├── Analysis.cc │ │ ├── DetectorConstruction.cc │ │ ├── DetectorMessenger.cc │ │ ├── EventAction.cc │ │ ├── HistoManager.cc │ │ ├── Material.cc │ │ ├── PMTSD.cc │ │ ├── PhotonHit.cc │ │ ├── PhysicsList.cc │ │ ├── PrimaryGeneratorAction.cc │ │ ├── RunAction.cc │ │ └── StackingAction.cc │ ├── subJob.sh │ ├── test.mac │ └── vis.mac └── README.md ├── LightYeildEDep ├── CMakeLists.txt ├── ExportHist.C ├── README.md ├── analysis.py ├── demoRun.mac ├── gui.mac ├── include │ ├── Analysis.hh │ ├── Analysis.hh.orig │ ├── CaloHit.hh │ ├── CaloSensitiveDetector.hh │ ├── DetectorConstruction.hh │ ├── DetectorMessenger.hh │ ├── EventAction.hh │ ├── HadronicPhysics.hh │ ├── HistoManager.hh │ ├── Materials.hh │ ├── PhysicsList.hh │ ├── PrimaryGeneratorAction.hh │ ├── RunAction.hh │ └── StackingAction.hh ├── macros │ ├── co60Source.mac │ ├── gRun.mac │ ├── nRun.mac │ └── neutronSource.mac ├── polymerFilm.cc ├── src │ ├── Analysis.cc │ ├── Analysis.cc.orig │ ├── CaloHit.cc │ ├── CaloSensitiveDetector.cc │ ├── DetectorConstruction.cc │ ├── DetectorMessenger.cc │ ├── EventAction.cc │ ├── HadronicPhysics.cc │ ├── HistoManager.cc │ ├── Materials.cc │ ├── PhysicsList.cc │ ├── PrimaryGeneratorAction.cc │ ├── RunAction.cc │ └── StackingAction.cc ├── subJob.sh └── vis.mac ├── MCNPXRPMModels ├── LayeredDetectors │ ├── MCNPXModel.py │ └── RPMModel.py ├── MCNPMaterial.py ├── README.md └── WrappedCylinders │ ├── CylinderMCNPX.py │ ├── CylinderOptResults.txt │ ├── FourTubeData.csv │ ├── PS_30LiF_Wrapped.mcnp │ ├── ThreeTubeData.csv │ └── TwoTubeData.csv ├── ParticleTracks ├── CMakeLists.txt ├── Doxyfile ├── README.md ├── gui.mac ├── include │ ├── DetectorConstruction.hh │ ├── Materials.hh │ ├── PhysicsList.hh │ ├── PhysicsListMessenger.hh │ └── PrimaryGeneratorAction.hh ├── init.mac ├── neutronSource.mac ├── run1.mac ├── src │ ├── DetectorConstruction.cc │ ├── Materials.cc │ ├── PhysicsList.cc │ ├── PhysicsListMessenger.cc │ └── PrimaryGeneratorAction.cc ├── tracking.cc └── vis.mac ├── README.md ├── RangeSim ├── CMakeLists.txt ├── Doxyfile ├── README.md ├── Range.C ├── beamSource.mac ├── co60Source.mac ├── eRangeDist.mac ├── erange.mac ├── gammaRange.mac ├── gui.mac ├── include │ ├── DetectorConstruction.hh │ ├── DetectorMessenger.hh │ ├── EventAction.hh │ ├── EventActionMessenger.hh │ ├── HistoManager.hh │ ├── Materials.hh │ ├── PhysicsList.hh │ ├── PhysicsListMessenger.hh │ ├── PrimaryGeneratorAction.hh │ ├── RunAction.hh │ ├── StackingAction.hh │ ├── SteppingAction.hh │ └── TrackingAction.hh ├── init.mac ├── init_vis.mac ├── rangeSim.cc ├── rxnProductRange.mac ├── src │ ├── DetectorConstruction.cc │ ├── DetectorMessenger.cc │ ├── EventAction.cc │ ├── EventActionMessenger.cc │ ├── HistoManager.cc │ ├── Materials.cc │ ├── PhysicsList.cc │ ├── PhysicsListMessenger.cc │ ├── PrimaryGeneratorAction.cc │ ├── RunAction.cc │ ├── StackingAction.cc │ ├── SteppingAction.cc │ └── TrackingAction.cc └── vis.mac ├── ScintillationSlab ├── Analysis.cc ├── CMakeLists.txt ├── Doxyfile ├── GS0GS2 ├── GS20LightYieldCal.cc ├── GammaOutput.txt ├── Material.cc ├── NeutronOutput.txt ├── OpticalProperties.txt ├── README.md ├── analysis.py ├── gui.mac ├── include │ ├── Analysis.hh │ ├── DetectorConstruction.hh │ ├── DetectorMessenger.hh │ ├── EventAction.hh │ ├── HadronicPhysics.hh │ ├── HistoManager.hh │ ├── Materials.hh │ ├── PhotonDetHit.hh │ ├── PhotonDetSD.hh │ ├── PhysicsList.hh │ ├── PrimaryGeneratorAction.hh │ ├── RunAction.hh │ └── StackingAction.hh ├── init.mac ├── macros │ ├── co60Source.mac │ ├── gRun.mac │ ├── nRun.mac │ └── neutronSource.mac ├── ptSrc.in ├── scintSlab.cc ├── slab.in ├── src │ ├── Analysis.cc │ ├── DetectorConstruction.cc │ ├── DetectorMessenger.cc │ ├── EventAction.cc │ ├── HistoManager.cc │ ├── Material.cc │ ├── PhotonDetHit.cc │ ├── PhotonDetSD.cc │ ├── PhysicsList.cc │ ├── PrimaryGeneratorAction.cc │ ├── RunAction.cc │ └── StackingAction.cc ├── subJob.sh └── vis.mac └── WLSScintBar ├── CMakeLists.txt ├── CladdingTest.mac ├── Doxyfile ├── README.md ├── WLSCases.mac ├── gui.mac ├── include ├── Analysis.hh ├── DetectorConstruction.hh ├── DetectorMessenger.hh ├── EventAction.hh ├── HistoManager.hh ├── Materials.hh ├── PhotonDetHit.hh ├── PhotonDetSD.hh ├── PhysicsList.hh ├── PrimaryGeneratorAction.hh ├── RunAction.hh └── StackingAction.hh ├── init.mac ├── macros ├── co60Source.mac ├── gRun.mac ├── nRun.mac └── neutronSource.mac ├── ptSrc.in ├── scintSlab.cc ├── src ├── Analysis.cc ├── DetectorConstruction.cc ├── DetectorMessenger.cc ├── EventAction.cc ├── HistoManager.cc ├── Materials.cc ├── PhotonDetHit.cc ├── PhotonDetSD.cc ├── PhysicsList.cc ├── PrimaryGeneratorAction.cc ├── RunAction.cc └── StackingAction.cc ├── subJob.sh ├── vis.mac └── wlsSlab.in /.gitignore: -------------------------------------------------------------------------------- 1 | # GEANT4 files 2 | *.root 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | 9 | # Compiled Dynamic libraries 10 | *.so 11 | *.dylib 12 | 13 | # Compiled Static libraries 14 | *.lai 15 | *.la 16 | *.a 17 | 18 | # CMAKE Build files 19 | build* 20 | GNU* 21 | CMakeCache.txt 22 | CMakeFiles 23 | Makefile 24 | cmake_install.cmake 25 | install_manifest.txt 26 | 27 | # OS-X Ignore 28 | .DS_Store 29 | .AppleDouble 30 | .LSOverride 31 | Icon 32 | 33 | # VIM 34 | *.s[a-w][a-z] 35 | *.un~ 36 | Session.vim 37 | .netrwhist 38 | *~ 39 | # Ignoring Speficfied Output Files 40 | LightQuenching/*.txt 41 | LightQuenching/*.csv 42 | LightValidation/BirksConstant/Birks_*.txt 43 | LightValidation/GS20Calibration/*.csv 44 | LightYeildEDep/*.csv 45 | # MCNPXRPMModels/ 46 | # RangeSim/README 47 | # RangeSim/TestEm1.in 48 | # RangeSim/TestEm1.out 49 | # SecElectronDistribution/ 50 | # WLSScintBar/ 51 | nothing added to commit but untracked files present (use "git add" to track) 52 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "MCNPXRPMModels/MCNPTools"] 2 | path = MCNPXRPMModels/MCNPTools 3 | url = git://github.com/murffer/MCNPTools.git 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #---Adding examples subdirectories explicitly 2 | # and a custom target to for building all code bases ------------- 3 | 4 | cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 5 | 6 | add_subdirectory(EnergyDeposition) 7 | add_subdirectory(RangeSim) 8 | add_subdirectory(ParticleTracks) 9 | add_subdirectory(LightQuenching) 10 | add_subdirectory(LightYeildEDep) 11 | add_custom_target(G4DetectorSim DEPENDS EnergyDeposition RangeSim Tracking LightQuenching lightYield) 12 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/README.md: -------------------------------------------------------------------------------- 1 | Electron Energy Deposition Simulation 2 | ===================================== 3 | 4 | Simulation of energy deposition of electrons in materials. The material is divided into logarithmic bins, and the energy deposited in a step is accumulated for an event, and all of the events in a run are accumulated for an average value and variance. 5 | 6 | ## Geometry 7 | 8 | The geometry is a box representing a 'semi infinite' homogeneous medium. The default geometry is constructed in DetectorConstruction class, but all of the above parameters can be changed interactively via the commands defined in the DetectorMessenger class. 9 | 10 | ## Run / Compiling 11 | 12 | The code is setup to use the CMakeEnviroment distributed with GEANT4. 13 | 14 | - execute electronEDep in 'batch' mode from macro files 15 | % electronEDep eDep.mac 16 | 17 | - execute electronEDep in 'interactive mode' with visualization 18 | % electronEDep 19 | .... 20 | Idle> type your commands 21 | .... 22 | Idle> exit 23 | 24 | ## Histograms and Analysis 25 | 26 | No histograms are produced in this simulation. Instead, the analysis of the simulation can be summarized into a csv with the provided python script, `analysis.py`. 27 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/eDep.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Simulate the electron energy runs 3 | # 4 | /control/verbose 0 5 | /run/verbose 0 6 | # 7 | /det/setMat G4_POLYSTYRENE 8 | # 9 | /run/initialize 10 | # 11 | # Simulated Ranges 12 | /gun/particle e- 13 | /gun/energy 3.162 keV 14 | /run/beamOn 1000000 15 | # 16 | /gun/energy 10 keV 17 | /run/beamOn 1000000 18 | # 19 | /gun/energy 31.62 keV 20 | /run/beamOn 1000000 21 | # 22 | /gun/energy 100 keV 23 | /run/beamOn 1000000 24 | # 25 | /gun/energy 316.2 keV 26 | /run/beamOn 1000000 27 | # 28 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "G4UImessenger.hh" 5 | #include "globals.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithADoubleAndUnit; 11 | class G4UIcmdWithoutParameter; 12 | 13 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 14 | 15 | class DetectorMessenger: public G4UImessenger 16 | { 17 | public: 18 | 19 | DetectorMessenger(DetectorConstruction* ); 20 | ~DetectorMessenger(); 21 | 22 | virtual void SetNewValue(G4UIcommand*, G4String); 23 | 24 | private: 25 | 26 | DetectorConstruction* fDetector; 27 | 28 | G4UIdirectory* fDetDir; 29 | G4UIcmdWithAString* fMaterCmd; 30 | G4UIcmdWithADoubleAndUnit* fSizeCmd; 31 | G4UIcmdWithoutParameter* fUpdateCmd; 32 | }; 33 | 34 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef EventAction_h 2 | #define EventAction_h 1 3 | 4 | #include "G4UserEventAction.hh" 5 | #include "globals.hh" 6 | 7 | class EventActionMessenger; 8 | class Analysis; 9 | class EventAction : public G4UserEventAction 10 | { 11 | public: 12 | EventAction(); 13 | ~EventAction(); 14 | 15 | public: 16 | virtual void BeginOfEventAction(const G4Event*); 17 | virtual void EndOfEventAction(const G4Event*); 18 | /** 19 | * Increment the energy deposition of the event 20 | * 21 | * @param Edep - the energy deposition of the event 22 | */ 23 | void AddEdep(G4double,G4double); 24 | 25 | 26 | private: 27 | 28 | }; 29 | #endif 30 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/Materials.hh: -------------------------------------------------------------------------------- 1 | #ifndef Materials_h 2 | #define Materials_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4Material.hh" 6 | #include "G4NistManager.hh" 7 | 8 | /** 9 | * Constructor for the Optical Materials 10 | * 11 | * The optical materials are implemented as a static class 12 | */ 13 | class Materials{ 14 | 15 | public: 16 | ~Materials(); 17 | static Materials* GetInstance(); 18 | G4Material* GetMaterial(const G4String); 19 | 20 | private: 21 | // Methods 22 | Materials(); 23 | void CreateMaterials(); 24 | 25 | // Fields 26 | static Materials* instance; /* Materials Instance */ 27 | G4NistManager* nistMan; /* NIST Material Manager */ 28 | G4Material* Teflon; /* Teflon Tape */ 29 | G4Material* GS20; /* GS20 Detector */ 30 | G4Material* BK7; /* PMT Window Glass (Boroscilate) */ 31 | G4Material* Silicone; /* Optical Grease */ 32 | G4Material* Air; /* Air */ 33 | G4Material* PMMA; /* PMMA (Plexiglass) */ 34 | G4Material* EJ426; /* EJ426 (LiF:ZnS(Ag)) */ 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | #include "globals.hh" 6 | 7 | class G4ParticleGun; 8 | class G4Event; 9 | 10 | /// The primary generator action class with particle gum. 11 | /// 12 | /// It defines a single particle which hits the Tracker 13 | /// perpendicular to the input face. The type of the particle 14 | /// can be changed via the G4 build-in commands of G4ParticleGun class 15 | /// (see the macros provided with this example). 16 | 17 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 18 | { 19 | public: 20 | PrimaryGeneratorAction(); 21 | virtual ~PrimaryGeneratorAction(); 22 | 23 | virtual void GeneratePrimaries(G4Event* ); 24 | 25 | G4ParticleGun* GetParticleGun() {return fParticleGun;} 26 | 27 | // Set methods 28 | void SetRandomFlag(G4bool ); 29 | 30 | private: 31 | G4ParticleGun* fParticleGun; // G4 particle gun 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef RunAction_h 2 | #define RunAction_h 1 3 | 4 | #include "G4UserRunAction.hh" 5 | #include "globals.hh" 6 | 7 | 8 | class G4Run; 9 | class G4ParticleGun; 10 | class DetectorConstruction; 11 | class Analysis; 12 | class PrimaryGeneratorAction; 13 | 14 | 15 | class RunAction : public G4UserRunAction 16 | { 17 | public: 18 | RunAction(DetectorConstruction*, PrimaryGeneratorAction*); 19 | ~RunAction(); 20 | 21 | public: 22 | virtual void BeginOfRunAction(const G4Run*); 23 | virtual void EndOfRunAction(const G4Run*); 24 | 25 | 26 | /** 27 | * Increment the energy depositioin 28 | * 29 | * @param - the energy deposited in the run 30 | */ 31 | void AddEdep(G4double, G4double); 32 | 33 | private: 34 | DetectorConstruction* fDetector; /** Pointer to detector geometry */ 35 | PrimaryGeneratorAction* fPrimary; /** Pointer to primary action */ 36 | 37 | }; 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/include/SteppingAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef SteppingAction_h 2 | #define SteppingAction_h 1 3 | 4 | #include "G4UserSteppingAction.hh" 5 | 6 | class RunAction; 7 | class EventAction; 8 | 9 | class SteppingAction : public G4UserSteppingAction 10 | { 11 | public: 12 | SteppingAction(EventAction*); 13 | ~SteppingAction() {}; 14 | 15 | virtual void UserSteppingAction(const G4Step*); 16 | 17 | private: 18 | EventAction* fEventAction; /** Pointer to EventAction */ 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /ElectronEnergyDeposition/src/SteppingAction.cc: -------------------------------------------------------------------------------- 1 | #include "SteppingAction.hh" 2 | #include "RunAction.hh" 3 | #include "EventAction.hh" 4 | 5 | #include "G4SteppingManager.hh" 6 | #include "G4VProcess.hh" 7 | 8 | /** 9 | * Creates a hook into a class that is called at every step in the Geant4 10 | * simulation. Initilization of the fiels is preformed. 11 | * 12 | * @param run - the RunAction 13 | * @param event - the EventAction 14 | */ 15 | SteppingAction::SteppingAction(EventAction* event) 16 | :fEventAction(event) 17 | { } 18 | 19 | /** 20 | * Fills the step length and increments the energy depostion. Only the step 21 | * length of the primary particle (Track ID = 1) is booked in the histogram. 22 | * 23 | * @param aStep - the step 24 | */ 25 | void SteppingAction::UserSteppingAction(const G4Step* aStep) 26 | { 27 | G4double xPos = aStep->GetPostStepPoint()->GetPosition().x(); 28 | G4double EdepStep = aStep->GetTotalEnergyDeposit(); 29 | if (EdepStep > 0.) { fEventAction->AddEdep(xPos,EdepStep);} 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /EnergyDeposition/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | #include "CaloHit.hh" 9 | 10 | #include "globals.hh" 11 | class HistoManager; 12 | class Analysis { 13 | 14 | public: 15 | // Singleton Class 16 | static Analysis* GetInstance(){ 17 | if(Analysis::singleton == NULL) 18 | Analysis::singleton = new Analysis(); 19 | return Analysis::singleton; 20 | } 21 | 22 | virtual ~Analysis(); 23 | void Initilize(); 24 | void CleanUp(); 25 | 26 | // Accumulation Methods 27 | void PrepareNewEvent(const G4Event* anEvent); 28 | void PrepareNewRun(const G4Run* aRun); 29 | void EndOfEvent(const G4Event* anEvent); 30 | void EndOfRun(const G4Run* aRun); 31 | 32 | private: 33 | 34 | // Singleton Analysis 35 | Analysis(); 36 | static Analysis *singleton; 37 | 38 | G4double GetCalorimeterThickness(); 39 | 40 | 41 | // Accumulation Variables 42 | G4double eDepEvent; 43 | HistoManager* fHistoManager; /* Histogram Manager */ 44 | }; 45 | #endif 46 | -------------------------------------------------------------------------------- /EnergyDeposition/include/CaloSensitiveDetector.hh: -------------------------------------------------------------------------------- 1 | #ifndef CaloSensitiveDetector_h 2 | #define CaloSensitiveDetector_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "CaloHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | class G4TouchableHistory; 10 | 11 | class CaloSensitiveDetector : public G4VSensitiveDetector 12 | { 13 | public: 14 | CaloSensitiveDetector(const G4String& name, const G4String& HCname); 15 | ~CaloSensitiveDetector(); 16 | 17 | void Initialize(G4HCofThisEvent*); 18 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 19 | void EndOfEvent(G4HCofThisEvent*); 20 | 21 | private: 22 | CaloHitsCollection* hitCollection; 23 | 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /EnergyDeposition/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithoutParameter; 13 | 14 | class DetectorMessenger: public G4UImessenger 15 | { 16 | public: 17 | DetectorMessenger(DetectorConstruction* ); 18 | ~DetectorMessenger(); 19 | 20 | void SetNewValue(G4UIcommand*, G4String); 21 | 22 | private: 23 | DetectorConstruction* Detector; 24 | 25 | G4UIdirectory* PolymerTransportDir; 26 | G4UIdirectory* detDir; 27 | G4UIcmdWithAString* AbsMaterCmd; 28 | G4UIcmdWithAString* GapMaterCmd; 29 | G4UIcmdWithADoubleAndUnit* AbsThickCmd; 30 | G4UIcmdWithADoubleAndUnit* GapThickCmd; 31 | G4UIcmdWithADoubleAndUnit* SizeRadiusCmd; 32 | G4UIcmdWithAnInteger* NbLayersCmd; 33 | G4UIcmdWithoutParameter* UpdateCmd; 34 | }; 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /EnergyDeposition/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /EnergyDeposition/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /EnergyDeposition/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /EnergyDeposition/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /EnergyDeposition/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /EnergyDeposition/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /EnergyDeposition/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /EnergyDeposition/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /EnergyDeposition/src/CaloHit.cc: -------------------------------------------------------------------------------- 1 | #include "CaloHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator HitAllocator; 10 | 11 | CaloHit::CaloHit(): G4VHit(){ 12 | // Initilization preformed in intilization list 13 | } 14 | 15 | /** 16 | * Destroctor of CaloHit 17 | */ 18 | CaloHit::~CaloHit() {} 19 | 20 | /** 21 | * Print 22 | * 23 | * Print's out information about the hit 24 | */ 25 | void CaloHit::Print(){ 26 | G4cout << " trackID: " << trackID <<" particle: " 27 | <GetParticleName()<<" rank: "<GetName() 29 | <<" position[mm]: " << pos/mm 30 | <<"\n Momentum "<PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /EnergyDeposition/src/HistoManager.cc: -------------------------------------------------------------------------------- 1 | #include "HistoManager.hh" 2 | #include "G4UnitsTable.hh" 3 | 4 | /** 5 | * Creates a Histogram manger with the default name 6 | */ 7 | HistoManager::HistoManager(): fFileName("energyDep") 8 | { 9 | Book(); 10 | } 11 | /** 12 | * Deconstructor 13 | */ 14 | HistoManager::~HistoManager() 15 | { 16 | delete G4AnalysisManager::Instance(); 17 | } 18 | /** 19 | * Sets up the histograms 20 | * 21 | * The histograms are inactived as the number of bins and the range of the 22 | * histograms have not been set. The type of analysis is done by the selection 23 | * of the namespace in HistoManger.hh 24 | */ 25 | void HistoManager::Book() 26 | { 27 | // Create or get analysis manager 28 | G4AnalysisManager* aMan = G4AnalysisManager::Instance(); 29 | aMan->SetFileName(fFileName); 30 | aMan->SetVerboseLevel(1); 31 | aMan->SetFirstHistoId(1); // start histogram numbering from 1 32 | aMan->SetActivation(true); // enable inactivation of histograms 33 | 34 | 35 | // Create all histograms as inactivated 36 | G4int ih = 0; 37 | ih = aMan->CreateH1("eDep","Total Energy Depostion",100,0,100); 38 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, false); 39 | ih = aMan->CreateH2("posEDep","Positional Energy Deposition",50,0,5*MeV,50,0,1*cm); 40 | aMan->SetActivation(G4VAnalysisManager::kH2, ih, false); 41 | } 42 | -------------------------------------------------------------------------------- /EnergyDeposition/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmLivermorePhysics.hh" 6 | #include "G4OpticalPhysics.hh" 7 | #include "HadronPhysicsQGSP_BERT_HP.hh" 8 | #include "G4IonPhysics.hh" 9 | 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | */ 15 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 16 | currentDefaultCut = 10*nm; 17 | 18 | // SetVerboseLevel(1); 19 | 20 | // Adding Physics List 21 | //RegisterPhysics( new G4EmDNAPhysics()); 22 | RegisterPhysics( new G4EmStandardPhysics()); 23 | RegisterPhysics( new G4EmLivermorePhysics()); 24 | RegisterPhysics( new HadronPhysicsQGSP_BERT_HP()); 25 | RegisterPhysics( new G4IonPhysics()); 26 | } 27 | 28 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 29 | 30 | PhysicsList::~PhysicsList(){ 31 | // Nothing to be done 32 | } 33 | 34 | 35 | 36 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 37 | 38 | void PhysicsList::SetCuts(){ 39 | 40 | SetDefaultCutValue(10*nm); 41 | } 42 | -------------------------------------------------------------------------------- /EnergyDeposition/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction(){ 20 | delete fParticleGun; 21 | } 22 | 23 | 24 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 25 | { 26 | fParticleGun->GeneratePrimaryVertex(anEvent); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /EnergyDeposition/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | Analysis::GetInstance()->EndOfRun(aRun); 26 | } 27 | -------------------------------------------------------------------------------- /EnergyDeposition/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/EnergyDeposition 3 | 4 | # 5 | # Setting up the job 6 | # 7 | function JobSetup() 8 | { 9 | echo "#PBS -q gen1" > job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=1:ppn=2" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "exec $G4WORKDIR/build/energyDep $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "exec $G4WORKDIR/build/energyDep $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | # Running the jobs 32 | runGamma 33 | runNeutron 34 | # Cleaning up 35 | rm nSub.qsub 36 | rm gSub.qsub 37 | 38 | -------------------------------------------------------------------------------- /LightQuenching/7LiRun.mac: -------------------------------------------------------------------------------- 1 | # 2 | # 7-Li Primary Particles (1 MeV to 10 keV) 3 | # 4 | /control/verbose 0 5 | /run/verbose 0 6 | # 7 | /gun/particle ion 8 | /gun/ion 3 7 9 | # 10 | /run/initialize 11 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 12 | /gun/energy 2.15 MeV 13 | /run/beamOn 10000 14 | # 15 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 16 | /gun/energy 1 MeV 17 | /run/beamOn 10000 18 | # 19 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 20 | /gun/energy 464 keV 21 | /run/beamOn 10000 22 | # 23 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 24 | /gun/energy 215 keV 25 | /run/beamOn 10000 26 | # 27 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 28 | /gun/energy 100 keV 29 | /run/beamOn 10000 30 | # 31 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 32 | /gun/energy 46.4 keV 33 | /run/beamOn 10000 34 | # 35 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 36 | /gun/energy 21.5 keV 37 | /run/beamOn 10000 38 | # 39 | /analysis/h1/set 1 100 0 5000 # Number of optical photons created 40 | /gun/energy 10 keV 41 | /run/beamOn 10000 42 | -------------------------------------------------------------------------------- /LightQuenching/README.md: -------------------------------------------------------------------------------- 1 | Light Quenching 2 | =============== 3 | 4 | Simulates the light quenching of scintillators using the GEANT4 toolkit. The geometry is currently a simple box volume, using a polystyrene based scintillator. The physic of the simulation include Optical Physics for the simulation of the light yield. The plastic scintillator proprieties are taken from the G4 simulation example in `examples/extended/optical/wls`. A PVT based scintillator is also provided, but without setting the `birks parameter` the quenching is not observable. 5 | 6 | Several runs are provided for the user. They are: 7 | 8 | + alphaRun.mac - Alpha from 10 keV to 2.15 MeV 9 | + eRun.mac - Electrons from 10 keV to 2.15 MeV 10 | + tritonRun.mac - Tritons from 10 keV to 2.15 MeV 11 | + demoRun.mac - A representation of a gamma and neutron 12 | 13 | In addition, for convince a script has been written, `jobSub.sh`, which allows for the submission of all of the runs to the cluster system. 14 | 15 | The analysis is completed without the use of the Singleton analysis class. This might be recovered by using a previous commit. 16 | A root script is provided, `LightQuench.C` which may be invoked by root that compares distribution of number of photons created for the particles in demoRun.mac. This script also generates .csv files which can then be plotted in ones favorite package. 17 | -------------------------------------------------------------------------------- /LightQuenching/alphaRun.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Alpha Primary Particles (1 MeV to 10 keV) 3 | # 4 | /control/verbose 0 5 | /run/verbose 0 6 | # 7 | /gun/particle alpha 8 | # 9 | /run/initialize 10 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 11 | /gun/energy 2.15 MeV 12 | /run/beamOn 10000 13 | # 14 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 15 | /gun/energy 1 MeV 16 | /run/beamOn 10000 17 | # 18 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 19 | /gun/energy 464 keV 20 | /run/beamOn 10000 21 | # 22 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 23 | /gun/energy 215 keV 24 | /run/beamOn 10000 25 | # 26 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 27 | /gun/energy 100 keV 28 | /run/beamOn 10000 29 | # 30 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 31 | /gun/energy 46.4 keV 32 | /run/beamOn 10000 33 | # 34 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 35 | /gun/energy 21.5 keV 36 | /run/beamOn 10000 37 | # 38 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 39 | /gun/energy 10 keV 40 | /run/beamOn 10000 41 | -------------------------------------------------------------------------------- /LightQuenching/demoRun.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Electron, alpha and triton primary paritlces 3 | # 100 keV 2.05 MeV 2.73 MeV 4 | # 5 | /control/verbose 0 6 | /run/verbose 0 7 | # 8 | # 9 | /run/initialize 10 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 11 | /analysis/setFileName electronOP 12 | /gun/particle e- 13 | /gun/energy 0.0190 MeV 14 | /run/beamOn 100000 15 | # 16 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 17 | /analysis/setFileName alphaOP 18 | /gun/particle alpha 19 | /gun/energy 2.05 MeV 20 | /run/beamOn 100000 21 | # 22 | /analysis/setFileName tritonOP 23 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 24 | /gun/particle triton 25 | /gun/energy 2.73 MeV 26 | /run/beamOn 100000 27 | 28 | /analysis/setFileName none 29 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 30 | /gun/particle alpha 31 | /gun/energy 1.78 MeV 32 | /run/beamOn 100000 33 | 34 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 35 | /gun/particle e- 36 | /gun/energy 4.78 MeV 37 | /run/beamOn 100000 38 | 39 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 40 | /gun/particle e- 41 | /gun/energy 2.78 MeV 42 | /run/beamOn 100000 43 | 44 | /gun/particle ion 45 | /gun/ion 3 7 46 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 47 | /gun/energy 1.02 MeV 48 | /run/beamOn 10000 49 | -------------------------------------------------------------------------------- /LightQuenching/eRun.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Electron Primary Particles (1 MeV to 10 keV) 3 | # 4 | /control/verbose 0 5 | /run/verbose 0 6 | # 7 | /gun/particle e- 8 | # 9 | /run/initialize 10 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 11 | /gun/energy 2.15 MeV 12 | /run/beamOn 10000 13 | # 14 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 15 | /gun/energy 1 MeV 16 | /run/beamOn 10000 17 | # 18 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 19 | /gun/energy 464 keV 20 | /run/beamOn 10000 21 | # 22 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 23 | /gun/energy 215 keV 24 | /run/beamOn 10000 25 | # 26 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 27 | /gun/energy 100 keV 28 | /run/beamOn 10000 29 | # 30 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 31 | /gun/energy 46.4 keV 32 | /run/beamOn 10000 33 | # 34 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 35 | /gun/energy 21.5 keV 36 | /run/beamOn 10000 37 | # 38 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 39 | /gun/energy 10 keV 40 | /run/beamOn 10000 41 | -------------------------------------------------------------------------------- /LightQuenching/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | 15 | class G4Event; 16 | 17 | /*! 18 | * \brief User's EventAction class 19 | * This class implements the Event Action. 20 | * 21 | */ 22 | 23 | 24 | class EventAction : public G4UserEventAction{ 25 | public: 26 | EventAction(); 27 | virtual ~EventAction() {}; 28 | //! Beginning of the event 29 | virtual void BeginOfEventAction(const G4Event* event); 30 | //! Digitize hits and store information 31 | virtual void EndOfEventAction(const G4Event* event); 32 | 33 | private: 34 | }; 35 | #endif 36 | -------------------------------------------------------------------------------- /LightQuenching/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightQuenching/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightQuenching/include/Materials.hh: -------------------------------------------------------------------------------- 1 | #ifndef Materials_h 2 | #define Materials_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4Material.hh" 6 | #include "G4NistManager.hh" 7 | 8 | /** 9 | * Constructor for the Optical Materials 10 | * 11 | * The optical materials are implemented as a static class 12 | */ 13 | class Materials{ 14 | 15 | public: 16 | ~Materials(); 17 | static Materials* GetInstance(); 18 | G4Material* GetMaterial(const G4String); 19 | 20 | private: 21 | // Methods 22 | Materials(); 23 | void CreateMaterials(); 24 | void SetOpticalPropertiesPS(); 25 | void SetOpticalPropertiesEJ200(); 26 | 27 | // Fields 28 | static Materials* instance; /* Materials Instance */ 29 | G4NistManager* nistMan; /* NIST Material Manager */ 30 | G4Material* EJ200; /* EJ200 Detector */ 31 | G4Material* Polystyrene; /* PMT Window Glass (Boroscilate) */ 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /LightQuenching/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightQuenching/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | #include "globals.hh" 6 | 7 | class G4ParticleGun; 8 | class G4Event; 9 | 10 | /// The primary generator action class with particle gum. 11 | /// 12 | /// It defines a single particle which hits the Tracker 13 | /// perpendicular to the input face. The type of the particle 14 | /// can be changed via the G4 build-in commands of G4ParticleGun class 15 | /// (see the macros provided with this example). 16 | 17 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 18 | { 19 | public: 20 | PrimaryGeneratorAction(); 21 | virtual ~PrimaryGeneratorAction(); 22 | 23 | virtual void GeneratePrimaries(G4Event* ); 24 | 25 | G4ParticleGun* GetParticleGun() {return fParticleGun;} 26 | 27 | // Set methods 28 | void SetRandomFlag(G4bool ); 29 | 30 | private: 31 | G4ParticleGun* fParticleGun; // G4 particle gun 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /LightQuenching/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | 16 | class G4Run; 17 | class HistoManager; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction(); 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | HistoManager* fHistoManager; /* Histogram Manager */ 27 | }; 28 | #endif 29 | -------------------------------------------------------------------------------- /LightQuenching/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightQuenching/src/EventAction.cc: -------------------------------------------------------------------------------- 1 | #include "EventAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4Event.hh" 5 | #include "G4SDManager.hh" 6 | #include "G4HCofThisEvent.hh" 7 | #include "G4UnitsTable.hh" 8 | #include "G4ios.hh" 9 | 10 | EventAction::EventAction() : G4UserEventAction(){ } 11 | 12 | /* 13 | * BeginOfEventAction 14 | * 15 | * Called before the begining of each event 16 | */ 17 | void EventAction::BeginOfEventAction(const G4Event* event){ 18 | } 19 | 20 | /** 21 | * EndOfEventAction 22 | * 23 | * @param const G4Event* event - event to be processed 24 | * 25 | * At the end of an event we want to call analysis to proccess 26 | * this event, and record the useful information. 27 | */ 28 | void EventAction::EndOfEventAction(const G4Event* event){ 29 | } 30 | -------------------------------------------------------------------------------- /LightQuenching/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmStandardPhysics_option4.hh" 6 | #include "G4EmLivermorePhysics.hh" 7 | #include "G4OpticalPhysics.hh" 8 | #include "HadronPhysicsQGSP_BERT.hh" 9 | #include "G4IonPhysics.hh" 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | * 15 | * The physics list relies on modular physics. Currently used modules are: 16 | * - Hadronic physics (High Precision) 17 | * - IonPhysics 18 | * - OpticalPhysics 19 | * - EM Standard Physics 20 | */ 21 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 22 | currentDefaultCut = 10*nm; 23 | 24 | // SetVerboseLevel(1); 25 | 26 | // Adding Physics List 27 | RegisterPhysics( new HadronPhysicsQGSP_BERT()); 28 | RegisterPhysics( new G4IonPhysics()); 29 | RegisterPhysics( new G4OpticalPhysics()); 30 | RegisterPhysics( new G4EmStandardPhysics_option4()); 31 | // RegisterPhysics( new G4EmDNAPhysics()); 32 | } 33 | 34 | /** 35 | * Deconstructor 36 | */ 37 | PhysicsList::~PhysicsList(){ 38 | // Nothing to be done 39 | } 40 | /** 41 | * Sets the physic list cuts 42 | */ 43 | void PhysicsList::SetCuts(){ 44 | SetDefaultCutValue(10*um); 45 | } 46 | -------------------------------------------------------------------------------- /LightQuenching/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "HistoManager.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); 24 | analysisManager->FillH1(1,optPhotonCounter); 25 | } 26 | /** 27 | * PrepareNewEvent 28 | * 29 | * Prepares a new event for the stacking action. 30 | * The only action we need to do is reset the counters 31 | */ 32 | void StackingAction::PrepareNewEvent(){ 33 | optPhotonCounter = 0; 34 | } 35 | /** 36 | * ClassifyNewTrack 37 | * 38 | * Called every time a new track needs to be classified, so we can use it to 39 | * determine in the new track is an optical photon 40 | */ 41 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 42 | // Optical Photon Counter 43 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 44 | optPhotonCounter++; 45 | } 46 | return fUrgent; 47 | } 48 | -------------------------------------------------------------------------------- /LightQuenching/tritonRun.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Triton Primary Particles (1 MeV to 10 keV) 3 | # 4 | /control/verbose 0 5 | /run/verbose 0 6 | # 7 | /gun/particle triton 8 | # 9 | /run/initialize 10 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 11 | /gun/energy 2.15 MeV 12 | /run/beamOn 10000 13 | # 14 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 15 | /gun/energy 1 MeV 16 | /run/beamOn 10000 17 | # 18 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 19 | /gun/energy 464 keV 20 | /run/beamOn 10000 21 | # 22 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 23 | /gun/energy 215 keV 24 | /run/beamOn 10000 25 | # 26 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 27 | /gun/energy 100 keV 28 | /run/beamOn 10000 29 | # 30 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 31 | /gun/energy 46.4 keV 32 | /run/beamOn 10000 33 | # 34 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 35 | /gun/energy 21.5 keV 36 | /run/beamOn 10000 37 | # 38 | /analysis/h1/set 1 100 0 8000 # Number of optical photons created 39 | /gun/energy 10 keV 40 | /run/beamOn 10000 41 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/birksConstant.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/BirksConstant 3 | # 4 | # Setting up the job 5 | # 6 | function JobSetup() 7 | { 8 | echo "#!/bin/bash" > job 9 | echo "#PBS -q gen2" >> job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=1:ppn=1" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "exec $G4WORKDIR/build_${b}/birksConstant $G4WORKDIR/macros/gRun.mac > Birks_${b}_GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "exec $G4WORKDIR/build_${b}/birksConstant $G4WORKDIR/macros/nRun.mac > Birks_${b}_NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | 32 | 33 | birks=(0.01 0.012 0.014 0.016 0.018 0.02 0.025 0.03 0.035 0.04 0.045 0.05 0.06 0.07 0.08 0.09 0.1) 34 | for b in "${birks[@]}" 35 | do 36 | # Changing the Birks 37 | sed -i "s|G4double birksConstant.*|G4double birksConstant = ${b}*mm/MeV;|g" src/Material.cc 38 | dos2unix src/Material.cc 39 | 40 | # Recompiling 41 | mkdir build_${b}; cd build_${b}; 42 | cmake .. 43 | make -j4 44 | cd .. 45 | 46 | # Running the calculation 47 | ## Running the jobs 48 | runGamma 49 | runNeutron 50 | ## Cleaning up 51 | rm nSub.qsub 52 | rm gSub.qsub 53 | 54 | done 55 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/cleanUp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Cleaning up the queue files and combining histograms" 4 | rm -f *.qsub.* 5 | 6 | # EJ-426 Data output 7 | if test -n "$(find . -maxdepth 1 -name 'EJ426_neutron-0*.root' -print -quit)" 8 | then 9 | hadd -f -v 1 EJ426_neutron.root EJ426_neutron-0*.root 10 | rm EJ426_neutron-0*.root 11 | fi 12 | if test -n "$(find . -maxdepth 1 -name 'EJ426_Gamma-0*.root' -print -quit)" 13 | then 14 | hadd -f -v 1 EJ426_Gamma.root EJ426_Gamma-0*.root 15 | rm EJ426_Gamma-0*.root 16 | fi 17 | 18 | # PS Data output 19 | if test -n "$(find . -maxdepth 1 -name 'PSLiF_neutron-0*.root' -print -quit)" 20 | then 21 | hadd -f -v 1 PSLiF_neutron.root PSLiF_neutron-0*.root 22 | rm PSLiF_neutron-0*.root 23 | fi 24 | if test -n "$(find . -maxdepth 1 -name 'PSLiF_Gamma-0*.root' -print -quit)" 25 | then 26 | hadd -f -v 1 PSLiF_Gamma.root PSLiF_Gamma-0*.root 27 | rm PSLiF_Gamma-0*.root 28 | fi 29 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | #include "globals.hh" 9 | class HistoManager; 10 | class Analysis { 11 | 12 | public: 13 | // Singleton Class 14 | static Analysis* GetInstance(){ 15 | if(Analysis::singleton == NULL) 16 | Analysis::singleton = new Analysis(); 17 | return Analysis::singleton; 18 | } 19 | 20 | virtual ~Analysis(); 21 | void Initilize(); 22 | void CleanUp(); 23 | 24 | // Accumulation Methods 25 | void PrepareNewEvent(const G4Event* anEvent); 26 | void PrepareNewRun(const G4Run* aRun); 27 | void EndOfEvent(const G4Event* anEvent); 28 | void EndOfRun(const G4Run* aRun); 29 | void SetNumOpticalPhotonsGenerated(G4int numPhotons); 30 | 31 | private: 32 | 33 | // Singleton Analysis 34 | Analysis(); 35 | static Analysis *singleton; 36 | 37 | // Accumulation Variables 38 | G4double nOPAbsEvent; 39 | HistoManager* fHistoManager; /* Histogram Manager */ 40 | }; 41 | #endif 42 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithADouble; 13 | class G4UIcmdWithoutParameter; 14 | 15 | class DetectorMessenger: public G4UImessenger 16 | { 17 | public: 18 | DetectorMessenger(DetectorConstruction* ); 19 | ~DetectorMessenger(); 20 | 21 | void SetNewValue(G4UIcommand*, G4String); 22 | 23 | private: 24 | DetectorConstruction* Detector; 25 | 26 | G4UIdirectory* detDir; 27 | G4UIcmdWithAString* DetMatCmd; 28 | G4UIcmdWithADoubleAndUnit* DetThickCmd; 29 | G4UIcmdWithADouble* BirksCmd; 30 | G4UIcmdWithoutParameter* UpdateCmd; 31 | }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/macros/BirksConstant.mac: -------------------------------------------------------------------------------- 1 | # 2 | /det/setDetMaterial GS20 3 | /det/update 4 | /run/beamOn 10000 5 | # 6 | /det/setDetMaterial PSLiF 7 | /det/update 8 | /run/beamOn 10000 9 | # 10 | /det/setDetMaterial EJ426 11 | /det/update 12 | /run/beamOn 10000 13 | # 14 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /control/execute macros/BirksConstant.mac 12 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /control/execute macros/BirksConstant.mac 12 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/EventAction.cc: -------------------------------------------------------------------------------- 1 | #include "EventAction.hh" 2 | #include "Analysis.hh" 3 | 4 | #include "G4RunManager.hh" 5 | #include "G4Event.hh" 6 | #include "G4SDManager.hh" 7 | #include "G4HCofThisEvent.hh" 8 | #include "G4UnitsTable.hh" 9 | #include "G4ios.hh" 10 | 11 | EventAction::EventAction() : G4UserEventAction(){ } 12 | 13 | /* 14 | * BeginOfEventAction 15 | * 16 | * Called before the begining of each event 17 | */ 18 | void EventAction::BeginOfEventAction(const G4Event* event){ 19 | Analysis::GetInstance()->PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/HistoManager.cc: -------------------------------------------------------------------------------- 1 | #include "HistoManager.hh" 2 | #include "G4UnitsTable.hh" 3 | 4 | /** 5 | * Creates a Histogram manger with the default name 6 | */ 7 | HistoManager::HistoManager(): fFileName("LayeredDetectorCal") 8 | { 9 | Book(); 10 | } 11 | /** 12 | * Deconstructor 13 | */ 14 | HistoManager::~HistoManager() 15 | { 16 | delete G4AnalysisManager::Instance(); 17 | } 18 | /** 19 | * Sets up the histograms 20 | * 21 | * The histograms are inactived as the number of bins and the range of the 22 | * histograms have not been set. The type of analysis is done by the selection 23 | * of the namespace in HistoManger.hh 24 | */ 25 | void HistoManager::Book() 26 | { 27 | // Create or get analysis manager 28 | G4AnalysisManager* aMan = G4AnalysisManager::Instance(); 29 | aMan->SetFileName(fFileName); 30 | aMan->SetVerboseLevel(0); 31 | aMan->SetFirstHistoId(1); // start histogram numbering from 1 32 | aMan->SetActivation(true); // enable inactivation of histograms 33 | 34 | 35 | // Create all histograms as inactivated 36 | G4int ih = 0; 37 | ih = aMan->CreateH1("numPhotonsDet","Number of Optical Photons Generated",100,0,10000); 38 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, true); 39 | } 40 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmStandardPhysics_option4.hh" 6 | #include "G4EmLivermorePhysics.hh" 7 | #include "G4OpticalPhysics.hh" 8 | #include "HadronPhysicsQGSP_BERT_HP.hh" 9 | #include "G4IonPhysics.hh" 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | * 15 | * The physics list relies on modular physics. Currently used modules are: 16 | * - Hadronic physics (High Precision) 17 | * - IonPhysics 18 | * - OpticalPhysics 19 | * - EM Standard Physics 20 | */ 21 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 22 | currentDefaultCut = 10*nm; 23 | 24 | // SetVerboseLevel(1); 25 | 26 | // Adding Physics List 27 | RegisterPhysics( new HadronPhysicsQGSP_BERT_HP()); 28 | RegisterPhysics( new G4IonPhysics()); 29 | RegisterPhysics( new G4OpticalPhysics()); 30 | RegisterPhysics( new G4EmStandardPhysics_option4()); 31 | // RegisterPhysics( new G4EmDNAPhysics()); 32 | } 33 | 34 | /** 35 | * Deconstructor 36 | */ 37 | PhysicsList::~PhysicsList(){ 38 | // Nothing to be done 39 | } 40 | /** 41 | * Sets the physic list cuts 42 | */ 43 | void PhysicsList::SetCuts(){ 44 | SetDefaultCutValue(1*um); 45 | } 46 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction() 20 | { 21 | delete fParticleGun; 22 | } 23 | 24 | 25 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 26 | { 27 | fParticleGun->GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | Analysis::GetInstance()->EndOfRun(aRun); 26 | } 27 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon. Once the track has been 39 | * classified (if it is an optical photon) the track is killed. 40 | */ 41 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 42 | // Optical Photon Counter 43 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 44 | optPhotonCounter++; 45 | return fKill; 46 | } 47 | return fUrgent; 48 | } 49 | -------------------------------------------------------------------------------- /LightValidation/BirksConstant/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/LayeredDetectorCalibration 3 | # 4 | # Setting up the job 5 | # 6 | function JobSetup() 7 | { 8 | echo "#!/bin/bash" > job 9 | echo "#PBS -q gen2" >> job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=2:ppn=4" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "mpirun $G4WORKDIR/build/scintSlabCal $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "mpirun $G4WORKDIR/build/scintSlabCal $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | 32 | ## Running the jobs 33 | runGamma 34 | runNeutron 35 | ## Cleaning up 36 | rm nSub.qsub 37 | rm gSub.qsub 38 | -------------------------------------------------------------------------------- /LightValidation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #---Adding examples subdirectories explicitly 2 | # and a custom target to for building all code bases ------------- 3 | 4 | cmake_minimum_required(VERSION 2.6 FATAL_ERROR) 5 | 6 | add_subdirectory(GS20Calibration) 7 | add_custom_target(LightValidation DEPENDS lightYield) 8 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/README.md: -------------------------------------------------------------------------------- 1 | GS20 Calibration 2 | ================ 3 | 4 | Simulation of gammas and neutrons and the subsquent energy depsotion and optical photons in GS20. 5 | 6 | The Briks constant was set to be 0.025 mm/MeV. 7 | Naming Conventions: 8 | Abosrber - the GS20 Scintillator 9 | PMT - the pmt 10 | 11 | The seperate histograms can be combined using the clean up script provided with the simulation 12 | `hadd GS20_Neutron.root GS20_Neutron_*.root` 13 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/cleanUp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Cleaning up the queue files and combining histograms" 4 | rm -f *.qsub.* 5 | 6 | # GS20 Data output 7 | if test -n "$(find . -maxdepth 1 -name 'GS20_Neutron-0*.root' -print -quit)" 8 | then 9 | hadd -f -v 1 GS20_Neutron.root GS20_Neutron-0*.root 10 | rm GS20_Neutron-0*.root 11 | fi 12 | if test -n "$(find . -maxdepth 1 -name 'GS20_Gamma-0*.root' -print -quit)" 13 | then 14 | hadd -f -v 1 GS20_Gamma.root GS20_Gamma-0*.root 15 | rm GS20_Gamma-0*.root 16 | fi 17 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/AbsorberSD.hh: -------------------------------------------------------------------------------- 1 | #ifndef AbsorberSD_h 2 | #define AbsorberSD_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "AbsorberHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | class G4TouchableHistory; 10 | 11 | class AbsorberSD : public G4VSensitiveDetector 12 | { 13 | public: 14 | AbsorberSD(const G4String& name, const G4String& HCname); 15 | ~AbsorberSD(); 16 | 17 | void Initialize(G4HCofThisEvent*); 18 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 19 | G4bool ProcessAbsorberHit(G4Step*,G4TouchableHistory*); 20 | G4bool ProcessOpticalPhotonHit(G4Step*,G4TouchableHistory*); 21 | void EndOfEvent(G4HCofThisEvent*); 22 | 23 | private: 24 | AbsHitsCollection* hitCollection; 25 | }; 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithADouble; 13 | class G4UIcmdWithoutParameter; 14 | 15 | class DetectorMessenger: public G4UImessenger 16 | { 17 | public: 18 | DetectorMessenger(DetectorConstruction* ); 19 | ~DetectorMessenger(); 20 | 21 | void SetNewValue(G4UIcommand*, G4String); 22 | 23 | private: 24 | DetectorConstruction* Detector; 25 | 26 | G4UIdirectory* detDir; 27 | G4UIcmdWithADoubleAndUnit* AbsThickCmd; 28 | G4UIcmdWithADoubleAndUnit* MntThickCmd; 29 | G4UIcmdWithADoubleAndUnit* RefThickCmd; 30 | G4UIcmdWithADoubleAndUnit* SizeRadiusCmd; 31 | G4UIcmdWithAString* DetMaterialCmd; 32 | G4UIcmdWithoutParameter* UpdateCmd; 33 | }; 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/PMTSD.hh: -------------------------------------------------------------------------------- 1 | #ifndef PMTSD_h 2 | #define PMTSD_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "PhotonHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | 10 | class PMTSD : public G4VSensitiveDetector 11 | { 12 | public: 13 | PMTSD(const G4String& name, const G4String& HCname); 14 | ~PMTSD(); 15 | 16 | void Initialize(G4HCofThisEvent*); 17 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 18 | void EndOfEvent(G4HCofThisEvent*); 19 | 20 | private: 21 | PhotonHitsCollection* hitCollection; 22 | 23 | }; 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # GS20 Simulation 10 | # 11 | /analysis/setFileName GS20_Gamma 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | /run/beamOn 100000 16 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # GS20 Simulation 10 | # 11 | /analysis/setFileName GS20_Neutron 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | /run/beamOn 100000 16 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/src/AbsorberHit.cc: -------------------------------------------------------------------------------- 1 | #include "AbsorberHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator AbsHitAllocator; 10 | 11 | AbsorberHit::AbsorberHit(): G4VHit(){ 12 | // Initilization preformed in intilization list 13 | } 14 | 15 | /** 16 | * Destroctor of AbsorberHit 17 | */ 18 | AbsorberHit::~AbsorberHit() {} 19 | 20 | /** 21 | * Print 22 | * 23 | * Print's out information about the hit 24 | */ 25 | void AbsorberHit::Print(){ 26 | G4cout << "particle: "<GetParticleName() 27 | <<"\nvolume: "<GetName() 28 | <<"\n\tposition[mm]: " << pos/mm 29 | <<"\n\tArrival Time: "<PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/src/PhotonHit.cc: -------------------------------------------------------------------------------- 1 | #include "PhotonHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator PhotonHitAllocator; 10 | /** 11 | * Creates a PhotonHit 12 | * 13 | * Hit of a photon on the detector 14 | */ 15 | PhotonHit::PhotonHit(): G4VHit(){ 16 | pos = G4ThreeVector(); 17 | arrivalTime = 0; 18 | kEnergy = 0; 19 | } 20 | 21 | /** 22 | * Destroctor of PhotonHit 23 | */ 24 | PhotonHit::~PhotonHit() {} 25 | 26 | /** 27 | * Print 28 | * 29 | * Print's out information about the hit 30 | */ 31 | void PhotonHit::Print(){ 32 | G4cout << "OpticalPhoton" 33 | <<"\n\tArrival Time: "<GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | Analysis::GetInstance()->EndOfRun(aRun); 26 | } 27 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon 39 | */ 40 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 41 | // Optical Photon Counter 42 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 43 | optPhotonCounter++; 44 | } 45 | return fUrgent; 46 | } 47 | -------------------------------------------------------------------------------- /LightValidation/GS20Calibration/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/GS20Calibration 3 | # 4 | # Setting up the job 5 | # 6 | function JobSetup() 7 | { 8 | echo "#!/bin/bash" > job 9 | echo "#PBS -q gen3" >> job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=2:ppn=8" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "mpirun $G4WORKDIR/build/lightYieldCal $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "mpirun $G4WORKDIR/build/lightYieldCal $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | 32 | ## Running the jobs 33 | runGamma 34 | runNeutron 35 | ## Cleaning up 36 | rm nSub.qsub 37 | rm gSub.qsub 38 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/cleanUp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Cleaning up the queue files and combining histograms" 4 | rm -f *.qsub.* 5 | 6 | # EJ-426 Data output 7 | if test -n "$(find . -maxdepth 1 -name 'EJ426_neutron-0*.root' -print -quit)" 8 | then 9 | hadd -f -v 1 EJ426_neutron.root EJ426_neutron-0*.root 10 | rm EJ426_neutron-0*.root 11 | fi 12 | if test -n "$(find . -maxdepth 1 -name 'EJ426_gamma-0*.root' -print -quit)" 13 | then 14 | hadd -f -v 1 EJ426_Gamma.root EJ426_gamma-0*.root 15 | rm EJ426_gamma-0*.root 16 | fi 17 | 18 | # PS Data output 19 | if test -n "$(find . -maxdepth 1 -name 'PS_neutron-0*.root' -print -quit)" 20 | then 21 | hadd -f -v 1 PSLiF_neutron.root PS_neutron-0*.root 22 | rm PS_neutron-0*.root 23 | fi 24 | if test -n "$(find . -maxdepth 1 -name 'PS_gamma-0*.root' -print -quit)" 25 | then 26 | hadd -f -v 1 PSLiF_Gamma.root PS_gamma-0*.root 27 | rm PS_gamma-0*.root 28 | fi 29 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | #include "globals.hh" 9 | class HistoManager; 10 | class Analysis { 11 | 12 | public: 13 | // Singleton Class 14 | static Analysis* GetInstance(){ 15 | if(Analysis::singleton == NULL) 16 | Analysis::singleton = new Analysis(); 17 | return Analysis::singleton; 18 | } 19 | 20 | virtual ~Analysis(); 21 | void Initilize(); 22 | void CleanUp(); 23 | 24 | // Accumulation Methods 25 | void PrepareNewEvent(const G4Event* anEvent); 26 | void PrepareNewRun(const G4Run* aRun); 27 | void EndOfEvent(const G4Event* anEvent); 28 | void EndOfRun(const G4Run* aRun); 29 | void SetNumOpticalPhotonsGenerated(G4int numPhotons); 30 | 31 | private: 32 | 33 | // Singleton Analysis 34 | Analysis(); 35 | static Analysis *singleton; 36 | 37 | // Accumulation Variables 38 | G4double nOPDetEvent; 39 | G4double nOPAbsEvent; 40 | HistoManager* fHistoManager; /* Histogram Manager */ 41 | }; 42 | #endif 43 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithoutParameter; 13 | 14 | class DetectorMessenger: public G4UImessenger 15 | { 16 | public: 17 | DetectorMessenger(DetectorConstruction* ); 18 | ~DetectorMessenger(); 19 | 20 | void SetNewValue(G4UIcommand*, G4String); 21 | 22 | private: 23 | DetectorConstruction* Detector; 24 | 25 | G4UIdirectory* detDir; 26 | G4UIcmdWithADoubleAndUnit* AbsThickCmd; 27 | G4UIcmdWithADoubleAndUnit* MntThickCmd; 28 | G4UIcmdWithADoubleAndUnit* RefThickCmd; 29 | G4UIcmdWithoutParameter* UpdateCmd; 30 | G4UIcmdWithAString* DetMatCmd; 31 | }; 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/PMTSD.hh: -------------------------------------------------------------------------------- 1 | #ifndef PMTSD_h 2 | #define PMTSD_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "PhotonHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | 10 | class PMTSD : public G4VSensitiveDetector 11 | { 12 | public: 13 | PMTSD(const G4String& name, const G4String& HCname); 14 | ~PMTSD(); 15 | 16 | void Initialize(G4HCofThisEvent*); 17 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 18 | void EndOfEvent(G4HCofThisEvent*); 19 | 20 | private: 21 | PhotonHitsCollection* hitCollection; 22 | 23 | }; 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # Volumetric Co60 Source 2 | /gps/source/intensity 1. 3 | /gps/particle gamma 4 | /control/execute macros/volumetricSource.mac 5 | # Energy 6 | /gps/ene/type Mono 7 | /gps/ene/mono 1.3325 MeV 8 | 9 | # beam #2 10 | /gps/source/add 1. 11 | /gps/particle gamma 12 | /control/execute macros/volumetricSource.mac 13 | # Energy 14 | /gps/ene/type Mono 15 | /gps/energy 1.1732 MeV 16 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # Setting up the runs 10 | # 11 | /det/setMaterial EJ426 12 | /det/update 13 | /analysis/setFileName EJ426_gamma 14 | /analysis/h1/set 1 100 0 10000 none # Number of Optical Photons 15 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 16 | /run/beamOn 100000 17 | # 18 | /det/setMaterial PSLiF 19 | /det/update 20 | /analysis/setFileName PS_gamma 21 | /analysis/h1/set 1 100 0 10000 none # Number of Optical Photons 22 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 23 | /run/beamOn 100000 24 | # 25 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /det/setMaterial EJ426 12 | /det/update 13 | /analysis/setFileName EJ426_neutron 14 | /analysis/h1/set 1 100 0 10000 none # Number of Optical Photons 15 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 16 | /run/beamOn 100000 17 | # 18 | /det/setMaterial PSLiF 19 | /det/update 20 | /analysis/setFileName PS_neutron 21 | /analysis/h1/set 1 100 0 10000 none # Number of Optical Photons 22 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 23 | /run/beamOn 100000 24 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /control/execute macros/volumeSource.mac 5 | # 6 | # the beam energy is mono energic 7 | /gps/ene/type Mono 8 | /gps/ene/mono 0.025 eV 9 | 10 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/macros/volumeSource.mac: -------------------------------------------------------------------------------- 1 | # Volumetric source 2 | /gps/pos/type Volume 3 | /gps/pos/shape Para 4 | /gps/pos/centre 0. 0. 0. cm 5 | /gps/pos/halfx 3. cm 6 | /gps/pos/halfy 5. cm 7 | /gps/pos/halfz 7.5 cm 8 | /gps/ang/type iso 9 | 10 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/src/EventAction.cc: -------------------------------------------------------------------------------- 1 | #include "EventAction.hh" 2 | #include "Analysis.hh" 3 | 4 | #include "G4RunManager.hh" 5 | #include "G4Event.hh" 6 | #include "G4SDManager.hh" 7 | #include "G4HCofThisEvent.hh" 8 | #include "G4UnitsTable.hh" 9 | #include "G4ios.hh" 10 | 11 | EventAction::EventAction() : G4UserEventAction(){ } 12 | 13 | /* 14 | * BeginOfEventAction 15 | * 16 | * Called before the begining of each event 17 | */ 18 | void EventAction::BeginOfEventAction(const G4Event* event){ 19 | Analysis::GetInstance()->PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/src/HistoManager.cc: -------------------------------------------------------------------------------- 1 | #include "HistoManager.hh" 2 | #include "G4UnitsTable.hh" 3 | 4 | /** 5 | * Creates a Histogram manger with the default name 6 | */ 7 | HistoManager::HistoManager(): fFileName("LayeredDetectorCal") 8 | { 9 | Book(); 10 | } 11 | /** 12 | * Deconstructor 13 | */ 14 | HistoManager::~HistoManager() 15 | { 16 | delete G4AnalysisManager::Instance(); 17 | } 18 | /** 19 | * Sets up the histograms 20 | * 21 | * The histograms are inactived as the number of bins and the range of the 22 | * histograms have not been set. The type of analysis is done by the selection 23 | * of the namespace in HistoManger.hh 24 | */ 25 | void HistoManager::Book() 26 | { 27 | // Create or get analysis manager 28 | G4AnalysisManager* aMan = G4AnalysisManager::Instance(); 29 | aMan->SetFileName(fFileName); 30 | aMan->SetVerboseLevel(0); 31 | aMan->SetFirstHistoId(1); // start histogram numbering from 1 32 | aMan->SetActivation(true); // enable inactivation of histograms 33 | 34 | 35 | // Create all histograms as inactivated 36 | G4int ih = 0; 37 | ih = aMan->CreateH1("numPhotonsCreated","Number of Optical Photons Detected",100,0,10000); 38 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, true); 39 | ih = aMan->CreateH1("numPhotonsDet","Number of Optical Photons Generated",100,0,10000); 40 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, true); 41 | } 42 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/src/PhotonHit.cc: -------------------------------------------------------------------------------- 1 | #include "PhotonHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator PhotonHitAllocator; 10 | /** 11 | * Creates a PhotonHit 12 | * 13 | * Hit of a photon on the detector 14 | */ 15 | PhotonHit::PhotonHit(): G4VHit(){ 16 | pos = G4ThreeVector(); 17 | arrivalTime = 0; 18 | kEnergy = 0; 19 | } 20 | 21 | /** 22 | * Destroctor of PhotonHit 23 | */ 24 | PhotonHit::~PhotonHit() {} 25 | 26 | /** 27 | * Print 28 | * 29 | * Print's out information about the hit 30 | */ 31 | void PhotonHit::Print(){ 32 | G4cout << "OpticalPhoton" 33 | <<"\n\tArrival Time: "<GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | G4cout<<"End of run "<GetRunID()<EndOfRun(aRun); 27 | } 28 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon 39 | */ 40 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 41 | // Optical Photon Counter 42 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 43 | optPhotonCounter++; 44 | } 45 | return fUrgent; 46 | } 47 | -------------------------------------------------------------------------------- /LightValidation/LayeredDetectorCalibration/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/LayeredDetectorCalibration 3 | # 4 | # Setting up the job 5 | # 6 | function JobSetup() 7 | { 8 | echo "#!/bin/bash" > job 9 | echo "#PBS -q gen1" >> job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=3:ppn=2" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "mpirun $G4WORKDIR/build/scintSlabCal $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "mpirun $G4WORKDIR/build/scintSlabCal $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | 32 | ## Running the jobs 33 | runGamma 34 | runNeutron 35 | ## Cleaning up 36 | rm nSub.qsub 37 | rm gSub.qsub 38 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/README.md: -------------------------------------------------------------------------------- 1 | PS Calibration 2 | ================ 3 | 4 | Simulation of gammas and neutrons and the subsquent energy depsotion and optical photons in PS. 5 | 6 | The Briks constant was set to be 0.025 mm/MeV. 7 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/cleanUp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Cleaning up the queue files and combining histograms" 4 | rm -f *.qsub.* 5 | 6 | # PS Data output 7 | if test -n "$(find . -maxdepth 1 -name 'PS_Neutron-0*.root' -print -quit)" 8 | then 9 | hadd -f -v 1 PS_Neutron.root PS_Neutron-0*.root 10 | rm PS_Neutron-0*.root 11 | fi 12 | if test -n "$(find . -maxdepth 1 -name 'PS_Gamma-0*.root' -print -quit)" 13 | then 14 | hadd -f -v 1 PS_Gamma.root PS_Gamma-0*.root 15 | rm PS_Gamma-0*.root 16 | fi 17 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/AbsorberSD.hh: -------------------------------------------------------------------------------- 1 | #ifndef AbsorberSD_h 2 | #define AbsorberSD_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "AbsorberHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | class G4TouchableHistory; 10 | 11 | class AbsorberSD : public G4VSensitiveDetector 12 | { 13 | public: 14 | AbsorberSD(const G4String& name, const G4String& HCname); 15 | ~AbsorberSD(); 16 | 17 | void Initialize(G4HCofThisEvent*); 18 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 19 | G4bool ProcessAbsorberHit(G4Step*,G4TouchableHistory*); 20 | G4bool ProcessOpticalPhotonHit(G4Step*,G4TouchableHistory*); 21 | void EndOfEvent(G4HCofThisEvent*); 22 | 23 | private: 24 | AbsHitsCollection* hitCollection; 25 | }; 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithADouble; 13 | class G4UIcmdWithoutParameter; 14 | 15 | class DetectorMessenger: public G4UImessenger 16 | { 17 | public: 18 | DetectorMessenger(DetectorConstruction* ); 19 | ~DetectorMessenger(); 20 | 21 | void SetNewValue(G4UIcommand*, G4String); 22 | 23 | private: 24 | DetectorConstruction* Detector; 25 | 26 | G4UIdirectory* detDir; 27 | G4UIcmdWithADoubleAndUnit* AbsThickCmd; 28 | G4UIcmdWithADoubleAndUnit* MntThickCmd; 29 | G4UIcmdWithADoubleAndUnit* RefThickCmd; 30 | G4UIcmdWithADoubleAndUnit* SizeRadiusCmd; 31 | G4UIcmdWithAString* DetMaterialCmd; 32 | G4UIcmdWithoutParameter* UpdateCmd; 33 | }; 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/PMTSD.hh: -------------------------------------------------------------------------------- 1 | #ifndef PMTSD_h 2 | #define PMTSD_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "PhotonHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | 10 | class PMTSD : public G4VSensitiveDetector 11 | { 12 | public: 13 | PMTSD(const G4String& name, const G4String& HCname); 14 | ~PMTSD(); 15 | 16 | void Initialize(G4HCofThisEvent*); 17 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 18 | void EndOfEvent(G4HCofThisEvent*); 19 | 20 | private: 21 | PhotonHitsCollection* hitCollection; 22 | 23 | }; 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # PS LiF Simulation 10 | # 11 | /analysis/setFileName PS_Gamma 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 6000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 6000 none # Number of Optical Photons 15 | /run/beamOn 1000000 16 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # PS LiF Simulation 10 | # 11 | /analysis/setFileName PS_Neutron 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 6000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 6000 none # Number of Optical Photons 15 | /run/beamOn 1000000 16 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/src/AbsorberHit.cc: -------------------------------------------------------------------------------- 1 | #include "AbsorberHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator AbsHitAllocator; 10 | 11 | AbsorberHit::AbsorberHit(): G4VHit(){ 12 | // Initilization preformed in intilization list 13 | } 14 | 15 | /** 16 | * Destroctor of AbsorberHit 17 | */ 18 | AbsorberHit::~AbsorberHit() {} 19 | 20 | /** 21 | * Print 22 | * 23 | * Print's out information about the hit 24 | */ 25 | void AbsorberHit::Print(){ 26 | G4cout << "particle: "<GetParticleName() 27 | <<"\nvolume: "<GetName() 28 | <<"\n\tposition[mm]: " << pos/mm 29 | <<"\n\tArrival Time: "<PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/src/PhotonHit.cc: -------------------------------------------------------------------------------- 1 | #include "PhotonHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator PhotonHitAllocator; 10 | /** 11 | * Creates a PhotonHit 12 | * 13 | * Hit of a photon on the detector 14 | */ 15 | PhotonHit::PhotonHit(): G4VHit(){ 16 | pos = G4ThreeVector(); 17 | arrivalTime = 0; 18 | kEnergy = 0; 19 | } 20 | 21 | /** 22 | * Destroctor of PhotonHit 23 | */ 24 | PhotonHit::~PhotonHit() {} 25 | 26 | /** 27 | * Print 28 | * 29 | * Print's out information about the hit 30 | */ 31 | void PhotonHit::Print(){ 32 | G4cout << "OpticalPhoton" 33 | <<"\n\tArrival Time: "<GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | Analysis::GetInstance()->EndOfRun(aRun); 26 | } 27 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon 39 | */ 40 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 41 | // Optical Photon Counter 42 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 43 | optPhotonCounter++; 44 | } 45 | return fUrgent; 46 | } 47 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/PSCalibration 3 | # 4 | # Setting up the job 5 | # 6 | function JobSetup() 7 | { 8 | echo "#!/bin/bash" > job 9 | echo "#PBS -q gen3" >> job 10 | echo "#PBS -V" >> job 11 | echo "#PBS -l nodes=2:ppn=8" >> job 12 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 13 | echo 'cd $PBS_O_WORKDIR' >> job 14 | } 15 | 16 | function runGamma() 17 | { 18 | JobSetup 19 | echo "mpirun $G4WORKDIR/build/lightYieldCal $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 20 | mv job gSub.qsub 21 | qsub gSub.qsub 22 | } 23 | function runNeutron() 24 | { 25 | JobSetup 26 | echo "mpirun $G4WORKDIR/build/lightYieldCal $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 27 | mv job nSub.qsub 28 | qsub nSub.qsub 29 | } 30 | 31 | 32 | ## Running the jobs 33 | runGamma 34 | runNeutron 35 | ## Cleaning up 36 | rm nSub.qsub 37 | rm gSub.qsub 38 | -------------------------------------------------------------------------------- /LightValidation/PSCalibration/test.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # PS LiF Simulation 10 | # 11 | /det/setDetectorMaterial PSLiF 12 | /det/setDetectorThick 50 um 13 | /det/setDetectorRadius 2 cm 14 | /det/update 15 | /analysis/setFileName PS_Neutron 16 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 17 | /analysis/h1/set 2 100 0 6000 none # Number of Optical Photons 18 | /analysis/h1/set 3 100 0 6000 none # Number of Optical Photons 19 | /run/beamOn 100 20 | # 21 | # GS20 Simulation 22 | # 23 | /det/setDetectorMaterial GS20 24 | /det/setDetectorThick 2 mm 25 | /det/setDetectorRadius 1.27 cm 26 | /det/update 27 | /analysis/setFileName GS20_Neutron 28 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 29 | /analysis/h1/set 2 100 0 6000 none # Number of Optical Photons 30 | /analysis/h1/set 3 100 0 6000 none # Number of Optical Photons 31 | /run/beamOn 100 32 | -------------------------------------------------------------------------------- /LightValidation/README.md: -------------------------------------------------------------------------------- 1 | Light Validation 2 | ================ 3 | 4 | Validation of the light transport simulations and the quantities that are used in the models. 5 | 6 | Projects: 7 | 8 | + BirksConstantEffect - Examining the effects of the Birks coefficient on materials and the light yields 9 | + GS20Calibration - A simulation of GS20 as measured (except using a neutron and gamma gun sources) and the number of optical photons detected and measured 10 | + PSCalibration - A simulation of PS as measured (except using a neutron and gamma gun sources) and the number of optical photons detected and measured 11 | + LayeredDetectorCalibration - A simulation of a 4" by 6" slab detector that was fabricated and measured at UTK. This simulation validates the number of optical photons detected and measured. 12 | -------------------------------------------------------------------------------- /LightYeildEDep/README.md: -------------------------------------------------------------------------------- 1 | Light Yield and Energy Deposition 2 | ================================= 3 | 4 | Simulates the effect of the film thickness (energy deposition) on the light yield. 5 | 6 | There are two macros provided, one for neutrons and the other for gammas. Both can be run with the script `subJobs.sh`. 7 | 8 | In general it is observed that the light yield increases proportionally to the energy deposition. The script `analysis.py` grabs the mean of both the energy deposition and light yield histograms for each film thickness, while the root script `ExportHistos.C` exports selected histograms of interest to a CSV. 9 | -------------------------------------------------------------------------------- /LightYeildEDep/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | #include "CaloHit.hh" 9 | 10 | #include "globals.hh" 11 | class HistoManager; 12 | class Analysis { 13 | 14 | public: 15 | // Singleton Class 16 | static Analysis* GetInstance(){ 17 | if(Analysis::singleton == NULL) 18 | Analysis::singleton = new Analysis(); 19 | return Analysis::singleton; 20 | } 21 | 22 | virtual ~Analysis(); 23 | void Initilize(); 24 | void CleanUp(); 25 | 26 | // Accumulation Methods 27 | void PrepareNewEvent(const G4Event* anEvent); 28 | void PrepareNewRun(const G4Run* aRun); 29 | void EndOfEvent(const G4Event* anEvent); 30 | void EndOfRun(const G4Run* aRun); 31 | void SetNumOpticalPhotonsGenerated(G4int numPhotons); 32 | 33 | private: 34 | 35 | // Singleton Analysis 36 | Analysis(); 37 | static Analysis *singleton; 38 | 39 | // Accumulation Variables 40 | G4double eDepEvent; 41 | G4double nOPAbsEvent; 42 | HistoManager* fHistoManager; /* Histogram Manager */ 43 | }; 44 | #endif 45 | -------------------------------------------------------------------------------- /LightYeildEDep/include/CaloSensitiveDetector.hh: -------------------------------------------------------------------------------- 1 | #ifndef CaloSensitiveDetector_h 2 | #define CaloSensitiveDetector_h 1 3 | 4 | #include "G4VSensitiveDetector.hh" 5 | #include "CaloHit.hh" 6 | 7 | class G4Step; 8 | class G4HCofThisEvent; 9 | class G4TouchableHistory; 10 | 11 | class CaloSensitiveDetector : public G4VSensitiveDetector 12 | { 13 | public: 14 | CaloSensitiveDetector(const G4String& name, const G4String& HCname); 15 | ~CaloSensitiveDetector(); 16 | 17 | void Initialize(G4HCofThisEvent*); 18 | G4bool ProcessHits(G4Step*, G4TouchableHistory*); 19 | void EndOfEvent(G4HCofThisEvent*); 20 | 21 | private: 22 | CaloHitsCollection* hitCollection; 23 | 24 | }; 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /LightYeildEDep/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | class G4UIcmdWithADoubleAndUnit; 12 | class G4UIcmdWithoutParameter; 13 | 14 | class DetectorMessenger: public G4UImessenger 15 | { 16 | public: 17 | DetectorMessenger(DetectorConstruction* ); 18 | ~DetectorMessenger(); 19 | 20 | void SetNewValue(G4UIcommand*, G4String); 21 | 22 | private: 23 | DetectorConstruction* Detector; 24 | 25 | G4UIdirectory* PolymerTransportDir; 26 | G4UIdirectory* detDir; 27 | G4UIcmdWithAString* AbsMaterCmd; 28 | G4UIcmdWithAString* GapMaterCmd; 29 | G4UIcmdWithADoubleAndUnit* AbsThickCmd; 30 | G4UIcmdWithADoubleAndUnit* GapThickCmd; 31 | G4UIcmdWithADoubleAndUnit* SizeRadiusCmd; 32 | G4UIcmdWithAnInteger* NbLayersCmd; 33 | G4UIcmdWithoutParameter* UpdateCmd; 34 | }; 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /LightYeildEDep/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /LightYeildEDep/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /LightYeildEDep/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /LightYeildEDep/include/Materials.hh: -------------------------------------------------------------------------------- 1 | #ifndef Materials_h 2 | #define Materials_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4Material.hh" 6 | #include "G4NistManager.hh" 7 | 8 | /** 9 | * Constructor for the Optical Materials 10 | * 11 | * The optical materials are implemented as a static class 12 | */ 13 | class Materials{ 14 | 15 | public: 16 | ~Materials(); 17 | static Materials* GetInstance(); 18 | G4Material* GetMaterial(const G4String); 19 | 20 | private: 21 | // Methods 22 | Materials(); 23 | void CreateMaterials(); 24 | void SetOpticalPropertiesPS(); 25 | void SetOpticalPropertiesEJ200(); 26 | void SetOpticalPropertiesGS20(); 27 | void SetOpticalPropertiesEJ426(); 28 | 29 | // Fields 30 | static Materials* instance; /* Materials Instance */ 31 | G4NistManager* nistMan; /* NIST Material Manager */ 32 | G4Material* EJ200; /* EJ200 Detector */ 33 | G4Material* EJ426; /* EJ426 (LiF ZnS:Ag */ 34 | G4Material* GS20; /* GS20 Lithated glass (Ce doped */ 35 | G4Material* psDet; /* PS Detector */ 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /LightYeildEDep/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /LightYeildEDep/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /LightYeildEDep/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /LightYeildEDep/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /LightYeildEDep/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /LightYeildEDep/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /LightYeildEDep/src/CaloHit.cc: -------------------------------------------------------------------------------- 1 | #include "CaloHit.hh" 2 | #include "G4UnitsTable.hh" 3 | #include "G4VVisManager.hh" 4 | #include "G4Circle.hh" 5 | #include "G4Colour.hh" 6 | #include "G4VisAttributes.hh" 7 | 8 | #include 9 | G4Allocator HitAllocator; 10 | 11 | CaloHit::CaloHit(): G4VHit(){ 12 | // Initilization preformed in intilization list 13 | } 14 | 15 | /** 16 | * Destroctor of CaloHit 17 | */ 18 | CaloHit::~CaloHit() {} 19 | 20 | /** 21 | * Print 22 | * 23 | * Print's out information about the hit 24 | */ 25 | void CaloHit::Print(){ 26 | G4cout << " trackID: " << trackID <<" particle: " 27 | <GetParticleName()<<" rank: "<GetName() 29 | <<" position[mm]: " << pos/mm 30 | <<"\n Momentum "<PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /LightYeildEDep/src/HistoManager.cc: -------------------------------------------------------------------------------- 1 | #include "HistoManager.hh" 2 | #include "G4UnitsTable.hh" 3 | 4 | /** 5 | * Creates a Histogram manger with the default name 6 | */ 7 | HistoManager::HistoManager(): fFileName("energyDep") 8 | { 9 | Book(); 10 | } 11 | /** 12 | * Deconstructor 13 | */ 14 | HistoManager::~HistoManager() 15 | { 16 | delete G4AnalysisManager::Instance(); 17 | } 18 | /** 19 | * Sets up the histograms 20 | * 21 | * The histograms are inactived as the number of bins and the range of the 22 | * histograms have not been set. The type of analysis is done by the selection 23 | * of the namespace in HistoManger.hh 24 | */ 25 | void HistoManager::Book() 26 | { 27 | // Create or get analysis manager 28 | G4AnalysisManager* aMan = G4AnalysisManager::Instance(); 29 | aMan->SetFileName(fFileName); 30 | aMan->SetVerboseLevel(0); 31 | aMan->SetFirstHistoId(1); // start histogram numbering from 1 32 | aMan->SetActivation(true); // enable inactivation of histograms 33 | 34 | 35 | // Create all histograms as inactivated 36 | G4int ih = 0; 37 | ih = aMan->CreateH1("eDep","Total Energy Depostion",100,0,100); 38 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, false); 39 | ih = aMan->CreateH1("numPhotons","Number of Optical Photons Generated",100,0,100); 40 | aMan->SetActivation(G4VAnalysisManager::kH1, ih, false); 41 | } 42 | -------------------------------------------------------------------------------- /LightYeildEDep/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmLivermorePhysics.hh" 6 | #include "G4OpticalPhysics.hh" 7 | #include "HadronPhysicsQGSP_BERT_HP.hh" 8 | #include "G4IonPhysics.hh" 9 | 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | */ 15 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 16 | currentDefaultCut = 10*nm; 17 | 18 | // SetVerboseLevel(1); 19 | 20 | // Adding Physics List 21 | //RegisterPhysics( new G4EmDNAPhysics()); 22 | RegisterPhysics( new G4EmStandardPhysics()); 23 | RegisterPhysics( new G4EmLivermorePhysics()); 24 | RegisterPhysics( new HadronPhysicsQGSP_BERT_HP()); 25 | RegisterPhysics( new G4IonPhysics()); 26 | RegisterPhysics( new G4OpticalPhysics()); 27 | } 28 | 29 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 30 | 31 | PhysicsList::~PhysicsList(){ 32 | // Nothing to be done 33 | } 34 | 35 | 36 | 37 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 | 39 | void PhysicsList::SetCuts(){ 40 | 41 | SetDefaultCutValue(10*nm); 42 | } 43 | -------------------------------------------------------------------------------- /LightYeildEDep/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction(){ 20 | delete fParticleGun; 21 | } 22 | 23 | 24 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 25 | { 26 | fParticleGun->GeneratePrimaryVertex(anEvent); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /LightYeildEDep/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | Analysis::GetInstance()->EndOfRun(aRun); 26 | } 27 | -------------------------------------------------------------------------------- /LightYeildEDep/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "HistoManager.hh" 7 | #include "Analysis.hh" 8 | 9 | StackingAction::StackingAction(){ 10 | optPhotonCounter = 0; 11 | } 12 | 13 | 14 | StackingAction::~StackingAction() 15 | { } 16 | /** 17 | * NewStage 18 | * 19 | * Seems to be called once stack is empty, so only after an event is over 20 | */ 21 | void StackingAction::NewStage(){ 22 | 23 | // Updating Analysis 24 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 25 | } 26 | /** 27 | * PrepareNewEvent 28 | * 29 | * Prepares a new event for the stacking action. 30 | * The only action we need to do is reset the counters 31 | */ 32 | void StackingAction::PrepareNewEvent(){ 33 | optPhotonCounter = 0; 34 | } 35 | /** 36 | * ClassifyNewTrack 37 | * 38 | * Called every time a new track needs to be classified, so we can use it to 39 | * determine in the new track is an optical photon 40 | */ 41 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 42 | // Optical Photon Counter 43 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 44 | optPhotonCounter++; 45 | return fKill; 46 | } 47 | return fUrgent; 48 | } 49 | -------------------------------------------------------------------------------- /LightYeildEDep/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightYeildEDep 3 | 4 | # 5 | # Setting up the job 6 | # 7 | function JobSetup() 8 | { 9 | echo "#!/bin/bash" > job 10 | echo "#PBS -q gen1" >> job 11 | echo "#PBS -V" >> job 12 | echo "#PBS -l nodes=1:ppn=2" >> job 13 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 14 | echo 'cd $PBS_O_WORKDIR' >> job 15 | } 16 | 17 | function runGamma() 18 | { 19 | JobSetup 20 | echo "exec $G4WORKDIR/build/lightYield $G4WORKDIR/macros/gRun.mac > GammaOutput.txt" >> job 21 | mv job gSub.qsub 22 | qsub gSub.qsub 23 | } 24 | function runNeutron() 25 | { 26 | JobSetup 27 | echo "exec $G4WORKDIR/build/lightYield $G4WORKDIR/macros/nRun.mac > NeutronOutput.txt" >> job 28 | mv job nSub.qsub 29 | qsub nSub.qsub 30 | } 31 | 32 | # Running the jobs 33 | runGamma 34 | runNeutron 35 | # Cleaning up 36 | rm nSub.qsub 37 | rm gSub.qsub 38 | 39 | -------------------------------------------------------------------------------- /MCNPXRPMModels/WrappedCylinders/FourTubeData.csv: -------------------------------------------------------------------------------- 1 | Polymer, loading, mass Li, count rate, error, count rate per mass 2 | PS , 0.20 , 4.798 , 2.816 , 0.04 , 0.587 3 | PS , 0.30 , 7.192 , 3.360 , 0.05 , 0.467 4 | PS , 0.10 , 2.401 , 1.879 , 0.03 , 0.783 5 | PEN , 0.20 , 4.769 , 2.668 , 0.04 , 0.559 6 | PEN , 0.30 , 7.154 , 3.234 , 0.04 , 0.452 7 | PEN , 0.10 , 2.384 , 1.726 , 0.02 , 0.724 8 | 9 | -------------------------------------------------------------------------------- /MCNPXRPMModels/WrappedCylinders/ThreeTubeData.csv: -------------------------------------------------------------------------------- 1 | Polymer, loading, mass Li, count rate, error, count rate per mass 2 | PS , 0.20 , 4.798 , 2.240 , 0.03 , 0.467 3 | PS , 0.30 , 7.192 , 2.706 , 0.04 , 0.376 4 | PS , 0.10 , 2.401 , 1.482 , 0.02 , 0.617 5 | PEN , 0.20 , 4.769 , 2.119 , 0.03 , 0.444 6 | PEN , 0.30 , 7.154 , 2.608 , 0.04 , 0.365 7 | PEN , 0.10 , 2.384 , 1.368 , 0.02 , 0.574 8 | 9 | -------------------------------------------------------------------------------- /MCNPXRPMModels/WrappedCylinders/TwoTubeData.csv: -------------------------------------------------------------------------------- 1 | Polymer, loading, mass Li, count rate, error, count rate per mass 2 | PS , 0.20 , 4.798 , 1.852 , 0.04 , 0.386 3 | PS , 0.30 , 7.192 , 2.160 , 0.04 , 0.300 4 | PS , 0.10 , 2.401 , 1.321 , 0.03 , 0.550 5 | PEN , 0.20 , 4.769 , 1.841 , 0.04 , 0.386 6 | PEN , 0.30 , 7.154 , 2.157 , 0.04 , 0.302 7 | PEN , 0.10 , 2.384 , 1.325 , 0.03 , 0.556 8 | 9 | -------------------------------------------------------------------------------- /ParticleTracks/README.md: -------------------------------------------------------------------------------- 1 | Tracking 2 | ======== 3 | 4 | Provides tracking of primary particle. Currently the defaults are an alpha (2.05 MeV), triton (2.78 MeV) and two electrons (10 keV and 100 keV). Currently this is only intended to demonstrate the different particle track structures, and thus no analysis is provided. 5 | 6 | ## Compile Instructions 7 | 8 | This program was built with CMAKE. It is assumed that the environment is setup such that the variable `G4INSTALL_CMAKE` is set to the installation files for GEANT4 for cmake. The code can be built by the following commands: 9 | 10 | > mkdir build; 11 | > cd build; 12 | > cmake .. 13 | > make 14 | 15 | The executable and run scripts will now be in the build directory. The compiled code can be run with: 16 | 17 | > ./tracking 18 | > ./tracking run1.mac 19 | 20 | The first will bring up an interactive session, while the second will run the four charged particles in the run script. 21 | 22 | -------------------------------------------------------------------------------- /ParticleTracks/include/Materials.hh: -------------------------------------------------------------------------------- 1 | #ifndef Materials_h 2 | #define Materials_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4Material.hh" 6 | #include "G4NistManager.hh" 7 | 8 | /** 9 | * Constructor for the Optical Materials 10 | * 11 | * The optical materials are implemented as a static class 12 | */ 13 | class Materials{ 14 | 15 | public: 16 | ~Materials(); 17 | static Materials* GetInstance(); 18 | G4Material* GetMaterial(const G4String); 19 | 20 | private: 21 | // Methods 22 | Materials(); 23 | void CreateMaterials(); 24 | 25 | // Fields 26 | static Materials* instance; /* Materials Instance */ 27 | G4NistManager* nistMan; /* NIST Material Manager */ 28 | G4Material* GS20; /* GS20 Detector */ 29 | G4Material* Air; /* Air */ 30 | G4Material* PMMA; /* PMMA (Plexiglass) */ 31 | G4Material* EJ426; /* EJ426 (LiF:ZnS(Ag)) */ 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /ParticleTracks/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class PhysicsListMessenger; 8 | class G4VPhysicsConstructor; 9 | 10 | 11 | class PhysicsList: public G4VModularPhysicsList 12 | { 13 | public: 14 | PhysicsList(); 15 | ~PhysicsList(); 16 | 17 | virtual void ConstructParticle(); 18 | virtual void ConstructProcess(); 19 | 20 | virtual void SetCuts(); 21 | void SetCutForGamma(G4double); 22 | void SetCutForElectron(G4double); 23 | void SetCutForPositron(G4double); 24 | void SetCutForAlpha(G4double); 25 | void SetCutForTriton(G4double); 26 | 27 | private: 28 | G4double fCutForGamma; /** Default gamma cut */ 29 | G4double fCutForElectron; /** Default electron cut */ 30 | G4double fCutForPositron; /** Default positron cut */ 31 | G4double fCutForAlpha; /** Defualt alpha cut */ 32 | G4double fCutForTriton; /** Default triton cut */ 33 | G4double fCurrentDefaultCut; /* Default cut for all particles */ 34 | 35 | G4VPhysicsConstructor* fEmPhysicsList; /* Default physics list */ 36 | G4String fEmName; /* Name of the physics list */ 37 | 38 | PhysicsListMessenger* fMessenger; /* Physics list messenger */ 39 | }; 40 | #endif 41 | -------------------------------------------------------------------------------- /ParticleTracks/include/PhysicsListMessenger.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PhysicsListMessenger_h 3 | #define PhysicsListMessenger_h 1 4 | 5 | #include "G4UImessenger.hh" 6 | #include "globals.hh" 7 | 8 | class PhysicsList; 9 | class G4UIdirectory; 10 | class G4UIcmdWithADoubleAndUnit; 11 | class G4UIcmdWithAString; 12 | 13 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 14 | 15 | class PhysicsListMessenger: public G4UImessenger 16 | { 17 | public: 18 | 19 | PhysicsListMessenger(PhysicsList* ); 20 | ~PhysicsListMessenger(); 21 | 22 | virtual void SetNewValue(G4UIcommand*, G4String); 23 | 24 | private: 25 | 26 | PhysicsList* fPhysicsList; 27 | 28 | G4UIdirectory* fPhysDir; 29 | G4UIcmdWithADoubleAndUnit* fGammaCutCmd; 30 | G4UIcmdWithADoubleAndUnit* fAlphaCutCmd; 31 | G4UIcmdWithADoubleAndUnit* fTritonCutCmd; 32 | G4UIcmdWithADoubleAndUnit* fElectCutCmd; 33 | G4UIcmdWithADoubleAndUnit* fProtoCutCmd; 34 | G4UIcmdWithADoubleAndUnit* fAllCutCmd; 35 | 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /ParticleTracks/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | #include "globals.hh" 6 | 7 | class G4ParticleGun; 8 | class G4Event; 9 | 10 | /// The primary generator action class with particle gum. 11 | /// 12 | /// It defines a single particle which hits the Tracker 13 | /// perpendicular to the input face. The type of the particle 14 | /// can be changed via the G4 build-in commands of G4ParticleGun class 15 | /// (see the macros provided with this example). 16 | 17 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 18 | { 19 | public: 20 | PrimaryGeneratorAction(); 21 | virtual ~PrimaryGeneratorAction(); 22 | 23 | virtual void GeneratePrimaries(G4Event* ); 24 | 25 | G4ParticleGun* GetParticleGun() {return fParticleGun;} 26 | 27 | // Set methods 28 | void SetRandomFlag(G4bool ); 29 | 30 | private: 31 | G4ParticleGun* fParticleGun; // G4 particle gun 32 | }; 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /ParticleTracks/init.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization phase of "exampleN03.cc" 2 | # when running in interactive mode without visualization 3 | # 4 | # Set some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | # 10 | -------------------------------------------------------------------------------- /ParticleTracks/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /RangeSim/beamSource.mac: -------------------------------------------------------------------------------- 1 | # 1D beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/pos/type Beam 4 | # 5 | # the incident surface is in the x-y plane 6 | /gps/pos/rot1 1 0 0 7 | /gps/pos/rot2 0 1 0 8 | # 9 | # the beam spot is centered at the origin and is 10 | # of 1d gaussian shape with a 3mm central plateau 11 | /gps/pos/shape Circle 12 | /gps/pos/centre 0. 0. 10 cm 13 | /gps/pos/radius 3. mm 14 | # 15 | # the beam is travelling along the z-axis with no dispersion 16 | /gps/ang/rot1 1 0 0 17 | /gps/ang/rot2 0 1 0 18 | /gps/ang/sigma_r 0. deg 19 | # 20 | # the beam energy is mono energic 21 | /gps/ene/type Mono 22 | 23 | -------------------------------------------------------------------------------- /RangeSim/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 0 1 0 8 | /gps/pos/rot2 0 0 1 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 0. mm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 0 0 1 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 0 1 0 24 | /gps/pos/rot2 0 0 1 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 0. mm 27 | /gps/pos/radius 3. mm 28 | /gps/pos/sigma_r .0 mm 29 | /gps/ang/rot1 0 0 1 30 | /gps/ang/rot2 0 1 0 31 | /gps/ang/type beam1d 32 | # Energy 33 | /gps/ene/type Mono 34 | /gps/energy 1.1732 MeV 35 | -------------------------------------------------------------------------------- /RangeSim/erange.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for "rangeSim.cc" 3 | # 4 | # compute the csda range of primary particle 5 | # 6 | /control/verbose 0 7 | /run/verbose 0 8 | # 9 | /testem/det/setMat G4_POLYSTYRENE 10 | # 11 | /run/initialize 12 | # 13 | # Simulated Ranges 14 | /gps/particle e- 15 | /control/execute beamSource.mac 16 | /gps/ene/mono 1 keV 17 | /run/beamOn 10000 18 | # 19 | /gps/particle e- 20 | /control/execute beamSource.mac 21 | /gps/ene/mono 2.2 keV 22 | /run/beamOn 10000 23 | # 24 | /gps/particle e- 25 | /control/execute beamSource.mac 26 | /gps/ene/mono 4.6 keV 27 | /run/beamOn 10000 28 | # 29 | /gps/particle e- 30 | /control/execute beamSource.mac 31 | /gps/ene/mono 10 keV 32 | /run/beamOn 10000 33 | # 34 | /gps/particle e- 35 | /control/execute beamSource.mac 36 | /gps/ene/mono 22 keV 37 | /run/beamOn 10000 38 | # 39 | /gps/particle e- 40 | /control/execute beamSource.mac 41 | /gps/ene/mono 46 keV 42 | /run/beamOn 10000 43 | # 44 | /gps/particle e- 45 | /control/execute beamSource.mac 46 | /gps/ene/mono 100 keV 47 | /run/beamOn 10000 48 | # 49 | /gps/particle e- 50 | /control/execute beamSource.mac 51 | /gps/ene/mono 220 keV 52 | /run/beamOn 10000 53 | # 54 | /gps/particle e- 55 | /control/execute beamSource.mac 56 | /gps/ene/mono 460 keV 57 | /run/beamOn 10000 58 | # 59 | /gps/particle e- 60 | /control/execute beamSource.mac 61 | /gps/ene/mono 1000 keV 62 | /run/beamOn 10000 63 | # 64 | -------------------------------------------------------------------------------- /RangeSim/gammaRange.mac: -------------------------------------------------------------------------------- 1 | # Macro file for "rangeSim.cc" 2 | # (can be run in batch, without graphic) 3 | # 4 | # Co60 Gamma; all processes 5 | # 6 | /control/verbose 0 7 | /run/verbose 0 8 | # 9 | /testem/det/setMat G4_POLYSTYRENE 10 | /testem/det/setSize 10 m 11 | # 12 | /run/initialize 13 | # 14 | /control/execute co60Source.mac 15 | # 16 | /analysis/h1/set 1 100 0 250 cm #track length of primary 17 | /analysis/h1/set 2 100 0 50 none #nb steps of primary 18 | /analysis/h1/set 3 200 0 50 cm #step size of primary 19 | /analysis/h1/set 4 100 0 1.5 MeV #total energy deposit 20 | /analysis/h1/set 5 100 0 1500 keV #sec. chared energy spectrum 21 | /analysis/h1/set 6 100 0 1.5 MeV #sec. neutral energy spectrum 22 | # 23 | /analysis/setFileName co60Range 24 | /run/beamOn 100000 25 | # 26 | -------------------------------------------------------------------------------- /RangeSim/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "G4UImessenger.hh" 5 | #include "globals.hh" 6 | 7 | class DetectorConstruction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithADoubleAndUnit; 11 | class G4UIcmdWithoutParameter; 12 | 13 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 14 | 15 | class DetectorMessenger: public G4UImessenger 16 | { 17 | public: 18 | 19 | DetectorMessenger(DetectorConstruction* ); 20 | ~DetectorMessenger(); 21 | 22 | virtual void SetNewValue(G4UIcommand*, G4String); 23 | 24 | private: 25 | 26 | DetectorConstruction* fDetector; 27 | 28 | G4UIdirectory* fTestemDir; 29 | G4UIdirectory* fDetDir; 30 | G4UIcmdWithAString* fMaterCmd; 31 | G4UIcmdWithADoubleAndUnit* fSizeCmd; 32 | G4UIcmdWithoutParameter* fUpdateCmd; 33 | }; 34 | 35 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /RangeSim/include/EventActionMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef EventActionMessenger_h 2 | #define EventActionMessenger_h 1 3 | 4 | #include "G4UImessenger.hh" 5 | #include "globals.hh" 6 | 7 | class EventAction; 8 | class G4UIdirectory; 9 | class G4UIcmdWithAString; 10 | class G4UIcmdWithAnInteger; 11 | 12 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 13 | 14 | class EventActionMessenger: public G4UImessenger 15 | { 16 | public: 17 | EventActionMessenger(EventAction*); 18 | ~EventActionMessenger(); 19 | 20 | virtual void SetNewValue(G4UIcommand*, G4String); 21 | 22 | private: 23 | EventAction* fEventAction; 24 | 25 | G4UIdirectory* fEventDir; 26 | G4UIcmdWithAString* fDrawCmd; 27 | G4UIcmdWithAnInteger* fPrintCmd; 28 | }; 29 | 30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /RangeSim/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /RangeSim/include/Materials.hh: -------------------------------------------------------------------------------- 1 | #ifndef Materials_h 2 | #define Materials_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4Material.hh" 6 | #include "G4NistManager.hh" 7 | 8 | /** 9 | * Constructor for the Optical Materials 10 | * 11 | * The optical materials are implemented as a static class 12 | */ 13 | class Materials{ 14 | 15 | public: 16 | ~Materials(); 17 | static Materials* GetInstance(); 18 | G4Material* GetMaterial(const G4String); 19 | 20 | private: 21 | // Methods 22 | Materials(); 23 | void CreateMaterials(); 24 | 25 | // Fields 26 | static Materials* instance; /* Materials Instance */ 27 | G4NistManager* nistMan; /* NIST Material Manager */ 28 | G4Material* Teflon; /* Teflon Tape */ 29 | G4Material* GS20; /* GS20 Detector */ 30 | G4Material* BK7; /* PMT Window Glass (Boroscilate) */ 31 | G4Material* Silicone; /* Optical Grease */ 32 | G4Material* Air; /* Air */ 33 | G4Material* PMMA; /* PMMA (Plexiglass) */ 34 | G4Material* EJ426; /* EJ426 (LiF:ZnS(Ag)) */ 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /RangeSim/include/PhysicsListMessenger.hh: -------------------------------------------------------------------------------- 1 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 2 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 3 | 4 | #ifndef PhysicsListMessenger_h 5 | #define PhysicsListMessenger_h 1 6 | 7 | #include "G4UImessenger.hh" 8 | #include "globals.hh" 9 | 10 | class PhysicsList; 11 | class G4UIdirectory; 12 | class G4UIcmdWithADoubleAndUnit; 13 | class G4UIcmdWithAString; 14 | 15 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 16 | 17 | class PhysicsListMessenger: public G4UImessenger 18 | { 19 | public: 20 | 21 | PhysicsListMessenger(PhysicsList* ); 22 | ~PhysicsListMessenger(); 23 | 24 | virtual void SetNewValue(G4UIcommand*, G4String); 25 | 26 | private: 27 | 28 | PhysicsList* fPhysicsList; 29 | 30 | G4UIdirectory* fPhysDir; 31 | G4UIcmdWithADoubleAndUnit* fGammaCutCmd; 32 | G4UIcmdWithADoubleAndUnit* fAlphaCutCmd; 33 | G4UIcmdWithADoubleAndUnit* fTritonCutCmd; 34 | G4UIcmdWithADoubleAndUnit* fElectCutCmd; 35 | G4UIcmdWithADoubleAndUnit* fProtoCutCmd; 36 | G4UIcmdWithADoubleAndUnit* fAllCutCmd; 37 | G4UIcmdWithADoubleAndUnit* fRCmd; 38 | G4UIcmdWithAString* fListCmd; 39 | 40 | }; 41 | 42 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /RangeSim/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | G4GeneralParticleSource* GetParticleGun() {return fParticleGun;} 18 | 19 | private: 20 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 21 | }; 22 | #endif 23 | -------------------------------------------------------------------------------- /RangeSim/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef StackingAction_h 2 | #define StackingAction_h 1 3 | 4 | #include "G4UserStackingAction.hh" 5 | #include "globals.hh" 6 | 7 | class StackingAction : public G4UserStackingAction 8 | { 9 | public: 10 | StackingAction(); 11 | ~StackingAction(); 12 | 13 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 14 | }; 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /RangeSim/include/SteppingAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef SteppingAction_h 2 | #define SteppingAction_h 1 3 | 4 | #include "G4UserSteppingAction.hh" 5 | 6 | class RunAction; 7 | class EventAction; 8 | 9 | class SteppingAction : public G4UserSteppingAction 10 | { 11 | public: 12 | SteppingAction(RunAction*, EventAction*); 13 | ~SteppingAction() {}; 14 | 15 | virtual void UserSteppingAction(const G4Step*); 16 | 17 | private: 18 | RunAction* fRunAction; /** Pointer to RunAction */ 19 | EventAction* fEventAction; /** Pointer to EventAction */ 20 | }; 21 | #endif 22 | -------------------------------------------------------------------------------- /RangeSim/include/TrackingAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef TrackingAction_h 2 | #define TrackingAction_h 1 3 | 4 | #include "G4UserTrackingAction.hh" 5 | 6 | class PrimaryGeneratorAction; 7 | class RunAction; 8 | class G4GeneralParticleSource; 9 | 10 | class TrackingAction : public G4UserTrackingAction { 11 | 12 | public: 13 | TrackingAction(PrimaryGeneratorAction*, RunAction*); 14 | ~TrackingAction() {}; 15 | 16 | virtual void PreUserTrackingAction(const G4Track*); 17 | virtual void PostUserTrackingAction(const G4Track*); 18 | 19 | private: 20 | PrimaryGeneratorAction* fPrimary; /** Primary Generator Action */ 21 | RunAction* fRunAction; /** RunAction */ 22 | }; 23 | #endif 24 | -------------------------------------------------------------------------------- /RangeSim/init.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization phase of "exampleN03.cc" 2 | # when running in interactive mode without visualization 3 | # 4 | # Set some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | -------------------------------------------------------------------------------- /RangeSim/init_vis.mac: -------------------------------------------------------------------------------- 1 | # Macro file for the initialization phase of "exampleN03.cc" 2 | # when running in interactive mode with visualization 3 | # 4 | # Sets some default verbose 5 | # 6 | /control/verbose 2 7 | /control/saveHistory 8 | /run/verbose 2 9 | # 10 | # Visualization setting 11 | /control/execute vis.mac 12 | -------------------------------------------------------------------------------- /RangeSim/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction() 20 | { 21 | delete fParticleGun; 22 | } 23 | 24 | 25 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 26 | { 27 | fParticleGun->GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /ScintillationSlab/GS0GS2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/murffer/DetectorSim/1ba114c405eff42c0a52b6dc394cbecfc2d2bab0/ScintillationSlab/GS0GS2 -------------------------------------------------------------------------------- /ScintillationSlab/README.md: -------------------------------------------------------------------------------- 1 | GS20 Calibration 2 | ================ 3 | 4 | Simulation of gammas and neutrons and the subsquent energy depsotion and optical photons in GS20. 5 | 6 | Naming Conventions: 7 | Abosrber - the GS20 Scintillator 8 | PMT - the pmt 9 | 10 | The seperate histograms can be combined with the following command. 11 | `hadd GS20_Neutron.root GS20_Neutron_*.root` 12 | -------------------------------------------------------------------------------- /ScintillationSlab/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | 9 | #include "globals.hh" 10 | class HistoManager; 11 | class PhotonDetHit; 12 | class Analysis { 13 | 14 | public: 15 | // Singleton Class 16 | static Analysis* GetInstance(){ 17 | if(Analysis::singleton == NULL) 18 | Analysis::singleton = new Analysis(); 19 | return Analysis::singleton; 20 | } 21 | 22 | virtual ~Analysis(); 23 | void Initilize(); 24 | void CleanUp(); 25 | 26 | // Accumulation Methods 27 | void PrepareNewEvent(const G4Event* anEvent); 28 | void PrepareNewRun(const G4Run* aRun); 29 | void EndOfEvent(const G4Event* anEvent); 30 | void EndOfRun(const G4Run* aRun); 31 | void SetNumOpticalPhotonsGenerated(G4int numPhotons); 32 | 33 | private: 34 | 35 | // Singleton Analysis 36 | Analysis(); 37 | static Analysis *singleton; 38 | 39 | // Accumulation Variables 40 | G4double nOPAbsEvent; 41 | G4double nOPPMTEvent; 42 | HistoManager* fHistoManager; /* Histogram Manager */ 43 | }; 44 | #endif 45 | -------------------------------------------------------------------------------- /ScintillationSlab/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | #include "DetectorConstruction.hh" 8 | 9 | class G4UIdirectory; 10 | class G4UIcmdWithABool; 11 | class G4UIcmdWithAString; 12 | class G4UIcmdWithADouble; 13 | class G4UIcmdWithAnInteger; 14 | class G4UIcmdWithADoubleAndUnit; 15 | class G4UIcmdWithoutParameter; 16 | class G4UIcmdWithoutParameter; 17 | 18 | class DetectorMessenger : public G4UImessenger 19 | { 20 | public: 21 | 22 | DetectorMessenger(DetectorConstruction* ); 23 | ~DetectorMessenger(); 24 | 25 | void SetNewValue(G4UIcommand*, G4String); 26 | 27 | private: 28 | 29 | DetectorConstruction* Detector; 30 | 31 | G4UIdirectory* detDir; 32 | 33 | G4UIcmdWithoutParameter* UpdateCmd; 34 | 35 | G4UIcmdWithADouble* SetPhotonDetPolishCmd; 36 | G4UIcmdWithADouble* SetPhotonDetReflectivityCmd; 37 | G4UIcmdWithADouble* SetScintThicknessCmd; 38 | G4UIcmdWithAString* SetPMTMaterialCmd; 39 | G4UIcmdWithAString* SetScintMaterialCmd; 40 | 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /ScintillationSlab/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /ScintillationSlab/include/HadronicPhysics.hh: -------------------------------------------------------------------------------- 1 | #ifndef HadronicPhysics_h 2 | #define HadronicPhysics_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "G4VPhysicsConstructor.hh" 7 | 8 | // Elastic 9 | #include "G4HadronElasticProcess.hh" 10 | #include "G4NeutronHPElastic.hh" 11 | #include "G4NeutronHPElasticData.hh" 12 | 13 | // IO 14 | #include "G4HadronInelasticProcess.hh" 15 | #include "G4NeutronHPInelastic.hh" 16 | #include "G4NeutronHPInelasticData.hh" 17 | 18 | #include "G4HadronFissionProcess.hh" 19 | #include "G4NeutronHPFission.hh" 20 | #include "G4NeutronHPFissionData.hh" 21 | 22 | #include "G4HadronCaptureProcess.hh" 23 | #include "G4NeutronHPCapture.hh" 24 | #include "G4NeutronHPCaptureData.hh" 25 | 26 | class HadronicPhysics: public G4VPhysicsConstructor 27 | { 28 | public: 29 | HadronicPhysics(const G4String& name="Neutron"); 30 | ~HadronicPhysics(); 31 | 32 | protected: 33 | // Construct particle and physics 34 | void ConstructParticle(); 35 | void ConstructProcess(); 36 | 37 | 38 | }; 39 | 40 | #endif 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ScintillationSlab/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /ScintillationSlab/include/PhotonDetSD.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PhotonDetSD_h 3 | #define PhotonDetSD_h 1 4 | 5 | #include "PhotonDetHit.hh" 6 | 7 | #include "G4VSensitiveDetector.hh" 8 | 9 | class G4Step; 10 | class G4HCofThisEvent; 11 | 12 | class PhotonDetSD : public G4VSensitiveDetector 13 | { 14 | public: 15 | 16 | PhotonDetSD(G4String name); 17 | ~PhotonDetSD(); 18 | 19 | void Initialize(G4HCofThisEvent* HCE); 20 | 21 | G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist); 22 | //A version of processHits that keeps aStep constant 23 | G4bool ProcessHits_constStep(const G4Step* aStep, 24 | G4TouchableHistory* ROhist); 25 | 26 | void EndOfEvent(G4HCofThisEvent* HCE); 27 | 28 | void clear(); 29 | void DrawAll(); 30 | void PrintAll(); 31 | 32 | private: 33 | 34 | PhotonDetHitsCollection* PhotonDetHitCollection; 35 | 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /ScintillationSlab/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /ScintillationSlab/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /ScintillationSlab/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /ScintillationSlab/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /ScintillationSlab/init.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for the initialization phase of the slab 3 | # 4 | #/run/verbose 1 5 | #/control/verbose 1 6 | #/event/verbose 1 7 | #/tracking/verbose 1 8 | # 9 | /run/initialize 10 | # 11 | # Setting up the manager 12 | # 13 | /analysis/setFileName ScintSlab 14 | /analysis/h1/set 1 100 0 5 ms # Resolution 15 | /analysis/h1/set 2 100 0 2 none # Number of Optical Photons 16 | /analysis/h1/set 3 100 0 2 none # Number of Optical Photons 17 | # 18 | /gps/particle opticalphoton 19 | /gps/ene/type Mono 20 | /gps/ene/mono 3.94 eV 21 | # 22 | /gps/pos/type Point 23 | /gps/ang/type iso 24 | /gps/pos/centre 0.0 0.0 0.0 cm 25 | # 26 | -------------------------------------------------------------------------------- /ScintillationSlab/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /ScintillationSlab/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /analysis/setFileName GS20_Gamma 12 | /analysis/h1/set 1 100 0 1.4 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | # Running through absorber thickness 16 | /run/beamOn 1000000 17 | # 18 | -------------------------------------------------------------------------------- /ScintillationSlab/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /analysis/setFileName GS20_Neutron 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | # Running through absorber thickness 16 | /run/beamOn 100000 17 | # 18 | -------------------------------------------------------------------------------- /ScintillationSlab/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /ScintillationSlab/src/EventAction.cc: -------------------------------------------------------------------------------- 1 | #include "EventAction.hh" 2 | #include "Analysis.hh" 3 | 4 | #include "G4RunManager.hh" 5 | #include "G4Event.hh" 6 | #include "G4SDManager.hh" 7 | #include "G4HCofThisEvent.hh" 8 | #include "G4UnitsTable.hh" 9 | #include "G4ios.hh" 10 | 11 | EventAction::EventAction() : G4UserEventAction(){ } 12 | 13 | /* 14 | * BeginOfEventAction 15 | * 16 | * Called before the begining of each event 17 | */ 18 | void EventAction::BeginOfEventAction(const G4Event* event){ 19 | Analysis::GetInstance()->PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /ScintillationSlab/src/PhotonDetHit.cc: -------------------------------------------------------------------------------- 1 | #include "PhotonDetHit.hh" 2 | 3 | G4Allocator PhotonDetHitAllocator; 4 | 5 | PhotonDetHit::PhotonDetHit() 6 | { 7 | arrivalTime = 0.; 8 | } 9 | 10 | PhotonDetHit::PhotonDetHit(G4double pTime) 11 | { 12 | arrivalTime = pTime; 13 | } 14 | 15 | PhotonDetHit::~PhotonDetHit() { } 16 | 17 | PhotonDetHit::PhotonDetHit(const PhotonDetHit &right) 18 | : G4VHit() 19 | { 20 | *this = right; 21 | } 22 | 23 | const PhotonDetHit& PhotonDetHit::operator=(const PhotonDetHit &right) 24 | { 25 | arrivalTime = right.arrivalTime; 26 | 27 | return *this; 28 | } 29 | 30 | G4int PhotonDetHit::operator==(const PhotonDetHit& right) const 31 | { 32 | return arrivalTime == right.arrivalTime; 33 | } 34 | 35 | void PhotonDetHit::Draw(){ } 36 | 37 | void PhotonDetHit::Print(){ } 38 | -------------------------------------------------------------------------------- /ScintillationSlab/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmStandardPhysics_option4.hh" 6 | #include "G4EmLivermorePhysics.hh" 7 | #include "G4OpticalPhysics.hh" 8 | #include "HadronPhysicsQGSP_BERT_HP.hh" 9 | #include "G4IonPhysics.hh" 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | * 15 | * The physics list relies on modular physics. Currently used modules are: 16 | * - Hadronic physics (High Precision) 17 | * - IonPhysics 18 | * - OpticalPhysics 19 | * - EM Standard Physics 20 | */ 21 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 22 | currentDefaultCut = 10*nm; 23 | 24 | // SetVerboseLevel(1); 25 | 26 | // Adding Physics List 27 | RegisterPhysics( new HadronPhysicsQGSP_BERT_HP()); 28 | RegisterPhysics( new G4IonPhysics()); 29 | RegisterPhysics( new G4OpticalPhysics()); 30 | RegisterPhysics( new G4EmStandardPhysics_option4()); 31 | // RegisterPhysics( new G4EmDNAPhysics()); 32 | } 33 | 34 | /** 35 | * Deconstructor 36 | */ 37 | PhysicsList::~PhysicsList(){ 38 | // Nothing to be done 39 | } 40 | /** 41 | * Sets the physic list cuts 42 | */ 43 | void PhysicsList::SetCuts(){ 44 | SetDefaultCutValue(1*um); 45 | } 46 | -------------------------------------------------------------------------------- /ScintillationSlab/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction() 20 | { 21 | delete fParticleGun; 22 | } 23 | 24 | 25 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 26 | { 27 | fParticleGun->GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /ScintillationSlab/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | G4cout<<"Ending run: " << aRun->GetRunID()<< G4endl; 26 | Analysis::GetInstance()->EndOfRun(aRun); 27 | } 28 | -------------------------------------------------------------------------------- /ScintillationSlab/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon 39 | */ 40 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 41 | // Optical Photon Counter 42 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 43 | optPhotonCounter++; 44 | } 45 | return fUrgent; 46 | } 47 | -------------------------------------------------------------------------------- /ScintillationSlab/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/LightValidation/ScintillationSlab 3 | 4 | # 5 | # Setting up the job 6 | # 7 | function JobSetup() 8 | { 9 | echo "#!/bin/bash" > job 10 | echo "#PBS -q gen1" >> job 11 | echo "#PBS -V" >> job 12 | echo "#PBS -l nodes=1:ppn=2" >> job 13 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 14 | echo 'cd $PBS_O_WORKDIR' >> job 15 | } 16 | 17 | function run() 18 | { 19 | JobSetup 20 | echo "exec $G4WORKDIR/build/scintSlab $G4WORKDIR/ptSrc.in > 25PTSRCOutput.txt" >> job 21 | mv job Sub.qsub 22 | qsub Sub.qsub 23 | } 24 | 25 | # Running the jobs 26 | run 27 | # Cleaning up 28 | rm Sub.qsub 29 | -------------------------------------------------------------------------------- /WLSScintBar/README.md: -------------------------------------------------------------------------------- 1 | Scintillation Slab With WLS and Cladding 2 | ======================================= 3 | 4 | Simulation of optical photon collection in a scintillation bar that is wrapped in a wavelength shifting plastic and encased in an optical cladding. 5 | 6 | ## GEOMETRY: 7 | 8 | The geometry is a thin 100 um slab that is 30 cm wide by 200 cm long. There are two rectangular PMT's attached to either end of the bar. The bar is encased in a plastic that can be set to a wavelength shifter. The entire assembly is wrapped in an optical covering (tape, mylar, air). 9 | 10 | -------------------------------------------------------------------------------- /WLSScintBar/WLSCases.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for the initialization phase of the slab 3 | # 4 | #/run/verbose 1 5 | #/control/verbose 1 6 | #/event/verbose 1 7 | #/tracking/verbose 1 8 | # 9 | /run/initialize 10 | # 11 | # Setting up the manager 12 | /gps/particle opticalphoton 13 | /gps/ene/type Mono 14 | /gps/ene/mono 3.94 eV 15 | # 16 | /gps/pos/type Volume 17 | /gps/pos/shape Para 18 | /gps/pos/centre 0. 0. 0. cm 19 | /gps/pos/halfx 50. um 20 | /gps/pos/halfy 15. cm 21 | /gps/pos/halfz 100. cm 22 | /gps/ang/type iso 23 | # 24 | # 25 | /det/setSlabMaterial G4_PLASTIC_SC_VINYLTOLUENE 26 | /gps/ene/mono 2.94 eV 27 | /det/setWLSMaterial G4_PLEXIGLASS 28 | /det/Update 29 | /run/beamOn 10000 30 | /det/setWLSMaterial PMMA_WLS 31 | /det/Update 32 | /run/beamOn 10000 33 | 34 | /det/setSlabMaterial PSLiF 35 | /gps/ene/mono 3.54 eV 36 | /det/setWLSMaterial G4_PLEXIGLASS 37 | /det/Update 38 | /run/beamOn 1000000 39 | /det/setWLSMaterial PMMA_WLS 40 | /det/Update 41 | /run/beamOn 1000000 42 | 43 | /det/setSlabMaterial EJ426 44 | /gps/ene/mono 2.75 eV 45 | /det/setWLSMaterial G4_PLEXIGLASS 46 | /det/Update 47 | /run/beamOn 10000000 48 | /det/setWLSMaterial PMMA_WLS 49 | /det/Update 50 | /run/beamOn 10000000 51 | 52 | -------------------------------------------------------------------------------- /WLSScintBar/include/Analysis.hh: -------------------------------------------------------------------------------- 1 | #ifndef Analysis_h 2 | #define Analysis_h 1 3 | 4 | #include "G4Event.hh" 5 | #include "G4Run.hh" 6 | #include "G4VHitsCollection.hh" 7 | 8 | 9 | #include "globals.hh" 10 | class HistoManager; 11 | class PhotonDetHit; 12 | class Analysis { 13 | 14 | public: 15 | // Singleton Class 16 | static Analysis* GetInstance(){ 17 | if(Analysis::singleton == NULL) 18 | Analysis::singleton = new Analysis(); 19 | return Analysis::singleton; 20 | } 21 | 22 | virtual ~Analysis(); 23 | void Initilize(); 24 | void CleanUp(); 25 | 26 | // Accumulation Methods 27 | void PrepareNewEvent(const G4Event* anEvent); 28 | void PrepareNewRun(const G4Run* aRun); 29 | void EndOfEvent(const G4Event* anEvent); 30 | void EndOfRun(const G4Run* aRun); 31 | void SetNumOpticalPhotonsGenerated(G4int numPhotons); 32 | 33 | private: 34 | 35 | // Singleton Analysis 36 | Analysis(); 37 | static Analysis *singleton; 38 | 39 | // Accumulation Variables 40 | G4double nOPAbsEvent; 41 | G4double nOPPMTEvent; 42 | HistoManager* fHistoManager; /* Histogram Manager */ 43 | }; 44 | #endif 45 | -------------------------------------------------------------------------------- /WLSScintBar/include/DetectorMessenger.hh: -------------------------------------------------------------------------------- 1 | #ifndef DetectorMessenger_h 2 | #define DetectorMessenger_h 1 3 | 4 | #include "globals.hh" 5 | #include "G4UImessenger.hh" 6 | 7 | #include "DetectorConstruction.hh" 8 | 9 | class G4UIdirectory; 10 | class G4UIcmdWithABool; 11 | class G4UIcmdWithAString; 12 | class G4UIcmdWithADouble; 13 | class G4UIcmdWithAnInteger; 14 | class G4UIcmdWithADoubleAndUnit; 15 | class G4UIcmdWithoutParameter; 16 | class G4UIcmdWithoutParameter; 17 | 18 | class DetectorMessenger : public G4UImessenger 19 | { 20 | public: 21 | 22 | DetectorMessenger(DetectorConstruction* ); 23 | ~DetectorMessenger(); 24 | 25 | void SetNewValue(G4UIcommand*, G4String); 26 | 27 | private: 28 | 29 | DetectorConstruction* Detector; 30 | 31 | G4UIdirectory* detDir; 32 | 33 | G4UIcmdWithoutParameter* UpdateCmd; 34 | 35 | G4UIcmdWithADouble* SetScintThicknessCmd; 36 | G4UIcmdWithAString* SetPMTMaterialCmd; 37 | G4UIcmdWithAString* SetScintMaterialCmd; 38 | G4UIcmdWithAString* SetWLSMaterialCmd; 39 | G4UIcmdWithAString* SetCladMaterialCmd; 40 | 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /WLSScintBar/include/EventAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file EventAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer@utk.edu 6 | * 7 | * @brief User's EventAction 8 | */ 9 | #ifndef EventAction_h 10 | #define EventAction_h 1 11 | 12 | #include "G4UserEventAction.hh" 13 | #include "globals.hh" 14 | #include "Analysis.hh" 15 | 16 | class G4Event; 17 | 18 | /*! 19 | * \brief User's EventAction class 20 | * This class implements the Event Action. 21 | * 22 | */ 23 | 24 | 25 | class EventAction : public G4UserEventAction{ 26 | public: 27 | EventAction(); 28 | virtual ~EventAction() {}; 29 | //! Beginning of the event 30 | virtual void BeginOfEventAction(const G4Event* event); 31 | //! Digitize hits and store information 32 | virtual void EndOfEventAction(const G4Event* event); 33 | 34 | private: 35 | }; 36 | #endif 37 | -------------------------------------------------------------------------------- /WLSScintBar/include/HistoManager.hh: -------------------------------------------------------------------------------- 1 | #ifndef HistoManager_h 2 | #define HistoManager_h 1 3 | 4 | #include "globals.hh" 5 | 6 | #include "g4root.hh" 7 | //#include "g4xml.hh" 8 | 9 | 10 | class HistoManager 11 | { 12 | public: 13 | HistoManager(); 14 | ~HistoManager(); 15 | 16 | private: 17 | void Book(); 18 | G4String fFileName; /** Default filename */ 19 | }; 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /WLSScintBar/include/PhotonDetSD.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PhotonDetSD_h 3 | #define PhotonDetSD_h 1 4 | 5 | #include "PhotonDetHit.hh" 6 | 7 | #include "G4VSensitiveDetector.hh" 8 | 9 | class G4Step; 10 | class G4HCofThisEvent; 11 | 12 | class PhotonDetSD : public G4VSensitiveDetector 13 | { 14 | public: 15 | 16 | PhotonDetSD(G4String name); 17 | ~PhotonDetSD(); 18 | 19 | void Initialize(G4HCofThisEvent* HCE); 20 | 21 | G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist); 22 | //A version of processHits that keeps aStep constant 23 | G4bool ProcessHits_constStep(const G4Step* aStep, 24 | G4TouchableHistory* ROhist); 25 | 26 | void EndOfEvent(G4HCofThisEvent* HCE); 27 | 28 | void clear(); 29 | void DrawAll(); 30 | void PrintAll(); 31 | 32 | private: 33 | 34 | PhotonDetHitsCollection* PhotonDetHitCollection; 35 | 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /WLSScintBar/include/PhysicsList.hh: -------------------------------------------------------------------------------- 1 | #ifndef PhysicsList_h 2 | #define PhysicsList_h 1 3 | 4 | #include "G4VModularPhysicsList.hh" 5 | #include "globals.hh" 6 | 7 | class G4VPhysicsConstructor; 8 | 9 | 10 | class PhysicsList: public G4VModularPhysicsList 11 | { 12 | public: 13 | PhysicsList(); 14 | ~PhysicsList(); 15 | 16 | void SetCuts(); 17 | 18 | private: 19 | G4double currentDefaultCut; 20 | 21 | }; 22 | 23 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /WLSScintBar/include/PrimaryGeneratorAction.hh: -------------------------------------------------------------------------------- 1 | #ifndef PrimaryGeneratorAction_h 2 | #define PrimaryGeneratorAction_h 1 3 | 4 | #include "G4VUserPrimaryGeneratorAction.hh" 5 | 6 | class G4ParticleGun; 7 | class G4GeneralParticleSource; 8 | class G4Event; 9 | 10 | class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction 11 | { 12 | public: 13 | PrimaryGeneratorAction(); 14 | virtual ~PrimaryGeneratorAction(); 15 | virtual void GeneratePrimaries(G4Event* event); 16 | 17 | private: 18 | G4GeneralParticleSource* fParticleGun; // G4 particle gun 19 | }; 20 | #endif 21 | -------------------------------------------------------------------------------- /WLSScintBar/include/RunAction.hh: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | 10 | #ifndef RunAction_h 11 | #define RunAction_h 1 12 | 13 | #include "G4UserRunAction.hh" 14 | #include "globals.hh" 15 | #include "Analysis.hh" 16 | 17 | class G4Run; 18 | 19 | class RunAction : public G4UserRunAction{ 20 | public: 21 | RunAction(); 22 | virtual ~RunAction() {}; 23 | virtual void BeginOfRunAction(const G4Run*); 24 | virtual void EndOfRunAction(const G4Run*); 25 | private: 26 | }; 27 | #endif 28 | -------------------------------------------------------------------------------- /WLSScintBar/include/StackingAction.hh: -------------------------------------------------------------------------------- 1 | 2 | #ifndef StackingAction_h 3 | #define StackingAction_h 1 4 | 5 | #include "G4UserStackingAction.hh" 6 | #include "globals.hh" 7 | 8 | 9 | class StackingAction : public G4UserStackingAction 10 | { 11 | public: 12 | StackingAction(); 13 | virtual ~StackingAction(); 14 | virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track*); 15 | virtual void PrepareNewEvent(); 16 | virtual void NewStage(); 17 | 18 | private: 19 | G4int optPhotonCounter; /* Number of optical photon's created per event */ 20 | }; 21 | 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /WLSScintBar/init.mac: -------------------------------------------------------------------------------- 1 | # 2 | # Macro file for the initialization phase of the slab 3 | # 4 | #/run/verbose 1 5 | #/control/verbose 1 6 | #/event/verbose 1 7 | #/tracking/verbose 1 8 | # 9 | /run/initialize 10 | # 11 | # Setting up the manager 12 | # 13 | /analysis/setFileName ScintSlab 14 | /analysis/h1/set 1 100 0 5 ms # Resolution 15 | /analysis/h1/set 2 100 0 2 none # Number of Optical Photons 16 | /analysis/h1/set 3 100 0 2 none # Number of Optical Photons 17 | # 18 | /gps/particle opticalphoton 19 | /gps/ene/type Mono 20 | /gps/ene/mono 3.94 eV 21 | # 22 | /gps/pos/type Volume 23 | /gps/pos/shape Para 24 | /gps/pos/centre 0. 0. 0. cm 25 | /gps/pos/halfx 50. um 26 | /gps/pos/halfy 15. cm 27 | /gps/pos/halfz 50. cm 28 | /gps/ang/type iso -------------------------------------------------------------------------------- /WLSScintBar/macros/co60Source.mac: -------------------------------------------------------------------------------- 1 | # 1D Co60 beam incident upon a surface of radius 3 mm in the x-y plane 2 | # at the origin. Beam is traveling along the z-axis 3 | # 4 | /gps/source/intensity 1. 5 | /gps/particle gamma 6 | /gps/pos/type Beam 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | /gps/pos/shape Circle 10 | /gps/pos/centre 0. 0. 10. cm 11 | /gps/pos/radius 3. mm 12 | /gps/ang/rot1 1 0 0 13 | /gps/ang/rot2 0 1 0 14 | /gps/ang/type beam1d 15 | /gps/ene/type Mono 16 | /gps/ene/mono 1.3325 MeV 17 | 18 | # beam #2 19 | /gps/source/add 1. 20 | /gps/particle gamma 21 | /gps/pos/type Beam 22 | /gps/pos/shape Circle 23 | /gps/pos/rot1 1 0 0 24 | /gps/pos/rot2 0 1 0 25 | /gps/pos/shape Circle 26 | /gps/pos/centre 0. 0. 10. cm 27 | /gps/pos/radius 3. mm 28 | /gps/ang/rot1 1 0 0 29 | /gps/ang/rot2 0 1 0 30 | /gps/ang/type beam1d 31 | # Energy 32 | /gps/ene/type Mono 33 | /gps/energy 1.1732 MeV 34 | -------------------------------------------------------------------------------- /WLSScintBar/macros/gRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Running the co60 beam source 6 | # 7 | /control/execute macros/co60Source.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /analysis/setFileName GS20_Gamma 12 | /analysis/h1/set 1 100 0 1.4 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | # Running through absorber thickness 16 | /run/beamOn 1000000 17 | # 18 | -------------------------------------------------------------------------------- /WLSScintBar/macros/nRun.mac: -------------------------------------------------------------------------------- 1 | # Setting up verbosity 2 | /tracking/verbose 0 3 | /run/verbose 0 4 | # 5 | # Setting up the source 6 | # 7 | /control/execute macros/neutronSource.mac 8 | # 9 | # Setting up the analysis 10 | # 11 | /analysis/setFileName GS20_Neutron 12 | /analysis/h1/set 1 100 0 5.0 MeV none # Energy Depostion 13 | /analysis/h1/set 2 100 0 10000 none # Number of Optical Photons 14 | /analysis/h1/set 3 100 0 10000 none # Number of Optical Photons 15 | # Running through absorber thickness 16 | /run/beamOn 100000 17 | # 18 | -------------------------------------------------------------------------------- /WLSScintBar/macros/neutronSource.mac: -------------------------------------------------------------------------------- 1 | # 1D neutron beam incident upon a surface of radius 3 mm in the y-z plane 2 | # at the origin. Beam is traveling along the x-axis 3 | /gps/particle neutron 4 | /gps/pos/type Beam 5 | # 6 | # the incident surface is in the x-y plane 7 | /gps/pos/rot1 1 0 0 8 | /gps/pos/rot2 0 1 0 9 | # 10 | # the beam spot is centered at the origin and is 11 | # of 1d gaussian shape with a 3mm central plateau 12 | /gps/pos/shape Circle 13 | /gps/pos/centre 0. 0. 10 cm 14 | /gps/pos/radius 3. mm 15 | # 16 | # the beam is travelling along the z-axis with 5 degrees dispersion 17 | /gps/ang/rot1 1 0 0 18 | /gps/ang/rot2 0 1 0 19 | /gps/ang/sigma_r 0. deg 20 | # 21 | # the beam energy is mono energic 22 | /gps/ene/type Mono 23 | /gps/ene/mono 0.025 eV 24 | 25 | -------------------------------------------------------------------------------- /WLSScintBar/src/EventAction.cc: -------------------------------------------------------------------------------- 1 | #include "EventAction.hh" 2 | #include "Analysis.hh" 3 | 4 | #include "G4RunManager.hh" 5 | #include "G4Event.hh" 6 | #include "G4SDManager.hh" 7 | #include "G4HCofThisEvent.hh" 8 | #include "G4UnitsTable.hh" 9 | #include "G4ios.hh" 10 | 11 | EventAction::EventAction() : G4UserEventAction(){ } 12 | 13 | /* 14 | * BeginOfEventAction 15 | * 16 | * Called before the begining of each event 17 | */ 18 | void EventAction::BeginOfEventAction(const G4Event* event){ 19 | Analysis::GetInstance()->PrepareNewEvent(event); 20 | } 21 | 22 | /** 23 | * EndOfEventAction 24 | * 25 | * @param const G4Event* event - event to be processed 26 | * 27 | * At the end of an event we want to call analysis to proccess 28 | * this event, and record the useful information. 29 | */ 30 | void EventAction::EndOfEventAction(const G4Event* event){ 31 | Analysis::GetInstance()->EndOfEvent(event); 32 | } 33 | -------------------------------------------------------------------------------- /WLSScintBar/src/PhotonDetHit.cc: -------------------------------------------------------------------------------- 1 | #include "PhotonDetHit.hh" 2 | 3 | G4Allocator PhotonDetHitAllocator; 4 | 5 | PhotonDetHit::PhotonDetHit() 6 | { 7 | arrivalTime = 0.; 8 | } 9 | 10 | PhotonDetHit::PhotonDetHit(G4double pTime) 11 | { 12 | arrivalTime = pTime; 13 | } 14 | 15 | PhotonDetHit::~PhotonDetHit() { } 16 | 17 | PhotonDetHit::PhotonDetHit(const PhotonDetHit &right) 18 | : G4VHit() 19 | { 20 | *this = right; 21 | } 22 | 23 | const PhotonDetHit& PhotonDetHit::operator=(const PhotonDetHit &right) 24 | { 25 | arrivalTime = right.arrivalTime; 26 | 27 | return *this; 28 | } 29 | 30 | G4int PhotonDetHit::operator==(const PhotonDetHit& right) const 31 | { 32 | return arrivalTime == right.arrivalTime; 33 | } 34 | 35 | void PhotonDetHit::Draw(){ } 36 | 37 | void PhotonDetHit::Print(){ } 38 | -------------------------------------------------------------------------------- /WLSScintBar/src/PhysicsList.cc: -------------------------------------------------------------------------------- 1 | #include "PhysicsList.hh" 2 | 3 | #include "G4EmDNAPhysics.hh" 4 | #include "G4EmStandardPhysics.hh" 5 | #include "G4EmStandardPhysics_option4.hh" 6 | #include "G4EmLivermorePhysics.hh" 7 | #include "G4OpticalPhysics.hh" 8 | #include "HadronPhysicsQGSP_BERT_HP.hh" 9 | #include "G4IonPhysics.hh" 10 | /** 11 | * PhysicsList 12 | * 13 | * Constructs the physics of the simulation 14 | * 15 | * The physics list relies on modular physics. Currently used modules are: 16 | * - Hadronic physics (High Precision) 17 | * - IonPhysics 18 | * - OpticalPhysics 19 | * - EM Standard Physics 20 | */ 21 | PhysicsList::PhysicsList() : G4VModularPhysicsList() { 22 | currentDefaultCut = 10*nm; 23 | 24 | // SetVerboseLevel(1); 25 | 26 | // Adding Physics List 27 | RegisterPhysics( new HadronPhysicsQGSP_BERT_HP()); 28 | RegisterPhysics( new G4IonPhysics()); 29 | RegisterPhysics( new G4OpticalPhysics()); 30 | RegisterPhysics( new G4EmStandardPhysics_option4()); 31 | // RegisterPhysics( new G4EmDNAPhysics()); 32 | } 33 | 34 | /** 35 | * Deconstructor 36 | */ 37 | PhysicsList::~PhysicsList(){ 38 | // Nothing to be done 39 | } 40 | /** 41 | * Sets the physic list cuts 42 | */ 43 | void PhysicsList::SetCuts(){ 44 | SetDefaultCutValue(1*um); 45 | } 46 | -------------------------------------------------------------------------------- /WLSScintBar/src/PrimaryGeneratorAction.cc: -------------------------------------------------------------------------------- 1 | #include "PrimaryGeneratorAction.hh" 2 | 3 | #include "G4RunManager.hh" 4 | #include "G4GeneralParticleSource.hh" 5 | #include "G4Event.hh" 6 | #include "G4ParticleGun.hh" 7 | #include "G4ParticleTable.hh" 8 | #include "G4ParticleDefinition.hh" 9 | #include "Randomize.hh" 10 | #include "globals.hh" 11 | 12 | PrimaryGeneratorAction::PrimaryGeneratorAction() 13 | : G4VUserPrimaryGeneratorAction(){ 14 | fParticleGun = new G4GeneralParticleSource(); 15 | 16 | } 17 | 18 | 19 | PrimaryGeneratorAction::~PrimaryGeneratorAction() 20 | { 21 | delete fParticleGun; 22 | } 23 | 24 | 25 | void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 26 | { 27 | fParticleGun->GeneratePrimaryVertex(anEvent); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /WLSScintBar/src/RunAction.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file RunAction.hh 3 | * 4 | * @date 5 July 2012 5 | * @author murffer 6 | * 7 | * @brief Implements user class RunAction 8 | */ 9 | #include "RunAction.hh" 10 | #include "G4Run.hh" 11 | #include "G4RunManager.hh" 12 | #include "G4UnitsTable.hh" 13 | 14 | #include "Analysis.hh" 15 | 16 | RunAction::RunAction() : G4UserRunAction(){} 17 | 18 | 19 | void RunAction::BeginOfRunAction(const G4Run* run){ 20 | G4cout<<"Starting run: " << run->GetRunID()<< G4endl; 21 | Analysis::GetInstance()->PrepareNewRun(run); 22 | } 23 | 24 | void RunAction::EndOfRunAction(const G4Run* aRun){ 25 | G4cout<<"Ending run: " << aRun->GetRunID()<< G4endl; 26 | Analysis::GetInstance()->EndOfRun(aRun); 27 | } 28 | -------------------------------------------------------------------------------- /WLSScintBar/src/StackingAction.cc: -------------------------------------------------------------------------------- 1 | #include "StackingAction.hh" 2 | #include "G4String.hh" 3 | #include "G4Track.hh" 4 | #include "G4ParticleDefinition.hh" 5 | #include "G4ParticleTypes.hh" 6 | #include "Analysis.hh" 7 | 8 | StackingAction::StackingAction(){ 9 | optPhotonCounter = 0; 10 | } 11 | 12 | 13 | StackingAction::~StackingAction() 14 | { } 15 | /** 16 | * NewStage 17 | * 18 | * Seems to be called once stack is empty, so only after an event is over 19 | */ 20 | void StackingAction::NewStage(){ 21 | 22 | // Updating Analysis 23 | Analysis::GetInstance()->SetNumOpticalPhotonsGenerated(optPhotonCounter); 24 | } 25 | /** 26 | * PrepareNewEvent 27 | * 28 | * Prepares a new event for the stacking action. 29 | * The only action we need to do is reset the counters 30 | */ 31 | void StackingAction::PrepareNewEvent(){ 32 | optPhotonCounter = 0; 33 | } 34 | /** 35 | * ClassifyNewTrack 36 | * 37 | * Called every time a new track needs to be classified, so we can use it to 38 | * determine in the new track is an optical photon 39 | */ 40 | G4ClassificationOfNewTrack StackingAction::ClassifyNewTrack(const G4Track* track){ 41 | // Optical Photon Counter 42 | if(track->GetDefinition()== G4OpticalPhoton::OpticalPhotonDefinition()){ 43 | optPhotonCounter++; 44 | } 45 | return fUrgent; 46 | } 47 | -------------------------------------------------------------------------------- /WLSScintBar/subJob.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export G4WORKDIR=/home/murffer/G4DetectorSim/WLSScintBar 3 | 4 | # 5 | # Setting up the job 6 | # 7 | function JobSetup() 8 | { 9 | echo "#!/bin/bash" > job 10 | echo "#PBS -q gen1" >> job 11 | echo "#PBS -V" >> job 12 | echo "#PBS -l nodes=1:ppn=2" >> job 13 | echo "export PBS_O_WORKDIR=$G4WORKDIR" >> job 14 | echo 'cd $PBS_O_WORKDIR' >> job 15 | } 16 | 17 | function runClad() 18 | { 19 | JobSetup 20 | echo "exec $G4WORKDIR/build/scintSlab $G4WORKDIR/CladdingTest.mac > CladOutput.txt" >> job 21 | mv job CladdSub.qsub 22 | qsub CladdSub.qsub 23 | } 24 | 25 | function runWLS() 26 | { 27 | JobSetup 28 | echo "exec $G4WORKDIR/build/scintSlab $G4WORKDIR/WLSCases.mac > WLSOutput.txt" >> job 29 | mv job WLSSub.qsub 30 | qsub WLSSub.qsub 31 | } 32 | 33 | # Running the jobs 34 | runClad 35 | runWLS 36 | # Cleaning up 37 | rm CladSub.qsub 38 | rm WLSSub.qsub 39 | --------------------------------------------------------------------------------