Beam Simulations 2008

From GlueXWiki
Revision as of 13:45, 19 August 2014 by Jonesrt (Talk | contribs) (Interactive simulation and plotting)

Jump to: navigation, search

Geant simulations of the Hall D Tagger Hall

A Geant3 simulation exists for the Hall D tagger area. It is maintained in the GlueX software repository, which is currently managed using subversion. Before doing this you should make sure your shell environment is properly configured for running GlueX software. For more information regarding on this, see HOWTO set up the GlueX environment. Once your environment is set up, the following commands will check out, build, and run your own working copy of the simulation.

$ svn co https://halldsvn.jlab.org/repos/trunk/sim-recon/src/programs/Simulation/gxtwist
$ make
$ gxtwist

As you can see, the simulation is performed by an batch-style application called gxtwist. There is also an interactive version called gxtwist++, if you are used to the interactive interface to Geant3. See below for a getting-started guide to interactive plotting of simulated events with gxtwist++.

Inputs

Most of the information used by the Geant3 library to run the simulation is contained in the compiled application, but there are two inputs that it expects to find in disk files located in your working directory.

  1. configuration controls - The application expects to find this information in a file called "control.in" located in your working directory. A standard version of this file is included in the distribution you checked out from subversion, but you will probably want to modify it before running your own simulations. Most of the commands in control.in are explained in comments within the file itself. If you are not familiar with Geant3 control commands, you should consult the Geant3 documentation. One line in control.in that you should be aware of it the SCAP line. The line starting with SCAP is intended to allow the user to scan a particle source over a region and selectively illuminate parts of the detector. In gxtwist, this line is used to tell the simulation where to inject the electron beam in x,y,z, cm units. The diamond radiator is centered at 0,0,0 and the electron beam is pointing along the direction 0,0,1 when it enters the simulation. The default "SCAP 0. 0. -1." line (decimals tell the system that the numbers are real, don't drop them!) enjects the beam just upstream of the diamond radiator so it passes through a 20 micron diamond before reaching the tagging spectrometer. If you want to simulate the tagger without anything at the diamond radiator, change this line to "SCAP 0. 0., 1.". Just downstream of the goniometer in the simulation is the amorphous radiator target which is a 1micron thick piece of aluminum located at 0,0,61 cm. If you want to simulate the tagger with neither the diamond nor the amorphous radiator, change the SCAP line to "SCAP 0. 0. 65.". The rest of the control lines should be self explanatory. The KINE line defines the beam particle type (electron=103), energy, energy spread, direction, direction spread, etc. The TRIG line defines how many beam particles to simulate. The defaults for most of the remaining lines should be fine.
  2. magnetic field maps - Field map files are needed for the tagger dipole and quadrupole magnets. The names of these map files are hard-wired in the hdds geometry for the tagger hall. These files are not a part of the software distribution, but are set up for downloading from a web server at UConn. The gxtwist application checks for these map files in your working directory when it starts up, and if not it tries to download them for you from the proper location, so you should not have to do this yourself. In case for some reason this is not working, you can download them manually from the following urls.

Outputs

Geant3 is really only a simulation toolkit, and users normally are expected to customize it with their own sampling code that generates the output needed to answer their questions. This is normally done by modifying gustep.F to save information from each simulation step in histograms, ntuples, or other hits structures, and then save these to an output file in guout.F which is called at the end of the simulation. The distribution comes with a simple implementation of gustep.F that can be used as a guide for further customization. Geant3 distinguishes "sensitive" media in the material model of the setup that are designated as detectors. In the gxtwist geometry, there are several of these, listed below by their 4-character Geant3 volume name.

  1. XTAL - diamond crystal radiator
  2. TAMO - amorphous radiator
  3. MSFI - microscope fiber counter
  4. FX** - fixed array hodoscope counter
  5. ENDP - special scintillator placed near the end-point region on the focal plane

The distributed gustep.F records the passage of each particle that passes through the microscope, hodoscope, and ENDP detectors and saves the results in a separate PAW ntuple for each. The elements of the ntuples are listed below.

  • kind [int] - Geant3 particle type code for interacting particle
  • xin(4) [float] - position and time (x,y,z,t) of particle entry to detector
  • xout(4) [float] - position and time (x,y,z,t) of particle exit from detector
  • pin(5) [float] - momentum (px,py,pz,E,|p|) of particle at entry
  • pout(5) [float] - momentum (px,py,pz,E,|p|) of particle at exit
  • dEsum [float] - energy deposited by particle in detector
  • x0(4) [float] - position and time (x,y,z,t) where particle was born (or entered simulation)
  • p0(5) [float] - momentum (px,py,pz,E,|p|) of particle at birth
  • p1(5) [float] - other properties of particle at birth, for future use, currently unused
  • ppol [float] - linear polarization [0,1] of photon generated by this beam particle in diamond radiator

Interactive simulation and plotting

Normally one runs Geant3 simulations in batch mode, but sometimes one would like to be able to generate graphics views of the simulation geometry, or visualize particles as they pass through the setup. For this, the interactive version of the application called gxtwist++ is most useful. To start the simulation in interactive mode, simply set up your shell environment for running GlueX software and invoke gxtwist++ from this shell. After printing the usual Geant3 log messages, the following prompt is displayed.

<literal>
  • *
  • W E L C O M E to P A W++ *
  • *
  • Version 2.14/04 12 January 2004 *
  • *

Workstation type (?=HELP) <CR>=1 :

</literal>