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

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