source: branches/Mars_McMismatchStudy/macros/tutorials/readcurrents.C@ 18086

Last change on this file since 18086 was 7160, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 2.3 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
47void readcurrents(const char *fname="../currents/dcs_arcturus.dat")
48{
49 MParList plist;
50
51 MGeomCamMagic geomcam;
52 MCameraDC cur;
53 MTaskList tlist;
54
55 plist.AddToList(&geomcam);
56 plist.AddToList(&cur);
57 plist.AddToList(&tlist);
58
59 MReportFileRead read(fname);
60 read.SetHasNoHeader();
61 read.AddToList("MReportCurrents");
62
63 tlist.AddToList(&read);
64
65 MEvtLoop evtloop;
66 evtloop.SetParList(&plist);
67
68 if (!evtloop.PreProcess())
69 return;
70
71 MHCamera display(geomcam);
72 display.Draw();
73 gPad->SetLogy();
74
75 int gifcnt = 0;
76
77 while (tlist.Process())
78 {
79 // cur.Print();
80 display.SetCamContent(cur);
81 gPad->GetPad(1)->Modified();
82 gPad->GetPad(1)->Update();
83 // Remove the comments if you want to go through the file
84 // event-by-event:
85 if (!HandleInput())
86 break;
87 }
88
89 evtloop.PostProcess();
90}
Note: See TracBrowser for help on using the repository browser.