source: tags/Mars-V0.8/macros/MagicHillas.C

Last change on this file was 1633, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 5.0 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, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2002
21!
22!
23\* ======================================================================== */
24
25
26void MagicHillas(const char *filename="~/data/Gamma_20_N*.root")
27{
28 //
29 // This is a demonstration program which calculates the Hillas
30 // parameter out of a Magic root file (raw data file).
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 // Craete the object which hlods the source positions in the camera
71 // plain in respect to which the image parameters will be calculated.
72 // For real data the containers will be filled by a task.
73 //
74 MSrcPosCam source;
75 source.SetReadyToSave();
76 plist.AddToList(&source);
77
78 //
79 // Now setup the tasks and tasklist:
80 // ---------------------------------
81 //
82 // The first argument is the tree you want to read.
83 // Events: Cosmic ray events
84 // PedEvents: Pedestal Events
85 // CalEvents: Calibration Events
86 //
87 MReadMarsFile read("Events", filename);
88 read.DisableAutoScheme();
89
90 MMcPedestalCopy pcopy;
91 MMcPedestalNSBAdd pnsb;
92
93 MCerPhotCalc ncalc;
94 //
95 // Alternative photon calculation:
96 // Example: use only 2nd to 6th FADC slices for photon calculation:
97 //
98 // const Float_t x[15]={0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
99 // TArrayF w(15,x);
100 // ncalc.SetWeights(w);
101 //
102
103 MImgCleanStd clean;
104 MBlindPixelCalc blind;
105 //
106 // Instead of unmapping the pixels you can also
107 //
108 // blind.SetUseInterpolation();
109 // blind.SetUseCetralPixel();
110 //
111 MHillasCalc hcalc;
112 MHillasSrcCalc csrc1;
113
114 //
115 // To use MHillasExt instead of MHillas
116 //
117 MHillasExt hext;
118 plist.AddToList(&hext);
119
120 MFillH hfill1("MHHillas", "MHillas");
121 MFillH hfill2("MHHillasExt");
122 MFillH hfill3("MHStarMap", "MHillas");
123 MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
124 MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
125
126 MWriteRootFile write("hillas.root");
127 write.AddContainer("MHStarMap");
128 write.AddContainer("MHHillas");
129 write.AddContainer("MHHillasExt");
130 write.AddContainer("HistSource");
131 write.AddContainer("HistExtSource");
132
133 tlist.AddToList(&read);
134 tlist.AddToList(&pcopy);
135 tlist.AddToList(&pnsb);
136 tlist.AddToList(&ncalc);
137 tlist.AddToList(&clean);
138 tlist.AddToList(&blind);
139
140 tlist.AddToList(&hcalc);
141 tlist.AddToList(&csrc1);
142 tlist.AddToList(&csrc2);
143
144 tlist.AddToList(&hfill1);
145 tlist.AddToList(&hfill2);
146 tlist.AddToList(&hfill3);
147 tlist.AddToList(&hfill4);
148 tlist.AddToList(&hfill5);
149 tlist.AddToList(&write);
150
151 //
152 // Create and setup the eventloop
153 //
154 MEvtLoop evtloop;
155 evtloop.SetParList(&plist);
156
157 //
158 // Execute your analysis
159 //
160 MProgressBar bar;
161 evtloop.SetProgressBar(&bar);
162 if (!evtloop.Eventloop())
163 return;
164
165 tlist.PrintStatistics();
166
167 //
168 // After the analysis is finished we can display the histograms
169 //
170 plist.FindObject("MHHillas")->DrawClone();
171 plist.FindObject("MHHillasExt")->DrawClone();
172 plist.FindObject("MHStarMap")->DrawClone();
173 plist.FindObject("HistSource")->DrawClone();
174 plist.FindObject("HistExtSource")->DrawClone();
175}
176
Note: See TracBrowser for help on using the repository browser.