Changeset 1313 for trunk/examples/advanced
- Timestamp:
- Jun 14, 2010, 3:54:58 PM (15 years ago)
- Location:
- trunk/examples/advanced
- Files:
-
- 103 edited
-
README (modified) (2 diffs)
-
Rich/GNUmakefile (modified) (2 diffs)
-
Rich/History (modified) (2 diffs)
-
Rich/README (modified) (1 diff)
-
Rich/RichTbSim.cc (modified) (2 diffs)
-
Rich/RichTbVis0.mac (modified) (2 diffs)
-
Rich/run1.mac (modified) (2 diffs)
-
air_shower/GNUmakefile (modified) (1 diff)
-
air_shower/History (modified) (3 diffs)
-
air_shower/Visualisation.mac (modified) (1 diff)
-
air_shower/src/UltraEventAction.cc (modified) (2 diffs)
-
brachytherapy/Brachy.cc (modified) (5 diffs)
-
brachytherapy/GNUmakefile (modified) (2 diffs)
-
brachytherapy/History (modified) (2 diffs)
-
brachytherapy/VisualisationMacro.mac (modified) (1 diff)
-
composite_calorimeter/CompositeCalorimeter.cc (modified) (1 diff)
-
composite_calorimeter/GNUmakefile (modified) (2 diffs)
-
composite_calorimeter/History (modified) (2 diffs)
-
composite_calorimeter/README (modified) (5 diffs)
-
composite_calorimeter/src/CCalEndOfEventAction.cc (modified) (2 diffs)
-
composite_calorimeter/test.g4mac (modified) (1 diff)
-
cosmicray_charging/init.mac (modified) (1 diff)
-
gammaray_telescope/GNUmakefile (modified) (2 diffs)
-
gammaray_telescope/History (modified) (2 diffs)
-
gammaray_telescope/macro1.mac (modified) (1 diff)
-
gammaray_telescope/macro2.mac (modified) (1 diff)
-
gammaray_telescope/macro3.mac (modified) (1 diff)
-
gammaray_telescope/src/GammaRayTelEventAction.cc (modified) (3 diffs)
-
hadrontherapy/GNUmakefile (modified) (3 diffs)
-
hadrontherapy/Hadrontherapy.cc (modified) (3 diffs)
-
hadrontherapy/History (modified) (1 diff)
-
hadrontherapy/README (modified) (2 diffs)
-
hadrontherapy/defaultMacro.mac (modified) (4 diffs)
-
hadrontherapy/include/CVS/Entries (modified) (1 diff)
-
hadrontherapy/include/CVS/Tag (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyAnalysisFileMessenger.hh (modified) (3 diffs)
-
hadrontherapy/include/HadrontherapyAnalysisManager.hh (modified) (4 diffs)
-
hadrontherapy/include/HadrontherapyDetectorConstruction.hh (modified) (8 diffs)
-
hadrontherapy/include/HadrontherapyDetectorMessenger.hh (modified) (2 diffs)
-
hadrontherapy/include/HadrontherapyDetectorSD.hh (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyEventAction.hh (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyInteractionParameters.hh (modified) (2 diffs)
-
hadrontherapy/include/HadrontherapyMatrix.hh (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyPhysicsList.hh (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyPhysicsListMessenger.hh (modified) (1 diff)
-
hadrontherapy/include/HadrontherapyPrimaryGeneratorAction.hh (modified) (2 diffs)
-
hadrontherapy/include/PassiveProtonBeamLine.hh (modified) (1 diff)
-
hadrontherapy/include/PassiveProtonBeamLineMessenger.hh (modified) (1 diff)
-
hadrontherapy/src/HadrontherapyAnalysisManager.cc (modified) (2 diffs)
-
hadrontherapy/src/HadrontherapyDetectorConstruction.cc (modified) (7 diffs)
-
hadrontherapy/src/HadrontherapyDetectorMessenger.cc (modified) (9 diffs)
-
hadrontherapy/src/HadrontherapyEventAction.cc (modified) (4 diffs)
-
hadrontherapy/src/HadrontherapyMatrix.cc (modified) (1 diff)
-
hadrontherapy/src/HadrontherapyPhysicsList.cc (modified) (7 diffs)
-
hadrontherapy/src/HadrontherapyPhysicsListMessenger.cc (modified) (4 diffs)
-
hadrontherapy/src/HadrontherapyPrimaryGeneratorAction.cc (modified) (5 diffs)
-
hadrontherapy/src/HadrontherapyRunAction.cc (modified) (4 diffs)
-
hadrontherapy/src/HadrontherapySteppingAction.cc (modified) (4 diffs)
-
human_phantom/GNUmakefile (modified) (2 diffs)
-
human_phantom/History (modified) (2 diffs)
-
human_phantom/README (modified) (2 diffs)
-
human_phantom/adultHead.mac (modified) (1 diff)
-
human_phantom/adultMIRDFemale.mac (modified) (1 diff)
-
human_phantom/adultMIXFemale.mac (modified) (1 diff)
-
human_phantom/adultORNLFemale.mac (modified) (1 diff)
-
human_phantom/dawnVis.mac (modified) (1 diff)
-
human_phantom/openGLVis.mac (modified) (1 diff)
-
human_phantom/vrmlVis.mac (modified) (1 diff)
-
lAr_calorimeter/GNUmakefile (modified) (2 diffs)
-
lAr_calorimeter/History (modified) (2 diffs)
-
lAr_calorimeter/prerunlArcal.mac (modified) (1 diff)
-
lAr_calorimeter/vis.mac (modified) (1 diff)
-
medical_linac/GNUmakefile (modified) (2 diffs)
-
medical_linac/History (modified) (2 diffs)
-
medical_linac/vis.mac (modified) (1 diff)
-
microbeam/GNUmakefile (modified) (2 diffs)
-
microbeam/History (modified) (2 diffs)
-
microbeam/microbeam.mac (modified) (1 diff)
-
microbeam/microbeam.out (modified) (11 diffs)
-
purging_magnet/GNUmakefile (modified) (2 diffs)
-
purging_magnet/History (modified) (2 diffs)
-
purging_magnet/vis.mac (modified) (1 diff)
-
radioprotection/GNUmakefile (modified) (2 diffs)
-
radioprotection/History (modified) (2 diffs)
-
radioprotection/moon.mac (modified) (1 diff)
-
radioprotection/remsim.cc (modified) (2 diffs)
-
radioprotection/vehicle1.mac (modified) (1 diff)
-
radioprotection/vehicle2.mac (modified) (1 diff)
-
radioprotection/vis.mac (modified) (1 diff)
-
underground_physics/DMX.cc (modified) (2 diffs)
-
underground_physics/GNUmakefile (modified) (3 diffs)
-
underground_physics/History (modified) (2 diffs)
-
underground_physics/initInter.mac (modified) (1 diff)
-
xray_fluorescence/GNUmakefile (modified) (2 diffs)
-
xray_fluorescence/History (modified) (2 diffs)
-
xray_fluorescence/initInter.mac (modified) (1 diff)
-
xray_telescope/GNUmakefile (modified) (3 diffs)
-
xray_telescope/History (modified) (2 diffs)
-
xray_telescope/README (modified) (2 diffs)
-
xray_telescope/README_stt (modified) (1 diff)
-
xray_telescope/XrayTel.cc (modified) (2 diffs)
-
xray_telescope/test.mac (modified) (1 diff)
-
xray_telescope/test.out (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/advanced/README
r1230 r1313 1 $Id: README,v 1. 2 2001/10/23 15:09:27 gcosmoExp $1 $Id: README,v 1.3 2009/11/18 15:34:16 cirrone Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 15 15 in each example for the details. 16 16 These application are made part of the official GEANT4 distribution, however 17 their maintenance and updates is under responsibility of the authors. These 18 applications are not subject to regular system testing. 17 their maintenance and updates is under responsibility of the authors. 19 18 -
trunk/examples/advanced/Rich/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1. 2 2009/03/06 09:39:58 gbarrandExp $1 # $Id: GNUmakefile,v 1.3 2010/01/11 14:24:55 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/Rich/History
r1230 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.1 6 2009/11/12 13:09:56 ribonExp $2 $Id: History,v 1.19 2010/06/06 06:24:26 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 12 03.06.2010 - J.Perl (Rich-V09-03-02) 13 Updated vis usage 14 15 01.06.2010 - G.A.P.Cirrone (Rich-V09-03-01) 16 Added G4UIExecutive 17 18 31.03.2010 - A.Ribon (Rich-V09-03-00) 19 Replaced obsolete G4MultipleScattering class with: 20 G4eMultipleScattering for e+ and e-; 21 G4MuMultipleScattering for mu+ and mu-; 22 G4hMultipleScattering for hadrons and ions. 11 23 12 24 12.11.2009 - A.Ribon (Rich-V09-02-01) -
trunk/examples/advanced/Rich/README
r807 r1313 59 59 60 60 The Visualization manager is set in the main(). 61 The Initialisation of the drawing is already defined in run1.mac. 62 The example is prepared to use any other visualization packages which 63 can be defined in such macro or inside RichTbVis0.mac. Before running 64 the events, the visualization must be initialized by: 61 Before running events, the visualization must be initialized by: 65 62 66 > /control/execute/ RichTbVis0.mac63 > /control/execute/vis.mac 67 64 68 65 The detector has longitudinal view of the geometry as default. -
trunk/examples/advanced/Rich/RichTbSim.cc
r1230 r1313 54 54 #ifdef G4VIS_USE 55 55 #include "G4VisExecutive.hh" 56 #endif 57 58 #ifdef G4UI_USE 59 #include "G4UIExecutive.hh" 56 60 #endif 57 61 … … 158 162 #endif 159 163 164 #ifdef G4UI_USE 165 G4UIExecutive * ui = new G4UIExecutive(argc,argv); 166 ui->SessionStart(); 167 delete ui; 168 #endif 169 160 170 delete runManager; 161 171 -
trunk/examples/advanced/Rich/RichTbVis0.mac
r807 r1313 1 ####################################################################### 2 # MACRO FILE NAME: RichTbVis0.mac # 3 # # 4 # AUTHOR(S): Satoshi Tanaka # 5 # Mod SE 20-3-01 # 6 # DATE: November 10, 1999 # 7 # May 20, 2000 # 8 # June 06, 2000 # 9 # # 10 # CONTENTS: A simplest macro to demonstrate visualization of # 11 # detector geometry and events # 12 # # 13 # USAGE: # 14 # Idle> /control/execute RichTbVis0.mac # 15 # # 16 # REQUIRED PLATFORMS & SOFTWARES: Unix, X-window, OpenGL, # 17 # DAWN (version 3.80 or after) # 18 # gv (Ghostview), Tcl/Tk # 19 # # 20 # ENVIRONMENTAL VARIABLES (C-MACROS) FOR INSTALLATION: # 21 # (See geant4/source/visualization/README for details.) # 22 # # 23 # % setenv OGLHOME ... (e.g. /usr/local) # 24 # % setenv G4VIS_BUILD_OPENGLX_DRIVER 1 # 25 # % setenv G4VIS_BUILD_DAWNFILE_DRIVER 1 # 26 # # 27 # ENVIRONMENTAL VARIABLES (C-MACROS) FOR COMPILATION: # 28 # (See geant4/source/visualization/README for details.) # 29 # # 30 # % setenv G4VIS_USE_OPENGLX 1 # 31 # % setenv G4VIS_USE_DAWNFILE 1 # 32 # # 33 # Addional Notes: # 34 # The compound command "/vis/open <graphics-system-name>" # 35 # is equivalent to the following set of commands: # 36 # # 37 # /vis/sceneHandler/create $1 # 38 # /vis/viewer/create # 39 # # 40 # The compound command "/vis/drawVolume <physical-volume-name>" # 41 # is equivalent to the following set of commands: # 42 # # 43 # /vis/scene/create # 44 # /vis/scene/add/volume $1 # 45 # /vis/sceneHandler/attach # 46 # /vis/viewer/refresh # 47 # /vis/viewer/update # 48 # # 49 ####################################################################### 50 51 ############################################## 52 # Visualization of detector geometry 53 # with the OGLIX (OpenGL Immediate X) driver 54 ############################################## 55 56 # Invoke the OGLIX driver 57 #/vis/open OGLIX 58 59 # Set camera 60 # Note: Camera setting should be done 61 # for each scene handler. 62 /vis/camera/reset 63 /vis/scene/create 64 #/vis/sceneHandler/create OGLIX 65 #/vis/sceneHandler/create DAWNFILE 66 #/vis/sceneHandler/create OGLSXm 1 # Use this open statement to create an OpenGL view: 2 #/vis/open OGL 600x600-0+0 3 # 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 67 6 /vis/open DAWNFILE 68 /vis/open OGLIX 69 /vis/viewer/create 70 /vis/scene/add/volume 71 #/vis/camera/viewpoint 0 0 72 73 /vis/camera/viewpoint -90 -90 7 # 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 11 # 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 14 #/vis/open VRML2FILE 15 # 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 20 # 21 # Draw geometry: 22 /vis/drawVolume 23 # 24 # Specify view angle: 25 /vis/viewer/set/viewpointThetaPhi -90. -90. 74 26 #/vis/camera/viewpoint 270 0 75 /vis/camera/zoom 0.8 76 #/vis/camera/spin 20 10 77 78 # Visualize of the whole detector geometry 79 /vis/drawVolume 27 # 28 # Specify zoom value: 29 /vis/viewer/zoom 0.8 30 # 31 # Specify style (surface or wireframe): 32 #/vis/viewer/set/style wireframe 33 # 34 # Draw coordinate axes: 35 #/vis/scene/add/axes 0 0 0 1 m 36 # 37 # Draw smooth trajectories at end of event, showing trajectory points 38 # as markers 2 pixels wide: 39 /vis/scene/add/trajectories smooth 40 /vis/modeling/trajectories/create/drawByCharge 41 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 42 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 43 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 44 # 45 # Draw hits at end of event: 46 #/vis/scene/add/hits 47 # 48 # To draw only gammas: 49 #/vis/filtering/trajectories/create/particleFilter 50 #/vis/filtering/trajectories/particleFilter-0/add gamma 51 # 52 # To invert the above, drawing all particles except gammas, 53 # keep the above two lines but also add: 54 #/vis/filtering/trajectories/particleFilter-0/invert true 55 # 56 # Many other options are available with /vis/modeling and /vis/filtering. 57 # For example, to select colour by particle ID: 58 #/vis/modeling/trajectories/create/drawByParticleID 59 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 60 # 61 # To superimpose all of the events from a given run: 62 #/vis/scene/endOfEventAction accumulate 63 # 64 # Re-establish auto refreshing and verbosity: 65 /vis/viewer/set/autoRefresh true 66 /vis/verbose warnings 67 # 80 68 /vis/viewer/update 81 69 … … 86 74 87 75 88 89 90 91 -
trunk/examples/advanced/Rich/run1.mac
r807 r1313 1 # $Id: run1.mac,v 1. 3 2004/07/15 19:10:02 johnaExp $1 # $Id: run1.mac,v 1.4 2010/06/06 06:24:26 perl Exp $ 2 2 # 3 3 # Macro file for "LHCbRichSim.cc" 4 4 # 5 #/vis/open OGLIX6 # (can be run in batch, without graphic)7 5 /control/verbose 2 8 6 /control/saveHistory … … 13 11 #process/verbose 4 14 12 #particle/process/verbose 4 15 #vis/verbose 416 13 17 /vis/scene/create18 /vis/sceneHandler/create OGLSXm19 /vis/sceneHandler/create OGLIX20 /vis/viewer/create21 /vis/scene/add/volume22 23 24 /vis/viewer/update25 26 /vis/viewer/set/viewpointThetaPhi -90. -90.27 14 /hits/list 28 15 /hits/activate 29 16 /hits/verbose 4 30 17 /tracking/storeTrajectory 1 31 /vis/scene/add/trajectories32 18 33 19 /gun/particle pi- -
trunk/examples/advanced/air_shower/GNUmakefile
r1230 r1313 8 8 9 9 ifndef G4INSTALL 10 G4INSTALL = ../.. /..10 G4INSTALL = ../.. 11 11 endif 12 12 -
trunk/examples/advanced/air_shower/History
r807 r1313 1 $Id: History,v 1. 14 2007/09/30 23:05:58 gumExp $1 $Id: History,v 1.24 2010/06/06 06:13:59 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 8 8 History file 9 9 ------------ 10 02.06.2010 - J.Perl (air_shower-V09-03-00) 11 Updated vis usage 12 13 16.11.2009 -- B. Tomé, 14 Tag air_shower-V09-02-06 15 Changed UltraPhysicsList.cc to use new processes G4eMultipleScattering, G4MuMultipleScattering 16 and G4hMultipleScattering 17 Tested example air_shower with Geant4 tag geant4-09-02-ref-10 18 19 15.05.2009 -- B. Tomé, 20 Updated README file. Tag air_shower-V09-01-00 21 Tested example with Geant4 tag geant4-09-02-ref-04 and iAIDA-1.0.14 22 23 10.12.2008 -- G.A.P.Cirrone, Tag: air_shower-V09-01-05 24 Updated README file; 25 03.07.2008 -- B. Tomé; Tag air_shower-V09-01-04 26 Access to private data members of UltraDetectorConstruction through Get functions. 27 28 03.07.2008 -- B. Tomé; Tag air_shower-V09-01-03 29 Adjusted range of optical properties tables in UltraDetectorConstruction; 30 Added check of optical photon energy in UltraPrimaryGeneratorAction; 31 Cerenkov process attached to all applicable particles; 32 Modified Visualisation.mac and UltraMacro.mac files 33 34 26.06.2008 -- G.A.P.Cirrone; Tag air_shower-V09-01-02 35 Corrected a parameter in the UltraDetectorConstruction to remove a segmentation 36 due to a non correct definition of the refraction index of the Quartz. 37 38 15.06.2008 -- G.A.P.Cirrone; Tag: air_shower-V09-01-01 39 Removed no more necessary AIDA commands from GNUmakefile 40 41 11.06.2008 -- G.A.P.Cirrone air_shower-V09-01-00 42 Solved a compilation error in the Analysis Manager 10 43 11 44 30.09.2007 -- P.Gumplinger - air_shower-V09-00-00 … … 38 71 -- Corrected usage of <strstream> in RunActionMessenger. 39 72 -- Corrected call to Visualisation.mac from Ultra.cc. 40 - Changed viewer to OGLSX in Visualisation.mac.73 -- Changed viewer to OGLSX in Visualisation.mac. 41 74 42 75 03.05.2005 -- J.Allison -
trunk/examples/advanced/air_shower/Visualisation.mac
r1230 r1313 3 3 /run/verbose 2 4 4 # 5 # create empty scene 5 # Use this open statement to create an OpenGL view: 6 #/vis/open OGL 600x600-0+0 6 7 # 7 # /vis/scene/create Space8 # /vis/scene/notifyHandlers Space flush9 /vis/ scene/create8 # Use this open statement to create a .prim file suitable for 9 # viewing in DAWN: 10 /vis/open DAWNFILE 10 11 # 11 # Create a scene handler for a specific graphics system 12 # (Edit the next line(s) to choose another graphic system) 12 # Use this open statement to create a .heprep file suitable for 13 # viewing in HepRApp: 14 #/vis/open HepRepFile 13 15 # 14 #/vis/open OGLIX 15 #/vis/open RayTracer 16 #/vis/open OGLSX 17 /vis/open DAWNFILE 18 #/vis/open HepRepFile 16 # Use this open statement to create a .wrl file suitable for 17 # viewing in a VRML viewer: 19 18 #/vis/open VRML2FILE 20 19 # 21 /vis/viewer/set/viewpointThetaPhi 90.0 0.0 deg 22 /vis/viewer/zoom 1. 23 /vis/viewer/flush 20 # Disable auto refresh and quieten vis messages whilst scene and 21 # trajectories are established: 22 /vis/viewer/set/autoRefresh false 23 /vis/verbose errors 24 # 25 # Draw geometry: 26 /vis/drawVolume 27 # 28 # Specify view angle: 29 /vis/viewer/set/viewpointThetaPhi 90. 0. 30 # 31 # Specify zoom value: 32 #/vis/viewer/zoom 2. 33 # 34 # Specify style (surface or wireframe): 35 #/vis/viewer/set/style wireframe 36 # 37 # Draw coordinate axes: 38 #/vis/scene/add/axes 0 0 0 1 m 39 # 40 # Draw smooth trajectories at end of event, showing trajectory points 41 # as markers 2 pixels wide: 42 /vis/scene/add/trajectories smooth 43 /vis/modeling/trajectories/create/drawByCharge 44 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 45 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 46 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 47 # 48 # Draw hits at end of event: 49 #/vis/scene/add/hits 50 # 51 # To draw only gammas: 52 #/vis/filtering/trajectories/create/particleFilter 53 #/vis/filtering/trajectories/particleFilter-0/add gamma 54 # 55 # To invert the above, drawing all particles except gammas, 56 # keep the above two lines but also add: 57 #/vis/filtering/trajectories/particleFilter-0/invert true 58 # 59 # Many other options are available with /vis/modeling and /vis/filtering. 60 # For example, to select colour by particle ID: 61 #/vis/modeling/trajectories/create/drawByParticleID 62 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 63 # 64 # To superimpose all of the events from a given run: 65 /vis/scene/endOfEventAction accumulate 66 # 67 # Re-establish auto refreshing and verbosity: 24 68 /vis/viewer/set/autoRefresh true 69 /vis/verbose warnings 25 70 # 26 # for drawing the tracks 27 # (if too many tracks cause core dump => storeTrajectory 0) 28 /tracking/storeTrajectory 1 29 /tracking/verbose 0 30 #/vis/drawView 31 32 /vis/scene/add/trajectories 33 /vis/scene/endOfEventAction accumulate 34 #/vis/drawVolume 71 # For file-based drivers, use this to create an empty detector view: 72 #/vis/viewer/flush 73 # 35 74 /gps/particle opticalphoton 36 75 /gps/energy 2.0 eV 37 76 /mysetrun/SetRunID 9999 38 77 /run/beamOn 100 39 -
trunk/examples/advanced/air_shower/src/UltraEventAction.cc
r807 r1313 51 51 #include "G4VHitsCollection.hh" 52 52 #include "G4GeneralParticleSource.hh" 53 54 #include "G4TrajectoryContainer.hh"55 #include "G4Trajectory.hh"56 #include "G4VVisManager.hh"57 53 58 54 #ifdef G4ANALYSIS_USE … … 134 130 analysis->FillHistogram(2,nOptHits); 135 131 #endif 136 137 // Define visualization atributes:138 139 G4String drawFlag = "all";140 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();141 142 if(pVVisManager)143 {144 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();145 G4int n_trajectories = 0;146 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();147 for(G4int i=0; i<n_trajectories; i++)148 { G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);149 if (drawFlag == "all") trj->DrawTrajectory();150 else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))151 trj->DrawTrajectory();152 }153 }154 155 132 } 156 133 -
trunk/examples/advanced/brachytherapy/Brachy.cc
r1230 r1313 26 26 // 27 27 // $Id: Brachy.cc 28 // GEANT4 tag $Name: geant4-09-0 3-cand-01$28 // GEANT4 tag $Name: geant4-09-04-beta-cand-00 $ 29 29 // 30 30 // -------------------------------------------------------------- … … 57 57 #endif 58 58 59 #include "BrachyEventAction.hh"60 59 #include "BrachyDetectorConstruction.hh" 61 60 #include "BrachyPhysicsList.hh" … … 72 71 #ifdef G4ANALYSIS_USE 73 72 #include "BrachyAnalysisManager.hh" 73 #endif 74 75 76 #ifdef G4UI_USE 77 #include "G4UIExecutive.hh" 74 78 #endif 75 79 … … 91 95 BrachyPrimaryGeneratorAction* primary = new BrachyPrimaryGeneratorAction(); 92 96 pRunManager -> SetUserAction(primary); 93 94 // Initialize Optional User Action95 BrachyEventAction *pEventAction = new BrachyEventAction();96 pRunManager -> SetUserAction(pEventAction );97 97 98 98 BrachyRunAction *pRunAction = new BrachyRunAction(); … … 152 152 #endif 153 153 154 #ifdef G4UI_USE 155 G4UIExecutive * ui = new G4UIExecutive(argc,argv); 156 ui->SessionStart(); 157 delete ui; 158 #endif 159 154 160 // Job termination 155 161 #ifdef G4VIS_USE -
trunk/examples/advanced/brachytherapy/GNUmakefile
r1230 r1313 1 1 # -------------------------------------------------------------- 2 # $Id: GNUmakefile,v 1.1 3 2008/06/15 18:05:59 cirroneExp $2 # $Id: GNUmakefile,v 1.14 2010/01/11 14:27:29 gcosmo Exp $ 3 3 # -------------------------------------------------------------- 4 4 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 11 11 12 12 ifndef G4INSTALL 13 G4INSTALL = ../.. /..13 G4INSTALL = ../.. 14 14 endif 15 15 -
trunk/examples/advanced/brachytherapy/History
r807 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1. 21 2006/11/15 10:03:37 guatelliExp $2 $Id: History,v 1.31 2010/06/06 06:15:30 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 12 03 June 2010 - Joseph Perl; tag brachy-V09-03-01 13 Updated vis usage 14 15 01 Jun 2010 - G.A.P. Cirrone; tag brachy-V09-03-00 16 G4UIExecutiveand minor revisions 17 18 12 Nov 2009 - L. Pandola; tag brachy-V09-02-02 19 Fixed AIDA 20 21 12 Nov. 2009 - S. Guatelli; brachy-V09-02-01 22 - Update of Physics List 23 24 22.Feb 2009 - G.Folger; tag brachy-V09-02-00 25 - Correct compilation errors and warnings when G4ANALYSIS is NOT set 26 27 24.11.2008 -- G.A.P.Cirrone; tag: brachy-V09-01-03 28 Updated macro files 29 21.11.2008 -- G.A.P.Cirrone; Tag: brachy-V09-01-02 30 Corrected and updated macro files 31 32 15.06.2008 -- G.A.P.Cirrone; Tag: brachy-V09-01-01 33 Removed no more necessary AIDA commands from GNUmakefile 34 35 05th June 2008: G.A.P.Cirrone (cirrone@lns.infn.it). Tag version: brachy-V09-01-00 36 - Compilation error corrected in the BrachyAnalysiManager 37 - Bad type assignment in BrachyAnalysismanager 38 - Activated the generation .root files for output 39 11 40 15th November 2006 Susanna Guatelli (brachy-V08-01-01) 12 41 - Physics list cleaned. The cut is fixed to a value lower than the -
trunk/examples/advanced/brachytherapy/VisualisationMacro.mac
r807 r1313 1 # Use this open statement to create an OpenGL view: 2 /vis/open OGL 600x600-0+0 1 3 # 2 # Macro file for the visualisation 3 # create empty scene 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 6 #/vis/open DAWNFILE 4 7 # 5 /vis/scene/create 6 /vis/open OGLIX 7 #/vis/open VRML1 8 #/vis/open DAWNFILE 9 /vis/viewer/flush 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 10 11 # 11 # draw scene/ 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 14 #/vis/open VRML2FILE 12 15 # 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 13 20 # 14 # for drawing the tracks 15 /vis/viewer/set/viewpointThetaPhi 90 180 deg 16 /vis/viewer/zoom 1.4 17 /tracking/storeTrajectory 1 21 # Draw geometry: 22 /vis/drawVolume 23 # 24 # Specify view angle: 25 /vis/viewer/set/viewpointThetaPhi 90. 180. 26 # 27 # Specify zoom value: 28 /vis/viewer/zoom 7. 29 # 30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 32 # 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 1 m 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 43 # 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 18 61 /vis/scene/endOfEventAction accumulate 19 /vis/viewer/update 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush 69 20 70 ##/primary/energy Iodium 21 71 ##/source/switch Iodium 22 /vis/viewer/zoom 5 72 23 73 /run/beamOn 100 24 74 -
trunk/examples/advanced/composite_calorimeter/CompositeCalorimeter.cc
r1230 r1313 122 122 // visCommand = "/vis/open DAWNFILE"; 123 123 // visCommand = "/vis/open VRML2FILE"; 124 visCommand = "/vis/open OGL IX";124 visCommand = "/vis/open OGL"; 125 125 UI->ApplyCommand(visCommand); 126 126 -
trunk/examples/advanced/composite_calorimeter/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1.1 1 2008/06/15 18:13:06 cirroneExp $1 # $Id: GNUmakefile,v 1.12 2010/01/11 14:28:16 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /../11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/composite_calorimeter/History
r807 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.3 1 2006/11/14 14:39:51 ribonExp $2 $Id: History,v 1.35 2010/06/06 06:18:17 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Example History file 10 10 --------------------- 11 12 04.06.2010 - J.Perl (ccal-V09-03-00) 13 - Updated vis usage 14 15 12.11.2009 - A.Ribon (ccal-V09-02-01) 16 - Use QGSP_BIC_EMY as default Physics List to test the 17 low-energy electromagnetic. 18 19 22.02.2009 20 - G.Folger; Tag: ccal-V09-02-00 21 Fix compilation warnings in CCalRunAction.cc and CCalEndOfEventAction.cc 22 23 15.06.2008 24 - G.A.P.Cirrone; Tag: ccal-V09-01-00 25 Removed no more necessary AIDA commands from GNUmakefile 11 26 12 27 14.11.2006 - A.Ribon (ccal-V08-01-01) -
trunk/examples/advanced/composite_calorimeter/README
r807 r1313 1 1 ------------------------------------------------------------------- 2 $Id: README,v 1.1 2 2006/07/25 11:02:56 gcosmoExp $2 $Id: README,v 1.14 2010/06/06 06:18:17 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 236 236 237 237 By the default, one of the ufficial High Energy Physics List for 238 Calorimetry, QGSC, is used in this example. However, it is 239 very easy to use instead either LHEP or QGSP. To do so, it is 240 enough to comment/uncomment a line in the main CompositeCalorimeter.cc : 241 for example, if you want to use LHEP instead of the default QGSC 242 you have to change it as follows: 238 Calorimetry, QGSP_BIC_EMY, is used in this example, so that it 239 allows to test the low-energy electromagnetic. 240 However, it is very easy to use instead either LHEP, QGSP, or QGSC. 241 To do so, it is enough to comment/uncomment a line in the main 242 CompositeCalorimeter.cc : for example, if you want to use LHEP 243 instead of the default QGSP_BIC_EMY you have to change it as follows: 243 244 244 245 //***LOOKHERE*** CHOOSE THE PHYSICS LIST. 245 runManager->SetUserInitialization(new LHEP); // LHEP 246 // runManager->SetUserInitialization(new QGSP); // QGSP 247 // runManager->SetUserInitialization(new QGSC); // QGSC 246 runManager->SetUserInitialization(new LHEP); // LHEP 247 // runManager->SetUserInitialization(new QGSP); // QGSP 248 // runManager->SetUserInitialization(new QGSC); // QGSC 249 // runManager->SetUserInitialization(new QGSP_BIC_EMY); // QGSP_BIC_EMY 248 250 //***endLOOKHERE*** 249 251 … … 251 253 in which we don't even take into account the beam profile, noise 252 254 and digitization!) the faster LHEP Physics List would be good enough 253 for calorimetry studies. However, we prefer to use, as default, the 254 more sophisticated (but slower) QGSC Physics List for the learning 255 purposes of this example. 255 for calorimetry studies. 256 256 257 257 … … 438 438 Idle> /run/beamOn 3 439 439 440 Notice that, by default, OGL IXis used for the visualization,440 Notice that, by default, OGL is used for the visualization, 441 441 because it is quite fast and it does not produce any files in 442 442 output. However, you can always choose something else, for example … … 448 448 visCommand = "/vis/open DAWNFILE"; 449 449 // visCommand = "/vis/open VRML2FILE"; 450 // visCommand = "/vis/open OGL IX";450 // visCommand = "/vis/open OGL"; 451 451 452 452 The tracks that are shown include both charged and neutral particles -
trunk/examples/advanced/composite_calorimeter/src/CCalEndOfEventAction.cc
r1230 r1313 48 48 #include <map> 49 49 50 #include "G4TrajectoryContainer.hh"51 #include "G4Trajectory.hh"52 #include "G4VVisManager.hh"53 54 50 #ifdef G4ANALYSIS_USE 55 51 #include "CCalAnalysis.hh" … … 247 243 } 248 244 #endif 249 250 //A.R. Add to visualize tracks251 // extract the trajectories and draw them252 if (G4VVisManager::GetConcreteInstance()) {253 G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();254 G4int n_trajectories = 0;255 if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();256 for (G4int i=0; i<n_trajectories; i++) {257 G4Trajectory* trj = (G4Trajectory*) ((*(evt->GetTrajectoryContainer()))[i]);258 trj->DrawTrajectory(50); // Draw all tracks259 // if ( trj->GetCharge() != 0. ) trj->DrawTrajectory(50); // Draw only charged tracks260 // if ( trj->GetCharge() == 0. ) trj->DrawTrajectory(50); // Draw only neutral tracks261 }262 }263 264 245 } 265 246 -
trunk/examples/advanced/composite_calorimeter/test.g4mac
r807 r1313 16 16 /gun/energy 100 GeV 17 17 18 #/control/execute vis.mac 19 18 20 ### Simulate ten events 19 21 /run/beamOn 10 -
trunk/examples/advanced/cosmicray_charging/init.mac
r893 r1313 9 9 /vis/scene/create 10 10 # 11 11 12 # Create a scene handler for a specific graphics system 12 13 # (Edit the next line(s) to choose another graphic system) 13 /vis/open OGLSQT 14 #/vis/open OGLSX 15 #/vis/open OGLIX 16 #/vis/open OGLSXm 17 #/vis/open OGLIXm 18 #/vis/open DANWFILE 19 # 20 # Add detector to scene 21 /vis/drawVolume 22 # 23 # Flush visualization 24 #/vis/viewer/flush 25 # 26 /vis/viewer/set/lineSegmentsPerCircle 120 14 # 15 # Use this open statement to get an .eps and .prim files 16 # suitable for viewing in DAWN. 17 ###/vis/open DAWNFILE 18 # 19 # Use this open statement instead for OpenGL in immediate mode. 20 #/vis/open OGLIQt 450x420 21 # 22 # Use this open statement instead to get a HepRep version 1 file 23 # suitable for viewing in WIRED. 24 #/vis/open HepRepFile 25 # 26 # Use this open statement instead to get a HepRep version 2 file 27 # suitable for viewing in WIRED. 28 #/vis/open HepRepXML 29 # 30 # Output an empty detector 31 #/gun/energy 10 GeV 32 /vis/viewer/flush 33 # 34 # Draw trajectories at end of event, showing trajectory points as 35 # markers of size 2 pixels 36 /vis/scene/add/trajectories smooth 37 /vis/modeling/trajectories/create/drawByCharge 38 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 39 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 40 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 41 # 42 # To draw gammas only 43 #/vis/filtering/trajectories/create/particleFilter 44 #/vis/filtering/trajectories/particleFilter-0/add gamma 45 # 46 # To draw charged particles only 47 #/vis/filtering/trajectories/particleFilter-0/invert true 48 # 49 # Many other options available with /vis/modeling and /vis/filtering. 50 # For example, select colour by particle ID 51 #/vis/modeling/trajectories/create/drawByParticleID 52 #/vis/modeling/trajectories/drawByParticleID-0/set e- red 53 # 54 /vis/scene/endOfEventAction accumulate 55 # 56 # At end of each run, an automatic flush causes graphical output. 57 #/run/beamOn 1 58 # When you exit Geant4, you will find a file called scene-0.heprep.zip. 59 # Unzipping this will give you three separate HepRep files suitable for 60 # viewing in WIRED. 61 # The first file will contain just detector geometry. 62 # The second file will contain the detector plus one event. 63 # The third file will contain the detector plus ten events. 64 # $Id: vis.mac,v 1.7 2009/11/15 14:48:40 maire Exp $ 65 # 66 # Macro file for the initialization phase of "exampleN03.cc" 67 # when running in interactive mode 68 # 69 # Sets some default verbose 70 # 71 /control/verbose 2 72 /control/saveHistory 73 /run/verbose 2 74 # 75 # create empty scene 76 # 77 #/vis/scene/create 78 # 79 # Create a scene handler for a specific graphics system 80 # (Edit the next line(s) to choose another graphic system) 81 # 82 # Use this open statement to get an .eps and .prim files 83 # suitable for viewing in DAWN. 84 ###/vis/open DAWNFILE 85 # 86 # Use this open statement instead for OpenGL in immediate mode. 87 #/vis/open OGLIQt 450x420 88 # 89 # Use this open statement instead to get a HepRep version 1 file 90 # suitable for viewing in WIRED. 91 #/vis/open HepRepFile 92 # 93 # Use this open statement instead to get a HepRep version 2 file 94 # suitable for viewing in WIRED. 95 #/vis/open HepRepXML 96 # 97 # Output an empty detector 98 #/gun/energy 10 GeV 99 /vis/viewer/flush 100 # 101 # Draw trajectories at end of event, showing trajectory points as 102 # markers of size 2 pixels 103 /vis/scene/add/trajectories smooth 104 /vis/modeling/trajectories/create/drawByCharge 105 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 106 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 107 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 108 # 109 # To draw gammas only 110 #/vis/filtering/trajectories/create/particleFilter 111 #/vis/filtering/trajectories/particleFilter-0/add gamma 112 # 113 # To draw charged particles only 114 #/vis/filtering/trajectories/particleFilter-0/invert true 115 # 116 # Many other options available with /vis/modeling and /vis/filtering. 117 # For example, select colour by particle ID 118 #/vis/modeling/trajectories/create/drawByParticleID 119 #/vis/modeling/trajectories/drawByParticleID-0/set e- red 120 # 121 /vis/scene/endOfEventAction accumulate 122 # 123 # At end of each run, an automatic flush causes graphical output. 124 #/run/beamOn 1 125 # When you exit Geant4, you will find a file called scene-0.heprep.zip. 126 # Unzipping this will give you three separate HepRep files suitable for 127 # viewing in WIRED. 128 # The first file will contain just detector geometry. 129 # The second file will contain the detector plus one event. 130 # The third file will contain the detector plus ten events. 131 # $Id: vis.mac,v 1.7 2009/11/15 14:48:40 maire Exp $ 132 # 133 # Macro file for the initialization phase of "exampleN03.cc" 134 # when running in interactive mode 135 # 136 # Sets some default verbose 137 # 138 /control/verbose 2 139 /control/saveHistory 140 /run/verbose 2 141 # 142 # create empty scene 143 # 144 #/vis/scene/create 145 # 146 # Create a scene handler for a specific graphics system 147 # (Edit the next line(s) to choose another graphic system) 148 # 149 # Use this open statement to get an .eps and .prim files 150 # suitable for viewing in DAWN. 151 ###/vis/open DAWNFILE 152 # 153 # Use this open statement instead for OpenGL in immediate mode. 154 #/vis/open OGLIQt 450x420 155 # 156 # Use this open statement instead to get a HepRep version 1 file 157 # suitable for viewing in WIRED. 158 #/vis/open HepRepFile 159 # 160 # Use this open statement instead to get a HepRep version 2 file 161 # suitable for viewing in WIRED. 162 #/vis/open HepRepXML 163 # 164 # Output an empty detector 165 #/gun/energy 10 GeV 166 /vis/viewer/flush 167 # 168 # Draw trajectories at end of event, showing trajectory points as 169 # markers of size 2 pixels 170 /vis/scene/add/trajectories smooth 171 /vis/modeling/trajectories/create/drawByCharge 172 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 173 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 174 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 175 # 176 # To draw gammas only 177 #/vis/filtering/trajectories/create/particleFilter 178 #/vis/filtering/trajectories/particleFilter-0/add gamma 179 # 180 # To draw charged particles only 181 #/vis/filtering/trajectories/particleFilter-0/invert true 182 # 183 # Many other options available with /vis/modeling and /vis/filtering. 184 # For example, select colour by particle ID 185 #/vis/modeling/trajectories/create/drawByParticleID 186 #/vis/modeling/trajectories/drawByParticleID-0/set e- red 187 # 188 /vis/scene/endOfEventAction accumulate 189 # 190 # At end of each run, an automatic flush causes graphical output. 191 #/run/beamOn 1 192 # When you exit Geant4, you will find a file called scene-0.heprep.zip. 193 # Unzipping this will give you three separate HepRep files suitable for 194 # viewing in WIRED. 195 # The first file will contain just detector geometry. 196 # The second file will contain the detector plus one event. 197 # The third file will contain the detector plus ten events. 198 ################################################################# 199 # Shoots 1 GeV protons randomly from generator surface 200 ################################################################# 201 # 202 /vis/enable 203 /tracking/storeTrajectory 1 204 /control/verbose 1 205 /run/verbose 1 206 /event/verbose 0 207 # 208 /control/suppressAbortion 1 209 # 210 # Random seeds 211 #/run/autoSeed 1 212 /random/resetEngineFrom seeds.rndm 213 # 214 # particle surveys 215 #/surveys/surveyParticles 1 216 #/surveys/surveyPrimaries 1 217 #/surveys/surveyTestMasses 1 218 # 219 /gps/particle proton 220 /gps/energy 1 GeV 221 # 222 # Isotropic distribution 223 /gps/pos/type Surface 224 /gps/pos/shape Sphere 225 /gps/pos/radius 1499. mm 226 /gps/pos/centre 0. 0. 0. mm 227 /gps/ang/type cos 228 # 229 /run/beamOn 10 -
trunk/examples/advanced/gammaray_telescope/GNUmakefile
r807 r1313 1 # $Id: GNUmakefile,v 1.2 4 2006/11/17 15:49:35 flongo Exp $1 # $Id: GNUmakefile,v 1.25 2010/01/11 14:29:03 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/gammaray_telescope/History
r807 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1. 4 2005/12/07 10:50:31 guatelliExp $2 $Id: History,v 1.7 2010/06/06 06:18:54 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 History file 10 10 ------------ 11 07-12-2005 - Susanna Guatelli (gammaraytel-V07-01-00) 12 - GammaRayParticles introduced 13 - G4Exception deriving from Hadronic Physics List deleted 11 03.06.2010 Joseph Perl, Tag: gammaraytel-V09-03-00 12 Update vis usage 14 13 15 3rd May 2005 John Allison (examples-V07-00-03) 16 - Replaced vis manager with G4VisExecutive. 14 24.11.2008 G.A.P.Cirrone, Tag: gammaraytel-V09-01-02 15 Updated History file 17 16 18 10.12.2004 - Gabriele Cosmo (gammaraytel-V06-02-01) 17 24.11.2008 G.A.P.Cirrone, Tag: gammaraytel-V09-01-01 18 Fixed compilation problems 19 20 11.06.2008 G.A.P.Cirrone (gammaraytel-V09-01-00) 21 Fixed errors in compilation 22 23 07-12-2005 Susanna Guatelli (gammaraytel-V07-01-00) 24 GammaRayParticles introduced 25 G4Exception deriving from Hadronic Physics List deleted 26 27 3rd May 2005 John Allison (examples-V07-00-03) 28 Replaced vis manager with G4VisExecutive. 29 30 10.12.2004 Gabriele Cosmo (gammaraytel-V06-02-01) 19 31 Replaced usage of M_PI with CLHEP's pi. 20 32 21 01.12.2004 -Francesco Longo (gammaraytel-V06-02-00)33 01.12.2004 Francesco Longo (gammaraytel-V06-02-00) 22 34 Updates and migration to <cmath>. 23 35 24 01.06.2004 -Susanna Guatelli36 01.06.2004 Susanna Guatelli 25 37 Migration to AIDA 3.2.1 and PI 1.2.1. -
trunk/examples/advanced/gammaray_telescope/macro1.mac
r1230 r1313 28 28 #/payload/update 29 29 30 # Use this open statement to create an OpenGL view: 31 /vis/open OGL 600x600-0+0 30 32 # 31 # Create a scene handler for a specific graphics system 32 /vis/open OGLSX 33 # Use this open statement to create a .prim file suitable for 34 # viewing in DAWN: 35 #/vis/open DAWNFILE 36 # 37 # Use this open statement to create a .heprep file suitable for 38 # viewing in HepRApp: 33 39 #/vis/open HepRepFile 34 35 /vis/viewer/reset 36 /vis/viewer/set/viewpointThetaPhi 90 0 37 38 # Visualize of the whole detector geometry 40 # 41 # Use this open statement to create a .wrl file suitable for 42 # viewing in a VRML viewer: 43 #/vis/open VRML2FILE 44 # 45 # Disable auto refresh and quieten vis messages whilst scene and 46 # trajectories are established: 47 /vis/viewer/set/autoRefresh false 48 /vis/verbose errors 49 # 50 # Draw geometry: 39 51 /vis/drawVolume 40 41 # for drawing the tracks42 # if too many tracks cause core dump => storeTrajectory 043 /tracking/storeTrajectory 144 45 52 # 46 # Flush visualization 47 /vis/viewer/update 53 # Specify view angle: 54 /vis/viewer/set/viewpointThetaPhi 90. 0. 55 # 56 # Specify zoom value: 57 #/vis/viewer/zoom 2. 58 # 59 # Specify style (surface or wireframe): 60 #/vis/viewer/set/style wireframe 61 # 62 # Draw coordinate axes: 63 #/vis/scene/add/axes 0 0 0 1 m 64 # 65 # Draw smooth trajectories at end of event, showing trajectory points 66 # as markers 2 pixels wide: 67 /vis/scene/add/trajectories smooth 68 /vis/modeling/trajectories/create/drawByCharge 69 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 70 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 71 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 72 # 73 # Draw hits at end of event: 74 #/vis/scene/add/hits 75 # 76 # To draw only gammas: 77 #/vis/filtering/trajectories/create/particleFilter 78 #/vis/filtering/trajectories/particleFilter-0/add gamma 79 # 80 # To invert the above, drawing all particles except gammas, 81 # keep the above two lines but also add: 82 #/vis/filtering/trajectories/particleFilter-0/invert true 83 # 84 # Many other options are available with /vis/modeling and /vis/filtering. 85 # For example, to select colour by particle ID: 86 #/vis/modeling/trajectories/create/drawByParticleID 87 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 88 # 89 # To superimpose all of the events from a given run: 90 #/vis/scene/endOfEventAction accumulate 91 # 92 # Re-establish auto refreshing and verbosity: 93 /vis/viewer/set/autoRefresh true 94 /vis/verbose warnings 95 # 96 # For file-based drivers, use this to create an empty detector view: 97 #/vis/viewer/flush 48 98 49 99 # run 10 events -
trunk/examples/advanced/gammaray_telescope/macro2.mac
r1230 r1313 32 32 /payload/update 33 33 34 34 # Use this open statement to create an OpenGL view: 35 #/vis/open OGL 600x600-0+0 35 36 # 36 # Create a scene handler for a specific graphics system 37 # Use this open statement to create a .prim file suitable for 38 # viewing in DAWN: 39 #/vis/open DAWNFILE 40 # 41 # Use this open statement to create a .heprep file suitable for 42 # viewing in HepRApp: 43 #/vis/open HepRepFile 44 # 45 # Use this open statement to create a .wrl file suitable for 46 # viewing in a VRML viewer: 37 47 /vis/open VRML2FILE 38 #/vis/open OGLIX 39 40 /vis/viewer/reset 41 /vis/viewer/set/viewpointThetaPhi 90 0 42 43 # Visualize of the whole detector geometry 48 # 49 # Disable auto refresh and quieten vis messages whilst scene and 50 # trajectories are established: 51 /vis/viewer/set/autoRefresh false 52 /vis/verbose errors 53 # 54 # Draw geometry: 44 55 /vis/drawVolume 45 46 # for drawing the tracks47 # if too many tracks cause core dump => storeTrajectory 048 /tracking/storeTrajectory 149 50 56 # 51 # Flush visualization 52 /vis/viewer/update 57 # Specify view angle: 58 /vis/viewer/set/viewpointThetaPhi 90. 0. 59 # 60 # Specify zoom value: 61 #/vis/viewer/zoom 2. 62 # 63 # Specify style (surface or wireframe): 64 #/vis/viewer/set/style wireframe 65 # 66 # Draw coordinate axes: 67 #/vis/scene/add/axes 0 0 0 1 m 68 # 69 # Draw smooth trajectories at end of event, showing trajectory points 70 # as markers 2 pixels wide: 71 /vis/scene/add/trajectories smooth 72 /vis/modeling/trajectories/create/drawByCharge 73 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 74 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 75 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 76 # 77 # Draw hits at end of event: 78 #/vis/scene/add/hits 79 # 80 # To draw only gammas: 81 #/vis/filtering/trajectories/create/particleFilter 82 #/vis/filtering/trajectories/particleFilter-0/add gamma 83 # 84 # To invert the above, drawing all particles except gammas, 85 # keep the above two lines but also add: 86 #/vis/filtering/trajectories/particleFilter-0/invert true 87 # 88 # Many other options are available with /vis/modeling and /vis/filtering. 89 # For example, to select colour by particle ID: 90 #/vis/modeling/trajectories/create/drawByParticleID 91 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 92 # 93 # To superimpose all of the events from a given run: 94 #/vis/scene/endOfEventAction accumulate 95 # 96 # Re-establish auto refreshing and verbosity: 97 /vis/viewer/set/autoRefresh true 98 /vis/verbose warnings 99 # 100 # For file-based drivers, use this to create an empty detector view: 101 #/vis/viewer/flush 53 102 54 103 /run/beamOn 10 -
trunk/examples/advanced/gammaray_telescope/macro3.mac
r1230 r1313 26 26 #/payload/update 27 27 28 # Use this open statement to create an OpenGL view: 29 #/vis/open OGL 600x600-0+0 28 30 # 29 # Create a scene handler for a specific graphics system31 # Use this open statement to create a DAWN view: 30 32 /vis/open DAWN 33 # 34 # Use this open statement to create a .heprep file suitable for 35 # viewing in HepRApp: 31 36 #/vis/open HepRepFile 32 33 /vis/viewer/reset 34 /vis/viewer/set/viewpointThetaPhi 90 0 35 36 # Visualize of the whole detector geometry 37 # 38 # Use this open statement to create a .wrl file suitable for 39 # viewing in a VRML viewer: 40 #/vis/open VRML2FILE 41 # 42 # Disable auto refresh and quieten vis messages whilst scene and 43 # trajectories are established: 44 /vis/viewer/set/autoRefresh false 45 /vis/verbose errors 46 # 47 # Draw geometry: 37 48 /vis/drawVolume 38 39 # for drawing the tracks40 # if too many tracks cause core dump => storeTrajectory 041 /tracking/storeTrajectory 142 43 49 # 44 # Flush visualization 45 /vis/viewer/update 50 # Specify view angle: 51 /vis/viewer/set/viewpointThetaPhi 90. 0. 52 # 53 # Specify zoom value: 54 #/vis/viewer/zoom 2. 55 # 56 # Specify style (surface or wireframe): 57 #/vis/viewer/set/style wireframe 58 # 59 # Draw coordinate axes: 60 #/vis/scene/add/axes 0 0 0 1 m 61 # 62 # Draw smooth trajectories at end of event, showing trajectory points 63 # as markers 2 pixels wide: 64 /vis/scene/add/trajectories smooth 65 /vis/modeling/trajectories/create/drawByCharge 66 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 67 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 68 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 69 # 70 # Draw hits at end of event: 71 #/vis/scene/add/hits 72 # 73 # To draw only gammas: 74 #/vis/filtering/trajectories/create/particleFilter 75 #/vis/filtering/trajectories/particleFilter-0/add gamma 76 # 77 # To invert the above, drawing all particles except gammas, 78 # keep the above two lines but also add: 79 #/vis/filtering/trajectories/particleFilter-0/invert true 80 # 81 # Many other options are available with /vis/modeling and /vis/filtering. 82 # For example, to select colour by particle ID: 83 #/vis/modeling/trajectories/create/drawByParticleID 84 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 85 # 86 # To superimpose all of the events from a given run: 87 #/vis/scene/endOfEventAction accumulate 88 # 89 # Re-establish auto refreshing and verbosity: 90 /vis/viewer/set/autoRefresh true 91 /vis/verbose warnings 92 # 93 # For file-based drivers, use this to create an empty detector view: 94 #/vis/viewer/flush 46 95 47 96 # run 10 events -
trunk/examples/advanced/gammaray_telescope/src/GammaRayTelEventAction.cc
r1230 r1313 25 25 // 26 26 // 27 // $Id: GammaRayTelEventAction.cc,v 1. 19 2006/06/29 15:56:39 gunterExp $28 // GEANT4 tag $Name: geant4-09-0 3-cand-01$27 // $Id: GammaRayTelEventAction.cc,v 1.20 2010/06/06 06:18:54 perl Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-00 $ 29 29 // ------------------------------------------------------------ 30 30 // GEANT 4 class implementation file … … 54 54 #include "G4HCofThisEvent.hh" 55 55 #include "G4VHitsCollection.hh" 56 #include "G4TrajectoryContainer.hh"57 #include "G4Trajectory.hh"58 #include "G4VVisManager.hh"59 56 #include "G4SDManager.hh" 60 57 #include "G4UImanager.hh" … … 243 240 } 244 241 } 245 246 if(G4VVisManager::GetConcreteInstance()) { 247 for(G4int i=0; i<n_trajectories; i++) { 248 G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]); 249 if (drawFlag == "all") trj->DrawTrajectory(50); 250 else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.)) 251 trj->DrawTrajectory(50); 252 } 253 } 254 } 255 256 257 258 259 260 261 262 263 264 265 266 267 242 } 243 244 245 246 247 248 249 250 251 252 253 254 255 -
trunk/examples/advanced/hadrontherapy/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1.1 2 2009/08/13 20:48:04 kaitanie Exp $1 # $Id: GNUmakefile,v 1.17 2010/05/18 11:14:39 cirrone Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 8 8 G4EXLIB := true 9 9 10 # Debug info 11 #CPPFLAGS += -g 12 10 13 ifndef G4INSTALL 11 G4INSTALL = ../.. /..14 G4INSTALL = ../.. 12 15 endif 13 16 … … 17 20 include $(G4INSTALL)/config/architecture.gmk 18 21 19 ifdef G4ANALYSIS_USE 20 CPPFLAGS += -DANALYSIS_USE 21 endif 22 ifndef G4ANALYSIS_USE # If we don't have AIDA 23 ifdef G4ANALYSIS_USE_ROOT # And we have ROOT 24 CPPFLAGS += -DANALYSIS_USE -DG4ANALYSIS_USE_ROOT 22 ifdef G4ANALYSIS_USE_ROOT # If we have ROOT 23 CPPFLAGS += -DG4ANALYSIS_USE_ROOT 25 24 CPPFLAGS += $(shell root-config --cflags) 26 25 LDFLAGS += $(shell root-config --glibs) 27 endif28 26 endif 29 27 30 28 include $(G4INSTALL)/config/binmake.gmk 31 29 32 ifdef G4ANALYSIS_USE33 endif -
trunk/examples/advanced/hadrontherapy/Hadrontherapy.cc
r1230 r1313 24 24 // ******************************************************************** 25 25 // 26 // Hadrontherapy.cc 27 // 28 // Main of the Hadrontherapy example; 29 // Released with the Geant4 9.3 version (December 2009) 30 // 31 // Last modified: G.A.P.Cirrone 32 // 26 // This is the *basic* version of Hadrontherapy, a Geant4-based application 33 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 34 28 // 29 // To obtain the full version visit the pages: http://sites.google.com/site/hadrontherapy/ 30 35 31 // ---------------------------------------------------------------------------- 36 32 // GEANT 4 - Hadrontherapy example 37 33 // ---------------------------------------------------------------------------- 38 // Code developed by:34 // Main Authors: 39 35 // 40 36 // G.A.P. Cirrone(a)°, G.Cuttone(a), F.Di Rosa(a), E.Mazzaglia(a), F.Romano(a) 41 37 // 42 38 // Contributor authors: 43 // P.Kaitaniemi(d), A.Heikkinen(d), G illisDanielsen (d)39 // P.Kaitaniemi(d), A.Heikkinen(d), G.Danielsen (d) 44 40 // 45 41 // Past authors: … … 101 97 #endif 102 98 99 #ifdef G4UI_USE 100 #include "G4UIExecutive.hh" 101 #endif 103 102 ////////////////////////////////////////////////////////////////////////////////////////////// 103 104 104 int main(int argc ,char ** argv) 105 105 { 106 // Set the Random engine 107 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine()); 108 109 G4RunManager* runManager = new G4RunManager; 110 111 //Initialize possible analysis needs, needs to come early in order to pick up metadata 112 #ifdef ANALYSIS_USE 113 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance(); 114 analysis -> book(); 115 #endif 116 // Geometry controller is responsible for instantiating the 117 // geometries. All geometry specific setup tasks are now in class 118 // HadrontherapyGeometryController. 119 HadrontherapyGeometryController *geometryController = new HadrontherapyGeometryController(); 120 121 // Connect the geometry controller to the G4 user interface 122 HadrontherapyGeometryMessenger *geometryMessenger = new HadrontherapyGeometryMessenger(geometryController); 123 124 G4ScoringManager *scoringManager = G4ScoringManager::GetScoringManager(); 125 scoringManager->SetVerboseLevel(1); 126 scoringManager->SetScoreWriter(new IAEAScoreWriter()); 127 128 // Initialize the default Hadrontherapy geometry 129 geometryController->SetGeometry("default"); 130 131 // Initialize command based scoring 132 G4ScoringManager::GetScoringManager(); 133 134 // Initialize the physics 135 runManager -> SetUserInitialization(new HadrontherapyPhysicsList()); 136 137 // Initialize the primary particles 138 HadrontherapyPrimaryGeneratorAction *pPrimaryGenerator = new HadrontherapyPrimaryGeneratorAction(); 139 runManager -> SetUserAction(pPrimaryGenerator); 140 141 // Optional UserActions: run, event, stepping 142 HadrontherapyRunAction* pRunAction = new HadrontherapyRunAction(); 143 runManager -> SetUserAction(pRunAction); 144 145 HadrontherapyEventAction* pEventAction = new HadrontherapyEventAction(); 146 runManager -> SetUserAction(pEventAction); 147 148 HadrontherapySteppingAction* steppingAction = new HadrontherapySteppingAction(pRunAction); 149 runManager -> SetUserAction(steppingAction); 150 151 // Interaction data: stopping powers 152 HadrontherapyInteractionParameters* pInteraction = new HadrontherapyInteractionParameters(); 153 106 // Set the Random engine 107 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine()); 108 109 // Only if an initial random seed is needed 110 // G4int seed = time(0); 111 // CLHEP::HepRandom::setTheSeed(seed); 112 113 G4RunManager* runManager = new G4RunManager; 114 // Geometry controller is responsible for instantiating the 115 // geometries. All geometry specific setup tasks are now in class 116 // HadrontherapyGeometryController. 117 HadrontherapyGeometryController *geometryController = new HadrontherapyGeometryController(); 118 119 // Connect the geometry controller to the G4 user interface 120 HadrontherapyGeometryMessenger *geometryMessenger = new HadrontherapyGeometryMessenger(geometryController); 121 122 G4ScoringManager *scoringManager = G4ScoringManager::GetScoringManager(); 123 scoringManager->SetVerboseLevel(1); 124 scoringManager->SetScoreWriter(new IAEAScoreWriter()); 125 126 // Initialize the default Hadrontherapy geometry 127 geometryController->SetGeometry("default"); 128 129 // Initialize command based scoring 130 G4ScoringManager::GetScoringManager(); 131 132 // Initialize the physics 133 runManager -> SetUserInitialization(new HadrontherapyPhysicsList()); 134 135 // Initialize the primary particles 136 HadrontherapyPrimaryGeneratorAction *pPrimaryGenerator = new HadrontherapyPrimaryGeneratorAction(); 137 runManager -> SetUserAction(pPrimaryGenerator); 138 139 // Optional UserActions: run, event, stepping 140 HadrontherapyRunAction* pRunAction = new HadrontherapyRunAction(); 141 runManager -> SetUserAction(pRunAction); 142 143 HadrontherapyEventAction* pEventAction = new HadrontherapyEventAction(); 144 runManager -> SetUserAction(pEventAction); 145 146 HadrontherapySteppingAction* steppingAction = new HadrontherapySteppingAction(pRunAction); 147 runManager -> SetUserAction(steppingAction); 148 149 // Interaction data: stopping powers 150 HadrontherapyInteractionParameters* pInteraction = new HadrontherapyInteractionParameters(true); 151 154 152 #ifdef G4VIS_USE 155 // Visualization manager156 G4VisManager* visManager = new G4VisExecutive;157 visManager -> Initialize();153 // Visualization manager 154 G4VisManager* visManager = new G4VisExecutive; 155 visManager -> Initialize(); 158 156 #endif 159 160 G4UImanager* UI = G4UImanager::GetUIpointer(); 161 162 if (argc!=1) // batch mode 163 { 164 G4String command = "/control/execute "; 165 G4String fileName = argv[1]; 166 UI->ApplyCommand(command+fileName); 167 } 168 169 else // interactive mode : define visualization UI terminal 170 { 171 G4UIsession* session = 0; 172 173 // If the enviroment variable for the TCSH terminal is active, it is used and the 174 // defaultMacro.mac file is executed 157 158 G4UImanager* UI = G4UImanager::GetUIpointer(); 159 160 // Batch mode: in this configuration, i.e. when the User explicitly call a macro file, 161 // the program run and, at the end, authomatically call the exit state. 162 // With a such configuration, it is possible to send in background a simulation 163 // and correctly get the output file. 164 if (argc!=1) 165 { 166 G4UIsession* session = 0; 167 G4String command = "/control/execute "; 168 G4String fileName = argv[1]; 169 UI -> ApplyCommand(command+fileName); 175 170 #if defined(G4UI_USE_TCSH) 176 session = new G4UIterminal(new G4UItcsh); 177 UI->ApplyCommand("/control/execute defaultMacro.mac"); 178 179 // Alternatively (if G4UI_USE_TCSH is not defined) the program search for the 180 // G$UI_USE_QT variable. It starts a graphical user interface based on the QT libraries 181 // In the following case the GUI.mac file is also executed 182 // 171 session = new G4UIterminal(new G4UItcsh); 172 #else 173 session = new G4UIterminal(); 174 #endif 175 // Only if the User Interface is needed! 176 //session -> SessionStart(); 177 //delete session; 178 } 179 else // interactive mode : define visualization UI terminal 180 { 181 G4UIsession* session = 0; 182 183 // If the enviroment variable for the TCSH terminal is active, it is used and the 184 // defaultMacro.mac file is executed 185 #if defined(G4UI_USE_TCSH) 186 session = new G4UIterminal(new G4UItcsh); 187 UI->ApplyCommand("/control/execute defaultMacro.mac"); 188 session -> SessionStart(); 189 190 // Alternatively (if G4UI_USE_TCSH is not defined) the program search for the 191 // G4UI_USE_QT variable. It starts a graphical user interface based on the QT libraries 192 // In the following case the GUI.mac file is also executed 183 193 #elif defined(G4UI_USE_QT) 184 session = new G4UIQt(argc,argv);185 UI->ApplyCommand("/control/execute macro/GUI.mac");186 187 // As final option, the simpleruser interface terminal is opened194 session = new G4UIQt(argc,argv); 195 UI->ApplyCommand("/control/execute macro/GUI.mac"); 196 session -> SessionStart(); 197 // As final option, the basic user interface terminal is opened 188 198 #else 189 session = new G4UIterminal(); 190 UI->ApplyCommand("/control/execute defaultMacro.mac"); 191 #endif 192 session->SessionStart(); 193 delete session; 194 } 195 HadrontherapyMatrix* matrix = HadrontherapyMatrix::getInstance(); 196 if (matrix) matrix -> TotalEnergyDeposit(); 197 198 #ifdef ANALYSIS_USE 199 analysis -> finish(); 200 #endif 201 202 // Job termination 203 #ifdef G4VIS_USE 204 delete visManager; 199 session = new G4UIterminal(); 200 201 UI -> ApplyCommand("/control/execute defaultMacro.mac"); 202 session -> SessionStart(); 203 #endif 204 delete session; 205 } 206 207 // Job termination 208 #ifdef G4ANALYSIS_USE_ROOT 209 HadrontherapyAnalysisManager::GetInstance() -> flush(); // Finalize the root file 210 #endif 211 212 #ifdef G4UI_USE 213 G4UIExecutive * ui = new G4UIExecutive(argc,argv); 214 ui->SessionStart(); 215 delete ui; 205 216 #endif 206 217 … … 210 221 delete runManager; 211 222 return 0; 223 212 224 } -
trunk/examples/advanced/hadrontherapy/History
r1230 r1313 8 8 History file of the Hadrontherapy application 9 9 ==================================================== 10 11 25.11.2009 S.E.Mazzaglia & F.Romano; Tag:Hadrontherapy-V09-02-40 10 03.06.2010 J.Perl; Tag: Hadrontherapy-V09-03-04 11 - Updated vis usage 12 13 01.06.2010: G.A.P.Cirrone; Tag: harontherapy-V09-03-03 14 - Added G4UIExecutive 15 - Main file updated 16 17 22.05.2010 S.E.Mazzaglia; Tag: hadrontherapy-V09-03-02 18 - Updated ROOT scripts in folder RootScripts/proton/BraggPeak 19 20 21.05.2010 S.E.Mazzaglia; Tag: hadrontherapy-V09-03-01 21 - Solved some bugs related to the preprocessor variable G4ANALYSIS_USE_ROOT. 22 23 18.05.2010 S.E.Mazzaglia; Tag: hadrontherapy-V09-03-00 24 - Removed the possibility to calculate Let. 25 - Removed AIDA and variables: G4_ANALYSIS_USE and ANALYSIS_USE. 26 - Improved the commands to modify phantom/detector geometry 27 - Added a command to set cuts just only in the detector: /physic/setDetectorCuts 28 - Added the possibility to store dose & fluence for all secondaries 29 produced in the same ASCII file. This feature can be switched on by the macro 30 command: /analysis/secondaries true. 31 32 33 16.12.2009 S.E.Mazzaglia; Tag: hadrontherapy-V09-02-42 34 - Added the possibility to calculate the Let too, using an ASCII file to store it. 35 - Added the new class HadrontherapyLet. 36 - Minor revisions of the code. 37 38 27.11.2009 S.E.Mazzaglia; Tag: hadrontherapy-V09-02-41 39 - Added the possibility to store dose and fluence for every particle/ion 40 produced during the simulation 41 42 25.11.2009 S.E.Mazzaglia & F.Romano; Tag: hadrontherapy-V09-02-40 12 43 - Corrected a bug in HadrontherapyDetectorConstruction class 13 - Added G4Radiactive DecayPhysics class to the Physics List.14 15 22.11.2009 S.E.Mazzaglia; Tag: Hadrontherapy-V09-02-3944 - Added G4RadiactivedecayPhysics class to the Physics List. 45 46 22.11.2009 S.E.Mazzaglia; Tag: hadrontherapy-V09-02-39 16 47 - Correction in the initialization of the passiveProtonBeamLine class. 17 48 -
trunk/examples/advanced/hadrontherapy/README
r807 r1313 1 1 2 ========================================================= 3 Geant4 - Hadrontherapy example 4 ========================================================= 5 6 README file 7 ---------------------- 8 9 AUTHORS 10 11 G.A.P. CIRRONE(a *), G.CUTTONE(a), F. DI ROSA(a), G.RUSSO(a) 12 a. Laboratori Nazionali del Sud - Istituto Nazionale di Fisica Nucleare 13 95123 Catania, Italy 14 * e-mail:cirrone@lns.infn.it 15 16 M.G. PIA(b) 17 b. Istituto Nazionale di Fisica Nucleare, Sezione di Genova Via Dodecaneso, 33 18 16146, Genova, Italy 19 20 A. LECHNER (c) 21 c. CERN, Switzerland 22 23 More informations on the Hadrontherapy example can be found in the 24 Hadrontherapy Documentation available at http://www.ge.infn.it/geant4/examples/ 25 26 Alternatevely send an e-mail to cirrone@lns.infn.it. 27 28 29 ---->0. INTRODUCTION. 30 31 The hadrontherapy example simulates a hadron therapy beam line. 32 In particular the example models the specific proton therapy beam line 33 installed at Laboratori Nazionali del Sud (INFN) in Catania, Sicily (Italy). 34 For more information on the proton therapy center of Catania 35 or/and proton/hadron therapy in general, please visit the 36 pages: 37 http://www.lns.infn.it/catanaweb/catana/ 38 39 ---->1. GEOMETRY SET-UP. 2 ========================================================= 3 Text version of the Hadrontherapy README file 4 ========================================================= 5 6 Last revsion: G.A.P.Cirrone, November 2009; 7 Released with the Geant4 9.3 version (December 2009) 8 9 ------------------------------------------------------------------------------------------------ 10 ADVERTISEMENT: this is the text version of the README file of the hadrontherapy application, 11 as it has been released in the official Geant4 9.3 release 12 13 A more complete and updated version of this file is published inside the web pages of Hadrontherapy: 14 http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 15 16 Please refer to the web-published version to know the last and future developments of hadrontherapy 17 ------------------------------------------------------------------------------------------------- 18 19 ========================================================= 20 HADRONTHERAPY 21 ========================================================= 22 23 Code developed by: 24 G.A.P. Cirrone(a)°, G.Cuttone(a), F.Di Rosa(a), S.E.Mazzaglia(a), F.Romano(a) 40 25 41 The elements simulated are: 26 Contributor authors: 27 P.Kaitaniemi(d), A.Heikkinen(d), G.Danielsen (d) 28 29 Past authors: 30 M.G.Pia(b), S.Guatelli(c), G.Russo(a), M.Russo(a), A.Lechner(e) 31 32 (a) Laboratori Nazionali del Sud 33 of the INFN, Catania, Italy 34 35 (b) INFN Section of Genova, Italy 36 37 (c) University of Wallongong, Australia 38 39 (d) Helsinki Institute of Physics, Helsinki, Finland 40 41 (e) CERN, (CH) 42 43 *Corresponding author, email to cirrone@lns.infn.it 44 ------------------------------------------------------------------------------------------------- 45 46 HADRONTHERAPY: 47 WHAT IT IS, WHAT IT DOES AND WHAT IT WILL PROVIDE 48 Hadrontherapy is a Geant4-based application specifically developed to address typical needs related to the proton and ion therapy. 49 It first release was in 2004. At that time Hadrontherapy was only capable to simulate a well specified proton therapy facility: the passive transport beam line installed at Laboratori Nazionali del Sud (INFN) in Catania, Italy. 50 51 Today Hadrontontherapy, except that it is in continuous development, is more flexible and show many additional capabilities as respect the past. 52 Its geometrical set-up, for example, is now completely interchangeable permitting a simple switch between different geometrical configurations. 53 In the actual version two geometrical configuration are available: the 'passive beam line' 54 and the 'IAEA Benchmark' geometry. See the paragraph Geometry set-up for more information. 55 Folder structure of Hadrontherapy 56 Hadrontherapy distribution contain different sub-folders: 57 58 \src: where source .cc files are stored 59 \include: where header .hh files are stored 60 \macro: where a set of ready-to-use macro files are provided 61 \experimentalData: in this director a set of reference (both experimental and analithycal) data are stored. These data are then used to perform a direct comparison with simulation results that are stored in the simulationResults folder. Data stored are better described in the README file contained inside. 62 \SimulationOutputs: when one of the .mac file contained in the macro folder is used, simulation results are directly stored in this directory. 63 \RootScripts: if the ROOT program is installed the User can use the scripts contained in this directory to compare directly results from the his/her simulation with reference data provided inside the experimentalData folder. 64 65 Currently this folders structure is in development and reference data as well as ROOT scripts will be added in the meanwhile new features and capabilities will be added. Moreover some ROOT script can be missed. Apologize for this and contact author if you need more information, clarification or useful discussion. 66 Description of the \macro folder 67 In the example directory, inside the "macro" folder two macro files are actually provided for the use of hadrontherapy with proton and carbon beams: proton_therapy.mac and ion_therapy.mac. 68 The proton_therapy.mac permits to run a simulation with the whole passive beam line installed in Catania. 69 The carbon_therapy.mac excludes all the elements (moving the origin of the ion beam close to the water phantom) and reproduce a simple passive beam line for the use with carbon beams. 70 The macro iaea.mac uses an alternative geometry that was created for the IAEA benchmark. It features a geometry with water target, aluminum beam window, and a particle detector behind the target. 71 72 73 DOWNLOAD AND INSTALLATION 74 Hadrontherapy source code is actually released inside the official distribution of the Geant4 toolkit in the $G4INSTALL/examples/AdvancedExamples folder. 75 76 To run Hadrontherapy you must first install the Geant4 package. Once Geant4 is installed the example must be first compiled (with the command gmake inside the 77 ../Hadrontherapy folder). When compilation is completed the program can be executed. 78 79 A complete guide for the Geant4 installation in different operating systems can be found inside the official installation Geant4 pages. 80 81 If you have troubles with the Geant4 installation please send an e-mail to us. 82 83 84 SISTEM SET-UP: enviroment variables 85 A standard Geant4 example GNUmakefile is provided 86 87 The following section reports the environment variables that are necessary for the run of Hadrontherapy. 88 #------------------------------------- 89 # SET UP LINUX GCC 90 #------------------------------------- 91 92 VERSION="geant4-09-03" 93 94 # Path to the directory in wich you have put data files and CLHEP 95 LIBPATH=$HOME/Geant4Library 96 97 export G4SYSTEM=Linux-g++ 98 99 # Path to the directory in wich you put your Geant4 installation 100 export G4INSTALL=$HOME/${VERSION} 101 102 export G4LIB=$G4INSTALL/lib 103 export G4WORKDIR=$G4INSTALL/workdir 104 export G4EXE=$G4WORKDIR/bin/$G4SYSTEM 105 106 export CLHEP_BASE_DIR=$LIBPATH/CLHEP2.0.4.5 107 export G4LEDATA=$LIBPATH/G4EMLOW6.9 108 export G4LEVELGAMMADATA=$LIBPATH/PhotonEvaporation2.0 109 export G4NEUTRONHPDATA=$LIBPATH/G4NDL3.13 110 export G4RADIOACTIVEDATA=$LIBPATH/RadioactiveDecay3.2 111 export G4ABLADATA=$LIBPATH/G4ABLA3.0 112 113 export LD_LIBRARY_PATH=$CLHEP_BASE_DIR/lib:$LD_LIBRARY_PATH 114 115 # For the generation .root file directly using the ROOT (if ROOT is 116 # instaled in you machine) 117 export G4ANALYSIS_USE_ROOT=1 118 export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH 119 120 #------------------------------------- 121 # SET UP VRML VIEW 122 #------------------------------------- 123 export G4VIS_BUILD_VRML_DRIVER=1 124 export G4VIS_USE_VRML=1 125 export G4VIS_USE_VRMLFILE=1 126 export G4VRMLFILE_MAX_FILE_NUM=100 127 export G4VRMLFILE_VIEWER=vrmlview #if installed 128 129 # Add path to your VRML installation 130 export PATH=$PATH:~/VRML 131 132 #------------------------------------- 133 # SET UP OpenGL o Mesa 134 #------------------------------------- 135 export G4VIS_BUILD_OPENGLX_DRIVER=1 136 export G4VIS_USE_OPENGLX=1 137 138 # Add path to your OpenGL installation 139 #export OGLHOME=/usr/lib 140 141 142 #------------------------------------- 143 # SET UP DAWN (if installed) 144 #------------------------------------- 145 export G4VIS_BUILD_DAWN_DRIVER=1 146 export G4VIS_BUILD_DOWNFILE_DRIVER=1 147 export G4VIS_USE_DAWN=1 148 export G4VIS_USE_DAWNFILE=1 149 # Add path to your DAWN installation 150 # export PATH=$PATH:~/dawn_3_86a 151 152 # VARIOUS USER INTERFACES 153 export G4UI_USE_XM=1 154 export G4UI_USE_TCSH=1 155 export G4UI_BUILD_QT_SESSION=1 156 export G4UI_USE_QT=1 157 158 # VARIOUS GRPHICAL USER INTERFACES 159 export G4VIS_BUILD_QT_SESSION=1 160 export G4VIS_BUILD_OPENGLQT_DRIVER=1 161 export G4VIS_USE_OPENGLQT=1 162 163 # If the QT libraries want be used for the User interfaces than the 164 # correct path must be addressed 165 export QTHOME=/usr/lib/qt-3.3 166 export PATH=$PATH:/usr/lib/qt-3.3/include/ 167 export PATH=$PATH:/usr/lib/qt-3.3/ 168 169 GEOMETRICAL SET-UP 170 The idea of Hadrontherapy is to provide a tool useful for Users interested in the field of proton and ion therapy. These can include the simple calculation of dose distribution curves in water or other materials, the derivation of important transport parameters (stopping powers, ranges, etc.) in different geometrical set-ups and for different materials, up to the complete simulation of a real transport beam line for therapy. 171 172 The main component of the simulation is the phantom, a box that can be filled with different material and where the score of different information (at moment the dose deposited and fluence in voxels) can be performed. A more complete description of the phantom is given in the next subsection. 173 174 At moment the Hadrontherapy include the simulation of the proton beam line for eye-treatments installed at the INFN-LNS facility in Catania. This is a passive beam line and it is simulated in the file PassiveProtonBeamLine.cc. 175 176 In the next future an ActiveProtonBeamLine.cc will be provided for the simulation of the active scanning treatment modality. 177 Moreover the possibility to add a very simple set-up (a beam, a phantom where collect the informations and some simple component) will be also provided. 178 179 All these configuration will be setted by macro commands. 180 181 There is also a facility that allows the user to make a choice between alternative geometry set-ups. This can be done by using command: 182 /geometrySetup/selectGeometry <name> 183 where <name> is either "default" for the standard hadrontherapy geometry or "IAEA" for the IAEA benchmark geometry. Both geometries are described below. By default the standard "default" geometry is used. 184 The water phantom to collect informations 185 At the end of the beam line a phantom (a box of uniform material) is reproduced. Inside it, a user-defined region is divided (via the ROGeomtry classes of Geant4) in cubic and identical voxels. The voxels size can be varied as well as the voxelized region. 186 At the end of a simulation run the dose deposited by primaries and secondaries in each voxel is collected. This information is available as an .out file or as a .root (if the G4ANALYSIS_USE variable is defined and the AIDA interface is activated). 187 188 The default sizes of the active voxelized region are 40x40x40 mm and actually the default voxel configuration is 200 x 1 x 1, which means 200 slices with 0.2 mm of thickness. 189 Of course this default can be modified in order to obtain, for example, a matrix of 80x80x80 cubic voxels each with a lateral dimension of 0.5 mm. 190 191 As concern the cut and stepMax values, the default configuration implies a cut value of 0.01 mm in the whole world (use the command /physic/setCuts <length> in order to set the cut for all, and the command /physic/setDetectorCuts <length> to set the cut for the detector only) and a stepMax of 0.01 mm just in the phantom (use the command /Step/waterPhantomStepMax 0.01 mm). 192 In any case it is strongly recommended to use a stepMax value not bigger than 5% of the dose slice thickness. 193 The Proton passive beam line class file 194 The following is the description of the elements of the passive proton beam line of the Laboratori Nazionali del Sud in Catania (I). This line is completely simulated inside this class. 195 196 The main elements are: 197 * The SCATTERING SYSTEM: to transversally enlarge the original beam 198 * The COLLIMATORS: placed along the beam line to collimate the beam; 199 * The RANGE SHIFTERS: to decrease the energy of the primary proton beam to a specific value; 200 * The MODULATOR WHEEL: to modulate the energy of the primary and mono-energetic beam in to a wide spectrum. The energy modulation is necessary to homogeneously irradiate a tumour volume that can extends in depth up to 20 mm; 201 * The MONITOR CHAMBERS: very thin ionisation chamber that permit the dose monitoring during the patient irradiation; 202 * The MOPI detector: microstrips, air free detector utilised for the check of the beam symmetry during the treatment; 203 * The PATIENT COLLIMATOR: a brass, tumour-shaped collimator able to confine the proton irradiation field in order to irradiate just the tumour mass in the transverse direction; 204 205 The user has the possibility to vary, via messenger, almost all the geometrical characteristics of the beam line elements (i.e. their position along the beam line, their thickness, etc.). 206 207 The elements simulated in the PassiveBeamLine.cc file are: 42 208 43 209 1. A scattering system, to spread geometrically the beam; … … 45 211 2. A system of collimators, to avoid the scattering radiation; 46 212 47 3. A modulation system that spreads the beam in energy and 48 produces the so-called spread out bragg peak; 49 It is constituted by a rotating wheel of different thichnesses. 50 The wheel rotates around is axis (parallel to the proton 51 beam axis) and its movement can be obtained by means of a 52 messenger between runs. 53 54 4. A set of monitor chambers (special transmission ionisation 55 chambers used to control hadron flux during the irradiation); 56 57 5. A "nozzle" and a final collimator defining the final shape 58 of the beam before reaching the patient. 59 60 6. A water phantom: it is a box of water where the energy deposit is 61 calculated. 62 The use of the water phantom is required by the international protocol 63 on the measure of dose in the case of proton and ion beams (IAEA 398, 2000). 64 65 ---->2. EXPERIMENTAL SET-UP. 66 67 The application simulates the proton therapy beam line 68 installed at Laboratori Nazionali del Sud. 69 The default beam line is a typical treatment line composed by several elements all 70 devoted to create the so-called "terapeutical beam", i.e. a beam ideal 71 for a radiotherapeutic treatment. 72 73 The main elements are: 74 ** The COLLIMATORS: placed along the beam line to collimate the beam; 75 76 ** The RANGE SHIFTERS: to decrease the energy of the primary proton beam 77 to a specific value; 78 79 ** The MODULATOR WHEEL: to modulate the energy of the primary and monoenergetic 80 beam in to a wide spectrum. The energy modulation is necessary to 81 homogeneusly irradiate a tumour volume that can extends in depth 82 up to 20 mm; 83 84 ** The MONITOR CHAMBERS: very thin ionisation chamber that permit the 85 dose monitoring during the patient irradiation; 86 87 ** The PATIENT COLLIMATOR: a brass, tumour-shaped collimator able to 88 confine the proton irradiation field in order to irradiate just the tumour mass 89 in the trasverse direction; 90 91 The user has the possibility to vary, via messenger, almost all the geometrical 92 characteristics of the beam line elements (i.e. their position along the beam line, 93 their thickness, etc.). More details on the available user messengers can be 94 found in the Hadronterapy Documentation (http://www.ge.infn.it/geant4/examples/). 95 96 At the end of the beam line, a typical water phantom is reproduced. 97 A user-defined region of the phantom is divided (via the ROGeomtry class) in 98 cubic and identical voxels. The voxels size can be varied. At the end of the simulation 99 the energy deposited by primary protons, and secondaries in each voxel 100 is collected. This information is available as an .hbk file (if the 101 G4ANALYSIS_USE variable is defined). 102 103 The default sizes of the active voxelized region are 40x40x40 mm corresponding 104 to a matric of 80x80x80 cubic voxels each with a lateral dimension of 0.5 mm. 105 106 ---->3. SET-UP 107 108 - a standard Geant4 example GNUmakefile is provided 109 110 setup with: 111 compiler = gcc-3.2.3 112 G4SYSTEM = linux-g++ 113 114 The following section reports the necessary environment variables 115 necessary for the run of Hadrontherapy. 116 117 ---->3.1 ENVIROMENT VARIABLES 118 119 - G4SYSTEM = Linux-g++ 120 121 - G4INSTALL points to the installation directory of GEANT4; 122 123 - G4LIB point to the compiled libraries of GEANT4; 124 125 - G4WORKDIR points to the work directory; 126 127 - CLHEP_BASE_DIR points to the installation directory of CHLEP; 128 129 - G4LEVELGAMMADATA points to the photoevaporation library; 130 131 - NeutronHPCrossSections points to the neutron data files; 132 133 - G4RADIOACTIVEDATA points to the libraries for radio-active decay 134 hadronic processes; 135 136 - G4LEDATA points to the low energy electromagnetic libraries 137 138 - LD_LIBRARY_PATH = $CLHEP_BASE_DIR/lib 139 140 ---->3.2 VISUALISATION 141 142 The user can visualise the experimental set-up with OpenGL, DAWN and vrml 143 144 ---->4. HOW TO RUN THE EXAMPLE 145 146 In interactive mode: 213 3. A modulation system that spreads the beam in energy and produces the so-called spread out Bragg peak; It is constituted by a rotating wheel of different thicknesses. The wheel rotates around its axis (parallel to the proton beam axis) and its movement can be obtained by means of a messenger between runs. 214 215 4. A set of monitor chambers (special transmission ionisation chambers used to control the particle flux during the irradiation); 216 217 5. A final long collimator and a patient collimator defining the final shape of the beam before reaching the patient. 218 219 6. A water phantom: it is a box of water where the dose deposit is calculated. The use of the water phantom is required by the international protocol on the measure of dose in the case of proton and ion beams (IAEA 398, 2000). 220 Geometry for the IAEA benchmark 221 Simple geometry for benchmark purposes contains water phantom (thickness can be set using a macro command), an aluminum beam window and Plexi-glass. Behind the phantom we have a detector that records outcoming particles. The IAEA geometry can be activated by using the command: 222 /geometrySetup/selectGeometry IAEA 223 224 Example IAEA benchmark run can be done as follows: 225 run: Hadrontherapy macro/iaea.mac 226 analysis: root RootScripts/iaeaBenchmark/fragmentEnergy.C 227 228 PHYSICS PROCESSES AND PHYSICS MODELS IMPLEMENTATION 229 A particular care is addressed to the simulation of the physic processes. 230 Three different approaches can be used for the choose of the physic models. 231 Approach 1: 232 Using the macro command: 233 /physic/addPhysics/<physics List name>. 234 235 In this case the models (for electromagnetic, hadronic elastic and hadronic inelastic) can be activated directly calling the name of the Physics Lists that are available inside the 236 Geant4 kernel in the directory: 237 238 $G4INSTALL/source/physics_lists/builders/include 239 240 An example of the use of the Physics List can be found in the macro files: 241 proton_therapy.mac and ion_therapy.mac 242 Approach 2: 243 A set of built-in physic models are also contained inside the Hadrontherapy directory. These are called Local*.cc and Local*.hh and can be activated using the macro command: 244 /physic/addPhysics/<name>. 245 Approach 3: 246 We developed this approach in order to simplify the choice of the physic models to 247 be used in the application. 248 With this approach the user must only insert a command line in his/her .mac file using the: /physics/addPackage <PACKAGE_NAME> 249 250 This permits to switch-on an already build physic package. 251 Various packages are already present in the Geant4 tree: they are in the directory: geant4/source/physics_lists/lists/include 252 253 In this case hadronic inelastic models are directly activated for every particle. 254 255 NOTE: we do not recommend the use of local physics lists while we recommend the use of the Physics Lists or of the Reference Physics Lists (Approach 1 or 3) 256 257 -------------------------------------------------------------------------------- 258 SUGGESTED PHYSIC FOR ION BEAMS IN THE RANGE 0 - 400 MeV 259 -------------------------------------------------------------------------------- 260 Two macro files (proton_therapy.mac and ion_therapy.mac) can be used for proton and ion 261 simulations. 262 263 Also the QGSP_BIC_EMY package can be used if the *Approach 3* is preferred. 264 265 INTERACTIVE COMMANDS 266 How to change Phantom and Detector geometries 267 In order to let the end user to change phantom and detector geometries and voxelization, some interactive commands have been provided. All parameters are mandatory, except those inside square brackets. 268 269 Detector geometry 270 271 The user can change: 272 273 (1) The detector (box) size. 274 275 (2) The voxels sizes. Changing this parameters, and/or the detector sizes, user should choose values in order to be divisors of the detector correspondent sizes. 276 For both above commands, zero or negative values mean << don't change it >> 277 278 (3) The displacement between the phantom and the detector. Displacement parameters refer to the lower left corner of the detector respect to that of the phantom, by the point of view of the beam. In this case zero or positive values are allowed, while the negatives ones mean: << don't change it>>. 279 280 Command synopsis: the <default values> follow "#" 281 282 283 1. /changeDetector/size <dimX> <dimY> <dimZ> <[unit]> # 4 4 4 cm 284 2. /changeDetector/voxelSize <dimX> <dimY> <dimZ> <[unit]> # 0.2 40 40 mm 285 3. /changeDetector/displacement <dispX> <dispY> <dispZ> <[unit]> # 0 18 18 cm 286 287 where the X dimension is that along the beam direction 288 289 Phantom geometry 290 291 (1) The phantom size. As usually, zero or negatives values mean: <<don't change it>>. 292 (2) The phantom position respect to the world. In this case specified values refer to the three components of the position of the phantom's center respect to the world's. 293 294 Command synopsis: 295 296 1. /changePhantom/size <dimX> <dimY> <dimZ> <[unit]> # 40 40 40 cm 297 2. /changePhantom/position <posX> <posY> <posZ> <[unit]> # 20 0 0 cm 298 299 All these commands must be followed by the command /changePhantom/update 300 in order to check and apply them to the real geometry. 301 Moreover must be issued between runs (so where you want but after the /run/initialize initialization command, or the G4State_Idle Geant4 state machine). 302 Obviously all the previous sizes must be set in order to maintain the detector inside the phantom, otherwise system complains. 303 304 Some examples follow: 305 306 /changeDetector/size 40 0 0 cm 307 # Will extend detector X size to cover in full the phantom X size 308 309 /changeDetector/size 0 4.5 0 cm 310 # Will extend the Y size to 4.5 cm (note that voxel size Y is automatically 311 # rounded to 4.5 cm because the default value along Y is 4 cm) 312 /changePhantom/update 313 # Remember to always update the geometry before the beamOn command!! 314 315 /changeDetector/size 0 8 0 cm 316 # Will extend the Y size to 8 cm. In this case voxel size Y doesn't change, but 317 # the number of voxel along Y doubles. 318 /changePhantom/update 319 320 321 /changeDetector/voxelSize 100 0 0 um 322 # 100 um should be a divisor of detector size X 323 # Will change only slabs X size to 100 um, without affecting the other. 324 /changePhantom/update 325 326 /changeDetector/displacement 0 0 0 # default unit mm 327 # Will place the detector in the left lower corner (from the point of view of the beam) of #the phantom. 328 /changePhantom/update 329 Stopping powers calculation 330 It is possible for the end-user to calculate, via macro command, stopping powers only for those materials inserted into G4NistMaterialBuilder class (about 300). 331 To get stopping powers user must provide this command line on the idle interactive terminal (or into a macro file) : 332 333 /parameter/getstopping <G4_material> <Emin> <Emax> <nPoints> <[particle]> <[output_filename]> 334 335 All parameters are mandatory except those inside square brackets []. 336 Default values for parameters inside square brackets are respectively proton and standard output (usually the user console terminal). 337 338 Parameters are respectively: 339 340 * The material (NIST) name (something like G4_..., the complete list of elements and materials is available into the G4NistMaterialBuilder class and can be printed to the terminal screen via the macro command: /parameter/nist ) 341 * Kinetic energy range in MeV and the number of data points to be retrieved (in a logarithmically uniform space) 342 * The particle name (proton, e+, e-, He3, neutron,... a full list can be gotten via the macro command: /particle/list). 343 Only for ions, user must firstly give them to the particle gun, for example issuing the macro commands: 344 a. /gun/particle ion 345 b. /gun/ion <Z> <A> <[charge]> 346 * The output filename: if users leave this blank then the standard output is used. 347 348 Below is an example in order to calculate the stopping power for alphas into Hydrogen between 1 keV to 150 MeV for 15 points: 349 350 /parameter/getstopping G4_H 0.001 150 15 alpha 351 352 # and for C12 ion: 353 354 /gun/particle ion 355 /gun/ion 6 12 6 356 /parameter/getstopping G4_H 0.001 150 15 C12[0.0] 357 358 # Value inside square brackets is the excitation energy of the ion (ground state). 359 360 HOW RUN HADRONTHERAPY 361 Run the example in interactive mode 147 362 > $G4WORDIR/bin/Linux-g++/Hadrontherapy 148 The defaultMacro.mac is executed 149 150 The primary particle beam parameter are: 151 Radiation: proton beam; 152 Energy distribution: gaussian; 153 Mean energy: 63.4 MeV; 154 Energy spread: 300 keV; 155 Beam spot size: 1 mm; 156 Beam angular spread: 0.057 deg; 157 158 The modulator wheel can be rotated via the messenger: 159 160 Idle>/modulator/angle/xx deg 161 162 To produce a Spread Out Bragg Peak using the modulator a macro 163 (modulatorMacro.mac) is provided. With this macro the modulator is 164 rotated of 360 degree at 1 deg steps. In each run 1000 protons are 165 generated as primary particles. Obviously a bigger resolution can be obtained 166 with smaller angles or increasing the protons number in each run. 167 168 Modulator wheel can be omitted setting its material air. 169 170 run $G4WORKDIR/bin/Linux-g++/Hadrontherapy visualisationMacro.mac 171 to visualise the experimental set-up with OpenGL 172 173 ---->5. PHYSICS 174 175 Both electromagnetic and hadronic physic processes are activated for 176 the particles of the experimental set-up. 177 Different physics models can be activated by the user interactively. 178 179 Examples of activation are provided in the macro files starting 180 with the string "physics": 181 182 All possible physics options are summarized in the file 183 physicsAllOptions.mac. 184 185 Different options concerning electromagnetic interactions of protons 186 and neutrons can be tested with the files: 187 physicsElectromagneticICRU49.mac 188 physicsElectromagneticZiegler77.mac 189 physicsElectromagneticZiegler85.mac 190 191 Different options concerning hadronic interactions of protons and 192 neutrons can be tested with the files: 193 physicsHadronicBertini.mac 194 physicsHadronicBinary.mac 195 physicsHadronicLEP.mac 196 physicsHadronicPrecompound.mac 197 198 NOTE: Apart from the different models for protons and neutrons, a user 199 can also select among several interaction models for particles like 200 electrons or photons. All possible options are listed in the file 201 physicsAllOptions.mac. 202 203 ---->6. SIMULATION OUTPUT 204 205 The output is an .hbk file (hadrontherapy.hbk) produced 206 if the variable G4ANALYSIS_USE is set to 1 and the analysis tool (AIDA 207 interface) correctly installed. 208 The file contains an histogram and an n-tuple. 209 The histogram contains the Bragg curve: energy deposited 210 by the proton beam (in MeV) versus the depth in water (in mm). 211 The n-tuple contains the total 3D energy deposit in the phantom; the information 212 is energy deposit in each voxel with respect to the position of the voxel. 213 214 Setup for analysis: AIDA 3.2.1 215 216 Users can download the analysis tools from: 217 http://aida.freehep.org/ 218 219 Note that the same information can be stored in any different format. 220 Please contact cirrone@lns.infn.it if you want store the information in 221 a different format. 222 223 --------------------------------------------------------------------------- 224 225 for comments, advices, doubts and questions please contact: 226 cirrone@lns.infn.it, giorgiorusso@lns.infn.it 227 228 last modified: A. Lechner, 16/11/2007 229 363 364 In this case the main file (Hadrontherapy.cc) performs different operations depending on which environment variable is activated; 365 For example, if the environment variable G4UI_USE_TCSH is activated, Hadrontherapy will start with the TCSH User Interface that has many useful functionalities. On the other hand, if this first variables is not defined, the program will continue searching for the G4UI_USE_QT variable and, finally, will open the standard G4UITerminal. 366 Run the example using macro files 367 Hadrontherapy can be launched using a macro file: 368 369 > $G4WORDIR/bin/Linux-g++/Hadrontherapy macroFile.mac 370 371 The defaultMacro.mac file is contained in the main directory of Hadrontherapy and is automatically readed in case the user launch the executable without a parameter. A big number of other macro are inside the /macro folder. 372 373 Example use of command based scoring 374 In the IAEA geometry it is possible to collect the energy deposition data using the Geant4 command based scoring feature. This allows the users to define scorers interactively in the user interface without writing a single line of C++. Below is listed an example usage of command based scoring: 375 376 /score/create/boxMesh boxMesh_1 377 #Box size is the radius of the box ie 20x20x20 gives 40x40x40 outer dimensions 378 /score/mesh/boxSize 13.95 16. 16. cm 379 /score/mesh/translate/xyz 69 0.0 0.0 cm 380 /score/mesh/nBin 400 1 1 # 400 bins in x-direction, 1 in y and z directions 381 382 SIMULATION OUTPUT 383 ASCII file 384 A .out file is generated at the end of each run, Dose.out is its default name that can be changed in the HadrontherapyMatrix.cc file. 385 The file can contain four columns; the first three columns represent the voxel indexes (that univocally identify the voxel volume), while the last column represent the dose deposited in the given voxel. 386 Alternatively, if the macro command /analysis/secondaries true is given, ordinated dose and fluence, for every secondary produced, is added to the file. 387 Setting the name of the ROOT output file 388 By default the name of the ROOT output file is DoseDistribution.root. The name of the file can be set by using command: 389 /analysis/setAnalysisFile <filename> 390 391 It is also possible to create multiple new output files in the same simulation session. For example: 392 /beam/energy/meanEnergy 4800 MeV 393 /analysis/setAnalysisFile firstRun.root 394 /run/beamOn 1000 395 /beam/energy/meanEnergy 3000 MeV 396 /analysis/setAnalysisFile secondRun.root 397 /run/beamOn 1000 398 Use of the ROOT analysis 399 It is possible to use ROOT data analysis package directly for the production of output files. 400 In the last version, anyway, this functionality must be implemented by User. This can be accomplished by setting an ad-hoc environment variable (i.e. G4ANALYSIS_USE_ROOT) to 1, adding in the code lines to create outputs with the ROOT libraries and recompiling the application. 401 In this case you must have the ROOT framework installed in your machine. 402 403 404 FUTURE CHALLENGES AND USERS' REQUESTS 405 This is a list of future components that will be added in Hadrontherapy and of main Users requests that we hope to fulfill in the next future. 406 What is in progress 407 1. A module for the simulation of an active beam line will be provided. 408 The Korean Group of the Proton therapy center, National Cancer Center is developing this. 409 2. Modules for LET and RBE (Relative Biological Effectiveness) calculation. The Catania Group in Collaboration with the Turin one is working on this. 410 3. Hadrontherapy will permit the simulation of a 'basic' experiment usefull in hadrontherapy applications. User will be able to simulate thin/thick target configuration to calculate quantities like double differential cross sections of secondaries produces, or fluence and yelds of primary and secondaries in a thick block. This work is maily discussed with P. Kaitaniemi and the Group from the Helsinki Institute of Physics. 411 What is requested from Users 412 1. Dicom interface 413 414 Please contact cirrone@lns.infn.it for more details or suggestions and feedbacks on this document 415 416 -
trunk/examples/advanced/hadrontherapy/defaultMacro.mac
r1230 r1313 1 # G.A.P.Cirrone1 # G.A.P.Cirrone 2 2 # 3 3 # Default macro file. It is called if no argument is provided at run … … 19 19 # Set of the physic models 20 20 # 21 /physic/addPhysics emstandard_opt3# Electromagnetic model21 /physic/addPhysics standard_opt3 # Electromagnetic model 22 22 /physic/addPhysics elastic # Hadronic elastic model 23 23 /physic/addPhysics binary # Hadronic inelastic model 24 24 /physic/addPhysics local_ion_ion_inelastic # Hadronic inelastic model for ions (local physic list) 25 26 25 27 26 28 ########################## … … 32 34 # Visualisation 33 35 # 34 /vis/scene/create 35 #/vis/open OGLIQt # only if QT library are installed 36 /vis/open OGLIX 36 /vis/open OGL 37 37 /vis/viewer/flush 38 38 /vis/viewer/set/viewpointThetaPhi 30 140 deg 39 39 /vis/viewer/zoom 1 40 40 /vis/viewer/pan -10 0 cm 41 /tracking/storeTrajectory 1 42 #/vis/scene/endOfEventAction accumulate 43 /vis/scene/endOfEventAction accumulate -1 44 /vis/viewer/update 41 /vis/scene/add/trajectories 42 /vis/scene/endOfEventAction accumulate 45 43 46 44 ########################## … … 69 67 # Start of the run 70 68 # 71 /run/beamOn 10 69 # If secondaries dose/fluence are needed 70 #/analysis/secondaries true 71 72 /run/beamOn 100 73 74 -
trunk/examples/advanced/hadrontherapy/include/CVS/Entries
r1230 r1313 1 /Decay.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 32 /HadrontherapyAnalysisFileMessenger.hh/1. 4/Fri Jan 8 13:32:05 2010//Tgeant4-09-033 /HadrontherapyAnalysisManager.hh/1. 16/Wed Nov 18 14:37:51 2009//Tgeant4-09-034 /HadrontherapyDetectorConstruction.hh/1.2 4/Fri Jan 8 13:32:05 2010//Tgeant4-09-035 /HadrontherapyDetectorHit.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 36 /HadrontherapyDetectorMessenger.hh/1.1 5/Fri Jan 8 13:32:05 2010//Tgeant4-09-037 /HadrontherapyDetectorROGeometry.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 38 /HadrontherapyDetectorSD.hh/1. 2/Wed Nov 18 14:37:51 2009//Tgeant4-09-039 /HadrontherapyDummySD.hh/1.6/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 310 /HadrontherapyEventAction.hh/1.1 5/Wed Nov 18 14:37:51 2009//Tgeant4-09-0311 /HadrontherapyEventActionMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 312 /HadrontherapyGeometryController.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 313 /HadrontherapyGeometryMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 314 /HadrontherapyInteractionParameters.hh/1. 5/Fri Jan 8 13:32:05 2010//Tgeant4-09-0315 /HadrontherapyMatrix.hh/1. 6/Fri Jan 8 13:32:05 2010//Tgeant4-09-0316 /HadrontherapyModulator.hh/1.5/Thu Jun 29 15:58:08 2006//Tgeant4-09-0 317 /HadrontherapyParameterMessenger.hh/1.5/Fri Jan 8 13:32:05 2010//Tgeant4-09-0 318 /HadrontherapyParticles.hh/1.7/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 319 /HadrontherapyPhysicsList.hh/1.2 1/Fri Jan 8 13:32:05 2010//Tgeant4-09-0320 /HadrontherapyPhysicsListMessenger.hh/1. 9/Wed Nov 18 14:37:51 2009//Tgeant4-09-0321 /HadrontherapyPrimaryGeneratorAction.hh/1.1 7/Wed Nov 18 14:37:51 2009//Tgeant4-09-0322 /HadrontherapyPrimaryGeneratorMessenger.hh/1.7/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 323 /HadrontherapyRunAction.hh/1.1 4/Wed Nov 18 14:37:51 2009//Tgeant4-09-0324 /HadrontherapyStepMax.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 325 /HadrontherapyStepMaxMessenger.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 326 /HadrontherapySteppingAction.hh/1.16/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 327 /IAEADetectorConstruction.hh/1.5/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 328 /IAEADetectorMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 329 /IAEAScoreWriter.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 330 /LocalINCLIonIonInelasticPhysic.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 331 /LocalIonIonInelasticPhysic.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-0 332 /PassiveProtonBeamLine.hh/1. 5/Wed Nov 18 14:37:51 2009//Tgeant4-09-0333 /PassiveProtonBeamLineMessenger.hh/1. 2/Wed Nov 18 14:37:51 2009//Tgeant4-09-031 /Decay.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 2 /HadrontherapyAnalysisFileMessenger.hh/1.6/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 3 /HadrontherapyAnalysisManager.hh/1.20/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 4 /HadrontherapyDetectorConstruction.hh/1.28/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 5 /HadrontherapyDetectorHit.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 6 /HadrontherapyDetectorMessenger.hh/1.18/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 7 /HadrontherapyDetectorROGeometry.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 8 /HadrontherapyDetectorSD.hh/1.3/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 9 /HadrontherapyDummySD.hh/1.6/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 10 /HadrontherapyEventAction.hh/1.16/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 11 /HadrontherapyEventActionMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 12 /HadrontherapyGeometryController.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 13 /HadrontherapyGeometryMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 14 /HadrontherapyInteractionParameters.hh/1.8/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 15 /HadrontherapyMatrix.hh/1.12/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 16 /HadrontherapyModulator.hh/1.5/Thu Jun 29 15:58:08 2006//Tgeant4-09-04-beta-cand-00 17 /HadrontherapyParameterMessenger.hh/1.5/Fri Jan 8 13:32:05 2010//Tgeant4-09-04-beta-cand-00 18 /HadrontherapyParticles.hh/1.7/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 19 /HadrontherapyPhysicsList.hh/1.22/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 20 /HadrontherapyPhysicsListMessenger.hh/1.10/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 21 /HadrontherapyPrimaryGeneratorAction.hh/1.18/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 22 /HadrontherapyPrimaryGeneratorMessenger.hh/1.7/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 23 /HadrontherapyRunAction.hh/1.16/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 24 /HadrontherapyStepMax.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 25 /HadrontherapyStepMaxMessenger.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 26 /HadrontherapySteppingAction.hh/1.16/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 27 /IAEADetectorConstruction.hh/1.5/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 28 /IAEADetectorMessenger.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 29 /IAEAScoreWriter.hh/1.3/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 30 /LocalINCLIonIonInelasticPhysic.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 31 /LocalIonIonInelasticPhysic.hh/1.2/Wed Nov 18 14:37:51 2009//Tgeant4-09-04-beta-cand-00 32 /PassiveProtonBeamLine.hh/1.6/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 33 /PassiveProtonBeamLineMessenger.hh/1.3/Mon Jun 14 13:47:41 2010//Tgeant4-09-04-beta-cand-00 34 34 D -
trunk/examples/advanced/hadrontherapy/include/CVS/Tag
r1230 r1313 1 Ngeant4-09-0 31 Ngeant4-09-04-beta-cand-00 -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyAnalysisFileMessenger.hh
r1230 r1313 30 30 #define HadrontherapyAnalysisFileMessenger_h 1 31 31 32 #ifdef ANALYSIS_USE33 32 34 33 #include "G4UImessenger.hh" … … 36 35 37 36 class HadrontherapyAnalysisManager; ///< Provides SetanalysisFileName() 38 class G4UIcmdWithAString; ///< Provides possibility to add commands 37 class G4UIcmdWithAString; 38 class G4UIcmdWithABool; 39 39 40 40 /** … … 68 68 * Constructor requires command name and messenger class(this). 69 69 */ 70 G4UIcmdWithAString* FileNameCmd; 70 G4UIcmdWithABool *secondariesCmd; 71 #ifdef G4ANALYSIS_USE_ROOT 72 G4UIcmdWithAString *FileNameCmd; 73 #endif 71 74 }; 72 75 73 76 #endif 74 #endif -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyAnalysisManager.hh
r1230 r1313 1 //2 // ********************************************************************3 // * License and Disclaimer *4 // * *5 // * The Geant4 software is copyright of the Copyright Holders of *6 // * the Geant4 Collaboration. It is provided under the terms and *7 // * conditions of the Geant4 Software License, included in the file *8 // * LICENSE and available at http://cern.ch/geant4/license . These *9 // * include a list of copyright holders. *10 // * *11 // * Neither the authors of this software system, nor their employing *12 // * institutes,nor the agencies providing financial support for this *13 // * work make any representation or warranty, express or implied, *14 // * regarding this software system or assume any liability for its *15 // * use. Please see the license in the file LICENSE and URL above *16 // * for the full disclaimer and the limitation of liability. *17 // * *18 // * This code implementation is the result of the scientific and *19 // * technical work of the GEANT4 collaboration. *20 // * By using, copying, modifying or distributing the software (or *21 // * any work based on the software) you agree to acknowledge its *22 // * use in resulting scientific publications, and indicate your *23 // * acceptance of all terms of the Geant4 Software license. *24 // ********************************************************************25 //26 // HadrontherapyAnalysisManager.hh; May 200527 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // HadrontherapyAnalysisManager.hh; May 2005 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 28 29 29 #ifndef HADRONTHERAPYANALYSISMANAGER_HH … … 32 32 #include "globals.hh" 33 33 34 #ifdef ANALYSIS_USE ///< If we use analysis35 36 #ifdef G4ANALYSIS_USE ///< If analysis is done via AIDA37 #include <AIDA/AIDA.h>38 39 namespace AIDA{40 class ITree;41 class IAnalysisFactory;42 class ITreeFactory;43 }44 #endif45 34 46 35 #ifdef G4ANALYSIS_USE_ROOT ///< If analysis is done directly with ROOT … … 50 39 #include "TH1F.h" 51 40 #endif 52 53 41 /** 54 42 * Messenger class for analysis-settings for HadronTherapyAnalysisManager … … 64 52 /** 65 53 * Analysis manager is a singleton object (there is only one instance). 66 * The pointer to this object is available through the use of the method getInstance();54 * The pointer to this object is available through the use of the method GetInstance(); 67 55 * 68 * @see getInstance69 */ 70 HadrontherapyAnalysisManager();71 56 * @see GetInstance 57 */ 58 HadrontherapyAnalysisManager(); 59 72 60 public: 73 ~HadrontherapyAnalysisManager(); 74 75 /** 76 * Get the pointer to the analysis manager. 77 */ 78 static HadrontherapyAnalysisManager* getInstance(); 79 80 /** 81 * Book the histograms and ntuples in an AIDA or ROOT file. 82 */ 83 void book(); 84 /** 85 * Set name for the analysis file .root (used by macro) 86 */ 87 void SetAnalysisFileName(G4String); 88 89 /** 90 * Fill the ntuple with the energy deposit in the phantom 91 */ 92 void FillEnergyDeposit(G4int voxelXId, G4int voxelYId, G4int voxelZId, 93 G4double energyDeposit); 94 95 void BraggPeak(G4int, G4double); ///< Fill 1D histogram with the Bragg peak in the phantom 96 97 void SecondaryProtonEnergyDeposit(G4int slice, G4double energy); 98 ///< Fill 1D histogram with the energy deposit of secondary protons 99 100 void SecondaryNeutronEnergyDeposit(G4int slice, G4double energy); 101 ///< Fill 1D histogram with the energy deposit of secondary neutrons 102 103 void SecondaryAlphaEnergyDeposit(G4int slice, G4double energy); 104 ///< Fill 1D histogram with the energy deposit of secondary alpha particles 105 106 void SecondaryGammaEnergyDeposit(G4int slice, G4double energy); 107 ///< Fill 1D histogram with the energy deposit of secondary gamma 108 109 void SecondaryElectronEnergyDeposit(G4int slice, G4double energy); 110 ///< Fill 1D histogram with the energy deposit of secondary electrons 111 112 void SecondaryTritonEnergyDeposit(G4int slice, G4double energy); 113 ///< Fill 1D histogram with the energy deposit of secondary tritons 114 115 void SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy); 116 ///< Fill 1D histogram with the energy deposit of secondary deuterons 117 118 void SecondaryPionEnergyDeposit(G4int slice, G4double energy); 119 ///< Fill 1D histogram with the energy deposit of secondary pions 120 121 void electronEnergyDistribution(G4double secondaryParticleKineticEnergy); 122 ///< Energy distribution of secondary electrons originated in the phantom 123 124 void gammaEnergyDistribution(G4double secondaryParticleKineticEnergy); 125 ///< Energy distribution of secondary gamma originated in the phantom 126 127 void deuteronEnergyDistribution(G4double secondaryParticleKineticEnergy); 128 ///< Energy distribution of secondary deuterons originated in the phantom 129 130 void tritonEnergyDistribution(G4double secondaryParticleKineticEnergy); 131 ///< Energy distribution of secondary tritons originated in the phantom 132 133 void alphaEnergyDistribution(G4double secondaryParticleKineticEnergy); 134 ///< Energy distribution of secondary alpha originated in the phantom 135 136 void heliumEnergy(G4double secondaryParticleKineticEnergy); 137 ///< Energy distribution of the helium (He3 and alpha) particles after the phantom 138 139 void hydrogenEnergy(G4double secondaryParticleKineticEnergy); 140 ///< Energy distribution of the hydrogen (proton, d, t) particles after the phantom 141 142 void fillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ); 143 ///< Energy ntuple 144 145 void genericIonInformation(G4int, G4double, G4int, G4double); 146 147 void ThintargetBeamDisp(G4double,G4double); 148 149 void startNewEvent(); 150 ///< Tell the analysis manager that a new event is starting 151 152 void setGeometryMetaData(G4double, G4double, G4double); 153 ///< from the detector construction information about the geometry can be written as metadata 154 155 void setBeamMetaData(G4double, G4double); 156 ///< metadata about the beam can be written this way 157 158 void finish(); 159 ///< Close the .hbk file with the histograms and the ntuples 160 161 void flush(); 162 163 #ifdef G4ANALYSIS_USE_ROOT 61 ~HadrontherapyAnalysisManager(); 62 63 /** 64 * Get the pointer to the analysis manager. 65 */ 66 static HadrontherapyAnalysisManager* GetInstance(); 67 68 #ifdef G4ANALYSIS_USE_ROOT 69 /** 70 * Clear analysis manager heap. 71 */ 72 void Clear(); 73 74 /** 75 * Book the histograms and ntuples in an AIDA or ROOT file. 76 */ 77 void book(); 78 /** 79 * Set name for the analysis file .root (used by macro) 80 */ 81 void SetAnalysisFileName(G4String); 82 83 /** 84 * Fill the ntuple with the energy deposit in the phantom 85 */ 86 void FillEnergyDeposit(G4int voxelXId, G4int voxelYId, G4int voxelZId, 87 G4double energyDeposit); 88 89 void BraggPeak(G4int, G4double); ///< Fill 1D histogram with the Bragg peak in the phantom 90 91 void SecondaryProtonEnergyDeposit(G4int slice, G4double energy); 92 ///< Fill 1D histogram with the energy deposit of secondary protons 93 94 void SecondaryNeutronEnergyDeposit(G4int slice, G4double energy); 95 ///< Fill 1D histogram with the energy deposit of secondary neutrons 96 97 void SecondaryAlphaEnergyDeposit(G4int slice, G4double energy); 98 ///< Fill 1D histogram with the energy deposit of secondary alpha particles 99 100 void SecondaryGammaEnergyDeposit(G4int slice, G4double energy); 101 ///< Fill 1D histogram with the energy deposit of secondary gamma 102 103 void SecondaryElectronEnergyDeposit(G4int slice, G4double energy); 104 ///< Fill 1D histogram with the energy deposit of secondary electrons 105 106 void SecondaryTritonEnergyDeposit(G4int slice, G4double energy); 107 ///< Fill 1D histogram with the energy deposit of secondary tritons 108 109 void SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy); 110 ///< Fill 1D histogram with the energy deposit of secondary deuterons 111 112 void SecondaryPionEnergyDeposit(G4int slice, G4double energy); 113 ///< Fill 1D histogram with the energy deposit of secondary pions 114 115 void electronEnergyDistribution(G4double secondaryParticleKineticEnergy); 116 ///< Energy distribution of secondary electrons originated in the phantom 117 118 void gammaEnergyDistribution(G4double secondaryParticleKineticEnergy); 119 ///< Energy distribution of secondary gamma originated in the phantom 120 121 void deuteronEnergyDistribution(G4double secondaryParticleKineticEnergy); 122 ///< Energy distribution of secondary deuterons originated in the phantom 123 124 void tritonEnergyDistribution(G4double secondaryParticleKineticEnergy); 125 ///< Energy distribution of secondary tritons originated in the phantom 126 127 void alphaEnergyDistribution(G4double secondaryParticleKineticEnergy); 128 ///< Energy distribution of secondary alpha originated in the phantom 129 130 void heliumEnergy(G4double secondaryParticleKineticEnergy); 131 ///< Energy distribution of the helium (He3 and alpha) particles after the phantom 132 133 void hydrogenEnergy(G4double secondaryParticleKineticEnergy); 134 ///< Energy distribution of the hydrogen (proton, d, t) particles after the phantom 135 136 //Kinetic energy by voxel, mass number A and atomic number Z. 137 void FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy); 138 139 //Kinetic energy by voxel, mass number A and atomic number Z of only primary particles 140 void FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy); 141 142 ///< Energy by voxel, mass number A and atomic number Z. 143 void FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence); 144 145 void FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ); 146 ///< Energy ntuple 147 148 void FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD); 149 ///< let ntuple 150 151 void genericIonInformation(G4int, G4double, G4int, G4double); 152 153 void ThintargetBeamDisp(G4double,G4double); 154 155 void startNewEvent(); 156 ///< Tell the analysis manager that a new event is starting 157 158 void setGeometryMetaData(G4double, G4double, G4double); 159 ///< from the detector construction information about the geometry can be written as metadata 160 161 void setBeamMetaData(G4double, G4double); 162 ///< metadata about the beam can be written this way 163 164 void flush(); 165 ///< Close the .hbk file with the histograms and the ntuples 164 166 private: 165 TH1F *createHistogram1D(const TString name, const TString title, int bins, double xmin, double xmax) { 166 TH1F *histo = new TH1F(name, title, bins, xmin, xmax); 167 histo->SetLineWidth(2); 168 return histo; 169 } 170 #endif 171 167 TH1F *createHistogram1D(const TString name, const TString title, int bins, double xmin, double xmax) { 168 TH1F *histo = new TH1F(name, title, bins, xmin, xmax); 169 histo->SetLineWidth(2); 170 return histo; 171 } 172 172 173 private: 173 static HadrontherapyAnalysisManager* instance; 174 HadrontherapyAnalysisFileMessenger* fMess; 175 G4String analysisFileName; 176 #ifdef G4ANALYSIS_USE 177 AIDA::IAnalysisFactory* aFact; 178 AIDA::ITree* theTree; 179 AIDA::IHistogramFactory *histFact; 180 AIDA::ITupleFactory *tupFact; 181 AIDA::IHistogram1D *h1; 182 AIDA::IHistogram1D *h2; 183 AIDA::IHistogram1D *h3; 184 AIDA::IHistogram1D *h4; 185 AIDA::IHistogram1D *h5; 186 AIDA::IHistogram1D *h6; 187 AIDA::IHistogram1D *h7; 188 AIDA::IHistogram1D *h8; 189 AIDA::IHistogram1D *h9; 190 AIDA::IHistogram1D *h10; 191 AIDA::IHistogram1D *h11; 192 AIDA::IHistogram1D *h12; 193 AIDA::IHistogram1D *h13; 194 AIDA::IHistogram1D *h14; 195 AIDA::IHistogram1D *h15; 196 AIDA::IHistogram1D *h16; 197 AIDA::ITuple *ntuple; 198 AIDA::ITuple *ionTuple; 199 AIDA::ITuple *fragmentTuple; 200 #endif 201 #ifdef G4ANALYSIS_USE_ROOT 202 TFile *theTFile; 203 TH1F *histo1; 204 TH1F *histo2; 205 TH1F *histo3; 206 TH1F *histo4; 207 TH1F *histo5; 208 TH1F *histo6; 209 TH1F *histo7; 210 TH1F *histo8; 211 TH1F *histo9; 212 TH1F *histo10; 213 TH1F *histo11; 214 TH1F *histo12; 215 TH1F *histo13; 216 TH1F *histo14; 217 TH1F *histo15; 218 TH1F *histo16; 219 220 TNtuple *theROOTNtuple; 221 TNtuple *theROOTIonTuple; 222 TNtuple *fragmentNtuple; // fragments 223 TNtuple *metaData; 224 #endif 225 G4long eventCounter; // Simulation metadata 226 G4double detectorDistance; 227 G4double phantomDepth; 228 G4double beamEnergy; 229 G4double energyError; 230 G4double phantomCenterDistance; 174 #endif 175 static HadrontherapyAnalysisManager* instance; 176 HadrontherapyAnalysisFileMessenger* fMess; 177 #ifdef G4ANALYSIS_USE_ROOT 178 G4String analysisFileName; 179 TFile *theTFile; 180 TH1F *histo1; 181 TH1F *histo2; 182 TH1F *histo3; 183 TH1F *histo4; 184 TH1F *histo5; 185 TH1F *histo6; 186 TH1F *histo7; 187 TH1F *histo8; 188 TH1F *histo9; 189 TH1F *histo10; 190 TH1F *histo11; 191 TH1F *histo12; 192 TH1F *histo13; 193 TH1F *histo14; 194 TH1F *histo15; 195 TH1F *histo16; 196 197 TNtuple *kinFragNtuple; 198 TNtuple *kineticEnergyPrimaryNtuple; 199 200 // ntuple containing the fluence of all the particle in any voxel 201 TNtuple *doseFragNtuple; 202 203 // ntuple containing the fluence of all the particle in any voxel 204 TNtuple *fluenceFragNtuple; 205 206 // ntuple containing the fluence of all the particle in any voxel 207 TNtuple *letFragNtuple; 208 209 TNtuple *theROOTNtuple; 210 TNtuple *theROOTIonTuple; 211 TNtuple *fragmentNtuple; // fragments 212 TNtuple *metaData; 213 G4long eventCounter; // Simulation metadata 214 G4double detectorDistance; 215 G4double phantomDepth; 216 G4double beamEnergy; 217 G4double energyError; 218 G4double phantomCenterDistance; 219 #endif 231 220 }; 232 221 #endif 233 222 234 #endif 235 223 224 -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyDetectorConstruction.hh
r1230 r1313 56 56 void ConstructPhantom(); 57 57 void ConstructDetector(); 58 void ConstructSensitiveDetector(G4ThreeVector position_respect_to_WORLD); 59 58 void ConstructSensitiveDetector(G4ThreeVector positionToWORLD); 59 void ParametersCheck(); 60 60 61 public: 61 62 // Get detector position relative to WORLD … … 65 66 } 66 67 ///////////////////////////////////////////////////////////////////////////// 67 // Get displacement between phantom and detector by detector position , phantomand detector sizes68 // Get displacement between phantom and detector by detector position (center of), phantom (center of) and detector sizes 68 69 inline G4ThreeVector GetDetectorToPhantomPosition() 69 70 { 70 return G4ThreeVector(phantomSizeX - detectorSizeX+ detectorPosition.getX(),71 phantomSizeY - detectorSizeY+ detectorPosition.getY(),72 phantomSizeZ - detectorSizeZ+ detectorPosition.getZ()71 return G4ThreeVector(phantomSizeX/2 - detectorSizeX/2 + detectorPosition.getX(), 72 phantomSizeY/2 - detectorSizeY/2 + detectorPosition.getY(), 73 phantomSizeZ/2 - detectorSizeZ/2 + detectorPosition.getZ() 73 74 ); 74 75 } … … 79 80 { 80 81 // Adjust detector position 81 detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX + detectorSizeX);82 detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY + detectorSizeY);83 detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ + detectorSizeZ);82 detectorPosition.setX(detectorToPhantomPosition.getX() - phantomSizeX/2 + detectorSizeX/2); 83 detectorPosition.setY(detectorToPhantomPosition.getY() - phantomSizeY/2 + detectorSizeY/2); 84 detectorPosition.setZ(detectorToPhantomPosition.getZ() - phantomSizeZ/2 + detectorSizeZ/2); 84 85 85 if (detectorPhysicalVolume) detectorPhysicalVolume -> SetTranslation(detectorPosition); 86 //G4cout << "*************** DetectorToPhantomPosition " << detectorToPhantomPosition/cm << "\n"; 87 //G4cout << "*************** DetectorPosition " << detectorPosition/cm << "\n"; 86 88 } 87 89 ///////////////////////////////////////////////////////////////////////////// 88 90 // Check whether detector is inside phantom 89 inline bool IsInside(G4double detector HalfX,90 G4double detector HalfY,91 G4double detector HalfZ,92 G4double phantom HalfX,93 G4double phantom HalfY,94 G4double phantom HalfZ,91 inline bool IsInside(G4double detectorX, 92 G4double detectorY, 93 G4double detectorZ, 94 G4double phantomX, 95 G4double phantomY, 96 G4double phantomZ, 95 97 G4ThreeVector detectorToPhantomPosition) 96 98 { 97 99 // Dimensions check... X Y and Z 98 100 // Firstly check what dimension we are modifying 99 if (detectorHalfX > 0. && phantomHalfX > 0. && detectorToPhantomPosition.getX() >=0.)100 101 { 101 if (detector HalfX > phantomHalfX)102 if (detectorX > phantomX) 102 103 { 103 104 G4cout << "Error: Detector X dimension must be smaller or equal to the corrispondent of the phantom" << G4endl; 104 105 return false; 105 106 } 106 if ( 2*(phantomHalfX - detectorHalfX) < detectorToPhantomPosition.getX())107 if ( (phantomX - detectorX) < detectorToPhantomPosition.getX()) 107 108 { 108 109 G4cout << "Error: X dimension doesn't fit with detector to phantom relative position" << G4endl; … … 111 112 } 112 113 113 if (detectorHalfY > 0. && phantomHalfY > 0.&& detectorToPhantomPosition.getY() >=0.)114 114 { 115 if (detector HalfY > phantomHalfY)115 if (detectorY > phantomY) 116 116 { 117 117 G4cout << "Error: Detector Y dimension must be smaller or equal to the corrispondent of the phantom" << G4endl; 118 118 return false; 119 119 } 120 if ( 2*(phantomHalfY - detectorHalfY) < detectorToPhantomPosition.getY())120 if ( (phantomY - detectorY) < detectorToPhantomPosition.getY()) 121 121 { 122 122 G4cout << "Error: Y dimension doesn't fit with detector to phantom relative position" << G4endl; … … 125 125 } 126 126 127 if (detectorHalfZ > 0. && phantomHalfZ > 0.&& detectorToPhantomPosition.getZ() >=0.)128 127 { 129 if (detector HalfZ > phantomHalfZ)128 if (detectorZ > phantomZ) 130 129 { 131 130 G4cout << "Error: Detector Z dimension must be smaller or equal to the corrispondent of the phantom" << G4endl; 132 131 return false; 133 132 } 134 if ( 2*(phantomHalfZ - detectorHalfZ) < detectorToPhantomPosition.getZ())133 if ( (phantomZ - detectorZ) < detectorToPhantomPosition.getZ()) 135 134 { 136 135 G4cout << "Error: Z dimension doesn't fit with detector to phantom relative position" << G4endl; … … 138 137 } 139 138 } 140 /* 141 G4cout << "Displacement between Phantom and Detector is: "; 142 G4cout << "DX= "<< G4BestUnit(detectorToPhantomPosition.getX(),"Length") << 143 "DY= "<< G4BestUnit(detectorToPhantomPosition.getY(),"Length") << 144 "DZ= "<< G4BestUnit(detectorToPhantomPosition.getZ(),"Length") << G4endl; 145 */ 139 146 140 return true; 147 141 } 148 142 ///////////////////////////////////////////////////////////////////////////// 149 143 150 G4bool SetNumberOfVoxelBySize(G4double sizeX, G4double sizeY, G4double sizeZ); 151 G4bool SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ); 152 G4bool SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ); 153 G4bool SetPhantomPosition(G4ThreeVector); 154 G4bool SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition); 144 G4bool SetPhantomMaterial(G4String material); 145 void SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ); 146 void SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ); 147 void SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ); 148 void SetPhantomPosition(G4ThreeVector); 149 void SetDetectorToPhantomPosition(G4ThreeVector DetectorToPhantomPosition); 150 void UpdateGeometry(); 151 void PrintParameters(); 155 152 G4LogicalVolume* GetDetectorLogicalVolume(){ return detectorLogicalVolume;} 156 153 … … 169 166 HadrontherapyMatrix* matrix; 170 167 171 G4VPhysicalVolume* phantomPhysicalVolume; 172 G4LogicalVolume* phantomLogicalVolume; 173 G4LogicalVolume* detectorLogicalVolume; 174 G4VPhysicalVolume* detectorPhysicalVolume; 168 G4Box *phantom , *detector; 169 G4LogicalVolume *phantomLogicalVolume, *detectorLogicalVolume; 170 G4VPhysicalVolume *phantomPhysicalVolume, *detectorPhysicalVolume; 175 171 176 172 G4double phantomSizeX; … … 192 188 G4int numberOfVoxelsAlongZ; 193 189 194 G4Box* phantom; 195 G4Box* detector; 190 G4double volumeOfVoxel, massOfVoxel; 196 191 192 G4Material *phantomMaterial, *detectorMaterial; 193 G4Region* aRegion; 197 194 }; 198 195 #endif -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyDetectorMessenger.hh
r1230 r1313 35 35 class HadrontherapyDetectorConstruction; 36 36 class G4UIdirectory; 37 class G4UIcmdWithADoubleAndUnit;38 class G4UIcmdWithAString;39 37 class G4UIcmdWith3VectorAndUnit; 38 class G4UIcmdWithoutParameter; 39 class G4UIcmdWithAString; 40 40 41 41 class HadrontherapyDetectorMessenger: public G4UImessenger … … 54 54 G4UIdirectory *changeThePhantomDir, *changeTheDetectorDir; 55 55 56 G4UIcmdWithoutParameter *updateCmd; 57 G4UIcmdWithAString *changeThePhantomMaterialCmd; 56 58 G4UIcmdWith3VectorAndUnit *changeThePhantomSizeCmd, 57 59 *changeThePhantomPositionCmd, -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyDetectorSD.hh
r1230 r1313 43 43 ~HadrontherapyDetectorSD(); 44 44 45 std::ofstream ofs; 45 46 void Initialize(G4HCofThisEvent*); 46 47 -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyEventAction.hh
r1230 r1313 59 59 G4String drawFlag; //Visualisation flag 60 60 G4int hitsCollectionID; 61 HadrontherapyMatrix *matrix;61 //HadrontherapyMatrix *matrix; 62 62 G4int printModulo; 63 63 HadrontherapyEventActionMessenger* pointerEventMessenger; -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyInteractionParameters.hh
r1230 r1313 34 34 #include "G4NistElementBuilder.hh" 35 35 36 #ifdef G4ANALYSIS_USE_ROOT 37 #include "TROOT.h" 38 #include "TCanvas.h" 39 #include "TFile.h" 40 #include "TH1F.h" 41 #include "TH2F.h" 42 #include "TGraph.h" 43 #include "TLegend.h" 44 #include "TLegendEntry.h" 45 #include "TStyle.h" 46 #endif 47 36 48 class HadrontherapyDetectorConstruction; 37 49 class HadrontherapyParameterMessenger; 50 class G4ParticleDefinition; 51 class G4Material; 52 38 53 class HadrontherapyInteractionParameters : public G4EmCalculator 39 54 { 40 55 public: 41 56 42 HadrontherapyInteractionParameters( );43 ~HadrontherapyInteractionParameters();57 HadrontherapyInteractionParameters(G4bool); 58 ~HadrontherapyInteractionParameters(); 44 59 45 // Get data for Mass SP (MeV*cm2/g)60 // Get data for Mass SP 46 61 // G4NistMaterialBuilder class materials 47 62 // User must provide: material kinetic energy lower limit, kinetic energy upper limit, number of points to retrieve, 48 63 // [particle], [output filename]. 49 64 50 bool GetStoppingTable (const G4String& vararg); 65 G4bool GetStoppingTable (const G4String& vararg); 66 G4double GetStopping (G4double energy, 67 const G4ParticleDefinition*, 68 const G4Material*, 69 G4double density = 0.); 70 #ifdef G4ANALYSIS_USE_ROOT 71 void PlotStopping(const G4String&); 72 #endif 51 73 void ListOfNistMaterials (const G4String& vararg); 52 74 void BeamOn(); … … 55 77 private: 56 78 G4Material* GetNistMaterial(G4String material); 57 58 79 G4NistElementBuilder* nistEle; 59 80 G4NistMaterialBuilder* nistMat; 60 G4double kinEmin, kinEmax, npoints;61 G4String particle, material, filename;62 81 std::ofstream outfile; 63 82 std::ostream data; 64 83 G4Material* Pmaterial; 65 G4double density;66 G4EmCalculator* emCal;67 84 HadrontherapyParameterMessenger* pMessenger; 68 85 bool beamFlag; 86 87 #ifdef G4ANALYSIS_USE_ROOT 88 TCanvas *theRootCanvas; 89 TGraph *theRootGraph; 90 TAxis *axisX, *axisY; 91 #endif 92 G4double kinEmin, kinEmax, npoints; 93 G4String particle, material, filename; 94 G4double dedxtot, density; 95 std::vector<G4double> energy; 96 std::vector<G4double> massDedx; 97 69 98 }; 70 99 #endif -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyMatrix.hh
r1230 r1313 29 29 #ifndef HadrontherapyMatrix_H 30 30 #define HadrontherapyMatrix_H 1 31 31 #include <G4ParticleDefinition.hh> 32 32 #include "globals.hh" 33 33 #include <vector> 34 #include <fstream> 34 35 35 36 // The information: energy deposit and position in the phantom 36 37 // is stored in a matrix 37 38 39 // type struct useful to store nucludes data 40 struct ion 41 { 42 G4bool isPrimary; // true if particle is primary 43 G4int PDGencoding; // Particle data group id for the particle 44 //G4String extName; // AZ[excitation energy]: like He3[1277.4], He4[0.0], Li7[231.4], ... 45 G4String name; // simple name without excitation energy: He3, He4, Li7, ... 46 G4int len; // name length 47 G4int Z; // atomic number 48 G4int A; // mass number 49 G4double *dose; // pointer to dose matrix 50 unsigned int *fluence; // pointer to fluence matrix 51 //friend bool operator<(const ion& a, const ion& b) {return (a.Z == b.Z) ? b.A < a.A : b.Z < a.Z ;} 52 G4bool operator<(const ion& a) const{return (this->Z == a.Z) ? this-> A < a.A : this->Z < a.Z ;} 53 }; 54 38 55 class HadrontherapyMatrix 39 56 { 40 57 private: 41 HadrontherapyMatrix(G4int voxelX, G4int voxelY, G4int voxelZ); //<--- this is supposed to be a singleton 58 HadrontherapyMatrix(G4int numberOfVoxelAlongX, 59 G4int numberOfVoxelAlongY, 60 G4int numberOfVoxelAlongZ, 61 G4double massOfVoxel); //< this is supposed to be a singleton 62 42 63 43 64 public: 44 65 45 66 ~HadrontherapyMatrix(); 46 // Get object instance only 47 static HadrontherapyMatrix* getInstance(); 48 // Make & Get instance 49 static HadrontherapyMatrix* getInstance(G4int nX, G4int nY, G4int nZ); 50 51 void flush(); 52 67 // Get object instance only 68 static HadrontherapyMatrix* GetInstance(); 69 // Make & Get instance 70 static HadrontherapyMatrix* GetInstance(G4int nX, G4int nY, G4int nZ, G4double mass); 71 72 static G4bool secondaries; 73 // Full list of generated nuclides 74 void PrintNuclides(); 75 // Hit array marker (useful to avoid multiple counts of fluence) 76 void ClearHitTrack(); 77 G4int* GetHitTrack(G4int i, G4int j, G4int k); 78 79 // All the elements of the matrix are initialised to zero 53 80 void Initialize(); 54 // All the elements of the matrix are initialised to zero 55 81 void Clear(); 82 // Fill DOSE/fluence matrix for particle: 83 // if fluence parameter is true then fluence at voxel (i, j, k) is increased 84 // else energyDeposit fill the dose matrix for voxel (i,j,k) 85 G4bool Fill(G4int, G4ParticleDefinition* particleDef, G4int i, G4int j, G4int k, G4double energyDeposit, G4bool fluence=false); 86 87 // Fill TOTAL DOSE matrix for primary particles only 56 88 void Fill(G4int i, G4int j, G4int k, G4double energyDeposit); 57 89 // The matrix is filled with the energy deposit 58 90 // in the element corresponding to the voxel of the phantom where 59 91 // the energy deposit was registered 60 61 void TotalEnergyDeposit(); 92 62 93 // Store the information of the matrix in a ntuple and in 63 94 // a 1D Histogram 64 65 inline G4int Index(G4int i, G4int j, G4int k){ return (i * numberVoxelY + j) * numberVoxelZ + k; } 66 // Get a unique index from a three dimensional voxel information 95 void TotalEnergyDeposit(); 96 97 // Store single matrix data to filename 98 void StoreMatrix(G4String file, void* data,size_t psize); 99 // Store all fluence data to filenames 100 void StoreFluenceData(); 101 // Store all dose data to filenames 102 void StoreDoseData(); 67 103 104 // Store all data (except the total dose) to ONE filename 105 void StoreDoseFluenceAscii(); 106 107 #ifdef G4ANALYSIS_USE_ROOT 108 void StoreDoseFluenceRoot(); 109 #endif 110 111 inline G4int Index(G4int i, G4int j, G4int k) { return (i * numberOfVoxelAlongY + j) * numberOfVoxelAlongZ + k; } 112 // Get a unique index from a three dimensional one 113 114 G4double * GetMatrix(){return matrix;} 115 116 G4int GetNvoxel(){return numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ;} 117 // Total number of voxels read only access 118 G4int GetNumberOfVoxelAlongX(){return numberOfVoxelAlongX;} 119 G4int GetNumberOfVoxelAlongY(){return numberOfVoxelAlongY;} 120 G4int GetNumberOfVoxelAlongZ(){return numberOfVoxelAlongZ;} 68 121 private: 69 122 70 123 static HadrontherapyMatrix* instance; 71 G4int numberVoxelX; 72 G4int numberVoxelY; 73 G4int numberVoxelZ; 124 G4int numberOfVoxelAlongX; 125 G4int numberOfVoxelAlongY; 126 G4int numberOfVoxelAlongZ; 127 G4double massOfVoxel; 128 74 129 G4double* matrix; 130 G4int* hitTrack; 131 G4String filename; 132 std::ofstream ofs; 133 134 // Dose&fluence data store 135 std::vector <ion> ionStore; 136 // want secondaries? 137 G4double doseUnit; 75 138 }; 76 139 #endif 140 -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyPhysicsList.hh
r1230 r1313 51 51 void SetCutForElectron(G4double); 52 52 void SetCutForPositron(G4double); 53 53 void SetDetectorCut(G4double cut); 54 54 void AddPhysicsList(const G4String& name); 55 55 void ConstructProcess(); -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyPhysicsListMessenger.hh
r1230 r1313 58 58 G4UIcmdWithADoubleAndUnit* protoCutCmd; 59 59 G4UIcmdWithADoubleAndUnit* allCutCmd; 60 G4UIcmdWithADoubleAndUnit* allDetectorCmd; 60 61 G4UIcmdWithAString* pListCmd; 61 62 G4UIcmdWithAString* packageListCmd; -
trunk/examples/advanced/hadrontherapy/include/HadrontherapyPrimaryGeneratorAction.hh
r1230 r1313 57 57 void SetsigmaMomentumZ(G4double); 58 58 G4double GetmeanKineticEnergy(void); 59 G4ParticleGun *GetParticleGun(void){return particleGun;} 59 60 60 61 private: … … 71 72 72 73 private: 73 G4ParticleGun* particleGun;74 G4ParticleGun* particleGun; 74 75 HadrontherapyPrimaryGeneratorMessenger* gunMessenger; 75 G4double sigmaX;76 G4double sigmaX; 76 77 }; 77 78 -
trunk/examples/advanced/hadrontherapy/include/PassiveProtonBeamLine.hh
r1230 r1313 116 116 117 117 private: 118 119 void SetD imensions(); //passive proton line dimensions118 //passive proton line dimensions 119 void SetDefaultDimensions(); 120 120 void ConstructPassiveProtonBeamLine(); 121 121 -
trunk/examples/advanced/hadrontherapy/include/PassiveProtonBeamLineMessenger.hh
r1230 r1313 24 24 // ******************************************************************** 25 25 // 26 // HadrontherapyDetectorMessenger.hh;26 // PassiveProtonBeamLineMessenger.hh; 27 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 28 29 #ifndef HadrontherapyDetectorMessenger_h30 #define HadrontherapyDetectorMessenger_h 129 #ifndef PassiveProtonBeamLineMessenger_h 30 #define PassiveProtonBeamLineMessenger_h 1 31 31 32 32 #include "globals.hh" -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyAnalysisManager.cc
r1230 r1313 1 //2 // ********************************************************************3 // * License and Disclaimer *4 // * *5 // * The Geant4 software is copyright of the Copyright Holders of *6 // * the Geant4 Collaboration. It is provided under the terms and *7 // * conditions of the Geant4 Software License, included in the file *8 // * LICENSE and available at http://cern.ch/geant4/license . These *9 // * include a list of copyright holders. *10 // * *11 // * Neither the authors of this software system, nor their employing *12 // * institutes,nor the agencies providing financial support for this *13 // * work make any representation or warranty, express or implied, *14 // * regarding this software system or assume any liability for its *15 // * use. Please see the license in the file LICENSE and URL above *16 // * for the full disclaimer and the limitation of liability. *17 // * *18 // * This code implementation is the result of the scientific and *19 // * technical work of the GEANT4 collaboration. *20 // * By using, copying, modifying or distributing the software (or *21 // * any work based on the software) you agree to acknowledge its *22 // * use in resulting scientific publications, and indicate your *23 // * acceptance of all terms of the Geant4 Software license. *24 // ********************************************************************25 //26 // $Id: HadrontherapyAnalisysManager.cc;27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // $Id: HadrontherapyAnalisysManager.cc; 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 28 29 29 #include "HadrontherapyAnalysisManager.hh" … … 31 31 #include "HadrontherapyAnalysisFileMessenger.hh" 32 32 #include <time.h> 33 #ifdef ANALYSIS_USE 33 34 34 HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::instance = 0; 35 35 36 #ifdef G4ANALYSIS_USE_ROOT 37 #undef G4ANALYSIS_USE 38 #endif 39 40 ///////////////////////////////////////////////////////////////////////////// 41 42 #ifdef G4ANALYSIS_USE 43 HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() : 44 analysisFileName("DoseDistribution.root"), aFact(0), theTree(0), histFact(0), tupFact(0), h1(0), h2(0), h3(0), 45 h4(0), h5(0), h6(0), h7(0), h8(0), h9(0), h10(0), h11(0), h12(0), h13(0), h14(0), h15(0), h16(0), ntuple(0), 46 ionTuple(0), 47 fragmentTuple(0), 48 eventCounter(0) 49 { 50 fMess = new HadrontherapyAnalysisFileMessenger(this); 51 } 52 #endif 53 #ifdef G4ANALYSIS_USE_ROOT 54 HadrontherapyAnalysisManager::HadrontherapyAnalysisManager() : 55 analysisFileName("DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0), 56 histo4(0), histo5(0), histo6(0), histo7(0), histo8(0), histo9(0), histo10(0), histo11(0), histo12(0), histo13(0), histo14(0), histo15(0), histo16(0), 57 theROOTNtuple(0), 58 theROOTIonTuple(0), 59 fragmentNtuple(0), 60 metaData(0), 61 eventCounter(0) 62 { 63 fMess = new HadrontherapyAnalysisFileMessenger(this); 36 HadrontherapyAnalysisManager::HadrontherapyAnalysisManager(): 37 #ifdef G4ANALYSIS_USE_ROOT 38 analysisFileName("DoseDistribution.root"),theTFile(0), histo1(0), histo2(0), histo3(0), 39 histo4(0), histo5(0), histo6(0), histo7(0), histo8(0), histo9(0), histo10(0), histo11(0), histo12(0), histo13(0), histo14(0), histo15(0), histo16(0), 40 kinFragNtuple(0), 41 kineticEnergyPrimaryNtuple(0), 42 doseFragNtuple(0), 43 fluenceFragNtuple(0), 44 letFragNtuple(0), 45 theROOTNtuple(0), 46 theROOTIonTuple(0), 47 fragmentNtuple(0), 48 metaData(0), 49 eventCounter(0) 50 { 51 fMess = new HadrontherapyAnalysisFileMessenger(this); 64 52 } 65 53 #endif 66 54 ///////////////////////////////////////////////////////////////////////////// 55 67 56 HadrontherapyAnalysisManager::~HadrontherapyAnalysisManager() 68 57 { 69 delete(fMess); //kill the messenger 70 #ifdef G4ANALYSIS_USE 71 delete fragmentTuple; 72 fragmentTuple = 0; 73 74 delete ionTuple; 75 ionTuple = 0; 76 77 delete ntuple; 78 ntuple = 0; 79 80 delete h16; 81 h16 = 0; 82 83 delete h15; 84 h15 = 0; 85 86 delete h14; 87 h14 = 0; 88 89 delete h13; 90 h13 = 0; 91 92 delete h12; 93 h12 = 0; 94 95 delete h11; 96 h11 = 0; 97 98 delete h10; 99 h10 = 0; 100 101 delete h9; 102 h9 = 0; 103 104 delete h8; 105 h8 = 0; 106 107 delete h7; 108 h7 = 0; 109 110 delete h6; 111 h6 = 0; 112 113 delete h5; 114 h5 = 0; 115 116 delete h4; 117 h4 = 0; 118 119 delete h3; 120 h3 = 0; 121 122 delete h2; 123 h2 = 0; 124 125 delete h1; 126 h1 = 0; 127 128 delete tupFact; 129 tupFact = 0; 130 131 delete histFact; 132 histFact = 0; 133 134 delete theTree; 135 theTree = 0; 136 137 delete aFact; 138 aFact = 0; 58 delete(fMess); 59 #ifdef G4ANALYSIS_USE_ROOT 60 Clear(); 139 61 #endif 62 } 63 64 HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::GetInstance() 65 { 66 if (instance == 0) instance = new HadrontherapyAnalysisManager; 67 return instance; 68 } 140 69 #ifdef G4ANALYSIS_USE_ROOT 141 delete metaData; 142 metaData = 0; 143 144 delete fragmentNtuple; 145 fragmentNtuple = 0; 146 147 delete theROOTIonTuple; 148 theROOTIonTuple = 0; 149 150 delete theROOTNtuple; 151 theROOTNtuple = 0; 152 153 delete histo16; 154 histo14 = 0; 155 156 delete histo15; 157 histo14 = 0; 158 159 delete histo14; 160 histo14 = 0; 161 162 delete histo13; 163 histo13 = 0; 164 165 delete histo12; 166 histo12 = 0; 167 168 delete histo11; 169 histo11 = 0; 170 171 delete histo10; 172 histo10 = 0; 173 174 delete histo9; 175 histo9 = 0; 176 177 delete histo8; 178 histo8 = 0; 179 180 delete histo7; 181 histo7 = 0; 182 183 delete histo6; 184 histo6 = 0; 185 186 delete histo5; 187 histo5 = 0; 188 189 delete histo4; 190 histo4 = 0; 191 192 delete histo3; 193 histo3 = 0; 194 195 delete histo2; 196 histo2 = 0; 197 198 delete histo1; 199 histo1 = 0; 70 void HadrontherapyAnalysisManager::Clear() 71 { 72 // XXX delete ALL variables!! 73 // but this seems to be automatically done by 74 // theTFile->Close() command! 75 // so we get a *double free or corruption* 76 77 delete metaData; 78 metaData = 0; 79 80 delete fragmentNtuple; 81 fragmentNtuple = 0; 82 83 delete theROOTIonTuple; 84 theROOTIonTuple = 0; 85 86 delete theROOTNtuple; 87 theROOTNtuple = 0; 88 89 delete histo16; 90 histo16 = 0; 91 92 delete histo15; 93 histo15 = 0; 94 95 delete histo14; 96 histo14 = 0; 97 98 delete histo13; 99 histo13 = 0; 100 101 delete histo12; 102 histo12 = 0; 103 104 delete histo11; 105 histo11 = 0; 106 107 delete histo10; 108 histo10 = 0; 109 110 delete histo9; 111 histo9 = 0; 112 113 delete histo8; 114 histo8 = 0; 115 116 delete histo7; 117 histo7 = 0; 118 119 delete histo6; 120 histo6 = 0; 121 122 delete histo5; 123 histo5 = 0; 124 125 delete histo4; 126 histo4 = 0; 127 128 delete histo3; 129 histo3 = 0; 130 131 delete histo2; 132 histo2 = 0; 133 134 delete histo1; 135 histo1 = 0; 136 } 137 ///////////////////////////////////////////////////////////////////////////// 138 139 void HadrontherapyAnalysisManager::SetAnalysisFileName(G4String aFileName) 140 { 141 this->analysisFileName = aFileName; 142 } 143 144 ///////////////////////////////////////////////////////////////////////////// 145 void HadrontherapyAnalysisManager::book() 146 { 147 delete theTFile; // this is similar to theTFile->Close() => delete all associated variables created via new, moreover it delete itself. 148 149 theTFile = new TFile(analysisFileName, "RECREATE"); 150 151 // Create the histograms with the energy deposit along the X axis 152 histo1 = createHistogram1D("braggPeak","slice, energy", 400, 0., 80); //<different waterthicknesses are accoutned for in ROOT-analysis stage 153 histo2 = createHistogram1D("h20","Secondary protons - slice, energy", 400, 0., 400.); 154 histo3 = createHistogram1D("h30","Secondary neutrons - slice, energy", 400, 0., 400.); 155 histo4 = createHistogram1D("h40","Secondary alpha - slice, energy", 400, 0., 400.); 156 histo5 = createHistogram1D("h50","Secondary gamma - slice, energy", 400, 0., 400.); 157 histo6 = createHistogram1D("h60","Secondary electron - slice, energy", 400, 0., 400.); 158 histo7 = createHistogram1D("h70","Secondary triton - slice, energy", 400, 0., 400.); 159 histo8 = createHistogram1D("h80","Secondary deuteron - slice, energy", 400, 0., 400.); 160 histo9 = createHistogram1D("h90","Secondary pion - slice, energy", 400, 0., 400.); 161 histo10 = createHistogram1D("h100","Energy distribution of secondary electrons", 70, 0., 70.); 162 histo11 = createHistogram1D("h110","Energy distribution of secondary photons", 70, 0., 70.); 163 histo12 = createHistogram1D("h120","Energy distribution of secondary deuterons", 70, 0., 70.); 164 histo13 = createHistogram1D("h130","Energy distribution of secondary tritons", 70, 0., 70.); 165 histo14 = createHistogram1D("h140","Energy distribution of secondary alpha particles", 70, 0., 70.); 166 histo15 = createHistogram1D("heliumEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom", 167 70, 0., 500.); 168 histo16 = createHistogram1D("hydrogenEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom", 169 70, 0., 500.); 170 171 kinFragNtuple = new TNtuple("kinFragNtuple", 172 "Kinetic energy by voxel & fragment", 173 "i:j:k:A:Z:kineticEnergy"); 174 kineticEnergyPrimaryNtuple= new TNtuple("kineticEnergyPrimaryNtuple", 175 "Kinetic energy by voxel of primary", 176 "i:j:k:kineticEnergy"); 177 doseFragNtuple = new TNtuple("doseFragNtuple", 178 "Energy deposit by voxel & fragment", 179 "i:j:k:A:Z:energy"); 180 181 fluenceFragNtuple = new TNtuple("fluenceFragNtuple", 182 "Fluence by voxel & fragment", 183 "i:j:k:A:Z:fluence"); 184 185 letFragNtuple = new TNtuple("letFragNtuple", 186 "Let by voxel & fragment", 187 "i:j:k:A:Z:letT:letD"); 188 189 theROOTNtuple = new TNtuple("theROOTNtuple", 190 "Energy deposit by slice", 191 "i:j:k:energy"); 192 193 theROOTIonTuple = new TNtuple("theROOTIonTuple", 194 "Generic ion information", 195 "a:z:occupancy:energy"); 196 197 fragmentNtuple = new TNtuple("fragmentNtuple", 198 "Fragments", 199 "A:Z:energy:posX:posY:posZ"); 200 201 metaData = new TNtuple("metaData", 202 "Metadata", 203 "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance"); 204 } 205 206 ///////////////////////////////////////////////////////////////////////////// 207 void HadrontherapyAnalysisManager::FillEnergyDeposit(G4int i, 208 G4int j, 209 G4int k, 210 G4double energy) 211 { 212 if (theROOTNtuple) { 213 theROOTNtuple->Fill(i, j, k, energy); 214 } 215 } 216 217 ///////////////////////////////////////////////////////////////////////////// 218 void HadrontherapyAnalysisManager::BraggPeak(G4int slice, G4double energy) 219 { 220 histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct 221 } 222 223 ///////////////////////////////////////////////////////////////////////////// 224 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(G4int slice, G4double energy) 225 { 226 histo2->Fill(slice, energy); 227 } 228 229 ///////////////////////////////////////////////////////////////////////////// 230 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(G4int slice, G4double energy) 231 { 232 histo3->Fill(slice, energy); 233 } 234 235 ///////////////////////////////////////////////////////////////////////////// 236 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(G4int slice, G4double energy) 237 { 238 histo4->Fill(slice, energy); 239 } 240 241 ///////////////////////////////////////////////////////////////////////////// 242 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(G4int slice, G4double energy) 243 { 244 histo5->Fill(slice, energy); 245 } 246 247 ///////////////////////////////////////////////////////////////////////////// 248 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(G4int slice, G4double energy) 249 { 250 histo6->Fill(slice, energy); 251 } 252 253 ///////////////////////////////////////////////////////////////////////////// 254 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(G4int slice, G4double energy) 255 { 256 histo7->Fill(slice, energy); 257 } 258 259 ///////////////////////////////////////////////////////////////////////////// 260 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy) 261 { 262 histo8->Fill(slice, energy); 263 } 264 265 ///////////////////////////////////////////////////////////////////////////// 266 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(G4int slice, G4double energy) 267 { 268 histo9->Fill(slice, energy); 269 } 270 271 ///////////////////////////////////////////////////////////////////////////// 272 void HadrontherapyAnalysisManager::electronEnergyDistribution(G4double energy) 273 { 274 histo10->Fill(energy); 275 } 276 277 ///////////////////////////////////////////////////////////////////////////// 278 void HadrontherapyAnalysisManager::gammaEnergyDistribution(G4double energy) 279 { 280 histo11->Fill(energy); 281 } 282 283 ///////////////////////////////////////////////////////////////////////////// 284 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(G4double energy) 285 { 286 histo12->Fill(energy); 287 } 288 289 ///////////////////////////////////////////////////////////////////////////// 290 void HadrontherapyAnalysisManager::tritonEnergyDistribution(G4double energy) 291 { 292 histo13->Fill(energy); 293 } 294 295 ///////////////////////////////////////////////////////////////////////////// 296 void HadrontherapyAnalysisManager::alphaEnergyDistribution(G4double energy) 297 { 298 histo14->Fill(energy); 299 } 300 ///////////////////////////////////////////////////////////////////////////// 301 void HadrontherapyAnalysisManager::heliumEnergy(G4double secondaryParticleKineticEnergy) 302 { 303 histo15->Fill(secondaryParticleKineticEnergy); 304 } 305 306 ///////////////////////////////////////////////////////////////////////////// 307 void HadrontherapyAnalysisManager::hydrogenEnergy(G4double secondaryParticleKineticEnergy) 308 { 309 histo16->Fill(secondaryParticleKineticEnergy); 310 } 311 312 ///////////////////////////////////////////////////////////////////////////// 313 // FillKineticFragmentTuple create an ntuple where the voxel indexs, the atomic number and mass and the kinetic 314 // energy of all the particles interacting with the phantom, are stored 315 void HadrontherapyAnalysisManager::FillKineticFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double kinEnergy) 316 { 317 kinFragNtuple -> Fill(i, j, k, A, Z, kinEnergy); 318 } 319 320 ///////////////////////////////////////////////////////////////////////////// 321 // FillKineticEnergyPrimaryNTuple creates a ntuple where the voxel indexs and the kinetic 322 // energies of ONLY primary particles interacting with the phantom, are stored 323 void HadrontherapyAnalysisManager::FillKineticEnergyPrimaryNTuple(G4int i, G4int j, G4int k, G4double kinEnergy) 324 { 325 kineticEnergyPrimaryNtuple -> Fill(i, j, k, kinEnergy); 326 } 327 328 ///////////////////////////////////////////////////////////////////////////// 329 // This function is called only if ROOT is activated. 330 // It is called by the HadrontherapyMatric.cc class file and it is used to create two ntuples containing 331 // the total energy deposited and the fluence values, in each voxel and per any particle (primary beam 332 // and secondaries ) 333 void HadrontherapyAnalysisManager::FillVoxelFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double energy, G4double fluence) 334 { 335 // Fill the ntuple containing the voxel, mass and atomic number and the energy deposited 336 doseFragNtuple -> Fill( i, j, k, A, Z, energy ); 337 338 // Fill the ntuple containing the voxel, mass and atomic number and the fluence 339 if (i==1 && Z==1) { 340 fluenceFragNtuple -> Fill( i, j, k, A, Z, fluence ); 341 342 } 343 } 344 345 void HadrontherapyAnalysisManager::FillLetFragmentTuple(G4int i, G4int j, G4int k, G4int A, G4double Z, G4double letT, G4double letD) 346 { 347 letFragNtuple -> Fill( i, j, k, A, Z, letT, letD); 348 349 } 350 ///////////////////////////////////////////////////////////////////////////// 351 void HadrontherapyAnalysisManager::FillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ) 352 { 353 fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ); 354 } 355 356 ///////////////////////////////////////////////////////////////////////////// 357 void HadrontherapyAnalysisManager::genericIonInformation(G4int a, 358 G4double z, 359 G4int electronOccupancy, 360 G4double energy) 361 { 362 if (theROOTIonTuple) { 363 theROOTIonTuple->Fill(a, z, electronOccupancy, energy); 364 } 365 } 366 367 ///////////////////////////////////////////////////////////////////////////// 368 void HadrontherapyAnalysisManager::startNewEvent() 369 { 370 eventCounter++; 371 } 372 ///////////////////////////////////////////////////////////////////////////// 373 void HadrontherapyAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness, G4double phantomCenter) 374 { 375 this->detectorDistance = endDetectorPosition; 376 this->phantomDepth = waterThickness; 377 this->phantomCenterDistance = phantomCenter; 378 } 379 void HadrontherapyAnalysisManager::setBeamMetaData(G4double meanKineticEnergy,G4double sigmaEnergy) 380 { 381 this->beamEnergy = meanKineticEnergy; 382 this->energyError = sigmaEnergy; 383 } 384 ///////////////////////////////////////////////////////////////////////////// 385 // Flush data & close the file 386 void HadrontherapyAnalysisManager::flush() 387 { 388 if (theTFile) 389 { 390 theTFile -> Write(); 391 theTFile -> Close(); 392 } 393 eventCounter = 0; 394 } 395 200 396 #endif 201 }202 /////////////////////////////////////////////////////////////////////////////203 HadrontherapyAnalysisManager* HadrontherapyAnalysisManager::getInstance()204 {205 if (instance == 0) instance = new HadrontherapyAnalysisManager;206 return instance;207 }208 209 /////////////////////////////////////////////////////////////////////////////210 void HadrontherapyAnalysisManager::SetAnalysisFileName(G4String aFileName)211 {212 this->analysisFileName = aFileName;213 }214 215 /////////////////////////////////////////////////////////////////////////////216 void HadrontherapyAnalysisManager::book()217 {218 #ifdef G4ANALYSIS_USE219 // Build up the analysis factory220 aFact = AIDA_createAnalysisFactory();221 AIDA::ITreeFactory* treeFact = aFact -> createTreeFactory();222 223 // Create the .hbk or the .root file224 G4String fileName = "DoseDistribution.hbk";225 226 std::string opts = "export=root";227 228 theTree = treeFact -> create(fileName,"hbook",false,true);229 theTree = treeFact -> create(analysisFileName,"ROOT",false,true,opts);230 231 // Factories are not "managed" by an AIDA analysis system.232 // They must be deleted by the AIDA user code.233 delete treeFact;234 235 // Create the histogram and the ntuple factory236 histFact = aFact -> createHistogramFactory(*theTree);237 tupFact = aFact -> createTupleFactory(*theTree);238 239 // Create the histograms with the enrgy deposit along the X axis240 h1 = histFact -> createHistogram1D("10","slice, energy", 400, 0., 400. );241 242 h2 = histFact -> createHistogram1D("20","Secondary protons - slice, energy", 400, 0., 400. );243 244 h3 = histFact -> createHistogram1D("30","Secondary neutrons - slice, energy", 400, 0., 400. );245 246 h4 = histFact -> createHistogram1D("40","Secondary alpha - slice, energy", 400, 0., 400. );247 248 h5 = histFact -> createHistogram1D("50","Secondary gamma - slice, energy", 400, 0., 400. );249 250 h6 = histFact -> createHistogram1D("60","Secondary electron - slice, energy", 400, 0., 400. );251 252 h7 = histFact -> createHistogram1D("70","Secondary triton - slice, energy", 400, 0., 400. );253 254 h8 = histFact -> createHistogram1D("80","Secondary deuteron - slice, energy", 400, 0., 400. );255 256 h9 = histFact -> createHistogram1D("90","Secondary pion - slice, energy", 400, 0., 400. );257 258 h10 = histFact -> createHistogram1D("100","Energy distribution of secondary electrons", 70, 0., 70. );259 260 h11 = histFact -> createHistogram1D("110","Energy distribution of secondary photons", 70, 0., 70. );261 262 h12 = histFact -> createHistogram1D("120","Energy distribution of secondary deuterons", 70, 0., 70. );263 264 h13 = histFact -> createHistogram1D("130","Energy distribution of secondary tritons", 70, 0., 70. );265 266 h14 = histFact -> createHistogram1D("140","Energy distribution of secondary alpha particles", 70, 0., 70. );267 268 h15 = histFact -> createHistogram1D("150","Energy distribution of helium fragments after the phantom", 70, 0., 500.);269 270 h16 = histFact -> createHistogram1D("160","Energy distribution of hydrogen fragments after the phantom", 70, 0., 500.);271 272 // Create the ntuple273 G4String columnNames = "int i; int j; int k; double energy;";274 G4String options = "";275 if (tupFact) ntuple = tupFact -> create("1","1",columnNames, options);276 277 // Create the ntuple278 G4String columnNames2 = "int a; double z; int occupancy; double energy;";279 G4String options2 = "";280 if (tupFact) ionTuple = tupFact -> create("2","2", columnNames2, options2);281 282 // Create the fragment ntuple283 G4String columnNames3 = "int a; double z; double energy; double posX; double posY; double posZ;";284 G4String options3 = "";285 if (tupFact) fragmentTuple = tupFact -> create("3","3", columnNames3, options3);286 #endif287 #ifdef G4ANALYSIS_USE_ROOT288 // Use ROOT289 theTFile = new TFile(analysisFileName, "RECREATE");290 291 // Create the histograms with the energy deposit along the X axis292 histo1 = createHistogram1D("braggPeak","slice, energy", 400, 0., 27.9); //<different waterthicknesses are accoutned for in ROOT-analysis stage293 histo2 = createHistogram1D("h20","Secondary protons - slice, energy", 400, 0., 400.);294 histo3 = createHistogram1D("h30","Secondary neutrons - slice, energy", 400, 0., 400.);295 histo4 = createHistogram1D("h40","Secondary alpha - slice, energy", 400, 0., 400.);296 histo5 = createHistogram1D("h50","Secondary gamma - slice, energy", 400, 0., 400.);297 histo6 = createHistogram1D("h60","Secondary electron - slice, energy", 400, 0., 400.);298 histo7 = createHistogram1D("h70","Secondary triton - slice, energy", 400, 0., 400.);299 histo8 = createHistogram1D("h80","Secondary deuteron - slice, energy", 400, 0., 400.);300 histo9 = createHistogram1D("h90","Secondary pion - slice, energy", 400, 0., 400.);301 histo10 = createHistogram1D("h100","Energy distribution of secondary electrons", 70, 0., 70.);302 histo11 = createHistogram1D("h110","Energy distribution of secondary photons", 70, 0., 70.);303 histo12 = createHistogram1D("h120","Energy distribution of secondary deuterons", 70, 0., 70.);304 histo13 = createHistogram1D("h130","Energy distribution of secondary tritons", 70, 0., 70.);305 histo14 = createHistogram1D("h140","Energy distribution of secondary alpha particles", 70, 0., 70.);306 histo15 = createHistogram1D("heliumEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",307 70, 0., 500.);308 histo16 = createHistogram1D("hydrogenEnergyAfterPhantom","Energy distribution of secondary helium fragments after the phantom",309 70, 0., 500.);310 311 theROOTNtuple = new TNtuple("theROOTNtuple", "Energy deposit by slice", "i:j:k:energy");312 theROOTIonTuple = new TNtuple("theROOTIonTuple", "Generic ion information", "a:z:occupancy:energy");313 fragmentNtuple = new TNtuple("fragmentNtuple", "Fragments", "A:Z:energy:posX:posY:posZ");314 metaData = new TNtuple("metaData", "Metadata", "events:detectorDistance:waterThickness:beamEnergy:energyError:phantomCenterDistance");315 #endif316 }317 318 /////////////////////////////////////////////////////////////////////////////319 void HadrontherapyAnalysisManager::FillEnergyDeposit(G4int i,320 G4int j,321 G4int k,322 G4double energy)323 {324 #ifdef G4ANALYSIS_USE325 if (ntuple) {326 G4int iSlice = ntuple -> findColumn("i");327 G4int jSlice = ntuple -> findColumn("j");328 G4int kSlice = ntuple -> findColumn("k");329 G4int iEnergy = ntuple -> findColumn("energy");330 331 ntuple -> fill(iSlice,i);332 ntuple -> fill(jSlice,j);333 ntuple -> fill(kSlice,k);334 ntuple -> fill(iEnergy, energy); }335 336 ntuple -> addRow();337 #endif338 #ifdef G4ANALYSIS_USE_ROOT339 if (theROOTNtuple) {340 theROOTNtuple->Fill(i, j, k, energy);341 }342 #endif343 }344 345 /////////////////////////////////////////////////////////////////////////////346 void HadrontherapyAnalysisManager::BraggPeak(G4int slice, G4double energy)347 {348 #ifdef G4ANALYSIS_USE349 h1 -> fill(slice,energy);350 #endif351 #ifdef G4ANALYSIS_USE_ROOT352 histo1->SetBinContent(slice, energy); //This uses setbincontent instead of fill to get labels correct353 #endif354 }355 356 /////////////////////////////////////////////////////////////////////////////357 void HadrontherapyAnalysisManager::SecondaryProtonEnergyDeposit(G4int slice, G4double energy)358 {359 #ifdef G4ANALYSIS_USE360 h2 -> fill(slice,energy);361 #endif362 #ifdef G4ANALYSIS_USE_ROOT363 histo2->Fill(slice, energy);364 #endif365 }366 367 /////////////////////////////////////////////////////////////////////////////368 void HadrontherapyAnalysisManager::SecondaryNeutronEnergyDeposit(G4int slice, G4double energy)369 {370 #ifdef G4ANALYSIS_USE371 h3 -> fill(slice,energy);372 #endif373 #ifdef G4ANALYSIS_USE_ROOT374 histo3->Fill(slice, energy);375 #endif376 }377 378 /////////////////////////////////////////////////////////////////////////////379 void HadrontherapyAnalysisManager::SecondaryAlphaEnergyDeposit(G4int slice, G4double energy)380 {381 #ifdef G4ANALYSIS_USE382 h4 -> fill(slice,energy);383 #endif384 #ifdef G4ANALYSIS_USE_ROOT385 histo4->Fill(slice, energy);386 #endif387 }388 389 /////////////////////////////////////////////////////////////////////////////390 void HadrontherapyAnalysisManager::SecondaryGammaEnergyDeposit(G4int slice, G4double energy)391 {392 #ifdef G4ANALYSIS_USE393 h5 -> fill(slice,energy);394 #endif395 #ifdef G4ANALYSIS_USE_ROOT396 histo5->Fill(slice, energy);397 #endif398 }399 400 /////////////////////////////////////////////////////////////////////////////401 void HadrontherapyAnalysisManager::SecondaryElectronEnergyDeposit(G4int slice, G4double energy)402 {403 #ifdef G4ANALYSIS_USE404 h6 -> fill(slice,energy);405 #endif406 #ifdef G4ANALYSIS_USE_ROOT407 histo6->Fill(slice, energy);408 #endif409 }410 411 /////////////////////////////////////////////////////////////////////////////412 void HadrontherapyAnalysisManager::SecondaryTritonEnergyDeposit(G4int slice, G4double energy)413 {414 #ifdef G4ANALYSIS_USE415 h7 -> fill(slice,energy);416 #endif417 #ifdef G4ANALYSIS_USE_ROOT418 histo7->Fill(slice, energy);419 #endif420 }421 422 /////////////////////////////////////////////////////////////////////////////423 void HadrontherapyAnalysisManager::SecondaryDeuteronEnergyDeposit(G4int slice, G4double energy)424 {425 #ifdef G4ANALYSIS_USE426 h8 -> fill(slice,energy);427 #endif428 #ifdef G4ANALYSIS_USE_ROOT429 histo8->Fill(slice, energy);430 #endif431 }432 433 /////////////////////////////////////////////////////////////////////////////434 void HadrontherapyAnalysisManager::SecondaryPionEnergyDeposit(G4int slice, G4double energy)435 {436 #ifdef G4ANALYSIS_USE437 h9 -> fill(slice,energy);438 #endif439 #ifdef G4ANALYSIS_USE_ROOT440 histo9->Fill(slice, energy);441 #endif442 }443 444 /////////////////////////////////////////////////////////////////////////////445 void HadrontherapyAnalysisManager::electronEnergyDistribution(G4double energy)446 {447 #ifdef G4ANALYSIS_USE448 h10 -> fill(energy);449 #endif450 #ifdef G4ANALYSIS_USE_ROOT451 histo10->Fill(energy);452 #endif453 }454 455 /////////////////////////////////////////////////////////////////////////////456 void HadrontherapyAnalysisManager::gammaEnergyDistribution(G4double energy)457 {458 #ifdef G4ANALYSIS_USE459 h11 -> fill(energy);460 #endif461 #ifdef G4ANALYSIS_USE_ROOT462 histo11->Fill(energy);463 #endif464 }465 466 /////////////////////////////////////////////////////////////////////////////467 void HadrontherapyAnalysisManager::deuteronEnergyDistribution(G4double energy)468 {469 #ifdef G4ANALYSIS_USE470 h12 -> fill(energy);471 #endif472 #ifdef G4ANALYSIS_USE_ROOT473 histo12->Fill(energy);474 #endif475 }476 477 /////////////////////////////////////////////////////////////////////////////478 void HadrontherapyAnalysisManager::tritonEnergyDistribution(G4double energy)479 {480 #ifdef G4ANALYSIS_USE481 h13 -> fill(energy);482 #endif483 #ifdef G4ANALYSIS_USE_ROOT484 histo13->Fill(energy);485 #endif486 }487 488 /////////////////////////////////////////////////////////////////////////////489 void HadrontherapyAnalysisManager::alphaEnergyDistribution(G4double energy)490 {491 #ifdef G4ANALYSIS_USE492 h14 -> fill(energy);493 #endif494 #ifdef G4ANALYSIS_USE_ROOT495 histo14->Fill(energy);496 #endif497 }498 /////////////////////////////////////////////////////////////////////////////499 void HadrontherapyAnalysisManager::heliumEnergy(G4double secondaryParticleKineticEnergy)500 {501 #ifdef G4ANALYSIS_USE502 h15->fill(secondaryParticleKineticEnergy);503 #endif504 #ifdef G4ANALYSIS_USE_ROOT505 histo15->Fill(secondaryParticleKineticEnergy);506 #endif507 }508 509 /////////////////////////////////////////////////////////////////////////////510 void HadrontherapyAnalysisManager::hydrogenEnergy(G4double secondaryParticleKineticEnergy)511 {512 #ifdef G4ANALYSIS_USE513 h16->fill(secondaryParticleKineticEnergy);514 #endif515 #ifdef G4ANALYSIS_USE_ROOT516 histo16->Fill(secondaryParticleKineticEnergy);517 #endif518 }519 520 521 522 void HadrontherapyAnalysisManager::fillFragmentTuple(G4int A, G4double Z, G4double energy, G4double posX, G4double posY, G4double posZ)523 {524 #ifdef G4ANALYSIS_USE525 if (fragmentTuple) {526 G4int aIndex = fragmentTuple -> findColumn("a");527 G4int zIndex = fragmentTuple -> findColumn("z");528 G4int energyIndex = fragmentTuple -> findColumn("energy");529 G4int posXIndex = fragmentTuple -> findColumn("posX");530 G4int posYIndex = fragmentTuple -> findColumn("posY");531 G4int posZIndex = fragmentTuple -> findColumn("posZ");532 533 fragmentTuple -> fill(aIndex,A);534 fragmentTuple -> fill(zIndex,Z);535 fragmentTuple -> fill(energyIndex, energy);536 fragmentTuple -> fill(posXIndex, posX);537 fragmentTuple -> fill(posYIndex, posY);538 fragmentTuple -> fill(posZIndex, posZ);539 fragmentTuple -> addRow();540 }541 #endif542 #ifdef G4ANALYSIS_USE_ROOT543 //G4cout <<" A = " << A << " Z = " << Z << " energy = " << energy << G4endl;544 fragmentNtuple->Fill(A, Z, energy, posX, posY, posZ);545 #endif546 }547 548 /////////////////////////////////////////////////////////////////////////////549 void HadrontherapyAnalysisManager::genericIonInformation(G4int a,550 G4double z,551 G4int electronOccupancy,552 G4double energy)553 {554 #ifdef G4ANALYSIS_USE555 if (ionTuple) {556 G4int aIndex = ionTuple -> findColumn("a");557 G4int zIndex = ionTuple -> findColumn("z");558 G4int electronIndex = ionTuple -> findColumn("occupancy");559 G4int energyIndex = ionTuple -> findColumn("energy");560 561 ionTuple -> fill(aIndex,a);562 ionTuple -> fill(zIndex,z);563 ionTuple -> fill(electronIndex, electronOccupancy);564 ionTuple -> fill(energyIndex, energy);565 }566 ionTuple -> addRow();567 #endif568 #ifdef G4ANALYSIS_USE_ROOT569 if (theROOTIonTuple) {570 theROOTIonTuple->Fill(a, z, electronOccupancy, energy);571 }572 #endif573 }574 575 /////////////////////////////////////////////////////////////////////////////576 void HadrontherapyAnalysisManager::startNewEvent()577 {578 eventCounter++;579 }580 /////////////////////////////////////////////////////////////////////////////581 void HadrontherapyAnalysisManager::setGeometryMetaData(G4double endDetectorPosition, G4double waterThickness, G4double phantomCenter)582 {583 this->detectorDistance = endDetectorPosition;584 this->phantomDepth = waterThickness;585 this->phantomCenterDistance = phantomCenter;586 }587 void HadrontherapyAnalysisManager::setBeamMetaData(G4double meanKineticEnergy,G4double sigmaEnergy)588 {589 this->beamEnergy = meanKineticEnergy;590 this->energyError = sigmaEnergy;591 }592 /////////////////////////////////////////////////////////////////////////////593 void HadrontherapyAnalysisManager::flush()594 {595 HadrontherapyMatrix* matrix = HadrontherapyMatrix::getInstance();596 597 matrix->TotalEnergyDeposit();598 #ifdef G4ANALYSIS_USE599 theTree -> commit();600 theTree ->close();601 #endif602 #ifdef G4ANALYSIS_USE_ROOT603 metaData->Fill((Float_t) eventCounter,(Float_t) detectorDistance, (Float_t) phantomDepth, (Float_t) beamEnergy,(Float_t) energyError, (Float_t) phantomCenterDistance);604 metaData->Write();605 theROOTNtuple->Write();606 theROOTIonTuple->Write();607 fragmentNtuple->Write();608 theTFile->Write();609 // theTFile->Clear();610 theTFile->Close();611 #endif612 eventCounter = 0;613 matrix->flush();614 }615 /////////////////////////////////////////////////////////////////////////////616 void HadrontherapyAnalysisManager::finish()617 {618 #ifdef G4ANALYSIS_USE619 // Write all histograms to file620 theTree -> commit();621 // Close (will again commit)622 theTree ->close();623 #endif624 #ifdef G4ANALYSIS_USE_ROOT625 metaData->Fill((Float_t) eventCounter,(Float_t) detectorDistance, (Float_t) phantomDepth, (Float_t) beamEnergy,(Float_t) energyError, (Float_t) phantomCenterDistance);626 metaData->Write();627 theROOTNtuple->Write();628 theROOTIonTuple->Write();629 fragmentNtuple->Write();630 theTFile->Write();631 theTFile->Close();632 #endif633 eventCounter = 0;634 }635 636 #endif637 638 639 640 641 642 643 644 645 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorConstruction.cc
r1230 r1313 28 28 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 29 29 30 30 31 #include "G4SDManager.hh" 31 32 #include "G4RunManager.hh" 33 #include "G4GeometryManager.hh" 34 #include "G4SolidStore.hh" 35 #include "G4PhysicalVolumeStore.hh" 36 #include "G4LogicalVolumeStore.hh" 32 37 #include "G4Box.hh" 33 38 #include "G4LogicalVolume.hh" … … 42 47 #include "G4VisAttributes.hh" 43 48 #include "G4NistManager.hh" 49 50 #include "HadrontherapyDetectorConstruction.hh" 44 51 #include "HadrontherapyDetectorROGeometry.hh" 45 52 #include "HadrontherapyDetectorMessenger.hh" 46 53 #include "HadrontherapyDetectorSD.hh" 47 #include "HadrontherapyDetectorConstruction.hh"48 54 #include "HadrontherapyMatrix.hh" 55 #include "HadrontherapyAnalysisManager.hh" 56 57 #include <cmath> 49 58 50 59 ///////////////////////////////////////////////////////////////////////////// 51 60 HadrontherapyDetectorConstruction::HadrontherapyDetectorConstruction(G4VPhysicalVolume* physicalTreatmentRoom) 52 : motherPhys(physicalTreatmentRoom), 61 : motherPhys(physicalTreatmentRoom), // pointer to WORLD volume 53 62 detectorSD(0), detectorROGeometry(0), matrix(0), 54 phantom PhysicalVolume(0),55 detectorLogicalVolume(0), detectorPhysicalVolume(0),56 phantom SizeX(20.*cm), phantomSizeY(20.*cm), phantomSizeZ(20.*cm), // Default half dimensions57 detectorSizeX(2.*cm), detectorSizeY(2.*cm), detectorSizeZ(2.*cm),58 phantomPosition(20.*cm, 0.*cm, 0.*cm), 59 detectorToPhantomPosition(0.*cm,18.*cm,18.*cm)// Default displacement of the detector respect to the phantom60 { 63 phantom(0), detector(0), 64 phantomLogicalVolume(0), detectorLogicalVolume(0), 65 phantomPhysicalVolume(0), detectorPhysicalVolume(0), 66 aRegion(0) 67 { 68 HadrontherapyAnalysisManager::GetInstance(); 69 61 70 // NOTE! that the HadrontherapyDetectorConstruction class 62 71 // does NOT inherit from G4VUserDetectorConstruction G4 class … … 69 78 // Default detector voxels size 70 79 // 200 slabs along the beam direction (X) 71 sizeOfVoxelAlongX = 200 *um; 72 sizeOfVoxelAlongY = 2 * detectorSizeY; 73 sizeOfVoxelAlongZ = 2 * detectorSizeZ; 74 75 // Calculate (and eventually set) detector position by displacement, phantom size and detector size 76 SetDetectorPosition(); 77 78 // Build phantom and associated detector 79 ConstructPhantom(); 80 ConstructDetector(); 81 // Set number of the detector voxels along X Y and Z directions. 82 // This will construct also the sensitive detector, the ROGeometry 83 // and the matrix where the energy deposited is collected! 84 SetNumberOfVoxelBySize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ); 80 sizeOfVoxelAlongX = 200 *um; 81 sizeOfVoxelAlongY = 4 *cm; 82 sizeOfVoxelAlongZ = 4 *cm; 83 84 // Define here the material of the water phantom and of the detector 85 SetPhantomMaterial("G4_WATER"); 86 // Construct geometry (messenger commands) 87 SetDetectorSize(4.*cm, 4.*cm, 4.*cm); 88 SetPhantomSize(40. *cm, 40. *cm, 40. *cm); 89 SetPhantomPosition(G4ThreeVector(20. *cm, 0. *cm, 0. *cm)); 90 SetDetectorToPhantomPosition(G4ThreeVector(0. *cm, 18. *cm, 18. *cm)); 91 92 93 // Write virtual parameters to the real ones and check for consistency 94 UpdateGeometry(); 85 95 } 86 96 … … 88 98 HadrontherapyDetectorConstruction::~HadrontherapyDetectorConstruction() 89 99 { 90 delete detectorROGeometry; // This should be safe in C++ even if the argument is a NULL pointer100 delete detectorROGeometry; 91 101 delete matrix; 92 102 delete detectorMessenger; 93 103 } 94 104 105 ///////////////////////////////////////////////////////////////////////////// 106 // ConstructPhantom() is the method that reconstuct a water box (called phantom 107 // (or water phantom) in the usual Medical physicists slang). 108 // A water phantom can be considered a good 109 // approximation of a an human body. 95 110 void HadrontherapyDetectorConstruction::ConstructPhantom() 96 111 { 97 //---------------------------------------- 98 // Phantom: 99 // A box used to approximate tissues 100 //---------------------------------------- 101 102 G4bool isotopes = false; 103 G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes); 104 phantom = new G4Box("Phantom",phantomSizeX, phantomSizeY, phantomSizeZ); 112 // Definition of the solid volume of the Phantom 113 phantom = new G4Box("Phantom", 114 phantomSizeX/2, 115 phantomSizeY/2, 116 phantomSizeZ/2); 117 118 // Definition of the logical volume of the Phantom 105 119 phantomLogicalVolume = new G4LogicalVolume(phantom, 106 waterNist,120 phantomMaterial, 107 121 "phantomLog", 0, 0, 0); 108 122 123 // Definition of the physics volume of the Phantom 109 124 phantomPhysicalVolume = new G4PVPlacement(0, 110 125 phantomPosition, … … 119 134 red -> SetVisibility(true); 120 135 red -> SetForceSolid(true); 121 //red -> SetForceWireframe(true);136 //red -> SetForceWireframe(true); 122 137 phantomLogicalVolume -> SetVisAttributes(red); 123 138 } 124 139 125 140 ///////////////////////////////////////////////////////////////////////////// 141 // ConstructDetector() it the method the reconstruct a detector region 142 // inside the water phantom. It is a volume, located inside the water phantom 143 // and with two coincident faces: 144 // 145 // ************************** 146 // * water phantom * 147 // * * 148 // * * 149 // *--------------- * 150 // Beam * - * 151 // -----> * detector - * 152 // * - * 153 // *--------------- * 154 // * * 155 // * * 156 // * * 157 // ************************** 158 // 159 // The detector is the volume that can be dived in slices or voxelized 160 // and in it we can collect a number of usefull information: 161 // dose distribution, fluence distribution, LET and so on 126 162 void HadrontherapyDetectorConstruction::ConstructDetector() 127 163 { 128 //----------- 129 // Detector 130 //----------- 131 G4bool isotopes = false; 132 G4Material* waterNist = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER", isotopes); 133 detector = new G4Box("Detector",detectorSizeX,detectorSizeY,detectorSizeZ); 164 165 // Definition of the solid volume of the Detector 166 detector = new G4Box("Detector", 167 detectorSizeX/2, 168 detectorSizeY/2, 169 detectorSizeZ/2); 170 171 // Definition of the logic volume of the Phantom 134 172 detectorLogicalVolume = new G4LogicalVolume(detector, 135 waterNist,173 detectorMaterial, 136 174 "DetectorLog", 137 175 0,0,0); 138 // De tector is attached by default to the phantom face directly exposed to the beam139 detectorPhysicalVolume = new G4PVPlacement(0, 140 detectorPosition, // Setted by displacement141 "DetectorPhys",142 detectorLogicalVolume,143 phantomPhysicalVolume,144 false,0);145 176 // Definition of the physical volume of the Phantom 177 detectorPhysicalVolume = new G4PVPlacement(0, 178 detectorPosition, // Setted by displacement 179 "DetectorPhys", 180 detectorLogicalVolume, 181 phantomPhysicalVolume, 182 false,0); 183 146 184 // Visualisation attributes of the detector 147 185 skyBlue = new G4VisAttributes( G4Colour(135/255. , 206/255. , 235/255. )); 148 186 skyBlue -> SetVisibility(true); 149 187 skyBlue -> SetForceSolid(true); 150 //skyBlue -> SetForceWireframe(true);188 //skyBlue -> SetForceWireframe(true); 151 189 detectorLogicalVolume -> SetVisAttributes(skyBlue); 190 191 // ************** 192 // Cut per Region 193 // ************** 152 194 153 } 154 ///////////////////////////////////////////////////////////////////////////// 195 // A smaller cut is fixed in the phantom to calculate the energy deposit with the 196 // required accuracy 197 if (!aRegion) 198 { 199 aRegion = new G4Region("DetectorLog"); 200 detectorLogicalVolume -> SetRegion(aRegion); 201 aRegion -> AddRootLogicalVolume(detectorLogicalVolume); 202 } 203 204 } 205 206 ///////////////////////////////////////////////////////////////////////////// 207 155 208 void HadrontherapyDetectorConstruction::ConstructSensitiveDetector(G4ThreeVector detectorToWorldPosition) 156 209 { 157 210 // Install new Sensitive Detector and ROGeometry 158 211 delete detectorROGeometry; // this should be safe in C++ also if we have a NULL pointer 159 212 //if (detectorSD) detectorSD->PrintAll(); 213 //delete detectorSD; 160 214 // Sensitive Detector and ReadOut geometry definition 161 215 G4SDManager* sensitiveDetectorManager = G4SDManager::GetSDMpointer(); 162 216 163 G4String sensitiveDetectorName = "Detector";217 static G4String sensitiveDetectorName = "Detector"; 164 218 if (!detectorSD) 165 219 { … … 168 222 } 169 223 // The Read Out Geometry is instantiated 170 G4String ROGeometryName = "DetectorROGeometry";224 static G4String ROGeometryName = "DetectorROGeometry"; 171 225 detectorROGeometry = new HadrontherapyDetectorROGeometry(ROGeometryName, 172 226 detectorToWorldPosition, 173 detectorSizeX ,174 detectorSizeY ,175 detectorSizeZ ,227 detectorSizeX/2, 228 detectorSizeY/2, 229 detectorSizeZ/2, 176 230 numberOfVoxelsAlongX, 177 231 numberOfVoxelsAlongY, … … 193 247 } 194 248 } 195 249 void HadrontherapyDetectorConstruction::ParametersCheck() 250 { 251 // Check phantom/detector sizes & relative position 252 if (!IsInside(detectorSizeX, 253 detectorSizeY, 254 detectorSizeZ, 255 phantomSizeX, 256 phantomSizeY, 257 phantomSizeZ, 258 detectorToPhantomPosition 259 )) 260 G4Exception("Error at HadrontherapyDetectorConstruction::ParametersCheck(). Detector is not fully inside Phantom!"); 261 262 // Check Detector sizes respect to the voxel ones 263 264 if ( detectorSizeX < sizeOfVoxelAlongX) { 265 G4Exception("Error at HadrontherapyDetectorConstruction::ParametersCheck(). Detector X size must be bigger or equal than that of Voxel X"); 266 } 267 if ( detectorSizeY < sizeOfVoxelAlongY) { 268 G4Exception("Error at HadrontherapyDetectorConstruction::ParametersCheck(). Detector Y size must be bigger or equal than that of Voxel Y"); 269 } 270 if ( detectorSizeZ < sizeOfVoxelAlongZ) { 271 G4Exception("Error at HadrontherapyDetectorConstruction::ParametersCheck(). Detector Z size must be bigger or equal than that of Voxel Z"); 272 } 273 274 } 196 275 ///////////////// 197 276 // MESSENGERS // 198 277 //////////////// 199 G4bool HadrontherapyDetectorConstruction::SetNumberOfVoxelBySize(G4double sizeX, G4double sizeY, G4double sizeZ) 200 { 201 // Only change positive dimensions 202 // XXX numberOfVoxels must be an integer, warn the user 203 204 if (sizeX > 0) 278 279 G4bool HadrontherapyDetectorConstruction::SetPhantomMaterial(G4String material) 280 { 281 282 if (G4Material* pMat = G4NistManager::Instance()->FindOrBuildMaterial(material, false) ) 205 283 { 206 if (sizeX > 2*detectorSizeX) 284 phantomMaterial = pMat; 285 detectorMaterial = pMat; 286 if (detectorLogicalVolume && phantomLogicalVolume) 207 287 { 208 G4cout << "WARNING: Voxel X size must be smaller or equal than that of detector X" << G4endl; 209 return false; 288 detectorLogicalVolume -> SetMaterial(pMat); 289 phantomLogicalVolume -> SetMaterial(pMat); 290 291 G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 292 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 293 G4cout << "The material of Phantom/Detector has been changed to " << material << G4endl; 210 294 } 211 // Round to the nearest integer 212 numberOfVoxelsAlongX = lrint(2 * detectorSizeX / sizeX); 213 sizeOfVoxelAlongX = (2 * detectorSizeX / numberOfVoxelsAlongX ); 214 if(sizeOfVoxelAlongX!=sizeX) G4cout << "Rounding " << 215 G4BestUnit(sizeX, "Length") << " to " << 216 G4BestUnit(sizeOfVoxelAlongX, "Length") << G4endl; 217 } 218 219 if (sizeY > 0) 295 } 296 else 220 297 { 221 if (sizeY > 2*detectorSizeY) 222 { 223 G4cout << "WARNING: Voxel Y size must be smaller or equal than that of detector Y" << G4endl; 224 return false; 225 } 226 numberOfVoxelsAlongY = lrint(2 * detectorSizeY / sizeY); 227 sizeOfVoxelAlongY = (2 * detectorSizeY / numberOfVoxelsAlongY ); 228 if(sizeOfVoxelAlongY!=sizeY) G4cout << "Rounding " << 229 G4BestUnit(sizeY, "Length") << " to " << 230 G4BestUnit(sizeOfVoxelAlongY, "Length") << G4endl; 231 } 232 if (sizeZ > 0) 298 G4cout << "WARNING: material \"" << material << "\" doesn't exist in NIST elements/materials" 299 " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << G4endl; 300 G4cout << "Use command \"/parameter/nist\" to see full materials list!" << G4endl; 301 return false; 302 } 303 304 return true; 305 } 306 ///////////////////////////////////////////////////////////////////////////// 307 void HadrontherapyDetectorConstruction::SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ) 308 { 309 if (sizeX > 0.) phantomSizeX = sizeX; 310 if (sizeY > 0.) phantomSizeY = sizeY; 311 if (sizeZ > 0.) phantomSizeZ = sizeZ; 312 } 313 ///////////////////////////////////////////////////////////////////////////// 314 ///////////////////////////////////////////////////////////////////////////// 315 void HadrontherapyDetectorConstruction::SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ) 316 { 317 if (sizeX > 0.) {detectorSizeX = sizeX;} 318 if (sizeY > 0.) {detectorSizeY = sizeY;} 319 if (sizeZ > 0.) {detectorSizeZ = sizeZ;} 320 SetVoxelSize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ); 321 } 322 ///////////////////////////////////////////////////////////////////////////// 323 324 void HadrontherapyDetectorConstruction::SetVoxelSize(G4double sizeX, G4double sizeY, G4double sizeZ) 325 { 326 if (sizeX > 0.) {sizeOfVoxelAlongX = sizeX;} 327 if (sizeY > 0.) {sizeOfVoxelAlongY = sizeY;} 328 if (sizeZ > 0.) {sizeOfVoxelAlongZ = sizeZ;} 329 } 330 void HadrontherapyDetectorConstruction::SetPhantomPosition(G4ThreeVector pos) 331 { 332 phantomPosition = pos; 333 } 334 335 ///////////////////////////////////////////////////////////////////////////// 336 void HadrontherapyDetectorConstruction::SetDetectorToPhantomPosition(G4ThreeVector displ) 337 { 338 detectorToPhantomPosition = displ; 339 } 340 ///////////////////////////////////////////////////////////////////////////// 341 void HadrontherapyDetectorConstruction::UpdateGeometry() 342 { 343 ParametersCheck(); 344 345 //G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 346 G4GeometryManager::GetInstance() -> OpenGeometry(); 347 if (phantom) 233 348 { 234 if (sizeZ > 2*detectorSizeZ) 235 { 236 G4cout << "WARNING: Voxel Z size must be smaller or equal than that of detector Z" << G4endl; 237 return false; 238 } 239 numberOfVoxelsAlongZ = lrint(2 * detectorSizeZ / sizeZ); 240 sizeOfVoxelAlongZ = (2 * detectorSizeZ / numberOfVoxelsAlongZ ); 241 if(sizeOfVoxelAlongZ!=sizeZ) G4cout << "Rounding " << 242 G4BestUnit(sizeZ, "Length") << " to " << 243 G4BestUnit(sizeOfVoxelAlongZ, "Length") << G4endl; 244 } 245 246 G4cout << "The (X, Y, Z) sizes of the Voxels are: (" << 247 G4BestUnit(sizeOfVoxelAlongX, "Length") << ", " << 248 G4BestUnit(sizeOfVoxelAlongY, "Length") << ", " << 249 G4BestUnit(sizeOfVoxelAlongZ, "Length") << ')' << G4endl; 349 phantom -> SetXHalfLength(phantomSizeX/2); 350 phantom -> SetYHalfLength(phantomSizeY/2); 351 phantom -> SetZHalfLength(phantomSizeZ/2); 352 phantomPhysicalVolume -> SetTranslation(phantomPosition); 353 } 354 else ConstructPhantom(); 355 356 // Get the center of the detector 357 SetDetectorPosition(); 358 if (detector) 359 { 360 detector -> SetXHalfLength(detectorSizeX/2); 361 detector -> SetYHalfLength(detectorSizeY/2); 362 detector -> SetZHalfLength(detectorSizeZ/2); 363 detectorPhysicalVolume -> SetTranslation(detectorPosition); 364 } 365 else ConstructDetector(); 366 367 // Round to nearest integer number of voxel 368 numberOfVoxelsAlongX = lrint(detectorSizeX / sizeOfVoxelAlongX); 369 sizeOfVoxelAlongX = ( detectorSizeX / numberOfVoxelsAlongX ); 370 371 numberOfVoxelsAlongY = lrint(detectorSizeY / sizeOfVoxelAlongY); 372 sizeOfVoxelAlongY = ( detectorSizeY / numberOfVoxelsAlongY ); 373 374 numberOfVoxelsAlongZ = lrint(detectorSizeZ / sizeOfVoxelAlongZ); 375 sizeOfVoxelAlongZ = ( detectorSizeZ / numberOfVoxelsAlongZ ); 376 377 //G4cout << "*************** DetectorToWorldPosition " << GetDetectorToWorldPosition()/cm << "\n"; 378 ConstructSensitiveDetector(GetDetectorToWorldPosition()); 379 380 volumeOfVoxel = sizeOfVoxelAlongX * sizeOfVoxelAlongY * sizeOfVoxelAlongZ; 381 massOfVoxel = detectorMaterial -> GetDensity() * volumeOfVoxel; 382 // This will clear the existing matrix (together with all data inside it)! 383 matrix = HadrontherapyMatrix::GetInstance(numberOfVoxelsAlongX, 384 numberOfVoxelsAlongY, 385 numberOfVoxelsAlongZ, 386 massOfVoxel); 387 388 // Inform the kernel about the new geometry 389 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 390 G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 391 392 PrintParameters(); 393 } 394 395 void HadrontherapyDetectorConstruction::PrintParameters() 396 { 397 398 G4cout << "The (X,Y,Z) dimensions of the phantom are : (" << 399 G4BestUnit( phantom -> GetXHalfLength()*2., "Length") << ',' << 400 G4BestUnit( phantom -> GetYHalfLength()*2., "Length") << ',' << 401 G4BestUnit( phantom -> GetZHalfLength()*2., "Length") << ')' << G4endl; 402 403 G4cout << "The (X,Y,Z) dimensions of the detector are : (" << 404 G4BestUnit( detector -> GetXHalfLength()*2., "Length") << ',' << 405 G4BestUnit( detector -> GetYHalfLength()*2., "Length") << ',' << 406 G4BestUnit( detector -> GetZHalfLength()*2., "Length") << ')' << G4endl; 407 408 G4cout << "Displacement between Phantom and World is: "; 409 G4cout << "DX= "<< G4BestUnit(phantomPosition.getX(),"Length") << 410 "DY= "<< G4BestUnit(phantomPosition.getY(),"Length") << 411 "DZ= "<< G4BestUnit(phantomPosition.getZ(),"Length") << G4endl; 412 413 G4cout << "The (X,Y,Z) sizes of the Voxels are: (" << 414 G4BestUnit(sizeOfVoxelAlongX, "Length") << ',' << 415 G4BestUnit(sizeOfVoxelAlongY, "Length") << ',' << 416 G4BestUnit(sizeOfVoxelAlongZ, "Length") << ')' << G4endl; 250 417 251 418 G4cout << "The number of Voxels along (X,Y,Z) is: (" << 252 numberOfVoxelsAlongX << ", " << 253 numberOfVoxelsAlongY << ", " << 254 numberOfVoxelsAlongZ << ')' << G4endl; 255 256 // This will clear the existing matrix (together with data inside it)! 257 matrix = HadrontherapyMatrix::getInstance(numberOfVoxelsAlongX, 258 numberOfVoxelsAlongY, 259 numberOfVoxelsAlongZ); 260 261 // Here construct the Sensitive Detector and Read Out Geometry 262 ConstructSensitiveDetector(GetDetectorToWorldPosition()); 263 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 264 return true; 265 } 266 ///////////////////////////////////////////////////////////////////////////// 267 G4bool HadrontherapyDetectorConstruction::SetDetectorSize(G4double sizeX, G4double sizeY, G4double sizeZ) 268 { 269 // Check that the detector stay inside the phantom 270 if (sizeX > 0 && sizeX < sizeOfVoxelAlongX) {G4cout << "WARNING: Detector X size must be bigger than that of Voxel X" << G4endl; return false;} 271 if (sizeY > 0 && sizeY < sizeOfVoxelAlongY) {G4cout << "WARNING: Detector Y size must be bigger than that of Voxel Y" << G4endl; return false;} 272 if (sizeZ > 0 && sizeZ < sizeOfVoxelAlongZ) {G4cout << "WARNING: Detector Z size must be bigger than that of Voxel Z" << G4endl; return false;} 273 274 if (!IsInside(sizeX/2, 275 sizeY/2, 276 sizeZ/2, 277 phantomSizeX, 278 phantomSizeY, 279 phantomSizeZ, 280 detectorToPhantomPosition)) 281 {return false;} 282 // Negative or null values mean don't change it! 283 if (sizeX > 0) { 284 detectorSizeX = sizeX/2; 285 detector -> SetXHalfLength(detectorSizeX); 286 } 287 288 if (sizeY > 0) { 289 detectorSizeY = sizeY/2; 290 detector -> SetYHalfLength(detectorSizeY); 291 } 292 293 if (sizeZ > 0) { 294 detectorSizeZ = sizeZ/2; 295 detector -> SetZHalfLength(detectorSizeZ); 296 } 297 298 299 G4cout << "The (X, Y, Z) dimensions of the detector are : (" << 300 G4BestUnit( detector -> GetXHalfLength()*2., "Length") << ", " << 301 G4BestUnit( detector -> GetYHalfLength()*2., "Length") << ", " << 302 G4BestUnit( detector -> GetZHalfLength()*2., "Length") << ')' << G4endl; 303 // Adjust detector position 304 SetDetectorPosition(); 305 // Adjust voxels number accordingly to new detector geometry 306 // Matrix will be re-instantiated! 307 // Voxels and ROGeometry must follow the detector! 308 SetNumberOfVoxelBySize(sizeOfVoxelAlongX, sizeOfVoxelAlongY, sizeOfVoxelAlongZ); 309 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 310 return true; 311 } 312 313 ///////////////////////////////////////////////////////////////////////////// 314 G4bool HadrontherapyDetectorConstruction::SetPhantomSize(G4double sizeX, G4double sizeY, G4double sizeZ) 315 { 316 317 if (!IsInside(detectorSizeX, 318 detectorSizeY, 319 detectorSizeZ, 320 sizeX/2,//method parameters 321 sizeY/2, 322 sizeZ/2, 323 detectorToPhantomPosition 324 )) 325 return false; 326 327 // Only change positive dimensions 328 if (sizeX > 0) { 329 phantomSizeX = sizeX/2; 330 phantom -> SetXHalfLength(phantomSizeX); 331 } 332 if (sizeY > 0) { 333 phantomSizeY = sizeY/2; 334 phantom -> SetYHalfLength(phantomSizeY); 335 } 336 337 if (sizeZ > 0) { 338 phantomSizeZ = sizeZ/2; 339 phantom -> SetZHalfLength(phantomSizeZ); 340 } 341 342 343 G4cout << "The (X, Y, Z) dimensions of the phantom are : (" << 344 G4BestUnit( phantom -> GetXHalfLength()*2., "Length") << ", " << 345 G4BestUnit( phantom -> GetYHalfLength()*2., "Length") << ", " << 346 G4BestUnit( phantom -> GetZHalfLength()*2., "Length") << ')' << G4endl; 347 //G4cout << '\n' << "Coordinate volume: " << phantomPhysicalVolume -> GetTranslation() << G4endl; 348 // Adjust detector position inside phantom 349 SetDetectorPosition(); 350 351 ConstructSensitiveDetector(GetDetectorToWorldPosition()); 352 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 353 return true; 354 } 355 ///////////////////////////////////////////////////////////////////////////// 356 G4bool HadrontherapyDetectorConstruction::SetPhantomPosition(G4ThreeVector displacement) 357 { 358 // Set Phantom position respect to the World 359 // TODO check for overlap! 360 phantomPosition = displacement; 361 if (phantomPhysicalVolume) 362 { 363 phantomPhysicalVolume -> SetTranslation(phantomPosition); 364 G4cout << "Displacement between Phantom and World is: "; 365 G4cout << "DX= "<< G4BestUnit(phantomPosition.getX(),"Length") << ", " << 366 "DY= "<< G4BestUnit(phantomPosition.getY(),"Length") << ", " << 367 "DZ= "<< G4BestUnit(phantomPosition.getZ(),"Length") << G4endl; 368 369 // Redraw ROGeometry! 370 ConstructSensitiveDetector(GetDetectorToWorldPosition()); 371 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 372 } 373 return true; 374 } 375 376 ///////////////////////////////////////////////////////////////////////////// 377 G4bool HadrontherapyDetectorConstruction::SetDetectorToPhantomPosition(G4ThreeVector displacement) 378 { 379 // Ignore negative values 380 if (displacement[0] < 0.) displacement[0] = detectorToPhantomPosition[0]; 381 if (displacement[1] < 0.) displacement[1] = detectorToPhantomPosition[1]; 382 if (displacement[2] < 0.) displacement[2] = detectorToPhantomPosition[2]; 383 384 if (!IsInside(detectorSizeX, 385 detectorSizeY, 386 detectorSizeZ, 387 phantomSizeX, 388 phantomSizeY, 389 phantomSizeZ, 390 displacement // method parameter! 391 )) 392 {return false;} 393 detectorToPhantomPosition = displacement; 394 395 // Adjust detector position inside phantom 396 SetDetectorPosition(); 397 398 ConstructSensitiveDetector(GetDetectorToWorldPosition()); 399 G4RunManager::GetRunManager() -> GeometryHasBeenModified(); 400 return true; 401 } 419 numberOfVoxelsAlongX << ',' << 420 numberOfVoxelsAlongY <<',' << 421 numberOfVoxelsAlongZ << ')' << G4endl; 422 423 } -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyDetectorMessenger.cc
r1230 r1313 31 31 #include "HadrontherapyDetectorConstruction.hh" 32 32 #include "G4UIdirectory.hh" 33 #include "G4UIcmdWithADoubleAndUnit.hh" 33 #include "G4UIcmdWith3VectorAndUnit.hh" 34 #include "G4UIcmdWithoutParameter.hh" 34 35 #include "G4UIcmdWithAString.hh" 35 #include "G4UIcmdWith3VectorAndUnit.hh"36 36 37 37 ///////////////////////////////////////////////////////////////////////////// … … 49 49 "PhantomSizeAlongZ", false); 50 50 changeThePhantomSizeCmd -> SetDefaultUnit("mm"); 51 changeThePhantomSizeCmd -> SetUnitCandidates(" um mm cm");51 changeThePhantomSizeCmd -> SetUnitCandidates("nm um mm cm"); 52 52 changeThePhantomSizeCmd -> AvailableForStates(G4State_Idle); 53 53 54 55 // Change Phantom material 56 changeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this); 57 changeThePhantomMaterialCmd -> SetGuidance("Change the Phantom and the detector material"); 58 changeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false); 59 changeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER"); 60 changeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle); 54 61 55 62 // Change Phantom position … … 61 68 "PositionAlongZ", false); 62 69 changeThePhantomPositionCmd -> SetDefaultUnit("mm"); 63 changeThePhantomPositionCmd -> SetUnitCandidates(" mm cm m");70 changeThePhantomPositionCmd -> SetUnitCandidates("um mm cm m"); 64 71 changeThePhantomPositionCmd -> AvailableForStates(G4State_Idle); 65 72 73 74 updateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this); 75 updateCmd->SetGuidance("Update Phantom/Detector geometry."); 76 updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" "); 77 updateCmd->SetGuidance("if you changed geometrical value(s)."); 78 updateCmd->AvailableForStates(G4State_Idle); 66 79 67 80 // Change detector size … … 74 87 changeTheDetectorSizeCmd -> SetParameterName("DetectorSizeAlongX", "DetectorSizeAlongY", "DetectorSizeAlongZ", false); 75 88 changeTheDetectorSizeCmd -> SetDefaultUnit("mm"); 76 changeTheDetectorSizeCmd -> SetUnitCandidates(" um mm cm");89 changeTheDetectorSizeCmd -> SetUnitCandidates("nm um mm cm"); 77 90 changeTheDetectorSizeCmd -> AvailableForStates(G4State_Idle); 78 91 … … 85 98 "DisplacementAlongZ", false); 86 99 changeTheDetectorToPhantomPositionCmd -> SetDefaultUnit("mm"); 87 changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates(" um mm cm");100 changeTheDetectorToPhantomPositionCmd -> SetUnitCandidates("nm um mm cm"); 88 101 changeTheDetectorToPhantomPositionCmd -> AvailableForStates(G4State_Idle); 89 102 … … 94 107 changeTheDetectorVoxelCmd -> SetParameterName("VoxelSizeAlongX", "VoxelSizeAlongY", "VoxelSizeAlongZ", false); 95 108 changeTheDetectorVoxelCmd -> SetDefaultUnit("mm"); 96 changeTheDetectorVoxelCmd -> SetUnitCandidates(" um mm cm");109 changeTheDetectorVoxelCmd -> SetUnitCandidates("nm um mm cm"); 97 110 changeTheDetectorVoxelCmd -> AvailableForStates(G4State_Idle); 98 111 } … … 104 117 delete changeThePhantomSizeCmd; 105 118 delete changeThePhantomPositionCmd; 119 delete changeThePhantomMaterialCmd; 120 delete updateCmd; 106 121 delete changeTheDetectorDir; 107 122 delete changeTheDetectorSizeCmd; … … 124 139 hadrontherapyDetector -> SetPhantomPosition(size); 125 140 } 141 else if (command == changeThePhantomMaterialCmd) 142 { 143 hadrontherapyDetector -> SetPhantomMaterial(newValue); 144 } 126 145 else if (command == changeTheDetectorSizeCmd) 127 146 { … … 137 156 { 138 157 G4ThreeVector size = changeTheDetectorVoxelCmd -> GetNew3VectorValue(newValue); 139 hadrontherapyDetector -> SetNumberOfVoxelBySize(size.getX(),size.getY(),size.getZ()); 158 hadrontherapyDetector -> SetVoxelSize(size.getX(),size.getY(),size.getZ()); 159 } 160 else if (command == updateCmd) 161 { 162 hadrontherapyDetector -> UpdateGeometry(); 140 163 } 141 164 } -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyEventAction.cc
r1230 r1313 24 24 // ******************************************************************** 25 25 // 26 // $Id: HadrontherapyEventAction.cc; 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 26 // $Id: HadrontherapyEventAction.cc; 27 // 28 // See more at: http://workgroup.lngs.infn.it/geant4lns 29 // 30 // ---------------------------------------------------------------------------- 31 // GEANT 4 - Hadrontherapy example 32 // ---------------------------------------------------------------------------- 33 // Code developed by: 34 // 35 // G.A.P. Cirrone(a)*, G. Candiano, F. Di Rosa(a), S. Guatelli(b), G. Russo(a) 36 // 37 // (a) Laboratori Nazionali del Sud 38 // of the National Institute for Nuclear Physics, Catania, Italy 39 // (b) National Institute for Nuclear Physics Section of Genova, genova, Italy 40 // 41 // * cirrone@lns.infn.it 42 // -------------------------------------------------------------- 29 43 #include "G4Event.hh" 30 44 #include "G4EventManager.hh" 31 45 #include "G4HCofThisEvent.hh" 32 46 #include "G4VHitsCollection.hh" 33 #include "G4TrajectoryContainer.hh"34 #include "G4Trajectory.hh"35 #include "G4VVisManager.hh"36 47 #include "G4SDManager.hh" 37 48 #include "G4VVisManager.hh" 49 38 50 #include "HadrontherapyEventAction.hh" 39 51 #include "HadrontherapyDetectorHit.hh" … … 64 76 //printing survey 65 77 if (evtNb%printModulo == 0) 66 G4cout << "\n---> Begin of Event: " << evtNb << G4endl;78 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; 67 79 68 80 G4SDManager* pSDManager = G4SDManager::GetSDMpointer(); 69 81 if(hitsCollectionID == -1) 70 82 hitsCollectionID = pSDManager -> GetCollectionID("HadrontherapyDetectorHitsCollection"); 83 71 84 } 72 85 73 86 ///////////////////////////////////////////////////////////////////////////// 74 87 void HadrontherapyEventAction::EndOfEventAction(const G4Event* evt) 75 { 88 { 76 89 if(hitsCollectionID < 0) 77 90 return; 78 91 G4HCofThisEvent* HCE = evt -> GetHCofThisEvent(); 79 92 93 // Clear voxels hit list 94 HadrontherapyMatrix* matrix = HadrontherapyMatrix::GetInstance(); 95 if (matrix) matrix -> ClearHitTrack(); 96 80 97 if(HCE) 81 98 { … … 83 100 if(CHC) 84 101 { 85 matrix = HadrontherapyMatrix::getInstance();86 102 if(matrix) 87 103 { … … 101 117 } 102 118 } 103 // Extract the trajectories and draw them in the visualisation104 105 if (G4VVisManager::GetConcreteInstance())106 {107 G4TrajectoryContainer * trajectoryContainer = evt -> GetTrajectoryContainer();108 G4int n_trajectories = 0;109 if (trajectoryContainer) n_trajectories = trajectoryContainer -> entries();110 111 for (G4int i = 0; i < n_trajectories; i++)112 {113 G4Trajectory* trj = (G4Trajectory*)114 ((*(evt -> GetTrajectoryContainer()))[i]);115 if(drawFlag == "all") trj -> DrawTrajectory(50);116 else if((drawFlag == "charged")&&(trj -> GetCharge() != 0.))117 trj -> DrawTrajectory(50);118 else if ((drawFlag == "neutral")&&(trj -> GetCharge() == 0.))119 trj -> DrawTrajectory(50);120 }121 }122 119 } 123 120 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyMatrix.cc
r1230 r1313 1 //2 // ********************************************************************3 // * License and Disclaimer *4 // * *5 // * The Geant4 software is copyright of the Copyright Holders of *6 // * the Geant4 Collaboration. It is provided under the terms and *7 // * conditions of the Geant4 Software License, included in the file*8 // * LICENSE and available at http://cern.ch/geant4/license . These *9 // * include a list of copyright holders. *10 // * *11 // * Neither the authors of this software system, nor their employing *12 // * institutes,nor the agencies providing financial support for this *13 // * work make any representation or warranty, express or implied, *14 // * regarding this software system or assume any liability for its *15 // * use. Please see the license in the file LICENSE and URL above *16 // * for the full disclaimer and the limitation of liability. *17 // * *18 // * This code implementation is the result of the scientific and *19 // * technical work of the GEANT4 collaboration. *20 // * By using, copying, modifying or distributing the software (or *21 // * any work based on the software) you agree to acknowledge its *22 // * use in resulting scientific publications, and indicate your *23 // * acceptance of all terms of the Geant4 Software license. *24 // ********************************************************************25 //26 // $Id: HadrontherapyMatrix.cc;27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy//1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file* 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // $Id: HadrontherapyMatrix.cc; 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy// 28 28 29 29 #include "HadrontherapyMatrix.hh" 30 30 #include "HadrontherapyAnalysisManager.hh" 31 #include "G4RunManager.hh" 32 #include "HadrontherapyPrimaryGeneratorAction.hh" 33 #include "G4ParticleGun.hh" 34 35 #include <fstream> 36 #include <unistd.h> 37 #include <iostream> 38 #include <sstream> 39 #include <iomanip> 31 40 #include "globals.hh" 32 #include <fstream> 33 41 42 // Units definition: CLHEP/Units/SystemOfUnits.h 43 // 34 44 HadrontherapyMatrix* HadrontherapyMatrix::instance = NULL; 35 // Static method that only return a pointer to the matrix object 36 HadrontherapyMatrix* HadrontherapyMatrix::getInstance() 37 { 38 return instance; 39 } 40 // This STATIC method delete (!) the old matrix and rewrite a new object returning a pointer to it 41 HadrontherapyMatrix* HadrontherapyMatrix::getInstance(G4int voxelX, G4int voxelY, G4int voxelZ) 42 { 43 if (instance) delete instance; 44 instance = new HadrontherapyMatrix(voxelX, voxelY, voxelZ); 45 instance -> Initialize(); 46 return instance; 47 } 48 49 HadrontherapyMatrix::HadrontherapyMatrix(G4int voxelX, G4int voxelY, G4int voxelZ): 50 matrix(0) 45 G4bool HadrontherapyMatrix::secondaries = false; 46 // Only return a pointer to matrix 47 HadrontherapyMatrix* HadrontherapyMatrix::GetInstance() 48 { 49 return instance; 50 } 51 // This STATIC method delete (!) the old matrix and rewrite a new object returning a pointer to it 52 // TODO A check on the parameters is required! 53 HadrontherapyMatrix* HadrontherapyMatrix::GetInstance(G4int voxelX, G4int voxelY, G4int voxelZ, G4double mass) 54 { 55 if (instance) delete instance; 56 instance = new HadrontherapyMatrix(voxelX, voxelY, voxelZ, mass); 57 instance -> Initialize();// XXX 58 return instance; 59 } 60 HadrontherapyMatrix::HadrontherapyMatrix(G4int voxelX, G4int voxelY, G4int voxelZ, G4double mass): 61 filename("Dose.out"), 62 doseUnit(MeV/g) 51 63 { 52 // Number of the voxels of the phantom 53 // For Y = Z = 1 the phantom is divided in slices (and not in voxels) 54 // orthogonal to the beam axis 55 numberVoxelX = voxelX; 56 numberVoxelY = voxelY; 57 numberVoxelZ = voxelZ; 58 // Create the dose matrix 59 matrix = new G4double[numberVoxelX*numberVoxelY*numberVoxelZ]; 60 if (matrix) G4cout << "Matrix: Memory space to store physical dose into " << 61 numberVoxelX*numberVoxelY*numberVoxelZ << 62 " voxels has been allocated " << G4endl; 63 else G4Exception("Can't allocate memory to store physical dose!"); 64 } 65 64 // Number of the voxels of the phantom 65 // For Y = Z = 1 the phantom is divided in slices (and not in voxels) 66 // orthogonal to the beam axis 67 numberOfVoxelAlongX = voxelX; 68 numberOfVoxelAlongY = voxelY; 69 numberOfVoxelAlongZ = voxelZ; 70 massOfVoxel = mass; 71 // Create the dose matrix 72 matrix = new G4double[numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ]; 73 if (matrix) 74 { 75 G4cout << "HadrontherapyMatrix: Memory space to store physical dose into " << 76 numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ << 77 " voxels has been allocated " << G4endl; 78 } 79 else G4Exception(" HadrontherapyMatrix::HadrontherapyMatrix. Can't allocate memory to store physical dose!"); 80 // Hit voxel (TrackID) marker 81 // This array mark the status of voxel, if a hit occur, with the trackID of the particle 82 // Must be initialized 83 hitTrack = new G4int[numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ]; 84 ClearHitTrack(); 85 } 86 87 ///////////////////////////////////////////////////////////////////////////// 66 88 HadrontherapyMatrix::~HadrontherapyMatrix() 67 89 { 68 90 delete[] matrix; 69 } 70 71 void HadrontherapyMatrix::flush() 72 { 73 if(matrix) 74 for(int i=0; i<numberVoxelX*numberVoxelY*numberVoxelZ; i++) 75 { 76 matrix[i] = 0; 77 } 78 } 91 delete[] hitTrack; 92 // clear fluences/dose data 93 Clear(); 94 } 95 96 ///////////////////////////////////////////////////////////////////////////// 97 void HadrontherapyMatrix::Clear() 98 { 99 for (size_t i=0; i<ionStore.size(); i++) 100 { 101 delete[] ionStore[i].dose; 102 delete[] ionStore[i].fluence; 103 } 104 ionStore.clear(); 105 } 106 107 ///////////////////////////////////////////////////////////////////////////// 108 // Initialise the elements of the matrix to zero 79 109 void HadrontherapyMatrix::Initialize() 80 110 { 81 // Initialise the elements of the matrix to zero 82 for(G4int i = 0; i < numberVoxelX; i++) 83 { 84 for(G4int j = 0; j < numberVoxelY; j++) 85 { 86 for(G4int k = 0; k < numberVoxelZ; k++) 87 88 matrix[Index(i,j,k)] = 0.; 89 } 90 } 91 } 111 Clear(); 112 for(int i=0;i<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ;i++) 113 { 114 matrix[i] = 0; 115 } 116 } 117 ///////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////// 119 // Print generated nuclides list 120 void HadrontherapyMatrix::PrintNuclides() 121 { 122 for (size_t i=0; i<ionStore.size(); i++) 123 { 124 G4cout << ionStore[i].name << G4endl; 125 } 126 } 127 ///////////////////////////////////////////////////////////////////////////// 128 // Clear Hit voxel (TrackID) markers 129 void HadrontherapyMatrix::ClearHitTrack() 130 { 131 for(G4int i=0; i<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ; i++) hitTrack[i] = 0; 132 } 133 // Return Hit status 134 G4int* HadrontherapyMatrix::GetHitTrack(G4int i, G4int j, G4int k) 135 { 136 return &(hitTrack[Index(i,j,k)]); 137 } 138 ///////////////////////////////////////////////////////////////////////////// 139 // Dose methods... 140 // Fill DOSE/fluence matrix for particle/ion: 141 // If fluence parameter is true (default value is FALSE) then fluence at voxel (i, j, k) is increased. 142 // The energyDeposit parameter fill the dose matrix for voxel (i,j,k) 143 ///////////////////////////////////////////////////////////////////////////// 144 145 G4bool HadrontherapyMatrix::Fill(G4int trackID, 146 G4ParticleDefinition* particleDef, 147 G4int i, G4int j, G4int k, 148 G4double energyDeposit, 149 G4bool fluence) 150 { 151 if (energyDeposit <=0. && !fluence || !secondaries) return false; 152 // Get Particle Data Group particle ID 153 G4int PDGencoding = particleDef -> GetPDGEncoding(); 154 PDGencoding -= PDGencoding%10; 155 156 // Search for already allocated data... 157 for (size_t l=0; l < ionStore.size(); l++) 158 { 159 if (ionStore[l].PDGencoding == PDGencoding ) 160 { // Is it a primary or a secondary particle? 161 if ( trackID ==1 && ionStore[l].isPrimary || trackID !=1 && !ionStore[l].isPrimary) 162 { 163 if (energyDeposit > 0.) ionStore[l].dose[Index(i, j, k)] += energyDeposit/massOfVoxel; 164 165 // Fill a matrix per each ion with the fluence 166 if (fluence) ionStore[l].fluence[Index(i, j, k)]++; 167 return true; 168 } 169 } 170 } 171 172 G4int Z = particleDef-> GetAtomicNumber(); 173 G4int A = particleDef-> GetAtomicMass(); 174 175 G4String fullName = particleDef -> GetParticleName(); 176 G4String name = fullName.substr (0, fullName.find("[") ); // cut excitation energy 177 // Let's put a new particle in our store... 178 ion newIon = 179 { 180 (trackID == 1) ? true:false, 181 PDGencoding, 182 name, 183 name.length(), 184 Z, 185 A, 186 new G4double[numberOfVoxelAlongX * numberOfVoxelAlongY * numberOfVoxelAlongZ], 187 new unsigned int[numberOfVoxelAlongX * numberOfVoxelAlongY * numberOfVoxelAlongZ] 188 }; 189 // Initialize data 190 if (newIon.dose && newIon.fluence) 191 { 192 for(G4int m=0; m<numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ; m++) 193 { 194 newIon.dose[m] = 0.; 195 newIon.fluence[m] = 0; 196 } 197 if (energyDeposit > 0.) newIon.dose[Index(i, j, k)] += energyDeposit/massOfVoxel; 198 if (fluence) newIon.fluence[Index(i, j, k)]++; 199 200 ionStore.push_back(newIon); 201 202 // TODO Put some verbosity check 203 /* 204 G4cout << "Memory space to store the DOSE/FLUENCE into " << 205 numberOfVoxelAlongX*numberOfVoxelAlongY*numberOfVoxelAlongZ << 206 " voxels has been allocated for the nuclide " << newIon.name << 207 " (Z = " << Z << ", A = " << A << ")" << G4endl ; 208 */ 209 return true; 210 } 211 else // XXX Out of memory! XXX 212 { 213 return false; 214 } 215 216 } 217 218 ///////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////// 220 // Methods to store data to filenames... 221 //////////////////////////////////////////////////////////////////////////// 222 //////////////////////////////////////////////////////////////////////////// 223 // 224 // General method to store matrix data to filename 225 void HadrontherapyMatrix::StoreMatrix(G4String file, void* data, size_t psize) 226 { 227 if (data) 228 { 229 ofs.open(file, std::ios::out); 230 if (ofs.is_open()) 231 { 232 for(G4int i = 0; i < numberOfVoxelAlongX; i++) 233 for(G4int j = 0; j < numberOfVoxelAlongY; j++) 234 for(G4int k = 0; k < numberOfVoxelAlongZ; k++) 235 { 236 G4int n = Index(i, j, k); 237 // Check for data type: u_int, G4double, XXX 238 if (psize == sizeof(unsigned int)) 239 { 240 unsigned int* pdata = (unsigned int*)data; 241 if (pdata[n]) ofs << i << '\t' << j << '\t' << 242 k << '\t' << pdata[n] << G4endl; 243 } 244 else if (psize == sizeof(G4double)) 245 { 246 G4double* pdata = (G4double*)data; 247 if (pdata[n]) ofs << i << '\t' << j << '\t' << 248 k << '\t' << pdata[n] << G4endl; 249 } 250 } 251 ofs.close(); 252 } 253 } 254 } 255 256 // Store fluence per single ion in multiple files 257 void HadrontherapyMatrix::StoreFluenceData() 258 { 259 for (size_t i=0; i < ionStore.size(); i++){ 260 StoreMatrix(ionStore[i].name + "_Fluence.out", ionStore[i].fluence, sizeof(unsigned int)); 261 } 262 } 263 // Store dose per single ion in multiple files 264 void HadrontherapyMatrix::StoreDoseData() 265 { 266 267 for (size_t i=0; i < ionStore.size(); i++){ 268 StoreMatrix(ionStore[i].name + "_Dose.out", ionStore[i].dose, sizeof(G4double)); 269 } 270 } 271 ///////////////////////////////////////////////////////////////////////// 272 // Store dose for all ions into a single file and into ntuples. 273 // Please note that this function is called via messenger commands 274 // defined in the HadrontherapyAnalysisFileMessenger.cc class file 275 void HadrontherapyMatrix::StoreDoseFluenceAscii() 276 { 277 // Sort like periodic table 278 std::sort(ionStore.begin(), ionStore.end()); 279 #define width 15L 280 ofs.open(filename, std::ios::out); 281 if (ofs.is_open()) 282 { 283 284 // 285 // Write the voxels index and the list of particles/ions 286 ofs << std::setprecision(6) << std::left << 287 "i\tj\tk\t"; 288 /* 289 G4RunManager *runManager = G4RunManager::GetRunManager(); 290 HadrontherapyPrimaryGeneratorAction *pPGA = (HadrontherapyPrimaryGeneratorAction*)runManager -> GetUserPrimaryGeneratorAction(); 291 G4String name = pPGA -> GetParticleGun() -> GetParticleDefinition() -> GetParticleName(); 292 */ 293 // Total dose 294 ofs << std::setw(width) << "Dose"; 295 296 for (size_t l=0; l < ionStore.size(); l++) 297 { 298 G4String a = (ionStore[l].isPrimary) ? "_1":""; // is it a primary? 299 ofs << std::setw(width) << ionStore[l].name + a << 300 std::setw(width) << ionStore[l].name + a; 301 } 302 ofs << G4endl; 303 304 /* 305 // PDGencoding 306 ofs << std::setprecision(6) << std::left << 307 "0\t0\t0\t"; 308 309 // Total dose 310 ofs << std::setw(width) << '0'; 311 for (size_t l=0; l < ionStore.size(); l++) 312 { 313 ofs << std::setw(width) << ionStore[l].PDGencoding << 314 std::setw(width) << ionStore[l].PDGencoding; 315 } 316 ofs << G4endl; 317 */ 318 // Write data 319 for(G4int i = 0; i < numberOfVoxelAlongX; i++) 320 for(G4int j = 0; j < numberOfVoxelAlongY; j++) 321 for(G4int k = 0; k < numberOfVoxelAlongZ; k++) 322 { 323 G4int n = Index(i, j, k); 324 // Write only not identically null data lines 325 if (matrix[n]) 326 { 327 ofs << G4endl; 328 ofs << i << '\t' << j << '\t' << k << '\t'; 329 // Total dose 330 ofs << std::setw(width) << matrix[n]/(doseUnit); 331 { 332 for (size_t l=0; l < ionStore.size(); l++) 333 { 334 // Fill ASCII file rows 335 ofs << std::setw(width) << ionStore[l].dose[n]/(doseUnit) << 336 std::setw(width) << ionStore[l].fluence[n]; 337 } 338 } 339 } 340 } 341 ofs.close(); 342 } 343 } 344 ///////////////////////////////////////////////////////////////////////////// 345 346 #ifdef G4ANALYSIS_USE_ROOT 347 void HadrontherapyMatrix::StoreDoseFluenceRoot() 348 { 349 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::GetInstance(); 350 for(G4int i = 0; i < numberOfVoxelAlongX; i++) 351 for(G4int j = 0; j < numberOfVoxelAlongY; j++) 352 for(G4int k = 0; k < numberOfVoxelAlongZ; k++) 353 { 354 G4int n = Index(i, j, k); 355 for (size_t l=0; l < ionStore.size(); l++) 356 357 { 358 // Do the same work for .root file: fill dose/fluence ntuple 359 analysis -> FillVoxelFragmentTuple( i, j, k, 360 ionStore[l].A, 361 ionStore[l].Z, 362 ionStore[l].dose[n]/(doseUnit), 363 ionStore[l].fluence[n] ); 364 365 366 } 367 } 368 } 369 #endif 92 370 93 371 void HadrontherapyMatrix::Fill(G4int i, G4int j, G4int k, 94 372 G4double energyDeposit) 95 373 { 96 if (matrix) 97 matrix[Index(i,j,k)] += energyDeposit; 98 99 // Store the energy deposit in the matrix element corresponding 100 // to the phantom voxel i, j, k 101 } 102 374 if (matrix) 375 matrix[Index(i,j,k)] += energyDeposit; 376 377 // Store the energy deposit in the matrix element corresponding 378 // to the phantom voxel 379 } 103 380 void HadrontherapyMatrix::TotalEnergyDeposit() 104 381 { 382 // Convert energy deposited to dose. 105 383 // Store the information of the matrix in a ntuple and in 106 384 // a 1D Histogram 107 385 108 G4int k; 109 G4int j; 110 G4int i; 111 112 if (matrix) 386 #ifdef G4ANALYSIS_USE_ROOT 387 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::GetInstance(); 388 #endif 389 if (matrix) 113 390 { 114 std::ofstream ofs; 115 ofs.open("DoseDistribution.out"); 116 117 for(G4int l = 0; l < numberVoxelZ; l++) 118 { 119 k = l; 120 121 for(G4int m = 0; m < numberVoxelY; m++) 122 { 123 j = m * numberVoxelZ + k; 124 125 for(G4int n = 0; n < numberVoxelX; n++) 126 { 127 i = n* numberVoxelZ * numberVoxelY + j; 128 if(matrix[i] != 0) 129 { 130 ofs << n << '\t' << m << '\t' << 131 k << '\t' << matrix[i] << G4endl; 132 133 #ifdef ANALYSIS_USE 134 HadrontherapyAnalysisManager* analysis = 135 HadrontherapyAnalysisManager::getInstance(); 136 analysis -> FillEnergyDeposit(n, m, k, matrix[i]); 137 analysis -> BraggPeak(n, matrix[i]); 391 for(G4int i = 0; i < numberOfVoxelAlongX; i++) 392 for(G4int j = 0; j < numberOfVoxelAlongY; j++) 393 for(G4int k = 0; k < numberOfVoxelAlongZ; k++) 394 { 395 G4int n = Index(i,j,k); 396 matrix[n] = matrix[n] / massOfVoxel; 397 #ifdef G4ANALYSIS_USE_ROOT 398 analysis -> FillEnergyDeposit(i, j, k, matrix[n]/doseUnit); 399 analysis -> BraggPeak(i, matrix[n]/doseUnit); 138 400 #endif 139 } 140 } 141 } 142 } 143 } 144 } 401 } 402 } 403 } 404 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyPhysicsList.cc
r1230 r1313 76 76 // and local physic for ion-ion enelastic processes) 77 77 78 #include "G4RunManager.hh" 79 #include "G4Region.hh" 80 #include "G4RegionStore.hh" 78 81 #include "HadrontherapyPhysicsList.hh" 79 82 #include "HadrontherapyPhysicsListMessenger.hh" … … 86 89 #include "LocalINCLIonIonInelasticPhysic.hh" // Physic dedicated to the ion-ion inelastic processes using INCL/ABLA 87 90 88 // Physic lists (contained inside the Geant4 distribution)91 // Physic lists (contained inside the Geant4 source code, in the 'physicslists folder') 89 92 #include "G4EmStandardPhysics_option3.hh" 90 93 #include "G4EmLivermorePhysics.hh" … … 173 176 { 174 177 // transportation 175 //176 178 AddTransportation(); 177 179 178 180 // electromagnetic physics list 179 //180 181 emPhysicsList->ConstructProcess(); 181 182 em_config.AddModels(); 182 183 183 184 // decay physics list 184 //185 185 decPhysicsList->ConstructProcess(); 186 186 … … 207 207 // ELECTROMAGNETIC MODELS 208 208 ///////////////////////////////////////////////////////////////////////////// 209 210 if (name == "standard_opt3") { 209 if (name == "standard_opt3") { 211 210 emName = name; 212 211 delete emPhysicsList; 213 212 emPhysicsList = new G4EmStandardPhysics_option3(); 213 G4RunManager::GetRunManager() -> PhysicsHasBeenModified(); 214 214 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; 215 215 … … 218 218 delete emPhysicsList; 219 219 emPhysicsList = new G4EmLivermorePhysics(); 220 G4RunManager::GetRunManager()-> PhysicsHasBeenModified(); 220 221 G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmLivermorePhysics" << G4endl; 221 222 … … 308 309 SetCutValue(cutForPositron, "e+"); 309 310 311 // Set cuts for detector 312 SetDetectorCut(defaultCutValue); 310 313 if (verboseLevel>0) DumpCutValuesTable(); 311 314 } … … 331 334 SetParticleCuts(cutForPositron, G4Positron::Positron()); 332 335 } 336 337 void HadrontherapyPhysicsList::SetDetectorCut(G4double cut) 338 { 339 340 G4String regionName = "DetectorLog"; 341 G4Region* region = G4RegionStore::GetInstance()->GetRegion(regionName); 342 343 G4ProductionCuts* cuts = new G4ProductionCuts ; 344 cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("gamma")); 345 cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e-")); 346 cuts -> SetProductionCut(cut,G4ProductionCuts::GetIndex("e+")); 347 region -> SetProductionCuts(cuts); 348 } 349 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyPhysicsListMessenger.cc
r1230 r1313 69 69 allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 70 70 71 allDetectorCmd = new G4UIcmdWithADoubleAndUnit("/physic/setDetectorCuts",this); 72 allDetectorCmd->SetGuidance("Set cut for all. into Detector"); 73 allDetectorCmd->SetParameterName("cut",false); 74 allDetectorCmd->SetUnitCategory("Length"); 75 allDetectorCmd->SetRange("cut>0.0"); 76 allDetectorCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 77 71 78 pListCmd = new G4UIcmdWithAString("/physic/addPhysics",this); 72 79 pListCmd->SetGuidance("Add physics list."); 73 80 pListCmd->SetParameterName("PList",false); 74 pListCmd->AvailableForStates(G4State_PreInit );81 pListCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 75 82 76 83 packageListCmd = new G4UIcmdWithAString("/physic/addPackage",this); 77 84 packageListCmd->SetGuidance("Add physics package."); 78 85 packageListCmd->SetParameterName("package",false); 79 packageListCmd->AvailableForStates(G4State_PreInit );86 packageListCmd->AvailableForStates(G4State_PreInit, G4State_Idle); 80 87 } 81 88 … … 87 94 delete protoCutCmd; 88 95 delete allCutCmd; 96 delete allDetectorCmd; 89 97 delete pListCmd; 90 98 delete physDir; … … 99 107 { pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));} 100 108 101 if( command == electCutCmd )109 else if( command == electCutCmd ) 102 110 { pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));} 103 111 104 if( command == protoCutCmd )112 else if( command == protoCutCmd ) 105 113 { pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));} 106 114 107 if( command == allCutCmd )115 else if( command == allCutCmd ) 108 116 { 109 117 G4double cut = allCutCmd->GetNewDoubleValue(newValue); … … 112 120 pPhysicsList->SetCutForPositron(cut); 113 121 } 114 115 if( command == pListCmd ) 122 else if( command == allDetectorCmd) 123 { 124 G4double cut = allDetectorCmd -> GetNewDoubleValue(newValue); 125 pPhysicsList -> SetDetectorCut(cut); 126 } 127 else if( command == pListCmd ) 116 128 { pPhysicsList->AddPhysicsList(newValue);} 117 129 118 130 119 if( command == packageListCmd )131 else if( command == packageListCmd ) 120 132 { pPhysicsList->AddPackage(newValue);} 121 133 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyPrimaryGeneratorAction.cc
r1230 r1313 86 86 sigmaEnergy = defaultsigmaEnergy; 87 87 88 #ifdef ANALYSIS_USE88 #ifdef G4ANALYSIS_USE_ROOT 89 89 // Write these values into the analysis if needed. Have to be written separately on change. 90 HadrontherapyAnalysisManager:: getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);90 HadrontherapyAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy); 91 91 #endif 92 92 … … 120 120 void HadrontherapyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) 121 121 { 122 #ifdef ANALYSIS_USE122 #ifdef G4ANALYSIS_USE_ROOT 123 123 // Increment the event counter 124 HadrontherapyAnalysisManager:: getInstance()->startNewEvent();124 HadrontherapyAnalysisManager::GetInstance()->startNewEvent(); 125 125 #endif 126 126 … … 178 178 { 179 179 meanKineticEnergy = val; 180 #ifdef ANALYSIS_USE180 #ifdef G4ANALYSIS_USE_ROOT 181 181 // Update the beam-data in the analysis manager 182 HadrontherapyAnalysisManager:: getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);182 HadrontherapyAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy); 183 183 #endif 184 184 … … 188 188 { 189 189 sigmaEnergy = val; 190 #ifdef ANALYSIS_USE190 #ifdef G4ANALYSIS_USE_ROOT 191 191 // Update the sigmaenergy in the metadata. 192 HadrontherapyAnalysisManager:: getInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy);192 HadrontherapyAnalysisManager::GetInstance()->setBeamMetaData(meanKineticEnergy, sigmaEnergy); 193 193 #endif 194 194 } … … 217 217 G4double HadrontherapyPrimaryGeneratorAction::GetmeanKineticEnergy(void) 218 218 { return meanKineticEnergy;} 219 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapyRunAction.cc
r1230 r1313 27 27 // See more at: http://g4advancedexamples.lngs.infn.it/Examples/hadrontherapy 28 28 29 29 30 #include "HadrontherapyRunAction.hh" 30 31 #include "HadrontherapyEventAction.hh" … … 38 39 #include "HadrontherapyRunAction.hh" 39 40 41 42 #include "HadrontherapyAnalysisManager.hh" 43 #include "HadrontherapyMatrix.hh" 44 40 45 HadrontherapyRunAction::HadrontherapyRunAction() 41 46 { … … 48 53 void HadrontherapyRunAction::BeginOfRunAction(const G4Run* aRun) 49 54 { 50 G4RunManager::GetRunManager()->SetRandomNumberStore(true);51 G4cout << "Run " << aRun -> GetRunID() << " starts ..." << G4endl;55 G4RunManager::GetRunManager()-> SetRandomNumberStore(true); 56 G4cout << "Run " << aRun -> GetRunID() << " starts ..." << G4endl; 52 57 53 electromagnetic = 0; 54 hadronic = 0; 58 // Warning! any beamOn will reset all data (dose, fluence, histograms, etc)! 59 // 60 61 // Initialize matrix with energy of primaries clearing data inside 62 if (HadrontherapyMatrix::GetInstance()) 63 { 64 HadrontherapyMatrix::GetInstance() -> Initialize(); 65 } 66 67 #ifdef G4ANALYSIS_USE_ROOT 68 HadrontherapyAnalysisManager::GetInstance() -> flush(); // Finalize the root file 69 // Initialize root analysis ----> book 70 HadrontherapyAnalysisManager::GetInstance() -> book(); 71 #endif 72 electromagnetic = 0; 73 hadronic = 0; 55 74 } 56 75 57 76 void HadrontherapyRunAction::EndOfRunAction(const G4Run*) 58 77 { 59 // G4cout << " Summary of Run " << aRun -> GetRunID() <<" :"<< G4endl; 60 //G4cout << "Number of electromagnetic processes of primary particles in the phantom:" 61 // << electromagnetic << G4endl; 62 //G4cout << "Number of hadronic processes of primary particles in the phantom:" 63 // << hadronic << G4endl; 78 // Store dose & fluence data to ASCII & ROOT files 79 if ( HadrontherapyMatrix::GetInstance() ) 80 { 81 HadrontherapyMatrix::GetInstance() -> TotalEnergyDeposit(); 82 HadrontherapyMatrix::GetInstance() -> StoreDoseFluenceAscii(); 83 84 #ifdef G4ANALYSIS_USE_ROOT 85 if (HadrontherapyAnalysisManager::GetInstance()) 86 { 87 HadrontherapyMatrix::GetInstance() -> StoreDoseFluenceRoot(); 88 } 89 #endif 90 } 91 92 //G4cout << " Summary of Run " << aRun -> GetRunID() <<" :"<< G4endl; 93 //G4cout << "Number of electromagnetic processes of primary particles in the phantom:" 94 // << electromagnetic << G4endl; 95 //G4cout << "Number of hadronic processes of primary particles in the phantom:" 96 // << hadronic << G4endl; 64 97 } 65 98 void HadrontherapyRunAction::AddEMProcess() … … 72 105 } 73 106 74 75 -
trunk/examples/advanced/hadrontherapy/src/HadrontherapySteppingAction.cc
r1230 r1313 39 39 #include "G4ParticleDefinition.hh" 40 40 #include "G4ParticleTypes.hh" 41 #include "G4UserEventAction.hh" 41 42 42 43 #include "HadrontherapyAnalysisManager.hh" … … 47 48 HadrontherapySteppingAction::HadrontherapySteppingAction( HadrontherapyRunAction *run) 48 49 { 49 runAction = run;50 runAction = run; 50 51 } 51 52 … … 58 59 void HadrontherapySteppingAction::UserSteppingAction(const G4Step* aStep) 59 60 { 61 /* 62 // USEFULL METHODS TO RETRIEVE INFORMATION DURING THE STEPS 63 if( (aStep->GetTrack()->GetVolume()->GetName() == "DetectorPhys") 64 && aStep->GetTrack()->GetDefinition()->GetParticleName() == "proton") 65 //G4int evtNb = G4RunManager::GetRunManager()->GetCurrentEvent() -> GetEventID(); 66 { 67 G4cout << "ENERGIA: " << aStep->GetTrack()->GetKineticEnergy() 68 << " VOLUME " << aStep->GetTrack()->GetVolume()->GetName() 69 << " MATERIALE " << aStep -> GetTrack() -> GetMaterial() -> GetName() 70 << " EVENTO " << G4RunManager::GetRunManager()->GetCurrentEvent() -> GetEventID() 71 << " POS " << aStep->GetTrack()->GetPosition().x() 72 << G4endl; 73 } 74 */ 75 60 76 if( aStep->GetTrack()->GetVolume()->GetName() == "NewDetectorPhys"){ 61 #ifdef ANALYSIS_USE62 G4ParticleDefinition *def = aStep->GetTrack()->GetDefinition();63 G4double secondaryParticleKineticEnergy = aStep->GetTrack()->GetKineticEnergy();64 G4String particleType = def->GetParticleType(); // particle type = nucleus for d, t, He3, alpha, and heavier nuclei65 G4String particleName = def->GetParticleName(); // e.g. for alpha: the name = "alpha" and type = "nucleus"66 if(particleType == "nucleus") {67 G4int A = def->GetBaryonNumber();68 G4double Z = def->GetPDGCharge();69 G4double posX = aStep->GetTrack()->GetPosition().x() / cm;70 G4double posY = aStep->GetTrack()->GetPosition().y() / cm;71 G4double posZ = aStep->GetTrack()->GetPosition().z() / cm;72 G4double energy = secondaryParticleKineticEnergy / A / MeV;73 74 HadrontherapyAnalysisManager* analysisMgr = HadrontherapyAnalysisManager::getInstance();75 analysisMgr->fillFragmentTuple(A, Z, energy, posX, posY, posZ);76 } else if(particleName == "proton") { // proton (hydrogen-1) is a special case77 G4double posX = aStep->GetTrack()->GetPosition().x() / cm ;78 G4double posY = aStep->GetTrack()->GetPosition().y() / cm ;79 G4double posZ = aStep->GetTrack()->GetPosition().z() / cm ;80 G4double energy = secondaryParticleKineticEnergy * MeV; // Hydrogen-1: A = 1, Z = 181 HadrontherapyAnalysisManager::getInstance()->fillFragmentTuple(1, 1.0, energy, posX, posY, posZ);82 }83 84 G4String secondaryParticleName = def -> GetParticleName();85 //G4cout <<"Particle: " << secondaryParticleName << G4endl;86 //G4cout <<"Energy: " << secondaryParticleKineticEnergy << G4endl;87 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager:: getInstance();77 #ifdef G4ANALYSIS_USE_ROOT 78 G4ParticleDefinition *def = aStep->GetTrack()->GetDefinition(); 79 G4double secondaryParticleKineticEnergy = aStep->GetTrack()->GetKineticEnergy(); 80 G4String particleType = def->GetParticleType(); // particle type = nucleus for d, t, He3, alpha, and heavier nuclei 81 G4String particleName = def->GetParticleName(); // e.g. for alpha: the name = "alpha" and type = "nucleus" 82 if(particleType == "nucleus") { 83 G4int A = def->GetBaryonNumber(); 84 G4double Z = def->GetPDGCharge(); 85 G4double posX = aStep->GetTrack()->GetPosition().x() / cm; 86 G4double posY = aStep->GetTrack()->GetPosition().y() / cm; 87 G4double posZ = aStep->GetTrack()->GetPosition().z() / cm; 88 G4double energy = secondaryParticleKineticEnergy / A / MeV; 89 90 HadrontherapyAnalysisManager* analysisMgr = HadrontherapyAnalysisManager::GetInstance(); 91 analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ); 92 } else if(particleName == "proton") { // proton (hydrogen-1) is a special case 93 G4double posX = aStep->GetTrack()->GetPosition().x() / cm ; 94 G4double posY = aStep->GetTrack()->GetPosition().y() / cm ; 95 G4double posZ = aStep->GetTrack()->GetPosition().z() / cm ; 96 G4double energy = secondaryParticleKineticEnergy * MeV; // Hydrogen-1: A = 1, Z = 1 97 HadrontherapyAnalysisManager::GetInstance()->FillFragmentTuple(1, 1.0, energy, posX, posY, posZ); 98 } 99 100 G4String secondaryParticleName = def -> GetParticleName(); 101 //G4cout <<"Particle: " << secondaryParticleName << G4endl; 102 //G4cout <<"Energy: " << secondaryParticleKineticEnergy << G4endl; 103 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::GetInstance(); 88 104 //There is a bunch of stuff recorded with the energy 0, something should perhaps be done about this. 89 105 if(secondaryParticleName == "proton") { 90 analysis->hydrogenEnergy(secondaryParticleKineticEnergy / MeV);106 analysis->hydrogenEnergy(secondaryParticleKineticEnergy / MeV); 91 107 } 92 108 if(secondaryParticleName == "deuteron") { 93 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) / MeV);109 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) / MeV); 94 110 } 95 111 if(secondaryParticleName == "triton") { 96 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) / MeV);112 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) / MeV); 97 113 } 98 114 if(secondaryParticleName == "alpha") { 99 analysis->heliumEnergy((secondaryParticleKineticEnergy/4) / MeV);115 analysis->heliumEnergy((secondaryParticleKineticEnergy/4) / MeV); 100 116 } 101 117 if(secondaryParticleName == "He3"){ 102 analysis->heliumEnergy((secondaryParticleKineticEnergy/3) / MeV);118 analysis->heliumEnergy((secondaryParticleKineticEnergy/3) / MeV); 103 119 } 104 120 #endif … … 107 123 } 108 124 109 // Electromagnetic and hadronic processes of primary particles in the phantom 110 //setting phantomPhys correctly will break something here fixme 111 if ((aStep -> GetTrack() -> GetTrackID() == 1) && 112 (aStep -> GetTrack() -> GetVolume() -> GetName() == "PhantomPhys") && 113 (aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL)) 125 // Electromagnetic and hadronic processes of primary particles in the phantom 126 //setting phantomPhys correctly will break something here fixme 127 if ((aStep -> GetTrack() -> GetTrackID() == 1) && 128 (aStep -> GetTrack() -> GetVolume() -> GetName() == "PhantomPhys") && 129 (aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL)) 130 { 131 G4String process = aStep -> GetPostStepPoint() -> 132 GetProcessDefinedStep() -> GetProcessName(); 133 134 if ((process == "Transportation") || (process == "StepLimiter")) {;} 135 else 136 { 137 if ((process == "msc") || (process == "hLowEIoni") || (process == "hIoni")) 138 { 139 runAction -> AddEMProcess(); 140 } 141 else 114 142 { 115 G4String process = aStep -> GetPostStepPoint() -> 116 GetProcessDefinedStep() -> GetProcessName(); 117 118 if ((process == "Transportation") || (process == "StepLimiter")) {;} 119 else { 120 if ((process == "msc") || (process == "hLowEIoni") || (process == "hIoni")) 121 { 122 runAction -> AddEMProcess(); 123 } 124 else 125 { 126 runAction -> AddHadronicProcess(); 127 128 if ( (process != "LElastic") && (process != "ProtonInelastic") && (process != "hElastic") ) 129 G4cout << "Warning! Unknown proton process: "<< process << G4endl; 130 } 131 } 143 runAction -> AddHadronicProcess(); 144 145 if ( (process != "LElastic") && (process != "ProtonInelastic") && (process != "hElastic") ) 146 G4cout << "Warning! Unknown proton process: "<< process << G4endl; 132 147 } 133 134 // Retrieve information about the secondaries originated in the phantom 135 136 G4SteppingManager* steppingManager = fpSteppingManager; 137 138 // check if it is alive 139 //if(theTrack-> GetTrackStatus() == fAlive) { return; } 140 141 // Retrieve the secondary particles 142 G4TrackVector* fSecondary = steppingManager -> GetfSecondary(); 143 144 for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++) 148 } 149 } 150 151 // Retrieve information about the secondaries originated in the phantom 152 153 G4SteppingManager* steppingManager = fpSteppingManager; 154 155 // check if it is alive 156 //if(theTrack-> GetTrackStatus() == fAlive) { return; } 157 158 // Retrieve the secondary particles 159 G4TrackVector* fSecondary = steppingManager -> GetfSecondary(); 160 161 for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++) 145 162 { 146 G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();147 148 if (volumeName == "phantomPhys")163 G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName(); 164 165 if (volumeName == "phantomPhys") 149 166 { 150 #ifdef ANALYSIS_USE151 G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();152 G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();153 154 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::getInstance();155 156 if (secondaryParticleName == "e-")157 analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/MeV);158 159 if (secondaryParticleName == "gamma")160 analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/MeV);161 162 if (secondaryParticleName == "deuteron")163 analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/MeV);164 165 if (secondaryParticleName == "triton")166 analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/MeV);167 168 if (secondaryParticleName == "alpha")169 analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/MeV);170 171 G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();172 if (z > 0.)173 {174 G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();175 G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy();176 177 // If a generic ion is originated in the detector, its baryonic number, PDG charge,178 // total number of electrons in the orbitals are stored in a ntuple179 analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/MeV);167 #ifdef G4ANALYSIS_USE_ROOT 168 G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName(); 169 G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy(); 170 171 HadrontherapyAnalysisManager* analysis = HadrontherapyAnalysisManager::GetInstance(); 172 173 if (secondaryParticleName == "e-") 174 analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/MeV); 175 176 if (secondaryParticleName == "gamma") 177 analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/MeV); 178 179 if (secondaryParticleName == "deuteron") 180 analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/MeV); 181 182 if (secondaryParticleName == "triton") 183 analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/MeV); 184 185 if (secondaryParticleName == "alpha") 186 analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/MeV); 187 188 G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge(); 189 if (z > 0.) 190 { 191 G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber(); 192 G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy(); 193 194 // If a generic ion is originated in the detector, its baryonic number, PDG charge, 195 // total number of electrons in the orbitals are stored in a ntuple 196 analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/MeV); 180 197 } 181 198 #endif -
trunk/examples/advanced/human_phantom/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1.7 2010/01/11 14:33:30 gcosmo Exp $ 1 2 # -------------------------------------------------------------- 2 3 # GNUmakefile for examples module. 3 # Author: Giorgio Guerrieri4 # Date: 14/06/2005.5 4 # -------------------------------------------------------------- 6 5 … … 10 9 11 10 ifndef G4INSTALL 12 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 13 12 endif 14 13 -
trunk/examples/advanced/human_phantom/History
r1230 r1313 1 $Id: History,v 1.2 5 2009/04/06 06:24:37 cirroneExp $1 $Id: History,v 1.28 2010/06/06 06:20:14 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 18 18 * Reverse chronological order (last date on top), please * 19 19 ---------------------------------------------------------- 20 21 June 4, 2010, J.Perl, tag: human_phantom-V09-03-02 22 - Updated vis usage 23 24 June 4, 2010, S. Guatelli, tag: human_phantom-V09-03-01 25 - Migration of Physics List 26 27 April 29, 2010, G.Cosmo, tag: human_phantom-V09-03-00 28 - Added missing includes of G4PVPlacement, causing compilation error. 29 - Migrated multiple-scattering process in physics-list to particle-based 30 (e+/e-) multiple-scattering. 31 - Corrected commands in some macros... 20 32 21 33 April 6, 2009, G.A.P.Cirrone, tag: human_phantom-V09-02-02 -
trunk/examples/advanced/human_phantom/README
r1230 r1313 1 $Id: README,v 1.1 4 2009/02/19 14:05:06 gcosmoExp $1 $Id: README,v 1.16 2010/06/03 23:42:16 cirrone Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 9 9 ----------------------- 10 10 11 Authors: S. Guatelli (guatelli@ge.infn.it) and M. G. Pia (pia@ge.infn.it), 12 INFN Genova, Italy. 11 Authors: S. Guatelli (susanna.guatelli@uow.edu.au), G. Guerrieri 12 and M. G. Pia (pia@ge.infn.it) 13 14 Maintained by: S. Guatelli (susanna.guatelli@uow.edu.au) 13 15 14 16 ------> Introduction -
trunk/examples/advanced/human_phantom/adultHead.mac
r807 r1313 69 69 # Run Particles 70 70 # 71 #/control/execute run.mac71 /control/execute run.mac -
trunk/examples/advanced/human_phantom/adultMIRDFemale.mac
r807 r1313 80 80 # 81 81 # Visualize Phantom with OPENGL 82 #/control/execute openGLVis.mac82 /control/execute openGLVis.mac 83 83 # 84 84 # Visualize Phantom with DAWN 85 /control/execute dawnVis.mac85 #/control/execute dawnVis.mac 86 86 # 87 87 # Run Particles 88 88 # 89 #/control/execute run.mac89 /control/execute run.mac 90 90 -
trunk/examples/advanced/human_phantom/adultMIXFemale.mac
r807 r1313 80 80 # 81 81 # Visualize Phantom with OPENGL 82 #/control/execute openGLVis.mac82 /control/execute openGLVis.mac 83 83 # 84 84 # Visualize Phantom with DAWN 85 /control/execute dawnVis.mac85 #/control/execute dawnVis.mac 86 86 # 87 87 # Run Particles 88 88 # 89 #/control/execute run.mac89 /control/execute run.mac 90 90 -
trunk/examples/advanced/human_phantom/adultORNLFemale.mac
r807 r1313 8 8 # Choose model: ORNLFemale, ORNLMale, MIRD, MIX, MIRDHead, ORNLHead 9 9 # 10 11 10 /phantom/setPhantomModel ORNLFemale 12 11 # -
trunk/examples/advanced/human_phantom/dawnVis.mac
r807 r1313 9 9 /event/verbose 0 10 10 /tracking/verbose 0 11 /vis/scene/create 11 # 12 # Use this open statement to create an OpenGL view: 13 #/vis/open OGL 600x600-0+0 14 # 15 # Use this open statement to create a .prim file suitable for 16 # viewing in DAWN: 12 17 /vis/open DAWNFILE 18 # 19 # Use this open statement to create a .heprep file suitable for 20 # viewing in HepRApp: 21 #/vis/open HepRepFile 22 # 23 # Use this open statement to create a .wrl file suitable for 24 # viewing in a VRML viewer: 25 #/vis/open VRML2FILE 26 # 27 # Disable auto refresh and quieten vis messages whilst scene and 28 # trajectories are established: 29 /vis/viewer/set/autoRefresh false 30 /vis/verbose errors 31 # 32 # Draw geometry: 13 33 /vis/drawVolume 14 #/vis/specify15 /vis/viewer/flush16 34 # 35 # Specify view angle: 36 #/vis/viewer/set/viewpointThetaPhi 90. 0. 37 # 38 # Specify zoom value: 39 #/vis/viewer/zoom 2. 40 # 41 # Specify style (surface or wireframe): 42 #/vis/viewer/set/style wireframe 43 # 44 # Draw coordinate axes: 45 #/vis/scene/add/axes 0 0 0 1 m 46 # 47 # Draw smooth trajectories at end of event, showing trajectory points 48 # as markers 2 pixels wide: 49 /vis/scene/add/trajectories smooth 50 /vis/modeling/trajectories/create/drawByCharge 51 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 52 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 53 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 54 # 55 # Draw hits at end of event: 56 #/vis/scene/add/hits 57 # 58 # To draw only gammas: 59 #/vis/filtering/trajectories/create/particleFilter 60 #/vis/filtering/trajectories/particleFilter-0/add gamma 61 # 62 # To invert the above, drawing all particles except gammas, 63 # keep the above two lines but also add: 64 #/vis/filtering/trajectories/particleFilter-0/invert true 65 # 66 # Many other options are available with /vis/modeling and /vis/filtering. 67 # For example, to select colour by particle ID: 68 #/vis/modeling/trajectories/create/drawByParticleID 69 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 70 # 71 # To superimpose all of the events from a given run: 72 #/vis/scene/endOfEventAction accumulate 73 # 74 # Re-establish auto refreshing and verbosity: 75 /vis/viewer/set/autoRefresh true 76 /vis/verbose warnings 77 # 78 # For file-based drivers, use this to create an empty detector view: 79 #/vis/viewer/flush -
trunk/examples/advanced/human_phantom/openGLVis.mac
r807 r1313 1 # Use this open statement to create an OpenGL view: 2 /vis/open OGL 600x600-0+0 1 3 # 2 # Macro file for the visualization 3 # when runing in interactive mode 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 6 #/vis/open DAWNFILE 4 7 # 5 # create empty scene 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 6 11 # 7 /vis/scene/create 8 /vis/open OGLIX 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 14 #/vis/open VRML2FILE 9 15 # 10 # Create a scene handler for a specific graphics system 11 # (Edit the next line(s) to choose another graphic system) 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 12 20 # 13 #/vis/viewer/set/viewpointThetaPhi 90 90 deg 21 # Draw geometry: 22 /vis/drawVolume 23 # 24 # Specify view angle: 25 #/vis/viewer/set/viewpointThetaPhi 90. 0. 26 # 27 # Specify zoom value: 14 28 #/vis/viewer/zoom 2. 15 # (if too many tracks cause core dump => storeTrajectory 0) 16 /tracking/storeTrajectory 1 17 /vis/scene/add/trajectories 18 # (if you prefer refreshing each event, comment out next line) 29 # 30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 32 # 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 1 m 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 43 # 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 19 61 /vis/scene/endOfEventAction accumulate 20 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush -
trunk/examples/advanced/human_phantom/vrmlVis.mac
r807 r1313 1 # Use this open statement to create an OpenGL view: 2 #/vis/open OGL 600x600-0+0 1 3 # 2 # Macro file for the initialization phase 3 # when runing in interactive mode 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 6 #/vis/open DAWNFILE 4 7 # 5 # Sets some default verbose 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 6 11 # 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 7 14 /vis/open VRML2FILE 15 # 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 20 # 21 # Draw geometry: 8 22 /vis/drawVolume 9 /vis/scene/create10 # Attack the current scene handler to the current scene11 /vis/sceneHandler/attach12 /vis/viewer/flush13 23 # 24 # Specify view angle: 25 #/vis/viewer/set/viewpointThetaPhi 90. 0. 26 # 27 # Specify zoom value: 28 #/vis/viewer/zoom 2. 29 # 30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 32 # 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 1 m 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 43 # 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 61 #/vis/scene/endOfEventAction accumulate 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush -
trunk/examples/advanced/lAr_calorimeter/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1.1 1 2009/11/12 12:43:14 ribonExp $1 # $Id: GNUmakefile,v 1.12 2010/01/11 16:10:42 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/lAr_calorimeter/History
r1230 r1313 1 1 Hi------------------------------------------------------------------- 2 $Id: History,v 1. 19 2009/11/12 12:43:14 ribonExp $2 $Id: History,v 1.20 2010/06/06 06:20:49 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 12 04.06.2010 Joseph Perl (lAr_calorimeter-V09-03-00) 13 Updated vis usage 11 14 12 15 12.11.2009 - A.Ribon (lAr_calorimeter-V09-02-01) -
trunk/examples/advanced/lAr_calorimeter/prerunlArcal.mac
r807 r1313 23 23 24 24 /vis/sceneHandler/create DAWNFILE 25 /vis/sceneHandler/create OGL IX25 /vis/sceneHandler/create OGL 26 26 #/vis/sceneHandler/create RAYX 27 27 -
trunk/examples/advanced/lAr_calorimeter/vis.mac
r807 r1313 10 10 /run/initialize 11 11 # 12 # Create empty scene ("world" is default)13 /vis/ scene/create12 # Use this open statement to create an OpenGL view: 13 /vis/open OGL 600x600-0+0 14 14 # 15 # Create a scene handler for a specific graphics system 16 # Edit the next line(s) to choose another graphic system 15 # Use this open statement to create a .prim file suitable for 16 # viewing in DAWN: 17 #/vis/open DAWNFILE 17 18 # 18 19 # Use this open statement to create a .heprep file suitable for 20 # viewing in HepRApp: 21 #/vis/open HepRepFile 19 22 # 20 /vis/open DAWNFILE 21 /vis/open OGLIX 23 # Use this open statement to create a .wrl file suitable for 24 # viewing in a VRML viewer: 25 #/vis/open VRML2FILE 22 26 # 23 # Draw scene 27 # Disable auto refresh and quieten vis messages whilst scene and 28 # trajectories are established: 29 /vis/viewer/set/autoRefresh false 30 /vis/verbose errors 31 # 32 # Draw geometry: 33 /vis/drawVolume 34 # 35 # Specify view angle: 36 #/vis/viewer/set/viewpointThetaPhi 90. 0. 37 # 38 # Specify zoom value: 24 39 /vis/viewer/zoom 10.5 25 /vis/viewer/flush26 40 # 27 # for drawing the tracks 28 # if too many tracks cause core dump => storeTrajectory 0 29 /tracking/storeTrajectory 1 41 # Specify style (surface or wireframe): 42 #/vis/viewer/set/style wireframe 43 # 44 # Draw coordinate axes: 45 #/vis/scene/add/axes 0 0 0 1 m 46 # 47 # Draw smooth trajectories at end of event, showing trajectory points 48 # as markers 2 pixels wide: 49 /vis/scene/add/trajectories smooth 50 /vis/modeling/trajectories/create/drawByCharge 51 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 52 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 53 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 54 # 55 # Draw hits at end of event: 56 #/vis/scene/add/hits 57 # 58 # To draw only gammas: 59 #/vis/filtering/trajectories/create/particleFilter 60 #/vis/filtering/trajectories/particleFilter-0/add gamma 61 # 62 # To invert the above, drawing all particles except gammas, 63 # keep the above two lines but also add: 64 #/vis/filtering/trajectories/particleFilter-0/invert true 65 # 66 # Many other options are available with /vis/modeling and /vis/filtering. 67 # For example, to select colour by particle ID: 68 #/vis/modeling/trajectories/create/drawByParticleID 69 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 70 # 71 # To superimpose all of the events from a given run: 30 72 /vis/scene/endOfEventAction accumulate 31 73 # 32 /event/drawTracks all 74 # Re-establish auto refreshing and verbosity: 75 /vis/viewer/set/autoRefresh true 76 /vis/verbose warnings 77 # 78 # For file-based drivers, use this to create an empty detector view: 79 #/vis/viewer/flush 33 80 # 34 81 # set magnetic field for visualization only, and limit -
trunk/examples/advanced/medical_linac/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1. 7 2009/11/17 12:55:01 cirroneExp $1 # $Id: GNUmakefile,v 1.8 2010/01/11 16:11:34 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/medical_linac/History
r1230 r1313 1 $Id: History,v 1.2 7 2009/11/19 09:54:39 cirroneExp $1 $Id: History,v 1.28 2010/06/06 06:21:22 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 15 15 * Reverse chronological order (last date on top), please * 16 16 ---------------------------------------------------------- 17 03.06.2010 J.Perl tag medical_linac-V09-03-00 18 Update vis usage 19 17 20 19.11.2009 C. Andenna, B. Caccia, G.A.P.Cirrone tag medical_linac-V09-02-05 18 21 History corrected, changed the local environmental variables name -
trunk/examples/advanced/medical_linac/vis.mac
r1230 r1313 1 /vis/scene/create 2 /vis/open OGLIX 3 4 /vis/drawVolume 5 6 #/vis/scene/add/volume 7 8 /vis/viewer/set/viewpointThetaPhi 45 45 deg 9 /vis/viewer/zoom 1 10 /vis/viewer/flush 11 /vis/scene/add/trajectories 1 # Use this open statement to create an OpenGL view: 2 /vis/open OGL 600x600-0+0 3 # 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 6 #/vis/open DAWNFILE 7 # 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 11 # 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 14 #/vis/open VRML2FILE 15 # 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 20 # 21 # Draw geometry: 22 /vis/drawVolume 23 # 24 # Specify view angle: 25 /vis/viewer/set/viewpointThetaPhi 45. 45. 26 # 27 # Specify zoom value: 28 #/vis/viewer/zoom 2. 29 # 30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 32 # 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 1 m 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 43 # 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 12 61 /vis/scene/endOfEventAction accumulate 100 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush 13 69 14 70 /run/beamOn 100 -
trunk/examples/advanced/microbeam/GNUmakefile
r807 r1313 1 1 # ------------------------------------------------------------------- 2 # $Id: GNUmakefile,v 1. 4 2006/06/01 22:25:19 sincertiExp $2 # $Id: GNUmakefile,v 1.5 2010/01/11 16:12:41 gcosmo Exp $ 3 3 # ----------- 4 4 # GNUmakefile … … 7 7 name := Microbeam 8 8 9 G4DEBUG := 010 9 G4TARGET := $(name) 11 10 G4EXLIB := true 12 G4VERBOSE :=113 11 14 12 ifndef G4INSTALL 15 G4INSTALL = ../.. /..13 G4INSTALL = ../.. 16 14 endif 17 15 -
trunk/examples/advanced/microbeam/History
r1230 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.2 1 2009/04/30 10:23:57sincerti Exp $2 $Id: History,v 1.25 2010/06/07 03:18:01 sincerti Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Package History file 10 10 -------------------- 11 12 06 June 2010 - S. Incerti - tag microbeam-V09-03-03 13 - Removed unused variable (evt) in MicrobeamEventAction.cc 14 15 03 June 2010 - J.Perl - tag microbeam-V09-03-02 16 - Update vis usage 17 18 23 February 2010 - S. Incerti - tag microbeam-V09-03-01 19 - changed material/density selection in MicrobeamPhantomConfiguration.cc 20 (thanks to gunter) 21 22 23 February 2010 - S. Incerti - tag microbeam-V09-03-00 23 - Added density initialisation in MicrobeamPhantomConfiguration.cc 24 (thanks to gunter) 11 25 12 26 30 April 2009 - S. Incerti - tag microbeam-V09-02-01 -
trunk/examples/advanced/microbeam/microbeam.mac
r807 r1313 1 #/vis/scene/create 2 #/vis/scene/add/volume 3 #/vis/sceneHandler/create OGLIX 1 /tracking/storeTrajectory 1 4 2 5 #/vis/viewer/create 6 #/vis/viewer/zoom 2000000 7 #/vis/viewer/set/viewpointVector 400 0 105.79 8 9 /tracking/storeTrajectory 1 10 #/vis/scene/endOfEventAction accumulate 3 /control/execute vis.mac 11 4 12 5 /tracking/verbose 0 -
trunk/examples/advanced/microbeam/microbeam.out
r1230 r1313 5 5 6 6 ************************************************************* 7 Geant4 version Name: geant4-09-03-ref-0 0 (18-December-2009)7 Geant4 version Name: geant4-09-03-ref-04 (9-April-2010) 8 8 Copyright : Geant4 Collaboration 9 9 Reference : NIM A 506 (2003), 250-303 … … 48 48 ***** Table : Nb of materials = 16 ***** 49 49 50 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 atm50 Material: Vacuum density: 0.000 kg/m3 RadL: 204727512.315 pc Nucl.Int.Length: 113804112.800 pc Imean: 19.200 eV temperature: 273.15 K pressure: 1.00 atm 51 51 ---> Element: Vacuum ( ) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 100.00 % ElmAbundance 100.00 % 52 52 53 Material: H2O density: 1.000 g/cm3 RadL: 36.092 cm Nucl.Int.Length: 75.416 cm Imean: 70.893eV53 Material: H2O density: 1.000 g/cm3 RadL: 36.092 cm Nucl.Int.Length: 75.416 cm Imean: 68.998 eV 54 54 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 11.21 % ElmAbundance 66.67 % 55 55 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 88.79 % ElmAbundance 33.33 % 56 56 57 Material: Air density: 1.290 mg/cm3 RadL: 285.161 m Nucl.Int.Length: 662.680 m Imean: 85. 684eV temperature: 293.16 K pressure: 1.00 atm57 Material: Air density: 1.290 mg/cm3 RadL: 285.161 m Nucl.Int.Length: 662.680 m Imean: 85.703 eV temperature: 293.16 K pressure: 1.00 atm 58 58 ---> Element: Nitrogen (N) Z = 7.0 N = 14.0 A = 14.01 g/mole ElmMassFraction: 70.00 % ElmAbundance 72.71 % 59 59 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 30.00 % ElmAbundance 27.29 % 60 60 61 Material: LPAir density: 0.000 kg/m3 RadL: 56273234.858 km Nucl.Int.Length: 135377105.890 km Imean: 87.3 08eV temperature: 293.16 K pressure: 1.00 atm61 Material: LPAir density: 0.000 kg/m3 RadL: 56273234.858 km Nucl.Int.Length: 135377105.890 km Imean: 87.351 eV temperature: 293.16 K pressure: 1.00 atm 62 62 ---> Element: Nitrogen (N) Z = 7.0 N = 14.0 A = 14.01 g/mole ElmMassFraction: 71.50 % ElmAbundance 75.57 % 63 63 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 25.00 % ElmAbundance 23.14 % 64 64 ---> Element: Argon (Ar) Z = 18.0 N = 39.9 A = 39.95 g/mole ElmMassFraction: 3.50 % ElmAbundance 1.30 % 65 65 66 Material: Pl density: 21.400 g/cm3 RadL: 3.058 mm Nucl.Int.Length: 9.486 cm Imean: 7 87.800 eV66 Material: Pl density: 21.400 g/cm3 RadL: 3.058 mm Nucl.Int.Length: 9.486 cm Imean: 790.000 eV 67 67 ---> Element: Pl ( ) Z = 78.0 N = 195.1 A = 195.09 g/mole ElmMassFraction: 100.00 % ElmAbundance 100.00 % 68 68 69 Material: Butane density: 0.026 kg/m3 RadL: 17.729 km Nucl.Int.Length: 25.686 km Imean: 53. 612eV temperature: 293.16 K pressure: 0.01 atm69 Material: Butane density: 0.026 kg/m3 RadL: 17.729 km Nucl.Int.Length: 25.686 km Imean: 53.040 eV temperature: 293.16 K pressure: 0.01 atm 70 70 ---> Element: Carbon (C) Z = 6.0 N = 12.0 A = 12.01 g/mole ElmMassFraction: 82.63 % ElmAbundance 28.57 % 71 71 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 17.37 % ElmAbundance 71.43 % 72 72 73 Material: Polyprop density: 900.000 mg/cm3 RadL: 49.764 cm Nucl.Int.Length: 75.179 cm Imean: 56. 713eV73 Material: Polyprop density: 900.000 mg/cm3 RadL: 49.764 cm Nucl.Int.Length: 75.179 cm Imean: 56.518 eV 74 74 ---> Element: Carbon (C) Z = 6.0 N = 12.0 A = 12.01 g/mole ElmMassFraction: 85.60 % ElmAbundance 33.33 % 75 75 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 14.40 % ElmAbundance 66.67 % 76 76 77 Material: Si3N4 density: 3.440 g/cm3 RadL: 7.644 cm Nucl.Int.Length: 28.008 cm Imean: 128. 542eV77 Material: Si3N4 density: 3.440 g/cm3 RadL: 7.644 cm Nucl.Int.Length: 28.008 cm Imean: 128.337 eV 78 78 ---> Element: Silicon (Si) Z = 14.0 N = 28.1 A = 28.09 g/mole ElmMassFraction: 60.06 % ElmAbundance 42.86 % 79 79 ---> Element: Nitrogen (N) Z = 7.0 N = 14.0 A = 14.01 g/mole ElmMassFraction: 39.94 % ElmAbundance 57.14 % 80 80 81 Material: SiO2 density: 2.500 g/cm3 RadL: 10.819 cm Nucl.Int.Length: 38.343 cm Imean: 12 6.007eV81 Material: SiO2 density: 2.500 g/cm3 RadL: 10.819 cm Nucl.Int.Length: 38.343 cm Imean: 125.663 eV 82 82 ---> Element: Silicon (Si) Z = 14.0 N = 28.1 A = 28.09 g/mole ElmMassFraction: 46.74 % ElmAbundance 33.33 % 83 83 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 53.26 % ElmAbundance 66.67 % 84 84 85 Material: Laiton density: 8.500 g/cm3 RadL: 1.487 cm Nucl.Int.Length: 16.512 cm Imean: 32 5.993 eV85 Material: Laiton density: 8.500 g/cm3 RadL: 1.487 cm Nucl.Int.Length: 16.512 cm Imean: 326.043 eV 86 86 ---> Element: Cuivre (Cu) Z = 29.0 N = 63.5 A = 63.55 g/mole ElmMassFraction: 49.28 % ElmAbundance 50.00 % 87 87 ---> Element: Zinc (Zn) Z = 30.0 N = 65.4 A = 65.41 g/mole ElmMassFraction: 50.72 % ElmAbundance 50.00 % 88 88 89 Material: Cytoplasm1 density: 1.000 g/cm3 RadL: 48.413 cm Nucl.Int.Length: 46.131 cm Imean: 31.293eV89 Material: Cytoplasm1 density: 1.000 g/cm3 RadL: 48.413 cm Nucl.Int.Length: 46.131 cm Imean: 28.535 eV 90 90 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 59.60 % ElmAbundance 95.53 % 91 91 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 24.24 % ElmAbundance 2.45 % … … 94 94 ---> Element: Phosphorus (P) Z = 15.0 N = 31.0 A = 30.97 g/mole ElmMassFraction: 1.01 % ElmAbundance 0.05 % 95 95 96 Material: Cytoplasm2 density: 10.000 g/cm3 RadL: 3.619 cm Nucl.Int.Length: 7.563 cm Imean: 71.338eV96 Material: Cytoplasm2 density: 10.000 g/cm3 RadL: 3.619 cm Nucl.Int.Length: 7.563 cm Imean: 69.752 eV 97 97 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 10.64 % ElmAbundance 64.80 % 98 98 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 74.50 % ElmAbundance 28.64 % … … 101 101 ---> Element: Phosphorus (P) Z = 15.0 N = 31.0 A = 30.97 g/mole ElmMassFraction: 2.61 % ElmAbundance 0.52 % 102 102 103 Material: Cytoplasm3 density: 1.000 g/cm3 RadL: 48.413 cm Nucl.Int.Length: 46.131 cm Imean: 31.293eV103 Material: Cytoplasm3 density: 1.000 g/cm3 RadL: 48.413 cm Nucl.Int.Length: 46.131 cm Imean: 28.535 eV 104 104 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 59.60 % ElmAbundance 95.53 % 105 105 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 24.24 % ElmAbundance 2.45 % … … 108 108 ---> Element: Phosphorus (P) Z = 15.0 N = 31.0 A = 30.97 g/mole ElmMassFraction: 1.01 % ElmAbundance 0.05 % 109 109 110 Material: Nucleus1 density: 1.000 g/cm3 RadL: 36.185 cm Nucl.Int.Length: 75.626 cm Imean: 71.338eV110 Material: Nucleus1 density: 1.000 g/cm3 RadL: 36.185 cm Nucl.Int.Length: 75.626 cm Imean: 69.752 eV 111 111 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 10.64 % ElmAbundance 64.80 % 112 112 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 74.50 % ElmAbundance 28.64 % … … 115 115 ---> Element: Phosphorus (P) Z = 15.0 N = 31.0 A = 30.97 g/mole ElmMassFraction: 2.61 % ElmAbundance 0.52 % 116 116 117 Material: Nucleus2 density: 1.100 g/cm3 RadL: 32.896 cm Nucl.Int.Length: 68.751 cm Imean: 71.338eV117 Material: Nucleus2 density: 1.100 g/cm3 RadL: 32.896 cm Nucl.Int.Length: 68.751 cm Imean: 69.752 eV 118 118 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 10.64 % ElmAbundance 64.80 % 119 119 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 74.50 % ElmAbundance 28.64 % … … 122 122 ---> Element: Phosphorus (P) Z = 15.0 N = 31.0 A = 30.97 g/mole ElmMassFraction: 2.61 % ElmAbundance 0.52 % 123 123 124 Material: Nucleus3 density: 1.000 g/cm3 RadL: 36.185 cm Nucl.Int.Length: 75.626 cm Imean: 71.338eV124 Material: Nucleus3 density: 1.000 g/cm3 RadL: 36.185 cm Nucl.Int.Length: 75.626 cm Imean: 69.752 eV 125 125 ---> Element: Hydrogen (H) Z = 1.0 N = 1.0 A = 1.01 g/mole ElmMassFraction: 10.64 % ElmAbundance 64.80 % 126 126 ---> Element: Oxygen (O) Z = 8.0 N = 16.0 A = 16.00 g/mole ElmMassFraction: 74.50 % ElmAbundance 28.64 % … … 158 158 msc: for e- SubType= 10 159 159 Lambda tables from 100 eV to 10 TeV in 77 bins, spline: 1 160 RangeFactor= 0.04, step limit type: 2, lateralDisplacement: 1, skin= 3, geomFactor= 2.5160 RangeFactor= 0.04, stepLimitType: 2, latDisplacement: 1, skin= 1, geomFactor= 2.5 161 161 ===== EM models for the G4Region DefaultRegionForTheWorld ====== 162 162 UrbanMsc92 : Emin= 0 eV Emax= 10 TeV … … 199 199 200 200 msc: for GenericIon SubType= 10 201 RangeFactor= 0.2, stepLimitType: 0, latDisplacement: 0 , skin= 3, geomFactor= 2.5201 RangeFactor= 0.2, stepLimitType: 0, latDisplacement: 0 202 202 ===== EM models for the G4Region DefaultRegionForTheWorld ====== 203 203 UrbanMsc90 : Emin= 0 eV Emax= 10 TeV … … 322 322 is non-zero. 323 323 -> Event # 2 generated 324 ===> The incident alpha particle has reached the targeted cell : 325 -----> total absorbed dose within Nucleus is (Gy) = 0.35642141103745 326 -----> total absorbed dose within Cytoplasm is (Gy) = 0.06113151460886 324 ===> Sorry, the incident alpha particle has missed the targeted cell ! 327 325 328 326 -> Event # 3 generated … … 337 335 -> Event # 6 generated 338 336 ===> The incident alpha particle has reached the targeted cell : 339 -----> total absorbed dose within Nucleus is (Gy) = 0.3 7929552793503340 -----> total absorbed dose within Cytoplasm is (Gy) = 0.0 73292337357998337 -----> total absorbed dose within Nucleus is (Gy) = 0.36355394124985 338 -----> total absorbed dose within Cytoplasm is (Gy) = 0.05491229519248 341 339 342 340 -> Event # 7 generated 341 ===> Sorry, the incident alpha particle has missed the targeted cell ! 342 343 -> Event # 8 generated 344 ===> Sorry, the incident alpha particle has missed the targeted cell ! 345 346 -> Event # 9 generated 347 ===> Sorry, the incident alpha particle has missed the targeted cell ! 348 349 -> Event # 10 generated 343 350 ===> The incident alpha particle has reached the targeted cell : 344 -----> total absorbed dose within Nucleus is (Gy) = 0.44333383440971 345 -----> total absorbed dose within Cytoplasm is (Gy) = 0.088046304881573 346 347 -> Event # 8 generated 348 ===> The incident alpha particle has reached the targeted cell : 349 -----> total absorbed dose within Nucleus is (Gy) = 0.31207606196404 350 -----> total absorbed dose within Cytoplasm is (Gy) = 0.077978290617466 351 352 -> Event # 9 generated 353 ===> Sorry, the incident alpha particle has missed the targeted cell ! 354 355 -> Event # 10 generated 356 ===> Sorry, the incident alpha particle has missed the targeted cell ! 351 -----> total absorbed dose within Nucleus is (Gy) = 0.33644217252731 352 -----> total absorbed dose within Cytoplasm is (Gy) = 0.084216192364693 357 353 358 354 ERROR: G4VisCommandsViewerUpdate::SetNewValue: no current viewer. 359 -> Total number of particles detected by the gas detector : 4355 -> Total number of particles detected by the gas detector : 2 360 356 361 357 Idle> Graphics systems deleted. -
trunk/examples/advanced/purging_magnet/GNUmakefile
r1230 r1313 1 1 # -------------------------------------------------------------- 2 # $Id: GNUmakefile,v 1. 2 2009/03/06 09:28:28 gbarrandExp $2 # $Id: GNUmakefile,v 1.3 2010/01/11 16:14:56 gcosmo Exp $ 3 3 # -------------------------------------------------------------- 4 4 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 11 11 12 12 ifndef G4INSTALL 13 G4INSTALL = ../.. /..13 G4INSTALL = ../.. 14 14 endif 15 15 -
trunk/examples/advanced/purging_magnet/History
r1230 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.1 0 2009/04/08 10:23:31 cirroneExp $2 $Id: History,v 1.12 2010/06/07 05:18:38 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 03.06.2010 - Joseph Perl (purtag-V09-03-01) 12 - Remove unused variable in EventAction 13 14 03.06.2010 - Joseph Perl (purtag-V09-03-00) 15 - Updated vis usage 16 11 17 06.04.2009 G.A.P.Cirrone (purtag-V09-02-00) 12 18 - GNUmakefile updated -
trunk/examples/advanced/purging_magnet/vis.mac
r807 r1313 1 # Use this open statement to create an OpenGL view: 2 /vis/open OGL 600x600-0+0 1 3 # 2 # Macro file for the initialization phase of "PurgMag.cc" 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 6 #/vis/open DAWNFILE 3 7 # 4 # Sets some default verbose 5 # and initializes the visualization. 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 6 11 # 7 #/control/verbose 2 8 #/run/verbose 2 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 14 #/vis/open VRML2FILE 9 15 # 10 # Create empty scene ("world" is default) 11 /vis/scene/create 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 12 20 # 13 # Add volume to scene14 /vis/ scene/add/volume21 # Draw geometry: 22 /vis/drawVolume 15 23 # 16 # Create a scene handler for a specific graphics system17 # Edit the next line(s) to choose another graphic system 24 # Specify view angle: 25 /vis/viewer/set/viewpointThetaPhi 90. 0. 18 26 # 19 #/vis/sceneHandler/create DAWN 20 #/vis/sceneHandler/create DAWNFILE 21 /vis/sceneHandler/create OGLIX 22 #/vis/sceneHandler/create VRML2FILE 27 # Specify zoom value: 28 /vis/viewer/zoom 1.5 23 29 # 24 # Create a viewer25 /vis/viewer/create30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 26 32 # 27 # viewpoint : (theta,phi) = (#*deg, #*deg), 28 # zoom factor: # 29 # coordinate axes: 30 # x-axis:red, y-axis:green, z-axis:blue 31 /vis/viewer/reset 32 /vis/viewer/set/viewpointThetaPhi 90 0 33 /vis/viewer/zoom 1.5 34 #/vis/draw/axes 0 0 0 500 35 #/vis/draw/text 0 0 0 mm 5 -120 -200 Assorbitore.0 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 500 mm 36 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 37 43 # 38 # Draw scene 39 /vis/scene/notifyHandlers 40 # for drawing the tracks 41 # if too many tracks cause core dump => storeTrajectory 0 42 /tracking/storeTrajectory 1 43 /vis/scene/endOfEventAction accumulate 44 45 46 47 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 61 /vis/scene/endOfEventAction accumulate 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush -
trunk/examples/advanced/radioprotection/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1. 6 2009/03/06 09:38:55 gbarrandExp $1 # $Id: GNUmakefile,v 1.7 2010/01/11 16:15:40 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/radioprotection/History
r1230 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1.2 4 2009/11/15 23:23:24 cirroneExp $2 $Id: History,v 1.26 2010/06/07 05:19:47 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 12 06.06.2010 J. Perl, tag radioprotection-V09-03-01 13 Remove unused variable in EventAction 14 15 03.06.2010 J. Perl, tag radioprotection-V09-03-00 16 Update vis usage 11 17 12 18 16.11.2009 S. Guatelli, tag radioprotection-V09-02-04 -
trunk/examples/advanced/radioprotection/moon.mac
r807 r1313 18 18 ####################################### 19 19 ## Visualisation 20 #/vis/scene/create 21 # --- Choose one the following visualisation tools 22 #/vis/open OGLIX 23 #/vis/open DAWNFILE 24 #/vis/open VRML2FILE 25 # -------- 26 #/vis/drawVolume 27 ##/vis/viewer/zoom 2 28 #/vis/viewer/set/viewpointThetaPhi 90 180 deg 29 #/tracking/storeTrajectory 1 30 #/vis/scene/endOfEventAction accumulate 20 #/control/execute vis.mac 31 21 ######################################## 32 22 ### Choose Moon habitat -
trunk/examples/advanced/radioprotection/remsim.cc
r1230 r1313 25 25 // 26 26 // 27 // $Id: remsim.cc,v 1.1 4 2006/07/24 09:53:27 guatelliExp $28 // GEANT4 tag $Name: geant4-09-0 3-cand-01$27 // $Id: remsim.cc,v 1.15 2010/06/06 06:23:52 perl Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-00 $ 29 29 30 30 #include "G4RunManager.hh" … … 100 100 #endif 101 101 102 UI -> ApplyCommand("/control/execute vis.mac");102 UI -> ApplyCommand("/control/execute interactive.mac"); 103 103 session -> SessionStart(); 104 104 delete session; -
trunk/examples/advanced/radioprotection/vehicle1.mac
r807 r1313 21 21 ################ 22 22 ## Visualisation 23 #/vis/scene/create 24 # --- Choose one the following visualisation tools 25 #/vis/open OGLIX 26 #/vis/open DAWNFILE 27 #/vis/open VRML2FILE 28 # -------- 29 #/vis/drawVolume 30 #/vis/viewer/set/viewpointThetaPhi 90 180 deg 31 #/vis/viewer/zoom 2 32 #/tracking/storeTrajectory 1 23 #/control/execute vis.mac 33 24 ################ 34 25 # Geometrical configuration -
trunk/examples/advanced/radioprotection/vehicle2.mac
r807 r1313 19 19 ################ 20 20 ## Visualisation 21 #/vis/scene/create 22 # --- Choose one the following visualisation tools 23 #/vis/open OGLIX 24 #/vis/open DAWNFILE 25 #/vis/open VRML2FILE 26 # -------- 27 #/vis/drawVolume 28 #/vis/viewer/set/viewpointThetaPhi 90 180 deg 29 #/vis/viewer/zoom 2 30 #/tracking/storeTrajectory 1 21 #/control/execute vis.mac 31 22 ################ 32 23 /run/initialize -
trunk/examples/advanced/radioprotection/vis.mac
r807 r1313 1 ############################# 2 ############# Activate physics 3 #### Add e.m. physics 4 /physics/addPhysics photon-epdl 5 /physics/addPhysics electron-eedl 6 /physics/addPhysics positron-standard 7 /physics/addPhysics ion-ICRU 8 #### Add Hadronic Physics, muon physics and decay 9 /physics/addPhysics hadronic-binary 10 /physics/addPhysics muon-standard 11 /physics/addPhysics decay 12 ############################## 13 #### Sets some default verbose 14 /control/verbose 1 15 /run/verbose 1 16 /event/verbose 0 17 /run/initialize 18 ############################## 19 # Geometrical configuration 20 # Choose inflatable vehicle 21 /configuration/choose vehicle 22 # Add 10 cm water shielding 23 /configuration/AddShielding On 24 ################ 25 ## Visualisation 26 /vis/scene/create 27 # --- Choose one the following visualisation tools 28 /vis/open OGLIX 1 # Use this open statement to create an OpenGL view: 2 /vis/open OGL 600x600-0+0 3 # 4 # Use this open statement to create a .prim file suitable for 5 # viewing in DAWN: 29 6 #/vis/open DAWNFILE 7 # 8 # Use this open statement to create a .heprep file suitable for 9 # viewing in HepRApp: 10 #/vis/open HepRepFile 11 # 12 # Use this open statement to create a .wrl file suitable for 13 # viewing in a VRML viewer: 30 14 #/vis/open VRML2FILE 31 # -------- 15 # 16 # Disable auto refresh and quieten vis messages whilst scene and 17 # trajectories are established: 18 /vis/viewer/set/autoRefresh false 19 /vis/verbose errors 20 # 21 # Draw geometry: 32 22 /vis/drawVolume 33 /vis/viewer/set/viewpointThetaPhi 90 180 deg 34 /vis/viewer/zoom 2 35 /tracking/storeTrajectory 1 36 ################ 37 # Define the primary particles 38 # Galactic cosmic protons 39 /gun/data gcr_min_z=1.txt 40 /run/beamOn 10 41 42 43 44 45 46 47 23 # 24 # Specify view angle: 25 /vis/viewer/set/viewpointThetaPhi 90. 180. 26 # 27 # Specify zoom value: 28 /vis/viewer/zoom 2. 29 # 30 # Specify style (surface or wireframe): 31 #/vis/viewer/set/style wireframe 32 # 33 # Draw coordinate axes: 34 #/vis/scene/add/axes 0 0 0 1 m 35 # 36 # Draw smooth trajectories at end of event, showing trajectory points 37 # as markers 2 pixels wide: 38 /vis/scene/add/trajectories smooth 39 /vis/modeling/trajectories/create/drawByCharge 40 /vis/modeling/trajectories/drawByCharge-0/default/setDrawStepPts true 41 /vis/modeling/trajectories/drawByCharge-0/default/setStepPtsSize 2 42 # (if too many tracks cause core dump => /tracking/storeTrajectory 0) 43 # 44 # Draw hits at end of event: 45 #/vis/scene/add/hits 46 # 47 # To draw only gammas: 48 #/vis/filtering/trajectories/create/particleFilter 49 #/vis/filtering/trajectories/particleFilter-0/add gamma 50 # 51 # To invert the above, drawing all particles except gammas, 52 # keep the above two lines but also add: 53 #/vis/filtering/trajectories/particleFilter-0/invert true 54 # 55 # Many other options are available with /vis/modeling and /vis/filtering. 56 # For example, to select colour by particle ID: 57 #/vis/modeling/trajectories/create/drawByParticleID 58 #/vis/modeling/trajectories/drawByParticleID-0/set e- blue 59 # 60 # To superimpose all of the events from a given run: 61 #/vis/scene/endOfEventAction accumulate 62 # 63 # Re-establish auto refreshing and verbosity: 64 /vis/viewer/set/autoRefresh true 65 /vis/verbose warnings 66 # 67 # For file-based drivers, use this to create an empty detector view: 68 #/vis/viewer/flush -
trunk/examples/advanced/underground_physics/DMX.cc
r807 r1313 55 55 #endif 56 56 57 #include "DMXAnalysisManager.hh" 57 58 #include "DMXDetectorConstruction.hh" 58 59 #include "DMXPhysicsList.hh" … … 167 168 168 169 // job termination 170 #ifdef G4ANALYSIS_USE 171 DMXAnalysisManager::getInstance()->Finish(); 172 G4cout << "Analysis files closed" << G4endl; 173 #endif 174 169 175 #ifdef G4VIS_USE 170 176 if(visManager) delete visManager; -
trunk/examples/advanced/underground_physics/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1. 9 2008/06/15 22:39:27 cirroneExp $1 # $Id: GNUmakefile,v 1.10 2010/01/11 16:17:58 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 … … 16 16 endif 17 17 18 ifdef G4ANALYSIS_USE19 CPPFLAGS += -DG4ANALYSIS_USE20 endif21 22 23 18 include $(G4INSTALL)/config/architecture.gmk 24 25 19 26 20 .PHONY: all -
trunk/examples/advanced/underground_physics/History
r1230 r1313 1 1 ------------------------------------------------------------------- 2 $Id: History,v 1. 17 2008/06/15 22:39:27 cirroneExp $2 $Id: History,v 1.22 2010/06/06 06:25:02 perl Exp $ 3 3 ------------------------------------------------------------------- 4 4 … … 9 9 Category History file 10 10 --------------------- 11 12 03.06.2010 - J.Perl (DMX-V09-03-01) 13 Change /vis/open OGLxxx to /vis/open OGL 14 15 16.02.2010 - L. Pandola (DMX-V09-03-00) 16 Copy of the previous tag, DMX-V09-02-02, which was not submitted for 17 testing. 18 19 26.10.2009 - L. Pandola (DMX-V09-02-02) 20 Physics list migrated from LowEnergy processes to the new Livermore 21 models. Physics results unchanged for gamma/e-. Possible differences 22 with ions/protons, since we don't use anymore G4hLowEnergyIonisation 23 24 22.10.2009 - L. Pandola (DMX-V09-02-01) 25 Correct Analysis manager to solve a problem with the HBOOK output files 26 (ntuples not filled, histograms not saved). Still at the stage of 27 pre-migration. 28 29 22.10.2009 - L. Pandola (DMX-V09-02-00) 30 Get rid of a warning message and allocation problems with ntuple2 31 Meant to be the reference to verify the migration to new 32 Livermore models. 33 11 34 16.06.2008 - G.A.P.Cirrone (DMX-V09-01-01) 12 35 Removed AIDA command from GNUmakefile -
trunk/examples/advanced/underground_physics/initInter.mac
r807 r1313 14 14 # Create a scene handler for a specific graphics system 15 15 # (Edit the next line(s) to choose another graphic system) 16 #/vis/open OGLSX 17 #/vis/open OGLIX 18 /vis/open OGLSXm 19 #/vis/open OGLIXm 16 #/vis/open OGL 20 17 #/vis/open DANWFILE 21 18 #/vis/open Xo -
trunk/examples/advanced/xray_fluorescence/GNUmakefile
r1230 r1313 1 # $Id: GNUmakefile,v 1.2 1 2009/03/06 09:45:38 gbarrandExp $1 # $Id: GNUmakefile,v 1.22 2010/01/11 16:18:52 gcosmo Exp $ 2 2 # -------------------------------------------------------------- 3 3 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 9 9 10 10 ifndef G4INSTALL 11 G4INSTALL = ../.. /..11 G4INSTALL = ../.. 12 12 endif 13 13 -
trunk/examples/advanced/xray_fluorescence/History
r1230 r1313 1 # $Id: History,v 1. 9 2009/11/10 16:35:02 manteroExp $1 # $Id: History,v 1.10 2010/06/06 06:25:35 perl Exp $ 2 2 # ------------------------------------------------------------------- 3 # GEANT4 tag $Name: geant4-09-0 3$3 # GEANT4 tag $Name: geant4-09-04-beta-cand-00 $ 4 4 # ------------------------------------------------------------------- 5 5 … … 19 19 * Reverse chronological order (last date on top), please * 20 20 ---------------------------------------------------------- 21 22 03-06-2010 Joseph Perl, Tag: XrayFluo-V09-03-00 23 - Updated vis usage 21 24 22 25 10-11-2009 Alf, Tag: XrayFluo-V09-02-01 -
trunk/examples/advanced/xray_fluorescence/initInter.mac
r1230 r1313 8 8 /control/saveHistory 9 9 /run/verbose 2 10 #11 # create empty scene12 #13 #/vis/scene/create14 #15 # Create a scene handler for a specific graphics system16 # (Edit the next line(s) to choose another graphic system)17 #18 10 19 #/vis/open OGLIX 20 #/vis/open VRML2FILE 21 22 # 23 # draw scene 24 # 25 # 26 #/vis/viewer/flush 27 28 29 # for drawing the tracks 30 # (if too many tracks cause core dump => storeTrajectory 0) 31 32 #/tracking/storeTrajectory 1 33 #/vis/viewer/set/viewpointThetaPhi 60 30 34 35 # this is not to redraw every single event 36 37 #/vis/scene/endOfEventAction accumulate 38 39 40 41 11 #/control/execute vis.mac -
trunk/examples/advanced/xray_telescope/GNUmakefile
r1230 r1313 1 1 # -------------------------------------------------------------- 2 # $Id: GNUmakefile,v 1. 8 2008/06/15 22:53:06 cirroneExp $2 # $Id: GNUmakefile,v 1.9 2010/01/11 16:20:08 gcosmo Exp $ 3 3 # -------------------------------------------------------------- 4 4 # GNUmakefile for examples module. Gabriele Cosmo, 06/04/98. … … 10 10 11 11 ifndef G4INSTALL 12 G4INSTALL = ../.. /..12 G4INSTALL = ../.. 13 13 endif 14 15 G4VIS_USE = 116 14 17 15 include $(G4INSTALL)/config/architecture.gmk … … 21 19 endif 22 20 23 24 21 .PHONY: all 25 22 all: lib bin -
trunk/examples/advanced/xray_telescope/History
r1230 r1313 1 $Id: History,v 1.2 4 2009/11/20 18:18:14 santinExp $1 $Id: History,v 1.25 2010/06/06 06:26:05 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 03.06.2010 Joseph Perl, Tag xraytel-V09-03-00 21 Update vis usage 19 22 20 23 20.11.2009 - G.Santin, tag xraytel-V09-02-00 -
trunk/examples/advanced/xray_telescope/README
r1230 r1313 1 $Id: README,v 1.1 4 2009/11/20 18:08:53 santinExp $1 $Id: README,v 1.15 2010/06/06 06:26:05 perl Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 50 50 XrayTel 51 51 52 execute command "/control/execute xxxxx.mac"52 execute command "/control/execute test.mac" 53 53 54 visualisation macros provided are 55 - opengl.mac for OpenGL display 56 - vrml.mac for VRML display and output file 57 - dawn.mac for dawn display and PS output file 58 59 To execute a run without visualisation use 60 - test.mac 61 54 To enable visualisation, uncomment one line from test.mac: 55 /control/execute vis.mac 62 56 63 57 If the analysis options are set, histograming windows will -
trunk/examples/advanced/xray_telescope/README_stt
r807 r1313 18 18 The job should take ~ 2 minutes on a 1 GHz Linux machine 19 19 20 The memory usage should be around 6 Mbytes. 20 Platforms to be tested on: 21 LINUX 21 22 22 Platforms to be tested on: 23 SUN and LINUX, NOT WINDOWS. 23 NOTE: with the new physics the example does not produce any output (unless it is run with much higher statistics) 24 24 25 At a future date G4ANALYSIS_USE should be set and the AIDA/Anaphe 26 packages tested. 25 G4ANALYSIS_USE requires an AIDA implementation 27 26 In this case 28 27 - computation time ~ 4 minutes 29 - memory usage ~ 18 Mbytes30 28 - the file xraytel.hbook is created (~250 kbytes) 31 29 - this file should be compared to xraytel_ref.hbook 32 30 33 If G4ANALYSIS_USE_PLOTTER is set together with G4ANALYSIS_USE, the34 AIDA/Anaphe plotter (Grace) can be tested in interactive runs.35 36 31 Giovanni Santin 37 e-mail: giovanni.santin@ cern.ch32 e-mail: giovanni.santin@esa.int 38 33 39 34 ******************************************************************************* -
trunk/examples/advanced/xray_telescope/XrayTel.cc
r807 r1313 84 84 #include "XrayTelPhysicsList.hh" 85 85 #include "G4VisExecutive.hh" 86 #include "XrayTelEventAction.hh"87 86 #include "XrayTelRunAction.hh" 88 87 #include "XrayTelSteppingAction.hh" … … 103 102 runManager->SetUserAction(new XrayTelPrimaryGeneratorAction); 104 103 runManager->SetUserAction(new XrayTelRunAction); 105 runManager->SetUserAction(new XrayTelEventAction);106 104 runManager->SetUserAction(new XrayTelSteppingAction); 107 105 -
trunk/examples/advanced/xray_telescope/test.mac
r807 r1313 13 13 /gps/ene/type Mono 14 14 /gps/ene/mono 0.5 MeV 15 16 /control/execute vis.mac 17 15 18 /run/beamOn 1000 16 17 18 -
trunk/examples/advanced/xray_telescope/test.out
r807 r1313 1 1 ********************************************** 2 Geant4 version $Name: $2 Geant4 version $Name: geant4-09-04-beta-cand-00 $ 3 3 (19-May-2003) 4 4 Copyright : Geant4 Collaboration
Note:
See TracChangeset
for help on using the changeset viewer.
