Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/biasing/ReverseMC01/

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Name Size       Last modified (GMT) Description
Back Parent directory       2024-12-05 15:16:16
Folder include/       2024-12-05 15:16:16
Folder src/       2024-12-05 15:16:16
File CMakeLists.txt 2471 bytes       2024-12-05 15:16:16
File GNUmakefile 367 bytes       2024-12-05 15:16:16
File History 7702 bytes       2024-12-05 15:16:16
File README 28536 bytes       2024-12-05 15:16:16
C++ file exampleRMC01.cc 4801 bytes       2024-12-05 15:16:16
File run_adjoint_simulation_electron.mac 1648 bytes       2024-12-05 15:16:16
File run_adjoint_simulation_electron.out 14667 bytes       2024-12-05 15:16:16
File run_adjoint_simulation_proton.mac 1520 bytes       2024-12-05 15:16:16
File run_forward_simulation_electron.mac 1167 bytes       2024-12-05 15:16:16
File run_forward_simulation_proton.mac 1171 bytes       2024-12-05 15:16:16
File vis.mac 3332 bytes       2024-12-05 15:16:16

  1     Example1 for Reverse Monte Carlo
  2     --------------------------------
  3 
  4 
  5 Author
  6 ------
  7 This example code and the adjoint classes in the G4 toolkit  have been developed by L.Desorgher (SpaceIT GmbH)
  8 under the ESA contract 21435/08/NL/AT. For any (reasonable) question  you may contact the author 
  9 at the following email address : desorgher@spaceit.ch 
 10 
 11 
 12 Abstract
 13 --------
 14 This is the README file for the first G4 example illustrating the use of the Reverse Monte Carlo (RMC) mode in a Geant4 
 15 application. The  Reverse Monte Carlo method is also known as the Adjoint Monte Carlo (AMC) method  and 
 16 in this document we will alternate both Reverse and Adjoint terms.
 17 
 18 Other documentation
 19 -------------------
 20 See also the section 3.7.3 Adjoint/Reverse Monte carlo in the 
 21 Geant4 User guide for application developers.
 22 
 23 
 24 Table of Contents:
 25 -----------------
 26 
 27 1.Definition of Reverse/Adjoint Monte Carlo 
 28 
 29 2.The Reverse Monte Carlo mode in Geant4 (since G4.9.3 release)
 30   2.1. Reverse tracking phase
 31   2.2. Forward tracking phase
 32   2.3. Reverse processes
 33   2.4. Remark on Nb of adjoint particle types and G4 events considered in an adjoint simulation
 34   2.5. Modifications to bring in a existing G4 application to use the Reverse MC method
 35 
 36 3.exampleRMC01
 37   3.1. Geometry
 38   3.2. Physics
 39   3.3. Analysis and output of the code
 40   3.4. Run macrofiles
 41   3.5. Comparison of adjoint and forward simulation results. Normalization! 
 42 
 43 4.Control of the adjoint simulation and the RMC01 code by G4 macro UI commands
 44   4.1. G4UI commands in the directory /adjoint
 45   4.2.  G4UI commands in the directory /adjoint_physics
 46   4.3.  G4UI commands in the directory  /RMC01
 47 
 48 5. Known issues
 49   5.1. Rare too high weight in the adjoint simulation
 50   5.2. Limitation of the reverse bremsstrahlung
 51   5.3.Limitation of the reverse multiple scattering
 52 
 53 
 54 
 55 1. Definition of Reverse/Adjoint Monte Carlo 
 56 -----------------------------------------
 57 -----------------------------------------
 58 When the sensitive part of a detector is small compared  to its entire size and to the size  of the
 59 external extended primary particle source,  a lot of computing time is spent during a normal Monte Carlo run 
 60 in the simulation of  particle showers that are not contributing to the detector signal.  
 61 In such particular case the Reverse Monte Carlo (RMC) method, also known as the 
 62 Adjoint Monte Carlo method, can be used. 
 63 In this method  particles are generated  in or on the external surface of the sensitive  volume 
 64 of the instrument and then are tracked backward in the geometry till they reach  the source surface, 
 65 or exceed an energy threshold. During the reverse tracking reverse reactions are applied to the particles.
 66 
 67 
 68 
 69 2. The Reverse Monte Carlo mode in Geant4 (since G4.9.3 release)
 70 ----------------------------------------------------------------
 71 ----------------------------------------------------------------
 72 (See also the section 3.7.3 Adjoint/Reverse Monte carlo in the 
 73 Geant4 User guide for application developers.)
 74 
 75 Different G4Adjoint classes have been implemented into the Geant4 
 76 toolkit to run an adjoint/reverse simulation in a Geant4 application.
 77 In this implementation an adjoint run is divided in a succession 
 78 of alternative adjoint and forward tracking  of adjoint and normal particles.
 79 One Geant4 event treats the reverse tracking of an adjoint primary particle 
 80 and its secondaries, and the forward tracking of a primary particle euqivalent 
 81 to the adjoint primary as well as its secondaries.
 82 
 83 
 84 2.1. Reverse tracking phase:
 85 -------------------------
 86 
 87 Adjoint particles (adjoint_e-, adjoint_gamma,...) are generated one by one on the so called
 88 adjoint source with random position, energy (1/E distribution) and direction. The adjoint
 89 source is the external surface of a user defined volume or of a user defined sphere. The 
 90 adjoint source should contain one or several sensitive volumes and should be small 
 91 compared to the entire geometry. The user can set the minimum and maximum energy of the 
 92 adjoint source. After its generation the adjoint primary particle is tracked backward in
 93 the geometry till a user defined external surface (spherical or boundary of a volume) 
 94 or is killed before if it reaches a user defined upper energy limit that represents the
 95 maximum energy of the external source. During the reverse tracking, reverse processes take 
 96 place where the adjoint particle being tracked can be either scattered or transformed in 
 97 another type of adjoint particle. During the reverse tracking the 
 98 G4AdjointSimulationManager replaces the user defined primary, run, stepping, ... actions, 
 99 by its own actions.
100 
101 2.2. Forward tracking phase:
102 --------------------------
103 
104 When an adjoint particle reaches the external surface its weight, type,  position, 
105 and direction are registered and a  normal primary particle with a type equivalent 
106 to the last generated adjoint primary is generated with the same energy, 
107 position but opposite direction  and is  tracked in the forward direction 
108 in the sensitive region as in a forward MC simulation. 
109 During this forward tracking phase the  event, stacking, stepping, tracking actions defined 
110 by the user for its general forward application are used. 
111 By this clear separation between adjoint and forward tracking phases, the code of the 
112 user developed for a forward simulation should be only slightly 
113 modified to adapt it for an adjoint simulation. Indeed  the computation of the signal 
114 is done by the same user actions or analysis classes that the one used in the forward 
115 simulation mode. Before the G4.10.0 release the reverse and forward tracking mode 
116 took place  in separated  events. Since the G4.10.0 release, 
117 in order to prepare to  the migration of the 
118 ReverseMC to the G4 Multiple Threading mode, the reverse and forward tracking
119 phase of corresponding adjoint and forward primaries have been merged in the same 
120 event.
121 
122 
123 2.3. Reverse Processes:
124 ---------------------
125 
126 During the reverse tracking phase reverse processes act on the adjoint particles.
127 The Reverse processes that  are available at the moment in Geant4 are the:
128   - Reverse discrete  Ionization for e-, proton and ions
129   - Continuous gain of energy by ionization and bremsstrahlung for e- and by ionization for protons and ions
130   - Reverse discrete e- bremsstrahlung  
131   - Reverse photoelectric effect 
132   - Reverse Compton scattering
133   - Approximated multiple scattering (MS) (see section 5.3)
134 
135 For the gamma reverse physics an adjoint gamma reverse forced interaction process has been implemented 
136 since GEANT4.10.3. THis process splits a new created gamma in two tracks.
137 The first tracks is used to force a free flight of the adjoint gamma through the geometry.
138 The second track is used to force a reverse bremsstrahlung or a reverse compton at some random
139 position along the free flight track.
140     
141 It is important to note that the electromagnetic reverse processes are cut dependent 
142 as their equivalent forward processes. The implementation of the reverse processes is
143  based on the forward processes
144 implemented in the G4 standard electromagnetic package.        
145 
146 
147 2.4. Remark on Nb of adjoint particle types and  Nb of G4 events considered in an adjoint simulation:
148 ---------------------------------------------------------------------------------
149 
150 The list of type of adjoint and forward particles that are generated on the adjoint source
151 and considered in the simulation is a function of the adjoint processes declared in the 
152 physics list. For example if only the e- and gamma electromagnetic processes are considered
153 , only adjoint e- and adjoint gamma will be considered as primaries. In this case an 
154 adjoint event will be divided in two G4 events. The first event will  consist 
155 into  the coupled  reverse and forward  tracking of an adjoint e- and its equivalent 
156 forward e-, while the second events will process the reverse and forward trackings
157 of corresponsing adjoint and forward primary gammas. In this case a 
158 run of 100 adjoint events will consist into 200 Geant4 events. If the proton ionization is
159 also considered adjoint and forward protons  are also generated as primaries 
160 and 300 Geant4 events are processed for 100 adjoint events.
161 
162 2.5. Modifications to bring in a existing G4 application to use the Reverse MC method
163 --------------------------------------------------------------------------------
164 (for more details see also the section 3.7.3 Adjoint/Reverse Monte carlo in the 
165 Geant4 User guide for application developers.)
166 
167 Due the clear separation  between the reverse and forward  tracking  phase  only few modifications are needed 
168 to an existing  Geant4 application in order to adapt it for the use of the reverse simulation mode.
169 Except in the physics list where all the reverse processes and their forward equivalent 
170 have to be declared, the principal code modifications  are needed only in the analysis phase at the end 
171 of the forward tracking where computed signals have to be multiplied by the weight 
172 of the reverse tracks that have reached the external surface of the simulatrion 
173 and then normalized to different user defined spectra and angular distribution representing 
174 the external source.
175 The weight of the adjoint tracks is computed by the G4Adjoint classes and the user needs
176 only to multiply them to the primary differential, directional spectrum of its choice. 
177 The adjoint weight a the end  of tracks can be also registered if needed in answer matrices.
178  
179 More precisely, in order to be able to use the Reverse MC method in his simulation, the user should modify 
180 its code as such:
181   
182   - Adapt its physics list to use Reverse Processes for adjoint particles. An example of such physics list is provided in an extended 
183     example. 
184   - Create an instance of    G4AdjointSimManager somewhere in the main code.
185   
186   - Modify the analysis part of the code to normalize the signal computed during the forward phase to the weight 
187          of adjoint particle that reached the external surface during the last tracking phase.
188          This is done by using the following method of G4AdjointSimManager.
189       size_t GetNbOfAdointTracksReachingTheExternalSurface()     
190       G4int GetIDOfLastAdjParticleReachingExtSource(size_t i)            
191         G4ThreeVector GetPositionAtEndOfLastAdjointTrack(size_t i)
192       G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(size_t i)
193       G4double GetEkinAtEndOfLastAdjointTrack(size_t i)
194       G4double GetEkinNucAtEndOfLastAdjointTrack(size_t i)
195       G4double GetWeightAtEndOfLastAdjointTrack(size_t i)
196             G4double GetCosthAtEndOfLastAdjointTrack(size_t i)
197         G4String GetFwdParticleNameAtEndOfLastAdjointTrack(size_t i)
198         G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(size_t i)
199             G4int GetFwdParticleIndexAtEndOfLastAdjointTrack(size_t i).
200     Since the version Geant4.10.3 several adjoint tracks can arrive on the external surface during the same events.
201     It is therefore important to loop over alll these tracks when normalizing the weights at the end of the event. 
202     The method GetNbOfAdointTracksReachingTheExternalSurface() returns the number of adjoint tracks that reached the 
203     external surface. Ine the other methods the input parameter i allows to get the information of the ith track.
204 
205     In order to have a code working for both forward and adjoint simulation mode, the extra code needed in user actions for the adjoint
206     simulation mode can be separated to the code needed only for the normal forward  simulation by using the following method
207                
208      G4bool GetAdjointSimMode() that return true if an adjoint simulation is running and false if not!
209 
210 
211 
212 3. exampleRMC01
213 ---------------
214 ---------------
215 The example RMC01 illustrates how to modify a G4 application in order to use 
216 both forward and reverse MC modes in the same code.
217      
218   
219 3.1. Geometry:
220 -------------- 
221  
222 The following simple geometry is considered:
223    - sensitive Silicon cylinder at the center of an Aluminum spherical shielding with 10 cm  Radius.
224    - two 0.5mm thick Tantalum plates set horizontally above and below the Sensitive Cylinder 
225 
226 The free parameters of the geometry that can bes set by the user are:
227    - the thickness of the Aluminum shielding  
228    - the height of the sensitive Si cylinder
229    - the radius of the sensitive Si cylinder
230       
231  
232 
233 3.2. Physics:
234 -------------
235 
236 The physical processes considered  are:
237   - Reverse and forward discrete  Ionization for e- and  proton 
238   - Continuous gain and loss of energy by ionization and bremsstrahlung for e- and by ionization for protons 
239   - Reverse and forward discrete e- bremsstrahlung  
240   - Reverse and forward photoelectric effect 
241   - Reverse and forward Compton scattering
242   - Reverse and forward Multiple scattering
243 
244 These processes are implemented in the class G4AdjointPhysicsList distributed with the example. The G4AdjointPhysicsMessenger allows the user
245 to switch on/off some processes for testing purpose. By default all processes cited above are considered except the proton ionization that
246 has to be specifically switch on in the macro file by the user.
247 
248 
249 
250 3.3. Analysis and output of the code:
251 ----------------------------------
252 
253 The example computes the energy deposited in the sensitive Si cylinder and the current of e-, protons, and gamma 
254 entering this cylinder.
255 The Hits are registered in the sensitive detector class RMC01SD that is a typical G4 sensitive detector class 
256 used in a forward simulation and is not modified at all
257 for the adjoint simulation mode. 
258 The analysis of the registered hits during forward events is done by the RMCO1AnalysisManager.
259 That is the class that illustrates how to adapt an analysis code of a fwd simulation in order to use it also for 
260 an adjoint simulation.
261 In this class during a forward simulation the  method EndOfEventForForwardSimulation is used at the end of an event 
262 while during an adjoint simulation at the end of fwd tracking event the method EndOfEventForAdjointSimulation is called.
263 By looking at the source of RMCO1AnalysisManager and more particularly to its method EndOfEventForAdjointSimulation the user will
264 learn how to adapt its G4 analysis code for an adjoint simulation.
265 
266 The outputs of an adjoint simulation are:
267 
268   -The total energy deposited and particle current entering the sensitive cylinder normalized 
269    automatically to a user defined primary spectrum(exponential or power law) .
270    These results are stored in the files:
271     -Adj_Edep_vs_EkinPrim.txt                            
272     -Adj_ElectronCurrent.txt
273     -Adj_GammaCurrent.txt
274     -Adj_ProtonCurrent.txt
275     -ConvergenceOfAdjointSimulationResults.txt: 
276         The total normalized edep and its relative error registered every 5000 adjoint events
277     
278     
279   -The answer matrix of the energy deposited and particles current on the sensitive cylinder in function of primary energy of e-, gamma and
280   protons. These results are stored in the files Adj********_Answer.txt
281         
282      
283   
284 The outputs of a forward simulation are:   
285   -The mean energy deposited and particle current entering the sensitive cylinder per event.
286    These results are stored in the files:
287     -Fwd_Edep_vs_EkinPrim.txt                            
288     -Fwd_ElectronCurrent.txt
289     -Fwd_GammaCurrent.txt
290     -Fwd_ProtonCurrent.txt
291     -ConvergenceOfAdjointSimulationResults.txt: The total normalized edep and its relative error registered every 5000 adjoint events
292     
293  
294 
295 3.4. Run macrofiles:
296 ------------------
297 The following example run macro files are distributed with the code:
298   
299   -run_adjoint_simulation_electron.mac and  run_adjoint_simulation_proton.mac for adjoint simulations 
300   
301   -run_forward_simulation_electron.mac  and run_forward_simulation_proton.mac for forward simulations
302   
303 
304 3.5. Comparison of adjoint and forward simulation results:
305 ----------------------------------------------------------
306 It is the responsibility of the user to select in the macro file the same external spectrum 
307 for both the forward and adjoint simulations  and to normalize the per event results of the forward simulation 
308 to the fluence considered in the adjoint  simulation. 
309 
310 For the macro files that are provided  with the examples it consists into multiplying  the forward results by pi*100.
311 This normalization factor is explained by the following:
312   
313   -For the forward simulation the results are given  per number of events. It corresponds  
314   to a normalization to a  fluence of 1 particle emanating from the external source. 
315   
316   -In run_fwd_simulation.mac the source is set on a sphere of 10 cm radius (see /gps commands in
317    macrofile).Therefore the omnidirectional  fluence for the fwd simulation  is 1./(pi*R^2) with R=10cm. 
318   
319   -The adjoint results  are normalized to a fluence of 1/cm2.
320       (See command /RMC01/analysis/SetExponentialSpectrumForAdjointSim in macrofile)
321   
322   -In conclusion to compare the adjoint and forward results, the forward results should
323       be multiplied by pi*R^2/cm2= pi*100.
324 
325 
326 
327 4. Control of the adjoint simulation and the RMC01 code by G4 macro UI commands:
328 -------------------------------------------------------------------------
329 Different G4 macro UI commands are provided to control the RMC01 example and the adjoint simulation.
330 Some macro commands are provided within the geant4 toolkit and appears in a G4 application when the singleton 
331 class G4AdjointSimManager is called somewhere in the code, the other macro commands are 
332 declared in the code  distributed within the example.
333 
334 
335 4.1. G4UI commands in the directory /adjoint
336 ----------------------------------------------- 
337 The macro commands in the directory /adjoint appears in a user application when the singleton 
338 class G4AdjointSimManager is called somewhere in the code. 
339 It allows to control the adjoint source, the external source and start an adjoint simulation.
340 
341 The command to start an adjoint  run is:
342 
343 -/adjoint/start_run nb
344   Start an adjoint simulation with a number of events given by nb. It is important to note that the total number of events in the sense of G4 
345   will be nb*2*nb_primary_considered (see  3.4.)
346   
347 
348 The commands to control the adjoint source are:
349 
350 -/adjoint/DefineSphericalAdjSource R X Y Z unit_length
351   The adjoint source is set on a sphere with radius R and centered on position (X,Y,Z) 
352          
353 -/adjoint/DefineSphericalAdjSourceCenteredOnAVolume phys_vol_name R unit_length
354   The external source is set on a sphere with radius R and with its center position located at the center of the 
355   the physical volume specified by the name phys_vol_name.
356 -/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume phys_vol_name 
357   The external surface is set as the external boundary of a the physical volume with name phys_vol_name
358       
359 -/adjoint/SetAdjSourceEmin  Emin energy_unit 
360   Set the minimum  energy of the external source
361     
362 -/adjoint/SetAdjSourceEmax  Emax energy_unit 
363   Set the maximum  energy of the external source
364       
365 -/adjoint/ConsiderAsPrimary  particle_name 
366   The type  of particle specified by  "particle_name" will be added in the list of primary adjoint particles. 
367   The list of candidates depends on the reverse physics processes considered in the simulation. At the most the 
368   potential candidates are (e-, gamma, proton , ion). For this example only e-, gamma, proton
369   can be chosen. As the proton ionization is not considered by default, the default list of particles is
370   [e-,gamma]. To have also the proton as candidate the proton ionization should 
371   be switch on (/adjoint_physics/UseProtonIonisation true).
372 
373 -/adjoint/NeglectAsPrimary  particle_name 
374   The type  of particle specified by  "particle_name" will be removed from the list of primary adjoint particles. 
375   The list of candidates depends on the reverse physics processes considered in the simulation. At the most the 
376   potential candidates are (e-, gamma, proton , ion). For this example only e-, gamma, proton
377   can be chosen. As the proton ionization is not considered by default, the default list of particles is
378   [e-,gamma].To have also the proton as candidate the proton ionization should 
379   be switch on (/adjoint_physics/UseProtonIonisation true). 
380     
381 
382 The commands to control the external source are:
383 
384 -/adjoint/DefineSphericalExtSource R X Y Z unit_length:
385   The external source is set on a sphere with radius R and centered on position (X,Y,Z) 
386          
387 -/adjoint/DefineSphericalExtSourceCenteredOnAVolume phys_vol_name R unit_length
388   The external source is set on a sphere with radius R and with its center position located at the center of the 
389   the physical volume specified by the name phys_vol_name.
390 
391 -/adjoint/DefineExtSourceOnExtSurfaceOfAVolume phys_vol_name 
392   The external surface is set as the external boundary of a the physical volume with name phys_vol_name
393 
394 -/adjoint/SetExtSourceEmax  Emax energy_unit 
395   Set the maximum  energy of the external source. An adjoint track will be stop when a an adjoint particle get an energy higher than this maximum energy.
396   
397 
398 
399 4.2. G4UI commands in the directory /adjoint_physics
400 ------------------------------------------------------
401 These commands allow to control the electromagnetic processes that will be considered in the simulation.
402 
403 The processes that can be used are:
404   -Reverse and forward e- continuous and discrete  Ionization. Always switch on
405   -Reverse and forward e- Bremsstrahlung. Switch on by default
406   -Reverse and forward Compton scattering. Switch on by default
407   -Reverse and forward photo electric effect. Switch on by default
408   -Reverse and forward photo electric effect. Switch on by default
409   -Reverse and forward multiple scattering. Switch on by default
410   -Reverse and forward proton continuous and discrete  Ionization. Switch off by default  
411   -Forward e-e+ pair production. Switch off by default. 
412    If switch all the e+ electromagnetic physics is considered.  
413 
414 
415 The commands that can be used to switch on of these processes are:
416 
417 /adjoint_physics/UseProtonIonisation true/false
418    -Switch on/off the reverse and forward proton ionization. Off by default. 
419 
420 /adjoint_physics/UseBremsstrahlung true/false
421    -Switch on/off the reverse and forward e- bremsstrahlung. On by default. 
422 
423 /adjoint_physics/UseCompton true/false
424    -Switch on/off the Compton scattering. On by default.  
425 
426 
427 /adjoint_physics/UseMS true/false
428    -Switch on/off the multiple scattering. On by default.
429    
430 
431 /adjoint_physics/UseEgainElossFluctuation true/false 
432    -Switch on/off the fluctuation in the continuous energy loss/gain.   On by default. Only for test purpose.   
433 
434 /adjoint_physics/UsePEEffect true/false
435    -Switch on/off the photo electric effect. On by default. 
436 
437 
438 /adjoint_physics/UseGammaConversion true/false
439    -Switch on/off the forward e-e+ pair production from gamma. Off by default. When On all the e+
440    electromagnetic physics is considered.
441    
442    
443 The user can also fix the maximum energy Emax and minimum energy Emin of the adjoint physical processes used 
444 in the simulation. The adjoint process will be applied to particles within the energy range [Emin, Emax] 
445 and will produce adjoint secondary only in this energy range. It is recommended to fix Emin to the minimum
446 energy  of the adjoint source and fix Emax to the maximum energy of the external source.  
447 The commands controlling Emin and Emax are:
448 
449 /adjoint_physics/SetEminForAdjointModels Emin Energy_unit
450   -Set the minimum energy of the adjoint processes/models.
451   
452 /adjoint_physics/SetEmaxForAdjointModels Emin Energy_unit
453   -Set the maximum energy of the adjoint processes/models.
454  
455    
456 4.3. G4UI commands in the directory  /RMC01
457 ----------------------------------------------
458 
459 Commands/RMC01/geometry/  to control the geometry:
460 
461 /RMC01/geometry/SetSensitiveVolumeHeight H length_unit
462   Set the height H of the Si sensitive cylinder.
463   
464 
465 /RMC01/geometry/SetSensitiveVolumeRadius R length_unit
466   Set the radius R of the Si sensitive cylinder.  
467 
468 /RMC01/geometry/SetShieldingThickness    D length_unit
469   Set the thickness D of the aluminum shielding.
470    
471 Commands /RMC01/analysis/ to control the primary spectrum used for the normalization of the 
472 adjoint simulation results and fix the expected precision of the computed Edep:
473 
474 /RMC01/analysis/SetPowerLawPrimSpectrumForAdjointSim particle_name F F_unit alpha Emin Emax E_unit
475   Set the primary spectrum to which the adjoint simulation results will be normalised to a power law
476   spectrum E^(-alpha) of particle defined by    particle_name, with an omnidirectional fluence F, and
477   energy range [Emin,Emax]. The fluence unit candidates for F_unit  are [1/cm2, 1/m2, cm-2, m-2]. 
478    
479    
480 /RMC01/analysis/SetExponentialSpectrumForAdjointSim particle_name F F_unit E0 Emin Emax E_unit
481   Set the primary spectrum to which the adjoint simulation results will be normalised to an exponential
482   spectrum exp(-E/E0) of particle defined by    particle_name, with an omnidirectional fluence F, and
483   energy range [Emin,Emax]. The fluence unit candidates for F_unit  are [1/cm2, 1/m2, cm-2, m-2]. 
484       
485 
486  
487 /RMC01/analysis/SetExpectedPrecisionOfResults precision
488   Set the expected precision in % for the computed energy deposited in the sensitive volume 
489   for both the forward and adjoint simulation case. When the relative statistical error 
490   of the  computed energy deposited reach this precision the run is aborted and the results are registered.
491   Otherwise the run continue till the nb of events specified by the user are processed. By default the precision is set
492   to 0. meaning that the run will not be aborted in this case. 
493     
494   
495 
496 
497 
498 
499 5. Known issues
500 --------------------------------
501 --------------------------------
502 
503 5.1 Rare too high weight in the adjoint simulation
504 ---------------------------------------------------
505 
506 In rare cases an adjoint track may get a much too high weight when  reaching the external source.
507 While this happen not often it may corrupt the simulation results significantly. The reason  of this high weight is 
508 the joint use at low e- and gamma  energy of both  the photoelectric and bremsstrahlung processes.
509 Unfortunately we still need some investigations to remove this problem  at the level of physical processes. 
510 However  this problem can be solved  at the level of event action in the user code by adding a test on the adjoint 
511 weight. Such test has been implemented in the example RMC01. 
512 In this implementation  an event is rejected when the relative error of the computed  normalised edep 
513 increase during one event by more than 50% when the precision  is already below 10%.
514  
515 
516 5.2 Limitation of the reverse bremsstrahlung
517 -------------------------------------------
518 The difference between the differential cross sections used in the adjoint and forward bremsstrahlung 
519  models is the source of a higher flux of >100 keV gamma in the reverse simulation compared to the forward simulation.
520 The adjoint processes/models should make use of the direct differential cross section to sample
521  the adjoint  secondaries and compute the adjoint cross section.
522 The differential cross section used in G4AdjointeBremstrahlungModel  is obtained by the numerical derivation
523 over the cut energy of the direct cross section provided  by G4eBremsstrahlungModel. 
524 This would be a correct procedure if the  distribution of secondary in   G4eBremsstrahlungModel  
525 would match this differential cross section. Unfortunately it is not the case as independent  parameterization are used 
526  in   G4eBremsstrahlungModel  for both the cross sections and the sample of secondary. (It means that in the forward case 
527  if one would integrate the effective differential cross section considered  in the simulation we would not find back 
528  the used cross section). 
529  In the future we plan to correct this problem by using an extra weight correction factor after the occurrence of a reverse
530  bremsstrahlung. This weight factor should be the ratio between the differential CS used in the adjoint simulation and the 
531 one effectively used in the forward processes. As it is impossible to have access to the forward differential CS 
532  in G4eBremsstrahlungModel we  are investigating the feasibility to use  the differential CS considered in  
533  G4Penelope models. 
534    
535 
536 5.3 Limitation of the reverse multiple scattering
537 -------------------------------------------------
538 For the reverse multiple scattering we are using the same models than for the forward case.
539 This approximation makes that the discrepancy between the adjoint and forward 
540 simulation cases can get to a level of ~ 10-15% relative differences in the test cases that we have considered. 
541 In the future we plan to improve   the adjoint multiple scattering models  by forcing the computation of 
542 multiple scattering effect at the end of an adjoint step.