wiki:IngredientsSpectrum

Version 9 (modified by Daniela Dorner, 5 years ago) ( diff )

--

starting new instructions here

steps

  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

example

step 1

e.g.: mysql --defaults-file=.mysql.pw.ethz.factdata -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

e.g.

./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

dorner@LaMouette:~/FACT.analysis/spectrum$ cat ontime-vs-zd.sql SELECT

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

FROM

RunInfo

WHERE

FileID IN ($FileID

then

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)

Ingredients

  • 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: https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/mc/ganymed.C?rev=17733#L169

Get Energy Parametrization

To get an energy parametrization, you may plot image parameters vs MC-energy and use https://trac.fact-project.org/browser/trunk/Mars/macros/optim/optimenergy.C 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: http://www.astro.uni-wuerzburg.de/wikineu/index.php/How_to_plot_image_parameters

To get an idea which other image parameters are available, you may look at the classes MHillas.cc MHillasExt MHillasSrc MImagePar MNewImagePar MNewImagePar2 in https://trac.fact-project.org/browser/trunk/Mars/mimage 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: https://www.fact-project.org/logbook/showthread.php?tid=4695

optimenergy.C

As input you need a MC ganymed file.

The parametrization is defined in

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

With

opt.AddParameter("MHillas.fSize");

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. https://www.fact-project.org/logbook/showthread.php?tid=3009 or https://www.fact-project.org/logbook/showthread.php?tid=2883&page=3 and others

Spectrum

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 https://www.fact-project.org/logbook/showthread.php?tid=2761

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'.

e.g. https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/mc/ganymed.C?rev=17733#L65 https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/mc/ganymed.C?rev=17733#L70

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: https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/ganymed.C?rev=18753#L61

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.

see https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/ganymed.C?rev=18753#L82

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).

e.g. https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/mc/ganymed.C?rev=17733#L169

Note: See TracWiki for help on using the wiki.