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

Last change on this file since 2512 was 2405, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 5.1 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("~MAGIC/online_data/rootdata", "*Mkn501-I*.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 MFillH fillhi(&trighi, "MRawEvtData");
97 MFillH hfill0("Uncleaned [MHCamEvent]", "MCerPhotEvt");
98 MFillH hfill1("Pedestals [MHCamEvent]", "MPedestalCam");
99 MFillH hfill2("PedestalRms", "MPedestalCam");
100 MFillH hfill3("MHHillas", "MHillas");
101 MFillH hfill4("MHHillasExt");
102 MFillH hfill5("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
103 MFillH hfill6("MHHillasSrc","MHillasSrc");
104 MFillH hfill7("MHNewImagePar","MNewImagePar");
105 MFillH hfill8("MHStarMap", "MHillas");
106 MFillH hfill9("Cleaned [MHCamEvent]", "MCerPhotEvt");
107
108 MContinue cont1("MNewImagePar.fNumCorePixels<0");
109
110 tlist.AddToList(&read);
111 tlist.AddToList(&geomapl);
112 tlist.AddToList(&fillhi);
113 tlist.AddToList(&pcopy);
114 tlist.AddToList(&pnsb);
115 tlist.AddToList(&ncalc);
116 tlist.AddToList(&blind);
117 tlist.AddToList(&hfill0);
118 //tlist.AddToList(&sgcal);
119 tlist.AddToList(&clean);
120 tlist.AddToList(&hcalc);
121 tlist.AddToList(&cont1);
122 tlist.AddToList(&scalc);
123 tlist.AddToList(&hfill1);
124 tlist.AddToList(&hfill2);
125 tlist.AddToList(&hfill3);
126 tlist.AddToList(&hfill4);
127 tlist.AddToList(&hfill5);
128 tlist.AddToList(&hfill6);
129 tlist.AddToList(&hfill7);
130 tlist.AddToList(&hfill8);
131 tlist.AddToList(&hfill9);
132
133 MEvtLoop evtloop;
134 evtloop.SetParList(&plist);
135 evtloop.SetDisplay(d);
136
137 //
138 // Execute your analysis
139 //
140 if (!evtloop.Eventloop())
141 return;
142
143 tlist.PrintStatistics();
144
145 MHCamEvent *uncl = (MHCamEvent*)plist.FindObject("Uncleaned");
146 MHCamEvent *hped = (MHCamEvent*)plist.FindObject("Pedestals");
147 MHCamEvent *hrms = (MHCamEvent*)plist.FindObject("PedestalRms");
148 uncl->PrintOutliers(3);
149 hped->PrintOutliers(1.5);
150 hrms->PrintOutliers(4);
151 trighi.PrintOutliers(2.5);
152
153 //
154 // Make sure the display hasn't been deleted by the user while the
155 // eventloop was running.
156 //
157 if ((d = evtloop.GetDisplay()))
158 {
159 // Save data in a postscriptfile (status.ps)
160 //d->SaveAsPS();
161 /*
162 * ----------- Write status to a root file ------------
163 *
164 TFile file("status.root", "RECREATE");
165 d->Write();
166 file.Close();
167 delete d;
168 */
169 }
170 /*
171 * ----------- Read status from a root file ------------
172 *
173 TFile file2("status.root", "READ");
174 MStatusDisplay *d2 = new MStatusDisplay;
175 d2->Read();
176 */
177}
Note: See TracBrowser for help on using the repository browser.