tbsim : Test Beam Simulation

This is a short, well after the fact, list of some pointers to this program, which is a slightly modified version of glastsim.

The code is available via the checkout package tbsim

Like glastsim, it can write the hit/digi information into an .irf file, or read same back for analysis, to the standard (pre AO) tuple.

An example .irf file, with one event for a straight-through muon,  can be examined here.

The special identifiers for detector elements are defined in the XML file glast.prs revision 1.1.2.2, which can be generated by tbsim to allow instantiation of the GlastDetector objects to read back the .irf, for example by the program ROOTWriter.

The standard read routine for the .irf is instrument/ResponseFile::readEvent. It reads the first element of a record, the detector id. If the id is not recognized, the corresponding GlastDetector object does not exist, it skips to the next record, searching for the record separator character ("|"). If the id is recognized, then  the appropriate "backward" function is called with the detector as a parameter, which reads the rest of the record. [This is an example of the OO "visitor" pattern.] For example, for the tracker,

void    ResponseFile::backward (SiDetector& d)
{
  if (good()) {
  float maxE;
  *this >> maxE;
  d.maxELoss (maxE);

  int count;
  *this >> count;

  while ((count--) && (good()))
  {
    int id;
    float e;
    bool noise;
    *this >> id >> e >> noise;
    d.addStrip (id, e, noise);
  }
}

So consider the following record from the example above:

404 3.79825 1 1099 3.79825 0 |

The detector id is 404, corresponding to a SiDetector object. The maximum charge deposited in any strip is 3.79825 fC. This is the deltaE in GeV divided by the factor, 3.4875E-5 GeV/fC. This constant is unfortunately wired into the function glastmedia/SiDetectorMed::getEloss. There is one strip, number 1099, which gets all the charge, and it is not a noise hit (0 instead of 1). The ids corresponding to the tracker are 404-435 at z = -2.84  to -51.22.

Other ids are: 1: the MC truth info, 2, the first log, 3-5, diodes on the first log, etc. All this information and the geometry is in the glast.prs XML file.

MC truth: id 1

Here is the record from the simple muon example:

1 136 mu+ 5 -9 6 138 0 0 -999999 -12.6188 20.2237 0 0 0 22.5057 1.46247 2 0 -13 8 0 0 -5104564 -1044 591 13820 1 -13 3 0 0 -5104564 -2289 -3 -99999 0|

The fields are:

Then it gets a little fuzzy. The code that wrote it, and should eventually read it back, is glastflux/src/FluxGenerator. It can be truncated at this point.


23-Mar-01 T.Burnett