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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 2111 bytes       2024-12-05 15:16:16
File GNUmakefile 373 bytes       2024-12-05 15:16:16
File History 11477 bytes       2024-12-05 15:16:16
C++ file LXe.cc 4044 bytes       2024-12-05 15:16:16
File LXe.mac 742 bytes       2024-12-05 15:16:16
File LXe.out 121312 bytes       2024-12-05 15:16:16
File README 14111 bytes       2024-12-05 15:16:16
File cerenkov.mac 1261 bytes       2024-12-05 15:16:16
File cerenkov.out 48645 bytes       2024-12-05 15:16:16
File gui.mac 806 bytes       2024-12-05 15:16:16
File photon.mac 191 bytes       2024-12-05 15:16:16
File photon.out 53288 bytes       2024-12-05 15:16:16
File vis.mac 2015 bytes       2024-12-05 15:16:16
File wls.mac 528 bytes       2024-12-05 15:16:16
File wls.out 51535 bytes       2024-12-05 15:16:16

  1 
  2                             LXe Example
  3                             -----------
  4 
  5 ------------
  6 Introduction
  7 ------------
  8 
  9 This example demonstrates usage of optical physics. 
 10 
 11 -----------------------------
 12 Geometry and primary particle
 13 -----------------------------
 14 
 15 The main volume is a box of LXe. PMTs are placed around the outside. There
 16 may be a reflective sphere placed inside the box, and a wavelength shifting
 17 slab and fibers.
 18 
 19 The geometry implementation is different from many of the other examples. 
 20 See the discussion below.
 21 
 22 G4ParticleGun creates the primary particle. The type of particle is selectable
 23 by the user.
 24 
 25 -------
 26 Physics
 27 -------
 28 
 29 The physics list is FTFP_BERT, with G4EmStandard_option4 electromagnetic
 30 physics and G4OpticalPhysics.
 31 
 32 -----------
 33 Macro files
 34 -----------
 35 
 36 cerenkov.mac disables scintillation, so the optical photons that are produced
 37 are Cerenkov photons.
 38 
 39 wls.mac implements a scintillating slab and wavelength shifting fibers.
 40 
 41 
 42 ---------------------------
 43 List of built-in histograms
 44 ---------------------------
 45 
 46  1  "hits per event"
 47  2  "hits per event above threshold"
 48  3  "scintillation photons per event"
 49  4  "Cerenkov photons per event"
 50  5  "absorbed photons per event"
 51  6  "photons absorbed at boundary per event"
 52  7  "energy deposition in scintillator per event"
 53 
 54 
 55 -------------
 56 How to start?
 57 -------------
 58 
 59   - execute LXe in 'batch' mode from macro files, e.g.
 60     $ ./LXe cerenkov.mac
 61 
 62   - execute LXe in 'interactive' mode with visualization, e.g.
 63     $ ./LXe
 64     Then type commands, for instance
 65     Session: /run/beamOn 1
 66 
 67 ---------------
 68 Macros included
 69 ---------------
 70 
 71 Several macros are include in the distribution:
 72 
 73 cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
 74               Cerenkov cone and PMTs hit are visible. (Reduce the number 
 75               of particles for visualization.)
 76 LXe.mac:      Shoot a 511 keV gamma with the default geometry.
 77 photon.mac:   Primary beam is an optical photon, with the default geometry.
 78 wls.mac:      Geometry includes 15 WLS fibers. A 511 keV electron is the
 79               primary.
 80 
 81 -----------------------------------------------
 82 Detailed Explanation of Geometry Implementation
 83 -----------------------------------------------
 84 
 85 The way the geometry is constructed is an experiment for a new, more object
 86 oriented, way to construct geometry. It separates the concept of how a volume
 87 is built from where it is placed. Each major volume in the geometry is defined
 88 as a class derived from G4PVPlacement. In this example, just the main LXe
 89 volume, the WLS scintillator slab, and the WLS fibers were chosen. To place
 90 one of these volumes, simply create an instance of it with the appropriate
 91 rotation, translation, and mother volumes.
 92 
 93     LXeMainVolume(G4RotationMatrix *pRot,
 94                   const G4ThreeVector &tlate,
 95                   G4LogicalVolume *pMotherLogical,
 96                   G4bool pMany,
 97                   G4int pCopyNo,
 98                   LXeDetectorConstruction* c);
 99 
100 Also necessary are the pMany and pCopyNo variables with the same usage as in 
101 G4PVPlacement. Additionally, the detector construction must be passed to the
102 main volume as a way to communicate the many parameters to the volume and its
103 sub-volumes. The communication is done from the CopyValues() function which
104 retrieves the information from the detector constructor.
105 
106 Notably, the name and logical volume parameters are no longer part of the
107 constructor. This is because they are both to be decided by the volume itself.
108 The volume must specify its own name and a temporary logical volume. The
109 constructor will then procede to define its logical volume in the normal way.
110 Once complete, the logical volume can be assigned to the physical volume using
111 the SetLogicalVolume() function.
112 
113 To handle instances of the same type of volume, a new logical volume should not
114 be defined for each one. Instead, the logical volume is kept as a static member
115 and defined only once. 
116 
117     if (!housing_log || updated) {
118       //...
119       //Define logical volume
120       //...
121     }
122     SetLogicalVolume(housing_log);
123 
124 The updated variable is to signal that the volume needs to be updated and a new
125 logical volume made.
126 
127 ---------------------------------
128 Modifying the geometry at runtime
129 ---------------------------------
130 
131 This example allows the user to modify the geometry definition at runtime. This
132 is accomplished through LXeDetectorMessenger, a derived class of G4UImessenger.
133 The commands it adds change variables stored in LXeDetectorConstructor that
134 are used when constructing the geometry. 
135 
136     void LXeDetectorConstruction::UpdateGeometry(){
137       // clean-up previous geometry
138       G4SolidStore::GetInstance()->Clean();
139       G4LogicalVolumeStore::GetInstance()->Clean();
140       G4PhysicalVolumeStore::GetInstance()->Clean();
141 
142       //define new one
143       G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
144       G4RunManager::GetRunManager()->GeometryHasBeenModified();
145     }
146 
147 ----------------------
148 PMT sensitive detector
149 ----------------------
150 
151 The PMT sensitive detector cannot be triggered like a normal sensitive detector
152 because the sensitive volume does not allow photons to pass through it. Rather,
153 it detects them in the OpBoundary process based on an efficiency set on the
154 skin of the volume.
155 
156 
157     G4OpticalSurface* photocath_opsurf=
158        new G4OpticalSurface("photocath_opsurf",glisur,polished,
159                              dielectric_metal);
160     G4double photocath_EFF[num]={1.,1.};
161     G4double photocath_REFL[num]={0.,0.};
162     G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
163     photocath_mt->AddProperty("EFFICIENCY",Ephoton,photocath_EFF,num);
164     photocath_mt->AddProperty("REFLECTIVITY",Ephoton,photocath_REFL,num);
165     photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
166     new G4LogicalSkinSurface("photocath_surf",photocath_log,photocath_opsurf);
167 
168 
169 A normal sensitive detector would have its ProcessHits 
170 function called for each step by a particle inside the volume. So, to record
171 these hits with a sensitive detector we watched the status of the OpBoundary
172 process from the stepping manager whenever a photon hit the sensitive volume
173 of the pmt. If the status was 'Detection', we retrieve the sensitive detector
174 from G4SDManager and call its ProcessHits function.
175 
176 
177     boundaryStatus=boundary->GetStatus();
178     //Check to see if the particle was actually at a boundary
179     //Otherwise the boundary status may not be valid
180     //Prior to Geant4.6.0-p1 this would not have been enough to check
181     if(thePostPoint->GetStepStatus()==fGeomBoundary){
182       switch(boundaryStatus){
183       //...    
184         case Detection: //Note, this assumes that the volume causing detection
185                         //is the photocathode because it is the only one with
186                   //non-zero efficiency
187     {
188       //Trigger sensitive detector manually since photon is
189       //absorbed but status was Detection
190       G4SDManager* SDman = G4SDManager::GetSDMpointer();
191       G4String sdName="/LXeDet/pmtSD";
192       LXePMTSD* pmtSD = (LXePMTSD*)SDman
193         ->FindSensitiveDetector(sdName);
194       if(pmtSD)
195         pmtSD->ProcessHits_constStep(theStep,NULL);
196       break;
197     }
198         //...
199       }
200 
201 
202 --------------------------------------------------------
203 Selectively drawing trajectories or highlighting volumes
204 --------------------------------------------------------
205 
206 In a simulation such as this one, where an average of 6000 trajectories are
207 generated in a small space, there is little use in drawing all of them. There
208 are two ways to select which ones to draw. The first of which is to decide
209 while looping through the trajectory container which ones to draw and only call
210 DrawTrajectory on the important ones. However, trajectories only contain a
211 small portion of the information from the track it represents. This may not
212 be enough to decide if a trajectory is worth drawing.
213 
214 The alternative is to define your own trajectory class to store additional
215 information to help decide if it should be drawn. To use your custom trajectory
216 you must create it in the PreUserTrackingAction:
217 
218 fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack));
219 
220 Then at any point you can get access to the trajectory you can update the extra
221 information within it. When it comes to drawing, you can then use this to
222 decide if you want to call DrawTrajectory. Or you can call DrawTrajectory for
223 all trajectories and have the logic decide how and if a trajectory should
224 be drawn inside the DrawTrajectory function itself.
225 
226 Selectively highlighting volumes is useful to show which volumes were hit. To
227 do this, you simply need a pointer to the physical volume. With that, you can
228 modify its vis attributes and instruct the vis manager to redraw the volume
229 with the new vis attributes.
230 
231     G4VisAttributes attribs(G4Colour(1.,0.,0.));
232     attribs.SetForceSolid(true);
233     G4RotationMatrix rot;
234     if(physVol->GetRotation())//If a rotation is defined use it
235       rot=*(physVol->GetRotation());
236     G4Transform3D trans(rot,physVol->GetTranslation());//Create transform
237     pVVisManager->Draw(*physVol,attribs,trans);//Draw it
238 
239 In this case, it is done in Draw function of a PMT hit but it can be placed
240 anywhere. The logic to decide if it should be drawn or not may be similar to
241 the logic used in choosing which trajectories to draw.
242 
243 See /LXe/detector/volumes/sphere in "UI commands" below for info on what 
244 trajectories are drawn in this simulation.
245 
246 --------------------------
247 Saving random engine seeds
248 --------------------------
249 
250 At times it may be necessary to review a particular event of interest. To do
251 this without redoing an entire run, which may take a long time, you must store
252 the random engine seed from the beginning of the event. The run manager
253 has some functions that help in this task.
254 
255 G4RunManager::SetRandomNumberStore(G4bool)
256 
257 When set to true, this causes the run manager to write the seed for the
258 beginning of the current run to CurrentRun.rndm and the current event to 
259 CurrentEvent.rndm. However, at the beginning of each event this file will be 
260 overwritten with the new event. To keep a copy for a particular event there is
261 a function to copy this file to run###evt###.rndm.
262 
263 G4RunManager::rndmSaveThisEvent()
264 
265 This can be done for every event so you can review any event you like but this
266 may be awkward for runs with very large numbers of events. Instead, implement
267 some form of logic in EndOfEventAction to decide if the event is worth saving.
268 If it is, then call rndmSaveThisEvent(). By default, these files are stored in
269 the current working directory. There is a function to change this as well.
270 Typically you would call that at the same time SetRandomNumberStore. The
271 directory to save in must exist first. GEANT4 will not create it for you.
272 
273 G4RunManager::SetRandomNumberStoreDir(G4String)
274 
275 -----------
276 UI commands
277 -----------
278 
279 Directories:
280 /LXe/ - All custom commands belong below this directory
281 /LXe/detector/ - Geometry related commands
282 /LXe/detector/volumes/ - Commands to enable/disable volumes in the geometry
283 
284 Commands:
285 /LXe/saveThreshold <int, default = 4500>
286 -Specifies a threshold for saving the random seed for an event. If the number
287 of photons generated in an event is below this number then the random seed is
288 saved to ./random/run###evt###.rndm. See "Saving random engine seeds".
289 
290 /LXe/eventVerbose <int, default = 1>
291 -Enables end of event verbose data to be printed. This includes information
292 counted and calculated by the user action classes.
293 
294 /LXe/pmtThreshold <int, default = 1>
295 -Sets the PMT threshold in # of photons being detected by the PMT. PMTs below
296 with fewer hits than the threshold will not count as being hit and will also
297 not be highlighted at the end of the event.
298 
299 /LXe/oneStepPrimaries <bool>
300 -This causes primary particles to be killed after going only one step inside
301 the scintillator volume. This is useful to view the photons generated during 
302 the initial conversion of the primary particle.
303 
304 /LXe/forceDrawPhotons <bool>
305 -Forces all optical photon trajectories to be drawn at the end of the event 
306 regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
307 
308 /LXe/forceDrawNoPhotons <bool>
309 -Forces all optical photon trajectories to NOT be drawn at the end of the 
310 event regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
311 -If /LXe/forceDrawPhotons is set to true, this has no effect.
312 
313 /LXe/detector/dimensions <double x y z> <unit, default = cm>
314 -Sets the dimensions of the main scintillator volume.
315 
316 /LXe/detector/housingThickness <double>
317 -Sets the thickness of the housing surrounding the main detector volume.
318 
319 /LXe/detector/pmtRadius <double> <unit, default = cm>
320 -Sets the radius of the PMTs
321 
322 /LXe/detector/nx
323 /LXe/detector/ny
324 /LXe/detector/nz
325 -Sets the number of PMTs placed in a row along each axis.
326 
327 /LXe/detector/reflectivity <double>
328 -Sets the reflectivity of the inside of the aluminum housing. The geometry
329 uses a default value of 1.00 for a fully reflective surface.
330 
331 /LXe/detector/nfibers <int>
332 -Sets the number of WLS fibers placed in the WLS scintillator slab. The
333 geometry uses a default value of 15 fibers.
334 
335 /LXe/detector/scintYieldFactor <double>
336 -Sets the yield factor for the scintillation process. This is cumulative with
337 the yield factor set on individual materials. Set to 0 to produce no 
338 scintillation photons.
339 
340 /LXe/detector/defaults
341 -Resets all detector values customizable with commands above to their defaults.
342 
343 /LXe/detector/volumes/sphere <bool>
344 -Enables/disables the sphere placed inside the main scintillator volume. When
345 the sphere is enabled, only photons that hit the sphere and hit a PMT are
346 drawn. If it is disabled, then all photons that hit PMTs are drawn.
347 
348 /LXe/detector/volumes/wls <bool>
349 -Enables/disables the WLS scintillator slab containing WLS fibers. By default
350 this is not part of the geometry. Enabling it will place it behind the LXe
351 scintillator volume.
352 
353 /LXe/detector/volumes/lxe <bool>
354 -Enables/disables the main LXe scintillator volume. By default this is part of
355 the geometry.
356