The file, analysis.pilot, contains input information for analysis.c. A line with no asterisk is a comment line. The comments in the file make it self-explanatory (hopefully). Should you wish to use a pilot file with a different name, just enter the name of the file on the analysis command line. If there is no name on the command line, the default is analysis.pilot. The following table shows an example analysis.pilot file.

(the gain time files and pedestals are documented here. This section discusses the analysis.pilot input file).

The format of the .rcs output file is given at the end of this html file. The format is also listed in GrISU/Analysis/rcs_output_list. You can convert this file to a root tree using the conversion code in GrISU/Utilities/Datahandler/

To see the format of the .par file output, have a look at the analys_out procedure in analysis.c

                  --- GrISU ANALYSIS PILOT ---
20feb06: changes
Pedestal file printout option for PEDOP option 0 (see below)
Different option numbering for reconstruction methods
Different options for functions to use in reconstruction method 4
The .rcs file format is given in the Analysis/rcs_output_list file.
 Datahandler class useful for moving .rcs output files to a root tree. (see README and code examples in the new Utilities/Datahandler directory).

NOTE: must use compile option "make stereo" to use reconstruction methods.
The standard option in "make_them_all" does not include the "stereo" option; move to Analysis and "make stereo" to include reconstruction methods.

This file is used to tell the analysis.c which files
to read and to provide operational parameters for the code
Any line not starting with a '*' is a comment line.
Any file name or parameter(s) must be preceded by a 5 character flag.
Extensive comments are included in this file.

ARRAY:  array configuration file.(no default)
DATTA:  data file (default stdin)
OUTPU:  output file (default stdout)
KUMAC:  kumac output file for PAW. (default, no file produced)
LOGBK:  analysis logbook file (default, no file produced)
MATLF:  output file for use with matlab graphics (default, no file)

* ARRAY   ./Config/Files/veritas4tel.cfg
* DATTA   ./Data/Raw/photon.rec
* KUMAC   ./Dump/photon_analysis.kumac
* OUTPU   ./Data/Processed/photon.par
* LOGBK   ./Data/Processed/analysis.log
* RCSFI   ./Data/Processed/photon.rcs 
  MATLF   photon.m

FADCI start_sum stop_sum1 stop_sum2 ( no defaults for fadc input)
Not used for QADC option, but record must be active
* FADCI 10 19 24
 FADCI 30 40 50

CLEAN option pic_thresh bound_thresh pic_thresh bound_thresh
      (default, no cleaning)
use option 0 for whipple configurations
 CLEAN 1 64 32 25 14
* CLEAN 0 7.0 3.5  4.0 2.0
 CLEAN 0 4.0 2.0 4.0 2.0
 CLEAN 0 4.0 2.0 4.0 2.0

PEDOP option:
       num_cumul_recs file_name,
The print-flag only applies to option 0. A print_flag = 1 produces a ped/pedvars file with filename given as the last field in PEDOP.
That is, for option 0, you may choose to print a peds/pedvars file. For FADC option, the file shows the telescope number, the pixel number, the average pedestal value for one time bin, the pedestal std for the narrow FADC integration window, and the pedestal std for the wide FADC integration window.
For the QADC option, the file shows the telescope number, the pixel number, the average pedestal value, and the pedestal std.

use option 0 for whipple configurations. 
(default: option 0)
* PEDOP 0 8 1500 1 pedestal.txt

GAINT option num_events threshold file_name
(default:option 0)
 GAINT 0 100 3 gaint1.txt

here are reconstruction parameters

RECST option: choose an analysis method (see bottom of pilot file for more details) (normally use option 1, option 2, or option 4).

     RECST 0 0 0 0 0 0
  RECST 1 0 0 0 0 0
* RECST 0 1 0 0 0 0
     RECST 0 0 1 0 0 0
     RECST 0 0 0 1 0 0
     RECST 0 0 0 0 1 0
  RECST 0 0 0 0 0 1

IMGRQ list: number of images required for method number, list for
methods 1, 2, 3, 4. Defaults are 3, 3, 4, 3
* IMGRQ 2 2 2 2

image cut parameters to choose images for method selected by RECST. Units are degrees for shape parmeters, distance, and alpha 

shape cuts: min_width max_width min_length max_length
(defaults: 0.0 1000.0 0.0 1000.0)
* CUTSH   0.05 10.0   0.0 12.0

orientation and position cuts: min_dist max_dist min_alpha max_alpha
(defaults: 0.0 1000.0 0.0 180.0)
* CUTOP   0.5 1.0   0.1 90.2

size related cuts: min_size ntubes max1 max2 max3 lenoversz_min
lenoversz_max (lenoversz = length over size)
(defaults: 0.0 0   0.0 0.0 0.0   0.0 1000.0)
* CUTSI   10.0 5   0.0 0.0 0.0    0.0 1000.0

Method 1 and 2: minimum angle (in degrees) between image lines
to retain fit. (angle in degrees).
default 10.0 degrees
* MINAN 15.0

Method 4 parameters for simplex fit
For example, you could fix xs and ys to their initial values and let
ximpact and yimpact vary in the simplex fit.
if ifree = 1, parameter varies; = 0 parameter fixed at initial value
parameter order: xs, ys, ximpact, yimpact 
* IFREE 1 1 1 1

Method 4 simplex fit lengths, first two are mm on the camera for S,
last two are meters on the array plane for P (impact point).  I've
only tried these values, both maybe too small.
* DELTA 0.5 0.5 10.0 10.0

Convergence criteria and maximum number of iterations for Method 4 (see gsl documentation).
defaults 0.02 500 0.02 500
* CONVR 0.02 500 0.1 2000

FUNC4: Method 4 function options: (use only 1 and 2 for now)
   0: minimize: ignore for now
   1: minimize: global image width  (in degrees on the camera)
   2: minimize: global shower width (in meters on the telescope plane)
   3: minimize: ignore for now
   4: minimize: ignore for now
* FUNC4 2

Starting x range and xinit for method 3 minimizer: xlow,xhi,xinit in
degrees. In the code all camera locations are stored as mm on the
camera and then converted to other units as needed.
 default -3.0 3.0 0.0
* START -3.0 3.0 0.0

for GrISU simulation input to analysis, print comparison with simulation shower location and impact point in array plane to rcs output
0 (default): do not print.  1 print


If an array configuration file, a condition of operation file, or the output file name is not provided, the program will stop. If more than one of each are provided, only the first instance of each will be used.

The FADCI parameters specify the integration ranges for FADC record.
All are given in sample position numbers starting at 0 for the
first sample. A time offset correction is applied according
to the time offset specified in the configuration file. Sum1 is from
start_sum to stop_sum1 inclusive;
sum2 is from start_sum to stop_sum2 inclusive.

The CLEAN parameters specify image cleaning option and parameters.
-option: 0 cleaning thresholds in unit of pedestal width
         1 cleaning thresholds in digital counts
-picture and boundary threshold for the  first integration.
-picture and boundary threshold for the second integration.

The PEDOP parameters specify pedestal operation options and parameters.
    0: use pedestal records in the input data stream (see * DATTA)
    1: read peds file, filename follows (hasn't been carefully tested)
    2: write peds in an output file (filename given in this record)
    3: calculate peds for each input record, no cummulated value
-The number of initial fadc samples used to determine peds, used
         in options 2 and 3 above,
-The number of cummulative records for calculating pedestals,
      for option 2, default (0) no limit. If the end of file is encountered before reaching the required number of records, the current pedestal information will be written to the output file.
-print-flag: applicable only for option 0, prints ped/pedvars file with filename given in the next field

The GAINT line specifies the gain and timing operation options and parameters.
    0: Use gain factors and  time offset in the configuration
        file for corrections.
    1: read gain file. Gain and timing information will be used
        in the analysis
    2: Write gain and timing information on the output. This should be used with laser or nitrogen-flasher like data
-number of events required to determine gain factors and time offsets
-threshold on the pulse for it to be used in the averaging
-file name for reading gain and timing information.

analysis methods should work for arrays of up to 5 telescopes. The number of telescopes is only limited by computer memory. To increase the number, change the define statement in the definition files that sets the maximum number of telescopes.

RECST: flag = 1 activate analysis method, 0 deactivate, in following order med1flag med2flag med3flag med41flag med42flag med43flag

method1 : use image axes and perpendicular fit to estimate source position. Makes use of usual Hillas parameters. To find impact point, assume source location at (0,0) and use perpendicular fit on ground using lines on the ground with slopes given by slopes of lines from image centoids and (0,0).  

method2 : use image axes and perpendicular fits to estimate source and impact positions. Makes use of usual Hillas parameters. Use two perpendicular fits, one to find the source position and one to find (using the source position) to find the impact point. Standard deviation is sqrt( average of distances squared from the point to the line). See routine perpendicular_fit for details.

method3 : use only image centroids and at least four images for exact calculation of source position and impact location. I'm concerned about the number of showers (two of my four test showers) that show no minimum using the gsl-minimizer. I plan to add a minimizer like that in the matlab routine to see if there's agreement.

method4n: full multiparameter minimization using pixel data to determine source location and impact point. Requires at least three images and initial positions of source and impact from med1,med2, or med3.  Thus n can be 1, 2, or 3 to select the method for determining initial estimates. We need to do use various convergence criteria with different values of the initial simplex points to see what works best.

global image width: given the reconstructed source point and the
reconstructed impact point, determine the perpendicular
distance from the pixel to the image axis. Determine the rms value of this distance using the number of digital counts as a weighting factor. This value is the global image width.

global shower width: given the reconstructed source point and the
reconstructed impact point, for each image determine the perpendicular distance (in meters) between the shower axis and a line from the telescope to the pixel position on the sky. With the number of digital counts in each pixel as the weighting factor, determine the rms value of this perpendicular distance.  This value is the global shower width. 

The accuracy of the reconstruction is strongly dependent on the cuts selected and the cleaning thresholds. Strong cleaning, a reasonable minimum for ntubes, i.e. 6, and some restrictions on distance appear to work best. (more later on this).



Use code in GrISU/Utilities/Datahandler/ to transfer .rcs output file
to a root tree.

output format of .rcs output file from analysis.c (after "make stereo")

1  event_id/I                       event identification number
2  nbr_tel/I                        number of telescopes
3  array_trig/I                    array_trigger flag
4  num_loc_trig/I               number of local triggers
5  trig[tel]/I  5,6,7,8 for four telescopes, local_trigger flag  
9  rcs_meth+num/I  
10 num_images/I                number of images used in

11 image[tel]/I    11,12,13,14 for four telescopes, image flag

15 xs                         reconstructed source location(x)
16 ys                         reconstructed source location(y)
17 stds                     source location std
18 src_dist = sqrt(xs_deg*xs_deg + ys_deg*ys_deg) source
19 ximp                        reconstructed impact point (x)
20 yimp                        reconstructed impact point (x)
21 stdp                        impact point std
22 imp_dist = sqrt(ximp*ximp + yimp*yimp) impact point distance
23 glbwid                       global image width (mm on camera)
24 gblwid_std                global image width std
25 gblwiddeg                 global image width (deg.on camera)
26 gblwidstddeg            global image width std (deg.on camera)
27 gblwidmeters            global shower width (meters on tel.plane)
28 gblwidtmeters_std    global shower width std (meters)
29 avgsize                     average image size
30 avgsizestd                average image size std
31 avgheight                  average shower height
32 avgheightstd             average shower height std

33 size                        Hillas parameters
34 len_deg
35 wid_deg
36 dist
37 xc_deg
38 yc_deg
39 phi
40 ntub/I
41 max0
42 max1
43 max2
44 alpha_deg
45 asym
repeat above 13 parameters for each telescope

85 xsMC                 true source position(x) in
86 ysMC                  true source position(y) in degrees    
87 del_srcMC          distance (deg) between recons. and true
88 ximp_rotMC         true impact position in telescope plane (x)
89 yimp_rotMC         true impact position in telescope plane (y)
90 del_impMC          distance (meters) between recons. and true
                                impact point on the telescope plane.
91 energyMC           true energy (TeV).

92 telxr              telescope location (x) in rotated (telescope)
93 telyr              telescope location (y) in rotated (telescope)
94 telzr              telescope location (z) in rotated (telescope)



repeat above three parameters for each telescope