This is arbitrary, but I would suggest one (mine).
Several kinds of data are stored at PIC. The main page for access is http://magic.pic.es/priv/data/. To start your own analysis, you need to download the star data first, for both telescopes (*_M1_*_I_*root and *_M2_*_I_*root). By following the link in the webpage one reach a query webpage http://magic.pic.es/priv/data/Query/.
Once you selected you source you are redirected to a webpage like this (for HESS 1857). It is important to check the version of the atar files: v1, v2, v3. From the query, you are redirected automatically to the latest. A newer version mean that some bugs were corrected. If you don't find the version with the corrected bug, either you wait for the PIC re-starification or you download the callisto files http://magicdoor.pic.es/Data/Star/v2/HESS1857+026/. Please also check about possible name mistakes in your source (for example your source has received two names like HESS1857+026 and HESS1857+026+C06).
In this page, data are stored by day. Now if you want to download one day, you can do the following. In your root directory,
mkdir 2010_09_01 (create a directory with that date you want to download) cd 2010_09_01 (enter the directory) wget --user=MAGIC --password=wow217mt -r -nd -l1 --no-parent -A '*root' http://magicdoor.pic.es/Data/Star/v2/HESS1857+026/2010_09_01
(of course, change the date and the source name accordingly). And then repeat this for each day of the datataking or make a script (I have one). There is a .rep file for each run produced by Arehucas. All .rep files are stored again in http://magic.pic.es/priv/data/CCdata/. You should counter-check that they agree with the star data at PIC (sometimes they don't and you analyze less data). If you make a script that does so, please circulate the MAGIC community!
Several parameters important for the characterization of the quality of the data are encoded in each events singularly. For this reason, it is often common to consider just the averages over an entire run. A code called quate do so quite well. On the other hand, in the official version, it does not calculate the Hillas parameter separately. For this reason I used a modified version of quate. To modify it, you also have to modify the files MRunSummary.h and .cc in the folder $MARSSYS/mreport/ accordingly. After that, you have to recompile MARS.
Quate must be run in the star data directory. I normally group data according to cycles if they are spread on different cycles. Another idea could be according to hardware changes. In order to group data, you can use easily simbolik links:
mkdir p_94 (create a directory for all data in that period) cd p_94 ln -s ../2010_07_12/20*root .
The quate usage then is
quate --useM1 --events --sizelow=100
where
A typical error that occurs is the following:
../20100715_M2_05008634.001_I_HESS1857+026-W0.50+030.root Error in <TTree::SetBranchAddress>: unknown branch -> MAnalysisProblems. Error in <TTree::SetBranchAddress>: unknown branch -> MPyrometer.
This happens because for this file the Pyrometer branch and and other one, which I do not know what it is, are not present. On the other hand, the macro does not clash, and it is not a major problem anyhow because quate calculates average over the run. A reason for this could be that the Pyrometer report, which are not taken event by event but every 1 second, are written only in a fraction of the runs, but I don't know.
As a result of quate, an output file Out_M1.root and Out_M2.root are created (you have to do it twice, one per telescope). Now, one can rapidly check the distribution of average run values by opening "Out_M1.root" with a ROOT TBrowser.
By now, pasta is not working for me, so I do not use it to easily see the average values.
SuperStar is an executable in MARS that converts two star files with individual-image parameters (*_M1_*_I_*root and *_M2_*_I_*root) to a Stereo-Parameter file (*_S_*root). It performs the stereoscopic reconstruction of the shower parameters (direction, ground impact, altitue...etc.) and can also reconstruct the energy from lookup tables. So far, the input card must be present, but it should be an empty file (ah ah ah!). SuperStar reconstructs some parameters thanks to the stereoscopic view of the shower. These parameters are store in the container MStereoPar. The shower incident direction and ground impact are reconstructed as the crossing points of the two image major axes. The poiting correction are taking into account in this calculation.
Superstar can also do an energy reconstruction based on look-up tables built from MC. As of now, the building of the look-up tables is done by a macro (see Dortmund workshop). Exemple of lookup table can be found here: File:Energy Table M1.root and File:Energy Table M2.root
To launch superstar with energy reconstruction, just execute the following command:
superstar -f --ind1=<input dir of M1> --ind2=<input dir of M1> \ -erec --etab1=Energy_Table_M1.root -- etab2=Energy_Table_M2.root \ --config=./superstar.rc --out=<output dir> --log=superstar.log
To launch superstar without energy reconstruction, just execute the following command:
superstar -f --ind1=<input dir of M1> --ind2=<input dir of M1> --config=./superstar.rc --out=<output dir> --log=superstar.log
In some cases, you may want to use the standard RF matrixes without producing them by yourself. You may use the official LUTs/RFs, here you will find a folder named Cycle_VI_Analysis_28_06. This means the files (RF,tables etc) you can find there were build to analyse recalibrated and crosstalk corrected Data (all data taken from CycleVI on). "28_06" means I started to build this Analysis set on that date. All details you might want to know are (hopefully) collected in the "notes" file in the same folder. The structure of the sub-folders is chosen to avoid confusion (i.e concerning DISPRF files which have the same name for M1 and M2). The site is protected by the usual password. If you have any problems concerning this feel free to ask me (Julian K email:jkrause@mppmu.mpg.de). You need to download:
With all these files you can then run melibea on superstar data:
melibea -q -f -b -a --calcstereodisp --config=melibea_stereo.rc --stereo --rf --rftree=RF.root \ --calc-disp-rf --rfdisptree=M1/DispRF.root --calc-disp2-rf --rfdisp2tree=M2/DispRF.root --disp-rf-sstrained \ --ind=superstarDataPath/*_S_*root --out=myOutPath --log=myLogFile.log \ -erec --etab1=Energy_Table_M1.root --etab2=Energy_Table_M2.root
Note: The command-line application of energy reconstruction is new to cvs melibea. With earlier versions, you may specify it in the rc file. Note: The energy like this will end up inMStereoParDisp.fEnergy, not in MStereoPar.fEnergy!
Odie.cuts: STANDARD Odie.eContainer: MStereoParDisp
To know which MC you have to download, you need to know first some pieces of information about your data sample, and precisely:
To know the PSF of the telescope during your data taking period, you may visit this page:
http://magic.pic.es/priv/data/psf_plot.html
From the top plot you get the PSF of the telescope (and read the not below which explains that the MC PSF is slightly smaller than the telescope PSF).
Once you have your star data downloaded you can check the zenith angle distribution. To know which zenith angle bins in the MC correspond to the telescope zenith angle, visithttp://magic.pic.es/priv/data/TaulaZbins.txt.
To get the MC, check the MC production page to see what is there, and download the star (*_I_*) files that match your analysis. If you use a pre-produced random forest, or energy look-up table, make sure you understand what MC it was trained on, so you don't mix these files with your MC. And then you can download the desired MC with the command above explained.
You have to superstar your MC with the command:
superstar -f -mc --ind1=<MC of M1> --ind2=<MC of M1> --config=./superstar.rc --out=<output dir> --log=superstar_mc.log
If you take your random forests (RFs) and energy look-up tables (LUTs) from somewhere else, and know what MC it was trained with, you may move on to the Melibea section. To build your own RF or LUTs, divide your MC into a train sample and a test sample (for the flux and eff. area calculation)! Make sure you understand the following points:
$MARSSYS/mtemp/mmpi/macros/magic2/create_Energy_table.C(<S-files>, <out_path>)
. The tables can be applied to the MC test sample, and data, on superstar or melibea level.$MARSSYS//mtemp/mmpi/macros/magic2/train_stereoDisp1.C(<S-files>, <out_path>/M1/DispRF1.root)
(and ...Disp2..RF2.root)
). For some reason, they must be in different directories for melibea to understand them. You may apply them in melibea to your test MC and data.$MARSSYS//mtemp/mmpi/macros/magic2/mytrain.C(<S-files (MC)>, <S-files (data)>, <out_path>)
. The "data" is the hadron sample, which can be the target data (for weak sources), or other weak, empty or off data that roughly matches the zenith/azimuth range of your data. You may apply them in melibea to your test MC and data.