starting new instructions here


  1. selection of data sample (by hand or script)
  2. obs-vs-zd distribution of these runs
  3. get number of MC events in zd bins


step 1


mysql -s -e "SELECT FileId FROM RunInfo WHERE fZenithDistanceMax<30 AND fRunTypeKey=1 AND fSourceKey=5 AND fThresholdMinSet<350 AND fR750Cor/fR750Ref BETWEEN 0.93 AND 1.3 AND fNight BETWEEN 20190101 AND 20190229" > dataset.txt

step 2


./rootifysql -C rootifysql.eth.rc /home/dorner/FACT.analysis/spectrum/ontime-vs-zd.sql --list.FileID=/home/dorner/FACT.analysis/spectrum/dataset.txt /home/dorner/FACT.analysis/spectrum/ontime-vs-zd.root

with ontime-vs-zd.sql:

  TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn as ontime,
  fZenithDistanceMean as zd
  FileID IN ($FileID)


root [0] TChain c("Result")
root [1] c.Add("/home/dorner/FACT.analysis/spectrum/ontime-vs-zd.root");
root [2] c.Draw("zd>>dis(90,0,90)", "ontime");

step 3

room for improvement

  • get zd-distribution events-wise

old stuff below

Amit asked me to write down the basic notes of the tutorial on creating a spectrum which I gave him few days ago. As I thought it might be useful for other people as well, I decided to put it in the trac. However please keep in mind that this is far from being complete, might contain information that is valid only now and that it has not been checked for mistakes.

remark: this tutorial is referring to Mars from June 2018 (rev 19018)


  • energy-estimator
  • ganymed-output for data
  • ganymed-output for MC
  • macro to calculate spectrum

Basic Steps and Rules

  1. Prepare ingredients
  2. MAKE SURE to
    • use star files produced the same way for data and MC
    • use the same cuts for data and MC
    • use the same disp parametrization for data and MC
    • use the same energy estimator for data and MC
  3. optimize energy parametrization
  4. run ganymed for data and MC
  5. run macro for spectrum

Energy Estimator

To estimate the energy there are different methods. E.g. you can use neutral nets or random forrest. Here I will refer to the very basic approach of an energy parametrization.

Once you have an energy estimator, you implement it in ganymed e.g. like this:

Get Energy Parametrization

To get an energy parametrization, you may plot image parameters vs MC-energy and use to optimize the coefficients.

The macro in the svn contains a very basic example using only the image parameter Size in the parametrization.

Start with this and then add more image parameters.

more image parameters

To find out which other parameters to use and which formula to use, plot the residual (Emc - Eest) versus an image parameter of your choice.

For example you can plot the image parameters like this:

To get an idea which other image parameters are available, you may look at the classes MHillasExt MHillasSrc MImagePar MNewImagePar MNewImagePar2 in Not all of them might be relevant for FACT, but for most of them you can find a description in the class.

Parameters relevant for the energy estimation: Size, Zd, Leakage, Dist and maybe some others.

An example for plots and energy parametrization here:


As input you need a MC ganymed file.

The parametrization is defined in

char *r = "[0]*M[0]";  



further image parameters are added.

You can also change the slope and add cuts.

More examples can be found at ISDC in /home/isdc/dorner/e_est/optimenergy.C

It is recommended not to optimize all coefficients at once. Examples for the procedure can be found as well in the datacenter forum in the threads about disp optimization e.g. or and others


A macro to get a spectrum can be found at /home/isdc/dorner/get_spectrum/spectrum.C

remark: so far it does not yet calculate errors.

Input: ganymed files from data and MC

Consistent Processing of MC and data

same processing

MC and data should have been processed in the same way (signal extractor, calibration, image cleaning, ...)

For ganymed, you need star-files as an input. Make sure to use star files from MC and data that had the same processing.

Information on the different processings can be found in wiki:Processing and

MC at ISDC can be found at /gpfs0/fact/monte-carlo/dortmund/

To be able to get the efficiency from the MC files without the need to read the ceres files, we added the MC information to the star files in /gpfs0/fact/monte-carlo/dortmund/star_full_newcl

remark: as the MC are processed with the new extractor while at La Palma the spline extractor is used, it is currently advised to use only ISDC analysis for spectrum calculation

same ganymed

Make sure to use either the same ganymed macro or the same setup in the ganymed macro for data and MC.

In the ganymed macro there is three things that you should make sure are the same: cuts, disp and energy estimator

same cuts

The quality cuts are defined as 'contq' and the background suppression cuts as 'cont0'.


Make also sure that you use cuts that have been optimized for the image cleaning you used.

e.g. old cleaning: /home/isdc/dorner/Tutorial.April2018/ganymed_LP.C new cleaning:

same disp

Make sure to use the same disp parametrization for data and MC. If you don't optimize a disp parametrization yourself, make sure to use the disp parametrization that has been optimized for the cleaning that you are using.


Both version are available there, you just have to use the correct one.

same energy estimator

Use the same energy estimator (same method, same file/formula).


Last modified 3 years ago Last modified on 11/21/19 12:09:22
Note: See TracWiki for help on using the wiki.