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

Last change on this file since 2132 was 2124, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 4.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 MSrcPosCam src;
60 src.SetReadyToSave();
61 plist.AddToList(&src);
62
63 //
64 // The geometry container must be created by yourself to make sure
65 // that you don't choose a wrong geometry by mistake
66 //
67 MGeomCamMagic geomcam;
68 plist.AddToList(&geomcam);
69
70 //
71 // Now setup the tasks and tasklist:
72 // ---------------------------------
73 //
74 MReadMarsFile read("Events");
75 read.DisableAutoScheme();
76
77 // ------------- user change -----------------
78 read.AddFile("magictest/test/Gamma_z*.root");
79
80 MMcPedestalCopy pcopy;
81 MMcPedestalNSBAdd pnsb;
82 MCerPhotCalc ncalc;
83
84 MBlindPixelCalc blind;
85 blind.SetUseInterpolation();
86
87 MSigmabarCalc sgcal;
88 MImgCleanStd clean;
89 MHillasCalc hcalc;
90 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
91 MCT1SupercutsCalc calc1;
92
93 // -------------------------------------------
94 MFillH hfill1("MHHillas", "MHillas");
95 MFillH hfill2("MHHillasExt");
96 MFillH hfill3("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
97 MFillH hfill4("MHHillasSrc","MHillasSrc");
98 MFillH hfill4("MHNewImagePar","MNewImagePar");
99 MFillH hfill5("MHStarMap", "MHillas");
100 MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
101 MFillH hfill7("MHHadronness", "MHadronness");
102 MFillH hfill8("MHSigmaTheta");
103
104 tlist.AddToList(&read);
105 tlist.AddToList(&pcopy);
106 tlist.AddToList(&pnsb);
107 tlist.AddToList(&ncalc);
108 tlist.AddToList(&blind);
109 tlist.AddToList(&sgcal);
110 tlist.AddToList(&clean);
111 tlist.AddToList(&hcalc);
112 tlist.AddToList(&scalc);
113 tlist.AddToList(&calc1);
114 tlist.AddToList(&hfill1);
115 tlist.AddToList(&hfill2);
116 tlist.AddToList(&hfill3);
117 tlist.AddToList(&hfill4);
118 tlist.AddToList(&hfill5);
119 tlist.AddToList(&hfill6);
120 tlist.AddToList(&hfill7);
121 tlist.AddToList(&hfill8);
122
123 MEvtLoop evtloop;
124 evtloop.SetParList(&plist);
125 evtloop.SetDisplay(d);
126
127 //
128 // Execute your analysis
129 //
130 if (!evtloop.Eventloop())
131 return;
132
133 tlist.PrintStatistics();
134
135 //
136 // Make sure the display hasn't been deleted by the user while the
137 // eventloop was running.
138 //
139 if ((d = evtloop.GetDisplay()))
140 {
141 // Save data in a postscriptfile (status.ps)
142 d->SaveAsPS();
143 /*
144 * ----------- Write status to a root file ------------
145 *
146 TFile file("status.root", "RECREATE");
147 d->Write();
148 file.Close();
149 delete d;
150 */
151 }
152 /*
153 * ----------- Read status from a root file ------------
154 *
155 TFile file2("status.root", "READ");
156 MStatusDisplay *d2 = new MStatusDisplay;
157 d2->Read();
158 */
159}
Note: See TracBrowser for help on using the repository browser.