Running the MARX Simulation
You can have MARX use an SAOSAC ray file instead of its internal HRMA model, however the timestamps assigned to SAOSAC photons are spaced by exactly one second, which is relevant for simulations where pileup is present.
We use MARX as a source of photons because it provides the user with convenient control over the spatial, spectral, and timing characteristics of the photons. Re-implementing all the cool current features of MARX, and the future ones too, sounded like no fun at all! Detailed information on MARX parameters is, of course, in the MARX User's Guide.
As described in Section 6.3 of the MARX User's Guide, you should set the MARX parameter DetIdeal to ``yes'' when the MARX output will be used by a CCD simulator. Also, do not forget that MARX has the unfortunate habit of modifying its parameter file marx.par based on the command-line options you specify.
Note that fluxes in MARX are specified by the parameter SourceFlux in photons/sec/cm2 at the entrance to the HRMA. Choosing a flux appropriate to your investigation can make your brain hurt due to several complications. (Yes, maximizing ``complicating details'' was one of our design goals!)
Note also that the PSU CCD simulator does not attempt to simulate the precise values of gates transmissions, including the effects of EXAFS. Thus, again, this simulator should not be applied where precision quantum efficiency estimates are required. Use the MIT supplied values incorporated into the ASC response matrices in these cases.
marx --dump dir/time.dat | wcand figuring out how many seconds the MARX simulation covered
marx --dump dir/time.dat | tailYou can also determine the MARX output rate by looking at the keyword FLUX (photons per frame) in the event list file produced by the Penn State ACIS simulator. Note that the MARX output omits photons that survive the HRMA and OBF, but then miss the CCD's that MARX is simulating.
fverify dir.evtbut grade 255 events may contaminate the count - ACIS will normally throw away grade 255 events. A better method would be to filter the event list (using Event Browser) to match whatever grades are implied by the definition of your target event rate. The moral is that ``event rate'' is a vague term.
To determine the length of the simulation execute
fverify dir.evtand read off the range of the TIME column. There are 3.34 seconds per exposure.
Note that you will often choose to simulate a small region of an ACIS CCD to speed things along, so you'll see an event rate slightly lower than the larger physical CCD would produce because photons way out in the PSF wings miss the virtual CCD you are simulating. Of course, the real ACIS also produces a small number of un-rejected background events. The CCD simulator can simulate a particle background, but you probably don't want to get into that. MARX can use SAOSAC rays, rather than its own HRMA model, in a simulation. The Penn State ACIS simulator will accept such an SAOSAC-derived MARX simulation, however the flux level in the CCD simulation will not be what you specified in the MARX run. The problem is that MARX 2.04 does not assign appropriate timestamps to SAOSAC photons. In the future, either MARX will be fixed or the Penn State ACIS simulator will be hacked to work around this problem.
You may find it convenient to run MARX from some type of script (csh, perl, etc.). If you decide to use IDL as your scripting language, you'll find the following IDL code interesting. (Change the reference to /bulk/pkg/asc/marx_2.04-dist to the appropriate MARX directory on your machine.)
spawn, '/bin/cp /bulk/pkg/asc/marx_2.04-dist/marx.par .' spawn, 'echo "MARX LOG" > marxlog.txt' num_events = 1000 flux = ... dir = "my_sim" energy = 1.486 f='("marx ExposureTime=0 NumRays=",I0," SourceFlux=",F0," OutputDir=",A,' +$ '" MinEnergy=",F0," MaxEnergy=",F0," DetIdeal=yes >> marxlog.txt")' cmd = string(num_events, flux, dir, energy, energy, F=f) print, cmd spawn, 'echo "' + cmd + '" >> marxlog.txt ' spawn, cmd