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 |
|
---|
26 | void MagicHillas()
|
---|
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 | MPedestalCam pedest;
|
---|
49 | plist.AddToList(&pedest);
|
---|
50 |
|
---|
51 | //
|
---|
52 | // The Hillas histograms (MHHillas) could be created automatically
|
---|
53 | // but to make sure, that they are not deleted when the macro is
|
---|
54 | // finished you must create them yourself and add it to the list
|
---|
55 | //
|
---|
56 | MHHillas *hists = new MHHillas;
|
---|
57 | plist.AddToList(hists);
|
---|
58 |
|
---|
59 | MHStarMap *smap = new MHStarMap;
|
---|
60 | plist.AddToList(smap);
|
---|
61 |
|
---|
62 | //
|
---|
63 | // Now setup the tasks and tasklist:
|
---|
64 | //
|
---|
65 | // 1) read in the data from a magic root file MReadTree
|
---|
66 | // 2) calculate number of cerenkov photons MCerPhotCalc
|
---|
67 | // 3) clean the image MImgCleanStd
|
---|
68 | // 4) calculate hillas MHillasCalc
|
---|
69 | // 5) fill the hillas into the histograms MFillH
|
---|
70 | //
|
---|
71 |
|
---|
72 | //
|
---|
73 | // The first argument is the tree you want to read.
|
---|
74 | // Events: Cosmic ray events
|
---|
75 | // PedEvents: Pedestal Events
|
---|
76 | // CalEvents: Calibration Events
|
---|
77 | //
|
---|
78 | MReadTree read("Events", "data/octobertest.root");
|
---|
79 | // read.AddFile("data/cer000019.root");
|
---|
80 |
|
---|
81 | MCerPhotCalc ncalc;
|
---|
82 | MImgCleanStd clean;
|
---|
83 | MHillasCalc hcalc;
|
---|
84 | MFillH hfill("MHillas", "MHHillas");
|
---|
85 | MFillH sfill("MHillas", "MHStarMap");
|
---|
86 |
|
---|
87 | MWriteRootFile write("hillas.root");
|
---|
88 | write.AddContainer("MHillas");
|
---|
89 | write.AddContainer("MHHillas");
|
---|
90 | write.AddContainer(smap);
|
---|
91 |
|
---|
92 | tlist.AddToList(&read);
|
---|
93 | tlist.AddToList(&ncalc);
|
---|
94 | tlist.AddToList(&clean);
|
---|
95 | tlist.AddToList(&hcalc);
|
---|
96 | tlist.AddToList(&hfill);
|
---|
97 | tlist.AddToList(&sfill);
|
---|
98 | tlist.AddToList(&write);
|
---|
99 |
|
---|
100 | //
|
---|
101 | // Create and setup the eventloop
|
---|
102 | //
|
---|
103 | MEvtLoop evtloop;
|
---|
104 | evtloop.SetParList(&plist);
|
---|
105 |
|
---|
106 | //
|
---|
107 | // Execute your analysis
|
---|
108 | //
|
---|
109 | if (!evtloop.Eventloop())
|
---|
110 | return;
|
---|
111 |
|
---|
112 | //
|
---|
113 | // After the analysis is finished we can display the histograms
|
---|
114 | //
|
---|
115 | hists->Draw();
|
---|
116 | smap->Draw();
|
---|
117 | }
|
---|
118 |
|
---|