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 | ! Author(s): Harald Kornmayer 1/2001
|
---|
20 | !
|
---|
21 | ! Copyright: MAGIC Software Development, 2000-2002
|
---|
22 | !
|
---|
23 | !
|
---|
24 | \* ======================================================================== */
|
---|
25 |
|
---|
26 | #include "MDataCheck.h"
|
---|
27 |
|
---|
28 | #include <TGButton.h> // TGTextButton
|
---|
29 |
|
---|
30 | #include "MGList.h"
|
---|
31 | #include "MFillH.h"
|
---|
32 | #include "MParList.h"
|
---|
33 | #include "MEvtLoop.h"
|
---|
34 | #include "MHFadcCam.h"
|
---|
35 | #include "MTaskList.h"
|
---|
36 | #include "MReadTree.h"
|
---|
37 | #include "MGDisplayAdc.h"
|
---|
38 |
|
---|
39 | // ---
|
---|
40 |
|
---|
41 | ClassImp(MDataCheck)
|
---|
42 |
|
---|
43 | enum {
|
---|
44 | kButPedAdc = 0x100,
|
---|
45 | kButEvtAdc = 0x101,
|
---|
46 | kButPedTdc = 0x102,
|
---|
47 | kButEvtTdc = 0x103
|
---|
48 | };
|
---|
49 |
|
---|
50 | // --------------------------------------------------------------------------
|
---|
51 | //
|
---|
52 | // Create the 'Data Check' GUI Controls (Window) on the screen. To use it
|
---|
53 | // from within the interpreter you can call a Standard Version with
|
---|
54 | // 'new MDataCheck()'
|
---|
55 | //
|
---|
56 | MDataCheck::MDataCheck(/*const TGWindow *main,*/ const TGWindow *p,
|
---|
57 | const UInt_t w, const UInt_t h)
|
---|
58 | : MBrowser(/*main,*/ p, w, h)
|
---|
59 | {
|
---|
60 | //TGTextButton *pedadc = new TGTextButton(fTop1, "ADC Spectra of Pedestals", kButPedAdc);
|
---|
61 | TGTextButton *cradc = new TGTextButton(fTop1, "ADC Spectra of Cosmics", kButEvtAdc);
|
---|
62 | //TGTextButton *pedtdc = new TGTextButton(fTop3, "Run Spectra of Pedestals", kButPedTdc);
|
---|
63 | //TGTextButton *crtdc = new TGTextButton(fTop3, "Run Spectra of Cosmics", kButEvtTdc);
|
---|
64 |
|
---|
65 | //pedadc->Associate(this);
|
---|
66 | cradc ->Associate(this);
|
---|
67 | //pedtdc->Associate(this);
|
---|
68 | //crtdc ->Associate(this);
|
---|
69 |
|
---|
70 | //fList->Add(pedadc);
|
---|
71 | fList->Add(cradc);
|
---|
72 | //fList->Add(pedtdc);
|
---|
73 | //fList->Add(crtdc);
|
---|
74 |
|
---|
75 | TGLayoutHints *laybut = new TGLayoutHints(kLHintsTop|kLHintsLeft, 10, 10, 5, 5);
|
---|
76 | fList->Add(laybut);
|
---|
77 |
|
---|
78 | //fTop1->AddFrame(pedadc, laybut);
|
---|
79 | fTop1->AddFrame(cradc, laybut);
|
---|
80 |
|
---|
81 | //fTop3->AddFrame(pedtdc, laybut);
|
---|
82 | //fTop3->AddFrame(crtdc, laybut);
|
---|
83 |
|
---|
84 | MapSubwindows();
|
---|
85 |
|
---|
86 | Layout();
|
---|
87 |
|
---|
88 | SetWindowName("DataCheck Window");
|
---|
89 | SetIconName("DataCheck");
|
---|
90 |
|
---|
91 | MapWindow();
|
---|
92 | }
|
---|
93 |
|
---|
94 | // --------------------------------------------------------------------------
|
---|
95 | //
|
---|
96 | // Create the 'View Adc' GUI Controls (Window) on the screen.
|
---|
97 | // Therefor we have to process all data in a file and fill the corresponding
|
---|
98 | // histograms.
|
---|
99 | //
|
---|
100 | void MDataCheck::View(const char *inputfile, const char *treeName, MHFadcPix::Type_t t)
|
---|
101 | {
|
---|
102 | //
|
---|
103 | // create a (empty) list of parameters which can be used by the tasks
|
---|
104 | // and an (empty) list of tasks which should be executed
|
---|
105 | // connect them in the required way.
|
---|
106 | //
|
---|
107 |
|
---|
108 | //
|
---|
109 | // create the data containers for the raw data
|
---|
110 | //
|
---|
111 | MParList plist;
|
---|
112 |
|
---|
113 | //
|
---|
114 | // set up the tasks for this job
|
---|
115 | //
|
---|
116 | MTaskList tasks;
|
---|
117 | plist.AddToList(&tasks);
|
---|
118 |
|
---|
119 | MReadTree read(treeName, inputfile);
|
---|
120 | read.DisableAutoScheme();
|
---|
121 |
|
---|
122 | MHFadcCam hist(t);
|
---|
123 | plist.AddToList(&hist);
|
---|
124 |
|
---|
125 | MFillH fill(&hist, "MRawEvtData");
|
---|
126 |
|
---|
127 | tasks.AddToList(&read);
|
---|
128 | tasks.AddToList(&fill);
|
---|
129 |
|
---|
130 | //
|
---|
131 | // set up the loop for the processing
|
---|
132 | //
|
---|
133 | MEvtLoop magic;
|
---|
134 | magic.SetParList(&plist);
|
---|
135 |
|
---|
136 | //
|
---|
137 | // Add ProgressBar to window
|
---|
138 | //
|
---|
139 | TGProgressBar *bar = CreateProgressBar(fTop1);
|
---|
140 | magic.SetProgressBar(bar);
|
---|
141 |
|
---|
142 | //
|
---|
143 | // Execute your analysis
|
---|
144 | //
|
---|
145 | Bool_t rc = magic.Eventloop();
|
---|
146 |
|
---|
147 | //
|
---|
148 | // Remove progressbar from window
|
---|
149 | //
|
---|
150 | DestroyProgressBar(bar);
|
---|
151 |
|
---|
152 | if (!rc)
|
---|
153 | return;
|
---|
154 |
|
---|
155 | new MGDisplayAdc(&hist);
|
---|
156 | }
|
---|
157 |
|
---|
158 | // --------------------------------------------------------------------------
|
---|
159 | //
|
---|
160 | // Process the GUI control events (here: mainly button clicks)
|
---|
161 | //
|
---|
162 | Bool_t MDataCheck::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
|
---|
163 | {
|
---|
164 | // Process events generated by the buttons in the frame.
|
---|
165 |
|
---|
166 | if (GET_MSG(msg)!=kC_COMMAND || GET_SUBMSG(msg)!=kCM_BUTTON)
|
---|
167 | return MBrowser::ProcessMessage(msg, parm1, parm2);
|
---|
168 |
|
---|
169 | switch (parm1)
|
---|
170 | {
|
---|
171 | case kButPedAdc:
|
---|
172 | case kButEvtAdc:
|
---|
173 | case kButPedTdc:
|
---|
174 | case kButEvtTdc:
|
---|
175 | if (!InputFileSelected())
|
---|
176 | {
|
---|
177 | DisplError("No Input (root) File selected!");
|
---|
178 | return kTRUE;
|
---|
179 | }
|
---|
180 |
|
---|
181 | switch (parm1)
|
---|
182 | {
|
---|
183 | case kButPedAdc:
|
---|
184 | View(fInputFile, "PedEvents", MHFadcPix::kValue);
|
---|
185 | return kTRUE;
|
---|
186 |
|
---|
187 | case kButEvtAdc:
|
---|
188 | View(fInputFile, "Events", MHFadcPix::kValue);
|
---|
189 | return kTRUE;
|
---|
190 |
|
---|
191 | case kButPedTdc:
|
---|
192 | View(fInputFile, "PedEvents", MHFadcPix::kSlices);
|
---|
193 | return kTRUE;
|
---|
194 |
|
---|
195 | case kButEvtTdc:
|
---|
196 | View(fInputFile, "Events", MHFadcPix::kSlices);
|
---|
197 | return kTRUE;
|
---|
198 | }
|
---|
199 | return kTRUE;
|
---|
200 | }
|
---|
201 |
|
---|
202 | return MBrowser::ProcessMessage(msg, parm1, parm2);
|
---|
203 | }
|
---|