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

Last change on this file since 1211 was 1209, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 3.8 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 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26void MagicHillas(const char *filename="~/data/Gamma*.root")
27{
28 //
29 // This is a demonstration program which calculates the Hillas
30 // parameter out of a Magic root file.
31
32 //
33 // Create a empty Parameter List and an empty Task List
34 // The tasklist is identified in the eventloop by its name
35 //
36 MParList plist;
37
38 MTaskList tlist;
39 plist.AddToList(&tlist);
40
41 //
42 // The geometry container must be created by yourself to make sure
43 // that you don't choos a wrong geometry by chance
44 //
45 MGeomCamMagic geomcam;
46 plist.AddToList(&geomcam);
47
48 //
49 // Craete the object which hlods the source positions in the camera
50 // plain in respect to which the image parameters will be calculated.
51 // For real data the containers will be filled by a task.
52 //
53 MSrcPosCam source("Source")
54 source.SetXY(0, 0);
55
56 MSrcPosCam antisrc("AntiSrc");
57 antisrc.SetXY(240, 0);
58
59 plist.AddToList(&source);
60 plist.AddToList(&antisrc);
61
62 //
63 // Now setup the tasks and tasklist:
64 // ---------------------------------
65 //
66 // The first argument is the tree you want to read.
67 // Events: Cosmic ray events
68 // PedEvents: Pedestal Events
69 // CalEvents: Calibration Events
70 //
71 MReadMarsFile read("Events", filename);
72
73 MMcPedestalCopy pcopy;
74 MMcPedestalNSBAdd pnsb;
75 MCerPhotCalc ncalc;
76 MImgCleanStd clean;
77 MBlindPixelCalc blind;
78 MHillasCalc hcalc;
79 MHillasSrcCalc csrc1("Source", "HillasSource");
80 MHillasSrcCalc csrc2("AntiSrc", "HillasAntiSrc");
81
82 MFillH hfill("MHHillas", "MHillas");
83 MFillH sfill("MHStarMap", "MHillas");
84 MFillH hfill2s("HistSource [MHHillasSrc]", "HillasSource");
85 MFillH hfill2a("HistAntiSrc [MHHillasSrc]", "HillasAntiSrc");
86
87 MWriteRootFile write("hillas.root");
88 write.AddContainer("MHillas", "Hillas");
89 write.AddContainer("HillasSource", "Hillas");
90 write.AddContainer("HillasAntiSrc", "Hillas");
91 write.AddContainer("MHStarMap");
92
93 tlist.AddToList(&read);
94 tlist.AddToList(&pcopy);
95 tlist.AddToList(&pnsb);
96 tlist.AddToList(&ncalc);
97 tlist.AddToList(&clean);
98 tlist.AddToList(&blind);
99 tlist.AddToList(&hcalc);
100 tlist.AddToList(&csrc1);
101 tlist.AddToList(&csrc2);
102 tlist.AddToList(&hfill);
103 tlist.AddToList(&sfill);
104 tlist.AddToList(&hfill2s);
105 tlist.AddToList(&hfill2a);
106 tlist.AddToList(&write);
107
108 //
109 // Create and setup the eventloop
110 //
111 MEvtLoop evtloop;
112 evtloop.SetParList(&plist);
113
114 //
115 // Execute your analysis
116 //
117 if (!evtloop.Eventloop())
118 return;
119
120 tlist.PrintStatistics();
121
122 //
123 // After the analysis is finished we can display the histograms
124 //
125 plist.FindObject("MHHillas")->DrawClone();
126 plist.FindObject("HistSource")->DrawClone();
127 plist.FindObject("HistAntiSrc")->DrawClone();
128 plist.FindObject("MHStarMap")->DrawClone();
129}
Note: See TracBrowser for help on using the repository browser.