source: tags/Mars-V0.8.2/status.cc@ 10653

Last change on this file since 10653 was 2506, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 7.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 ----- PRELIMINARY
30//
31/////////////////////////////////////////////////////////////////////////////
32
33#include "MStatusDisplay.h"
34#include "MArray.h"
35#include "MLog.h"
36#include "MArgs.h"
37#include "MLogManip.h"
38#include "MParList.h"
39#include "MTaskList.h"
40#include "MReadMarsFile.h"
41#include "MGeomApply.h"
42#include "MMcPedestalCopy.h"
43#include "MMcPedestalNSBAdd.h"
44#include "MCerPhotCalc.h"
45#include "MCerPhotAnal2.h"
46//#include "MBlindPixelCalc.h"
47#include "MSigmabarCalc.h"
48#include "MImgCleanStd.h"
49#include "MHillasCalc.h"
50#include "MHillasSrcCalc.h"
51#include "MCT1SupercutsCalc.h"
52#include "MHCamEvent.h"
53#include "MFillH.h"
54#include "MEvtLoop.h"
55
56#include <TApplication.h>
57#include <TSystem.h>
58
59static void StartUpMessage()
60{
61 gLog << all << endl;
62
63 // 1 2 3 4 5
64 // 12345678901234567890123456789012345678901234567890
65 gLog << "==================================================" << endl;
66 gLog << " status - MARS V" << MARSVER << endl;
67 gLog << " MARS - Merging and Preprocessing Program" << endl;
68 gLog << " Compiled on <" << __DATE__ << ">" << endl;
69 gLog << " Using ROOT v" << ROOTVER << endl;
70 gLog << " PROGRAM IS PRELIMINARY - FOR TEST CASES ONLY" << endl;
71 gLog << "==================================================" << endl;
72 gLog << endl;
73}
74
75static void Usage()
76{
77 gLog << all << endl;
78 gLog << "Sorry the usage is:" << endl;
79 gLog << " status [-a0] [-vn] [-cn] inputfile[.root]" << endl << endl;
80 gLog << " input file: Mars root file." << endl;
81 gLog << " -a0: Do not use Ansii codes." << endl;
82 gLog << " -vn: Verbosity level n [default=2]" << endl << endl;
83}
84
85
86int main(int argc, char **argv)
87{
88 StartUpMessage();
89
90 //
91 // Evaluate arguments
92 //
93 MArgs arg(argc, (const char**)argv);
94
95 //
96 // Set verbosity to highest level.
97 //
98 gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
99
100 if (arg.HasOption("-a") && arg.GetIntAndRemove("-a")==0)
101 gLog.SetNoColors();
102
103 //
104 // check for the right usage of the program
105 //
106 if (arg.GetNumArguments()!=1)
107 {
108 Usage();
109 return -1;
110 }
111
112 //
113 // This is to make argv[i] more readable insidethe code
114 //
115 TString kNamein = arg.GetArgumentStr(0);
116
117 if (!kNamein.EndsWith(".root"))
118 kNamein += ".root";
119
120 //
121 // check whether the given files are OK.
122 //
123 if (gSystem->AccessPathName(kNamein, kFileExists))
124 {
125 gLog << err << "Sorry, the input file '" << kNamein << "' doesn't exist." << endl;
126 return -1;
127 }
128
129 TApplication app("Status", &argc, argv);
130 if (gROOT->IsBatch() || !gClient)
131 {
132 gLog << "Bombing... maybe your DISPLAY variable is not set correctly!" << endl;
133 return 1;
134 }
135
136 MArray::Class()->IgnoreTObjectStreamer();
137 MParContainer::Class()->IgnoreTObjectStreamer();
138
139 //
140 // Update frequency by default = 1Hz
141 //
142 MStatusDisplay *d = new MStatusDisplay;
143
144 // Set update time to 5s
145 // d->SetUpdateTime(5000);
146
147 // Disable online update
148 // d->SetUpdateTime(-1);
149
150 d->SetLogStream(&gLog, kTRUE); // Disables output to stdout
151 gLog.SetOutputFile("status.log", kTRUE); // Enable output to file
152 //gLog.EnableOutputDevice(MLog::eStdout); // Enable output to stdout again
153
154 //
155 // Create a empty Parameter List and an empty Task List
156 // The tasklist is identified in the eventloop by its name
157 //
158 MParList plist;
159
160 MTaskList tlist;
161 plist.AddToList(&tlist);
162
163 /*
164 MSrcPosCam src;
165 src.SetXY(1./geomcam.GetConvMm2Deg(), 0);
166 plist.AddToList(&src);
167 */
168
169 //
170 // Now setup the tasks and tasklist:
171 // ---------------------------------
172 //
173 MReadMarsFile read("Events");
174 //read.DisableAutoScheme();
175
176 // ------------- user change -----------------
177 read.AddFile(kNamein);
178
179 MGeomApply geomapl;
180 MMcPedestalCopy pcopy;
181 MMcPedestalNSBAdd pnsb;
182 MCerPhotCalc ncalc;
183// MCerPhotAnal2 ncalc;
184/*
185 TArrayS blinds(6);
186 blinds[0] = 0;
187 blinds[1] = 195;
188 blinds[2] = 227;
189 blinds[3] = 248;
190 blinds[4] = 271;
191 blinds[5] = 291;
192
193 blinds[3] = 51;
194 blinds[4] = 56;
195 blinds[5] = 112;
196 blinds[6] = 31;
197 blinds[7] = 116;
198 blinds[8] = 507;
199 blinds[9] = 559;
200 blinds[10]= 291; // 311, 119, 54, 85, 125, 92, 133, 224
201
202 MBlindPixelCalc blind;
203 blind.SetPixelIndices(blinds);
204 //blind.SetUseInterpolation();
205*/
206 // MSigmabarCalc sgcal;
207 MImgCleanStd clean;
208 MHillasCalc hcalc;
209 MHillasSrcCalc scalc; // !!Preliminary!! Will be removed later!
210 // MCT1SupercutsCalc calc1;
211
212 MHCamEvent hist("PedestalRms");
213 hist.SetType(1);
214 plist.AddToList(&hist);
215
216 // -------------------------------------------
217 MFillH hfill0("Uncleaned [MHCamEvent]", "MCerPhotEvt");
218 MFillH hfill1("Pedestals [MHCamEvent]", "MPedestalCam");
219 MFillH hfill2("PedestalRms", "MPedestalCam");
220 MFillH hfill3("MHHillas", "MHillas");
221 MFillH hfill4("MHHillasExt");
222 MFillH hfill5("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
223 MFillH hfill6("MHHillasSrc","MHillasSrc");
224 MFillH hfill7("MHNewImagePar","MNewImagePar");
225 //MFillH hfill8a("MHStarMap", "MHillas");
226 //MFillH hfill8b("MHStarMap2", "MHillas");
227 MFillH hfill9("Cleaned [MHCamEvent]", "MCerPhotEvt");
228 //MFillH hfill10("MHHadronness", "MHadronness");
229 //MFillH hfill11("MHSigmaTheta");
230
231 tlist.AddToList(&read);
232 tlist.AddToList(&geomapl);
233 tlist.AddToList(&pcopy);
234 tlist.AddToList(&pnsb);
235 tlist.AddToList(&ncalc);
236 //tlist.AddToList(&blind);
237 tlist.AddToList(&hfill0);
238 //tlist.AddToList(&sgcal);
239 tlist.AddToList(&clean);
240 tlist.AddToList(&hcalc);
241 tlist.AddToList(&scalc);
242 //tlist.AddToList(&calc1);
243 tlist.AddToList(&hfill1);
244 tlist.AddToList(&hfill2);
245 tlist.AddToList(&hfill3);
246 tlist.AddToList(&hfill4);
247 tlist.AddToList(&hfill5);
248 tlist.AddToList(&hfill6);
249 tlist.AddToList(&hfill7);
250 //tlist.AddToList(&hfill8a);
251 //tlist.AddToList(&hfill8b);
252 tlist.AddToList(&hfill9);
253 //tlist.AddToList(&hfill10);
254 //tlist.AddToList(&hfill11);
255
256 MEvtLoop evtloop;
257 evtloop.SetParList(&plist);
258 evtloop.SetDisplay(d);
259
260 //
261 // Execute your analysis
262 //
263 if (!evtloop.Eventloop())
264 return 1;
265
266 tlist.PrintStatistics();
267 return 0;
268}
Note: See TracBrowser for help on using the repository browser.