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

Last change on this file since 2897 was 2377, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.9 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 MTaskList tlist;
40 plist.AddToList(&tlist);
41
42 //
43 // Use this if you want to change the binning of one of
44 // the histograms. You can use:
45 // BinningConc, BinningConc1, BinningAsym, BinningM3Long,
46 // BinningM3Trans, BinningWidth, BinningLength, BinningDist,
47 // BinningHeadTail, BinningAlpha, BinningSize, BinningDelta,
48 // BinningPixels and BinningCamera
49 //
50 // For more information see MBinning and the corresponding
51 // histograms
52 //
53 // MBinning binsalpha("BinningAlpha");
54 // binsalpha.SetEdges(90, 0, 90); // 90 bins from 0 to 90 deg
55 // plist.AddToList(&binsalpha);
56
57 // MBinning binssize("BinningSize");
58 // binssize.SetEdgesLog(50, 1, 1e7);
59 // plist.AddToList(&binssize);
60
61 //
62 // Craete the object which hlods the source positions in the camera
63 // plain in respect to which the image parameters will be calculated.
64 // For real data the containers will be filled by a task.
65 //
66 MSrcPosCam source;
67 source.SetReadyToSave();
68 plist.AddToList(&source);
69
70 //
71 // Now setup the tasks and tasklist:
72 // ---------------------------------
73 //
74 // The first argument is the tree you want to read.
75 // Events: Cosmic ray events
76 // PedEvents: Pedestal Events
77 // CalEvents: Calibration Events
78 //
79 MReadMarsFile read("Events", filename);
80 read.DisableAutoScheme();
81
82 MGeomApply geomapl;
83
84 MMcPedestalCopy pcopy;
85 MMcPedestalNSBAdd pnsb;
86
87 MCerPhotCalc ncalc;
88 //
89 // Alternative photon calculation:
90 // Example: use only 2nd to 6th FADC slices for photon calculation:
91 //
92 // const Float_t x[15]={0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
93 // const TArrayF w(15,(Float_t*)x);
94 // ncalc.SetWeights(w);
95 //
96
97 MImgCleanStd clean;
98 MBlindPixelCalc blind;
99 //
100 // Instead of unmapping the pixels you can also
101 //
102 // blind.SetUseInterpolation();
103 // blind.SetUseCetralPixel();
104 //
105 MHillasCalc hcalc;
106 MHillasSrcCalc csrc1;
107
108 MFillH hfill1("MHHillas", "MHillas");
109 MFillH hfill2("MHHillasExt");
110 MFillH hfill3("MHStarMap", "MHillas");
111 MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
112 MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
113 MFillH hfill6("MHNewImagePar");
114
115 MWriteRootFile write("hillas.root");
116 write.AddContainer("MHStarMap");
117 write.AddContainer("MHHillas");
118 write.AddContainer("MHHillasExt");
119 write.AddContainer("HistSource");
120 write.AddContainer("HistExtSource");
121 write.AddContainer("MHNewImagePar");
122
123 tlist.AddToList(&read);
124 tlist.AddToList(&geomapl);
125 tlist.AddToList(&pcopy);
126 tlist.AddToList(&pnsb);
127 tlist.AddToList(&ncalc);
128 tlist.AddToList(&clean);
129 tlist.AddToList(&blind);
130
131 tlist.AddToList(&hcalc);
132 tlist.AddToList(&csrc1);
133
134 tlist.AddToList(&hfill1);
135 tlist.AddToList(&hfill2);
136 tlist.AddToList(&hfill3);
137 tlist.AddToList(&hfill4);
138 tlist.AddToList(&hfill5);
139 tlist.AddToList(&hfill6);
140 tlist.AddToList(&write);
141
142 //
143 // Create and setup the eventloop
144 //
145 MEvtLoop evtloop;
146 evtloop.SetParList(&plist);
147
148 //
149 // Execute your analysis
150 //
151 MProgressBar bar;
152 evtloop.SetProgressBar(&bar);
153 if (!evtloop.Eventloop())
154 return;
155
156 tlist.PrintStatistics();
157
158 //
159 // After the analysis is finished we can display the histograms
160 //
161 plist.FindObject("MHHillas")->DrawClone();
162 plist.FindObject("MHHillasExt")->DrawClone();
163 plist.FindObject("MHStarMap")->DrawClone();
164 plist.FindObject("HistSource")->DrawClone();
165 plist.FindObject("HistExtSource")->DrawClone();
166 plist.FindObject("MHNewImagePar")->DrawClone();
167}
168
Note: See TracBrowser for help on using the repository browser.