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(const char *filename="data/camera.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 | MPedestalCam pedest;
|
---|
49 | plist.AddToList(&pedest);
|
---|
50 |
|
---|
51 | //
|
---|
52 | // Now setup the tasks and tasklist:
|
---|
53 | //
|
---|
54 | // 1) read in the data from a magic root file MReadTree
|
---|
55 | // 2) calculate number of cerenkov photons MCerPhotCalc
|
---|
56 | // 3) clean the image MImgCleanStd
|
---|
57 | // 4) calculate hillas MHillasCalc
|
---|
58 | // 5) fill the hillas into the histograms MFillH
|
---|
59 | //
|
---|
60 |
|
---|
61 | //
|
---|
62 | // The first argument is the tree you want to read.
|
---|
63 | // Events: Cosmic ray events
|
---|
64 | // PedEvents: Pedestal Events
|
---|
65 | // CalEvents: Calibration Events
|
---|
66 | //
|
---|
67 | MReadMarsFile read("Events",filename);
|
---|
68 |
|
---|
69 | MMcPedestalCopy pcopy;
|
---|
70 | MMcPedestalNSBAdd pnsb;
|
---|
71 | MCerPhotCalc ncalc;
|
---|
72 | MImgCleanStd clean;
|
---|
73 | MBlindPixelCalc blind;
|
---|
74 | MHillasCalc hcalc;
|
---|
75 | MFillH hfill("MHillas", "MHHillas");
|
---|
76 | MFillH sfill("MHillas", "MHStarMap");
|
---|
77 |
|
---|
78 | //
|
---|
79 | // Crete and setup Tasklist
|
---|
80 | //
|
---|
81 | MWriteRootFile write("hillas.root");
|
---|
82 | write.AddContainer("MHillas");
|
---|
83 | write.AddContainer("MHStarMap");
|
---|
84 |
|
---|
85 | tlist.AddToList(&read);
|
---|
86 | tlist.AddToList(&pcopy);
|
---|
87 | tlist.AddToList(&pnsb);
|
---|
88 | tlist.AddToList(&ncalc);
|
---|
89 | tlist.AddToList(&clean);
|
---|
90 | tlist.AddToList(&blind);
|
---|
91 | tlist.AddToList(&hcalc);
|
---|
92 | tlist.AddToList(&hfill);
|
---|
93 | tlist.AddToList(&sfill);
|
---|
94 | tlist.AddToList(&write);
|
---|
95 |
|
---|
96 | //
|
---|
97 | // Create and setup the eventloop
|
---|
98 | //
|
---|
99 | MEvtLoop evtloop;
|
---|
100 | evtloop.SetParList(&plist);
|
---|
101 |
|
---|
102 | //
|
---|
103 | // Execute your analysis
|
---|
104 | //
|
---|
105 | if (!evtloop.Eventloop())
|
---|
106 | return;
|
---|
107 |
|
---|
108 | tlist.PrintStatistics();
|
---|
109 |
|
---|
110 | //
|
---|
111 | // After the analysis is finished we can display the histograms
|
---|
112 | //
|
---|
113 | plist.FindObject("MHHillas")->DrawClone();
|
---|
114 | plist.FindObject("MHStarMap")->DrawClone();
|
---|
115 | }
|
---|