source: trunk/MagicSoft/Mars/mtemp/mpisa/macros/HillasAnal.C@ 4055

Last change on this file since 4055 was 4055, checked in by stamerra, 21 years ago
*** empty log message ***
File size: 6.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, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25///////////////////////////////////////////////////////////////////////////
26//
27// MagicHillas.C
28// =============
29//
30// This is a demonstration program which calculates image (Hillas +)
31// parameters using as input a Merpp output file (raw data).
32// All parameters are written to an output file called hillas.root. Also
33// filles histograms are displayed.
34// For the calculation an arbitrary signal extractor (MCerPhotAnal2/Calc)
35// is used.
36//
37///////////////////////////////////////////////////////////////////////////
38
39void HillasAnal(const char *filename="output_test.root")
40{
41 //
42 // Create a empty Parameter List and an empty Task List
43 // The tasklist is identified in the eventloop by its name
44 //
45 MParList plist;
46
47 MTaskList tlist;
48 plist.AddToList(&tlist);
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 // Setup a task which makes sure that all used arrays have
91 // the correct size
92 MGeomApply geomapl;
93
94 // tasks used if MC files are detected to calculate pedestals
95 // MMcPedestalCopy pcopy;
96 // MMcPedestalNSBAdd pnsb;
97
98 // calculate the signal in a very simple way
99 // for real adat files use MCerPhotAnal2 instead which also
100 // calculates the pedestal.
101 // MCerPhotCalc ncalc;
102 //
103 // Alternative photon calculation:
104 // Example: use only 2nd to 6th FADC slices for photon calculation:
105 //
106 // const Float_t x[15]={0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
107 // const TArrayF w(15,(Float_t*)x);
108 // ncalc.SetWeights(w);
109 //
110
111 // setup image cleaning and blind pixel treatment
112 MImgCleanStd clean;
113 MBlindPixelCalc blind;
114
115 //
116 // Instead of unmapping the pixels you can also (The use of this
117 // class is deprecated, it will be replaced by MBadPixels*)
118 //
119 // blind.SetUseInterpolation();
120 // blind.SetUseCetralPixel();
121 //
122
123 // setup tasks to calculate image parameters
124 MHillasCalc hcalc;
125 MHillasSrcCalc csrc1;
126
127 // setup tasks to fill histograms
128 MFillH hfill1("MHHillas", "MHillas");
129 MFillH hfill2("MHHillasExt");
130 MFillH hfill3("MHStarMap", "MHillas");
131 MFillH hfill4("HistExtSource [MHHillasExt]", "MHillasSrc");
132 MFillH hfill5("HistSource [MHHillasSrc]", "MHillasSrc");
133 //MFillH hfill6("MHNewImagePar");
134
135 // setup task to write containers to a file
136 MWriteRootFile write("hillas_Mrk421.root");
137 write.AddContainer("MHillas");
138 write.AddContainer("MHillasExt");
139 write.AddContainer("MHillasSrc");
140 write.AddContainer("MRawEvtHeader");
141 write.AddContainer("MRawRunHeader");
142 //write.AddContainer("HistExtSource");
143 //write.AddContainer("MHNewImagePar");
144
145 // Setup the contents of zour tasklist
146 tlist.AddToList(&read);
147 tlist.AddToList(&geomapl);
148 //tlist.AddToList(&pcopy);
149 //tlist.AddToList(&pnsb);
150 //tlist.AddToList(&ncalc);
151 tlist.AddToList(&clean);
152 tlist.AddToList(&blind);
153
154 tlist.AddToList(&hcalc);
155 tlist.AddToList(&csrc1);
156
157 tlist.AddToList(&hfill1);
158 tlist.AddToList(&hfill2);
159 tlist.AddToList(&hfill3);
160 tlist.AddToList(&hfill4);
161 tlist.AddToList(&hfill5);
162 //tlist.AddToList(&hfill6);
163 tlist.AddToList(&write);
164
165 //
166 // Create and setup the eventloop
167 //
168 MEvtLoop evtloop;
169 evtloop.SetParList(&plist);
170
171 //
172 // Execute your analysis
173 //
174 MProgressBar bar;
175 evtloop.SetProgressBar(&bar);
176 if (!evtloop.Eventloop())
177 return;
178
179 tlist.PrintStatistics();
180
181 //
182 // After the analysis is finished we can display the histograms
183 //
184 plist.FindObject("MHHillas")->DrawClone();
185 plist.FindObject("MHHillasExt")->DrawClone();
186 plist.FindObject("MHStarMap")->DrawClone();
187 plist.FindObject("HistSource")->DrawClone();
188 plist.FindObject("HistExtSource")->DrawClone();
189 //plist.FindObject("MHNewImagePar")->DrawClone();
190}
191
Note: See TracBrowser for help on using the repository browser.