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

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