| 1 | /* ======================================================================== *\
|
|---|
| 2 | !
|
|---|
| 3 | ! *
|
|---|
| 4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
|---|
| 5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
|---|
| 6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
|---|
| 7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
|---|
| 8 | ! *
|
|---|
| 9 | ! * Permission to use, copy, modify and distribute this software and its
|
|---|
| 10 | ! * documentation for any purpose is hereby granted without fee,
|
|---|
| 11 | ! * provided that the above copyright notice appear in all copies and
|
|---|
| 12 | ! * that both that copyright notice and this permission notice appear
|
|---|
| 13 | ! * in supporting documentation. It is provided "as is" without express
|
|---|
| 14 | ! * or implied warranty.
|
|---|
| 15 | ! *
|
|---|
| 16 | !
|
|---|
| 17 | !
|
|---|
| 18 | ! Author(s): Thomas Bretz et al, 08/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2002
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | void starplot(const char *filename="Gamma_*.root")
|
|---|
| 27 | {
|
|---|
| 28 | //
|
|---|
| 29 | // This is a demonstration program which plots the Hillas
|
|---|
| 30 | // parameter from a file created with star.C
|
|---|
| 31 | //
|
|---|
| 32 |
|
|---|
| 33 | //
|
|---|
| 34 | // Create a empty Parameter List and an empty Task List
|
|---|
| 35 | // The tasklist is identified in the eventloop by its name
|
|---|
| 36 | //
|
|---|
| 37 | MParList plist;
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 | MTaskList tlist;
|
|---|
| 41 | plist.AddToList(&tlist);
|
|---|
| 42 |
|
|---|
| 43 | //
|
|---|
| 44 | // The geometry container must be created by yourself to make sure
|
|---|
| 45 | // that you don't choos a wrong geometry by chance
|
|---|
| 46 | //
|
|---|
| 47 | MGeomCamMagic geomcam;
|
|---|
| 48 | plist.AddToList(&geomcam);
|
|---|
| 49 |
|
|---|
| 50 | //
|
|---|
| 51 | // Use this if you want to change the binning of one of
|
|---|
| 52 | // the histograms. You can use:
|
|---|
| 53 | // BinningConc, BinningConc1, BinningAsym, BinningM3Long,
|
|---|
| 54 | // BinningM3Trans, BinningWidth, BinningLength, BinningDist,
|
|---|
| 55 | // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta,
|
|---|
| 56 | // BinningPixels and BinningCamera
|
|---|
| 57 | //
|
|---|
| 58 | // For more information see MBinning and the corresponding
|
|---|
| 59 | // histograms
|
|---|
| 60 | //
|
|---|
| 61 | // MBinning binsalpha("BinningAlpha");
|
|---|
| 62 | // binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg
|
|---|
| 63 | // plist.AddToList(&binsalpha);
|
|---|
| 64 |
|
|---|
| 65 | // MBinning binssize("BinningSize");
|
|---|
| 66 | // binssize.SetEdgesLog(50, 1, 1e7);
|
|---|
| 67 | // plist.AddToList(&binssize);
|
|---|
| 68 |
|
|---|
| 69 | //
|
|---|
| 70 | // Now setup the tasks and tasklist:
|
|---|
| 71 | // ---------------------------------
|
|---|
| 72 | //
|
|---|
| 73 | // The first argument is the tree you want to read.
|
|---|
| 74 | // Events: Cosmic ray events
|
|---|
| 75 | // PedEvents: Pedestal Events
|
|---|
| 76 | // CalEvents: Calibration Events
|
|---|
| 77 | //
|
|---|
| 78 | MReadMarsFile read("Events", filename);
|
|---|
| 79 | read.DisableAutoScheme();
|
|---|
| 80 |
|
|---|
| 81 | MFillH hfill1("MHHillas", "MHillas");
|
|---|
| 82 | MFillH hfill2("MHHillasExt");
|
|---|
| 83 | MFillH hfill3("MHStarMap", "MHillas");
|
|---|
| 84 | MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
|
|---|
| 85 | MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
|
|---|
| 86 |
|
|---|
| 87 | tlist.AddToList(&read);
|
|---|
| 88 | tlist.AddToList(&hfill1);
|
|---|
| 89 | tlist.AddToList(&hfill2);
|
|---|
| 90 | tlist.AddToList(&hfill3);
|
|---|
| 91 | tlist.AddToList(&hfill4);
|
|---|
| 92 | tlist.AddToList(&hfill5);
|
|---|
| 93 |
|
|---|
| 94 | //
|
|---|
| 95 | // Create and setup the eventloop
|
|---|
| 96 | //
|
|---|
| 97 | MEvtLoop evtloop;
|
|---|
| 98 | evtloop.SetParList(&plist);
|
|---|
| 99 |
|
|---|
| 100 | //
|
|---|
| 101 | // Execute your analysis
|
|---|
| 102 | //
|
|---|
| 103 | MProgressBar bar;
|
|---|
| 104 | evtloop.SetProgressBar(&bar);
|
|---|
| 105 | if (!evtloop.Eventloop())
|
|---|
| 106 | return;
|
|---|
| 107 |
|
|---|
| 108 | tlist.PrintStatistics();
|
|---|
| 109 |
|
|---|
| 110 | //
|
|---|
| 111 | // After the analysis is finished we can display the histograms
|
|---|
| 112 | //
|
|---|
| 113 | plist.FindObject("MHHillas")->DrawClone();
|
|---|
| 114 | plist.FindObject("MHHillasExt")->DrawClone();
|
|---|
| 115 | plist.FindObject("MHStarMap")->DrawClone();
|
|---|
| 116 | plist.FindObject("HistSource")->DrawClone();
|
|---|
| 117 | plist.FindObject("HistExtSource")->DrawClone();
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|