source: trunk/MagicSoft/Mars/macros/readCT1.C@ 1865

Last change on this file since 1865 was 1325, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.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 12/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
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 readCT1(const char *fname="~/data/CT1_97_on1.dat")
48{
49 MParList plist;
50
51 MGeomCamCT1 geomcam;
52 MHillas hillas;
53 MTaskList tlist;
54
55 plist.AddToList(&geomcam);
56 plist.AddToList(&hillas);
57 plist.AddToList(&tlist);
58
59 MCT1ReadAscii read(fname);
60 MClone clone("MCerPhotEvt");
61 MImgCleanStd clean;
62 MHillasCalc hcalc;
63
64 tlist.AddToList(&read);
65 tlist.AddToList(&clone);
66 tlist.AddToList(&clean);
67 tlist.AddToList(&hcalc);
68
69 MEvtLoop evtloop;
70 evtloop.SetParList(&plist);
71
72 if (!evtloop.PreProcess())
73 return;
74
75 Int_t icount = 0;
76 MCamDisplay display(&geomcam);
77 display.Draw();
78
79 while (tlist.Process())
80 {
81 cout << "Event #" << icount++ << endl;
82
83 MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
84
85 if (!evt)
86 continue;
87
88 display.DrawPhotNum(evt);
89
90 if (!HandleInput())
91 break;
92
93 hillas.Print();
94 hillas.Draw();
95 display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
96
97 if (!HandleInput())
98 break;
99 }
100
101 evtloop.PostProcess();
102}
Note: See TracBrowser for help on using the repository browser.