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

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