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

Last change on this file since 1023 was 1023, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 4.9 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): 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
39ClassImp(MDataCheck)
40
41enum {
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//
54MDataCheck::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(fTop2, "ADC Spectra of Pedestals", kButPedAdc);
59 TGTextButton *cradc = new TGTextButton(fTop2, "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 fTop2->AddFrame(pedadc, laybut);
77 fTop2->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//
98void 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 readin(treeName, inputfile);
118 tasks.AddToList(&readin);
119
120 MFillH fillspect("MRawEvtData", "MHFadcCam");
121 tasks.AddToList(&fillspect);
122
123 //
124 // set up the loop for the processing
125 //
126 MEvtLoop magic;
127 magic.SetParList(&plist);
128
129 // ADD ProgressBar, TGHProgressBar::ShowStatus();
130
131 //
132 // start the loop running
133 //
134 if (!magic.Eventloop())
135 return;
136
137 new MGDisplayAdc((MHFadcCam*)plist.FindObject("MHFadcCam"));
138}
139
140// --------------------------------------------------------------------------
141//
142// Process the GUI control events (here: mainly button clicks)
143//
144Bool_t MDataCheck::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
145{
146 // Process events generated by the buttons in the frame.
147
148 if (GET_MSG(msg)!=kC_COMMAND || GET_SUBMSG(msg)!=kCM_BUTTON)
149 return MBrowser::ProcessMessage(msg, parm1, parm2);
150
151 switch (parm1)
152 {
153 case kButPedAdc:
154 case kButEvtAdc:
155 case kButPedTdc:
156 case kButEvtTdc:
157 if (!InputFileSelected())
158 {
159 DisplError("No Input (root) File selected!");
160 return kTRUE;
161 }
162
163 switch (parm1)
164 {
165 case kButPedAdc:
166 ViewAdcSpectra(fInputFile, "PedEvents");
167 return kTRUE;
168
169 case kButEvtAdc:
170 ViewAdcSpectra(fInputFile, "Events");
171 return kTRUE;
172
173 case kButPedTdc:
174 // fOctober.PedTdcSpectra(fInputFile) ;
175 return kTRUE;
176
177 case kButEvtTdc:
178 return kTRUE;
179 }
180 return kTRUE;
181 }
182
183 return MBrowser::ProcessMessage(msg, parm1, parm2);
184}
Note: See TracBrowser for help on using the repository browser.