source: trunk/MagicSoft/Mars/macros/readrfl.C@ 2974

Last change on this file since 2974 was 2229, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 2.6 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, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2003
21!
22!
23\* ======================================================================== */
24
25Bool_t HandleInput()
26{
27 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
28 while (1)
29 {
30 //
31 // While reading the input process gui events asynchronously
32 //
33 timer.TurnOn();
34 TString input = Getline("Type 'q' to exit, <return> to go on: ");
35 timer.TurnOff();
36
37 if (input=="q\n")
38 return kFALSE;
39
40 if (input=="\n")
41 return kTRUE;
42 };
43
44 return kFALSE;
45}
46
47Bool_t JumpTo(MTaskList &tlist, MReadRflFile &read, int runno, int evtno)
48{
49 if (runno<0 || evtno<0)
50 return tlist.Process();
51
52 return read.SearchFor(runno, evtno);
53}
54
55void readrfl(int runno=-1, int evtno=-1, const char *fname="Gamma_zbin1_0_7_1140_w0.rfl")
56{
57 MParList plist;
58
59 MGeomCamMagic geomcam;
60 MRflEvtData event;
61 MRflEvtHeader evthead;
62 MRflRunHeader runhead;
63 MTaskList tlist;
64
65 plist.AddToList(&geomcam);
66 plist.AddToList(&event);
67 plist.AddToList(&evthead);
68 plist.AddToList(&runhead);
69 plist.AddToList(&tlist);
70
71 MReadRflFile read(fname);
72 tlist.AddToList(&read);
73
74 MEvtLoop evtloop;
75 evtloop.SetParList(&plist);
76
77 if (!evtloop.PreProcess())
78 return;
79
80 MHCamera display(geomcam);
81 display.Draw();
82 event.Draw();
83
84 cout << "Runno: " << runno << " Eventno: " << evtno << endl;
85
86 while (JumpTo(tlist, read, runno, evtno))
87 {
88 runno = -1;
89
90 cout << "Run #" << runhead.GetRunNumber() << " ";
91 cout << "Event #" << evthead.GetEvtNumber() << endl;
92
93 display.SetCamContent(event);
94 gPad->Modified();
95 gPad->Update();
96 if (!HandleInput())
97 break;
98 }
99
100 evtloop.PostProcess();
101}
Note: See TracBrowser for help on using the repository browser.