source: trunk/MagicSoft/Mars/mmain/MDataCheck.cc@ 1103

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