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

Last change on this file since 2384 was 2377, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 2.8 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 MHillasExt hillasext;
54 MNewImagePar newimgpar;
55 MTaskList tlist;
56
57 plist.AddToList(&geomcam);
58 plist.AddToList(&hillas);
59 plist.AddToList(&hillasext);
60 plist.AddToList(&newimgpar);
61 plist.AddToList(&tlist);
62
63 MCT1ReadAscii read(fname);
64 MGeomApply geomapl;
65 MClone clone("MCerPhotEvt");
66 MImgCleanStd clean;
67 MHillasCalc hcalc;
68
69 tlist.AddToList(&read);
70 tlist.AddToList(&clone);
71 tlist.AddToList(&clean);
72 tlist.AddToList(&hcalc);
73
74 MEvtLoop evtloop;
75 evtloop.SetParList(&plist);
76
77 if (!evtloop.PreProcess())
78 return;
79
80 Int_t icount = 0;
81 MHCamera display(geomcam);
82 display.Draw();
83
84 while ((rc=tlist.Process()))
85 {
86 cout << "Event #" << icount++ << endl;
87
88 MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
89 if (!evt) // If skipped due to MInputStreamId
90 continue;
91
92 display.SetCamContent(*evt);
93 display.Update();
94
95 if (!HandleInput())
96 break;
97
98 hillas.Draw();
99 hillas.Print();
100 hillasext.Print();
101 newimgpar.Print();
102
103 display.SetCamContent(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
104 display.Update();
105
106 if (!HandleInput())
107 break;
108 }
109
110 evtloop.PostProcess();
111}
Note: See TracBrowser for help on using the repository browser.