Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/optical/LXe/README is written in an unsupported language. File is not indexed.

0001 
0002                             LXe Example
0003                             -----------
0004 
0005 ------------
0006 Introduction
0007 ------------
0008 
0009 This example demonstrates usage of optical physics. 
0010 
0011 -----------------------------
0012 Geometry and primary particle
0013 -----------------------------
0014 
0015 The main volume is a box of LXe. PMTs are placed around the outside. There
0016 may be a reflective sphere placed inside the box, and a wavelength shifting
0017 slab and fibers.
0018 
0019 The geometry implementation is different from many of the other examples. 
0020 See the discussion below.
0021 
0022 G4ParticleGun creates the primary particle. The type of particle is selectable
0023 by the user.
0024 
0025 -------
0026 Physics
0027 -------
0028 
0029 The physics list is FTFP_BERT, with G4EmStandard_option4 electromagnetic
0030 physics and G4OpticalPhysics.
0031 
0032 -----------
0033 Macro files
0034 -----------
0035 
0036 cerenkov.mac disables scintillation, so the optical photons that are produced
0037 are Cerenkov photons.
0038 
0039 wls.mac implements a scintillating slab and wavelength shifting fibers.
0040 
0041 
0042 ---------------------------
0043 List of built-in histograms
0044 ---------------------------
0045 
0046  1  "hits per event"
0047  2  "hits per event above threshold"
0048  3  "scintillation photons per event"
0049  4  "Cerenkov photons per event"
0050  5  "absorbed photons per event"
0051  6  "photons absorbed at boundary per event"
0052  7  "energy deposition in scintillator per event"
0053 
0054 
0055 -------------
0056 How to start?
0057 -------------
0058 
0059   - execute LXe in 'batch' mode from macro files, e.g.
0060     $ ./LXe cerenkov.mac
0061 
0062   - execute LXe in 'interactive' mode with visualization, e.g.
0063     $ ./LXe
0064     Then type commands, for instance
0065     Session: /run/beamOn 1
0066 
0067 ---------------
0068 Macros included
0069 ---------------
0070 
0071 Several macros are include in the distribution:
0072 
0073 cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
0074               Cerenkov cone and PMTs hit are visible. (Reduce the number 
0075               of particles for visualization.)
0076 LXe.mac:      Shoot a 511 keV gamma with the default geometry.
0077 photon.mac:   Primary beam is an optical photon, with the default geometry.
0078 wls.mac:      Geometry includes 15 WLS fibers. A 511 keV electron is the
0079               primary.
0080 
0081 -----------------------------------------------
0082 Detailed Explanation of Geometry Implementation
0083 -----------------------------------------------
0084 
0085 The way the geometry is constructed is an experiment for a new, more object
0086 oriented, way to construct geometry. It separates the concept of how a volume
0087 is built from where it is placed. Each major volume in the geometry is defined
0088 as a class derived from G4PVPlacement. In this example, just the main LXe
0089 volume, the WLS scintillator slab, and the WLS fibers were chosen. To place
0090 one of these volumes, simply create an instance of it with the appropriate
0091 rotation, translation, and mother volumes.
0092 
0093     LXeMainVolume(G4RotationMatrix *pRot,
0094                   const G4ThreeVector &tlate,
0095                   G4LogicalVolume *pMotherLogical,
0096                   G4bool pMany,
0097                   G4int pCopyNo,
0098                   LXeDetectorConstruction* c);
0099 
0100 Also necessary are the pMany and pCopyNo variables with the same usage as in 
0101 G4PVPlacement. Additionally, the detector construction must be passed to the
0102 main volume as a way to communicate the many parameters to the volume and its
0103 sub-volumes. The communication is done from the CopyValues() function which
0104 retrieves the information from the detector constructor.
0105 
0106 Notably, the name and logical volume parameters are no longer part of the
0107 constructor. This is because they are both to be decided by the volume itself.
0108 The volume must specify its own name and a temporary logical volume. The
0109 constructor will then procede to define its logical volume in the normal way.
0110 Once complete, the logical volume can be assigned to the physical volume using
0111 the SetLogicalVolume() function.
0112 
0113 To handle instances of the same type of volume, a new logical volume should not
0114 be defined for each one. Instead, the logical volume is kept as a static member
0115 and defined only once. 
0116 
0117     if (!housing_log || updated) {
0118       //...
0119       //Define logical volume
0120       //...
0121     }
0122     SetLogicalVolume(housing_log);
0123 
0124 The updated variable is to signal that the volume needs to be updated and a new
0125 logical volume made.
0126 
0127 ---------------------------------
0128 Modifying the geometry at runtime
0129 ---------------------------------
0130 
0131 This example allows the user to modify the geometry definition at runtime. This
0132 is accomplished through LXeDetectorMessenger, a derived class of G4UImessenger.
0133 The commands it adds change variables stored in LXeDetectorConstructor that
0134 are used when constructing the geometry. 
0135 
0136     void LXeDetectorConstruction::UpdateGeometry(){
0137       // clean-up previous geometry
0138       G4SolidStore::GetInstance()->Clean();
0139       G4LogicalVolumeStore::GetInstance()->Clean();
0140       G4PhysicalVolumeStore::GetInstance()->Clean();
0141 
0142       //define new one
0143       G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
0144       G4RunManager::GetRunManager()->GeometryHasBeenModified();
0145     }
0146 
0147 ----------------------
0148 PMT sensitive detector
0149 ----------------------
0150 
0151 The PMT sensitive detector cannot be triggered like a normal sensitive detector
0152 because the sensitive volume does not allow photons to pass through it. Rather,
0153 it detects them in the OpBoundary process based on an efficiency set on the
0154 skin of the volume.
0155 
0156 
0157     G4OpticalSurface* photocath_opsurf=
0158        new G4OpticalSurface("photocath_opsurf",glisur,polished,
0159                              dielectric_metal);
0160     G4double photocath_EFF[num]={1.,1.};
0161     G4double photocath_REFL[num]={0.,0.};
0162     G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
0163     photocath_mt->AddProperty("EFFICIENCY",Ephoton,photocath_EFF,num);
0164     photocath_mt->AddProperty("REFLECTIVITY",Ephoton,photocath_REFL,num);
0165     photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
0166     new G4LogicalSkinSurface("photocath_surf",photocath_log,photocath_opsurf);
0167 
0168 
0169 A normal sensitive detector would have its ProcessHits 
0170 function called for each step by a particle inside the volume. So, to record
0171 these hits with a sensitive detector we watched the status of the OpBoundary
0172 process from the stepping manager whenever a photon hit the sensitive volume
0173 of the pmt. If the status was 'Detection', we retrieve the sensitive detector
0174 from G4SDManager and call its ProcessHits function.
0175 
0176 
0177     boundaryStatus=boundary->GetStatus();
0178     //Check to see if the particle was actually at a boundary
0179     //Otherwise the boundary status may not be valid
0180     //Prior to Geant4.6.0-p1 this would not have been enough to check
0181     if(thePostPoint->GetStepStatus()==fGeomBoundary){
0182       switch(boundaryStatus){
0183       //...    
0184         case Detection: //Note, this assumes that the volume causing detection
0185                         //is the photocathode because it is the only one with
0186                   //non-zero efficiency
0187     {
0188       //Trigger sensitive detector manually since photon is
0189       //absorbed but status was Detection
0190       G4SDManager* SDman = G4SDManager::GetSDMpointer();
0191       G4String sdName="/LXeDet/pmtSD";
0192       LXePMTSD* pmtSD = (LXePMTSD*)SDman
0193         ->FindSensitiveDetector(sdName);
0194       if(pmtSD)
0195         pmtSD->ProcessHits_constStep(theStep,NULL);
0196       break;
0197     }
0198         //...
0199       }
0200 
0201 
0202 --------------------------------------------------------
0203 Selectively drawing trajectories or highlighting volumes
0204 --------------------------------------------------------
0205 
0206 In a simulation such as this one, where an average of 6000 trajectories are
0207 generated in a small space, there is little use in drawing all of them. There
0208 are two ways to select which ones to draw. The first of which is to decide
0209 while looping through the trajectory container which ones to draw and only call
0210 DrawTrajectory on the important ones. However, trajectories only contain a
0211 small portion of the information from the track it represents. This may not
0212 be enough to decide if a trajectory is worth drawing.
0213 
0214 The alternative is to define your own trajectory class to store additional
0215 information to help decide if it should be drawn. To use your custom trajectory
0216 you must create it in the PreUserTrackingAction:
0217 
0218 fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack));
0219 
0220 Then at any point you can get access to the trajectory you can update the extra
0221 information within it. When it comes to drawing, you can then use this to
0222 decide if you want to call DrawTrajectory. Or you can call DrawTrajectory for
0223 all trajectories and have the logic decide how and if a trajectory should
0224 be drawn inside the DrawTrajectory function itself.
0225 
0226 Selectively highlighting volumes is useful to show which volumes were hit. To
0227 do this, you simply need a pointer to the physical volume. With that, you can
0228 modify its vis attributes and instruct the vis manager to redraw the volume
0229 with the new vis attributes.
0230 
0231     G4VisAttributes attribs(G4Colour(1.,0.,0.));
0232     attribs.SetForceSolid(true);
0233     G4RotationMatrix rot;
0234     if(physVol->GetRotation())//If a rotation is defined use it
0235       rot=*(physVol->GetRotation());
0236     G4Transform3D trans(rot,physVol->GetTranslation());//Create transform
0237     pVVisManager->Draw(*physVol,attribs,trans);//Draw it
0238 
0239 In this case, it is done in Draw function of a PMT hit but it can be placed
0240 anywhere. The logic to decide if it should be drawn or not may be similar to
0241 the logic used in choosing which trajectories to draw.
0242 
0243 See /LXe/detector/volumes/sphere in "UI commands" below for info on what 
0244 trajectories are drawn in this simulation.
0245 
0246 --------------------------
0247 Saving random engine seeds
0248 --------------------------
0249 
0250 At times it may be necessary to review a particular event of interest. To do
0251 this without redoing an entire run, which may take a long time, you must store
0252 the random engine seed from the beginning of the event. The run manager
0253 has some functions that help in this task.
0254 
0255 G4RunManager::SetRandomNumberStore(G4bool)
0256 
0257 When set to true, this causes the run manager to write the seed for the
0258 beginning of the current run to CurrentRun.rndm and the current event to 
0259 CurrentEvent.rndm. However, at the beginning of each event this file will be 
0260 overwritten with the new event. To keep a copy for a particular event there is
0261 a function to copy this file to run###evt###.rndm.
0262 
0263 G4RunManager::rndmSaveThisEvent()
0264 
0265 This can be done for every event so you can review any event you like but this
0266 may be awkward for runs with very large numbers of events. Instead, implement
0267 some form of logic in EndOfEventAction to decide if the event is worth saving.
0268 If it is, then call rndmSaveThisEvent(). By default, these files are stored in
0269 the current working directory. There is a function to change this as well.
0270 Typically you would call that at the same time SetRandomNumberStore. The
0271 directory to save in must exist first. GEANT4 will not create it for you.
0272 
0273 G4RunManager::SetRandomNumberStoreDir(G4String)
0274 
0275 -----------
0276 UI commands
0277 -----------
0278 
0279 Directories:
0280 /LXe/ - All custom commands belong below this directory
0281 /LXe/detector/ - Geometry related commands
0282 /LXe/detector/volumes/ - Commands to enable/disable volumes in the geometry
0283 
0284 Commands:
0285 /LXe/saveThreshold <int, default = 4500>
0286 -Specifies a threshold for saving the random seed for an event. If the number
0287 of photons generated in an event is below this number then the random seed is
0288 saved to ./random/run###evt###.rndm. See "Saving random engine seeds".
0289 
0290 /LXe/eventVerbose <int, default = 1>
0291 -Enables end of event verbose data to be printed. This includes information
0292 counted and calculated by the user action classes.
0293 
0294 /LXe/pmtThreshold <int, default = 1>
0295 -Sets the PMT threshold in # of photons being detected by the PMT. PMTs below
0296 with fewer hits than the threshold will not count as being hit and will also
0297 not be highlighted at the end of the event.
0298 
0299 /LXe/oneStepPrimaries <bool>
0300 -This causes primary particles to be killed after going only one step inside
0301 the scintillator volume. This is useful to view the photons generated during 
0302 the initial conversion of the primary particle.
0303 
0304 /LXe/forceDrawPhotons <bool>
0305 -Forces all optical photon trajectories to be drawn at the end of the event 
0306 regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
0307 
0308 /LXe/forceDrawNoPhotons <bool>
0309 -Forces all optical photon trajectories to NOT be drawn at the end of the 
0310 event regardless of the scheme mentioned in /LXe/detector/volumes/sphere below.
0311 -If /LXe/forceDrawPhotons is set to true, this has no effect.
0312 
0313 /LXe/detector/dimensions <double x y z> <unit, default = cm>
0314 -Sets the dimensions of the main scintillator volume.
0315 
0316 /LXe/detector/housingThickness <double>
0317 -Sets the thickness of the housing surrounding the main detector volume.
0318 
0319 /LXe/detector/pmtRadius <double> <unit, default = cm>
0320 -Sets the radius of the PMTs
0321 
0322 /LXe/detector/nx
0323 /LXe/detector/ny
0324 /LXe/detector/nz
0325 -Sets the number of PMTs placed in a row along each axis.
0326 
0327 /LXe/detector/reflectivity <double>
0328 -Sets the reflectivity of the inside of the aluminum housing. The geometry
0329 uses a default value of 1.00 for a fully reflective surface.
0330 
0331 /LXe/detector/nfibers <int>
0332 -Sets the number of WLS fibers placed in the WLS scintillator slab. The
0333 geometry uses a default value of 15 fibers.
0334 
0335 /LXe/detector/scintYieldFactor <double>
0336 -Sets the yield factor for the scintillation process. This is cumulative with
0337 the yield factor set on individual materials. Set to 0 to produce no 
0338 scintillation photons.
0339 
0340 /LXe/detector/defaults
0341 -Resets all detector values customizable with commands above to their defaults.
0342 
0343 /LXe/detector/volumes/sphere <bool>
0344 -Enables/disables the sphere placed inside the main scintillator volume. When
0345 the sphere is enabled, only photons that hit the sphere and hit a PMT are
0346 drawn. If it is disabled, then all photons that hit PMTs are drawn.
0347 
0348 /LXe/detector/volumes/wls <bool>
0349 -Enables/disables the WLS scintillator slab containing WLS fibers. By default
0350 this is not part of the geometry. Enabling it will place it behind the LXe
0351 scintillator volume.
0352 
0353 /LXe/detector/volumes/lxe <bool>
0354 -Enables/disables the main LXe scintillator volume. By default this is part of
0355 the geometry.
0356