source: trunk/MagicSoft/Mars/macros/tutorials/starplot.C@ 9492

Last change on this file since 9492 was 7159, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 3.4 KB
Line 
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
26void 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 // Use this if you want to change the binning of one of
45 // the histograms. You can use:
46 // BinningConc, BinningConc1, BinningAsym, BinningM3Long,
47 // BinningM3Trans, BinningWidth, BinningLength, BinningDist,
48 // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta,
49 // BinningPixels and BinningCamera
50 //
51 // For more information see MBinning and the corresponding
52 // histograms
53 //
54 // MBinning binsalpha("BinningAlpha");
55 // binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg
56 // plist.AddToList(&binsalpha);
57
58 // MBinning binssize("BinningSize");
59 // binssize.SetEdgesLog(50, 1, 1e7);
60 // plist.AddToList(&binssize);
61
62 //
63 // Now setup the tasks and tasklist:
64 // ---------------------------------
65 //
66 // The first argument is the tree you want to read.
67 // Events: Cosmic ray events
68 // PedEvents: Pedestal Events
69 // CalEvents: Calibration Events
70 //
71 MReadMarsFile read("Events", filename);
72 read.DisableAutoScheme();
73
74 MGeomApply geomapl;
75
76 MFillH hfill1("MHHillas", "MHillas");
77 MFillH hfill2("MHHillasExt");
78 MFillH hfill3("MHStarMap", "MHillas");
79 MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
80 MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
81
82 tlist.AddToList(&read);
83 tlist.AddToList(&geomapl);
84 tlist.AddToList(&hfill1);
85 tlist.AddToList(&hfill2);
86 tlist.AddToList(&hfill3);
87 tlist.AddToList(&hfill4);
88 tlist.AddToList(&hfill5);
89
90 //
91 // Create and setup the eventloop
92 //
93 MEvtLoop evtloop;
94 evtloop.SetParList(&plist);
95
96 //
97 // Execute your analysis
98 //
99 MProgressBar bar;
100 evtloop.SetProgressBar(&bar);
101 if (!evtloop.Eventloop())
102 return;
103
104 tlist.PrintStatistics();
105
106 //
107 // After the analysis is finished we can display the histograms
108 //
109 plist.FindObject("MHHillas")->DrawClone();
110 plist.FindObject("MHHillasExt")->DrawClone();
111 plist.FindObject("MHStarMap")->DrawClone();
112 plist.FindObject("HistSource")->DrawClone();
113 plist.FindObject("HistExtSource")->DrawClone();
114}
115
Note: See TracBrowser for help on using the repository browser.