Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • mirandal/mitesis
1 result
Show changes
Commits on Source (20)
Showing
with 1015 additions and 72 deletions
#!/bin/bash
declare -a valores=(0 5 10 15 20 25 30 35 40 45)
for i in "${!valores[@]}"
do
h="${valores[$i]}"
#echo "$i"
mkdir humedadc7-1kev-$h
cd humedadc7-1kev-$h
cmake -DGeant4_DIR6=/opt/geant4/lib/Geant4-10.3.3/ ../"direccion del directorio"/Simulacion_neutrones_monoenergeticos; make -j2
./wcd -m input.in
cd
#sleep 30
cd humedad6/codigo/src
Archivo="PrimaryGeneratorAction.cc"
#echo "$i"
#"El índice es $i y el valor es $h"
# para realizar las modificaciones necesarias
echo "e" | vim -c "44 + $i" -c "normal i//" -c "45 + $i" -c "normal 2|xxx" -c "wq" "$Archivo"
#echo "$i"
cd
done
echo "terminado"
import random
import numpy as np
from scipy.stats import skewnorm
# Neutrones rapidos
# Abrir un archivo para escritura
with open('salidasimu.shw', 'w') as f:
# Escribir los nombres de las columnas en la primera línea
f.write('#CorsikaID px py pz x y z shower_id prm_id prm_energy prm_theta prm_phi\n')
a = 1.1 # Pendiente deseada
total_samples = 1000000 # El número de muestras que deseas generar
# Genera datos uniformemente distribuidos en el rango deseado
data_uniform = np.random.uniform(low=1e-3, high=1e5, size= int(total_samples*0.3))# energia neutrones 1e-3eV- 1e5eV
# Aplicar la transformación logarítmica inversa
data_pendiente_positiva = np.exp(np.log(data_uniform) / a)
data_lognormal2 = np.random.lognormal(mean=15.7, sigma=0.9, size= int(total_samples*0.3)) #energia neutrones 1e5eV- 1e7eV
data_lognormal3 = np.random.lognormal(mean=19.5, sigma=0.9, size= int(total_samples*0.4)) #energia neutrones 1e7eV- +
energia_flujo = np.concatenate([data_pendiente_positiva, data_lognormal2, data_lognormal3])
# Mezcla los datos de forma aleatoria
np.random.shuffle(energia_flujo)
m = 0.939 # Masa del neutrón en GeV/c^2
prim_phi = np.random.uniform(low=-180, high=180, size=total_samples) # Aleatorio para el ángulo azimutal
prim_theta = np.random.uniform(low=0, high=90, size=total_samples) # Aleatorio para el ángulo cenital
p = np.sqrt(2 * m * energia_flujo/1e8) # Calculamos el momento
# Calculamos las componentes del momento
px = p * np.sin(np.radians(prim_theta)) * np.cos(np.radians(prim_phi))
py = p * np.sin(np.radians(prim_theta)) * np.sin(np.radians(prim_phi))
pz = p * np.cos(np.radians(prim_theta))
# Escribir los datos en el archivo (mismo orden de un archivo de dalida de CORSIKA)
for i in range(total_samples):
# Escribir el CorsicaID
f.write('13 ')
num_format = "{:+013.6e}"
f.write(num_format.format(px[i]) + ' ')
f.write(num_format.format(py[i]) + ' ')
f.write(num_format.format(abs(pz[i])) + ' ')
# Escribir valores aleatorios para x, y, z
f.write(num_format.format(random.normalvariate(0, 25)) + ' ')
f.write(num_format.format(random.normalvariate(0, 25)) + ' ')
f.write(num_format.format(1) + ' ')
# Escribir valores aleatorios para shower_id, prm_id
f.write("{:03d}".format(random.randint(0, 100)) + ' ')
f.write("{:03d}".format(random.randint(0, 100)) + ' ')
# Escribir valores aleatorios para prm_energy
f.write(num_format.format(energia_flujo[i]) + ' ')
# Escribir los ángulos prim_theta y prim_phi
f.write("{:+010.6f}".format(prim_theta[i]) + ' ')
f.write("{:+011.6f}".format(prim_phi[i]) + '\n')
File added
# Mitesis
<<<<<<< README.md
# Proyecto de Simulación de Interacción de Neutrones con Suelo
Este repositorio contiene dos carpetas principales que abordan las simulaciones realizadas para la interacción de neutrones con suelo húmedo.
## Getting started
## 1. Simulación de Flujo de Neutrones Monoenergeticos
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
La carpeta `Simular_flujo_de_neutrones` contiene archivos para simular la interacción de neutrones con suelo húmedo, contándolos a través de 6 anillos concéntricos de 2 metros, con radios de 10, 25, 45, 95, 145 y 195 metros. El sistema físico consta de un bloque de suelo de 800,000 m² dividido en tres partes. Durante las simulaciones, se varía únicamente la humedad de la primera capa. En la ubicación `Simular_flujo_de_neutrones/src/`, se encuentra el archivo `PrimaryGeneratorAction.cc`, que define la inyección de neutrones, su dirección y energía.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
Para las simulaciones, se inyectaron 10,000 neutrones primarios en ángulos cenitales (θ) que variaban desde 0 grados hasta 45 grados, con incrementos de 5 grados. Asimismo, los neutrones son monoenergéticos en el rango de 1 eV a 10 MeV, aumentando de a 1 década.
## Add your files
La salida del código es un archivo .root que contiene 6 histogramas, uno para cada contador. Cada barra en estos histogramas representa el número de partículas que llegan a cada contador. El orden de las partículas en los histogramas es el siguiente:
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
1. Electrones y positrones
2. Gammas
3. Protones
4. Neutrones
```
cd existing_repo
git remote add origin https://gitmilab.redclara.net/mirandal/mitesis.git
git branch -M main
git push -uf origin main
```
Es posible realizar un seguimiento por paso de los siguientes parámetros: "ID", "X", "Y", "Z".
: ID de la partícula y posición de la partícula.
## Integrate with your tools
Para imprimir lo anterior en pantalla, es necesario descomentar las líneas 130 a 133 en el archivo `PrimaryGeneratorAction.cc`. Al realizar esta acción, se mostrará en la pantalla el ID del neutrón y su posición en cada paso de la simulación.
- [ ] [Set up project integrations](https://gitmilab.redclara.net/mirandal/mitesis/-/settings/integrations)
Lo anterior se realiza descomentando las lineas 130 - 133, realizando esto se imprime en la pantalla el ID del neutron y su posicion en cada step.
## Collaborate with your team
## 2. Simulación de un Flujo de Neutrones
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
En la carpeta `Simular_neutrones_monoenergeticos`, se encuentran los archivos necesarios para simular la interacción de neutrones con suelo húmedo. El sistema físico consiste en un bloque de suelo de 400,000 m² y un contador en forma de cubo con arista de 2 metros, elevado a 3 metros sobre el suelo. Las simulaciones implican cambios en la humedad del bloque de suelo, y la modificación del flujo de neutrones se logra mediante el archivo `salidasimu.shw.bz2` en la carpeta `flujos`.
## Test and Deploy
La salida del codigo en un archivo .root donde se generan 2 histogramas.
Use the built-in continuous integration in GitLab.
1. Numero de neutrones que llegan al contador
2. Energia de los neutrones que llegan al contador
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
Es posible realizar un seguimiento por paso de los siguientes parámetros: "N", "ID", "X", "Y", "Z", "PX", "PY", "PZ", "THETA", "PHY".
: ID de la partícula, posición de la partícula, momento de la partícula, y ángulos cenital y azimutal de la partícula.
# Editing this README
Para imprimir lo anterior en pantalla, es necesario descomentar las líneas 167 a 176 en el archivo `PrimaryGeneratorAction.cc`. Al realizar esta acción, se mostrará en la pantalla el numero del evento, el ID del neutrón, su posición, su momento y los angulos cenital y asumutal en cada paso de la simulación.
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Archivos Adicionales
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
- En la carpeta `flujos`, el archivo `salidasimu.shw.bz2` contiene el flujo de neutrones sobre Bucaramanga (956 m s.n.m) se debe rehubicar en la carpeta `Simular_flujo_de_neutrones`.
- En la carpeta `flujos`, el script `flujo_artificial.py` genera un flujo artificial de neutrones con las características deseadas.
- En la carpeta `flujos`, el script `auto_simulaciones.sh` automatiza las simulaciones de un flujo monoenergético de neutrones. Si se desea utilizar, es necesario cambiar la energía de los neutrones antes de compilar este código.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
project(wcd)
#----------------------------------------------------------------------------
# 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
#
include(${Geant4_USE_FILE})
#----------------------------------------------------------------------------
# Locate sources and headers for this project
#
include_directories(${PROJECT_SOURCE_DIR}/include
${Geant4_INCLUDE_DIR})
file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
#----------------------------------------------------------------------------
# Add the executable, and link it to the Geant4 libraries
#
add_executable(wcd wcd.cc ${sources} ${headers})
target_link_libraries(wcd ${Geant4_LIBRARIES} )
#----------------------------------------------------------------------------
# Copy all scripts to the build directory, i.e. the directory in which we
# build OpNovice. This is so that we can run the executable directly because it
# relies on these scripts being in the current working directory.
#
set(wcd_SCRIPTS
init_vis.mac
input.in
optPhoton.mac
gui.mac
vis.mac
loop.sh
salidasimu.shw.bz2
)
foreach(_script ${wcd_SCRIPTS})
configure_file(
${PROJECT_SOURCE_DIR}/${_script}
${PROJECT_BINARY_DIR}/${_script}
COPYONLY
)
endforeach()
#----------------------------------------------------------------------------
# For internal Geant4 use - but has no effect if you build this
# example standalone
#
add_custom_target(wcd-pmt-2 DEPENDS wcd)
#----------------------------------------------------------------------------
# Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
#
install(TARGETS wcd DESTINATION bin)
# $Id: GNUmakefile 68752 2013-04-05 10:23:47Z gcosmo $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := wcd
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
visclean:
rm -f g4*.prim g4*.eps g4*.wrl
rm -f .DAWN_*
# Archivos de la Tesis
Para compilar el código en una carpeta diferente, utiliza el siguiente comando:
```
cmake -DGeant4_DIR=/opt/geant4/lib/Geant4-10.3.3/ ../"direccion del directorio"/Simulacion_flujo_de_neutrones; make -j2
```
Para ejecutar el código, utiliza el siguiente comando:
```
./wcd -m input.in > archivo.txt
```
Si deseas cambiar la humedad, accede a la siguiente dirección: `/"direccion del directorio"/Simulacion_flujo_de_neutrones/src/`. Luego, ingresa al archivo `DetectorConstruction.cc` con el editor de texto de tu preferencia.
En la línea 103, escribe:
- `sueloBS` (0% de humedad),
- `sueloBH5` (5% de humedad),
- `sueloBH15` (15% de humedad),
- `sueloBH25` (25% de humedad),
- `sueloBH30` (30% de humedad).
#
# This file permits to customize, with commands,
# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
# It has no effect with G4UIterminal.
#
# Process vis.mac (and draw geometry)
#
/control/execute vis.mac
#
# File menu :
/gui/addMenu file File
/gui/addButton file Quit exit
#
# Run menu :
/gui/addMenu run Run
/gui/addButton run "beamOn 1" "/run/beamOn 1"
#/gui/addButton run run1 "/control/execute run1.mac"
#/gui/addButton run run2 "/control/execute run2.mac"
#
# Gun menu :
/gui/addMenu gun Gun
/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
/gui/addButton gun "1 GeV" "/gun/energy 1 GeV"
/gui/addButton gun "10 GeV" "/gun/energy 10 GeV"
/gui/addButton gun "e-" "/gun/particle e-"
/gui/addButton gun "pi0" "/gun/particle pi0"
/gui/addButton gun "pi+" "/gun/particle pi+"
/gui/addButton gun "neutron" "/gun/particle neutron"
/gui/addButton gun "proton" "/gun/particle proton"
#
# Field menu :
#/gui/addMenu field Field
#/gui/addButton field "off" "/B2/det/setField 0.2 tesla"
#/gui/addButton field "0.2 tesla" "/B2/det/setField 0.2 tesla"
#/gui/addButton field "2.0 tesla" "/B2/det/setField 2.0 tesla"
#
# Viewer menu :
/gui/addMenu viewer Viewer
/gui/addButton viewer "Set style surface" "/vis/viewer/set/style surface"
/gui/addButton viewer "Set style wireframe" "/vis/viewer/set/style wireframe"
/gui/addButton viewer "Refresh viewer" "/vis/viewer/refresh"
/gui/addButton viewer "Update viewer (interaction or end-of-file)" "/vis/viewer/update"
/gui/addButton viewer "Flush viewer (= refresh + update)" "/vis/viewer/flush"
/gui/addButton viewer "Update scene" "/vis/scene/notifyHandlers"
#
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: ActionInitialization.hh 68058 2013-03-13 14:47:43Z gcosmo $
//
/// \file ActionInitialization.hh
/// \brief Definition of the ActionInitialization class
#ifndef ActionInitialization_h
#define ActionInitialization_h 1
#include "G4VUserActionInitialization.hh"
class B4DetectorConstruction;
/// Action initialization class.
///
class ActionInitialization : public G4VUserActionInitialization
{
public:
ActionInitialization();
virtual ~ActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
virtual G4VSteppingVerbose* InitializeSteppingVerbose() const;
};
#endif
#ifndef DetectorConstruction_h
#define DetectorConstruction_h 1
// Geant4 Libraries
//
#include "globals.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Cache.hh"
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4Ellipsoid.hh"
#include "G4Tubs.hh"
#include "G4OpticalSurface.hh"
// Local Libraries
//
//#include "PMTSD.hh"
class G4LogicalVolume;
class DetectorConstruction : public G4VUserDetectorConstruction
{
public:
DetectorConstruction();
virtual ~DetectorConstruction();
public:
virtual G4VPhysicalVolume* Construct();
/* G4VPhysicalVolume* GetWaterVolume() const
{
return fwaterVolume;
}*/
private:
};
#endif
#ifndef EventAction_h
#define EventAction_h 1
// Geant libraries
//
#include "G4UserEventAction.hh"
#include "globals.hh"
class RunAction;
class EventAction : public G4UserEventAction
{
public:
EventAction(RunAction* runAction);
virtual ~EventAction();
virtual void BeginOfEventAction(const G4Event* event);
//virtual void EndOfEventAction(const G4Event* event);
void AddEdep(G4double edep)
{
fEdep += edep;
}
private:
RunAction* fRunAction;
G4double fEdep;
};
#endif
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: ExtraPhysics.hh 68752 2013-04-05 10:23:47Z gcosmo $
//
/// \file optical//include/ExtraPhysics.hh
/// \brief Definition of the ExtraPhysics class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef ExtraPhysics_h
#define ExtraPhysics_h 1
#include "globals.hh"
#include "G4VPhysicsConstructor.hh"
class ExtraPhysics : public G4VPhysicsConstructor
{
public:
ExtraPhysics();
virtual ~ExtraPhysics();
virtual void ConstructParticle();
virtual void ConstructProcess();
};
#endif
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: OpticalPhysics.hh 69561 2013-05-08 12:25:56Z gcosmo $
//
/// \file optical//include/OpticalPhysics.hh
/// \brief Definition of the OpticalPhysics class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef OpticalPhysics_h
#define OpticalPhysics_h 1
#include "globals.hh"
#include "G4OpWLS.hh"
#include "G4Cerenkov.hh"
#include "G4Scintillation.hh"
#include "G4OpMieHG.hh"
#include "G4OpRayleigh.hh"
#include "G4OpAbsorption.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4VPhysicsConstructor.hh"
class OpticalPhysics : public G4VPhysicsConstructor
{
public:
OpticalPhysics(G4bool toggle=true);
virtual ~OpticalPhysics();
virtual void ConstructParticle();
virtual void ConstructProcess();
G4OpWLS* GetProcess() {return fProcess;}
G4Cerenkov* GetCerenkovProcess() {return fCerenkovProcess;}
G4Scintillation* GetScintillationProcess() {return fScintProcess;}
G4OpAbsorption* GetAbsorptionProcess() {return fAbsorptionProcess;}
G4OpRayleigh* GetRayleighScatteringProcess() {return fRayleighScattering;}
G4OpMieHG* GetMieHGScatteringProcess() {return fMieHGScatteringProcess;}
G4OpBoundaryProcess* GetBoundaryProcess() { return fBoundaryProcess;}
void SetNbOfPhotonsCerenkov(G4int);
private:
G4OpWLS* fProcess;
G4Cerenkov* fCerenkovProcess;
G4Scintillation* fScintProcess;
G4OpAbsorption* fAbsorptionProcess;
G4OpRayleigh* fRayleighScattering;
G4OpMieHG* fMieHGScatteringProcess;
G4OpBoundaryProcess* fBoundaryProcess;
G4bool fAbsorptionOn;
};
#endif
#ifndef PMTHit_h
#define PMTHit_h 1
// Geant4 Libraries
//
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "tls.hh"
// Local Libraries
//
class G4VTouchable;
class PMTHit //: public G4VHit
{
public:
PMTHit();
virtual ~PMTHit();
G4int askDetected(G4double);
void reset();
private:
void GetWavelength(G4double);
G4double waveLength;
};
#endif
#ifndef PMTSD_h
#define PMTSD_h 1
// Geant4 Libraries
//
//#include "G4DataVector.hh"
//#include "G4VSensitiveDetector.hh"
// Local Libraries
//
#include "PMTHit.hh"
// C++ Libraries
//
//#include <vector>
class G4Step;
class G4HCofThisEvent;
class PMTSD //: public G4VSensitiveDetector
{
public:
PMTSD();//G4String name);
virtual ~PMTSD();
virtual G4int ProcessHits(const G4Step* aStep);
void resetPMTSD();
G4double getPhoDetected()
{
return phoDetec;
}
private:
PMTHit *phoHit;
G4int phoDetec;
G4double kinEnergy;
};
#endif
#ifndef PhysicsList_h
#define PhysicsList_h 1
// Geant4 Libraries
//
#include "globals.hh"
#include "G4VModularPhysicsList.hh"
class G4VPhysicsConstructor;
class PhysicsListMessenger;
class StepMax;
class OpticalPhysics;
class PhysicsList: public G4VModularPhysicsList
{
public:
PhysicsList(G4String);
virtual ~PhysicsList();
void SetCuts();
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForPositron(G4double);
void SetStepMax(G4double);
StepMax* GetStepMaxProcess();
void AddStepMax();
/// Remove specific physics from physics list.
void RemoveFromPhysicsList(const G4String&);
/// Make sure that the physics list is empty.
void ClearPhysics();
virtual void ConstructParticle();
virtual void ConstructProcess();
// Turn on or off the absorption process
void SetAbsorption(G4bool);
void SetNbOfPhotonsCerenkov(G4int);
void SetVerbose(G4int);
private:
G4double fCutForGamma;
G4double fCutForElectron;
G4double fCutForPositron;
StepMax* fStepMaxProcess;
OpticalPhysics* fOpticalPhysics;
PhysicsListMessenger* fMessenger;
G4bool fAbsorptionOn;
G4VMPLData::G4PhysConstVectorData* fPhysicsVector;
};
#endif
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
// $Id: PhysicsListMessenger.hh 69561 2013-05-08 12:25:56Z gcosmo $
//
/// \file optical//include/PhysicsListMessenger.hh
/// \brief Definition of the PhysicsListMessenger class
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef PhysicsListMessenger_h
#define PhysicsListMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4DecayTable.hh"
#include "G4VDecayChannel.hh"
class PhysicsList;
class G4UIdirectory;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithoutParameter;
class G4UIcmdWithADoubleAndUnit;
/// Provide control of the physics list and cut parameters
class PhysicsListMessenger : public G4UImessenger
{
public:
PhysicsListMessenger(PhysicsList* );
virtual ~PhysicsListMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
PhysicsList* fPhysicsList;
G4UIdirectory* fDirectory;
G4UIdirectory* fDecayDirectory;
G4UIcmdWithABool* fSetAbsorptionCMD;
G4UIcmdWithAnInteger* fVerboseCmd;
G4UIcmdWithAnInteger* fCerenkovCmd;
G4UIcmdWithADoubleAndUnit* fGammaCutCMD;
G4UIcmdWithADoubleAndUnit* fElectCutCMD;
G4UIcmdWithADoubleAndUnit* fPosCutCMD;
G4UIcmdWithADoubleAndUnit* fAllCutCMD;
G4UIcmdWithADoubleAndUnit* fStepMaxCMD;
G4UIcmdWithAString* fRemovePhysicsCMD;
G4UIcmdWithoutParameter* fClearPhysicsCMD;
G4UIcmdWithoutParameter* fListCMD;
G4UIcmdWithoutParameter* fPienuCMD;
G4UIcmdWithoutParameter* fPimunuCMD;
};
#endif
//
// ********************************************************************
// * 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 /include/PrimaryGeneratorAction.hh
/// \brief Definition of the PrimaryGeneratorAction class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorAction_h
#define PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4ParticleGun.hh"
#include "PrimarySpectrum.hh"
class G4ParticleGun;
class G4Event;
class PrimaryGeneratorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
PrimaryGeneratorAction();
virtual ~PrimaryGeneratorAction();
public:
virtual void GeneratePrimaries(G4Event*);
const G4ParticleGun* GetParticleGun() const
{
return fParticleGun;
}
void SetOptPhotonPolar();
void SetOptPhotonPolar(G4double);
private:
G4double enerPart;
G4ParticleGun* fParticleGun;
PrimarySpectrum parPosDir;
PrimaryGeneratorMessenger* fGunMessenger;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif /*PrimaryGeneratorAction_h*/
//
// ********************************************************************
// * 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 /include/PrimaryGeneratorMessenger.hh
/// \brief Definition of the PrimaryGeneratorMessenger class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#ifndef PrimaryGeneratorMessenger_h
#define PrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class PrimaryGeneratorAction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class PrimaryGeneratorMessenger: public G4UImessenger
{
public:
PrimaryGeneratorMessenger(PrimaryGeneratorAction* );
virtual ~PrimaryGeneratorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
PrimaryGeneratorAction* fAction;
G4UIdirectory* fGunDir;
G4UIcmdWithADoubleAndUnit* fPolarCmd;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
#ifndef PrimarySpectrum_h
#define PrimarySpectrum_h 1
//Geant libraries
//
#include "globals.hh"
#include "G4ThreeVector.hh"
// c++ libraries
//
#include <math.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <stdlib.h>
#include <string>
#include <iomanip>
class PrimarySpectrumMessenger;
class PrimarySpectrum
{
public:
PrimarySpectrum();
~PrimarySpectrum();
void primaryPosition();
G4ThreeVector particlePosition;
G4ThreeVector particleDirection;
G4String parId;
void primaryMomento();
std::string inputFile; //[] = "tmpMachin24h.shw.bz2";
int openFile(std::string name);
private:
G4double pi;
G4double Ro;
G4double initx;
G4double inity;
G4double initz;
float r;
float theta;
G4int crkId;
G4double px;
G4double py;
G4double pz;
G4double x;
G4double y;
G4double z;
G4int shwId;
G4int prmId;
G4double prmEner;
G4double prmThe;
G4double prmPhi;
FILE *inFile = NULL;
PrimarySpectrumMessenger* fSpectMessenger;
};
#endif