From 6cf14608e37aa5c82d0a86590a5d3013f8e5cab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Der=C3=B3s?= Date: Mon, 22 Jul 2019 06:25:23 -0300 Subject: [PATCH] files changed to handle tracking action class --- CMakeLists.txt | 85 +++ exampleB1.in | 16 + exampleB1.out | 769 ++++++++++++++++++++++++++++ include/B1ActionInitialization.hh | 54 ++ include/B1Analysis.hh | 7 + include/B1DetectorConstruction.hh | 59 +++ include/B1EventAction.hh | 61 +++ include/B1PrimaryGeneratorAction.hh | 65 +++ include/B1RunAction.hh | 71 +++ include/B1SteppingAction.hh | 60 +++ include/B1TrackingAction.hh | 44 ++ src/B1ActionInitialization.cc | 76 +++ src/B1DetectorConstruction.cc | 104 ++++ src/B1EventAction.cc | 64 +++ src/B1PrimaryGeneratorAction.cc | 87 ++++ src/B1RunAction.cc | 252 +++++++++ src/B1SteppingAction.cc | 132 +++++ src/B1TrackingAction.cc | 62 +++ 18 files changed, 2068 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 exampleB1.in create mode 100644 exampleB1.out create mode 100644 include/B1ActionInitialization.hh create mode 100644 include/B1Analysis.hh create mode 100644 include/B1DetectorConstruction.hh create mode 100644 include/B1EventAction.hh create mode 100644 include/B1PrimaryGeneratorAction.hh create mode 100644 include/B1RunAction.hh create mode 100644 include/B1SteppingAction.hh create mode 100644 include/B1TrackingAction.hh create mode 100644 src/B1ActionInitialization.cc create mode 100644 src/B1DetectorConstruction.cc create mode 100644 src/B1EventAction.cc create mode 100644 src/B1PrimaryGeneratorAction.cc create mode 100644 src/B1RunAction.cc create mode 100644 src/B1SteppingAction.cc create mode 100644 src/B1TrackingAction.cc diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..494e861 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,85 @@ + +#---------------------------------------------------------------------------- +# Setup the project +cmake_minimum_required(VERSION 2.6 FATAL_ERROR) +project(cosmic_rays) + +#---------------------------------------------------------------------------- +# Find Geant4 package, activating all available UI and Vis drivers by default +# You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui +# to build a batch mode only executable +# +option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON) +if(WITH_GEANT4_UIVIS) + find_package(Geant4 REQUIRED ui_all vis_all) +else() + find_package(Geant4 REQUIRED) +endif() + +#---------------------------------------------------------------------------- +# Setup Geant4 include directories and compile definitions +# Setup include directory for this project +# +include(${Geant4_USE_FILE}) +include_directories(${PROJECT_SOURCE_DIR}/include) + + +#---------------------------------------------------------------------------- +# Locate sources and headers for this project +# NB: headers are included so they will show up in IDEs +# +set(PROJECT_SRC + + src/B1ActionInitialization.cc + src/B1DetectorConstruction.cc + src/B1EventAction.cc + src/B1PrimaryGeneratorAction.cc + src/B1RunAction.cc + src/B1SteppingAction.cc + src/B1TrackingAction.cc +) + +set(PROJECT_HEADER +include/B1ActionInitialization.hh +include/B1DetectorConstruction.hh +include/B1EventAction.hh +include/B1PrimaryGeneratorAction.hh +include/B1RunAction.hh +include/B1SteppingAction.hh +include/B1Analysis.hh +include/B1TrackingAction.hh +) + +#---------------------------------------------------------------------------- +# Add the executable, and link it to the Geant4 libraries +# +add_executable(cosmic_rays cosmic_rays.cc ${PROJECT_SRC} ${PROJECT_HEADER}) +target_link_libraries(cosmic_rays ${Geant4_LIBRARIES}) + +#---------------------------------------------------------------------------- +# Copy all scripts to the build directory, i.e. the directory in which we +# build B1. This is so that we can run the executable directly because it +# relies on these scripts being in the current working directory. +# +set(EXAMPLEB1_SCRIPTS + exampleB1.in + exampleB1.out + init_vis.mac + run1.mac + run2.mac + vis.mac + ) + +foreach(_script ${EXAMPLEB1_SCRIPTS}) + configure_file( + ${PROJECT_SOURCE_DIR}/${_script} + ${PROJECT_BINARY_DIR}/${_script} + COPYONLY + ) +endforeach() + + +#---------------------------------------------------------------------------- +# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX +# +install(TARGETS cosmic_rays DESTINATION bin) diff --git a/exampleB1.in b/exampleB1.in new file mode 100644 index 0000000..11f4c83 --- /dev/null +++ b/exampleB1.in @@ -0,0 +1,16 @@ +# Macro file for example B1 test + +/run/initialize + +# gamma 6 MeV +/gun/particle gamma +/gun/energy 6 MeV +# +/run/printProgress 100 +/run/beamOn 1000 +# +# proton 210 MeV +/gun/particle proton +/gun/energy 210 MeV +# +/run/beamOn 1000 diff --git a/exampleB1.out b/exampleB1.out new file mode 100644 index 0000000..9116e2d --- /dev/null +++ b/exampleB1.out @@ -0,0 +1,769 @@ + +************************************************************** + Geant4 version Name: geant4-10-05-ref-06 (30-June-2019) + Copyright : Geant4 Collaboration + References : NIM A 506 (2003), 250-303 + : IEEE-TNS 53 (2006), 270-278 + : NIM A 835 (2016), 186-225 + WWW : http://geant4.org/ +************************************************************** + +<<< Reference Physics List QBBC +Visualization Manager instantiating with verbosity "warnings (3)"... +Visualization Manager initialising... +Registering graphics systems... + +You have successfully registered the following graphics systems. +Current available graphics systems are: +ASCIITree (ATree) +DAWNFILE (DAWNFILE) +G4HepRep (HepRepXML) +G4HepRepFile (HepRepFile) +RayTracer (RayTracer) +VRML1FILE (VRML1FILE) +VRML2FILE (VRML2FILE) +gMocrenFile (gMocrenFile) +OpenGLImmediateXm (OGLIXm, OGLI) +OpenGLStoredXm (OGLSXm, OGL, OGLS) +OpenGLImmediateX (OGLIX, OGLIXm_FALLBACK) +OpenGLStoredX (OGLSX, OGLSXm_FALLBACK) +RayTracerX (RayTracerX) + +Registering model factories... + +You have successfully registered the following model factories. +Registered model factories: + generic + drawByAttribute + drawByCharge + drawByOriginVolume + drawByParticleID + drawByEncounteredVolume + +Registered filter factories: + attributeFilter + chargeFilter + originVolumeFilter + particleFilter + encounteredVolumeFilter + +You have successfully registered the following user vis actions. +Run Duration User Vis Actions: none +End of Event User Vis Actions: none +End of Run User Vis Actions: none + +Some /vis commands (optionally) take a string to specify colour. +"/vis/list" to see available colours. +Checking overlaps for volume Envelope ... OK! +Checking overlaps for volume Shape1 ... OK! +Checking overlaps for volume Shape2 ... OK! +### Adding tracking cuts for neutron TimeCut(ns)= 10000 KinEnergyCut(MeV)= 0 + +phot: for gamma SubType=12 BuildTable=0 + LambdaPrime table from 200 keV to 100 TeV in 61 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + LivermorePhElectric : Emin= 0 eV Emax= 100 TeV SauterGavrila Fluo + +compt: for gamma SubType=13 BuildTable=1 + Lambda table from 100 eV to 1 MeV, 7 bins/decade, spline: 1 + LambdaPrime table from 1 MeV to 100 TeV in 56 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Klein-Nishina : Emin= 0 eV Emax= 100 TeV + +conv: for gamma SubType=14 BuildTable=1 + Lambda table from 1.022 MeV to 100 TeV, 18 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BetheHeitler : Emin= 0 eV Emax= 80 GeV ModifiedTsai + BetheHeitlerLPM : Emin= 80 GeV Emax= 100 TeV ModifiedTsai + +Rayl: for gamma SubType=11 BuildTable=1 + Lambda table from 100 eV to 100 keV, 7 bins/decade, spline: 0 + LambdaPrime table from 100 keV to 100 TeV in 63 bins + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + LivermoreRayleigh : Emin= 0 eV Emax= 100 TeV CullenGenerator + +msc: for e- SubType= 10 + RangeFactor= 0.04, stepLimType: 1, latDisp: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV + WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV + +eIoni: for e- SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MollerBhabha : Emin= 0 eV Emax= 100 TeV + +eBrem: for e- SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai + eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai + +CoulombScat: for e-, integral:1 SubType=1 BuildTable=1 + Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 100 MeV Emax= 100 TeV + +msc: for e+ SubType= 10 + RangeFactor= 0.04, stepLimType: 1, latDisp: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 MeV Nbins=42 100 eV - 100 MeV + WentzelVIUni : Emin= 100 MeV Emax= 100 TeV Nbins=42 100 MeV - 100 TeV + +eIoni: for e+ SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MollerBhabha : Emin= 0 eV Emax= 100 TeV + +eBrem: for e+ SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + LPM flag: 1 for E > 1 GeV, VertexHighEnergyTh(GeV)= 100000 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eBremSB : Emin= 0 eV Emax= 1 GeV ModifiedTsai + eBremLPM : Emin= 1 GeV Emax= 100 TeV ModifiedTsai + +annihil: for e+, integral:1 SubType=5 BuildTable=0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eplus2gg : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for e+, integral:1 SubType=1 BuildTable=1 + Lambda table from 100 MeV to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 100 MeV Emax= 100 TeV + +msc: for proton SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for proton SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +hBrems: for proton SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for proton SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 17x1001 from 7.50618 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for proton, integral:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for GenericIon SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 TeV + +ionIoni: for GenericIon SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02 + Stopping Power data for 17 ion/material pairs + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BraggIon : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +msc: for alpha SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + UrbanMsc : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +ionIoni: for alpha SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.02 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + BraggIon : Emin= 0 eV Emax=7.9452 MeV + BetheBloch : Emin=7.9452 MeV Emax= 100 TeV + +msc: for anti_proton SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for anti_proton SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax= 2 MeV + BetheBloch : Emin= 2 MeV Emax= 100 TeV + +hBrems: for anti_proton SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for anti_proton SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 17x1001 from 7.50618 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for anti_proton, integral:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for kaon+ SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for kaon+ SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax=1.05231 MeV + BetheBloch : Emin=1.05231 MeV Emax= 100 TeV + +hBrems: for kaon+ SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for kaon+ SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 18x1001 from 3.94942 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for kaon+, integral:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for kaon- SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for kaon- SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax=1.05231 MeV + BetheBloch : Emin=1.05231 MeV Emax= 100 TeV + +hBrems: for kaon- SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for kaon- SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 18x1001 from 3.94942 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for kaon-, integral:1 SubType=1 BuildTable=1 + Used Lambda table of kaon+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for mu+ SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0, polarAngLim(deg)= 180 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +muIoni: for mu+ SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax= 200 keV + BetheBloch : Emin= 200 keV Emax= 1 GeV + MuBetheBloch : Emin= 1 GeV Emax= 100 TeV + +muBrems: for mu+ SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MuBrem : Emin= 0 eV Emax= 100 TeV + +muPairProd: for mu+ SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 21x1001 from 1 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + muPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for mu+, integral:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for mu- SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0, polarAngLim(deg)= 180 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +muIoni: for mu- SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax= 200 keV + BetheBloch : Emin= 200 keV Emax= 1 GeV + MuBetheBloch : Emin= 1 GeV Emax= 100 TeV + +muBrems: for mu- SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + MuBrem : Emin= 0 eV Emax= 100 TeV + +muPairProd: for mu- SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 21x1001 from 1 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + muPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for mu-, integral:1 SubType=1 BuildTable=1 + Used Lambda table of mu+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for pi+ SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for pi+ SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + Bragg : Emin= 0 eV Emax=297.505 keV + BetheBloch : Emin=297.505 keV Emax= 100 TeV + +hBrems: for pi+ SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for pi+ SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 20x1001 from 1.11656 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for pi+, integral:1 SubType=1 BuildTable=1 + Lambda table from threshold to 100 TeV, 7 bins/decade, spline: 1 + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +msc: for pi- SubType= 10 + RangeFactor= 0.2, stepLimType: 0, latDisp: 0 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + WentzelVIUni : Emin= 0 eV Emax= 100 TeV Nbins=84 100 eV - 100 TeV + +hIoni: for pi- SubType=2 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + StepFunction=(0.2, 0.1 mm), integ: 1, fluct: 1, linLossLim= 0.01 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + ICRU73QO : Emin= 0 eV Emax=297.505 keV + BetheBloch : Emin=297.505 keV Emax= 100 TeV + +hBrems: for pi- SubType=3 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hBrem : Emin= 0 eV Emax= 100 TeV + +hPairProd: for pi- SubType=4 + dE/dx and range tables from 100 eV to 100 TeV in 84 bins + Lambda tables from threshold to 100 TeV, 7 bins/decade, spline: 1 + Sampling table 20x1001 from 1.11656 GeV to 100 TeV + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + hPairProd : Emin= 0 eV Emax= 100 TeV + +CoulombScat: for pi-, integral:1 SubType=1 BuildTable=1 + Used Lambda table of pi+ + ThetaMin(p) < Theta(degree) < 180 pLimit(GeV^1)= 0.139531 + ===== EM models for the G4Region DefaultRegionForTheWorld ====== + eCoulombScattering : Emin= 0 eV Emax= 100 TeV + +==================================================================== + HADRONIC PROCESSES SUMMARY (verbose level 1) + +--------------------------------------------------- + Hadronic Processes for neutron + + Process: hadElastic + Model: hElasticCHIPS: 0 eV ---> 100 TeV + Cr_sctns: G4NeutronElasticXS: 0 eV ---> 100 TeV + + Process: neutronInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 5 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: G4NeutronInelasticXS: 0 eV ---> 100 TeV + + Process: nCapture + Model: nRadCapture: 0 eV ---> 100 TeV + Cr_sctns: G4NeutronCaptureXS: 0 eV ---> 100 TeV + + Process: nKiller + +--------------------------------------------------- + Hadronic Processes for GenericIon + + Process: ionInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 4 GeV/n + Model: FTFP: 2 GeV/n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + + Process: ionElastic + Model: NNDiffuseElastic: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for He3 + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + + Process: He3Inelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 4 GeV/n + Model: FTFP: 2 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for alpha + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + + Process: alphaInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 4 GeV/n + Model: FTFP: 2 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for anti_He3 + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: anti_He3Inelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_alpha + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: anti_alphaInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_deuteron + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: anti_deuteronInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_neutron + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: anti_neutronInelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_proton + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100.1 MeV + Model: AntiAElastic: 100 MeV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: anti_protonInelastic + Model: FTFP: 0 eV ---> 100 TeV + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for anti_triton + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100.1 MeV/n + Model: AntiAElastic: 100 MeV/n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: anti_tritonInelastic + Model: FTFP: 0 eV /n ---> 100 TeV/n + Cr_sctns: AntiAGlauber: 0 eV ---> 100 TeV + + Process: hFritiofCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for deuteron + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + + Process: dInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 4 GeV/n + Model: FTFP: 2 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for e+ + + Process: positronNuclear + Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for e- + + Process: electronNuclear + Model: G4ElectroVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: ElectroNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for gamma + + Process: photonNuclear + Model: BertiniCascade: 0 eV ---> 3.5 GeV + Model: TheoFSGenerator: 3 GeV ---> 100 TeV + Cr_sctns: PhotoNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for kaon+ + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: kaon+Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 5 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for kaon- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: kaon-Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 5 GeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: hBertiniCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for lambda + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 100 TeV + Cr_sctns: Glauber-Gribov: 0 eV ---> 100 TeV + + Process: lambdaInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 5 GeV + Cr_sctns: ChipsHyperonInelasticXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for mu+ + + Process: muonNuclear + Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for mu- + + Process: muonNuclear + Model: G4MuonVDNuclearModel: 0 eV ---> 1 PeV + Cr_sctns: KokoulinMuonNuclearXS: 0 eV ---> 100 TeV + + Process: muMinusCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for pi+ + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 1.0001 GeV + Model: hElasticGlauber: 1 GeV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: pi+Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 5 GeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for pi- + + Process: hadElastic + Model: hElasticLHEP: 0 eV ---> 1.0001 GeV + Model: hElasticGlauber: 1 GeV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: pi-Inelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 0 eV ---> 5 GeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: hBertiniCaptureAtRest + +--------------------------------------------------- + Hadronic Processes for proton + + Process: hadElastic + Model: hElasticCHIPS: 0 eV ---> 100 TeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + + Process: protonInelastic + Model: FTFP: 3 GeV ---> 100 TeV + Model: BertiniCascade: 1 GeV ---> 5 GeV + Model: Binary Cascade: 0 eV ---> 1.5 GeV + Cr_sctns: BarashenkovGlauberGribov: 0 eV ---> 100 TeV + +--------------------------------------------------- + Hadronic Processes for triton + + Process: hadElastic + Model: hElasticLHEP: 0 eV /n ---> 100 TeV/n + Cr_sctns: Glauber-Gribov Nucl-nucl: 0 eV ---> 100 TeV + + Process: tInelastic + Model: Binary Light Ion Cascade: 0 eV /n ---> 4 GeV/n + Model: FTFP: 2 GeV/n ---> 100 TeV/n + Cr_sctns: G4ParticleInelasticXS: 0 eV ---> 100 TeV + +================================================================ +======================================================================= +====== Pre-compound/De-excitation Physics Parameters ======== +======================================================================= +Type of pre-compound inverse x-section 3 +Pre-compound model active 1 +Pre-compound low energy (MeV) 0.1 +Type of de-excitation inverse x-section 3 +Type of de-excitation factory Evaporation+GEM +Number of de-excitation channels 68 +Min excitation energy (keV) 0.01 +Min energy per nucleon for multifragmentation (MeV) 1e+05 +Limit excitation energy for Fermi BreakUp (MeV) 20 +Level density (1/MeV) 0.075 +Model of level density flag 1 +Time limit for long lived isomeres (ns) 1e+12 +Internal e- conversion flag 1 +Store e- internal conversion data 0 +Electron internal conversion ID 0 +Correlated gamma emission flag 0 +Max 2J for sampling of angular correlations 10 +======================================================================= +G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model. +See commands in /vis/modeling/trajectories/ for other options. +### Run 0 starts. +--> Event 0 starts. +--> Event 100 starts. +--> Event 200 starts. +--> Event 300 starts. +--> Event 400 starts. +--> Event 500 starts. +--> Event 600 starts. +--> Event 700 starts. +--> Event 800 starts. +--> Event 900 starts. + +--------------------End of Global Run----------------------- + The run consists of 1000 gamma of 6 MeV + Cumulated dose per run, in scoring volume : 40.0907 picoGy rms = 3.81872 picoGy +------------------------------------------------------------ + +### Run 1 starts. +--> Event 0 starts. +--> Event 100 starts. +--> Event 200 starts. +--> Event 300 starts. +--> Event 400 starts. +--> Event 500 starts. +--> Event 600 starts. +--> Event 700 starts. +--> Event 800 starts. +--> Event 900 starts. + +--------------------End of Global Run----------------------- + The run consists of 1000 proton of 210 MeV + Cumulated dose per run, in scoring volume : 5.07255 nanoGy rms = 146.85 picoGy +------------------------------------------------------------ + +Graphics systems deleted. +Visualization Manager deleting... diff --git a/include/B1ActionInitialization.hh b/include/B1ActionInitialization.hh new file mode 100644 index 0000000..f0d19c3 --- /dev/null +++ b/include/B1ActionInitialization.hh @@ -0,0 +1,54 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1ActionInitialization.hh +/// \brief Definition of the B1ActionInitialization class + +#ifndef B1ActionInitialization_h +#define B1ActionInitialization_h 1 + +#include "G4VUserActionInitialization.hh" + +/// Action initialization class. +class B1DetectorConstruction; + +class B1ActionInitialization : public G4VUserActionInitialization +{ + private: + + B1DetectorConstruction* fDetectorConstruction; + + public: + B1ActionInitialization(B1DetectorConstruction *Detector); + virtual ~B1ActionInitialization(); + + virtual void BuildForMaster() const; + virtual void Build() const; +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif diff --git a/include/B1Analysis.hh b/include/B1Analysis.hh new file mode 100644 index 0000000..75b6cc7 --- /dev/null +++ b/include/B1Analysis.hh @@ -0,0 +1,7 @@ +#ifndef B1Analysis_h +#define B1Analysis_h 1 + +//Como vamos utilizar o root como software de análise de dados: +#include "g4root.hh" + +#endif diff --git a/include/B1DetectorConstruction.hh b/include/B1DetectorConstruction.hh new file mode 100644 index 0000000..6ca18c2 --- /dev/null +++ b/include/B1DetectorConstruction.hh @@ -0,0 +1,59 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1DetectorConstruction.hh +/// \brief Definition of the B1DetectorConstruction class + +#ifndef B1DetectorConstruction_h +#define B1DetectorConstruction_h 1 + +#include "G4VUserDetectorConstruction.hh" +#include "globals.hh" + +class G4VPhysicalVolume; +class G4LogicalVolume; + +/// Detector construction class to define materials and geometry. + +class B1DetectorConstruction : public G4VUserDetectorConstruction +{ + public: + B1DetectorConstruction(); + virtual ~B1DetectorConstruction(); + + virtual G4VPhysicalVolume* Construct(); + + G4LogicalVolume* GetScoringVolume() const { return fScoringVolume; } + + protected: + G4LogicalVolume* fScoringVolume; + +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif + diff --git a/include/B1EventAction.hh b/include/B1EventAction.hh new file mode 100644 index 0000000..14a1727 --- /dev/null +++ b/include/B1EventAction.hh @@ -0,0 +1,61 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1EventAction.hh +/// \brief Definition of the B1EventAction class + +#ifndef B1EventAction_h +#define B1EventAction_h 1 + +#include "G4UserEventAction.hh" +#include "globals.hh" + +class B1RunAction; + +/// Event action class +/// + +class B1EventAction : public G4UserEventAction +{ + public: + B1EventAction(B1RunAction* runAction); + virtual ~B1EventAction(); + + virtual void BeginOfEventAction(const G4Event* event); + virtual void EndOfEventAction(const G4Event* event); + + void AddEdep(G4double edep) { fEdep += edep; } + + private: + B1RunAction* fRunAction; + G4double fEdep; +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif + + diff --git a/include/B1PrimaryGeneratorAction.hh b/include/B1PrimaryGeneratorAction.hh new file mode 100644 index 0000000..1bb418c --- /dev/null +++ b/include/B1PrimaryGeneratorAction.hh @@ -0,0 +1,65 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1PrimaryGeneratorAction.hh +/// \brief Definition of the B1PrimaryGeneratorAction class + +#ifndef B1PrimaryGeneratorAction_h +#define B1PrimaryGeneratorAction_h 1 + +#include "G4VUserPrimaryGeneratorAction.hh" +#include "G4ParticleGun.hh" +#include "globals.hh" + +class G4ParticleGun; +class G4Event; +class G4Box; + +/// The primary generator action class with particle gun. +/// +/// The default kinematic is a 6 MeV gamma, randomly distribued +/// in front of the phantom across 80% of the (X,Y) phantom size. + +class B1PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction +{ + public: + B1PrimaryGeneratorAction(); + virtual ~B1PrimaryGeneratorAction(); + + // method from the base class + virtual void GeneratePrimaries(G4Event*); + + // method to access particle gun + const G4ParticleGun* GetParticleGun() const { return fParticleGun; } + + private: + G4ParticleGun* fParticleGun; // pointer a to G4 gun class + G4Box* fEnvelopeBox; +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif diff --git a/include/B1RunAction.hh b/include/B1RunAction.hh new file mode 100644 index 0000000..6363efa --- /dev/null +++ b/include/B1RunAction.hh @@ -0,0 +1,71 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1RunAction.hh +/// \brief Definition of the B1RunAction class + +#ifndef B1RunAction_h +#define B1RunAction_h 1 + +#include "G4UserRunAction.hh" +#include "G4ParticleDefinition.hh" +#include "G4Accumulable.hh" +#include "globals.hh" +#include + +class G4Run; +class B1TrackingAction; + +/// Run action class +/// +/// In EndOfRunAction(), it calculates the dose in the selected volume +/// from the energy deposit accumulated via stepping and event actions. +/// The computed dose is then printed on the screen. + +class B1RunAction : public G4UserRunAction +{ + public: + B1RunAction(); + virtual ~B1RunAction(); + + // virtual G4Run* GenerateRun(); + virtual void BeginOfRunAction(const G4Run*); + virtual void EndOfRunAction(const G4Run*); + + void PrintParticles(std::map& container); + void AddEdep (G4double edep); + + private: + //adiciona mais duas instâncias da classe + void createHistogram(); + void WriteHistogram(); + G4Accumulable fEdep; + G4Accumulable fEdep2; + B1TrackingAction* fptrackingAction; + +}; + +#endif diff --git a/include/B1SteppingAction.hh b/include/B1SteppingAction.hh new file mode 100644 index 0000000..fb18f32 --- /dev/null +++ b/include/B1SteppingAction.hh @@ -0,0 +1,60 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1SteppingAction.hh +/// \brief Definition of the B1SteppingAction class + +#ifndef B1SteppingAction_h +#define B1SteppingAction_h 1 + +#include "G4UserSteppingAction.hh" +#include "globals.hh" + +class B1EventAction; + +class G4LogicalVolume; + +/// Stepping action class +/// + +class B1SteppingAction : public G4UserSteppingAction +{ + public: + B1SteppingAction(B1EventAction* eventAction); + virtual ~B1SteppingAction(); + + + // method from the base class + virtual void UserSteppingAction(const G4Step*); + + private: + B1EventAction* fEventAction; + G4LogicalVolume* fScoringVolume; +}; + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +#endif diff --git a/include/B1TrackingAction.hh b/include/B1TrackingAction.hh new file mode 100644 index 0000000..88211b8 --- /dev/null +++ b/include/B1TrackingAction.hh @@ -0,0 +1,44 @@ + + +#ifndef TrackingAction_h +#define TrackingAction_h + +#include "G4UserTrackingAction.hh" +#include "G4LogicalVolume.hh" +#include + +class G4Region; +class G4ParticleDefinition; +class B1DetectorConstruction; + + +class B1TrackingAction : public G4UserTrackingAction +{ +private: + //aqui ficam as variáveis da classe + B1DetectorConstruction* fworld; + G4Region* fworldRegion; + G4LogicalVolume* worldVolume; + const G4ParticleDefinition* particle_def; + std::map fNParticleOutsideWorld; + std::map fNParticleInWorld; + +public: + //aqui ficam as funçes que a classe terá + B1TrackingAction(B1DetectorConstruction* world); //construtor + ~B1TrackingAction(); //destrutor + virtual void PreUserTrackingAction(const G4Track* track); + + std::map& GetNParticlesCreatedOutsideWorld() + { + return fNParticleOutsideWorld; + } + + std::map& GetNParticlesCreatedInWorld() + { + return fNParticleInWorld; + } + void clearParticles(); +}; + +#endif diff --git a/src/B1ActionInitialization.cc b/src/B1ActionInitialization.cc new file mode 100644 index 0000000..f2b9af4 --- /dev/null +++ b/src/B1ActionInitialization.cc @@ -0,0 +1,76 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1ActionInitialization.cc +/// \brief Implementation of the B1ActionInitialization class + +#include "B1ActionInitialization.hh" +#include "B1PrimaryGeneratorAction.hh" +#include "B1RunAction.hh" +#include "B1EventAction.hh" +#include "B1SteppingAction.hh" +#include "B1TrackingAction.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1ActionInitialization::B1ActionInitialization(B1DetectorConstruction *Detector) + : G4VUserActionInitialization(), + fDetectorConstruction(Detector) +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1ActionInitialization::~B1ActionInitialization() +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1ActionInitialization::BuildForMaster() const +{ + B1RunAction* runAction = new B1RunAction; + SetUserAction(runAction); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1ActionInitialization::Build() const +{ + SetUserAction(new B1PrimaryGeneratorAction); + + //adicionando Tracking Action + B1TrackingAction* trackingAction = new B1TrackingAction(fDetectorConstruction); //cria objeto trackingAction, da classe B1TrackingAction + SetUserAction(trackingAction); + + B1RunAction* runAction = new B1RunAction; + SetUserAction(runAction); + + B1EventAction* eventAction = new B1EventAction(runAction); + SetUserAction(eventAction); + + SetUserAction(new B1SteppingAction(eventAction)); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1DetectorConstruction.cc b/src/B1DetectorConstruction.cc new file mode 100644 index 0000000..ad5f620 --- /dev/null +++ b/src/B1DetectorConstruction.cc @@ -0,0 +1,104 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1DetectorConstruction.cc +/// \brief Implementation of the B1DetectorConstruction class + +#include "B1DetectorConstruction.hh" + +#include "G4RunManager.hh" +#include "G4NistManager.hh" +#include "G4Box.hh" +#include "G4Tubs.hh" +#include "G4Cons.hh" +#include "G4Orb.hh" +#include "G4Sphere.hh" +#include "G4Trd.hh" +#include "G4LogicalVolume.hh" +#include "G4PVPlacement.hh" +#include "G4SystemOfUnits.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1DetectorConstruction::B1DetectorConstruction() +: G4VUserDetectorConstruction(), + fScoringVolume(0) +{ } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1DetectorConstruction::~B1DetectorConstruction() +{ } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +G4VPhysicalVolume* B1DetectorConstruction::Construct() +{ + // Get nist material manager + G4NistManager* nist = G4NistManager::Instance(); + G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm; + + // Option to switch on/off checking of volumes overlaps + // + G4bool checkOverlaps = true; + + // + // World + // + //caracteristicas do cilíndro + G4double raio_i = 0; + G4double raio_e = 80.*m; + G4double h = 100.*m; + G4double theta_0 = 0.*deg; + G4double theta_f = 360.*deg; + G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR"); + + G4Tubs* cilindro = new G4Tubs("world", raio_i, raio_e, h, theta_0, theta_f); + + G4LogicalVolume* logicWorld = + new G4LogicalVolume(cilindro, //its solid + world_mat, //its material + "World"); //its name + + G4VPhysicalVolume* physWorld = + new G4PVPlacement(0, //no rotation + G4ThreeVector(), //at (0,0,0) + logicWorld, //its logical volume + "World", //its name + 0, //its mother volume + false, //no boolean operation + 0, //copy number + checkOverlaps); //overlaps checking + + + // + //always return the physical World + // + fScoringVolume = logicWorld; + return physWorld; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1EventAction.cc b/src/B1EventAction.cc new file mode 100644 index 0000000..e57ff7f --- /dev/null +++ b/src/B1EventAction.cc @@ -0,0 +1,64 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1EventAction.cc +/// \brief Implementation of the B1EventAction class + +#include "B1EventAction.hh" +#include "B1RunAction.hh" + +#include "G4Event.hh" +#include "G4RunManager.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1EventAction::B1EventAction(B1RunAction* runAction) +: G4UserEventAction(), + fRunAction(runAction), + fEdep(0.) +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1EventAction::~B1EventAction() +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1EventAction::BeginOfEventAction(const G4Event*) +{ + fEdep = 0.; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1EventAction::EndOfEventAction(const G4Event*) +{ + // accumulate statistics in run action + fRunAction->AddEdep(fEdep); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1PrimaryGeneratorAction.cc b/src/B1PrimaryGeneratorAction.cc new file mode 100644 index 0000000..270a9df --- /dev/null +++ b/src/B1PrimaryGeneratorAction.cc @@ -0,0 +1,87 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1PrimaryGeneratorAction.cc +/// \brief Implementation of the B1PrimaryGeneratorAction class + +#include "B1PrimaryGeneratorAction.hh" + +#include "G4LogicalVolumeStore.hh" +#include "G4LogicalVolume.hh" +#include "G4Box.hh" +#include "G4RunManager.hh" +#include "G4ParticleGun.hh" +#include "G4ParticleTable.hh" +#include "G4ParticleDefinition.hh" +#include "G4SystemOfUnits.hh" +#include "Randomize.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1PrimaryGeneratorAction::B1PrimaryGeneratorAction() +: G4VUserPrimaryGeneratorAction(), + fParticleGun(0), + fEnvelopeBox(0) +{ + G4int n_particle = 1; + fParticleGun = new G4ParticleGun(n_particle); + + // default particle kinematic + G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); + G4String particleName; + G4ParticleDefinition* particle + = particleTable->FindParticle(particleName="proton"); + fParticleGun->SetParticleDefinition(particle); + fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.)); + fParticleGun->SetParticleEnergy(1.*TeV); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1PrimaryGeneratorAction::~B1PrimaryGeneratorAction() +{ + delete fParticleGun; +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) +{ + //this function is called at the begining of ecah event + // + + // In order to avoid dependence of PrimaryGeneratorAction + // on DetectorConstruction class we get Envelope volume + // from G4LogicalVolumeStore. + + + + fParticleGun->SetParticlePosition(G4ThreeVector(0,0,-100.*m)); + + fParticleGun->GeneratePrimaryVertex(anEvent); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1RunAction.cc b/src/B1RunAction.cc new file mode 100644 index 0000000..946c6d7 --- /dev/null +++ b/src/B1RunAction.cc @@ -0,0 +1,252 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1RunAction.cc +/// \brief Implementation of the B1RunAction class + +#include "B1RunAction.hh" +#include "B1PrimaryGeneratorAction.hh" +#include "B1DetectorConstruction.hh" +#include "B1SteppingAction.hh" +//adicionando Tracking Action +#include "B1TrackingAction.hh" +// #include "B1Run.hh" +// Adicionando header de análise de dados: +#include "B1Analysis.hh" +#include "G4RunManager.hh" +#include "G4Run.hh" +#include "G4AccumulableManager.hh" +#include "G4LogicalVolumeStore.hh" +#include "G4LogicalVolume.hh" +#include "G4UnitsTable.hh" +#include "G4SystemOfUnits.hh" + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1RunAction::B1RunAction() +: G4UserRunAction(), + fEdep(0.), + fEdep2(0.) +{ + // add new units for dose + // + const G4double milligray = 1.e-3*gray; + const G4double microgray = 1.e-6*gray; + const G4double nanogray = 1.e-9*gray; + const G4double picogray = 1.e-12*gray; + + new G4UnitDefinition("milligray", "milliGy" , "Dose", milligray); + new G4UnitDefinition("microgray", "microGy" , "Dose", microgray); + new G4UnitDefinition("nanogray" , "nanoGy" , "Dose", nanogray); + new G4UnitDefinition("picogray" , "picoGy" , "Dose", picogray); + + // Register accumulable to the accumulable manager + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->RegisterAccumulable(fEdep); + accumulableManager->RegisterAccumulable(fEdep2); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1RunAction::~B1RunAction() +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1RunAction::BeginOfRunAction(const G4Run*) +{ + bool sequential = (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM); + if (sequential) { + G4cout << "aaaa" << G4endl; + fptrackingAction = (B1TrackingAction*) G4RunManager::GetRunManager()->GetUserTrackingAction(); + G4cout << "bbbb" << G4endl; + } + + createHistogram(); + // inform the runManager to save random number seed + G4RunManager::GetRunManager()->SetRandomNumberStore(false); + + // reset accumulables to their initial values + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->Reset(); + +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1RunAction::EndOfRunAction(const G4Run* run) +{ + G4int nofEvents = run->GetNumberOfEvent(); + if (nofEvents == 0) return; + + // Merge accumulables + G4AccumulableManager* accumulableManager = G4AccumulableManager::Instance(); + accumulableManager->Merge(); + + // Compute dose = total energy deposit in a run and its variance + // + G4double edep = fEdep.GetValue(); + G4double edep2 = fEdep2.GetValue(); + + G4double rms = edep2 - edep*edep/nofEvents; + if (rms > 0.) rms = std::sqrt(rms); else rms = 0.; + + const B1DetectorConstruction* detectorConstruction + = static_cast + (G4RunManager::GetRunManager()->GetUserDetectorConstruction()); + G4double mass = detectorConstruction->GetScoringVolume()->GetMass(); + G4double dose = edep/mass; + G4double rmsDose = rms/mass; + + // Run conditions + // note: There is no primary generator action object for "master" + // run manager for multi-threaded mode. + const B1PrimaryGeneratorAction* generatorAction + = static_cast + (G4RunManager::GetRunManager()->GetUserPrimaryGeneratorAction()); + G4String runCondition; + if (generatorAction) + { + const G4ParticleGun* particleGun = generatorAction->GetParticleGun(); + runCondition += particleGun->GetParticleDefinition()->GetParticleName(); + runCondition += " of "; + G4double particleEnergy = particleGun->GetParticleEnergy(); + runCondition += G4BestUnit(particleEnergy,"Energy"); + } + + // Print + // + + if (IsMaster()) { + G4cout + << G4endl + << "--------------------End of Global Run-----------------------"; + } + else { + G4cout + << G4endl + << "--------------------End of Local Run------------------------"; + } + + G4cout + << G4endl + << " The run consists of " << nofEvents << " "<< runCondition + << G4endl + << " Cumulated dose per run, in scoring volume : " + << G4BestUnit(dose,"Dose") << " rms = " << G4BestUnit(rmsDose,"Dose") + << G4endl + << "------------------------------------------------------------" + << G4endl + << G4endl; + + WriteHistogram(); + delete G4AnalysisManager::Instance(); + //printando partículas criadas + std::map& + particlesCreatedInWorld = fptrackingAction->GetNParticlesCreatedInWorld(); + + G4cout << "Partículas criadas dentro do mundo :" << G4endl; + + PrintParticles(particlesCreatedInWorld); + + G4cout << "_______________________" << G4endl; + + std::map& + particlesCreatedOutsideWorld = fptrackingAction->GetNParticlesCreatedOutsideWorld(); + + G4cout << "Prtículas criadas fora do mundo :" << G4endl; + + PrintParticles(particlesCreatedOutsideWorld); + + //limpa dados + fptrackingAction->clearParticles(); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1RunAction::AddEdep(G4double edep) +{ + fEdep += edep; + fEdep2 += edep*edep; +} + +void B1RunAction::createHistogram() +{ + //Avisa que está criando + G4cout << "CRIANDO HISTOGRAMAS" << G4endl; + G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); + //mostrando o tipo + G4cout << "utilizando " << analysisManager->GetType() << "Analysis Manager" << G4endl; + //setando o verbose + analysisManager->SetVerboseLevel(1); + + //Abrindo arquivo de saída + G4String filename = "air_shower"; + analysisManager->OpenFile(filename); + + //criando ntuples + analysisManager->CreateNtuple("air_shower", "physics"); + analysisManager->CreateNtupleDColumn("proton"); + analysisManager->CreateNtupleDColumn("e_plus"); + analysisManager->CreateNtupleDColumn("e_minus"); + analysisManager->CreateNtupleDColumn("mu_minus"); + analysisManager->CreateNtupleDColumn("mu_plus"); + analysisManager->CreateNtupleDColumn("pi_plus"); + analysisManager->CreateNtupleDColumn("pi_minus"); + analysisManager->CreateNtupleDColumn("gamma"); + analysisManager->CreateNtupleDColumn("z"); + analysisManager->FinishNtuple(); + +} + +void B1RunAction::WriteHistogram() +{ + G4cout<<"ESCREVENDO"<Write(); + analysisManager->CloseFile(); + +} + +//função para printar partículas +void B1RunAction::PrintParticles(std::map& container) { + std::map::iterator it; + G4cout << "aa" << G4endl; + for(it = container.begin() ;it != container.end(); it ++) + { + G4cout << "N " << it->first->GetParticleName() << " : " << it->second << G4endl; + } +} + + + + + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1SteppingAction.cc b/src/B1SteppingAction.cc new file mode 100644 index 0000000..73e74c3 --- /dev/null +++ b/src/B1SteppingAction.cc @@ -0,0 +1,132 @@ +// +// ******************************************************************** +// * License and Disclaimer * +// * * +// * The Geant4 software is copyright of the Copyright Holders of * +// * the Geant4 Collaboration. It is provided under the terms and * +// * conditions of the Geant4 Software License, included in the file * +// * LICENSE and available at http://cern.ch/geant4/license . These * +// * include a list of copyright holders. * +// * * +// * Neither the authors of this software system, nor their employing * +// * institutes,nor the agencies providing financial support for this * +// * work make any representation or warranty, express or implied, * +// * regarding this software system or assume any liability for its * +// * use. Please see the license in the file LICENSE and URL above * +// * for the full disclaimer and the limitation of liability. * +// * * +// * This code implementation is the result of the scientific and * +// * technical work of the GEANT4 collaboration. * +// * By using, copying, modifying or distributing the software (or * +// * any work based on the software) you agree to acknowledge its * +// * use in resulting scientific publications, and indicate your * +// * acceptance of all terms of the Geant4 Software license. * +// ******************************************************************** +// +// +/// \file B1SteppingAction.cc +/// \brief Implementation of the B1SteppingAction class + +#include "B1SteppingAction.hh" +#include "B1EventAction.hh" +#include "B1DetectorConstruction.hh" +#include "B1Analysis.hh" + +#include "G4Step.hh" +#include "G4SystemOfUnits.hh" +#include "G4Event.hh" +#include "G4RunManager.hh" +#include "G4LogicalVolume.hh" + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1SteppingAction::B1SteppingAction(B1EventAction* eventAction) +: G4UserSteppingAction(), + fEventAction(eventAction), + fScoringVolume(0) +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +B1SteppingAction::~B1SteppingAction() +{} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + +void B1SteppingAction::UserSteppingAction(const G4Step* step) +{ + G4double e_minus, p, pi_p, pi_m, mu_p, mu_m, e_p, neutron, gamma = 0; + if (!fScoringVolume) { + const B1DetectorConstruction* detectorConstruction + = static_cast + (G4RunManager::GetRunManager()->GetUserDetectorConstruction()); + fScoringVolume = detectorConstruction->GetScoringVolume(); + } + + + // get volume of the current step + G4LogicalVolume* volume + = step->GetPreStepPoint()->GetTouchableHandle() + ->GetVolume()->GetLogicalVolume(); + + + + // check if we are in scoring volume + if (volume != fScoringVolume) { + G4cout << "AAAAAA" << G4endl; + return; + } + + //ATENÇÃO - Comments dentro dos else-if -> para histograma de particlas x z (BUG no Z=0 e resultado duvidoso -- MELHORAR) + + G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); + //collect particle for each step + G4String particle = step->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName(); + G4double z =step->GetPreStepPoint()->GetPosition().z()/meter; + //G4double x =step->GetPreStepPoint()->GetPosition().x()/meter;// se quiser plotar com x e y + //G4double y =step->GetPreStepPoint()->GetPosition().y()/meter; + if (particle == "e-") { + e_minus = 1; + //analysisManager->FillNtupleDColumn(2, z); + } else if (particle == "e+") { + e_p = 1; + //analysisManager->FillNtupleDColumn(1, z); + }else if (particle == "proton") { + p = 1; + //analysisManager->FillNtupleDColumn(0, z); + }else if (particle == "pi-") { + pi_m = 1; + //analysisManager->FillNtupleDColumn(6, z); + }else if (particle == "pi+") { + pi_p = 1; + //analysisManager->FillNtupleDColumn(5, z); + }else if (particle == "mu-") { + mu_m = 1; + //analysisManager->FillNtupleDColumn(3, z); + }else if (particle == "mu+") { + mu_p = 1; + //analysisManager->FillNtupleDColumn(4, z); + }else if (particle == "gamma") { + gamma = 1; + //analysisManager->FillNtupleDColumn(7, z); + } + //Retire esse comment para histograma que leva em conta o numero de vezes que a particula foi identificado no evento. -> Por enquanto o mais confiável. + /* + analysisManager->FillNtupleDColumn(0, p); + analysisManager->FillNtupleDColumn(1, e_p); + analysisManager->FillNtupleDColumn(2, e_minus); + analysisManager->FillNtupleDColumn(3, mu_m); + analysisManager->FillNtupleDColumn(4, mu_p); + analysisManager->FillNtupleDColumn(5, pi_p); + analysisManager->FillNtupleDColumn(6, pi_m); + analysisManager->FillNtupleDColumn(7, gamma); + analysisManager->FillNtupleDColumn(8, z); + + /**/ + analysisManager->AddNtupleRow(); + // collect energy deposited in this step + G4double edepStep = step->GetTotalEnergyDeposit(); + fEventAction->AddEdep(edepStep); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/src/B1TrackingAction.cc b/src/B1TrackingAction.cc new file mode 100644 index 0000000..8462401 --- /dev/null +++ b/src/B1TrackingAction.cc @@ -0,0 +1,62 @@ + +#include "B1TrackingAction.hh" +#include "G4Track.hh" +#include "G4VSolid.hh" +#include "G4Region.hh" +#include "B1DetectorConstruction.hh" + +using namespace std; + +//implementação do construtor +B1TrackingAction::B1TrackingAction(B1DetectorConstruction* world) { + fworld = world; + fworldRegion = 0; + worldVolume = 0; +} + +//implementação do destrutor +B1TrackingAction::~B1TrackingAction() { + fworld = 0; + fworldRegion = 0; + worldVolume = 0; +} + +//implementação da função(instância da classe B1TrackingAction) PreUserTrackingAction +void B1TrackingAction::PreUserTrackingAction(const G4Track* track) { + //pega o nome da partícula relacionado ao seu TrackID. + particle_def = track->GetParticleDefinition(); + //const G4String& particle_name = particle_def->GetParticleName(); + //se a variável fworldRegio não possui a regiao do mundo, fazer isso + if(fworldRegion == 0) { + worldVolume= fworld->GetScoringVolume(); + fworldRegion = worldVolume->GetRegion(); + } + + + const G4ThreeVector& position = track->GetPosition(); + int N = fworldRegion->GetNumberOfRootVolumes(); + std::vector::iterator it_logicalVolumeInRegion = fworldRegion->GetRootLogicalVolumeIterator(); + bool inside_world = false; + //checar se está dentro do mundo + for(int i = 0; i < N ; i++, it_logicalVolumeInRegion++) + { + EInside test_status = (*it_logicalVolumeInRegion)->GetSolid()->Inside(position) ; + if(test_status == kInside) + { + inside_world = true; + + break; + } + } + //coloca eles no std::map + if (inside_world) { + fNParticleInWorld[particle_def]++; + } else { + fNParticleOutsideWorld[particle_def]++; + } + +} +void B1TrackingAction::clearParticles() { + fNParticleInWorld.clear(); + fNParticleOutsideWorld.clear(); +} -- 2.22.0