1 | $Id: README,v 1.4 2005/12/09 16:44:21 mkossov Exp $ |
---|
2 | ------------------------------------------------------------------- |
---|
3 | |
---|
4 | ========================================================= |
---|
5 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP |
---|
6 | ========================================================= |
---|
7 | |
---|
8 | Photon_Inefficiency (raredecay_calorimetry) advanced example |
---|
9 | ------------------------------------------------------------ |
---|
10 | |
---|
11 | |
---|
12 | This example simulates a simplified sandwitch calorimeter (developed from N07). |
---|
13 | The main features in this example to be demonstrated are: |
---|
14 | |
---|
15 | 1. How to use a user's run class derived from the G4Run base class for accumulating |
---|
16 | physics values and hits to make the run result; |
---|
17 | |
---|
18 | 2. How to change calorimeter geometry without re-building a world volume; |
---|
19 | |
---|
20 | 3. How to change materials which are used in parameterized volumes; |
---|
21 | |
---|
22 | 4. How to instantiate more than one sensitive detectors with different |
---|
23 | module names from only one sensitive detector class; |
---|
24 | |
---|
25 | 5. How to define geometrical regions and set production thresholds for each readout |
---|
26 | region; |
---|
27 | |
---|
28 | 6. How to Estimate importance of photonuclear reactions for photon inefficiency of |
---|
29 | calorimeters; |
---|
30 | |
---|
31 | 7. How to compare effectiveness of different absorbers to reduce photon inefficiency. |
---|
32 | |
---|
33 | 8. How to use macro files in the batch and interactive modes. |
---|
34 | |
---|
35 | 9. How to make the user's UI commands (/PhotIn/ in this example). |
---|
36 | |
---|
37 | 1- Utilizing a run class derived from the G4Run base class for accumulating energy |
---|
38 | depositions and hits for the run result: |
---|
39 | |
---|
40 | G4Run is a class which users can inherit and create their own class for accumulating |
---|
41 | useful information. It has a virtual method RecordEvent(const G4Event*), which is |
---|
42 | called by G4RunManager class at the end of event processing. By implemeting this method |
---|
43 | in the user's run class, one can store information associated with G4Event class and |
---|
44 | hit collections attached to the G4Event class. The PhotInRun class is a class derived |
---|
45 | from the G4Run class. In the PhotInRun::RecordEvent(const G4Event*) method events are |
---|
46 | counted and all hit collections are accessed to accumulate energy depositions, step |
---|
47 | lengths and numbers of steps. |
---|
48 | |
---|
49 | When users create run classes, objects of these classes must be instantiated in the |
---|
50 | GenerateRun() method of the class derived from G4UserRunAction base class. The pointer |
---|
51 | to the run object must be returned by this method. A PhotInRunAction class instantiates |
---|
52 | PhotInRun class object. In the PhotInRunAction::EndOfRunAction(const G4Run*) method, |
---|
53 | PhotInRun object is analized to make the output run summary. |
---|
54 | |
---|
55 | Generated secondary particles is collected in the PhotInStackinAction class instead of |
---|
56 | the sensitive detector class. A PhotInStackingAction::ClassifyNewTrack(const G4Track*) |
---|
57 | method is used not for tracks which are sent to the stack, but for accessing all |
---|
58 | secondaries generated in the event. |
---|
59 | |
---|
60 | 2- Changing calorimeter geometry without re-building a world volume: |
---|
61 | |
---|
62 | In PhotINDetectorConstruction, all solids, logical and physical volumes are constructed |
---|
63 | only once in the first Constuct() method. Positions and numbers of slices are changed |
---|
64 | not by re-constructing new objects but by modifying data members of already existing |
---|
65 | objects as it's implemented in the PhotInDetectorConstruction::SetNumberOfLayers(G4int) |
---|
66 | method for showing how to change the number of the parameterized volumes, and also in |
---|
67 | the PhotInDetectorConstruction::SetSerialGeometry(G4bool) method as an example of |
---|
68 | changing positions of the placed volumes. |
---|
69 | |
---|
70 | 3- Changing materials already used in parameterized volumes: |
---|
71 | |
---|
72 | Materials of absorbers and of the sensitive gap in the calorimeter are defined by the |
---|
73 | PhotInGapParameterisation::ComputeMaterial(const G4int,G4VPhysicalVolume*) method. |
---|
74 | Positions of each layer in the calorimeter have to be defined by the method |
---|
75 | PhotInGapParameterisation::ComputeTransformation(const G4int,G4VPhysicalVolume*). |
---|
76 | |
---|
77 | 4- Instantiating more than one sensitive detectors with different module names using only |
---|
78 | one sensitive detector class: |
---|
79 | |
---|
80 | The PhotInCalorimeterSD class is constructed three times with deferent module names in |
---|
81 | the PhotInDetectorConstruction::Construct() method. Each detector creates two hits |
---|
82 | collections (PhotInCalorHit class). In total six hits collections of the same type are |
---|
83 | created for each event. To access each of six collections in the PhotInEventAction |
---|
84 | method both the module name and the collection name are used. |
---|
85 | |
---|
86 | 5- Defining geometrical regions and setting production thresholds for each region: |
---|
87 | |
---|
88 | Setting production thresholds (so-called production cuts) to individual region of the |
---|
89 | detector geometry is a new feature provided by Geant4 5.1 release. This feature is also |
---|
90 | called as "Cuts per region". Please, note that this new feature is supporsed to be used |
---|
91 | only by users, |
---|
92 | a) who are simulating complex geometry (such as LHC detectors); |
---|
93 | b) and who has enough experience of simulating EM showers in matter. |
---|
94 | It is strongly recommended to compare simulated results of this new feature with the |
---|
95 | results of the same geometry but with uniform production thresholds. Setting different |
---|
96 | cuts for each region may break coherent and comprehensive accuracy of simulation. Such |
---|
97 | regional cuts must be carefully optimized by users comparing results with uniform cuts. |
---|
98 | |
---|
99 | In the PhotInDetectorConstruction::Construct(), three objects of the G4Region class are |
---|
100 | instantiated and set to the logical volumes of each of three calorimeter modules. Also, |
---|
101 | these individual logical volumes are registered as "root logical volumes" so that all |
---|
102 | daghter volumes in the logical volumes are also affected by the corresponding regions. |
---|
103 | |
---|
104 | In the PhotInPhysicsList::SetCuts() method, in addition to set of the default threshold |
---|
105 | values for the world volume, three thresholds are set to three calorimeter regions |
---|
106 | respectively. Setting a production threshold to a region, gamma, electron, or positron |
---|
107 | are not generated as a secondary if its range is shorter than the production threshold |
---|
108 | for the particular region. Please note, that at present some EM processes still |
---|
109 | generate such secondaries below threshold. |
---|
110 | |
---|
111 | 6- Estimating importance of photonuclear reactions for photon inefficiency of detectors: |
---|
112 | |
---|
113 | User can switch on or off the photo- (and electro-) nuclear processes for the run. |
---|
114 | |
---|
115 | 7- Compare effectiveness of different absorbers to reduce the photon inefficiency: |
---|
116 | |
---|
117 | User can compare results of simulation for different materials of absorbers. |
---|
118 | |
---|
119 | 8- Macro files: |
---|
120 | |
---|
121 | Batch mode: ">./PhotIn < PhotIn.in" (It creates a reference output file PhotIn.out) |
---|
122 | |
---|
123 | Interactive mode: ">./PhotIn". |
---|
124 | Print "/control/execute sample.mac" when "Idle>" prompt appears. |
---|
125 | or (as the sam="/control/execute sample.mac" alias is define in vis.mac) |
---|
126 | Print "Idle> sam" |
---|
127 | |
---|
128 | Setting visualization parameters: The "vis.mac" macro file will be called automatically |
---|
129 | when the interactive execution starts. |
---|
130 | |
---|
131 | 9- UI commands defined in the "Photon_inefficiency" example: |
---|
132 | |
---|
133 | -------------------------------------------------- |
---|
134 | |
---|
135 | Command : /PhotIn/projParticle |
---|
136 | Guidance: Select Incident Beam Particle. |
---|
137 | |
---|
138 | Parameter : particle |
---|
139 | Parameter type: s |
---|
140 | Omittable : False |
---|
141 | Candidates : < List of all Geant4 particles> |
---|
142 | |
---|
143 | -------------------------------------------------- |
---|
144 | |
---|
145 | Command : /PhotIn/projEnergy |
---|
146 | Guidance: Select Energy for the Beam Particle. |
---|
147 | |
---|
148 | Parameter : Energy |
---|
149 | Parameter type: d |
---|
150 | Omittable : False |
---|
151 | |
---|
152 | -------------------------------------------------- |
---|
153 | |
---|
154 | Command : /PhotIn/setAbsMat |
---|
155 | Guidance: Select Material of the Absorber. |
---|
156 | |
---|
157 | Parameter : choice |
---|
158 | Parameter type: s |
---|
159 | Omittable : False |
---|
160 | Candidates : Aluminium liquidArgon Lead Water Scintillator Air Galactic |
---|
161 | |
---|
162 | -------------------------------------------------- |
---|
163 | |
---|
164 | Command : /PhotIn/setGapMat |
---|
165 | Guidance: Select Material of the Gap. |
---|
166 | |
---|
167 | Parameter : choice |
---|
168 | Parameter type: s |
---|
169 | Omittable : False |
---|
170 | Candidates : Aluminium liquidArgon Lead Water Scintillator Air Galactic |
---|
171 | |
---|
172 | -------------------------------------------------- |
---|
173 | |
---|
174 | Command : /PhoyIn/numberOfLayers |
---|
175 | Guidance: Set number of layers. |
---|
176 | Range of parameters : nl>0 |
---|
177 | |
---|
178 | Parameter : nl |
---|
179 | Parameter type: i |
---|
180 | Omittable : False |
---|
181 | |
---|
182 | -------------------------------------------------- |
---|
183 | |
---|
184 | Command : /PhoyIn/numberOfSlabs |
---|
185 | Guidance: Set number of slabs in a layer. |
---|
186 | Range of parameters : nl>0 |
---|
187 | |
---|
188 | Parameter : nl |
---|
189 | Parameter type: i |
---|
190 | Omittable : False |
---|
191 | |
---|
192 | -------------------------------------------------- |
---|
193 | |
---|
194 | Command : /PhotIn/serialGeometry |
---|
195 | Guidance: Select calorimeters to be placed in serial or parallel. |
---|
196 | |
---|
197 | Parameter : serialize |
---|
198 | Parameter type: b |
---|
199 | Omittable : False |
---|
200 | |
---|
201 | -------------------------------------------------- |
---|
202 | |
---|
203 | Command : /PhotIn/verbose |
---|
204 | Guidance: Set verbosity of each event. |
---|
205 | Range of parameters : vl>=0 && vl<10 |
---|
206 | |
---|
207 | Parameter : vl |
---|
208 | Parameter type: i |
---|
209 | Omittable : True |
---|
210 | Default value : taken from the current value |
---|
211 | |
---|
212 | -------------------------------------------------- |
---|
213 | |
---|
214 | General comments about the structure of the example: |
---|
215 | ==================================================== |
---|
216 | |
---|
217 | 0. In all .cc files the debug flags can be defined. To make program silent comment them. |
---|
218 | In some .cc files the errors flag is defined. It permits run time warnings (if ever). |
---|
219 | |
---|
220 | 1. All constants of the example, names, and default values for the variable parameters are |
---|
221 | collected in the include/PhotInConstants.hh header widely used in almost all classes. |
---|
222 | |
---|
223 | 2. The src/PhotInHit collection is practically a structure for three values: energy |
---|
224 | deposition of charged particles, track length of neutrons, and #of steps. Hits are |
---|
225 | collected PhotInCalorHitsCollection's defined in include/PhotInCalorHit.hh. |
---|
226 | |
---|
227 | 3. PhotInCalorimeterSD class defines and treats 6 (two per detector: one for absorber, one |
---|
228 | for the active slabs) hit collections, so absorber is defined as a sensitive detector. |
---|
229 | |
---|
230 | 4. All cuts are made in the PhotInPhysicsList::SetCuts(), while in future cuts can be more |
---|
231 | complicated than the scaling of the standard cuts and can be out of the Physics List. |
---|
232 | |
---|
233 | The dependency structure (general Constants.hh and PhotIn prefix is skipped). |
---|
234 | ============================================================================= |
---|
235 | |
---|
236 | .____________________________________________________________Main________. |
---|
237 | | / / / / | | | |
---|
238 | | VisManager PhysicsList / DetectorMessenger | RunAction | |
---|
239 | | / / / \ \ | | | |
---|
240 | \ PrimaryGeneratorAction / \ \ | Run* EventAction |
---|
241 | \ | / \ \ | | / / |
---|
242 | -----------------DetectorConstruction \ StackingAction / |
---|
243 | / | \ \ / |
---|
244 | LayerParameterization GapParameterization CalorimeerSD \ / |
---|
245 | | \ / |
---|
246 | (defined in the "CalorHit" as a type) CalorHitsCollection \ / |
---|
247 | \ \ / |
---|
248 | CalorHit |
---|
249 | |
---|
250 | |
---|
251 | * SteppingAction is a debuging tool which can be optionally attached to the RunManager |
---|
252 | ========================================================================================= |
---|
253 | |
---|
254 | Description of classes: |
---|
255 | ======================= |
---|
256 | |
---|
257 | "CalorHit" handles (Reset/Add/Get) EnergyDeposition, TrackLengt, NumberOfSteps of the Hit |
---|
258 | (+ "CalorHitsCollection" a container for CalorHits in different parts of the detector) |
---|
259 | |
---|
260 | "CalorimeerSD" SensetiveDetector, nLay & nSlab definition, Layers & Slabs HitsCollections |
---|
261 | |
---|
262 | "LayerParameterization" & "GapParameterization" parameterization of Layers & Slabs |
---|
263 | |
---|
264 | "DetectorConstruction" create, change, and replace three calorimeters of the example |
---|
265 | |
---|
266 | "StackingAction" calculates number of each kind of particles, their min & max energies |
---|
267 | |
---|
268 | "PrimaryGeneratorAction" ParticleGun of events changes kind of particle, energy, direction |
---|
269 | |
---|
270 | "DetectorMessenger" on flight change of the detector geometry, regions, and HitsCollections |
---|
271 | |
---|
272 | "Run" run manager which can treat/reset information about particles and their energy range |
---|
273 | |
---|
274 | "EventAction" & "RunAction" treat of the collected information of simulation |
---|
275 | |
---|
276 | "PhysicsList" defines physics (now is not used and ReferencePhysicsLists are used instead) |
---|
277 | |
---|
278 | "VisManager" defines a way of visualization of the particular/overlaped events |
---|