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 |
|
---|
26 | Bool_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 |
|
---|
48 | void readMagic(const char *fname="~/Proton_zbin0_0_7_11650to11659_w0.root")
|
---|
49 | {
|
---|
50 | MParList plist;
|
---|
51 |
|
---|
52 | MHillas hillas;
|
---|
53 | MHillasExt hillasext;
|
---|
54 | MNewImagePar newimgpar;
|
---|
55 | MTaskList tlist;
|
---|
56 |
|
---|
57 | plist.AddToList(&hillas);
|
---|
58 | plist.AddToList(&hillasext);
|
---|
59 | plist.AddToList(&newimgpar);
|
---|
60 | plist.AddToList(&tlist);
|
---|
61 |
|
---|
62 | MReadMarsFile read("Events", fname);
|
---|
63 | read.DisableAutoScheme();
|
---|
64 |
|
---|
65 | MGeomApply geomapl;
|
---|
66 | MPrint print1("MMcEvt");
|
---|
67 | MPrint print2("MRawEvtHeader");
|
---|
68 | print1.EnableSkip();
|
---|
69 | print2.EnableSkip();
|
---|
70 |
|
---|
71 | MMcPedestalCopy pcopy;
|
---|
72 | MMcPedestalNSBAdd pnsb;
|
---|
73 | MCerPhotCalc ncalc;
|
---|
74 | MBlindPixelCalc blind;
|
---|
75 | blind.SetUseInterpolation();
|
---|
76 | MClone clone("MCerPhotEvt");
|
---|
77 | MImgCleanStd clean;
|
---|
78 | MHillasCalc hcalc;
|
---|
79 |
|
---|
80 | tlist.AddToList(&read);
|
---|
81 | tlist.AddToList(&geomapl);
|
---|
82 | tlist.AddToList(&print1);
|
---|
83 | tlist.AddToList(&print2);
|
---|
84 | tlist.AddToList(&pcopy);
|
---|
85 | tlist.AddToList(&pnsb);
|
---|
86 | tlist.AddToList(&ncalc);
|
---|
87 | tlist.AddToList(&blind);
|
---|
88 | tlist.AddToList(&clone);
|
---|
89 | tlist.AddToList(&clean);
|
---|
90 | tlist.AddToList(&hcalc);
|
---|
91 |
|
---|
92 | MEvtLoop evtloop;
|
---|
93 | evtloop.SetParList(&plist);
|
---|
94 |
|
---|
95 | if (!evtloop.PreProcess())
|
---|
96 | return;
|
---|
97 |
|
---|
98 | MHCamera display1(geomcam);
|
---|
99 | MHCamera display2(geomcam);
|
---|
100 |
|
---|
101 | TCanvas c("Events", "Real Events", 300, 600);
|
---|
102 | c.SetBorderMode(0);
|
---|
103 | c.Divide(1,2);
|
---|
104 | c.cd(1);
|
---|
105 | gPad->SetBorderMode(0);
|
---|
106 | gPad->Divide(1,1);
|
---|
107 | gPad->cd(1);
|
---|
108 | gPad->SetBorderMode(0);
|
---|
109 | display1.Draw();
|
---|
110 | c.cd(2);
|
---|
111 | gPad->SetBorderMode(0);
|
---|
112 | gPad->Divide(1,1);
|
---|
113 | gPad->cd(1);
|
---|
114 | gPad->SetBorderMode(0);
|
---|
115 | display2.Draw();
|
---|
116 |
|
---|
117 | // Use this if you don't want the event to be autoscaled
|
---|
118 | //display.SetMinimum(0);
|
---|
119 | //display.SetMaximum(100);
|
---|
120 |
|
---|
121 | while (tlist.Process())
|
---|
122 | {
|
---|
123 | cout << "Event #" << read.GetNumEntry() ":" << endl;
|
---|
124 |
|
---|
125 | display1.SetCamContent(*(MCerPhotEvt*)clone.GetClone());
|
---|
126 | display2.SetCamContent(*(MCerPhotEvt*)plist.FindObject("MCerPhotEvt"));
|
---|
127 |
|
---|
128 | c->cd(1);
|
---|
129 | gPad->cd(1);
|
---|
130 | gPad->Modified();
|
---|
131 | gPad->Update();
|
---|
132 | c->cd(2);
|
---|
133 | gPad->cd(1);
|
---|
134 | hillas.Draw();
|
---|
135 | gPad->Modified();
|
---|
136 | gPad->Update();
|
---|
137 |
|
---|
138 | hillas.Print();
|
---|
139 | hillasext.Print();
|
---|
140 | newimgpar.Print();
|
---|
141 |
|
---|
142 | if (!HandleInput())
|
---|
143 | break;
|
---|
144 | }
|
---|
145 |
|
---|
146 | evtloop.PostProcess();
|
---|
147 | }
|
---|
148 |
|
---|