source: trunk/MagicSoft/Mars/macros/status.C@ 3828

Last change on this file since 3828 was 2550, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 5.5 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, 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// Status - Example how to use the MStatusDisplay
28//
29// Use a camera file as input
30//
31/////////////////////////////////////////////////////////////////////////////
32
33void status()
34{
35 //
36 // Update frequency by default = 1Hz
37 //
38 MStatusDisplay *d = new MStatusDisplay;
39
40 // Set update time to 5s
41 // d->SetUpdateTime(5000);
42
43 // Disable online update
44 // d->SetUpdateTime(-1);
45
46 d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
47 gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
48 //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
49
50 //
51 // Create a empty Parameter List and an empty Task List
52 // The tasklist is identified in the eventloop by its name
53 //
54 MParList plist;
55
56 MTaskList tlist;
57 plist.AddToList(&tlist);
58
59 // ------------- user change -----------------
60 MDirIter files(".", "G*.root", -1);
61 //files.Print("all");
62
63 //
64 // Now setup the tasks and tasklist:
65 // ---------------------------------
66 //
67 MReadMarsFile read("Events");
68 read.DisableAutoScheme();
69 read.AddFiles(files);
70
71 MGeomApply geomapl;
72
73 MMcPedestalCopy pcopy;
74 MMcPedestalNSBAdd pnsb;
75 MCerPhotCalc ncalc;
76
77 TArrayS blinds(0);
78
79 MBlindPixelCalc blind;
80 blind.SetPixelIndices(blinds);
81 blind.SetUseInterpolation();
82
83 MSigmabarCalc sgcal;
84 MImgCleanStd clean;
85 MHillasCalc hcalc;
86 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
87
88 MHCamEvent hist("PedestalRms");
89 hist.SetType(1);
90 plist.AddToList(&hist);
91
92 // -------------------------------------------
93 MHTriggerLvl0 trighi(254, "SaturationHi", "Saturation Rate of Hi Gains");
94 trighi.SetType(1);
95
96 MHCamEvent maxhi("MaxIdxHi", "Index of maximum hi-gain slice");
97 MHCamEvent maxlo("MaxIdxLo", "Index of maximum lo-gain slice");
98 maxhi.SetType(3);
99 maxlo.SetType(4);
100 plist.AddToList(&maxhi);
101 plist.AddToList(&maxlo);
102
103
104 MFillH fillhi(&trighi, "MRawEvtData");
105 MFillH hfilhi("MaxIdxHi", "MRawEvtData");
106 MFillH hfillo("MaxIdxLo", "MRawEvtData");
107 MFillH hfill0("Uncleaned [MHCamEvent]", "MCerPhotEvt");
108 MFillH hfill1("Pedestals [MHCamEvent]", "MPedestalCam");
109 MFillH hfill2("PedestalRms", "MPedestalCam");
110 MFillH hfill3("MHHillas", "MHillas");
111 MFillH hfill4("MHHillasExt");
112 MFillH hfill5("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
113 MFillH hfill6("MHHillasSrc","MHillasSrc");
114 MFillH hfill7("MHNewImagePar","MNewImagePar");
115 MFillH hfill8("MHStarMap", "MHillas");
116 MFillH hfill9("Cleaned [MHCamEvent]", "MCerPhotEvt");
117
118 MContinue cont1("MNewImagePar.fNumCorePixels<0");
119
120 tlist.AddToList(&read);
121 tlist.AddToList(&geomapl);
122 tlist.AddToList(&hfilhi);
123 tlist.AddToList(&hfillo);
124 tlist.AddToList(&fillhi);
125 tlist.AddToList(&pcopy);
126 tlist.AddToList(&pnsb);
127 tlist.AddToList(&ncalc);
128 tlist.AddToList(&blind);
129 tlist.AddToList(&hfill0);
130 //tlist.AddToList(&sgcal);
131 tlist.AddToList(&clean);
132 tlist.AddToList(&hcalc);
133 tlist.AddToList(&cont1);
134 tlist.AddToList(&scalc);
135 tlist.AddToList(&hfill1);
136 tlist.AddToList(&hfill2);
137 tlist.AddToList(&hfill3);
138 tlist.AddToList(&hfill4);
139 tlist.AddToList(&hfill5);
140 tlist.AddToList(&hfill6);
141 tlist.AddToList(&hfill7);
142 tlist.AddToList(&hfill8);
143 tlist.AddToList(&hfill9);
144
145 MEvtLoop evtloop;
146 evtloop.SetParList(&plist);
147 evtloop.SetDisplay(d);
148
149 //
150 // Execute your analysis
151 //
152 if (!evtloop.Eventloop())
153 return;
154
155 tlist.PrintStatistics();
156
157 MHCamEvent *uncl = (MHCamEvent*)plist.FindObject("Uncleaned");
158 MHCamEvent *hped = (MHCamEvent*)plist.FindObject("Pedestals");
159 MHCamEvent *hrms = (MHCamEvent*)plist.FindObject("PedestalRms");
160 uncl->PrintOutliers(3);
161 hped->PrintOutliers(1.5);
162 hrms->PrintOutliers(4);
163 trighi.PrintOutliers(2.5);
164
165 //
166 // Make sure the display hasn't been deleted by the user while the
167 // eventloop was running.
168 //
169 if ((d = evtloop.GetDisplay()))
170 {
171 // Save data in a postscriptfile (status.ps)
172 //d->SaveAsPS();
173 /*
174 * ----------- Write status to a root file ------------
175 *
176 TFile file("status.root", "RECREATE");
177 d->Write();
178 file.Close();
179 delete d;
180 */
181 }
182 /*
183 * ----------- Read status from a root file ------------
184 *
185 TFile file2("status.root", "READ");
186 MStatusDisplay *d2 = new MStatusDisplay;
187 d2->Read();
188 */
189}
Note: See TracBrowser for help on using the repository browser.