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

Last change on this file since 2525 was 2512, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 3.2 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 display1(*geomcam);
85 MHCamera display2(*geomcam);
86
87 TCanvas c("Events", "Real Events", 300, 600);
88 c.SetBorderMode(0);
89 c.Divide(1,2);
90 c.cd(1);
91 display1.Draw();
92 gPad->cd(1);
93 hillas.Draw();
94 c.cd(2);
95 display2.Draw();
96 gPad->cd(1);
97 hillas.Draw();
98
99 while ((rc=tlist.Process()))
100 {
101 cout << "Event #" << icount++ << endl;
102
103 MCerPhotEvt *evt = (MCerPhotEvt*)clone.GetClone();
104 if (!evt) // If skipped due to MInputStreamId
105 continue;
106
107 display1.SetCamContent(*(MCerPhotEvt*)clone.GetClone());
108 display2.SetCamContent(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
109
110 c->GetPad(1)->GetPad(1)->Modified();
111 c->GetPad(1)->GetPad(1)->Update();
112 c->GetPad(2)->GetPad(1)->Modified();
113 c->GetPad(2)->GetPad(1)->Update();
114
115 hillas.Print();
116 hillasext.Print();
117 newimgpar.Print();
118
119 if (!HandleInput())
120 break;
121 }
122
123 evtloop.PostProcess();
124}
Note: See TracBrowser for help on using the repository browser.