source: trunk/MagicSoft/Mars/macros/CT1Hillas.C@ 2423

Last change on this file since 2423 was 2358, checked in by moralejo, 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 CT1Hillas(const char *filename)
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 MGeomCamCT1 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("Source")
75 source.SetXY(0, 0);
76 plist.AddToList(&source);
77
78 //
79 // Now setup the tasks and tasklist:
80 //
81 // 1) read in the data from a ct1 ascii file MCTReadAscii
82 // 2) clean the image MImgCleanStd
83 // 3) calculate hillas MHillasCalc
84 // 4) fill the hillas into the histograms MFillHHillas
85 //
86 MCT1ReadAscii read("../data/CT1_97_on1.dat");
87 //read.AddFile("../data/CT1_97_off1.dat");
88
89 MMcPedestalCopy pcopy;
90 MMcPedestalNSBAdd pnsb;
91
92 MCerPhotCalc ncalc;
93
94 MCameraSmooth smooth;
95 MImgCleanStd clean;
96 MBlindPixelCalc blind;
97 //
98 // Instead of unmapping the pixels you can also
99 //
100 // blind.SetUseInterpolation();
101 // blind.SetUseCetralPixel();
102 //
103 MHillasCalc hcalc;
104 MHillasSrcCalc csrc1("Source", "HillasSource");
105
106 //
107 // Uncomment this two line if you want to use MHillasExt instead
108 // of MHillas
109 //
110 //MHillasExt hext;
111 //plist.AddToList(&hext);
112
113 MFillH hfill1("MHHillas", "MHillas");
114 MFillH hfill2("MHHillasExt");
115 MFillH hfill3("MHStarMap", "MHillas");
116 MFillH hfill4("HistExtSource [MHHillasExt]", "HillasSource");
117 MFillH hfill5("HistSource [MHHillasSrc]", "HillasSource");
118
119 MWriteRootFile write("hillas.root");
120 write.AddContainer("MHStarMap");
121 write.AddContainer("MHHillas");
122 write.AddContainer("MHHillasExt");
123 write.AddContainer("HistSource");
124 write.AddContainer("HistExtSource");
125
126 tlist.AddToList(&read);
127 tlist.AddToList(&pcopy);
128 tlist.AddToList(&pnsb);
129 tlist.AddToList(&ncalc);
130 tlist.AddToList(&clean);
131 tlist.AddToList(&blind);
132
133 tlist.AddToList(&hcalc);
134 tlist.AddToList(&csrc1);
135 tlist.AddToList(&csrc2);
136
137 tlist.AddToList(&hfill1);
138 tlist.AddToList(&hfill2);
139 tlist.AddToList(&hfill3);
140 tlist.AddToList(&hfill4);
141 tlist.AddToList(&hfill5);
142 tlist.AddToList(&write);
143
144 //
145 // Create and setup the eventloop
146 //
147 MEvtLoop evtloop;
148 evtloop.SetParList(&plist);
149
150 //
151 // Execute your analysis
152 //
153 MProgressBar bar;
154 evtloop.SetProgressBar(&bar);
155 if (!evtloop.Eventloop())
156 return;
157
158 tlist.PrintStatistics();
159
160 //
161 // After the analysis is finished we can display the histograms
162 //
163 plist.FindObject("MHHillas")->DrawClone();
164 plist.FindObject("MHHillasExt")->DrawClone();
165 plist.FindObject("MHStarMap")->DrawClone();
166 plist.FindObject("HistSource")->DrawClone();
167 plist.FindObject("HistExtSource")->DrawClone();
168}
169
Note: See TracBrowser for help on using the repository browser.