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 |
|
---|
26 | void 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 | // Uncomment this two line if you want to use MHillasExt instead
|
---|
43 | // of MHillas
|
---|
44 | //
|
---|
45 | //MHillasExt hext;
|
---|
46 | //plist.AddToList(&hext);
|
---|
47 |
|
---|
48 | //
|
---|
49 | // The geometry container must be created by yourself to make sure
|
---|
50 | // that you don't choos a wrong geometry by chance
|
---|
51 | //
|
---|
52 | MGeomCamMagic geomcam;
|
---|
53 | plist.AddToList(&geomcam);
|
---|
54 |
|
---|
55 | //
|
---|
56 | // Setup binning for your histograms.
|
---|
57 | //
|
---|
58 | MBinning binswidth("BinningWidth");
|
---|
59 | binswidth.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg
|
---|
60 |
|
---|
61 | MBinning binslength("BinningLength");
|
---|
62 | binslength.SetEdges(100, 0, 1); // 100 bins from 0 to 1 deg
|
---|
63 |
|
---|
64 | MBinning binsalpha("BinningAlpha");
|
---|
65 | binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg
|
---|
66 |
|
---|
67 | MBinning binsdist("BinningDist");
|
---|
68 | binsdist.SetEdges(100, 0, 2); // 100 bins from 0 to 2 deg
|
---|
69 |
|
---|
70 | plist.AddToList(&binswidth);
|
---|
71 | plist.AddToList(&binslength);
|
---|
72 | plist.AddToList(&binsalpha);
|
---|
73 | plist.AddToList(&binsdist);
|
---|
74 |
|
---|
75 | //
|
---|
76 | // Craete the object which hlods the source positions in the camera
|
---|
77 | // plain in respect to which the image parameters will be calculated.
|
---|
78 | // For real data the containers will be filled by a task.
|
---|
79 | //
|
---|
80 | MSrcPosCam source("Source")
|
---|
81 | source.SetXY(0, 0);
|
---|
82 |
|
---|
83 | MSrcPosCam antisrc("AntiSrc");
|
---|
84 | antisrc.SetXY(240, 0);
|
---|
85 |
|
---|
86 | plist.AddToList(&source);
|
---|
87 | plist.AddToList(&antisrc);
|
---|
88 |
|
---|
89 | //
|
---|
90 | // Now setup the tasks and tasklist:
|
---|
91 | // ---------------------------------
|
---|
92 | //
|
---|
93 | // The first argument is the tree you want to read.
|
---|
94 | // Events: Cosmic ray events
|
---|
95 | // PedEvents: Pedestal Events
|
---|
96 | // CalEvents: Calibration Events
|
---|
97 | //
|
---|
98 | MReadMarsFile read("Events", filename);
|
---|
99 | read.DisableAutoScheme();
|
---|
100 |
|
---|
101 | MMcPedestalCopy pcopy;
|
---|
102 | MMcPedestalNSBAdd pnsb;
|
---|
103 | MCerPhotCalc ncalc;
|
---|
104 | MImgCleanStd clean;
|
---|
105 | MBlindPixelCalc blind;
|
---|
106 | MHillasCalc hcalc;
|
---|
107 | MHillasSrcCalc csrc1("Source", "HillasSource");
|
---|
108 | MHillasSrcCalc csrc2("AntiSrc", "HillasAntiSrc");
|
---|
109 |
|
---|
110 | MFillH hfill("MHHillas", "MHillas");
|
---|
111 | MFillH sfill("MHStarMap", "MHillas");
|
---|
112 | MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource");
|
---|
113 | MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc");
|
---|
114 |
|
---|
115 | MWriteRootFile write("hillas.root");
|
---|
116 | write.AddContainer("MHillas", "Hillas");
|
---|
117 | write.AddContainer("HillasSource", "Hillas");
|
---|
118 | write.AddContainer("HillasAntiSrc", "Hillas");
|
---|
119 | write.AddContainer("MHStarMap");
|
---|
120 | write.AddContainer("MMcEvt","Hillas");
|
---|
121 |
|
---|
122 |
|
---|
123 | /*
|
---|
124 | MWriteAsciiFile write("hillas.txt");
|
---|
125 | write.AddContainer("MHillas", "fLength");
|
---|
126 | write.AddContainer("MHillas", "fConc");
|
---|
127 | write.AddContainer("MHillas");
|
---|
128 | */
|
---|
129 |
|
---|
130 | tlist.AddToList(&read);
|
---|
131 | tlist.AddToList(&pcopy);
|
---|
132 | tlist.AddToList(&pnsb);
|
---|
133 | tlist.AddToList(&ncalc);
|
---|
134 | tlist.AddToList(&clean);
|
---|
135 | tlist.AddToList(&blind);
|
---|
136 | tlist.AddToList(&hcalc);
|
---|
137 | tlist.AddToList(&csrc1);
|
---|
138 | tlist.AddToList(&csrc2);
|
---|
139 | tlist.AddToList(&hfill);
|
---|
140 | tlist.AddToList(&sfill);
|
---|
141 | tlist.AddToList(&hfill2s);
|
---|
142 | tlist.AddToList(&hfill2a);
|
---|
143 | tlist.AddToList(&write);
|
---|
144 |
|
---|
145 | //
|
---|
146 | // Create and setup the eventloop
|
---|
147 | //
|
---|
148 | MEvtLoop evtloop;
|
---|
149 | evtloop.SetParList(&plist);
|
---|
150 |
|
---|
151 | //
|
---|
152 | // Execute your analysis
|
---|
153 | //
|
---|
154 | if (!evtloop.Eventloop())
|
---|
155 | return;
|
---|
156 |
|
---|
157 | tlist.PrintStatistics();
|
---|
158 |
|
---|
159 | //
|
---|
160 | // After the analysis is finished we can display the histograms
|
---|
161 | //
|
---|
162 | plist.FindObject("MHHillas")->DrawClone();
|
---|
163 | plist.FindObject("HistSource")->DrawClone();
|
---|
164 | plist.FindObject("HistAntiSrc")->DrawClone();
|
---|
165 | plist.FindObject("MHStarMap")->DrawClone();
|
---|
166 | }
|
---|