Project

General

Profile

TestBeamSim

Contact: Tom Stuttard (UCL) -

Overview

A simulation of the g-2 tracker prototype test beams in January and April 2014 have been developed. This simulation contains:

  • The beam time and position profile (based of FNAL beam complex)
  • The straw DAQ readout cycle (simplified)
  • Two straws in a doublet
  • Response of straws to proton hits (either by basic model, or by reading in GARFIELD data)
  • Noise (uniform or sinusoidal)
  • Data output in ROOT file with correct TDC data format (can be used directly in TestBeamAnalysis.cc)

The simulation does not contain:

  • True numbers of straws (only one doublet, so only one plane)
  • The stereo angle of the straws (only matters if beam is not polar symmetric, e.g. RMS different in x,y)
  • Multiple scattering, showering, etc
  • Variation in beam angle
  • Models of the ASDQ/TDC (although GARFIELD data that is used as an input might)

User guide

Running the sim

The test beam simulation is in the file tracker DAQ repo, see here for more info on this, including how to get it, compile it etc. An important step is that you will need to setup the environment correctly for your system in trackerDaq-setup.sh, and this file must be sourced at each new login. This file must point to a CLHEP installation, which is a requirement of the sim not imposed on the rest of the repo.

The sim code is in the file software/src/TestBeamSim.cc.

To compile it, use the following command in software/src:

make analysis
make sim

The executable will be in software/bin/TestBeamSim.exe.

There are some command line arguments required to run the sim, see the following examples (or just run the file without any and check the console output):

  ../bin/TestBeamSim.exe GARFIELD=N CARDS_FILE=../cfg/TestBeamSim.cards OP_FILE=TestBeamSim.root
  ../bin/TestBeamSim.exe GARFIELD=Y CARDS_FILE=../cfg/TestBeamSim.cards IP_FILE=GarfieldData.root OP_FILE=TestBeamSim.root

These arguments are:

  • GARFIELD (Y/N) - toggles whether to interface with GARFIELD for drift times or generate them internally (GARFIELD better but slower)
  • CARDS_FILE - file containing parameter values to be parsed
  • INPUT_FILE - input ROOT file from GARFIELD (if required)
  • OUTPUT_FILE - the path and name of the output ROOT file for simulation data and histos

The cards file is used to set parameter values in the simulation without needing to recompile. An example is given in the tracker DAQ repo in software/cfg/TestBeamSim.cards. This contains comments to explain the contents.

Outputs

The simulation output is a ROOT file containing two main things:

  • Histograms showing the simulation results (hit times, positions in all straws etc)
  • The simulated TDC hits in a ROOT tree in the real TDC data format
    • Note that some branches are not filled, but everything required by TestBeamAnalysis.cc is

The output ROOT file can be used as the input to the test beam analysis code software/bin/TestBeamAnalysis.exe. See here to details of this, and note that the DATA_TYPE=SIM argument must be used when running on sim data.

Using GARFIELD data as an input

It is possible to use GARFIELD simulated data as an input to the simulation. The simulation runs as usual, but uses the track position and corresponding drift distances/times from the GARFIELD output ROOT file to fill this values in the simulation rather than generating its own.

At present, this system is pretty clunky. A GARFIELD sim must be run using the doublet GARFIELD setup for g-2, the output .dat file must be converted to a ROOT file, and this must be specified in the test beam sim. Also, some parameters need to be entered in both the GARFIELD and test beam sims, leading to potential for errors.

I hope to develop this system in the near future to be much cleaner, hopefully finding some way to directly interface to GARFIELD as part of the test beam sim. I will try this shortly, so will not cover this functionality for now.