source: trunk/MagicSoft/Mars/macros/readMagic.C@ 1947

Last change on this file since 1947 was 1947, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.9 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 <mailto:tbretz@uni-sw.gwdg.de>
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26Bool_t HandleInput()
27{
28 TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
29 while (1)
30 {
31 //
32 // While reading the input process gui events asynchronously
33 //
34 timer.TurnOn();
35 TString input = Getline("Type 'q' to exit, <return> to go on: ");
36 timer.TurnOff();
37
38 if (input=="q\n")
39 return kFALSE;
40
41 if (input=="\n")
42 return kTRUE;
43 };
44
45 return kFALSE;
46}
47
48void readMagic(const char *fname="~/data/Gamma_0_7*.root")
49{
50 MParList plist;
51
52 MGeomCamMagic geomcam;
53 MHillasExt hillas;
54 MTaskList tlist;
55
56 plist.AddToList(&geomcam);
57 plist.AddToList(&hillas);
58 plist.AddToList(&tlist);
59
60 MReadMarsFile read("Events", fname);
61 read.DisableAutoScheme();
62
63 MPrint print1("MMcEvt");
64 MPrint print2("MRawEvtHeader");
65 print1.EnableSkip();
66 print2.EnableSkip();
67
68 MMcPedestalCopy pcopy;
69 MMcPedestalNSBAdd pnsb;
70 MCerPhotCalc ncalc;
71 MBlindPixelCalc blind;
72 blind.SetUseInterpolation();
73 MClone clone("MCerPhotEvt");
74 MImgCleanStd clean;
75 MHillasCalc hcalc;
76
77
78 tlist.AddToList(&read);
79 tlist.AddToList(&print1);
80 tlist.AddToList(&print2);
81 tlist.AddToList(&pcopy);
82 tlist.AddToList(&pnsb);
83 tlist.AddToList(&ncalc);
84 tlist.AddToList(&blind);
85 tlist.AddToList(&clone);
86 tlist.AddToList(&clean);
87 tlist.AddToList(&hcalc);
88
89 MEvtLoop evtloop;
90 evtloop.SetParList(&plist);
91
92 if (!evtloop.PreProcess())
93 return;
94
95 MCamDisplay display(&geomcam);
96 display.Draw();
97
98 while (tlist.Process())
99 {
100 cout << "Event #" << read.GetNumEntry() ":" << endl;
101
102 display.DrawPhotNum((MCerPhotEvt*)clone.GetClone());
103
104 if (!HandleInput())
105 break;
106
107 hillas.Print();
108 hillas.Draw();
109
110 display.DrawPhotNum((MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
111
112 if (!HandleInput())
113 break;
114 }
115
116 evtloop.PostProcess();
117}
118
Note: See TracBrowser for help on using the repository browser.