Warning, /geant4/examples/extended/exoticphysics/saxs/README is written in an unsupported language. File is not indexed.
0001
0002 =========================================================
0003 Geant4 - an Object-Oriented Toolkit for Simulation in HEP
0004 =========================================================
0005
0006 Extended Example saxs
0007 --------------------
0008
0009 The example saxs implements the typical setup of a Small Angle X-ray
0010 Scattering (SAXS) experiment. It is meant to illustrate the
0011 usage of molecular interference (MI) of Rayleigh (coherent) scattering
0012 of photons inside the matter, which is implemented in the
0013 G4PenelopeRayleighModelMI model.
0014
0015 1- GEOMETRY
0016
0017 The setup consists of a phantom/sample under investigation, slits
0018 to collimate the photon beam and a shielded detector to collect
0019 the photons scattered by the phantom (see SAXSDetectorConstruction).
0020
0021 The geometry is scalable through the interactive commands defined
0022 in the SAXSDetectorConstructionMessenger class. All the significant
0023 quantities, such as the setup (scattering) rotation angle, the position
0024 and size of all the volumes, as well as the phantom material can be
0025 set via macro commands.
0026
0027 Two macro files come with this example: saxs.in and saxs_slits.in.
0028
0029 In the saxs.in macro, the phantom is a cylinder with a diameter and
0030 a height of 10 mm made of a mixture of 80% fat and 20% water.
0031 In general, if the argument of /det/setPhantomMaterial command is 2,
0032 as in this case, the material is a biological tissue ("MedMat")
0033 defined as a mixture of fat, water, collagen and hydroxyapatite.
0034 The weight fraction of the mixture components can be set through commands
0035 /det/setComp0, /det/setComp1, /det/setComp2, /det/setComp3, respectively.
0036 The tissue form factor (including MI) is automatically calculated as a
0037 weighed sum of the form factors of the basis components.
0038 In this case, no slits are foreseen and the sensitive detector
0039 positioned 400 mm downstream of the phantom collects all the photons
0040 transmitted and scattered by the phantom, which is irradiated
0041 by a pencil beam with an energy of 20 keV.
0042
0043 In the saxs_slits.in macro, the phantom is again a cylinder with a
0044 diameter and a height of 10 mm. The phantom is made of a custom
0045 material ("CustomMat") whose density and composition is set through
0046 /det/setCustomMatDensity and /det/setCustomMatHmassfract,
0047 /det/setCustomMatNmassfract, /det/setCustomMatOmassfract commands,
0048 respectively. In general, a custom material can be defined by
0049 specifying the mass fraction of H, C, N, O, Na, P, S, Cl, K, and Ca via
0050 commands analogous to those mentioned above. In this case, the material
0051 composition corresponds to that of ammonium nitrate (NH4NO3).
0052 For a custom material, the user can provide the path of the file with
0053 the material form factor (with MI) through the /det/SetCustomMatFF
0054 command. As an example, the file myFF.dat contains the form factor of
0055 NH4NO3 measured by Harding in 1999.
0056 In this case the slits upstream and downstream the phantom
0057 are present. This setup is suitable for both monochromatic and
0058 polychromatic beams. To speed-up the simulation, a monochromatic
0059 photon beam was chosen, but a polychromatic beam can be easily defined.
0060
0061 2- PHYSICS
0062
0063 In this example, only electromagnetic processes and decays are considered.
0064 They are defined in a custom physics list that allows the user to
0065 choose among various EM PhysicsList constructors. In particular,
0066 by choosing G4EmPenelopePhysicsMI and setting fUseMIFlag as true,
0067 it is possible to enable the molecular interference effects. This
0068 is the default configuration.
0069
0070 3- ACTION INITALIZATION
0071
0072 SAXSActionInitialization class instantiates and registers to
0073 Geant4 kernel all user action classes. While in sequential mode
0074 the action classes are instatiated just once, by invoking the
0075 method: SAXSActionInitialization::Build(),
0076 in multi-threading mode the same method is invoked for each thread
0077 worker and so all user action classes are defined thread-local.
0078
0079 A run action class is instantiated both thread-local and global.
0080 That's why its instance is created also in the method
0081 SAXSActionInitialization::BuildForMaster(), which is
0082 invoked only in multi-threading mode.
0083
0084 4- PRIMARY GENERATOR
0085
0086 The primary generator action class employs the G4GeneralParticleSource (GPS)
0087 generator. The primary beam has to be defined via the G4 built-in
0088 commands of the G4GeneralParticleSource in a input macro file.
0089 In particular, a photon beam directed toward the phantom must be defined
0090 to test the MI effects. The X-ray beam can be monochromatic or
0091 polychromatic, parallel or divergent.
0092
0093 5- EVENT AND DETECTOR RESPONSE
0094
0095 An event consists of the generation of a single particle which is
0096 transported through the phantom and then to the sensitive detector.
0097
0098 The interactions of the photons inside the phantom, and in particular,
0099 the scattering events, are scored in a dedicated ntuple through the
0100 SAXSSteppingAction class.
0101
0102 The hits of the particles on the sensitive detector positioned
0103 downstream of the phantom (SAXSSensitiveDetectorHit) are recorded
0104 in a dedicated ntuple through the SAXSSensitiveDetector class.
0105
0106 6- ANALYSIS:
0107
0108 The analysis tools are used to accumulate statistics.
0109 ntuple are created in SAXSRunAction::SAXSRunAction()
0110 constructor for the following quantities:
0111
0112 Ntuple1 (part) - Particles impinging on the Sensitive Detector (SD):
0113 - energy of the particles
0114 - position of the hits
0115 - momentum of the particles
0116 - time of the hits
0117 - type of impinging particles
0118 - ID number of the impinging particles
0119 - number of scattering events a primary had before hitting the SD
0120 - event number of the hits
0121
0122 Ntuple2 (scatt) - Interactions of photons inside the phantom:
0123 - ID of the process occurred
0124 (0-> transportation, 1->Rayleigh, 2->Compton, 3->Photoelectic)
0125 - initial energy of the particles
0126 - scattering angle
0127
0128 The ntuples are saved in the output file in the Root format.
0129
0130 When running in multi-threading mode, the ntuples accumulated
0131 on threads are automatically merged in a single output file.
0132
0133 The default output format is root. Two root scripts come with
0134 this example to analyze the output file: scattAnalysis.C and
0135 ADXRD.C. The first can be used to analyze the scatt ntuple, while
0136 the second can be used for part ntuple.
0137
0138 7- HOW TO RUN
0139
0140 - Execute saxs in the 'interactive mode' with visualization:
0141 % ./saxs
0142 and type in the commands line by line:
0143 Idle> /control/verbose 2
0144 Idle> /tracking/verbose 1
0145 Idle> ...
0146 Idle> /run/beamOn 10
0147 Idle> ...
0148 Idle> exit
0149 or it is possible to run a macro file (test.in is a simple macro where the
0150 primary beam is defined through the usual GPS commands):
0151 Idle> /control/execute test.in
0152 Idle> /run/beamOn 10
0153 ....
0154 Idle> exit
0155
0156 - Execute saxs in the 'batch' mode from macro files
0157 (without visualization)
0158 % ./saxs saxs.in [Ncores]
0159 % ./saxs saxs_slits.in [Ncores]
0160 Ncores (optional argument) is the number of threads the user wants to use in
0161 MT mode.
0162
0163
0164 The following paragraphs are common to all basic examples
0165
0166 A- VISUALISATION
0167
0168 The visualization manager is set via the G4VisExecutive class
0169 in the main() function in saxs.cc.
0170 The initialisation of the drawing is done via a set of /vis/ commands
0171 in the macro vis.mac. This macro is automatically read from
0172 the main function when the example is used in interactive running mode.
0173
0174 By default, vis.mac opens an OpenGL viewer (/vis/open OGL).
0175 The user can change the initial viewer by commenting out this line
0176 and instead uncommenting one of the other /vis/open statements, such as
0177 HepRepFile or DAWNFILE (which produce files that can be viewed with the
0178 HepRApp and DAWN viewers, respectively). Note that one can always
0179 open new viewers at any time from the command line. For example, if
0180 you already have a view in, say, an OpenGL window with a name
0181 "viewer-0", then
0182 /vis/open DAWNFILE
0183 then to get the same view
0184 /vis/viewer/copyView viewer-0
0185 or to get the same view *plus* scene-modifications
0186 /vis/viewer/set/all viewer-0
0187 then to see the result
0188 /vis/viewer/flush
0189
0190 The DAWNFILE, HepRepFile drivers are always available
0191 (since they require no external libraries), but the OGL driver requires
0192 that the Geant4 libraries have been built with the OpenGL option.
0193
0194 vis.mac has additional commands that demonstrate additional functionality
0195 of the vis system, such as displaying text, axes, scales, date, logo and
0196 shows how to change viewpoint and style.
0197 To see even more commands use help or ls or browse the available UI commands
0198 in the Application Developers Guide.
0199
0200 For more information on visualization, including information on how to
0201 install and run DAWN, OpenGL and HepRApp, see the visualization tutorials,
0202 for example,
0203 http://geant4.slac.stanford.edu/Presentations/vis/G4[VIS]Tutorial/G4[VIS]Tutorial.html
0204 (where [VIS] can be replaced by DAWN, OpenGL and HepRApp)
0205
0206 The tracks are automatically drawn at the end of each event, accumulated
0207 for all events and erased at the beginning of the next run.
0208
0209 B- USER INTERFACES
0210
0211 The user command interface is set via the G4UIExecutive class
0212 in the main() function in saxs.cc
0213 The selection of the user command interface is then done automatically
0214 according to the Geant4 configuration or it can be done explicitly via
0215 the third argument of the G4UIExecutive constructor (see exampleB4a.cc).
0216
0217