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, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2003
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | /////////////////////////////////////////////////////////////////////////////
|
---|
26 | //
|
---|
27 | // STAR - STandard Analysis and Reconstruction
|
---|
28 | //
|
---|
29 | // This macro is the standard converter to convert raw data into image
|
---|
30 | // parameters
|
---|
31 | //
|
---|
32 | /////////////////////////////////////////////////////////////////////////////
|
---|
33 |
|
---|
34 | void star()
|
---|
35 | {
|
---|
36 | //
|
---|
37 | // This is a demonstration program which calculates the image
|
---|
38 | // parameters from a Magic raw data root file.
|
---|
39 |
|
---|
40 | //
|
---|
41 | // Create a empty Parameter List and an empty Task List
|
---|
42 | // The tasklist is identified in the eventloop by its name
|
---|
43 | //
|
---|
44 | MParList plist;
|
---|
45 |
|
---|
46 | MTaskList tlist;
|
---|
47 | plist.AddToList(&tlist);
|
---|
48 |
|
---|
49 | //
|
---|
50 | // Now setup the tasks and tasklist:
|
---|
51 | // ---------------------------------
|
---|
52 | //
|
---|
53 | MReadMarsFile read("Events");
|
---|
54 | read.DisableAutoScheme();
|
---|
55 |
|
---|
56 | // ------------- user change -----------------
|
---|
57 | read.AddFile("~/MC/test_sample/Gamma_zbin0_0_*.root");
|
---|
58 |
|
---|
59 | MGeomApply apply;
|
---|
60 | MMcPedestalCopy pcopy;
|
---|
61 | MMcPedestalNSBAdd pnsb;
|
---|
62 |
|
---|
63 | MCerPhotCalc ncalc;
|
---|
64 | MCerPhotAnal2 nanal;
|
---|
65 |
|
---|
66 | MFDataMember f1("MRawRunHeader.fRunType", '>', 255.5);
|
---|
67 | MFDataMember f2("MRawRunHeader.fRunType", '<', 255.5);
|
---|
68 |
|
---|
69 | ncalc.SetFilter(&f1);
|
---|
70 | nanal.SetFilter(&f2);
|
---|
71 |
|
---|
72 | MBlindPixelCalc blind;
|
---|
73 | blind.SetUseInterpolation();
|
---|
74 |
|
---|
75 | MSigmabarCalc sgcal;
|
---|
76 | MImgCleanStd clean;
|
---|
77 | MHillasCalc hcalc;
|
---|
78 | MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
|
---|
79 |
|
---|
80 | // ------------- user change -----------------
|
---|
81 | MWriteRootFile write("starfile.root");
|
---|
82 |
|
---|
83 | tlist.AddToList(&read);
|
---|
84 | tlist.AddToList(&f1);
|
---|
85 | tlist.AddToList(&f2);
|
---|
86 | tlist.AddToList(&apply);
|
---|
87 | tlist.AddToList(&pcopy);
|
---|
88 | tlist.AddToList(&pnsb);
|
---|
89 | tlist.AddToList(&ncalc);
|
---|
90 | tlist.AddToList(&nanal);
|
---|
91 | tlist.AddToList(&blind);
|
---|
92 | tlist.AddToList(&sgcal);
|
---|
93 | tlist.AddToList(&clean);
|
---|
94 | tlist.AddToList(&hcalc);
|
---|
95 | tlist.AddToList(&scalc);
|
---|
96 | tlist.AddToList(&write);
|
---|
97 |
|
---|
98 | // ------------- user change -----------------
|
---|
99 | // You may use the "UPDATE" option in the constructor
|
---|
100 | // of MWriteRootFile to update an existing file.
|
---|
101 | //
|
---|
102 | // tlist.SetSerialNumber(1); // Serial number of telescope
|
---|
103 |
|
---|
104 | write.AddContainer(write.AddSerialNumber("MMcEvt"), "Events", kFALSE);
|
---|
105 | write.AddContainer(write.AddSerialNumber("MSigmabar"), "Events");
|
---|
106 | write.AddContainer(write.AddSerialNumber("MHillas"), "Events");
|
---|
107 | write.AddContainer(write.AddSerialNumber("MHillasExt"), "Events");
|
---|
108 | write.AddContainer(write.AddSerialNumber("MHillasSrc"), "Events");
|
---|
109 | write.AddContainer(write.AddSerialNumber("MNewImagePar"), "Events");
|
---|
110 | write.AddContainer(write.AddSerialNumber("MSrcPosCam"), "RunHeaders");
|
---|
111 | write.AddContainer("MRawRunHeader", "RunHeaders");
|
---|
112 | write.AddContainer("MMcRunHeader", "RunHeaders", kFALSE);
|
---|
113 |
|
---|
114 | //
|
---|
115 | // Create and set up the eventloop
|
---|
116 | //
|
---|
117 | MProgressBar bar;
|
---|
118 |
|
---|
119 | MEvtLoop evtloop;
|
---|
120 | evtloop.SetProgressBar(&bar);
|
---|
121 | evtloop.SetParList(&plist);
|
---|
122 |
|
---|
123 | //
|
---|
124 | // Execute your analysis
|
---|
125 | //
|
---|
126 | if (!evtloop.Eventloop())
|
---|
127 | return;
|
---|
128 |
|
---|
129 | tlist.PrintStatistics();
|
---|
130 | }
|
---|