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 | MHCamera display[4];
|
---|
49 |
|
---|
50 | TCanvas *c;
|
---|
51 | MParList *fParList;
|
---|
52 | MTaskList *fTaskList;
|
---|
53 |
|
---|
54 | Int_t PreProcess(MParList *plist)
|
---|
55 | {
|
---|
56 | fParList = plist;
|
---|
57 | fTaskList = (MTaskList*)plist->FindObject("MTaskList");
|
---|
58 |
|
---|
59 | MGeomCam *geomcam = (MGeomCam*)plist->FindObject("MGeomCam");
|
---|
60 |
|
---|
61 | c = new TCanvas("Events", "Real Events", 600, 600);
|
---|
62 | c->SetBorderMode(0);
|
---|
63 | c->Divide(2,2);
|
---|
64 | for (int i=0; i<4; i++)
|
---|
65 | {
|
---|
66 | display[i].SetGeometry(*geomcam);
|
---|
67 | c->cd(i+1);
|
---|
68 | display[i].Draw();
|
---|
69 | gPad->cd(1);
|
---|
70 | plist->FindObject("MHillas")->Draw();
|
---|
71 | }
|
---|
72 | return kTRUE;
|
---|
73 | }
|
---|
74 |
|
---|
75 | Int_t Process()
|
---|
76 | {
|
---|
77 | MReadMarsFile *read = (MReadMarsFile*)fTaskList->FindObject("MRead");
|
---|
78 | MClone *clone = (MClone*)fTaskList->FindObject("MClone");
|
---|
79 | MImgCleanStd *clean = (MImgCleanStd*)fTaskList->FindObject("MImgCleanStd");
|
---|
80 | MGeomCam *geom = (MGeomCam*)fParList->FindObject("MGeomCam");
|
---|
81 |
|
---|
82 | cout << "Event #" << read->GetNumEntry() << ":" << endl;
|
---|
83 |
|
---|
84 | display[0].SetCamContent(*(MCerPhotEvt*)clone->GetClone());
|
---|
85 | display[1].SetCamContent(*(MCerPhotEvt*)fParList->FindObject("MCerPhotEvt"));
|
---|
86 | display[2].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData"));
|
---|
87 | display[3].SetCamContent(*(MCameraData*)fParList->FindObject("MCameraData"));
|
---|
88 |
|
---|
89 | TArrayF lvl(2);
|
---|
90 | lvl[0] = clean->GetCleanLvl2();
|
---|
91 | lvl[1] = clean->GetCleanLvl1();
|
---|
92 | display[3].SetLevels(lvl);
|
---|
93 |
|
---|
94 | for (int i=1; i<=4; i++)
|
---|
95 | {
|
---|
96 | c->GetPad(i)->GetPad(1)->Modified();
|
---|
97 | c->GetPad(i)->GetPad(1)->Update();
|
---|
98 | }
|
---|
99 |
|
---|
100 | ((MHillas*)fParList->FindObject("MHillas"))->Print(*geom);
|
---|
101 | ((MHillasExt*)fParList->FindObject("MHillasExt"))->Print(*geom);
|
---|
102 | fParList->FindObject("MNewImagePar")->Print();
|
---|
103 |
|
---|
104 | return HandleInput();
|
---|
105 | }
|
---|
106 |
|
---|
107 | Int_t PostProcess()
|
---|
108 | {
|
---|
109 | delete c;
|
---|
110 | }
|
---|
111 |
|
---|
112 | void readMagic(const char *fname="../Proton*.root")
|
---|
113 | {
|
---|
114 | MParList plist;
|
---|
115 | MTaskList tlist;
|
---|
116 |
|
---|
117 | plist.AddToList(&tlist);
|
---|
118 |
|
---|
119 | MReadMarsFile read("Events", fname);
|
---|
120 | read.DisableAutoScheme();
|
---|
121 |
|
---|
122 | MGeomApply geomapl;
|
---|
123 | MPrint print1("MMcEvt");
|
---|
124 | MPrint print2("MRawEvtHeader");
|
---|
125 | print1.EnableSkip();
|
---|
126 | print2.EnableSkip();
|
---|
127 |
|
---|
128 | MMcPedestalCopy pcopy;
|
---|
129 | MMcPedestalNSBAdd pnsb;
|
---|
130 | MCerPhotAnal2 ncalc;
|
---|
131 | MBlindPixelCalc blind;
|
---|
132 | blind.SetUseInterpolation();
|
---|
133 | MClone clone("MCerPhotEvt");
|
---|
134 | MImgCleanStd clean;
|
---|
135 | MHillasCalc hcalc;
|
---|
136 | MTaskInteractive mytask;
|
---|
137 |
|
---|
138 | mytask.SetPreProcess(PreProcess);
|
---|
139 | mytask.SetProcess(Process);
|
---|
140 |
|
---|
141 | tlist.AddToList(&read);
|
---|
142 | tlist.AddToList(&geomapl);
|
---|
143 | tlist.AddToList(&print1);
|
---|
144 | tlist.AddToList(&print2);
|
---|
145 | tlist.AddToList(&pcopy);
|
---|
146 | tlist.AddToList(&pnsb);
|
---|
147 | tlist.AddToList(&ncalc);
|
---|
148 | tlist.AddToList(&blind);
|
---|
149 | tlist.AddToList(&clone);
|
---|
150 | tlist.AddToList(&clean);
|
---|
151 | tlist.AddToList(&hcalc);
|
---|
152 | tlist.AddToList(&mytask);
|
---|
153 |
|
---|
154 | MEvtLoop evtloop;
|
---|
155 | evtloop.SetParList(&plist);
|
---|
156 |
|
---|
157 | if (!evtloop.Eventloop())
|
---|
158 | return;
|
---|
159 |
|
---|
160 | tlist.PrintStatistics();
|
---|
161 | }
|
---|
162 |
|
---|