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