source: branches/Mars_use_drstimefiles/macros/tutorials/readrfl.C@ 18066

Last change on this file since 18066 was 8940, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 2.7 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="~msmeyer/MC/MagicSoft/Simulation/Detector/ReflectorII/resultsQi/000302.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 gPad->cd(1);
83 event.Draw();
84
85
86
87 cout << "Runno: " << runno << " Eventno: " << evtno << endl;
88
89 runhead.Print();
90
91 while (JumpTo(tlist, read, runno, evtno))
92 {
93 runno = -1;
94
95 cout << "Run #" << runhead.GetRunNumber() << " ";
96 cout << "Event #" << evthead.GetEvtNumber() << endl;
97
98 evthead.Print();
99
100 display.SetCamContent(event);
101
102 if (display.GetMean()<1e-5)
103 continue;
104
105 gPad->Modified();
106 gPad->Update();
107
108 if (!HandleInput())
109 break;
110 }
111
112 evtloop.PostProcess();
113}
Note: See TracBrowser for help on using the repository browser.