This page gives a tutorial in the installation and running of GrOptics and CARE. GrOptics is the ray-tracing simulation of Cherenkov photons through the telescope structure into the focal plane of the Cherenkov telescope. The GrOptics simulation ends by storing in a file the wavelength of Cherenkov photons and their arrival times in the focal plane. CARE takes the GrOptics output file and simulates the response of a Cherenkov telescope camera to the Cherenkov photons to the point where digitized photon-detector signals are written to disk.

Installation of corsikaIOreader, GrOptics , and CARE

Prerequisites are a working root installation and the gsl package installed. Root is the analysis framework used by the majority of particle and astroparticle experiments. The installation described here is for a linux box, which makes the most sense because most simulations will require the execution one a cluster with >100 nodes.

GrOptics and CARE can be downloaded as git repositories by executing the following commands on your linux box:
git clone http://www.gtlib.gatech.edu/pub/IACT/GrOptics.git
git clone http://www.gtlib.gatech.edu/pub/IACT/CARE.git
Note that these are read-only repositories. You will not be able to upload changes of GrOptics and CARE to the repository. If you have made changes to the code and want to see them migrate into the distributed packages get in touch with the authors.

We will also need the corsikaIOreader. CorsikaIOreader reads in the Cherenkov photons simulated with corsika, applies atmospheric absorption, and directly pipes the Cherenkov photons into the optics simulation.

CorsikaIOreader installation

Download corsikaIOreader from this page https://wiki-zeuthen.desy.de/CTA/CorsikaIOreader. Extract the archive and compile it by executing make.

 GrOptics installation

The GrOptics root directory contains a README directory with the user manual UsersGuideGrOptics.pdf, which also includes some more detail on the installation. But in a nutshell it is as simple as executing make on the command line. In case the code does not compile and make quits, try changing all “&&” to “;” in the Makefile and everything should work just fine. You should have an executable called grOptics in the GrOptics root directory.

CARE installation

Prerequisites for a working CARE installation are root and a working VBF installation. VBF is the VERITAS raw data format. The library is distributed with CARE. To install VBF go to into the CARE root directory and unpack VBF archive
tar -xzvf  VBF-0.3.3.tar.gz
go into the VBF directory and configure the code
./configure –prefix=$PATHTOVBFLIBDIRECTORY
followed by a make and a make install.
In your .bashrc or whatever config file is the one that goes along with your shell add

where $PATHTOVBFLIBDIRECTORY is the directory that you have given as
argument to the –prefix option in the configure command.

Now it is time to compile CARE. Type make. This will create the executable CameraAndReadout

Executing your first GrOptics and CARE simulation

Now lets simulate the response of a four Cherenkov telescope array to a few gamma-rays.

First download or create a corsika file with some simulated gamma-ray showers. The file contains Cherenkov photons with their arrival directions and arrival times.

Next step is to unzip the file
bunzip2 -c DAT${SRUN}.telescope.bz2 > DAT${SRUN}.telescope

Running GrOptics

Now you have to run the corsikaIOreader and GrOptics. Lets move into the groptics directory (yes you have to execute GrOptics from within its installation directory).

Create a symbolic link to the atmospheric absorption files in the corsikaIOreader directory.

Now we are ready to run GrOptics
${IOREADEREXECUTABLEDIR}/corsikaIOreader -queff 0.50 -cors DAT${SRUN}.telescope -seed ${SRUN} -grisu stdout -abs ${ATMOSPHERE} -cfg ${DETECTORFILEIOREADER} | ./grOptics -of DAT${SRUNOUT}.root -p ${GROPTICSPILOTFILE}
where ${IOREADEREXECUTABLEDIR} is the path to the corsikaIOreader directory. Remember that we execute the above line in the GrOptics directory.
-queff 0.50
is the global quantum efficiecy applied. Its main purpose is to reduce the number of photons that have to be ray traced.
-cors DAT${SRUN}.telescope gives the corsika input file, which goes by the name  DAT${SRUN}.telescope .
-seed ${SRUN} is the random seed for which the run number ${SRUN} is used.
-grisu stdout  tells the reader to output grisu format which is the format GrOptics takes as input.
is the atmospheric model used to calculate the atmospheric absorption.
gives the locations of the telescopes. Note that the same corsika file can be used to simulate different arrays. From the detector file only the TLLOC configurations are used by the reader. This is the example file for VERITAS:

Telescope location in the field (TLLOC) the parameters are:
   -the telescope identification number
   -the X (oriented towrd east) location cordinate in meters.
   -the Y (oriented toward north)location cordinate in meters.
   -the Z (oriented toward up) location cordinate in meters.
   -the telescope rotation offset in meters.
        The telescope rotation offset is the distance below the focal point
        of the mirror along the optical axis about which the telescope
        rotates. (intersection of the elevation and azimuth axis)
   -the pointing offset in the x direction
   -the pointing offset in the y direction

Z coordinates set to zero for compatibility with Corsika; may want nonzero
values with full grisu chain.

* TLLOC 1     135.48 -8.61 0.0 12.0 0.0 0.0
* TLLOC 2      44.1 -47.7 0.0 12.0 0.0 0.0
* TLLOC 3      29.4  60.1 0.0 12.0 0.0 0.0
* TLLOC 4     -35.9  11.3 0.0 12.0 0.0 0.0

Note that only the x and y coordinates are used by the reader. Only lines beginning with “*” are read by the reader. All other lines are treated as comments.

The second part of the command line executes GrOptics. -of DAT${SRUNOUT}.root gives the name and location of the output file that GrOptics will create. -p ${GROPTICSPILOTFILE} is the pilot file to steer the optics simulation.

Running CARE

CARE configuration file, file with lowgain pulse shapes, file with high gain pulse shapes

In the last step of this tutorial we execute the simulation of the camera and readout CARE. Go into the CARE directory and execute. Note that it is not mandatory to execute CARE from within its installation directory.
./CameraAndReadout NSBRATEPERPIXEL “0 120” –notraces –seed ${SRUN} –configfile ${CONFIGFILE} –outputfile ${FINALDIR}/CARE${SRUN} –inputfile ${GROPTICSFILESDIR}/DAT${SRUN}.root –vbfrunnumber 10000 –writepedestals 1

NSBRATEPERPIXEL “0 120” is a configuration parameter of CARE. Translated the command gives the instruction that all telescopes of type 0 have to be simulated with a background photoelectron rate of 120 MHz per camera pixel. In this tutorial all four telescopes are of the same type. Having this option given in the command line instead of the configuration file allows to efficiently simulate different background levels by making changes to submission script instead of having to write numerous configuration files. Every configuration parameter of CARE can be given in the command line.
–notraces turns of the option to write traces into the root output file. CARE always generates a root output file that allows easy access to all simulated data.
–seed ${SRUN}
the seed for the random number generator. It is good practice to use the runnumber as seed
–configfile ${CONFIGFILE}
The CARE configuration file
–outputfile ${FINALDIR}/CARE${SRUN}
The output file name. Do not specify an ending .root or .vbf
–inputfile ${GROPTICSFILESDIR}/DAT${SRUN}.root
The file simulated with GrOptics
–vbfrunnumber 10000
The runnumber written into the vbf file if a vbf file is written. The option to write a vbf file is given in the configuration file
–writepedestals 1
turns on the simulation of pedestal events.