source: trunk/MagicSoft/Mars/macros/MagicHillas.C@ 1216

Last change on this file since 1216 was 1216, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 4.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 12/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26void MagicHillas(const char *filename="~/data/gamma*.root")
27{
28 //
29 // This is a demonstration program which calculates the Hillas
30 // parameter out of a Magic root file.
31
32 //
33 // Create a empty Parameter List and an empty Task List
34 // The tasklist is identified in the eventloop by its name
35 //
36 MParList plist;
37
38 MTaskList tlist;
39 plist.AddToList(&tlist);
40
41 //
42 // The geometry container must be created by yourself to make sure
43 // that you don't choos a wrong geometry by chance
44 //
45 MGeomCamMagic geomcam;
46 plist.AddToList(&geomcam);
47
48 //
49 // Setup binning for your histograms.
50 //
51 MBinning binswidth("BinningWidth");
52 binswidth.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg
53
54 MBinning binslength("BinningLength");
55 binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg
56
57 MBinning binsalpha("BinningAlpha");
58 binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg
59
60 MBinning binsdist("BinningDist");
61 binsdist.SetEdges(100, 0, 2); // 100 bins from 0 to 2 deg
62
63 plist.AddToList(&binswidth);
64 plist.AddToList(&binslength);
65 plist.AddToList(&binsalpha);
66 plist.AddToList(&binsdist);
67
68 //
69 // Craete the object which hlods the source positions in the camera
70 // plain in respect to which the image parameters will be calculated.
71 // For real data the containers will be filled by a task.
72 //
73 MSrcPosCam source("Source")
74 source.SetXY(0, 0);
75
76 MSrcPosCam antisrc("AntiSrc");
77 antisrc.SetXY(240, 0);
78
79 plist.AddToList(&source);
80 plist.AddToList(&antisrc);
81
82 //
83 // Now setup the tasks and tasklist:
84 // ---------------------------------
85 //
86 // The first argument is the tree you want to read.
87 // Events: Cosmic ray events
88 // PedEvents: Pedestal Events
89 // CalEvents: Calibration Events
90 //
91 MReadMarsFile read("Events", filename);
92
93 MMcPedestalCopy pcopy;
94 MMcPedestalNSBAdd pnsb;
95 MCerPhotCalc ncalc;
96 MImgCleanStd clean;
97 MBlindPixelCalc blind;
98 MHillasCalc hcalc;
99 MHillasSrcCalc csrc1("Source", "HillasSource");
100 MHillasSrcCalc csrc2("AntiSrc", "HillasAntiSrc");
101
102 MFillH hfill("MHHillas", "MHillas");
103 MFillH sfill("MHStarMap", "MHillas");
104 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource");
105 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc");
106
107 MWriteRootFile write("hillas.root");
108 write.AddContainer("MHillas", "Hillas");
109 write.AddContainer("HillasSource", "Hillas");
110 write.AddContainer("HillasAntiSrc", "Hillas");
111 write.AddContainer("MHStarMap");
112
113 tlist.AddToList(&read);
114 tlist.AddToList(&pcopy);
115 tlist.AddToList(&pnsb);
116 tlist.AddToList(&ncalc);
117 tlist.AddToList(&clean);
118 tlist.AddToList(&blind);
119 tlist.AddToList(&hcalc);
120 tlist.AddToList(&csrc1);
121 tlist.AddToList(&csrc2);
122 tlist.AddToList(&hfill);
123 tlist.AddToList(&sfill);
124 tlist.AddToList(&hfill2s);
125 tlist.AddToList(&hfill2a);
126 tlist.AddToList(&write);
127
128 //
129 // Create and setup the eventloop
130 //
131 MEvtLoop evtloop;
132 evtloop.SetParList(&plist);
133
134 //
135 // Execute your analysis
136 //
137 if (!evtloop.Eventloop())
138 return;
139
140 tlist.PrintStatistics();
141
142 //
143 // After the analysis is finished we can display the histograms
144 //
145 plist.FindObject("MHHillas")->DrawClone();
146 plist.FindObject("HistSource")->DrawClone();
147 plist.FindObject("HistAntiSrc")->DrawClone();
148 plist.FindObject("MHStarMap")->DrawClone();
149}
Note: See TracBrowser for help on using the repository browser.