Table of Contents
starting new instructions here
- selection of data sample (by hand or script)
- obs-vs-zd distribution of these runs
- get number of MC events in zd bins
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
./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
SELECT TIME_TO_SEC(TIMEDIFF(fRunStop,fRunStart))*fEffectiveOn as ontime, fZenithDistanceMean as zd FROM RunInfo WHERE FileID IN ($FileID)
root  TChain c("Result") root  c.Add("/home/dorner/FACT.analysis/spectrum/ontime-vs-zd.root"); root  c.Draw("zd>>dis(90,0,90)", "ontime");
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)
- ganymed-output for data
- ganymed-output for MC
- macro to calculate spectrum
Basic Steps and Rules
- Prepare ingredients
- 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
- optimize energy parametrization
- run ganymed for data and MC
- run macro for spectrum
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
As input you need a MC ganymed file.
The parametrization is defined in
char *r = "*M";
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
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
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
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
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: https://trac.fact-project.org/browser/trunk/Mars/fact/analysis/ganymed.C?rev=18753#L61
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).