Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# --------------------------------------------------------------
|
||||
# $Id: GNUmakefile,v 1.3 2008/01/25 20:49:23 sincerti Exp $
|
||||
# --------------------------------------------------------------
|
||||
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
|
||||
# --------------------------------------------------------------
|
||||
|
||||
name := Nanobeam
|
||||
|
||||
G4TARGET := $(name)
|
||||
G4EXLIB := true
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: lib bin
|
||||
|
||||
include $(G4INSTALL)/config/binmake.gmk
|
||||
@@ -0,0 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
$Id: History,v 1.4 2008/06/21 19:28:03 sincerti Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - Nanobeam example
|
||||
=========================================================
|
||||
|
||||
Package History file
|
||||
--------------------
|
||||
|
||||
21 June 2008 - tag nanobeam-V09-01-11 - S. Incerti
|
||||
- several tags to try to resolve conflict with system testing
|
||||
|
||||
25 January 2008 - tag nanobeam-V09-01-01 - S. Incerti
|
||||
- first version of nanobeam example committed
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: Nanobeam.cc,v 1.6 2008/06/21 19:28:03 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIterminal.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4UItcsh.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PhysicsList.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "RunAction.hh"
|
||||
#include "EventAction.hh"
|
||||
#include "TrackingAction.hh"
|
||||
#include "SteppingAction.hh"
|
||||
#include "SteppingVerbose.hh"
|
||||
|
||||
int main(int argc,char** argv) {
|
||||
|
||||
// Choose the Random engine
|
||||
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
|
||||
|
||||
// Verbose output class
|
||||
G4VSteppingVerbose::SetInstance(new SteppingVerbose);
|
||||
|
||||
// Construct the default run manager
|
||||
G4RunManager * runManager = new G4RunManager;
|
||||
|
||||
// Set mandatory initialization classes
|
||||
DetectorConstruction* detector = new DetectorConstruction;
|
||||
runManager->SetUserInitialization(detector);
|
||||
runManager->SetUserInitialization(new PhysicsList);
|
||||
|
||||
runManager->SetUserAction(new PrimaryGeneratorAction(detector));
|
||||
|
||||
// Set user action classes
|
||||
RunAction* RunAct = new RunAction(detector);
|
||||
PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
|
||||
|
||||
runManager->SetUserAction(RunAct);
|
||||
runManager->SetUserAction(new EventAction(RunAct));
|
||||
runManager->SetUserAction(new TrackingAction(RunAct));
|
||||
runManager->SetUserAction(new SteppingAction(RunAct,detector,primary));
|
||||
|
||||
// Initialize G4 kernel
|
||||
runManager->Initialize();
|
||||
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UI = G4UImanager::GetUIpointer();
|
||||
|
||||
// Cleaning result files
|
||||
system ("rm -rf ./results/x.txt");
|
||||
system ("rm -rf ./results/y.txt");
|
||||
system ("rm -rf ./results/theta.txt");
|
||||
system ("rm -rf ./results/phi.txt");
|
||||
system ("rm -rf ./results/image.txt");
|
||||
system ("rm -rf ./results/matrix.txt");
|
||||
system ("rm -rf ./results/profile.txt");
|
||||
system ("rm -rf ./results/grid.txt");
|
||||
|
||||
if (argc==1) // Define UI session for interactive mode.
|
||||
{
|
||||
// G4UIterminal is a (dumb) terminal.
|
||||
G4UIsession * session = new G4UIterminal;
|
||||
UI->ApplyCommand("/control/execute default.mac");
|
||||
session->SessionStart();
|
||||
delete session;
|
||||
}
|
||||
|
||||
else // Batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UI->ApplyCommand(command+fileName);
|
||||
}
|
||||
|
||||
|
||||
// test
|
||||
/*
|
||||
if (argc!=1)
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UI->ApplyCommand(command+fileName);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
G4UIsession* session = 0;
|
||||
|
||||
#ifdef G4UI_USE_TCSH
|
||||
session = new G4UIterminal(new G4UItcsh);
|
||||
#else
|
||||
session = new G4UIterminal();
|
||||
#endif
|
||||
|
||||
UI->ApplyCommand( "/control/execute default.mac");
|
||||
session->SessionStart();
|
||||
delete session;
|
||||
}
|
||||
|
||||
*/
|
||||
// end test
|
||||
|
||||
delete runManager;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Executable
+27226
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,176 @@
|
||||
-------------------------------------------------------------------
|
||||
$Id: README,v 1.8 2008/06/02 10:00:40 sincerti Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - Nanobeam example
|
||||
=========================================================
|
||||
|
||||
README file
|
||||
----------------------
|
||||
|
||||
CORRESPONDING AUTHOR
|
||||
|
||||
S. Incerti (a, *) et al.
|
||||
a. Centre d'Etudes Nucleaires de Bordeaux-Gradignan
|
||||
(CENBG), IN2P3 / CNRS / Bordeaux 1 University, 33175 Gradignan, France
|
||||
* e-mail:incerti@cenbg.in2p3.fr
|
||||
|
||||
Last modified by S. Incerti, 10/04/2008
|
||||
|
||||
---->1. INTRODUCTION.
|
||||
|
||||
The nanobeam example simulates the beam optics of the nanobeam line installed
|
||||
on the AIFIRA electrostatic accelerator facility located at CENBG,
|
||||
Bordeaux-Gradignan, France. For more information on this facility,
|
||||
please visit :
|
||||
http://www.cenbg.in2p3.fr/
|
||||
|
||||
The code can be used to calculate :
|
||||
1) intrinsic aberration coefficients of the nanobeam line
|
||||
2) beam image from a relasitic primary emittance distribution
|
||||
3) grid shadow images
|
||||
|
||||
Three quadrupole field models can be used :
|
||||
- a simple square field model
|
||||
- a 3D mesh field model computed from OPERA3D
|
||||
- an analytical model based on Enge's model
|
||||
|
||||
---->2. GEOMETRY SET-UP.
|
||||
|
||||
The full magnetic configuration of the nanobeam line is simulated.
|
||||
This configuration is made of a combination of a doublet and triplet of
|
||||
5 Oxford Microbeams Ltd. OM50 quadrupoles.
|
||||
|
||||
More details on the experimental setup and its simulation with Geant4 can
|
||||
be found in the following papers, which may be found on the SLAC-SPIRES
|
||||
online database (http://www.slac.stanford.edu/spires/) :
|
||||
|
||||
- A DETAILED RAY-TRACING SIMULATION OF THE HIGH RESOLUTION MICROBEAM AT THE
|
||||
AIFIRA FACILITY
|
||||
F. Andersson, Ph. Barberet, S. Incerti, Ph. Moretto (CENBG, Gradignan) . Dec 2007.
|
||||
In press in Nucl.Instrum.Meth.B266:1653-1658, 2008
|
||||
|
||||
- MONTE CARLO SIMULATION OF THE CENBG MICROBEAM AND NANOBEAM LINES WITH THE
|
||||
GEANT4 TOOLKIT
|
||||
By S. Incerti, Q. Zhang, F. Andersson, Ph. Moretto, G.W. Grime,
|
||||
M.J. Merchant, D.T. Nguyen, C. Habchi, T. Pouthier and H. Seznec
|
||||
In press in Nucl.Instrum.Meth.B260:20-27, 2007
|
||||
|
||||
- GEANT4 SIMULATION OF THE NEW CENBG MICRO AND NANO PROBES FACILITY
|
||||
By S. Incerti, C. Habchi, Ph. Moretto, J. Olivier and H. Seznec. May 2006. 5pp.
|
||||
Published in Nucl.Instrum.Meth.B249:738-742, 2006
|
||||
|
||||
- A COMPARISON OF RAY-TRACING SOFTWARE FOR THE DESIGN OF QUADRUPOLE MICROBEAM
|
||||
SYSTEMS
|
||||
By S. Incerti et al.,
|
||||
Published in Nucl.Instrum.Meth.B231:76-85, 2005
|
||||
|
||||
---->3. SET-UP
|
||||
|
||||
- a standard Geant4 example GNUmakefile is provided
|
||||
|
||||
setup with:
|
||||
compiler = gcc-3.4.6
|
||||
G4SYSTEM = linux-g++
|
||||
|
||||
The following section gives the necessary environment variables.
|
||||
|
||||
------->>3.1 ENVIRONMENT VARIABLES
|
||||
|
||||
All variables are defined with their default value.
|
||||
|
||||
- G4SYSTEM = Linux-g++
|
||||
|
||||
- G4INSTALL points to the installation directory of GEANT4;
|
||||
|
||||
- G4LIB point to the compiled libraries of GEANT4;
|
||||
|
||||
- G4WORKDIR points to the work directory;
|
||||
|
||||
- CLHEP_BASE_DIR points to the installation directory of CHLEP;
|
||||
|
||||
- G4LEDATA points to the low energy electromagnetic libraries;
|
||||
|
||||
- LD_LIBRARY_PATH = $CLHEP_BASE_DIR/lib
|
||||
|
||||
- G4LEVELGAMMADATA points to the photoevaporation library;
|
||||
|
||||
- G4NEUTRONHPDATA points to the neutron data files;
|
||||
|
||||
- G4RADIOACTIVEDATA points to the libraries for radio-active decay
|
||||
hadronic processes;
|
||||
|
||||
- G4ABLADATA points to the libraries fo ablation processes;
|
||||
|
||||
However, the
|
||||
$G4LEDATA,
|
||||
$G4LEVELGAMMADATA,
|
||||
$G4NEUTRONHPDATA,
|
||||
$G4RADIOACTIVEDATA
|
||||
and $G4ABLADATA
|
||||
variables do not need to be defined for this example.
|
||||
|
||||
Once these variables have been set, simply type gmake to compile the Nanobeam
|
||||
example.
|
||||
|
||||
------->>3.2 VISUALIZATION
|
||||
|
||||
Visualization has not been implemented.
|
||||
All results are stored in text files and can be displayed with the provided
|
||||
ROOT macro file plot.C.
|
||||
|
||||
This macro file shows :
|
||||
- the beam profile along the nanobeam line (only for the computation of intrinsic
|
||||
coefficients)
|
||||
- the beam image (Y vs X) on target
|
||||
- the beam emittance (THETA vs X) and (PHY vs Y) on target
|
||||
- the grid shadow image
|
||||
|
||||
---->4. HOW TO RUN THE EXAMPLE
|
||||
|
||||
The code can be run with :
|
||||
|
||||
> $G4WORDIR/bin/$G4SYSTEM/Nanobeam
|
||||
|
||||
The macro file default.mac is read by default.
|
||||
|
||||
It can be one of the following macro files :
|
||||
|
||||
1) for the computation of intrinsic aberration coefficients :
|
||||
coef-square.mac : using square magnetic field model (=default.mac)
|
||||
coef-map.mac : using 3D map magnetic field model
|
||||
coef-enge.mac : using Enge's analytical field model
|
||||
|
||||
2) for the simulation of the beam image with a realistic emittance :
|
||||
image-square.mac : using square magnetic field model
|
||||
image-map.mac : using 3D map magnetic field model
|
||||
image-enge.mac : using Enge's analytical field model
|
||||
|
||||
3) for the simulation of grid shadow images
|
||||
grid-square.mac : using square magnetic field model
|
||||
grid-map.mac : using 3D map magnetic field model
|
||||
grid-enge.mac : using Enge's analytical field model
|
||||
|
||||
These macros files are stored in the ./macros directory.
|
||||
|
||||
---->5. PHYSICS
|
||||
|
||||
The example runs with protons with fluctuationg energies around 3 MeV.
|
||||
Standard electromagnetic processes are activated by default.
|
||||
|
||||
---->6. SIMULATION OUTPUT AND RESULT ANALYZIS
|
||||
|
||||
The output results consists in several .txt files.
|
||||
|
||||
These files can be easily analyzed using for example the provided ROOT macro
|
||||
file plot.C; to do so :
|
||||
* be sure to have ROOT installed on your machine
|
||||
* be sure to be in the nanobeam directory
|
||||
* launch ROOT by typing root
|
||||
* under your ROOT session, type in : .X plot.C to execute the macro file
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Should you have any enquiry, please do not hesitate to contact:
|
||||
incerti@cenbg.in2p3.fr
|
||||
Executable
+11
@@ -0,0 +1,11 @@
|
||||
/quad/setModel 1
|
||||
/quad/setG1 -11.964623
|
||||
/quad/setG2 16.494652
|
||||
/quad/setG3 9.866770
|
||||
/quad/setG4 -6.244493
|
||||
/displayProfile 1
|
||||
/quad/update
|
||||
/beam/emission 1
|
||||
/run/beamOn 32
|
||||
|
||||
exit
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: DetectorConstruction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef DetectorConstruction_h
|
||||
#define DetectorConstruction_h 1
|
||||
|
||||
#include "G4VUserDetectorConstruction.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4PVPlacement.hh"
|
||||
#include "G4Mag_UsualEqRhs.hh"
|
||||
#include "G4FieldManager.hh"
|
||||
#include "G4TransportationManager.hh"
|
||||
#include "G4EqMagElectricField.hh"
|
||||
#include "G4UserLimits.hh"
|
||||
#include "G4MagIntegratorDriver.hh"
|
||||
#include "G4ClassicalRK4.hh"
|
||||
#include "G4ChordFinder.hh"
|
||||
#include "G4PropagatorInField.hh"
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
#include "TabulatedField3D.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class DetectorConstruction : public G4VUserDetectorConstruction
|
||||
{
|
||||
public:
|
||||
DetectorConstruction();
|
||||
~DetectorConstruction();
|
||||
|
||||
G4VPhysicalVolume* Construct();
|
||||
void PrintDetectorParameters();
|
||||
|
||||
void SetG1 (G4float);
|
||||
void SetG2 (G4float);
|
||||
void SetG3 (G4float);
|
||||
void SetG4 (G4float);
|
||||
void UpdateGeometry();
|
||||
|
||||
void SetModel (G4int);
|
||||
|
||||
G4int GetCoef();
|
||||
void SetCoef();
|
||||
|
||||
G4int GetProfile(){return profile;};
|
||||
void SetProfile(G4int myProfile);
|
||||
|
||||
G4int GetGrid(){return grid;};
|
||||
void SetGrid(G4int myGrid);
|
||||
|
||||
G4float G1, G2, G3, G4;
|
||||
G4int model, coef, profile, grid;
|
||||
|
||||
private:
|
||||
|
||||
void DefineMaterials();
|
||||
G4VPhysicalVolume* ConstructVolumes();
|
||||
|
||||
G4VPhysicalVolume* physiWorld;
|
||||
G4LogicalVolume* logicWorld;
|
||||
G4Box* solidWorld;
|
||||
|
||||
G4VPhysicalVolume* physiVol;
|
||||
G4LogicalVolume* logicVol;
|
||||
G4Box* solidVol;
|
||||
|
||||
G4VPhysicalVolume* physiGridVol;
|
||||
G4LogicalVolume* logicGridVol;
|
||||
G4Box* solidGridVol;
|
||||
|
||||
G4VPhysicalVolume* physiGridVol_Hole;
|
||||
G4LogicalVolume* logicGridVol_Hole;
|
||||
G4Box* solidGridVol_Hole;
|
||||
|
||||
G4VPhysicalVolume* physiControlVol_GridShadow;
|
||||
G4LogicalVolume* logicControlVol_GridShadow;
|
||||
G4Box* solidControlVol_GridShadow;
|
||||
|
||||
G4Material* defaultMaterial;
|
||||
G4Material* waterMaterial;
|
||||
G4Material* gridMaterial;
|
||||
|
||||
G4bool gradientsInitialized;
|
||||
DetectorMessenger* detectorMessenger;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: DetectorMessenger.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef DetectorMessenger_h
|
||||
#define DetectorMessenger_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UImessenger.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
|
||||
class DetectorConstruction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class DetectorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
|
||||
DetectorMessenger(DetectorConstruction* );
|
||||
~DetectorMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
|
||||
DetectorConstruction* Detector;
|
||||
|
||||
G4UIdirectory* quadDir;
|
||||
G4UIcmdWithADouble* G1Cmd;
|
||||
G4UIcmdWithADouble* G2Cmd;
|
||||
G4UIcmdWithADouble* G3Cmd;
|
||||
G4UIcmdWithADouble* G4Cmd;
|
||||
G4UIcmdWithAnInteger* modelCmd;
|
||||
G4UIcmdWithAnInteger* profileCmd;
|
||||
G4UIcmdWithAnInteger* gridCmd;
|
||||
G4UIcmdWithoutParameter* UpdateCmd;
|
||||
};
|
||||
#endif
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: EventAction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef EventAction_h
|
||||
#define EventAction_h 1
|
||||
|
||||
#include "G4UserEventAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4Trajectory.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
class RunAction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class EventAction : public G4UserEventAction
|
||||
{
|
||||
public:
|
||||
|
||||
EventAction(RunAction*);
|
||||
~EventAction();
|
||||
|
||||
void BeginOfEventAction(const G4Event*);
|
||||
void EndOfEventAction(const G4Event*);
|
||||
|
||||
private:
|
||||
|
||||
RunAction* Run;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysicsList.hh,v 1.3 2008/12/18 12:56:22 gunter Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef PhysicsList_h
|
||||
#define PhysicsList_h 1
|
||||
|
||||
#include "G4VUserPhysicsList.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class PhysicsList: public G4VUserPhysicsList
|
||||
{
|
||||
public:
|
||||
PhysicsList();
|
||||
~PhysicsList();
|
||||
|
||||
protected:
|
||||
// Construct particle and physics
|
||||
void ConstructParticle();
|
||||
void ConstructProcess();
|
||||
void SetCuts();
|
||||
|
||||
public:
|
||||
// Set Cuts
|
||||
void SetGammaCut(G4double);
|
||||
void SetElectronCut(G4double);
|
||||
void SetPositronCut(G4double);
|
||||
void SetProtonCut(G4double);
|
||||
|
||||
void SetGammaLowLimit(G4double);
|
||||
void SetElectronLowLimit(G4double);
|
||||
void SetPositronLowLimit(G4double);
|
||||
void SetProtonLowLimit(G4double);
|
||||
void SetGEPLowLimit(G4double);
|
||||
|
||||
void SetGELowLimit(G4double);
|
||||
|
||||
private:
|
||||
|
||||
G4double cutForGamma;
|
||||
G4double cutForElectron;
|
||||
G4double cutForPositron;
|
||||
G4double cutForProton;
|
||||
|
||||
protected:
|
||||
// these methods Construct particles
|
||||
void ConstructBosons();
|
||||
void ConstructLeptons();
|
||||
void ConstructBarions();
|
||||
|
||||
protected:
|
||||
// these methods Construct physics processes and register them
|
||||
void ConstructGeneral();
|
||||
void ConstructEM();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PrimaryGeneratorAction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef PrimaryGeneratorAction_h
|
||||
#define PrimaryGeneratorAction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4VUserPrimaryGeneratorAction.hh"
|
||||
#include "G4ParticleGun.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorMessenger.hh"
|
||||
|
||||
class PrimaryGeneratorMessenger;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorAction(DetectorConstruction*);
|
||||
~PrimaryGeneratorAction();
|
||||
|
||||
public:
|
||||
|
||||
void GeneratePrimaries(G4Event*);
|
||||
G4ParticleGun* GetParticleGun() {return particleGun;};
|
||||
void SetEmission (G4int);
|
||||
|
||||
G4int emission;
|
||||
|
||||
private:
|
||||
|
||||
G4double XYofAngle(G4double);
|
||||
|
||||
G4ParticleGun* particleGun;
|
||||
DetectorConstruction* detector;
|
||||
PrimaryGeneratorMessenger* gunMessenger;
|
||||
G4double angleMax;
|
||||
G4bool shoot;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PrimaryGeneratorMessenger.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef PrimaryGeneratorMessenger_h
|
||||
#define PrimaryGeneratorMessenger_h 1
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
class PrimaryGeneratorAction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
class PrimaryGeneratorMessenger: public G4UImessenger
|
||||
{
|
||||
public:
|
||||
PrimaryGeneratorMessenger(PrimaryGeneratorAction*);
|
||||
~PrimaryGeneratorMessenger();
|
||||
|
||||
void SetNewValue(G4UIcommand*, G4String);
|
||||
|
||||
private:
|
||||
PrimaryGeneratorAction* Action;
|
||||
G4UIdirectory* gunDir;
|
||||
G4UIcmdWithAnInteger* emissionCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: RunAction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef RunAction_h
|
||||
#define RunAction_h 1
|
||||
|
||||
#include "G4UserRunAction.hh"
|
||||
#include "globals.hh"
|
||||
#include <iostream>
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class G4Run;
|
||||
|
||||
class RunAction : public G4UserRunAction
|
||||
{
|
||||
public:
|
||||
|
||||
RunAction(DetectorConstruction*);
|
||||
~RunAction();
|
||||
|
||||
void BeginOfRunAction(const G4Run*);
|
||||
void EndOfRunAction(const G4Run*);
|
||||
|
||||
private:
|
||||
|
||||
DetectorConstruction* detector;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: SteppingAction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef SteppingAction_h
|
||||
#define SteppingAction_h 1
|
||||
|
||||
#include "G4UserSteppingAction.hh"
|
||||
#include "G4SteppingManager.hh"
|
||||
|
||||
#include "RunAction.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class SteppingAction : public G4UserSteppingAction
|
||||
{
|
||||
public:
|
||||
SteppingAction(RunAction*,DetectorConstruction*,PrimaryGeneratorAction*);
|
||||
~SteppingAction();
|
||||
|
||||
void UserSteppingAction(const G4Step*);
|
||||
|
||||
private:
|
||||
RunAction* Run;
|
||||
DetectorConstruction* Detector;
|
||||
PrimaryGeneratorAction* Primary;
|
||||
|
||||
G4double xIn,x0;
|
||||
G4double yIn,y0;
|
||||
G4double zIn,z0;
|
||||
G4double theta0, phi0;
|
||||
G4double thetaIn, phiIn;
|
||||
G4double E;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: SteppingVerbose.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
class SteppingVerbose;
|
||||
|
||||
#ifndef SteppingVerbose_h
|
||||
#define SteppingVerbose_h 1
|
||||
|
||||
#include "G4SteppingVerbose.hh"
|
||||
|
||||
class SteppingVerbose : public G4SteppingVerbose {
|
||||
|
||||
public:
|
||||
|
||||
SteppingVerbose();
|
||||
~SteppingVerbose();
|
||||
|
||||
void StepInfo();
|
||||
void TrackingStarted();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
+64
@@ -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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
// $Id: TabulatedField3D.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4MagneticField.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include "globals.hh"
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
class TabulatedField3D
|
||||
|
||||
#ifndef STANDALONE
|
||||
: public G4MagneticField
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
public:
|
||||
TabulatedField3D(G4float gr1, G4float gr2, G4float gr3, G4float gr4, G4int quadModel);
|
||||
void GetFieldValue( const double Point[4],
|
||||
double *Bfield ) const;
|
||||
|
||||
private:
|
||||
vector< vector< vector< double > > > xField;
|
||||
vector< vector< vector< double > > > yField;
|
||||
vector< vector< vector< double > > > zField;
|
||||
G4int nx,ny,nz;
|
||||
G4double minx, maxx, miny, maxy, minz, maxz;
|
||||
G4double dx, dy, dz;
|
||||
|
||||
G4float gradient1, gradient2, gradient3, gradient4;
|
||||
G4int model;
|
||||
|
||||
};
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: TrackingAction.hh,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#ifndef TrackingAction_h
|
||||
#define TrackingAction_h 1
|
||||
|
||||
#include "G4UserTrackingAction.hh"
|
||||
|
||||
class RunAction;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
class TrackingAction : public G4UserTrackingAction
|
||||
{
|
||||
|
||||
public:
|
||||
TrackingAction(RunAction*);
|
||||
~TrackingAction() {};
|
||||
|
||||
void PostUserTrackingAction(const G4Track*);
|
||||
|
||||
private:
|
||||
RunAction* Run;
|
||||
};
|
||||
|
||||
#endif
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/quad/setModel 3
|
||||
/quad/setG1 -11.425793
|
||||
/quad/setG2 15.763169
|
||||
/quad/setG3 9.3653612
|
||||
/quad/setG4 -5.912425
|
||||
/displayProfile 1
|
||||
/quad/update
|
||||
/beam/emission 1
|
||||
/run/beamOn 32
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/quad/setModel 2
|
||||
/quad/setG1 -11.234147
|
||||
/quad/setG2 15.503626
|
||||
/quad/setG3 9.167942
|
||||
/quad/setG4 -5.777609
|
||||
/displayProfile 1
|
||||
/quad/update
|
||||
/beam/emission 1
|
||||
/run/beamOn 32
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/quad/setModel 1
|
||||
/quad/setG1 -11.964623
|
||||
/quad/setG2 16.494652
|
||||
/quad/setG3 9.866770
|
||||
/quad/setG4 -6.244493
|
||||
/displayProfile 1
|
||||
/quad/update
|
||||
/beam/emission 1
|
||||
/run/beamOn 32
|
||||
|
||||
exit
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/quad/setModel 3
|
||||
/quad/setG1 -11.425793
|
||||
/quad/setG2 15.763169
|
||||
/quad/setG3 9.3653612
|
||||
/quad/setG4 -5.912425
|
||||
/displayProfile 0
|
||||
/setGrid 1
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/quad/setModel 2
|
||||
/quad/setG1 -11.234147
|
||||
/quad/setG2 15.503626
|
||||
/quad/setG3 9.167942
|
||||
/quad/setG4 -5.777609
|
||||
/displayProfile 0
|
||||
/setGrid 1
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/tracking/verbose 0
|
||||
/quad/setModel 1
|
||||
/quad/setG1 -11.965085
|
||||
/quad/setG2 16.495268
|
||||
/quad/setG3 9.867257
|
||||
/quad/setG4 -6.244803
|
||||
/displayProfile 0
|
||||
/setGrid 1
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/quad/setModel 3
|
||||
/quad/setG1 -11.425793
|
||||
/quad/setG2 15.763169
|
||||
/quad/setG3 9.3653612
|
||||
/quad/setG4 -5.912425
|
||||
/displayProfile 0
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/quad/setModel 2
|
||||
/quad/setG1 -11.234147
|
||||
/quad/setG2 15.503626
|
||||
/quad/setG3 9.167942
|
||||
/quad/setG4 -5.777609
|
||||
/displayProfile 0
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/quad/setModel 1
|
||||
/quad/setG1 -11.965085
|
||||
/quad/setG2 16.495268
|
||||
/quad/setG3 9.867257
|
||||
/quad/setG4 -6.244803
|
||||
/displayProfile 0
|
||||
/quad/update
|
||||
/beam/emission 2
|
||||
/run/beamOn 1000
|
||||
@@ -0,0 +1,219 @@
|
||||
|
||||
*************************************************************
|
||||
Geant4 version Name: global-V09-01-17 (19-December-2008)
|
||||
Copyright : Geant4 Collaboration
|
||||
Reference : NIM A 506 (2003), 250-303
|
||||
WWW : http://cern.ch/geant4
|
||||
*************************************************************
|
||||
|
||||
|
||||
|
||||
***** Table : Nb of materials = 2 *****
|
||||
|
||||
Material: H2O density: 1.000 g/cm3 RadL: 36.092 cm Nucl.Int.Length: 75.416 cm Imean: 70.893 eV
|
||||
---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 11.21 % ElmAbundance 66.67 %
|
||||
---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 88.79 % ElmAbundance 33.33 %
|
||||
|
||||
Material: Vacuum density: 0.000 kg/m3 RadL: 204727512.315 pc Nucl.Int.Length: 113804112.800 pc Imean: 21.800 eV temperature: 273.15 K pressure: 1.00 atm
|
||||
---> Element: Vacuum ( ) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 100.00 % ElmAbundance 100.00 %
|
||||
|
||||
|
||||
### NIST DataBase for Materials is used
|
||||
PhysicsList::SetCuts:CutLength : 1 um
|
||||
**********************
|
||||
**** CONFIGURATION ***
|
||||
**********************
|
||||
|
||||
=====> You have selected :
|
||||
-> Square quadrupole field
|
||||
G1 (T/m) = -11.9646
|
||||
G2 (T/m) = 16.4947
|
||||
G3 (T/m) = 9.86677
|
||||
G4 (T/m) = -6.24449
|
||||
|
||||
phot: for gamma SubType= 12
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
PhotoElectric : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
compt: for gamma SubType= 13
|
||||
Lambda tables from 100 eV to 100 TeV in 84 bins, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Klein-Nishina : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
conv: for gamma SubType= 14
|
||||
Lambda tables from 1.022 MeV to 100 TeV in 84 bins, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bethe-Heitler : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
msc: for e- SubType= 10
|
||||
Lambda tables from 100 eV to 100 TeV in 84 bins, spline: 1
|
||||
RangeFactor= 0.02, step limit type: 1, lateralDisplacement: 1, skin= 3, geomFactor= 2.5
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMscUni : Emin= 0 eV Emax= 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 in 84 bins, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 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 in 84 bins, spline: 1
|
||||
LPM flag: 1 for E > 1 GeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eBrem : Emin= 0 eV Emax= 1 GeV
|
||||
eBremRel : Emin= 1 GeV Emax= 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 in 84 bins, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 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 in 84 bins, spline: 1
|
||||
LPM flag: 1 for E > 1 GeV
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eBrem : Emin= 0 eV Emax= 1 GeV
|
||||
eBremRel : Emin= 1 GeV Emax= 100 TeV
|
||||
|
||||
annihil: for e+ SubType= 5
|
||||
Lambda tables from 100 eV to 100 TeV in 84 bins, spline: 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
eplus2gg : Emin= 0 eV Emax= 100 TeV
|
||||
|
||||
msc: for proton SubType= 10
|
||||
Lambda tables from 100 eV to 100 TeV in 84 bins, spline: 1
|
||||
RangeFactor= 0.2, step limit type: 0, lateralDisplacement: 1, skin= 3
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
UrbanMscUni90 : Emin= 0 eV Emax= 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 in 84 bins, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
NuclearStopping= 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 2 MeV
|
||||
BetheBloch : Emin= 2 MeV Emax= 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 in 84 bins, spline: 1
|
||||
finalRange(mm)= 1, dRoverRange= 0.2, integral: 1, fluct: 1, linLossLimit= 0.01
|
||||
NuclearStopping= 1
|
||||
===== EM models for the G4Region DefaultRegionForTheWorld ======
|
||||
Bragg : Emin= 0 eV Emax= 2 MeV
|
||||
BetheBloch : Emin= 2 MeV Emax= 100 TeV
|
||||
|
||||
========= Table of registered couples ==============================
|
||||
|
||||
Index : 0 used in the geometry : Yes recalculation needed : No
|
||||
Material : Vacuum
|
||||
Range cuts : gamma 1 um e- 1 um e+ 1 um
|
||||
Energy thresholds : gamma 990 eV e- 990 eV e+ 990 eV
|
||||
Region(s) which use this couple :
|
||||
DefaultRegionForTheWorld
|
||||
|
||||
====================================================================
|
||||
|
||||
-> Event= 1: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= -0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-3.5867089010791 Y(microns)=-0.45887737486595 THETA(mrad)=-5.8367647764082 PHI(mrad)=-9.1305836538323
|
||||
|
||||
-> Event= 2: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= -0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-0.48858394982666 Y(microns)=-0.30133481278277 THETA(mrad)=-1.9441075333148 PHI(mrad)=-9.1297089122698
|
||||
|
||||
-> Event= 3: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= -0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=0.48858394982666 Y(microns)=-0.30133481278277 THETA(mrad)=1.9441075333148 PHI(mrad)=-9.1297089122698
|
||||
|
||||
-> Event= 4: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= -0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=3.5867089010791 Y(microns)=-0.45887737486595 THETA(mrad)=5.8367647764082 PHI(mrad)=-9.1305836538323
|
||||
|
||||
-> Event= 5: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= -0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-3.3399324435349 Y(microns)=-0.11876365231005 THETA(mrad)=-5.8363619945219 PHI(mrad)=-3.0434522502772
|
||||
|
||||
-> Event= 6: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= -0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-0.40645857802869 Y(microns)=-0.066246823180853 THETA(mrad)=-1.9439736159923 PHI(mrad)=-3.0431621480574
|
||||
|
||||
-> Event= 7: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= -0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=0.40645857802869 Y(microns)=-0.066246823180853 THETA(mrad)=1.9439736159923 PHI(mrad)=-3.0431621480574
|
||||
|
||||
-> Event= 8: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= -0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=3.3399324435349 Y(microns)=-0.11876365231005 THETA(mrad)=5.8363619945219 PHI(mrad)=-3.0434522502772
|
||||
|
||||
-> Event= 9: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= 0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-3.3399324435349 Y(microns)=0.11876365231005 THETA(mrad)=-5.8363619945219 PHI(mrad)=3.0434522502772
|
||||
|
||||
-> Event= 10: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= 0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-0.40645857802869 Y(microns)=0.066246823180853 THETA(mrad)=-1.9439736159923 PHI(mrad)=3.0431621480574
|
||||
|
||||
-> Event= 11: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= 0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=0.40645857802869 Y(microns)=0.066246823180853 THETA(mrad)=1.9439736159923 PHI(mrad)=3.0431621480574
|
||||
|
||||
-> Event= 12: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= 0.03 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=3.3399324435349 Y(microns)=0.11876365231005 THETA(mrad)=5.8363619945219 PHI(mrad)=3.0434522502772
|
||||
|
||||
-> Event= 13: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= 0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-3.5867089010791 Y(microns)=0.45887737486595 THETA(mrad)=-5.8367647764082 PHI(mrad)=9.1305836538323
|
||||
|
||||
-> Event= 14: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= 0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=-0.48858394982666 Y(microns)=0.30133481278277 THETA(mrad)=-1.9441075333148 PHI(mrad)=9.1297089122698
|
||||
|
||||
-> Event= 15: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= 0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=0.48858394982666 Y(microns)=0.30133481278277 THETA(mrad)=1.9441075333148 PHI(mrad)=9.1297089122698
|
||||
|
||||
-> Event= 16: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= 0.09 E0(MeV)= 2.9997
|
||||
=>IMAGE : X(microns)=3.5867089010791 Y(microns)=0.45887737486595 THETA(mrad)=5.8367647764082 PHI(mrad)=9.1305836538323
|
||||
|
||||
-> Event= 17: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= -0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-1.7196770328417 Y(microns)=-0.11880586487665 THETA(mrad)=-5.8315814398783 PHI(mrad)=-9.124902487762
|
||||
|
||||
-> Event= 18: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= -0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=0.13297208222397 Y(microns)=0.038567370885464 THETA(mrad)=-1.9423814979315 PHI(mrad)=-9.1240303956597
|
||||
|
||||
-> Event= 19: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= -0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-0.13297208222397 Y(microns)=0.038567370885464 THETA(mrad)=1.9423814979315 PHI(mrad)=-9.1240303956597
|
||||
|
||||
-> Event= 20: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= -0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=1.7196770328417 Y(microns)=-0.11880586487665 THETA(mrad)=5.8315814398783 PHI(mrad)=-9.124902487762
|
||||
|
||||
-> Event= 21: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= -0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-1.4734196916507 Y(microns)=-0.0054541489705432 THETA(mrad)=-5.8311795427551 PHI(mrad)=-3.0415592251015
|
||||
|
||||
-> Event= 22: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= -0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=0.21499992476237 Y(microns)=0.047025989915602 THETA(mrad)=-1.9422479641261 PHI(mrad)=-3.0412671975718
|
||||
|
||||
-> Event= 23: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= -0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-0.21499992476237 Y(microns)=0.047025989915602 THETA(mrad)=1.9422479641261 PHI(mrad)=-3.0412671975718
|
||||
|
||||
-> Event= 24: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= -0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=1.4734196916507 Y(microns)=-0.0054541489705432 THETA(mrad)=5.8311795427551 PHI(mrad)=-3.0415592251015
|
||||
|
||||
-> Event= 25: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= 0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-1.4734196916507 Y(microns)=0.0054541489705432 THETA(mrad)=-5.8311795427551 PHI(mrad)=3.0415592251015
|
||||
|
||||
-> Event= 26: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= 0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=0.21499992476237 Y(microns)=-0.047025989915602 THETA(mrad)=-1.9422479641261 PHI(mrad)=3.0412671975718
|
||||
|
||||
-> Event= 27: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= 0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-0.21499992476237 Y(microns)=-0.047025989915602 THETA(mrad)=1.9422479641261 PHI(mrad)=3.0412671975718
|
||||
|
||||
-> Event= 28: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= 0.03 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=1.4734196916507 Y(microns)=0.0054541489705432 THETA(mrad)=5.8311795427551 PHI(mrad)=3.0415592251015
|
||||
|
||||
-> Event= 29: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.09 PHI(mrad)= 0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-1.7196770328417 Y(microns)=0.11880586487665 THETA(mrad)=-5.8315814398783 PHI(mrad)=9.124902487762
|
||||
|
||||
-> Event= 30: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= -0.03 PHI(mrad)= 0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=0.13297208222397 Y(microns)=-0.038567370885464 THETA(mrad)=-1.9423814979315 PHI(mrad)=9.1240303956597
|
||||
|
||||
-> Event= 31: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.03 PHI(mrad)= 0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=-0.13297208222397 Y(microns)=-0.038567370885464 THETA(mrad)=1.9423814979315 PHI(mrad)=9.1240303956597
|
||||
|
||||
-> Event= 32: X0(mm)= 0 X0(mm) = 0 Z0(m) = -8.87 THETA(mrad)= 0.09 PHI(mrad)= 0.09 E0(MeV)= 3.0003
|
||||
=>IMAGE : X(microns)=1.7196770328417 Y(microns)=0.11880586487665 THETA(mrad)=5.8315814398783 PHI(mrad)=9.124902487762
|
||||
|
||||
Executable
+146
@@ -0,0 +1,146 @@
|
||||
{
|
||||
gROOT->Reset();
|
||||
gROOT->SetStyle("Plain");
|
||||
|
||||
gStyle->SetOptStat(1111);
|
||||
gStyle->SetPalette(1);
|
||||
|
||||
c1 = new TCanvas ("c1","",200,10,800,800);
|
||||
c1.Divide(2,2);
|
||||
|
||||
Float_t x,y,z,theta,phi,nrj;
|
||||
Int_t ncols;
|
||||
|
||||
FILE *fp1 = fopen("./results/profile.txt","r");
|
||||
if (fp1==0) goto jump1;
|
||||
|
||||
TNtuple *ntuple1 = new TNtuple("ntuple1","file1","x:y:z");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp1,"%f %f %f",&x, &y, &z);
|
||||
if (ncols < 0) break;
|
||||
ntuple1->Fill(x/1000,y/1000,z/1000);
|
||||
}
|
||||
fclose(fp1);
|
||||
|
||||
c1.cd(1);
|
||||
ntuple1->SetMarkerSize(.2);
|
||||
ntuple1->SetMarkerColor(2);
|
||||
ntuple1->SetMarkerStyle(20);
|
||||
ntuple1->Draw("x:y:z","");
|
||||
htemp->GetXaxis()->SetLabelSize(0.025);
|
||||
htemp->GetYaxis()->SetLabelSize(0.025);
|
||||
htemp->GetZaxis()->SetLabelSize(0.025);
|
||||
htemp->GetXaxis()->SetTitleSize(0.035);
|
||||
htemp->GetYaxis()->SetTitleSize(0.035);
|
||||
htemp->GetZaxis()->SetTitleSize(0.035);
|
||||
htemp->GetXaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetYaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetZaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetXaxis()->SetTitle("Z (m)");
|
||||
htemp->GetYaxis()->SetTitle("X (mm)");
|
||||
htemp->GetZaxis()->SetTitle("Y (mm)");
|
||||
htemp->SetTitle("Nanobeam profile");
|
||||
|
||||
jump1:
|
||||
|
||||
FILE *fp1 = fopen("./results/x.txt","r");
|
||||
if (fp1==0) goto jump2;
|
||||
FILE *fp2 = fopen("./results/y.txt","r");
|
||||
FILE *fp3 = fopen("./results/theta.txt","r");
|
||||
FILE *fp4 = fopen("./results/phi.txt","r");
|
||||
TNtuple *ntuple2 = new TNtuple("ntuple2","file2","x:y:theta:phi");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp1,"%f",&x);
|
||||
if (ncols < 0) break;
|
||||
ncols = fscanf(fp2,"%f",&y);
|
||||
ncols = fscanf(fp3,"%f",&theta);
|
||||
ncols = fscanf(fp4,"%f",&phi);
|
||||
ntuple2->Fill(x,y,theta,phi);
|
||||
}
|
||||
fclose(fp1);
|
||||
fclose(fp2);
|
||||
fclose(fp3);
|
||||
fclose(fp4);
|
||||
|
||||
c1.cd(2);
|
||||
gStyle->SetPalette(1);
|
||||
ntuple2->SetMarkerColor(2);
|
||||
ntuple2->SetMarkerStyle(20);
|
||||
gPad->SetLogz();
|
||||
ntuple2->Draw("y:x","","hcolz");
|
||||
htemp->GetXaxis()->SetLabelSize(0.025);
|
||||
htemp->GetYaxis()->SetLabelSize(0.025);
|
||||
htemp->GetXaxis()->SetTitleSize(0.035);
|
||||
htemp->GetYaxis()->SetTitleSize(0.035);
|
||||
htemp->GetXaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetYaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetXaxis()->SetTitle("X (micrometer)");
|
||||
htemp->GetYaxis()->SetTitle("Y (micrometer)");
|
||||
htemp->SetTitle("Nanobeam image");
|
||||
|
||||
c1.cd(3);
|
||||
gStyle->SetPalette(1);
|
||||
ntuple2->SetMarkerColor(4);
|
||||
ntuple2->SetMarkerStyle(20);
|
||||
gPad->SetLogz();
|
||||
ntuple2->Draw("theta:x","","hcolz");
|
||||
htemp->GetXaxis()->SetLabelSize(0.025);
|
||||
htemp->GetYaxis()->SetLabelSize(0.025);
|
||||
htemp->GetXaxis()->SetTitleSize(0.035);
|
||||
htemp->GetYaxis()->SetTitleSize(0.035);
|
||||
htemp->GetXaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetYaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetXaxis()->SetTitle("X (micrometer)");
|
||||
htemp->GetYaxis()->SetTitle("THETA (mrad)");
|
||||
htemp->SetTitle("Nanobeam image emittance (X,THETA)");
|
||||
|
||||
c1.cd(4);
|
||||
gStyle->SetPalette(1);
|
||||
ntuple2->SetMarkerColor(4);
|
||||
ntuple2->SetMarkerStyle(20);
|
||||
gPad->SetLogz();
|
||||
ntuple2->Draw("phi:y","","hcolz");
|
||||
htemp->GetXaxis()->SetLabelSize(0.025);
|
||||
htemp->GetYaxis()->SetLabelSize(0.025);
|
||||
htemp->GetXaxis()->SetTitleSize(0.035);
|
||||
htemp->GetYaxis()->SetTitleSize(0.035);
|
||||
htemp->GetXaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetYaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetXaxis()->SetTitle("Y (micrometer)");
|
||||
htemp->GetYaxis()->SetTitle("PHI (mrad)");
|
||||
htemp->SetTitle("Nanobeam image emittance (Y,PHI)");
|
||||
|
||||
jump2:
|
||||
FILE *fp3 = fopen("./results/grid.txt","r");
|
||||
if (fp3==0) goto jump3;
|
||||
|
||||
TNtuple *ntuple3 = new TNtuple("ntuple3","file3","x:y:nrj");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp3,"%f %f %f",&x, &y, &nrj);
|
||||
if (ncols < 0) break;
|
||||
ntuple3->Fill(x/1000,y/1000,nrj);
|
||||
}
|
||||
fclose(fp3);
|
||||
|
||||
c1.cd(1);
|
||||
gStyle->SetPalette(1);
|
||||
ntuple3->SetMarkerSize(.2);
|
||||
ntuple3->SetMarkerColor(2);
|
||||
ntuple3->SetMarkerStyle(20);
|
||||
gPad->SetLogz();
|
||||
ntuple3->Draw("y:x","","hcolz");
|
||||
htemp->GetXaxis()->SetLabelSize(0.025);
|
||||
htemp->GetYaxis()->SetLabelSize(0.025);
|
||||
htemp->GetXaxis()->SetTitleSize(0.035);
|
||||
htemp->GetYaxis()->SetTitleSize(0.035);
|
||||
htemp->GetXaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetYaxis()->SetTitleOffset(1.4);
|
||||
htemp->GetXaxis()->SetTitle("X (mm)");
|
||||
htemp->GetYaxis()->SetTitle("Y (mm)");
|
||||
htemp->SetTitle("Grid shadow");
|
||||
|
||||
jump3:
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
This is a temporary file allowing CVS to keep this 'results' directory.
|
||||
+340
@@ -0,0 +1,340 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: DetectorConstruction.cc,v 1.3 2008/12/18 12:56:24 gunter Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "DetectorConstruction.hh"
|
||||
#include "G4NistManager.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
DetectorConstruction::DetectorConstruction()
|
||||
{
|
||||
detectorMessenger = new DetectorMessenger(this);
|
||||
gradientsInitialized=false;
|
||||
G1=0; G2=0; G3=0; G4=0; coef=0; profile=0; grid=0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
DetectorConstruction::~DetectorConstruction()
|
||||
{ delete detectorMessenger;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::Construct()
|
||||
|
||||
{
|
||||
DefineMaterials();
|
||||
return ConstructVolumes();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::DefineMaterials()
|
||||
{
|
||||
G4String name, symbol;
|
||||
G4double density;
|
||||
|
||||
G4int ncomponents, natoms;
|
||||
G4double z, a;
|
||||
|
||||
// Define Elements
|
||||
G4Element* H = new G4Element ("Hydrogen", "H", 1. , 1.01*g/mole);
|
||||
G4Element* O = new G4Element ("Oxygen" , "O", 8. , 16.00*g/mole);
|
||||
|
||||
// Water
|
||||
density = 1.000*g/cm3;
|
||||
G4Material* H2O = new G4Material(name="H2O" , density, ncomponents=2);
|
||||
H2O->AddElement(H, natoms=2);
|
||||
H2O->AddElement(O, natoms=1);
|
||||
|
||||
// Vacuum standard definition...
|
||||
density = universe_mean_density;
|
||||
G4Material* vacuum = new G4Material(name="Vacuum", z=1., a=1.01*g/mole,
|
||||
density);
|
||||
|
||||
// NIST
|
||||
G4NistManager *man=G4NistManager::Instance();
|
||||
man->SetVerbose(1);
|
||||
|
||||
G4cout << G4endl << *(G4Material::GetMaterialTable()) << G4endl;
|
||||
|
||||
// Default materials in setup.
|
||||
defaultMaterial = vacuum;
|
||||
waterMaterial = H2O;
|
||||
gridMaterial = man->FindOrBuildMaterial("G4_Ni");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VPhysicalVolume* DetectorConstruction::ConstructVolumes()
|
||||
{
|
||||
|
||||
static G4bool fieldIsInitialized = false;
|
||||
if(!fieldIsInitialized && gradientsInitialized)
|
||||
{
|
||||
G4FieldManager* pFieldMgr;
|
||||
G4MagIntegratorStepper* pStepper;
|
||||
G4Mag_UsualEqRhs* pEquation;
|
||||
|
||||
G4MagneticField* Field= new TabulatedField3D(G1, G2, G3, G4, model);
|
||||
|
||||
pEquation = new G4Mag_UsualEqRhs (Field);
|
||||
pStepper = new G4ClassicalRK4 (pEquation);
|
||||
pFieldMgr=G4TransportationManager::GetTransportationManager()->GetFieldManager();
|
||||
|
||||
G4ChordFinder *pChordFinder = new G4ChordFinder(Field,1e-9*m,pStepper);
|
||||
pFieldMgr->SetChordFinder( pChordFinder );
|
||||
|
||||
pFieldMgr->SetDetectorField(Field);
|
||||
|
||||
fieldIsInitialized = true;
|
||||
|
||||
// tuned parameters
|
||||
pFieldMgr->GetChordFinder()->SetDeltaChord(1.e-9*m);
|
||||
pFieldMgr->SetDeltaIntersection(1.e-9*m);
|
||||
pFieldMgr->SetDeltaOneStep(1.e-9*m);
|
||||
|
||||
G4PropagatorInField *propInField;
|
||||
propInField =
|
||||
G4TransportationManager::GetTransportationManager()->GetPropagatorInField();
|
||||
propInField->SetMinimumEpsilonStep(1e-11);
|
||||
propInField->SetMaximumEpsilonStep(1e-10);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
solidWorld = new G4Box("World", //its name
|
||||
12*m/2,12*m/2,22*m/2); //its size
|
||||
|
||||
|
||||
logicWorld = new G4LogicalVolume(solidWorld, //its solid
|
||||
defaultMaterial, //its material
|
||||
"World"); //its name
|
||||
|
||||
physiWorld = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(), //at (0,0,0)
|
||||
"World", //its name
|
||||
logicWorld, //its logical volume
|
||||
NULL, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
|
||||
// MAGNET VOLUME
|
||||
|
||||
solidVol = new G4Box("Vol", //its name
|
||||
10*m/2,10*m/2,9.120*m/2); //its size
|
||||
|
||||
|
||||
logicVol = new G4LogicalVolume(solidVol, //its solid
|
||||
defaultMaterial, //its material
|
||||
"Vol"); //its name
|
||||
|
||||
physiVol = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(0,0,-4310*mm), //at (0,0,0)
|
||||
"Vol", //its name
|
||||
logicVol, //its logical volume
|
||||
physiWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0); //copy number
|
||||
|
||||
// GRID
|
||||
|
||||
if (grid==1)
|
||||
{
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
G4cout << " ********************** " << G4endl;
|
||||
G4cout << " **** GRID IN PLACE *** " << G4endl;
|
||||
G4cout << " ********************** " << G4endl;
|
||||
|
||||
G4double x_grid=5.0*mm;
|
||||
G4double y_grid=5.0*mm;
|
||||
G4double grid_Zpos=(250+200)*mm; // 250+10 mm for object size of 50µm diam
|
||||
//G4double thickness_grid=10*micrometer;
|
||||
G4double thickness_grid=100*micrometer;
|
||||
G4double z_grid=thickness_grid/2.0;
|
||||
|
||||
solidGridVol= new G4Box("GridVolume",x_grid,y_grid,z_grid); //its size
|
||||
|
||||
logicGridVol = new G4LogicalVolume(solidGridVol, //its solid
|
||||
gridMaterial, //its material
|
||||
"GridVolume"); //its name
|
||||
|
||||
physiGridVol = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(0,0,grid_Zpos), // origin
|
||||
logicGridVol, //its logical volume
|
||||
"GridVolume", //its name
|
||||
logicWorld, //its mother volume
|
||||
false, //no boolean operation
|
||||
0);
|
||||
|
||||
// Holes in grid
|
||||
|
||||
G4double holeSize= 9e-3*mm;
|
||||
G4double pix_grid=1.3e-2*mm;
|
||||
G4int num_half_grid=100;
|
||||
|
||||
solidGridVol_Hole= new G4Box("GridHole",holeSize/2,holeSize/2,z_grid); //its size
|
||||
|
||||
logicGridVol_Hole = new G4LogicalVolume(solidGridVol_Hole, //its solid
|
||||
defaultMaterial, //its material
|
||||
"GridHole"); //its name
|
||||
|
||||
|
||||
for(int i=-num_half_grid;i<num_half_grid;i++)
|
||||
{
|
||||
for (int j=-num_half_grid;j<num_half_grid;j++)
|
||||
{
|
||||
|
||||
G4double x0_grid,y0_grid,z0_grid;
|
||||
G4int number_index_grid;
|
||||
|
||||
x0_grid=pix_grid*i;
|
||||
y0_grid=pix_grid*j;
|
||||
z0_grid=0.0*mm;
|
||||
|
||||
number_index_grid=(i+num_half_grid)*1000+(j+num_half_grid);
|
||||
|
||||
physiGridVol_Hole = new G4PVPlacement(0, //no rotation
|
||||
G4ThreeVector(x0_grid,y0_grid,z0_grid),//origin
|
||||
logicGridVol_Hole, //its logical volume
|
||||
"GridHole", //its name
|
||||
logicGridVol, //its mother volume
|
||||
false, //no boolean operation
|
||||
number_index_grid);
|
||||
}
|
||||
}
|
||||
|
||||
// Grid imaging plane
|
||||
|
||||
G4double ContVolSizeXY = 1*m;
|
||||
G4double ImPlaneWidth = 0.001*mm;
|
||||
|
||||
solidControlVol_GridShadow =
|
||||
new G4Box
|
||||
("ControlVol_GridShadow", ContVolSizeXY/2, ContVolSizeXY/2 , ImPlaneWidth/2);
|
||||
|
||||
logicControlVol_GridShadow =
|
||||
new G4LogicalVolume
|
||||
(solidControlVol_GridShadow, defaultMaterial, "ControlVol_GridShadow");
|
||||
|
||||
physiControlVol_GridShadow =
|
||||
new G4PVPlacement
|
||||
//( 0, G4ThreeVector(0,0,(250+250)*mm), logicControlVol_GridShadow, "ControlVol_GridShadow",logicWorld, false, 0);
|
||||
|
||||
( 0, G4ThreeVector(0,0,(250+300)*mm), logicControlVol_GridShadow, "ControlVol_GridShadow",logicWorld, false, 0);
|
||||
|
||||
|
||||
} // end GRID
|
||||
|
||||
// STEP MINIMUM SIZE
|
||||
logicVol->SetUserLimits(new G4UserLimits(1*mm));
|
||||
|
||||
return physiWorld;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetG1(G4float value)
|
||||
{
|
||||
G1 = value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetG2(G4float value)
|
||||
{
|
||||
G2 = value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetG3(G4float value)
|
||||
{
|
||||
G3 = value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetG4(G4float value)
|
||||
{
|
||||
G4 = value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetModel(G4int modelChoice)
|
||||
{
|
||||
if (modelChoice==1) model=1;
|
||||
if (modelChoice==2) model=2;
|
||||
if (modelChoice==3) model=3;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
void DetectorConstruction::UpdateGeometry()
|
||||
{
|
||||
gradientsInitialized=true;
|
||||
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructVolumes());
|
||||
}
|
||||
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetCoef()
|
||||
{
|
||||
coef=1;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4int DetectorConstruction::GetCoef()
|
||||
{
|
||||
return coef;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetProfile(G4int myProfile)
|
||||
{
|
||||
profile=myProfile;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void DetectorConstruction::SetGrid(G4int myGrid)
|
||||
{
|
||||
grid=myGrid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: DetectorMessenger.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "DetectorMessenger.hh"
|
||||
#include "DetectorConstruction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
|
||||
:Detector(Det)
|
||||
{
|
||||
quadDir = new G4UIdirectory("/quad/");
|
||||
quadDir->SetGuidance("Quadrupole control.");
|
||||
|
||||
modelCmd = new G4UIcmdWithAnInteger("/quad/setModel",this);
|
||||
modelCmd->SetGuidance("Select magnetic field model.");
|
||||
modelCmd->SetParameterName("model",false);
|
||||
modelCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
profileCmd = new G4UIcmdWithAnInteger("/displayProfile",this);
|
||||
profileCmd->SetGuidance("Display beam profile.");
|
||||
profileCmd->SetParameterName("profile",false);
|
||||
profileCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
gridCmd = new G4UIcmdWithAnInteger("/setGrid",this);
|
||||
gridCmd->SetGuidance("Put grid and shadow plane.");
|
||||
gridCmd->SetParameterName("grid",false);
|
||||
gridCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
G1Cmd = new G4UIcmdWithADouble("/quad/setG1",this);
|
||||
G1Cmd->SetGuidance("Set G1.");
|
||||
G1Cmd->SetParameterName("G1",false);
|
||||
G1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
G2Cmd = new G4UIcmdWithADouble("/quad/setG2",this);
|
||||
G2Cmd->SetGuidance("Set G2.");
|
||||
G2Cmd->SetParameterName("G2",false);
|
||||
G2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
G3Cmd = new G4UIcmdWithADouble("/quad/setG3",this);
|
||||
G3Cmd->SetGuidance("Set G3.");
|
||||
G3Cmd->SetParameterName("G3",false);
|
||||
G3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
G4Cmd = new G4UIcmdWithADouble("/quad/setG4",this);
|
||||
G4Cmd->SetGuidance("Set G4.");
|
||||
G4Cmd->SetParameterName("G4",false);
|
||||
G4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
UpdateCmd = new G4UIcmdWithoutParameter("/quad/update",this);
|
||||
UpdateCmd->SetGuidance("Update calorimeter geometry.");
|
||||
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
|
||||
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
|
||||
UpdateCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
DetectorMessenger::~DetectorMessenger()
|
||||
{
|
||||
delete G1Cmd;
|
||||
delete G2Cmd;
|
||||
delete G3Cmd;
|
||||
delete G4Cmd;
|
||||
delete UpdateCmd;
|
||||
delete quadDir;
|
||||
delete modelCmd;
|
||||
delete profileCmd;
|
||||
delete gridCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if( command == modelCmd )
|
||||
{ Detector->SetModel(modelCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == profileCmd )
|
||||
{ Detector->SetProfile(profileCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == gridCmd )
|
||||
{ Detector->SetGrid(gridCmd->GetNewIntValue(newValue));}
|
||||
|
||||
if( command == G1Cmd )
|
||||
{ Detector->SetG1(G1Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == G2Cmd )
|
||||
{ Detector->SetG2(G1Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == G3Cmd )
|
||||
{ Detector->SetG3(G1Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == G4Cmd )
|
||||
{ Detector->SetG4(G1Cmd->GetNewDoubleValue(newValue));}
|
||||
|
||||
if( command == UpdateCmd )
|
||||
{ Detector->UpdateGeometry();}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: EventAction.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "EventAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
EventAction::EventAction(RunAction* run)
|
||||
:Run(run)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
EventAction::~EventAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void EventAction::BeginOfEventAction(const G4Event* /*evt*/)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void EventAction::EndOfEventAction(const G4Event* /*evt*/)
|
||||
{}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysicsList.cc,v 1.4 2008/12/18 12:56:26 gunter Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "PhysicsList.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PhysicsList::PhysicsList(): G4VUserPhysicsList()
|
||||
{
|
||||
defaultCutValue = 1*micrometer;
|
||||
cutForGamma = defaultCutValue;
|
||||
cutForElectron = defaultCutValue;
|
||||
cutForPositron = defaultCutValue;
|
||||
cutForProton = defaultCutValue;
|
||||
|
||||
SetVerboseLevel(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PhysicsList::~PhysicsList()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructParticle()
|
||||
{
|
||||
// In this method, static member functions should be called
|
||||
// for all particles which you want to use.
|
||||
// This ensures that objects of these particle types will be
|
||||
// created in the program.
|
||||
|
||||
ConstructBosons();
|
||||
ConstructLeptons();
|
||||
ConstructBarions();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructBosons()
|
||||
{
|
||||
|
||||
// gamma
|
||||
G4Gamma::GammaDefinition();
|
||||
|
||||
// optical photon
|
||||
G4OpticalPhoton::OpticalPhotonDefinition();
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructLeptons()
|
||||
{
|
||||
// leptons
|
||||
G4Electron::ElectronDefinition();
|
||||
G4Positron::PositronDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructBarions()
|
||||
{
|
||||
// barions
|
||||
G4Proton::ProtonDefinition();
|
||||
G4AntiProton::AntiProtonDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructProcess()
|
||||
{
|
||||
AddTransportation();
|
||||
ConstructEM();
|
||||
ConstructGeneral();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
|
||||
#include "G4MultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4ionIonisation.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
|
||||
#include "G4StepLimiter.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructEM()
|
||||
{
|
||||
|
||||
theParticleIterator->reset();
|
||||
|
||||
while( (*theParticleIterator)() ){
|
||||
|
||||
G4ParticleDefinition* particle = theParticleIterator->value();
|
||||
G4ProcessManager* pmanager = particle->GetProcessManager();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
|
||||
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
|
||||
pmanager->AddDiscreteProcess(new G4ComptonScattering);
|
||||
pmanager->AddDiscreteProcess(new G4GammaConversion);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
|
||||
pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
|
||||
pmanager->AddProcess(new G4eIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4eplusAnnihilation, 0,-1, 4);
|
||||
|
||||
} else if( particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
|
||||
pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
|
||||
pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);
|
||||
|
||||
} else if (particleName == "alpha" ||
|
||||
particleName == "He3" ||
|
||||
particleName == "GenericIon") {
|
||||
// ions with charge >= +2
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4ionIonisation, -1, 2, 2);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
//all others charged particles except geantino and short-lived
|
||||
pmanager->AddProcess(new G4hMultipleScattering,-1, 1, 1);
|
||||
pmanager->AddProcess(new G4hIonisation, -1, 2, 2);
|
||||
|
||||
pmanager->AddProcess(new G4StepLimiter(),-1,-1,3);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::ConstructGeneral()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetCuts()
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
|
||||
}
|
||||
|
||||
// set cut values for gamma at first and for e- second and next for e+,
|
||||
// because some processes for e+/e- need cut values for gamma
|
||||
SetCutValue(cutForGamma, "gamma");
|
||||
SetCutValue(cutForElectron, "e-");
|
||||
SetCutValue(cutForPositron, "e+");
|
||||
|
||||
// set cut values for proton and anti_proton before all other hadrons
|
||||
// because some processes for hadrons need cut values for proton/anti_proton
|
||||
SetCutValue(cutForProton, "proton");
|
||||
SetCutValue(cutForProton, "anti_proton");
|
||||
|
||||
//SetCutValueForOthers(defaultCutValue);
|
||||
|
||||
if (verboseLevel>0) DumpCutValuesTable();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetGammaLowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
// G4Gamma::SetEnergyRange(lowcut,1e5);
|
||||
SetGELowLimit(lowcut);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetElectronLowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
// G4Electron::SetEnergyRange(lowcut,1e5);
|
||||
SetGELowLimit(lowcut);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetPositronLowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "Positron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
G4cerr << "PhysicsList::SetPositronLowLimit: Not currently able to set Positron LowLimit." << G4endl;
|
||||
G4Exception("Positron Low Limit: not implemented in PhysicsList");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetProtonLowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
|
||||
G4cout << "PhysicsList::SetCuts:";
|
||||
G4cout << "Proton cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
G4cerr << "PhysicsList::SetProtonLowLimit: Not currently able to set Proton LowLimit." << G4endl;
|
||||
G4Exception("Proton Low Limit: not implemented in PhysicsList");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetGEPLowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetGEPLowLimit:";
|
||||
G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
this->SetGELowLimit(lowcut);
|
||||
|
||||
G4cerr << " SetGEPLowLimit : Uncertain whether setting Positron low limit " << G4endl;
|
||||
}
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
void PhysicsList::SetGELowLimit(G4double lowcut)
|
||||
{
|
||||
if (verboseLevel >0){
|
||||
G4cout << "PhysicsList::SetGELowLimit:";
|
||||
G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
|
||||
}
|
||||
|
||||
G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(lowcut,1e5);
|
||||
}
|
||||
void PhysicsList::SetGammaCut(G4double val)
|
||||
{
|
||||
ResetCuts();
|
||||
cutForGamma = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetElectronCut(G4double val)
|
||||
{
|
||||
// ResetCuts();
|
||||
cutForElectron = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetPositronCut(G4double val)
|
||||
{
|
||||
// ResetCuts();
|
||||
cutForPositron = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PhysicsList::SetProtonCut(G4double val)
|
||||
{
|
||||
//ResetCuts();
|
||||
cutForProton = val;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PrimaryGeneratorAction.cc,v 1.4 2008/03/01 09:04:29 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
#include "PrimaryGeneratorMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PrimaryGeneratorAction::PrimaryGeneratorAction(DetectorConstruction* DC)
|
||||
:detector(DC)
|
||||
{
|
||||
angleMax = 0.09;
|
||||
emission =0;
|
||||
|
||||
G4int n_particle = 1;
|
||||
particleGun = new G4ParticleGun(n_particle);
|
||||
|
||||
G4ParticleDefinition* particle =
|
||||
G4ParticleTable::GetParticleTable()->FindParticle("proton");
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
|
||||
particleGun->SetParticleEnergy(3*MeV);
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
|
||||
|
||||
gunMessenger = new PrimaryGeneratorMessenger(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
PrimaryGeneratorAction::~PrimaryGeneratorAction()
|
||||
{
|
||||
delete particleGun;
|
||||
delete gunMessenger;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
G4int numEvent;
|
||||
numEvent=anEvent->GetEventID()+1;
|
||||
G4double x0,y0,z0,theta,phi,xMom0,yMom0,zMom0,e0,de;
|
||||
shoot=false;
|
||||
|
||||
x0=0; y0=0; z0=0; theta=0; phi=0; e0=0;
|
||||
|
||||
// Coefficient computation
|
||||
|
||||
if (emission==1)
|
||||
{
|
||||
detector->SetCoef();
|
||||
shoot=true;
|
||||
de = 0;
|
||||
|
||||
if (numEvent== 1) {theta = -0.00500; phi = -0.00500; de = -0.0050; }
|
||||
if (numEvent== 2) {theta = -0.005/3; phi = -0.00500; de = -0.0050; }
|
||||
if (numEvent== 3) {theta = 0.005/3; phi = -0.00500; de = -0.0050; }
|
||||
if (numEvent== 4) {theta = 0.00500; phi = -0.00500; de = -0.0050; }
|
||||
if (numEvent== 5) {theta = -0.00500; phi = -0.005/3; de = -0.0050; }
|
||||
if (numEvent== 6) {theta = -0.005/3; phi = -0.005/3; de = -0.0050; }
|
||||
if (numEvent== 7) {theta = 0.005/3; phi = -0.005/3; de = -0.0050; }
|
||||
if (numEvent== 8) {theta = 0.00500; phi = -0.005/3; de = -0.0050; }
|
||||
if (numEvent== 9) {theta = -0.00500; phi = 0.005/3; de = -0.0050; }
|
||||
if (numEvent== 10) {theta = -0.005/3; phi = 0.005/3; de = -0.0050; }
|
||||
if (numEvent== 11) {theta = 0.005/3; phi = 0.005/3; de = -0.0050; }
|
||||
if (numEvent== 12) {theta = 0.00500; phi = 0.005/3; de = -0.0050; }
|
||||
if (numEvent== 13) {theta = -0.00500; phi = 0.00500; de = -0.0050; }
|
||||
if (numEvent== 14) {theta = -0.005/3; phi = 0.00500; de = -0.0050; }
|
||||
if (numEvent== 15) {theta = 0.005/3; phi = 0.00500; de = -0.0050; }
|
||||
if (numEvent== 16) {theta = 0.00500; phi = 0.00500; de = -0.0050; }
|
||||
if (numEvent== 17) {theta = -0.00500; phi = -0.00500; de = 0.0050; }
|
||||
if (numEvent== 18) {theta = -0.005/3; phi = -0.00500; de = 0.0050; }
|
||||
if (numEvent== 19) {theta = 0.005/3; phi = -0.00500; de = 0.0050; }
|
||||
if (numEvent== 20) {theta = 0.00500; phi = -0.00500; de = 0.0050; }
|
||||
if (numEvent== 21) {theta = -0.00500; phi = -0.005/3; de = 0.0050; }
|
||||
if (numEvent== 22) {theta = -0.005/3; phi = -0.005/3; de = 0.0050; }
|
||||
if (numEvent== 23) {theta = 0.005/3; phi = -0.005/3; de = 0.0050; }
|
||||
if (numEvent== 24) {theta = 0.00500; phi = -0.005/3; de = 0.0050; }
|
||||
if (numEvent== 25) {theta = -0.00500; phi = 0.005/3; de = 0.0050; }
|
||||
if (numEvent== 26) {theta = -0.005/3; phi = 0.005/3; de = 0.0050; }
|
||||
if (numEvent== 27) {theta = 0.005/3; phi = 0.005/3; de = 0.0050; }
|
||||
if (numEvent== 28) {theta = 0.00500; phi = 0.005/3; de = 0.0050; }
|
||||
if (numEvent== 29) {theta = -0.00500; phi = 0.00500; de = 0.0050; }
|
||||
if (numEvent== 30) {theta = -0.005/3; phi = 0.00500; de = 0.0050; }
|
||||
if (numEvent== 31) {theta = 0.005/3; phi = 0.00500; de = 0.0050; }
|
||||
if (numEvent== 32) {theta = 0.00500; phi = 0.00500; de = 0.0050; }
|
||||
|
||||
theta=theta*200*angleMax*1e-3;
|
||||
phi=phi*200*angleMax*1e-3;
|
||||
|
||||
de=de/100;
|
||||
e0 = 3*MeV + 2*de*3*MeV;
|
||||
|
||||
x0 = 0;
|
||||
y0 = 0;
|
||||
z0 = -8870*mm;
|
||||
|
||||
// triplet only
|
||||
//z0 = -3230*mm;
|
||||
|
||||
G4float cte = 1 ;
|
||||
G4float DE = 100*de;
|
||||
|
||||
phi = phi * 1000;
|
||||
theta = theta * 1000;
|
||||
|
||||
FILE *myFile;
|
||||
myFile=fopen ("results/matrix.txt","a");
|
||||
fprintf(myFile,
|
||||
"%e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e %e \n",
|
||||
|
||||
cte,
|
||||
|
||||
theta,
|
||||
phi,
|
||||
DE,
|
||||
|
||||
theta * theta,
|
||||
theta * phi,
|
||||
phi * phi,
|
||||
theta * DE,
|
||||
phi * DE,
|
||||
|
||||
theta * theta * theta,
|
||||
theta * theta * phi,
|
||||
theta * phi * phi,
|
||||
phi * phi * phi,
|
||||
theta * theta * DE,
|
||||
theta * phi * DE,
|
||||
phi * phi * DE,
|
||||
|
||||
theta * theta * theta * phi,
|
||||
theta * theta * phi * phi,
|
||||
theta * phi * phi * phi,
|
||||
theta * theta * theta * DE,
|
||||
theta * theta * phi * DE,
|
||||
theta * phi * phi * DE,
|
||||
phi * phi * phi * DE,
|
||||
|
||||
theta * theta * theta * phi * phi,
|
||||
theta * theta * phi * phi * phi,
|
||||
theta * theta * theta * phi * DE,
|
||||
theta * theta * phi * phi * DE,
|
||||
theta * phi * phi * phi * DE,
|
||||
|
||||
theta * theta * theta * phi * phi * phi,
|
||||
theta * theta * theta * phi * phi * DE,
|
||||
theta * theta * phi * phi * phi * DE,
|
||||
|
||||
theta * theta * theta * phi * phi * phi * DE
|
||||
|
||||
);
|
||||
|
||||
phi = phi / 1000;
|
||||
theta = theta / 1000;
|
||||
fclose (myFile);
|
||||
|
||||
} // end coefficient
|
||||
|
||||
// Full beam
|
||||
|
||||
if (emission==2)
|
||||
{
|
||||
shoot=false;
|
||||
G4double aR, angle, rR;
|
||||
aR = -1;
|
||||
e0= G4RandGauss::shoot(3*MeV,5.0955e-5*MeV); // AIFIRA ENERGY RESOLUTION
|
||||
while (aR < 0) aR = G4RandGauss::shoot(0.10e-3 , 0.06e-3/2.35) * rad; // old =0.08e-3 displacement
|
||||
angle = G4UniformRand() * 2 * CLHEP::pi *rad;
|
||||
theta = aR * std::cos(angle);
|
||||
phi = aR * std::sin(angle);
|
||||
rR = XYofAngle(aR);
|
||||
x0 = rR*std::cos(angle);
|
||||
y0 = rR*std::sin(angle);
|
||||
x0 = G4RandGauss::shoot(x0,220/2.35) *micrometer;
|
||||
theta = G4RandGauss::shoot(theta,0.03e-3/2.35);
|
||||
y0 = G4RandGauss::shoot(y0,220/2.35) *micrometer;
|
||||
phi = G4RandGauss::shoot(phi,0.03e-3/2.35);
|
||||
z0 = (-9120+250)*mm; //position C0
|
||||
if (std::sqrt(x0*x0+y0*y0)/micrometer<2000) shoot=true;
|
||||
|
||||
/*
|
||||
xMom0 = std::sin(theta);
|
||||
yMom0 = std::sin(phi);
|
||||
zMom0 = std::cos(theta);
|
||||
*/
|
||||
|
||||
} // end full beam
|
||||
|
||||
// shoot
|
||||
|
||||
if (shoot)
|
||||
{
|
||||
|
||||
G4cout << "-> Event= " << numEvent<< ": X0(mm)= " << x0/mm << " X0(mm) = " << y0/mm << " Z0(m) = " << z0/m
|
||||
<< " THETA(mrad)= " << theta/mrad << " PHI(mrad)= " << phi/mrad << " E0(MeV)= " << e0/MeV << G4endl;
|
||||
|
||||
xMom0 = std::sin(theta);
|
||||
yMom0 = std::sin(phi);
|
||||
zMom0 = std::sqrt(1.-xMom0*xMom0-yMom0*yMom0);
|
||||
|
||||
particleGun->SetParticleEnergy(e0);
|
||||
|
||||
particleGun->SetParticleMomentumDirection(G4ThreeVector(xMom0,yMom0,zMom0));
|
||||
|
||||
particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
|
||||
|
||||
G4ParticleDefinition* particle=
|
||||
G4ParticleTable::GetParticleTable()->FindParticle("proton");
|
||||
|
||||
particleGun->SetParticleDefinition(particle);
|
||||
|
||||
particleGun->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
|
||||
// end shoot
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void PrimaryGeneratorAction::SetEmission(G4int value)
|
||||
{
|
||||
emission = value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double PrimaryGeneratorAction::XYofAngle(G4double angle)// returns position in micrometers
|
||||
{
|
||||
return std::pow(20000*angle, 13);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PrimaryGeneratorMessenger.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "PrimaryGeneratorMessenger.hh"
|
||||
#include "PrimaryGeneratorAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorMessenger::PrimaryGeneratorMessenger(
|
||||
PrimaryGeneratorAction* Gun)
|
||||
:Action(Gun)
|
||||
{
|
||||
gunDir = new G4UIdirectory("/beam/");
|
||||
gunDir->SetGuidance("beam control");
|
||||
|
||||
emissionCmd = new G4UIcmdWithAnInteger("/beam/emission",this);
|
||||
emissionCmd->SetGuidance("Select emission model.");
|
||||
emissionCmd->SetParameterName("emission",false);
|
||||
emissionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PrimaryGeneratorMessenger::~PrimaryGeneratorMessenger()
|
||||
{
|
||||
delete emissionCmd;
|
||||
delete gunDir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
void PrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if (command == emissionCmd)
|
||||
{Action->SetEmission(emissionCmd->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Executable
+242
@@ -0,0 +1,242 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: RunAction.cc,v 1.3 2008/04/10 12:02:57 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4SteppingManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
#include <iomanip>
|
||||
#include <assert.h>
|
||||
|
||||
#include "RunAction.hh"
|
||||
|
||||
// MATRIX
|
||||
#define MATRIX_BOUND_CHECK
|
||||
#include "globals.hh"
|
||||
#include <iostream>
|
||||
#include "CLHEP/Matrix/Matrix.h"
|
||||
#include "CLHEP/Matrix/Vector.h"
|
||||
#include <fstream>
|
||||
#include "G4ios.hh"
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
using namespace std;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::RunAction(DetectorConstruction* det)
|
||||
:detector(det)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
RunAction::~RunAction()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::BeginOfRunAction(const G4Run* /*aRun*/)
|
||||
{
|
||||
// Cleaning result files
|
||||
system ("rm -rf ./results/x.txt");
|
||||
system ("rm -rf ./results/y.txt");
|
||||
system ("rm -rf ./results/theta.txt");
|
||||
system ("rm -rf ./results/phi.txt");
|
||||
system ("rm -rf ./results/image.txt");
|
||||
system ("rm -rf ./results/matrix.txt");
|
||||
system ("rm -rf ./results/profile.txt");
|
||||
system ("rm -rf ./results/grid.txt");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void RunAction::EndOfRunAction(const G4Run* /*aRun*/)
|
||||
{
|
||||
|
||||
if (detector->GetCoef()==1)
|
||||
{
|
||||
|
||||
CLHEP::HepMatrix m,s;
|
||||
m = CLHEP::HepMatrix(32,32);
|
||||
s = CLHEP::HepMatrix(32,32);
|
||||
CLHEP::HepVector v;
|
||||
v = CLHEP::HepVector(32);
|
||||
|
||||
float aa,ab,ac,ad,ae,af,ag,ah,ai,aj;
|
||||
float ba,bb,bc,bd,be,bf,bg,bh,bi,bj;
|
||||
float ca,cb,cc,cd,ce,cf,cg,ch,ci,cj;
|
||||
float da,db;
|
||||
float vv;
|
||||
|
||||
// MATRIX READING
|
||||
|
||||
int ncols;
|
||||
int nlines=1;
|
||||
|
||||
FILE * fp1 = fopen("results/matrix.txt","r");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp1,
|
||||
"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
|
||||
&aa,&ab,&ac,&ad,&ae,&af,&ag,&ah,&ai,&aj,
|
||||
&ba,&bb,&bc,&bd,&be,&bf,&bg,&bh,&bi,&bj,
|
||||
&ca,&cb,&cc,&cd,&ce,&cf,&cg,&ch,&ci,&cj,
|
||||
&da,&db
|
||||
);
|
||||
|
||||
if (ncols<0) break;
|
||||
if (nlines>32) G4Exception("Try to read more than 32 lines in matrix file !");
|
||||
|
||||
m(nlines,1)=aa;
|
||||
m(nlines,2)=ab;
|
||||
m(nlines,3)=ac;
|
||||
m(nlines,4)=ad;
|
||||
m(nlines,5)=ae;
|
||||
m(nlines,6)=af;
|
||||
m(nlines,7)=ag;
|
||||
m(nlines,8)=ah;
|
||||
m(nlines,9)=ai;
|
||||
m(nlines,10)=aj;
|
||||
m(nlines,11)=ba;
|
||||
m(nlines,12)=bb;
|
||||
m(nlines,13)=bc;
|
||||
m(nlines,14)=bd;
|
||||
m(nlines,15)=be;
|
||||
m(nlines,16)=bf;
|
||||
m(nlines,17)=bg;
|
||||
m(nlines,18)=bh;
|
||||
m(nlines,19)=bi;
|
||||
m(nlines,20)=bj;
|
||||
m(nlines,21)=ca;
|
||||
m(nlines,22)=cb;
|
||||
m(nlines,23)=cc;
|
||||
m(nlines,24)=cd;
|
||||
m(nlines,25)=ce;
|
||||
m(nlines,26)=cf;
|
||||
m(nlines,27)=cg;
|
||||
m(nlines,28)=ch;
|
||||
m(nlines,29)=ci;
|
||||
m(nlines,30)=cj;
|
||||
m(nlines,31)=da;
|
||||
m(nlines,32)=db;
|
||||
|
||||
nlines++;
|
||||
|
||||
}
|
||||
fclose(fp1);
|
||||
|
||||
// VECTOR READING
|
||||
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout << "===> NANOBEAM LINE INTRINSIC ABERRATION COEFFICIENTS (units of micrometer and mrad) :" << G4endl;
|
||||
G4cout << G4endl;
|
||||
|
||||
int inv;
|
||||
nlines = 1;
|
||||
FILE * fp2 = fopen("results/x.txt","r");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp2,"%f", &vv);
|
||||
if (ncols<0) break;
|
||||
v(nlines)=vv;
|
||||
nlines++;
|
||||
}
|
||||
fclose(fp2);
|
||||
|
||||
m.invert(inv);
|
||||
CLHEP::HepVector seb(32,0);
|
||||
seb=m*v;
|
||||
CLHEP::HepVector b;
|
||||
b=seb.sub(2,2); G4cout << "<x|theta>=" << b << G4endl;
|
||||
b=seb.sub(8,8); G4cout << "<x|theta*delta>=" << b << G4endl;
|
||||
b=seb.sub(10,10); G4cout << "<x|theta^3>=" << b << G4endl;
|
||||
b=seb.sub(12,12); G4cout << "<x|theta*phi^2>=" << b << G4endl;
|
||||
m.invert(inv);
|
||||
|
||||
nlines = 1;
|
||||
FILE * fp3 = fopen("results/theta.txt","r");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp3,"%f", &vv);
|
||||
if (ncols<0) break;
|
||||
v(nlines)=vv;
|
||||
nlines++;
|
||||
}
|
||||
fclose(fp3);
|
||||
|
||||
m.invert(inv);
|
||||
seb = m*v;
|
||||
m.invert(inv);
|
||||
b=seb.sub(2,2); G4cout << "<x|x>=" << b << G4endl;
|
||||
|
||||
nlines = 1;
|
||||
FILE * fp4 = fopen("results/y.txt","r");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp4,"%f", &vv);
|
||||
if (ncols<0) break;
|
||||
v(nlines)=vv;
|
||||
nlines++;
|
||||
}
|
||||
fclose(fp4);
|
||||
m.invert(inv);
|
||||
seb=m*v;
|
||||
b=seb.sub(3,3); G4cout << "<y|phi>=" << b << G4endl;
|
||||
b=seb.sub(9,9); G4cout << "<y|phi*delta>=" << b << G4endl;
|
||||
b=seb.sub(11,11); G4cout << "<y|theta^2*phi>=" << b << G4endl;
|
||||
b=seb.sub(13,13); G4cout << "<y|phi^3>=" << b << G4endl;
|
||||
m.invert(inv);
|
||||
|
||||
nlines = 1;
|
||||
FILE * fp5 = fopen("results/phi.txt","r");
|
||||
while (1)
|
||||
{
|
||||
ncols = fscanf(fp5,"%f", &vv);
|
||||
if (ncols<0) break;
|
||||
v(nlines)=vv;
|
||||
nlines++;
|
||||
}
|
||||
fclose(fp5);
|
||||
m.invert(inv);
|
||||
seb = m*v;
|
||||
m.invert(inv);
|
||||
b=seb.sub(3,3); G4cout << "<y|y>=" << b << G4endl;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: SteppingAction.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "SteppingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::SteppingAction(RunAction* run,DetectorConstruction* det,PrimaryGeneratorAction* pri)
|
||||
:Run(run),Detector(det),Primary(pri)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingAction::~SteppingAction()
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void SteppingAction::UserSteppingAction(const G4Step* s)
|
||||
|
||||
{
|
||||
|
||||
|
||||
if ( (s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton")
|
||||
|
||||
/*
|
||||
// for doublet
|
||||
|
||||
&& (s->GetTrack()->GetPosition().z()>-3230.2)
|
||||
&& (s->GetTrack()->GetPosition().z()<-3229.8)
|
||||
*/
|
||||
|
||||
// for triplet and whole line
|
||||
|
||||
&& (s->GetTrack()->GetPosition().z()>249.99999)
|
||||
&& (s->GetTrack()->GetPosition().z()<250.00001)
|
||||
&& (s->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Vol")
|
||||
&& (s->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "World")
|
||||
)
|
||||
|
||||
{
|
||||
xIn = s->GetTrack()->GetPosition().x();
|
||||
yIn = s->GetTrack()->GetPosition().y();
|
||||
zIn = s->GetTrack()->GetPosition().z();
|
||||
E = s->GetTrack()->GetKineticEnergy();
|
||||
|
||||
G4ThreeVector angleIn;
|
||||
angleIn = s->GetTrack()->GetMomentumDirection();
|
||||
|
||||
thetaIn = std::asin(angleIn[0]/std::sqrt(angleIn[0]*angleIn[0]+angleIn[1]*angleIn[1]+angleIn[2]*angleIn[2]));
|
||||
phiIn = std::asin(angleIn[1]/std::sqrt(angleIn[0]*angleIn[0]+angleIn[1]*angleIn[1]+angleIn[2]*angleIn[2]));
|
||||
|
||||
G4cout << " =>IMAGE : X(microns)=" << xIn/micrometer <<" Y(microns)="<< yIn/micrometer << " THETA(mrad)=" << (thetaIn/mrad) << " PHI(mrad)=" << (phiIn/mrad) << G4endl;
|
||||
G4cout << G4endl;
|
||||
|
||||
FILE *myFile1;
|
||||
myFile1=fopen ("results/x.txt","a");
|
||||
fprintf(myFile1,"%e \n",xIn*1000);
|
||||
fclose (myFile1);
|
||||
|
||||
FILE *myFile2;
|
||||
myFile2=fopen ("results/y.txt","a");
|
||||
fprintf(myFile2,"%e \n",yIn*1000);
|
||||
fclose (myFile2);
|
||||
|
||||
FILE *myFile3;
|
||||
myFile3=fopen ("results/theta.txt","a");
|
||||
fprintf(myFile3,"%e \n",thetaIn*1000);
|
||||
fclose (myFile3);
|
||||
|
||||
FILE *myFile4;
|
||||
myFile4=fopen ("results/phi.txt","a");
|
||||
fprintf(myFile4,"%e \n",phiIn*1000);
|
||||
fclose (myFile4);
|
||||
|
||||
FILE *myFile5;
|
||||
myFile5=fopen ("results/image.txt","a");
|
||||
fprintf(myFile5,"%e %e\n",xIn*1000, yIn*1000);
|
||||
fclose (myFile5);
|
||||
|
||||
}
|
||||
|
||||
if (Detector->GetProfile()==1)
|
||||
{
|
||||
|
||||
if (
|
||||
(s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton")
|
||||
&& (s->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "Vol")
|
||||
&& (s->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "Vol") )
|
||||
{
|
||||
xIn = s->GetTrack()->GetPosition().x();
|
||||
yIn = s->GetTrack()->GetPosition().y();
|
||||
zIn = s->GetTrack()->GetPosition().z();
|
||||
FILE *myFile6;
|
||||
myFile6=fopen ("results/profile.txt","a");
|
||||
fprintf(myFile6,"%e %e %e\n",xIn*1000, yIn*1000, zIn);
|
||||
fclose (myFile6);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (Detector->GetGrid()==1)
|
||||
{
|
||||
|
||||
if (
|
||||
(s->GetTrack()->GetDynamicParticle()->GetDefinition() ->GetParticleName() == "proton")
|
||||
&& (s->GetPreStepPoint()->GetPhysicalVolume()->GetName() == "ControlVol_GridShadow")
|
||||
&& (s->GetPostStepPoint()->GetPhysicalVolume()->GetName() == "World") )
|
||||
{
|
||||
xIn = s->GetTrack()->GetPosition().x();
|
||||
yIn = s->GetTrack()->GetPosition().y();
|
||||
E = s->GetTrack()->GetKineticEnergy();
|
||||
FILE *myFile7;
|
||||
myFile7=fopen ("results/grid.txt","a");
|
||||
fprintf(myFile7,"%e %e %e\n",xIn*1000, yIn*1000, E);
|
||||
fclose (myFile7);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// end
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: SteppingVerbose.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "SteppingVerbose.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingVerbose::SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
SteppingVerbose::~SteppingVerbose()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void SteppingVerbose::StepInfo()
|
||||
{
|
||||
CopyState();
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
|
||||
if( verboseLevel >= 1 ){
|
||||
if( verboseLevel >= 4 ) VerboseTrack();
|
||||
if( verboseLevel >= 3 ){
|
||||
G4cout << G4endl;
|
||||
G4cout << std::setw( 5) << "#Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "NextVolu"
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
}
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
// if( fStepStatus != fWorldBoundary){
|
||||
if( fTrack->GetNextVolume() != 0 ) {
|
||||
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName();
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld";
|
||||
}
|
||||
|
||||
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != NULL){
|
||||
G4cout << std::setw(10) << fStep->GetPostStepPoint()->GetProcessDefinedStep()
|
||||
->GetProcessName();
|
||||
} else {
|
||||
G4cout << "User Limit";
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
|
||||
if( verboseLevel == 2 ){
|
||||
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
|
||||
fN2ndariesAlongStepDoIt +
|
||||
fN2ndariesPostStepDoIt;
|
||||
if(tN2ndariesTot>0){
|
||||
G4cout << " :----- List of 2ndaries - "
|
||||
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
|
||||
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
|
||||
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
|
||||
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
|
||||
<< "), "
|
||||
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
|
||||
<< " ---------------"
|
||||
<< G4endl;
|
||||
|
||||
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
|
||||
lp1<(*fSecondary).size(); lp1++){
|
||||
G4cout << " : "
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
|
||||
<< std::setw(6)
|
||||
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
|
||||
<< std::setw(10)
|
||||
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
|
||||
G4cout << G4endl;
|
||||
}
|
||||
|
||||
G4cout << " :-----------------------------"
|
||||
<< "----------------------------------"
|
||||
<< "-- EndOf2ndaries Info ---------------"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
//G4cout<< "exit SteppingVerbose::StepInfo " <<G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void SteppingVerbose::TrackingStarted()
|
||||
{
|
||||
CopyState();
|
||||
G4int prec = G4cout.precision(3);
|
||||
if( verboseLevel > 0 ){
|
||||
|
||||
G4cout << std::setw( 5) << "Step#" << " "
|
||||
<< std::setw( 6) << "X" << " "
|
||||
<< std::setw( 6) << "Y" << " "
|
||||
<< std::setw( 6) << "Z" << " "
|
||||
<< std::setw( 9) << "KineE" << " "
|
||||
<< std::setw( 9) << "dEStep" << " "
|
||||
<< std::setw(10) << "StepLeng"
|
||||
<< std::setw(10) << "TrakLeng"
|
||||
<< std::setw(10) << "NextVolu"
|
||||
<< std::setw(10) << "Process" << G4endl;
|
||||
|
||||
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
|
||||
<< std::setw( 6) << G4BestUnit(fStep->GetStepLength(),"Length")
|
||||
<< std::setw( 6) << G4BestUnit(fTrack->GetTrackLength(),"Length");
|
||||
|
||||
if(fTrack->GetNextVolume()){
|
||||
G4cout << std::setw(10) << fTrack->GetNextVolume()->GetName() << " ";
|
||||
} else {
|
||||
G4cout << std::setw(10) << "OutOfWorld" << " ";
|
||||
}
|
||||
G4cout << std::setw(10) << "initStep" << G4endl;
|
||||
}
|
||||
G4cout.precision(prec);
|
||||
G4cout<< "exit SteppingVerbose::TrackingStarted() " <<G4endl;
|
||||
}
|
||||
+532
@@ -0,0 +1,532 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: TabulatedField3D.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "TabulatedField3D.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
TabulatedField3D::TabulatedField3D(G4float gr1, G4float gr2, G4float gr3, G4float gr4, G4int choiceModel)
|
||||
{
|
||||
|
||||
G4cout << " ********************** " << G4endl;
|
||||
G4cout << " **** CONFIGURATION *** " << G4endl;
|
||||
G4cout << " ********************** " << G4endl;
|
||||
|
||||
G4cout<< G4endl;
|
||||
G4cout << "=====> You have selected :" << G4endl;
|
||||
if (choiceModel==1) G4cout<< "-> Square quadrupole field"<<G4endl;
|
||||
if (choiceModel==2) G4cout<< "-> 3D quadrupole field"<<G4endl;
|
||||
if (choiceModel==3) G4cout<< "-> Enge quadrupole field"<<G4endl;
|
||||
G4cout << " G1 (T/m) = "<< gr1 << G4endl;
|
||||
G4cout << " G2 (T/m) = "<< gr2 << G4endl;
|
||||
G4cout << " G3 (T/m) = "<< gr3 << G4endl;
|
||||
G4cout << " G4 (T/m) = "<< gr4 << G4endl;
|
||||
|
||||
gradient1 = gr1;
|
||||
gradient2 = gr2;
|
||||
gradient3 = gr3;
|
||||
gradient4 = gr4;
|
||||
model = choiceModel;
|
||||
|
||||
if (model==2)
|
||||
{
|
||||
const char * filename ="OM50.grid";
|
||||
|
||||
double lenUnit= mm;
|
||||
G4cout << "\n-----------------------------------------------------------"
|
||||
<< "\n 3D Magnetic field from OPERA software "
|
||||
<< "\n-----------------------------------------------------------";
|
||||
|
||||
G4cout << "\n ---> " "Reading the field grid from " << filename << " ... " << endl;
|
||||
ifstream file( filename ); // Open the file for reading.
|
||||
|
||||
// Read table dimensions
|
||||
file >> nx >> ny >> nz; // Note dodgy order
|
||||
|
||||
G4cout << " [ Number of values x,y,z: "
|
||||
<< nx << " " << ny << " " << nz << " ] "
|
||||
<< endl;
|
||||
|
||||
// Set up storage space for table
|
||||
xField.resize( nx );
|
||||
yField.resize( nx );
|
||||
zField.resize( nx );
|
||||
int ix, iy, iz;
|
||||
for (ix=0; ix<nx; ix++) {
|
||||
xField[ix].resize(ny);
|
||||
yField[ix].resize(ny);
|
||||
zField[ix].resize(ny);
|
||||
for (iy=0; iy<ny; iy++) {
|
||||
xField[ix][iy].resize(nz);
|
||||
yField[ix][iy].resize(nz);
|
||||
zField[ix][iy].resize(nz);
|
||||
}
|
||||
}
|
||||
|
||||
// Read in the data
|
||||
double xval,yval,zval,bx,by,bz;
|
||||
double permeability; // Not used in this example.
|
||||
for (ix=0; ix<nx; ix++) {
|
||||
for (iy=0; iy<ny; iy++) {
|
||||
for (iz=0; iz<nz; iz++) {
|
||||
file >> xval >> yval >> zval >> bx >> by >> bz >> permeability;
|
||||
if ( ix==0 && iy==0 && iz==0 ) {
|
||||
minx = xval * lenUnit;
|
||||
miny = yval * lenUnit;
|
||||
minz = zval * lenUnit;
|
||||
}
|
||||
xField[ix][iy][iz] = bx ;
|
||||
yField[ix][iy][iz] = by ;
|
||||
zField[ix][iy][iz] = bz ;
|
||||
}
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
|
||||
maxx = xval * lenUnit;
|
||||
maxy = yval * lenUnit;
|
||||
maxz = zval * lenUnit;
|
||||
|
||||
G4cout << "\n ---> ... done reading " << endl;
|
||||
|
||||
// G4cout << " Read values of field from file " << filename << endl;
|
||||
G4cout << " ---> assumed the order: x, y, z, Bx, By, Bz "
|
||||
<< "\n ---> Min values x,y,z: "
|
||||
<< minx/cm << " " << miny/cm << " " << minz/cm << " cm "
|
||||
<< "\n ---> Max values x,y,z: "
|
||||
<< maxx/cm << " " << maxy/cm << " " << maxz/cm << " cm " << endl;
|
||||
|
||||
dx = maxx - minx;
|
||||
dy = maxy - miny;
|
||||
dz = maxz - minz;
|
||||
G4cout << "\n ---> Dif values x,y,z (range): "
|
||||
<< dx/cm << " " << dy/cm << " " << dz/cm << " cm in z "
|
||||
<< "\n-----------------------------------------------------------" << endl;
|
||||
|
||||
|
||||
// Table normalization
|
||||
for (ix=0; ix<nx; ix++)
|
||||
{
|
||||
for (iy=0; iy<ny; iy++)
|
||||
{
|
||||
for (iz=0; iz<nz; iz++)
|
||||
{
|
||||
|
||||
xField[ix][iy][iz] = (xField[ix][iy][iz]/197.736);
|
||||
yField[ix][iy][iz] = (yField[ix][iy][iz]/197.736);
|
||||
zField[ix][iy][iz] = (zField[ix][iy][iz]/197.736);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // model==2
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
|
||||
void TabulatedField3D::GetFieldValue(const double point[4],
|
||||
double *Bfield ) const
|
||||
{
|
||||
|
||||
G4double coef, G0;
|
||||
G0 = 0;
|
||||
|
||||
coef=1; //protons
|
||||
//coef=2; // alphas
|
||||
|
||||
//******************************************************************
|
||||
|
||||
// MAP
|
||||
if (model==2)
|
||||
{
|
||||
Bfield[0] = 0.0;
|
||||
Bfield[1] = 0.0;
|
||||
Bfield[2] = 0.0;
|
||||
Bfield[3] = 0.0;
|
||||
Bfield[4] = 0.0;
|
||||
Bfield[5] = 0.0;
|
||||
|
||||
double x = point[0];
|
||||
double y = point[1];
|
||||
double z = point[2];
|
||||
|
||||
G4int quad;
|
||||
G4double gradient[5];
|
||||
|
||||
gradient[0]=gradient1*(tesla/m)/coef;
|
||||
gradient[1]=gradient2*(tesla/m)/coef;
|
||||
gradient[2]=gradient3*(tesla/m)/coef;
|
||||
gradient[3]=gradient4*(tesla/m)/coef;
|
||||
gradient[4]=-gradient3*(tesla/m)/coef;
|
||||
|
||||
for (quad=0; quad<=4; quad++)
|
||||
{
|
||||
if ((quad+1)==1) {z = point[2] + 3720 * mm;}
|
||||
if ((quad+1)==2) {z = point[2] + 3580 * mm;}
|
||||
if ((quad+1)==3) {z = point[2] + 330 * mm;}
|
||||
if ((quad+1)==4) {z = point[2] + 190 * mm;}
|
||||
if ((quad+1)==5) {z = point[2] + 50 * mm;}
|
||||
|
||||
// Check that the point is within the defined region
|
||||
|
||||
if
|
||||
(
|
||||
x>=minx && x<=maxx &&
|
||||
y>=miny && y<=maxy &&
|
||||
z>=minz && z<=maxz
|
||||
)
|
||||
{
|
||||
// Position of given point within region, normalized to the range
|
||||
// [0,1]
|
||||
double xfraction = (x - minx) / dx;
|
||||
double yfraction = (y - miny) / dy;
|
||||
double zfraction = (z - minz) / dz;
|
||||
|
||||
// Need addresses of these to pass to modf below.
|
||||
// modf uses its second argument as an OUTPUT argument.
|
||||
double xdindex, ydindex, zdindex;
|
||||
|
||||
// Position of the point within the cuboid defined by the
|
||||
// nearest surrounding tabulated points
|
||||
double xlocal = ( std::modf(xfraction*(nx-1), &xdindex));
|
||||
double ylocal = ( std::modf(yfraction*(ny-1), &ydindex));
|
||||
double zlocal = ( std::modf(zfraction*(nz-1), &zdindex));
|
||||
|
||||
// The indices of the nearest tabulated point whose coordinates
|
||||
// are all less than those of the given point
|
||||
int xindex = static_cast<int>(xdindex);
|
||||
int yindex = static_cast<int>(ydindex);
|
||||
int zindex = static_cast<int>(zdindex);
|
||||
|
||||
// Interpolated field
|
||||
Bfield[0] =
|
||||
(xField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
|
||||
xField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
|
||||
xField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
|
||||
xField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
|
||||
xField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
|
||||
xField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
|
||||
xField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
|
||||
xField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
|
||||
+ Bfield[0];
|
||||
|
||||
Bfield[1] =
|
||||
(yField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
|
||||
yField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
|
||||
yField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
|
||||
yField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
|
||||
yField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
|
||||
yField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
|
||||
yField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
|
||||
yField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
|
||||
+ Bfield[1];
|
||||
|
||||
Bfield[2] =
|
||||
(zField[xindex ][yindex ][zindex ] * (1-xlocal) * (1-ylocal) * (1-zlocal) +
|
||||
zField[xindex ][yindex ][zindex+1] * (1-xlocal) * (1-ylocal) * zlocal +
|
||||
zField[xindex ][yindex+1][zindex ] * (1-xlocal) * ylocal * (1-zlocal) +
|
||||
zField[xindex ][yindex+1][zindex+1] * (1-xlocal) * ylocal * zlocal +
|
||||
zField[xindex+1][yindex ][zindex ] * xlocal * (1-ylocal) * (1-zlocal) +
|
||||
zField[xindex+1][yindex ][zindex+1] * xlocal * (1-ylocal) * zlocal +
|
||||
zField[xindex+1][yindex+1][zindex ] * xlocal * ylocal * (1-zlocal) +
|
||||
zField[xindex+1][yindex+1][zindex+1] * xlocal * ylocal * zlocal)*gradient[quad]
|
||||
+ Bfield[2];
|
||||
|
||||
}
|
||||
|
||||
} // loop on quads
|
||||
|
||||
} //end MAP
|
||||
|
||||
|
||||
//******************************************************************
|
||||
// SQUARE
|
||||
|
||||
if (model==1)
|
||||
{
|
||||
Bfield[0] = 0.0;
|
||||
Bfield[1] = 0.0;
|
||||
Bfield[2] = 0.0;
|
||||
Bfield[3] = 0.0;
|
||||
Bfield[4] = 0.0;
|
||||
Bfield[5] = 0.0;
|
||||
|
||||
// Field components
|
||||
G4double Bx = 0;
|
||||
G4double By = 0;
|
||||
G4double Bz = 0;
|
||||
|
||||
G4double x = point[0];
|
||||
G4double y = point[1];
|
||||
G4double z = point[2];
|
||||
|
||||
if (z>=-3770*mm & z<=-3670*mm) G0 = (gradient1/coef)* tesla/m;
|
||||
if (z>=-3630*mm & z<=-3530*mm) G0 = (gradient2/coef)* tesla/m;
|
||||
|
||||
if (z>=-380*mm & z<=-280*mm) G0 = (gradient3/coef)* tesla/m;
|
||||
if (z>=-240*mm & z<=-140*mm) G0 = (gradient4/coef)* tesla/m;
|
||||
if (z>=-100*mm & z<=0*mm) G0 = (-gradient3/coef)* tesla/m;
|
||||
|
||||
Bx = y*G0;
|
||||
By = x*G0;
|
||||
Bz = 0;
|
||||
|
||||
Bfield[0] = Bx;
|
||||
Bfield[1] = By;
|
||||
Bfield[2] = Bz;
|
||||
|
||||
}
|
||||
|
||||
// end SQUARE
|
||||
|
||||
//******************************************************************
|
||||
// ENGE
|
||||
|
||||
if (model==3)
|
||||
{
|
||||
|
||||
// X POSITION OF FIRST QUADRUPOLE
|
||||
//G4double lineX = 0*mm;
|
||||
|
||||
// Z POSITION OF FIRST QUADRUPOLE
|
||||
G4double lineZ = -3720*mm;
|
||||
|
||||
// QUADRUPOLE HALF LENGTH
|
||||
//G4double quadHalfLength = 50*mm;
|
||||
|
||||
// QUADRUPOLE CENTER COORDINATES
|
||||
G4double zoprime;
|
||||
|
||||
G4double Grad1, Grad2, Grad3, Grad4, Grad5;
|
||||
Grad1=gradient1;
|
||||
Grad2=gradient2;
|
||||
Grad3=gradient3;
|
||||
Grad4=gradient4;
|
||||
Grad5=-Grad3;
|
||||
|
||||
Bfield[0] = 0.0;
|
||||
Bfield[1] = 0.0;
|
||||
Bfield[2] = 0.0;
|
||||
Bfield[3] = 0.0;
|
||||
Bfield[4] = 0.0;
|
||||
Bfield[5] = 0.0;
|
||||
|
||||
double x = point[0];
|
||||
double y = point[1];
|
||||
double z = point[2];
|
||||
|
||||
if ( z>=-3900*mm & z<-3470*mm || z>=-490*mm & z<100*mm )
|
||||
{
|
||||
G4double Bx=0;
|
||||
G4double By=0;
|
||||
G4double Bz=0;
|
||||
|
||||
// FRINGING FILED CONSTANTS
|
||||
G4double c0[5], c1[5], c2[5], z1[5], z2[5], a0[5], gradient[5];
|
||||
|
||||
// DOUBLET***************
|
||||
// QUADRUPOLE 1
|
||||
c0[0] = -10.; // Ci are constants in the; Pn(z)=C0+C1*s+C2*s^2
|
||||
c1[0] = 3.08874;
|
||||
c2[0] = -0.00618654;
|
||||
z1[0] = 28.6834*mm; //Fringing field lower limit
|
||||
z2[0] = z1[0]+50*mm; //Fringing field upper limit
|
||||
a0[0] = 7.5*mm; //Bore Radius
|
||||
gradient[0] =Grad1*(tesla/m)/coef;
|
||||
|
||||
// QUADRUPOLE 2
|
||||
c0[1] = -10.; // Ci are constants in the; Pn(z)=C0+C1*s+C2*s^2
|
||||
c1[1] = 3.08874;
|
||||
c2[1] = -0.00618654;
|
||||
z1[1] = 28.6834*mm; //Fringing field lower limit
|
||||
z2[1] = z1[1]+50*mm; //Fringing field upper limit
|
||||
a0[1] = 7.5*mm; //Bore Radius
|
||||
gradient[1] =Grad2*(tesla/m)/coef;
|
||||
|
||||
// TRIPLET**********
|
||||
// QUADRUPOLE 3
|
||||
c0[2] = -10.; // Ci are constants in the; Pn(z)=C0+C1*s+C2*s^2
|
||||
c1[2] = 3.08874;
|
||||
c2[2] = -0.00618654;
|
||||
z1[2] = 28.6834*mm; //Fringing field lower limit
|
||||
z2[2] = z1[2]+50*mm; //Fringing field upper limit
|
||||
a0[2] = 7.5*mm; //Bore Radius
|
||||
gradient[2] = Grad3*(tesla/m)/coef;
|
||||
|
||||
// QUADRUPOLE 4
|
||||
c0[3] = -10.; // Ci are constants in the; Pn(z)=C0+C1*s+C2*s^2
|
||||
c1[3] = 3.08874;
|
||||
c2[3] = -0.00618654;
|
||||
z1[3] = 28.6834*mm; //Fringing field lower limit
|
||||
z2[3] = z1[3]+50*mm; //Fringing field upper limit
|
||||
a0[3] = 7.5*mm; //Bore Radius
|
||||
gradient[3] = Grad4*(tesla/m)/coef;
|
||||
|
||||
// QUADRUPOLE 5
|
||||
c0[4] = -10.; // Ci are constants in the; Pn(z)=C0+C1*s+C2*s^2
|
||||
c1[4] = 3.08874;
|
||||
c2[4] = -0.00618654;
|
||||
z1[4] = 28.6834*mm; //Fringing field lower limit
|
||||
z2[4] = z1[4]+50*mm; //Fringing field upper limit
|
||||
a0[4] = 7.5*mm; //Bore Radius
|
||||
gradient[4] = Grad5*(tesla/m)/coef;
|
||||
|
||||
// FIELD CREATED BY A QUADRUPOLE IN ITS LOCAL FRAME
|
||||
G4double Bx_local,By_local,Bz_local;
|
||||
Bx_local = 0; By_local = 0; Bz_local = 0;
|
||||
|
||||
// FIELD CREATED BY A QUADRUPOOLE IN WORLD FRAME
|
||||
G4double Bx_quad,By_quad,Bz_quad;
|
||||
Bx_quad = 0; By_quad=0; Bz_quad=0;
|
||||
|
||||
// QUADRUPOLE FRAME
|
||||
G4double x_local,y_local,z_local;
|
||||
x_local= 0; y_local=0; z_local=0;
|
||||
|
||||
G4double s = 0; // For Enges formula
|
||||
G4double G0, G1, G2, G3; // For Enges formula
|
||||
G4double K0, K1, K2, K3; // For Enges formula
|
||||
G4double P0, P1, P2, P3, cte; // For Enges formula
|
||||
|
||||
K0=0;
|
||||
K1=0;
|
||||
K2=0;
|
||||
K3=0;
|
||||
P0=0;
|
||||
P1=0;
|
||||
P2=0;
|
||||
P3=0;
|
||||
G0=0;
|
||||
G1=0;
|
||||
G2=0;
|
||||
G3=0;
|
||||
cte=0;
|
||||
|
||||
for (G4int i=0;i<5; i++) // LOOP ON MAGNETS
|
||||
{
|
||||
|
||||
if (i<2) // (if Doublet)
|
||||
{
|
||||
zoprime = lineZ + i*140*mm; //centre of magnet nbr i
|
||||
x_local = x;
|
||||
y_local = y;
|
||||
z_local = (z - zoprime);
|
||||
}
|
||||
else // else the current magnet is in the triplet
|
||||
{
|
||||
zoprime = lineZ + i*140*mm +(3150-40)*mm;
|
||||
|
||||
x_local = x;
|
||||
y_local = y;
|
||||
z_local = (z - zoprime);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ( z_local < -z2[i] || z_local > z2[i]) // Outside the fringing field
|
||||
{
|
||||
G0=0;
|
||||
G1=0;
|
||||
G2=0;
|
||||
G3=0;
|
||||
}
|
||||
|
||||
|
||||
if ( (z_local>=-z1[i]) & (z_local<=z1[i]) ) // inside the quadrupole but outside the fringefield
|
||||
{
|
||||
G0=gradient[i];
|
||||
G1=0;
|
||||
G2=0;
|
||||
G3=0;
|
||||
}
|
||||
|
||||
if ( ((z_local>=-z2[i]) & (z_local<-z1[i])) || ((z_local>z1[i]) & (z_local<=z2[i])) ) // Inside the fringefield
|
||||
{
|
||||
|
||||
s = ( z_local - z1[i]) / a0[i]; // se (8)
|
||||
if (z_local<-z1[i]) s = ( - z_local - z1[i]) / a0[i]; // se (9) p1397 Incerti et.al.
|
||||
|
||||
|
||||
P0 = c0[i]+c1[i]*s+c2[i]*s*s;
|
||||
|
||||
P1 = c1[i]/a0[i]+2*c2[i]*(z_local-z1[i])/a0[i]/a0[i]; //dP/dz
|
||||
if (z_local<-z1[i]) P1 = -c1[i]/a0[i]+2*c2[i]*(z_local+z1[i])/a0[i]/a0[i]; // --"--
|
||||
|
||||
P2 = 2*c2[i]/a0[i]/a0[i]; // d2P/dz2
|
||||
|
||||
P3 = 0; // d3P/dw3 ??
|
||||
|
||||
cte = 1 + std::exp(c0[i]); // (1+e^c0)
|
||||
|
||||
K1 = -cte*P1*std::exp(P0)/( (1+std::exp(P0))*(1+std::exp(P0)) ); // se (11) p1397 Incerti et.al.
|
||||
|
||||
K2 = -cte*std::exp(P0)*( // se (12) p1397 Incerti et.al.
|
||||
P2/( (1+std::exp(P0))*(1+std::exp(P0)) )
|
||||
+2*P1*K1/(1+std::exp(P0))/cte
|
||||
+P1*P1/(1+std::exp(P0))/(1+std::exp(P0))
|
||||
);
|
||||
|
||||
K3 = -cte*std::exp(P0)*( // se (13) p1397 Incerti et.al
|
||||
(3*P2*P1+P1*P1*P1)/(1+std::exp(P0))/(1+std::exp(P0))
|
||||
+4*K1*(P1*P1+P2)/(1+std::exp(P0))/cte
|
||||
+2*P1*(K1*K1/cte/cte+K2/(1+std::exp(P0))/cte)
|
||||
);
|
||||
|
||||
G0 = gradient[i]*cte/(1+std::exp(P0)); // G = G0*K(z) , se (7) p1397 Incerti et.al
|
||||
G1 = gradient[i]*K1; // dG/dz
|
||||
G2 = gradient[i]*K2; // d2G/dz2
|
||||
G3 = gradient[i]*K3; // d3G/dz3
|
||||
|
||||
}
|
||||
|
||||
Bx_local = y_local*(G0-(1./12)*(3*x_local*x_local+y_local*y_local)*G2); // se (4) p1396 Incerti et.al
|
||||
By_local = x_local*(G0-(1./12)*(3*y_local*y_local+x_local*x_local)*G2); // se (5) p1396 Incerti et.al
|
||||
Bz_local = x_local*y_local*(G1-(1./12)*(x_local*x_local+y_local*y_local)*G3); // se (6) p1396 Incerti et.al
|
||||
|
||||
// TOTAL MAGNETIC FIELD
|
||||
|
||||
Bx = Bx + Bx_local ;
|
||||
By = By + By_local ;
|
||||
Bz = Bz + Bz_local ;
|
||||
|
||||
|
||||
} // LOOP ON QUADRUPOLES
|
||||
|
||||
Bfield[0] = Bx;
|
||||
Bfield[1] = By;
|
||||
Bfield[2] = Bz;
|
||||
}
|
||||
|
||||
|
||||
} // end ENGE
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: TrackingAction.cc,v 1.2 2008/01/25 20:49:24 sincerti Exp $
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
#include "G4TrackingManager.hh"
|
||||
#include "G4Track.hh"
|
||||
|
||||
#include "TrackingAction.hh"
|
||||
#include "RunAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
TrackingAction::TrackingAction(RunAction* run)
|
||||
:Run(run)
|
||||
{
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void TrackingAction::PostUserTrackingAction(const G4Track*)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user