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

Last change on this file since 959 was 959, checked in by tbretz, 23 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// ---
31
32#include "MParList.h"
33#include "MTaskList.h"
34#include "MEvtLoop.h"
35#include "MReadTree.h"
36#include "MFillH.h"
37#include "MGDisplayAdc.h"
38
39// ---
40
41ClassImp(MDataCheck)
42
43enum {
44 M_BUTTON_PEDADC,
45 M_BUTTON_CRADC,
46 M_BUTTON_PEDTDC,
47 M_BUTTON_CRTDC
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//
56MDataCheck::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(fTop2, "ADC Spectra of Pedestals", M_BUTTON_PEDADC);
61 TGTextButton *cradc = new TGTextButton(fTop2, "ADC Specta of Cosmics", M_BUTTON_CRADC);
62 TGTextButton *pedtdc = new TGTextButton(fTop3, "TDC Spectra of Pedestals", M_BUTTON_PEDTDC);
63 TGTextButton *crtdc = new TGTextButton(fTop3, "TDC Specta of Cosmics", M_BUTTON_CRTDC);
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 fTop2->AddFrame(pedadc, laybut);
79 fTop2->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//
100void MDataCheck::ViewAdcSpectra(Char_t *inputfile, Char_t *treeName)
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 readin(treeName, inputfile);
120 tasks.AddToList(&readin);
121
122 MFillH fillspect("MRawEvtData", "MHFadcCam");
123 tasks.AddToList(&fillspect);
124
125 //
126 // set up the loop for the processing
127 //
128 MEvtLoop magic;
129 magic.SetParList(&plist);
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 M_BUTTON_PEDADC:
154 case M_BUTTON_CRADC:
155 case M_BUTTON_PEDTDC:
156 case M_BUTTON_CRTDC:
157 if (!InputFileSelected())
158 {
159 DisplError("No Input (root) File selected!");
160 return kTRUE;
161 }
162
163 switch (parm1)
164 {
165 case M_BUTTON_PEDADC:
166 ViewAdcSpectra(fInputFile, "PedEvents");
167 return kTRUE;
168
169 case M_BUTTON_CRADC:
170 ViewAdcSpectra(fInputFile, "Events");
171 return kTRUE;
172
173 case M_BUTTON_PEDTDC:
174 // fOctober.PedTdcSpectra(fInputFile) ;
175 return kTRUE;
176
177 case M_BUTTON_CRTDC:
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.