1 | //
|
---|
2 | //
|
---|
3 | //
|
---|
4 | #define START_DIRECTORY "/dat1"
|
---|
5 | #define S_ISDIR(m) (((m)&(0170000)) == (0040000))
|
---|
6 | #define PI 3.1415926
|
---|
7 |
|
---|
8 | #include <TApplication.h>
|
---|
9 | #include <TGMsgBox.h>
|
---|
10 |
|
---|
11 | #include "MainFrameSimone.hxx"
|
---|
12 |
|
---|
13 |
|
---|
14 | char NtupName[5][20] = {"WaveLen", "PosY:PosX", "Height", "Time", "DireY:DireX" } ;
|
---|
15 |
|
---|
16 |
|
---|
17 | MainFrameSimone::MainFrameSimone(const TGWindow *p, UInt_t w, UInt_t h)
|
---|
18 | : TGMainFrame(p, w, h)
|
---|
19 | {
|
---|
20 | sprintf (fInputPath, "\0" ) ;
|
---|
21 | fNumEvents = 0 ;
|
---|
22 |
|
---|
23 | fEvtNb = 0 ;
|
---|
24 |
|
---|
25 | //
|
---|
26 | // set up the NTuples
|
---|
27 | //
|
---|
28 | fNtup = new TNtuple ("fNtup", "Ntuple with Run distributions",
|
---|
29 | "PartID:Energy:CoreX:CoreY:Theta:Phi:FirstInt") ;
|
---|
30 |
|
---|
31 | fNtupEvt = new TNtuple ("fNtupEvt", "Ntuple with Event distributions",
|
---|
32 | "WaveLen:PosX:PosY:Height:Time:DireX:DireY") ;
|
---|
33 |
|
---|
34 | //
|
---|
35 | // Create a main frame with a number of different buttons.
|
---|
36 | //
|
---|
37 |
|
---|
38 | //
|
---|
39 | // First create the MenuBar.
|
---|
40 | //
|
---|
41 |
|
---|
42 | fLayMenuBar = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX,
|
---|
43 | 2, 2, 2, 2 ) ;
|
---|
44 | fLayMenuItem = new TGLayoutHints ( kLHintsTop | kLHintsLeft ,
|
---|
45 | 0, 4, 0, 0 ) ;
|
---|
46 |
|
---|
47 |
|
---|
48 | fFileMenu = new TGPopupMenu ( fClient->GetRoot() ) ;
|
---|
49 | fFileMenu->AddEntry ("Exit", M_FILE_EXIT ) ;
|
---|
50 |
|
---|
51 |
|
---|
52 | //
|
---|
53 | // the button messages are handled by main frame (this)
|
---|
54 | //
|
---|
55 | fFileMenu->Associate(this) ;
|
---|
56 |
|
---|
57 | fMenuBar = new TGMenuBar ( this, 1, 1, kHorizontalFrame ) ;
|
---|
58 | fMenuBar->AddPopup("File", fFileMenu, fLayMenuItem ) ;
|
---|
59 |
|
---|
60 | AddFrame(fMenuBar, fLayMenuBar ) ;
|
---|
61 |
|
---|
62 |
|
---|
63 | //
|
---|
64 | // create the Tab
|
---|
65 | //
|
---|
66 |
|
---|
67 | fFrame = new TGCompositeFrame (this, 300,300, kHorizontalFrame ) ;
|
---|
68 |
|
---|
69 | fLayTab = new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX , 5, 5, 5, 5 ) ;
|
---|
70 | fTab = new TGTab ( fFrame, 400, 400 ) ;
|
---|
71 |
|
---|
72 | TGCompositeFrame *tf = fTab->AddTab("Input") ;
|
---|
73 | fTabF1 = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ;
|
---|
74 |
|
---|
75 | tf->AddFrame(fTabF1, fLayTab ) ;
|
---|
76 |
|
---|
77 | fTabF1a = new TGCompositeFrame (tf, 100, 100, kHorizontalFrame) ;
|
---|
78 | tf->AddFrame(fTabF1a, new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
79 |
|
---|
80 | fTabF1b = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
---|
81 | tf->AddFrame(fTabF1b, new TGLayoutHints ( kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY , 5, 5, 5, 5 ) ) ;
|
---|
82 |
|
---|
83 | fDir = new TGListBox(fTabF1, -1) ;
|
---|
84 | fDir->Resize(350,20) ;
|
---|
85 | char temp[100] ;
|
---|
86 | // sprintf ( temp, "%s", START_DIRECTORY ) ;
|
---|
87 | sprintf ( temp, "%s", gSystem->WorkingDirectory() ) ;
|
---|
88 | fDir->AddEntry(temp, 1) ;
|
---|
89 | fTabF1->AddFrame( fDir, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
90 |
|
---|
91 |
|
---|
92 | fPicCdup = fClient->GetPicture("tb_uplevel.xpm") ;
|
---|
93 | fCdup = new TGPictureButton(fTabF1, fPicCdup, M_CDIR_UP ) ;
|
---|
94 | fCdup->SetToolTipText("One Level up!") ;
|
---|
95 | fCdup->Associate(this) ;
|
---|
96 | fTabF1->AddFrame (fCdup, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
---|
97 |
|
---|
98 | fPicList = fClient->GetPicture("tb_list.xpm") ;
|
---|
99 | fListMode = new TGPictureButton(fTabF1, fPicList, M_LIST_MODE ) ;
|
---|
100 | fListMode->SetToolTipText("List Mode") ;
|
---|
101 | fListMode->Associate(this) ;
|
---|
102 | fListMode->SetState(kButtonUp) ;
|
---|
103 | fListMode->AllowStayDown(kTRUE) ;
|
---|
104 | fTabF1->AddFrame (fListMode, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
---|
105 |
|
---|
106 | fPicDetail = fClient->GetPicture("tb_details.xpm") ;
|
---|
107 | fDetail = new TGPictureButton(fTabF1, fPicDetail, M_DETAIL_MODE ) ;
|
---|
108 | fDetail->SetToolTipText("Details Mode") ;
|
---|
109 | fDetail->Associate(this) ;
|
---|
110 | fDetail->SetState(kButtonEngaged) ;
|
---|
111 | fDetail->AllowStayDown(kTRUE) ;
|
---|
112 | fTabF1->AddFrame (fDetail, new TGLayoutHints(kLHintsLeft | kLHintsTop, 5, 5, 5, 5) ) ;
|
---|
113 |
|
---|
114 |
|
---|
115 | fSelectButton = new TGTextButton(fTabF1b, "Select", M_BUTTON_SELECT );
|
---|
116 | fSelectButton->SetToolTipText("To select a path with Mmcs data files!");
|
---|
117 | fSelectButton->SetState(kButtonDisabled);
|
---|
118 | fSelectButton->Associate(this) ;
|
---|
119 |
|
---|
120 | fTabF1b->AddFrame(fSelectButton,
|
---|
121 | new TGLayoutHints(kLHintsTop | kLHintsCenterX, 5, 5, 5, 5) ) ;
|
---|
122 |
|
---|
123 | fFileView = new TGListView(fTabF1b, 540, 380 ) ;
|
---|
124 | fFileCont = new TGFileContainer(fFileView->GetViewPort(), 100, 100,
|
---|
125 | kVerticalFrame, fgWhitePixel) ;
|
---|
126 |
|
---|
127 | fFileCont->Associate(this) ;
|
---|
128 | fFileView->GetViewPort()->SetBackgroundColor(fgWhitePixel) ;
|
---|
129 | fFileView->SetContainer(fFileCont) ;
|
---|
130 | fFileCont->SetFilter("*") ;
|
---|
131 | // fFileCont->ChangeDirectory(START_DIRECTORY) ;
|
---|
132 | fFileCont->ChangeDirectory(gSystem->WorkingDirectory()) ;
|
---|
133 | fFileView->SetViewMode(kLVDetails);
|
---|
134 | fFileCont->Sort(kSortByName) ;
|
---|
135 |
|
---|
136 | fTabF1b->AddFrame(fFileView, new TGLayoutHints(kLHintsTop | kLHintsExpandX, 5, 5, 5, 5) ) ;
|
---|
137 |
|
---|
138 | //
|
---|
139 | // create Tab 2
|
---|
140 | //
|
---|
141 |
|
---|
142 | tf = fTab->AddTab("Run Dist") ;
|
---|
143 | fTabF2 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
---|
144 |
|
---|
145 | tf->AddFrame(fTabF2, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5)) ;
|
---|
146 |
|
---|
147 | // create the vertical subframes
|
---|
148 |
|
---|
149 | fTabF2a = new TGCompositeFrame (fTabF2, 100, 100, kHorizontalFrame) ;
|
---|
150 | fTabF2->AddFrame(fTabF2a, fLayTab ) ;
|
---|
151 |
|
---|
152 | fTabF2b = new TGCompositeFrame (fTabF2, 300, 300, kHorizontalFrame) ;
|
---|
153 | fTabF2->AddFrame(fTabF2b,
|
---|
154 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
155 |
|
---|
156 | fTabF2c = new TGCompositeFrame (fTabF2, 100, 100, kHorizontalFrame) ;
|
---|
157 | fTabF2->AddFrame(fTabF2c,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
158 |
|
---|
159 | // create the entries in first subframe
|
---|
160 |
|
---|
161 | fLabelInput = new TGLabel(fTabF2a, new TGString("Title:") );
|
---|
162 | fTabF2a->AddFrame( fLabelInput, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
163 |
|
---|
164 | fDir2 = new TGListBox(fTabF2a, -1) ;
|
---|
165 | fDir2->Resize(350,20) ;
|
---|
166 | sprintf ( temp, "%s", fInputPath ) ;
|
---|
167 | fDir2->AddEntry(temp, 1) ;
|
---|
168 | fTabF2a->AddFrame( fDir2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
169 |
|
---|
170 | fLabelNumEvts = new TGLabel(fTabF2a, new TGString("Number of Events:") );
|
---|
171 | fTabF2a->AddFrame( fLabelNumEvts, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
172 |
|
---|
173 | fDirNum = new TGListBox(fTabF2a, -1) ;
|
---|
174 | fDirNum->Resize(50,20) ;
|
---|
175 | fTabF2a->AddFrame( fDirNum,
|
---|
176 | new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) ) ;
|
---|
177 |
|
---|
178 | fButtonPrint = new TGTextButton(fTabF2a, "Print", M_BUTTON_PRINT );
|
---|
179 | fButtonPrint->Associate(this) ;
|
---|
180 | fTabF2a->AddFrame (fButtonPrint, new TGLayoutHints(kLHintsTop | kLHintsLeft, 50, 50, 5, 5) );
|
---|
181 |
|
---|
182 | // create the entries in the second subframe
|
---|
183 |
|
---|
184 | fCanvasRun = new TRootEmbeddedCanvas("fCanvasRun", fTabF2b, 300, 300 ) ;
|
---|
185 | fTabF2b->AddFrame(fCanvasRun, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
186 |
|
---|
187 | // create the entries in the third subframe
|
---|
188 |
|
---|
189 | fButtonPartID = new TGTextButton(fTabF2c, "PartId", M_BUTTON_PARTID );
|
---|
190 | fButtonPartID->Associate(this) ;
|
---|
191 | fTabF2c->AddFrame (fButtonPartID, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
192 |
|
---|
193 | fButtonEnergy = new TGTextButton(fTabF2c, "Energy", M_BUTTON_ENERGY );
|
---|
194 | fButtonEnergy->Associate(this) ;
|
---|
195 | fTabF2c->AddFrame (fButtonEnergy, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
196 |
|
---|
197 | fButtonCore = new TGTextButton(fTabF2c, "Core", M_BUTTON_CORE );
|
---|
198 | fButtonCore->Associate(this) ;
|
---|
199 | fTabF2c->AddFrame (fButtonCore, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
200 |
|
---|
201 | fButtonTheta = new TGTextButton(fTabF2c, "Theta", M_BUTTON_THETA );
|
---|
202 | fButtonTheta->Associate(this) ;
|
---|
203 | fTabF2c->AddFrame (fButtonTheta, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
204 |
|
---|
205 | fButtonPhi = new TGTextButton(fTabF2c, " Phi ", M_BUTTON_PHI );
|
---|
206 | fButtonPhi->Associate(this) ;
|
---|
207 | fTabF2c->AddFrame (fButtonPhi, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
208 |
|
---|
209 | fButtonFirst = new TGTextButton(fTabF2c, "FirstInt", M_BUTTON_FIRSTINT );
|
---|
210 | fButtonFirst->Associate(this) ;
|
---|
211 | fTabF2c->AddFrame (fButtonFirst, new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 2, 2, 2) );
|
---|
212 |
|
---|
213 | //
|
---|
214 | // create Tab 3
|
---|
215 | //
|
---|
216 |
|
---|
217 | tf = fTab->AddTab("Event Dist") ;
|
---|
218 | fTabF3 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
---|
219 |
|
---|
220 | tf->AddFrame(fTabF3, new TGLayoutHints(kLHintsTop | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5)) ;
|
---|
221 |
|
---|
222 |
|
---|
223 | // create the vertical subframes
|
---|
224 |
|
---|
225 | fTabF3a = new TGCompositeFrame (fTabF3, 100, 100, kHorizontalFrame) ;
|
---|
226 | fTabF3->AddFrame(fTabF3a, fLayTab ) ;
|
---|
227 |
|
---|
228 | fTabF3b = new TGCompositeFrame (fTabF3, 300, 300, kHorizontalFrame) ;
|
---|
229 | fTabF3->AddFrame(fTabF3b,
|
---|
230 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX |kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
231 |
|
---|
232 | fTabF3c = new TGCompositeFrame (fTabF3, 100, 100, kHorizontalFrame) ;
|
---|
233 | fTabF3->AddFrame(fTabF3c,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
234 |
|
---|
235 | // create the entries in first subframe
|
---|
236 |
|
---|
237 | fLabel3 = new TGLabel(fTabF3a, new TGString("Input:") );
|
---|
238 | fTabF3a->AddFrame( fLabel3, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
239 |
|
---|
240 | fDir3 = new TGListBox(fTabF3a, -1) ;
|
---|
241 | fDir3->Resize(350,20) ;
|
---|
242 | sprintf ( temp, "%s", fInputPath ) ;
|
---|
243 | fDir3->AddEntry(temp, 1) ;
|
---|
244 | fTabF3a->AddFrame( fDir3, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
245 |
|
---|
246 | fLabel4 = new TGLabel(fTabF3a, new TGString("EventNb:") );
|
---|
247 | fTabF3a->AddFrame( fLabel4, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
248 |
|
---|
249 | fDirEvtNb = new TGListBox(fTabF3a, -1) ;
|
---|
250 | fDirEvtNb->Resize(50,20) ;
|
---|
251 | fTabF3a->AddFrame( fDirEvtNb,
|
---|
252 | new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5 ) ) ;
|
---|
253 |
|
---|
254 | fButtonPrev = new TGTextButton(fTabF3a, "Prev", M_BUTTON_PREV );
|
---|
255 | fButtonPrev->Associate(this) ;
|
---|
256 | fTabF3a->AddFrame (fButtonPrev, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
|
---|
257 |
|
---|
258 | fButtonNext = new TGTextButton(fTabF3a, "Next", M_BUTTON_NEXT );
|
---|
259 | fButtonNext->Associate(this) ;
|
---|
260 | fTabF3a->AddFrame (fButtonNext, new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 5, 5) );
|
---|
261 |
|
---|
262 |
|
---|
263 | //
|
---|
264 | // create the entries in the second subframe
|
---|
265 |
|
---|
266 |
|
---|
267 | fTabF3bI = new TGCompositeFrame (fTabF3b, 300, 300, kVerticalFrame) ;
|
---|
268 | fTabF3b->AddFrame(fTabF3bI,
|
---|
269 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
270 |
|
---|
271 | fTabF3bII = new TGCompositeFrame (fTabF3b, 300, 300, kVerticalFrame) ;
|
---|
272 | fTabF3b->AddFrame(fTabF3bII,
|
---|
273 | new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5 ) ) ;
|
---|
274 |
|
---|
275 | fLabelId = new TGLabel(fTabF3bI, new TGString("PartId: ------------") );
|
---|
276 | fTabF3bI->AddFrame( fLabelId, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
277 |
|
---|
278 | fLabelEner = new TGLabel(fTabF3bI, new TGString("Energy: ------------") );
|
---|
279 | fTabF3bI->AddFrame( fLabelEner, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
280 |
|
---|
281 | fLabelNbPhot = new TGLabel(fTabF3bI, new TGString("NbPhot: ------------") );
|
---|
282 | fTabF3bI->AddFrame( fLabelNbPhot, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
283 |
|
---|
284 | fLabelCoreX = new TGLabel(fTabF3bI, new TGString("CoreX: ------------") );
|
---|
285 | fTabF3bI->AddFrame( fLabelCoreX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
286 |
|
---|
287 | fLabelCoreY = new TGLabel(fTabF3bI, new TGString("CoreY: ------------") );
|
---|
288 | fTabF3bI->AddFrame( fLabelCoreY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
289 |
|
---|
290 | fLabelTheta = new TGLabel(fTabF3bI, new TGString("Theta: ------------") );
|
---|
291 | fTabF3bI->AddFrame( fLabelTheta, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
292 |
|
---|
293 | fLabelPhi = new TGLabel(fTabF3bI, new TGString("Phi: ------------") );
|
---|
294 | fTabF3bI->AddFrame( fLabelPhi, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
295 |
|
---|
296 | fLabelDireX = new TGLabel(fTabF3bI, new TGString("DireX: ------------") );
|
---|
297 | fTabF3bI->AddFrame( fLabelDireX, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
298 |
|
---|
299 | fLabelDireY = new TGLabel(fTabF3bI, new TGString("DireY: ------------") );
|
---|
300 | fTabF3bI->AddFrame( fLabelDireY, new TGLayoutHints(kLHintsTop | kLHintsLeft , 5, 5, 5, 5 ) ) ;
|
---|
301 |
|
---|
302 |
|
---|
303 | fCanvasEvt = new TRootEmbeddedCanvas("fCanvasEvt", fTabF3bII, 300, 300 ) ;
|
---|
304 | fTabF3bII->AddFrame(fCanvasEvt, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY | kLHintsExpandX, 5, 5, 5, 5 ) ) ;
|
---|
305 |
|
---|
306 |
|
---|
307 | // create the entries in the third subframe
|
---|
308 |
|
---|
309 | //
|
---|
310 | // set up the Radio Button
|
---|
311 | //
|
---|
312 |
|
---|
313 | fRadioEvt[0] = new TGRadioButton(fTabF3c, new TGHotString("WaveLen") , M_BUTTON_WAVELEN );
|
---|
314 | fRadioEvt[1] = new TGRadioButton(fTabF3c, new TGHotString("Position"), M_BUTTON_POSIT );
|
---|
315 | fRadioEvt[2] = new TGRadioButton(fTabF3c, new TGHotString("Height") , M_BUTTON_HEIGHT );
|
---|
316 | fRadioEvt[3] = new TGRadioButton(fTabF3c, new TGHotString("Time") , M_BUTTON_TIME );
|
---|
317 | fRadioEvt[4] = new TGRadioButton(fTabF3c, new TGHotString("Direction"),M_BUTTON_DIRE);
|
---|
318 |
|
---|
319 | for (Int_t i = 0; i < 5; i++ ) {
|
---|
320 | fTabF3c->AddFrame(fRadioEvt[i], new TGLayoutHints(kLHintsBottom | kLHintsLeft, 2, 10, 2, 2) );
|
---|
321 | fRadioEvt[i]->Associate(this);
|
---|
322 | }
|
---|
323 |
|
---|
324 | fRadioEvt[0]->SetState(kButtonDown) ;
|
---|
325 |
|
---|
326 |
|
---|
327 |
|
---|
328 | //
|
---|
329 | // create Tab 4
|
---|
330 | //
|
---|
331 |
|
---|
332 | tf = fTab->AddTab("Control") ;
|
---|
333 | fTabF4 = new TGCompositeFrame (tf, 100, 100, kVerticalFrame) ;
|
---|
334 |
|
---|
335 | fButton1 = new TGTextButton(fTabF4, "&Exit", M_CTRL_EXIT);
|
---|
336 | fButton2 = new TGTextButton(fTabF4, "Working Directory", M_CTRL_PWD);
|
---|
337 | fButton3 = new TGTextButton(fTabF4, "Input Path", M_CTRL_PATH);
|
---|
338 |
|
---|
339 | fButton1->Associate(this) ;
|
---|
340 | fButton2->Associate(this) ;
|
---|
341 | fButton3->Associate(this) ;
|
---|
342 |
|
---|
343 | fLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 10, 10, 10, 10);
|
---|
344 |
|
---|
345 | fTabF4->AddFrame (fButton1, fLayout ) ;
|
---|
346 | fTabF4->AddFrame (fButton2, fLayout ) ;
|
---|
347 | fTabF4->AddFrame (fButton3, fLayout ) ;
|
---|
348 |
|
---|
349 | tf->AddFrame(fTabF4, fLayTab) ;
|
---|
350 |
|
---|
351 | fFrame->AddFrame ( fTab, new TGLayoutHints(kLHintsBottom | kLHintsExpandX | kLHintsExpandY, 5, 5, 5, 5) );
|
---|
352 |
|
---|
353 | AddFrame(fFrame, new TGLayoutHints (kLHintsExpandX|kLHintsExpandY) ) ;
|
---|
354 |
|
---|
355 | //
|
---|
356 | //
|
---|
357 | //
|
---|
358 |
|
---|
359 | MapSubwindows();
|
---|
360 |
|
---|
361 | Layout();
|
---|
362 |
|
---|
363 | SetWindowName("MainSimone");
|
---|
364 | SetIconName("MainSimone");
|
---|
365 |
|
---|
366 | MapWindow();
|
---|
367 | }
|
---|
368 |
|
---|
369 | // ======================================================================
|
---|
370 | // ======================================================================
|
---|
371 |
|
---|
372 | MainFrameSimone::~MainFrameSimone() {
|
---|
373 |
|
---|
374 | // first delete all entries in the tab frames
|
---|
375 |
|
---|
376 | // Tab 1
|
---|
377 |
|
---|
378 | delete fFileView, fFileCont ;
|
---|
379 | delete fCdup, fListMode, fDetail ;
|
---|
380 | delete fDir, fSelectButton ;
|
---|
381 | delete fTabF1a, fTabF1b ;
|
---|
382 |
|
---|
383 | // Tab 2
|
---|
384 |
|
---|
385 | delete fButtonTheta, fButtonPhi, fButtonFirst;
|
---|
386 | delete fButtonPartID, fButtonEnergy, fButtonCore;
|
---|
387 | delete fCanvasRun ;
|
---|
388 | delete fButtonPrint ;
|
---|
389 | delete fDir2, fDirNum ;
|
---|
390 | delete fLabelInput, fLabelNumEvts ;
|
---|
391 | delete fTabF2a, fTabF2b, fTabF2c ;
|
---|
392 |
|
---|
393 | // Tab 3
|
---|
394 |
|
---|
395 | delete fRadioEvt[0], fRadioEvt[1], fRadioEvt[2], fRadioEvt[3], fRadioEvt[4];
|
---|
396 | delete fButtonPrev, fButtonNext ;
|
---|
397 | delete fCanvasEvt;
|
---|
398 | delete fLabelTheta, fLabelPhi, fLabelDireX, fLabelDireY ;
|
---|
399 | delete fLabelCoreX, fLabelCoreY ;
|
---|
400 | delete fLabelNbPhot ;
|
---|
401 | delete fLabelId, fLabelEner ;
|
---|
402 | delete fDir3, fDirEvtNb ;
|
---|
403 | delete fLabel3, fLabel4;
|
---|
404 | delete fTabF3bI, fTabF3bII ;
|
---|
405 | delete fTabF3a, fTabF3b, fTabF3c ;
|
---|
406 |
|
---|
407 | // Tab4
|
---|
408 |
|
---|
409 | delete fButton1 ;
|
---|
410 | delete fButton2 ;
|
---|
411 | delete fButton3 ;
|
---|
412 | delete fFrame, fTab, fTabF1, fTabF2, fTabF4 ;
|
---|
413 |
|
---|
414 |
|
---|
415 | // then delete the rest of the main frame
|
---|
416 |
|
---|
417 | delete fFileMenu, fMenuBar;
|
---|
418 | delete fTabF1, fTabF2, fTabF3, fTabF4 ;
|
---|
419 | delete fFrame, fTab;
|
---|
420 |
|
---|
421 | delete fLayout, fLayMenuBar, fLayMenuItem, fLayTab ;
|
---|
422 |
|
---|
423 | delete fPicCdup, fPicList, fPicDetail ;
|
---|
424 |
|
---|
425 |
|
---|
426 | delete fNtup, fNtupEvt ;
|
---|
427 |
|
---|
428 |
|
---|
429 | }
|
---|
430 |
|
---|
431 | // ======================================================================
|
---|
432 | // ======================================================================
|
---|
433 |
|
---|
434 | void MainFrameSimone::CloseWindow()
|
---|
435 | {
|
---|
436 | // Got close message for this MainFrame. Calls parent CloseWindow()
|
---|
437 | // (which destroys the window) and terminate the application.
|
---|
438 | // The close message is generated by the window manager when its close
|
---|
439 | // window menu item is selected.
|
---|
440 |
|
---|
441 | TGMainFrame::CloseWindow();
|
---|
442 | gROOT->GetApplication()->Terminate(0) ;
|
---|
443 |
|
---|
444 | }
|
---|
445 |
|
---|
446 | // ======================================================================
|
---|
447 | // ======================================================================
|
---|
448 |
|
---|
449 | Bool_t MainFrameSimone::CerFileExist(Char_t *dir)
|
---|
450 | {
|
---|
451 | Char_t testfile[110] ;
|
---|
452 | FILE *unit ;
|
---|
453 |
|
---|
454 | sprintf (testfile, "%s/%s/cer000001",
|
---|
455 | gSystem->WorkingDirectory(), dir ) ;
|
---|
456 | //
|
---|
457 | // try to open the testfile
|
---|
458 | //
|
---|
459 |
|
---|
460 | if ( (unit = fopen (testfile, "r" )) == 0 ) {
|
---|
461 | //
|
---|
462 | // doesn't exist --> kFALSE
|
---|
463 | return (kFALSE) ;
|
---|
464 | }
|
---|
465 | else {
|
---|
466 | fclose ( unit ) ;
|
---|
467 |
|
---|
468 | return ( kTRUE ) ;
|
---|
469 | }
|
---|
470 |
|
---|
471 | }
|
---|
472 |
|
---|
473 | // ======================================================================
|
---|
474 | // ======================================================================
|
---|
475 |
|
---|
476 | Bool_t MainFrameSimone::DrawRunParam (Char_t *paraName) {
|
---|
477 |
|
---|
478 | TCanvas *canvas = fCanvasRun->GetCanvas();
|
---|
479 |
|
---|
480 | canvas->cd() ;
|
---|
481 |
|
---|
482 | if ( CheckNtup() )
|
---|
483 | {
|
---|
484 | fNtup->Draw(paraName) ;
|
---|
485 | canvas->Modified() ;
|
---|
486 | canvas->Update() ;
|
---|
487 |
|
---|
488 | return(kTRUE) ;
|
---|
489 | }
|
---|
490 | else
|
---|
491 | {
|
---|
492 | canvas->Clear() ;
|
---|
493 | canvas->Modified() ;
|
---|
494 | canvas->Update() ;
|
---|
495 | }
|
---|
496 | return (kFALSE) ;
|
---|
497 | }
|
---|
498 |
|
---|
499 |
|
---|
500 | // ======================================================================
|
---|
501 | // ======================================================================
|
---|
502 |
|
---|
503 | Bool_t MainFrameSimone::DrawEvtParam () {
|
---|
504 |
|
---|
505 | TCanvas *canvas = fCanvasEvt->GetCanvas();
|
---|
506 |
|
---|
507 | canvas->cd() ;
|
---|
508 |
|
---|
509 | char paraName[20] ;
|
---|
510 |
|
---|
511 | for ( Int_t i=0 ; i<5 ; i++ ) {
|
---|
512 | if ( fRadioEvt[i]->GetState() == kButtonDown) {
|
---|
513 | sprintf( paraName, "%s\0", NtupName[i] ) ;
|
---|
514 | break ;
|
---|
515 | }
|
---|
516 | }
|
---|
517 |
|
---|
518 | if ( fNtupEvt->GetEntries() > 0 ) {
|
---|
519 |
|
---|
520 | fNtupEvt->Draw(paraName) ;
|
---|
521 | canvas->Modified() ;
|
---|
522 | canvas->Update() ;
|
---|
523 |
|
---|
524 | return(kTRUE) ;
|
---|
525 | }
|
---|
526 | else {
|
---|
527 |
|
---|
528 | canvas->Clear() ;
|
---|
529 | canvas->Modified() ;
|
---|
530 | canvas->Update() ;
|
---|
531 |
|
---|
532 | return (kFALSE) ;
|
---|
533 | }
|
---|
534 | }
|
---|
535 |
|
---|
536 | // ======================================================================
|
---|
537 | // ======================================================================
|
---|
538 |
|
---|
539 | Bool_t MainFrameSimone::CheckNtup()
|
---|
540 | {
|
---|
541 | Int_t buttons = 4, retval ;
|
---|
542 |
|
---|
543 | if ( ! strcmp( fInputPath, "\0") ) {
|
---|
544 |
|
---|
545 |
|
---|
546 | new TGMsgBox(fClient->GetRoot(), this,
|
---|
547 | "Warning",
|
---|
548 | "No Input Path specified\n Do this before!!",
|
---|
549 | kMBIconExclamation, buttons, &retval);
|
---|
550 |
|
---|
551 | return (kFALSE) ;
|
---|
552 | }
|
---|
553 |
|
---|
554 |
|
---|
555 | if ( ! strcmp ( fInputPath, fNtupPath ) ) {
|
---|
556 | return (kTRUE) ;
|
---|
557 | }
|
---|
558 | else {
|
---|
559 |
|
---|
560 | if ( ReadDataToNtup() ) {
|
---|
561 | return (kTRUE) ;
|
---|
562 | }
|
---|
563 | }
|
---|
564 |
|
---|
565 | return (kFALSE) ;
|
---|
566 | }
|
---|
567 |
|
---|
568 | // ======================================================================
|
---|
569 | // ======================================================================
|
---|
570 |
|
---|
571 | Bool_t MainFrameSimone::ReadDataToNtup()
|
---|
572 | {
|
---|
573 | FILE *unit ;
|
---|
574 | Char_t rootfile[256] ;
|
---|
575 | Char_t cername[256] ;
|
---|
576 | Char_t datname[256] ;
|
---|
577 |
|
---|
578 | ifstream cerfile ;
|
---|
579 |
|
---|
580 | COREventHeader Event ;
|
---|
581 |
|
---|
582 | fNtup->Reset() ;
|
---|
583 |
|
---|
584 | sprintf (rootfile, "%s/simone.root", fInputPath ) ;
|
---|
585 |
|
---|
586 | //
|
---|
587 | // check if there is a file simone.root in the directory fInputPath
|
---|
588 | //
|
---|
589 | // if the file is there open it an read the ntuple in,
|
---|
590 | // else open all cerenkov files and fill the histograms and store
|
---|
591 | // the ntuple as simone.root in the directory fInputPath
|
---|
592 | //
|
---|
593 |
|
---|
594 | if ( ( unit = fopen (rootfile, "r" )) != 0 ) {
|
---|
595 | fclose (unit) ;
|
---|
596 |
|
---|
597 | //
|
---|
598 | // open the file as a root file
|
---|
599 | //
|
---|
600 |
|
---|
601 | TFile *hfile = new TFile ( rootfile ) ;
|
---|
602 |
|
---|
603 | //
|
---|
604 | // connect the ntuple from the file
|
---|
605 | //
|
---|
606 |
|
---|
607 | fNtup = (TNtuple *) hfile->Get("fNtup") ;
|
---|
608 |
|
---|
609 | fNtup->Read("fNtup") ;
|
---|
610 |
|
---|
611 | //
|
---|
612 | // close the root file
|
---|
613 | //
|
---|
614 |
|
---|
615 | //hfile->Close() ;
|
---|
616 |
|
---|
617 | //delete hfile ;
|
---|
618 |
|
---|
619 |
|
---|
620 |
|
---|
621 | fNumEvents = (Int_t) fNtup->GetEntries() ;
|
---|
622 |
|
---|
623 | sprintf ( datname, "%d", fNumEvents ) ;
|
---|
624 |
|
---|
625 | fDirNum->RemoveEntry(1) ;
|
---|
626 | fDirNum->AddEntry(datname,1) ;
|
---|
627 | fDirNum->MapSubwindows() ;
|
---|
628 | fDirNum->Layout() ;
|
---|
629 | }
|
---|
630 | else {
|
---|
631 | //
|
---|
632 | // create the root file
|
---|
633 | //
|
---|
634 |
|
---|
635 | TFile *hfile = new TFile ( rootfile, "NEW" ) ;
|
---|
636 |
|
---|
637 |
|
---|
638 | for (int i_cer = 1; i_cer <= 100000; i_cer++ ) {
|
---|
639 |
|
---|
640 | // inform about progress
|
---|
641 |
|
---|
642 | if (!( i_cer %1000) )
|
---|
643 | {
|
---|
644 | cout << i_cer << endl ;
|
---|
645 | sprintf ( datname, "%d", fNumEvents ) ;
|
---|
646 |
|
---|
647 | fDirNum->RemoveEntry(1) ;
|
---|
648 | fDirNum->AddEntry(datname,1) ;
|
---|
649 | fDirNum->MapSubwindows() ;
|
---|
650 | fDirNum->Layout() ;
|
---|
651 | }
|
---|
652 |
|
---|
653 |
|
---|
654 | // create the file names
|
---|
655 |
|
---|
656 | sprintf ( cername, "%s/cer%06d", fInputPath, i_cer ) ;
|
---|
657 | sprintf ( datname, "%s/dat%06d", fInputPath, i_cer ) ;
|
---|
658 |
|
---|
659 | // try to open the files
|
---|
660 |
|
---|
661 | cerfile.open( cername );
|
---|
662 |
|
---|
663 | if ( cerfile.bad() ) {
|
---|
664 |
|
---|
665 | fNumEvents = i_cer -1 ;
|
---|
666 |
|
---|
667 | sprintf ( datname, "%d", fNumEvents ) ;
|
---|
668 |
|
---|
669 | fDirNum->RemoveEntry(1) ;
|
---|
670 | fDirNum->AddEntry(datname,1) ;
|
---|
671 | fDirNum->MapSubwindows() ;
|
---|
672 | fDirNum->Layout() ;
|
---|
673 |
|
---|
674 | break ;
|
---|
675 | }
|
---|
676 |
|
---|
677 | Event.read( cerfile );
|
---|
678 |
|
---|
679 | //
|
---|
680 | // fill Ntuple
|
---|
681 | //
|
---|
682 |
|
---|
683 | fNtup->Fill( Event.get_primary() ,
|
---|
684 | Event.get_energy() ,
|
---|
685 | Event.get_coreX(),
|
---|
686 | Event.get_coreY(),
|
---|
687 | Event.get_theta(),
|
---|
688 | Event.get_phi(),
|
---|
689 | Event.get_firstInt() ) ;
|
---|
690 |
|
---|
691 |
|
---|
692 | cerfile.close();
|
---|
693 |
|
---|
694 | }
|
---|
695 |
|
---|
696 | //
|
---|
697 | // write Ntuple to the file
|
---|
698 | //
|
---|
699 | fNtup->Write() ;
|
---|
700 |
|
---|
701 | //
|
---|
702 | // write the root file
|
---|
703 | //
|
---|
704 | hfile->Write();
|
---|
705 |
|
---|
706 | delete hfile ;
|
---|
707 | }
|
---|
708 |
|
---|
709 |
|
---|
710 | //
|
---|
711 | // set some value of this class
|
---|
712 | //
|
---|
713 | sprintf ( fNtupPath, "%s", fInputPath) ;
|
---|
714 |
|
---|
715 | return (kTRUE) ;
|
---|
716 | }
|
---|
717 |
|
---|
718 |
|
---|
719 | // ======================================================================
|
---|
720 | // ======================================================================
|
---|
721 |
|
---|
722 | Bool_t MainFrameSimone::ReadinEvt()
|
---|
723 | {
|
---|
724 | Int_t buttons =4 , retval ;
|
---|
725 |
|
---|
726 | Char_t wort[256] ;
|
---|
727 | FILE *unit ;
|
---|
728 | Char_t filename[256] ;
|
---|
729 |
|
---|
730 | ifstream cerfile ;
|
---|
731 |
|
---|
732 | COREventHeader Event ;
|
---|
733 | CORParticle Photon ;
|
---|
734 |
|
---|
735 | Int_t iPhotonInShower ;
|
---|
736 | Float_t lambda ;
|
---|
737 |
|
---|
738 | //
|
---|
739 | // check the input Path
|
---|
740 | //
|
---|
741 |
|
---|
742 | if ( ! strcmp( fInputPath, "\0") ) {
|
---|
743 |
|
---|
744 | new TGMsgBox(fClient->GetRoot(), this,
|
---|
745 | "Warning",
|
---|
746 | "No Input Path specified\n Do this before!!",
|
---|
747 | kMBIconExclamation, buttons, &retval);
|
---|
748 |
|
---|
749 | return (kFALSE) ;
|
---|
750 | }
|
---|
751 |
|
---|
752 | if ( fEvtNb == 0 ) {
|
---|
753 | printf ("Don't press the Prev Button at the first time!!\n") ;
|
---|
754 | return (kFALSE) ;
|
---|
755 | }
|
---|
756 |
|
---|
757 | sprintf ( filename, "%s/cer%06d", fInputPath, fEvtNb ) ;
|
---|
758 |
|
---|
759 | fNtupEvt->Reset() ;
|
---|
760 |
|
---|
761 | //
|
---|
762 | // open the file
|
---|
763 | //
|
---|
764 |
|
---|
765 | cerfile.open( filename );
|
---|
766 |
|
---|
767 | if ( cerfile.bad() ) {
|
---|
768 |
|
---|
769 | new TGMsgBox(fClient->GetRoot(), this,
|
---|
770 | "ERROR",
|
---|
771 | "Can't open the cer file!!",
|
---|
772 | kMBIconExclamation, buttons, &retval);
|
---|
773 |
|
---|
774 | return (kFALSE) ;
|
---|
775 | }
|
---|
776 |
|
---|
777 | //
|
---|
778 | // read in the header
|
---|
779 | //
|
---|
780 |
|
---|
781 | Event.read( cerfile );
|
---|
782 |
|
---|
783 |
|
---|
784 | //
|
---|
785 | // fill the information labels
|
---|
786 | //
|
---|
787 |
|
---|
788 | sprintf( wort,"PartId: %5.0f", Event.get_primary() ) ;
|
---|
789 | fLabelId->SetText(new TGString(wort) ) ;
|
---|
790 |
|
---|
791 | sprintf( wort,"Energy: %9.1f", Event.get_energy() ) ;
|
---|
792 | fLabelEner->SetText(new TGString(wort) ) ;
|
---|
793 |
|
---|
794 | sprintf( wort,"CoreX: %9.1f", Event.get_coreX() ) ;
|
---|
795 | fLabelCoreX->SetText(new TGString(wort) ) ;
|
---|
796 |
|
---|
797 | sprintf( wort,"CoreY: %9.1f", Event.get_coreY() ) ;
|
---|
798 | fLabelCoreY->SetText(new TGString(wort) ) ;
|
---|
799 |
|
---|
800 |
|
---|
801 | sprintf( wort,"Theta: %9.1f", Event.get_theta()*180./PI ) ;
|
---|
802 | fLabelTheta->SetText(new TGString(wort) ) ;
|
---|
803 |
|
---|
804 | sprintf( wort,"Phi: %9.1f", Event.get_phi()*180./PI ) ;
|
---|
805 | fLabelPhi->SetText(new TGString(wort) ) ;
|
---|
806 |
|
---|
807 | sprintf( wort,"DireX: %9.3f", Event.get_direX() ) ;
|
---|
808 | fLabelDireX->SetText(new TGString(wort) ) ;
|
---|
809 |
|
---|
810 | sprintf( wort,"DireY: %9.3f", Event.get_direY() ) ;
|
---|
811 | fLabelDireY->SetText(new TGString(wort) ) ;
|
---|
812 |
|
---|
813 |
|
---|
814 | //
|
---|
815 | // loop over the particles
|
---|
816 | //
|
---|
817 |
|
---|
818 |
|
---|
819 | iPhotonInShower = 0 ;
|
---|
820 |
|
---|
821 | while( ! (cerfile.eof() || cerfile.bad() )) {
|
---|
822 |
|
---|
823 | //
|
---|
824 | // read in the particles
|
---|
825 | //
|
---|
826 |
|
---|
827 | Photon.read ( cerfile ) ;
|
---|
828 | //
|
---|
829 | // only if the wavelength lambda is greater than
|
---|
830 | // 1.0 it is a real cerenkov photon
|
---|
831 | //
|
---|
832 |
|
---|
833 | lambda = Photon.get_wl() ;
|
---|
834 |
|
---|
835 | if ( lambda < 1.0 )
|
---|
836 | break ;
|
---|
837 |
|
---|
838 | iPhotonInShower++ ;
|
---|
839 |
|
---|
840 | fNtupEvt->Fill(Photon.get_wl(),
|
---|
841 | Photon.get_x(),
|
---|
842 | Photon.get_y(),
|
---|
843 | Photon.get_h(),
|
---|
844 | Photon.get_t(),
|
---|
845 | Photon.get_u(),
|
---|
846 | Photon.get_v() ) ;
|
---|
847 |
|
---|
848 | }
|
---|
849 |
|
---|
850 |
|
---|
851 | //
|
---|
852 | // close the file
|
---|
853 | //
|
---|
854 |
|
---|
855 | cerfile.close();
|
---|
856 |
|
---|
857 | sprintf( wort,"NbPhot: %8d", iPhotonInShower ) ;
|
---|
858 | fLabelNbPhot->SetText(new TGString(wort) ) ;
|
---|
859 |
|
---|
860 | return (kTRUE) ;
|
---|
861 |
|
---|
862 | }
|
---|
863 | // ======================================================================
|
---|
864 | // ======================================================================
|
---|
865 |
|
---|
866 | Bool_t MainFrameSimone::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
|
---|
867 | {
|
---|
868 | Int_t buttons = 4, retval = 0 ;
|
---|
869 | Char_t wort[100] ;
|
---|
870 | Char_t wort2[10] ;
|
---|
871 | Char_t testfile[100] ;
|
---|
872 | Char_t extens[5] ;
|
---|
873 | Char_t command[110] ;
|
---|
874 |
|
---|
875 | TGFileItem *item ; // to process items in the file view container
|
---|
876 | void *np = NULL ; // null pointer
|
---|
877 |
|
---|
878 | TCanvas *canvas = fCanvasRun->GetCanvas();
|
---|
879 |
|
---|
880 | // Process events generated by the buttons in the frame.
|
---|
881 |
|
---|
882 | switch (GET_MSG(msg)) {
|
---|
883 | case kC_COMMAND:
|
---|
884 | switch (GET_SUBMSG(msg)) {
|
---|
885 | case kCM_BUTTON:
|
---|
886 |
|
---|
887 | switch (parm1) {
|
---|
888 | case M_CDIR_UP :
|
---|
889 | sprintf ( fInputPath, "\0") ;
|
---|
890 | fSelectButton->SetState(kButtonDisabled) ;
|
---|
891 |
|
---|
892 | fDir2->RemoveEntry(1) ;
|
---|
893 | fDir2->AddEntry(fInputPath,1) ;
|
---|
894 | fDir2->MapSubwindows() ;
|
---|
895 | fDir2->Layout() ;
|
---|
896 |
|
---|
897 | fDir3->RemoveEntry(1) ;
|
---|
898 | fDir3->AddEntry(fInputPath,1) ;
|
---|
899 | fDir3->MapSubwindows() ;
|
---|
900 | fDir3->Layout() ;
|
---|
901 |
|
---|
902 |
|
---|
903 | sprintf (wort2, "\0" ) ;
|
---|
904 | fDirEvtNb->RemoveEntry(1) ;
|
---|
905 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
---|
906 | fDirEvtNb->MapSubwindows() ;
|
---|
907 | fDirEvtNb->Layout() ;
|
---|
908 |
|
---|
909 |
|
---|
910 |
|
---|
911 | //
|
---|
912 | // goto the parent directory
|
---|
913 | //
|
---|
914 | gSystem->ChangeDirectory("..") ;
|
---|
915 | fDir->RemoveEntry(1) ;
|
---|
916 | sprintf (wort, "%s", gSystem->WorkingDirectory() ) ;
|
---|
917 | fDir->AddEntry(wort,1) ;
|
---|
918 | fDir->MapSubwindows() ;
|
---|
919 | fDir->Layout() ;
|
---|
920 | fFileCont->ChangeDirectory( wort ) ;
|
---|
921 | fFileCont->DisplayDirectory() ;
|
---|
922 |
|
---|
923 | break ;
|
---|
924 |
|
---|
925 | case M_LIST_MODE:
|
---|
926 | fFileView->SetViewMode(kLVList) ;
|
---|
927 | fDetail->SetState(kButtonUp) ;
|
---|
928 | break ;
|
---|
929 |
|
---|
930 | case M_DETAIL_MODE:
|
---|
931 | fFileView->SetViewMode(kLVDetails) ;
|
---|
932 | fListMode->SetState(kButtonUp) ;
|
---|
933 | break ;
|
---|
934 |
|
---|
935 | case M_BUTTON_SELECT:
|
---|
936 |
|
---|
937 | if ( fFileCont->NumSelected() == 1 ) {
|
---|
938 | //
|
---|
939 | // one file selected
|
---|
940 | //
|
---|
941 | item = (TGFileItem *) fFileCont->GetNextSelected(&np) ;
|
---|
942 |
|
---|
943 | if ( S_ISDIR(item->GetType()) ) { // file is directory
|
---|
944 |
|
---|
945 | sprintf (fInputPath, "%s/%s",
|
---|
946 | gSystem->WorkingDirectory(),
|
---|
947 | item->GetItemName()->GetString()) ;
|
---|
948 |
|
---|
949 | fDir2->RemoveEntry(1) ;
|
---|
950 | fDir2->AddEntry(fInputPath,1) ;
|
---|
951 | fDir2->MapSubwindows() ;
|
---|
952 | fDir2->Layout() ;
|
---|
953 |
|
---|
954 | fDir3->RemoveEntry(1) ;
|
---|
955 | fDir3->AddEntry(fInputPath,1) ;
|
---|
956 | fDir3->MapSubwindows() ;
|
---|
957 | fDir3->Layout() ;
|
---|
958 |
|
---|
959 | fEvtNb = 0 ;
|
---|
960 | sprintf (wort2, "%d", fEvtNb ) ;
|
---|
961 | fDirEvtNb->RemoveEntry(1) ;
|
---|
962 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
---|
963 | fDirEvtNb->MapSubwindows() ;
|
---|
964 | fDirEvtNb->Layout() ;
|
---|
965 |
|
---|
966 | }
|
---|
967 | }
|
---|
968 | break;
|
---|
969 |
|
---|
970 | case M_BUTTON_PRINT:
|
---|
971 | canvas->Print("simone.ps") ;
|
---|
972 | gSystem->Exec("lpr simone.ps") ;
|
---|
973 | gSystem->Exec("rm -f simone.ps") ;
|
---|
974 | break;
|
---|
975 |
|
---|
976 | case M_BUTTON_PARTID:
|
---|
977 | DrawRunParam("PartID") ;
|
---|
978 | break ;
|
---|
979 |
|
---|
980 | case M_BUTTON_ENERGY:
|
---|
981 | DrawRunParam("log10(Energy)") ;
|
---|
982 | break;
|
---|
983 |
|
---|
984 | case M_BUTTON_CORE:
|
---|
985 | DrawRunParam("CoreY:CoreX") ;
|
---|
986 | break;
|
---|
987 |
|
---|
988 | case M_BUTTON_THETA:
|
---|
989 | DrawRunParam("Theta") ;
|
---|
990 | break;
|
---|
991 |
|
---|
992 | case M_BUTTON_PHI:
|
---|
993 | DrawRunParam("Phi") ;
|
---|
994 | break;
|
---|
995 |
|
---|
996 | case M_BUTTON_FIRSTINT:
|
---|
997 | DrawRunParam("FirstInt") ;
|
---|
998 | break;
|
---|
999 |
|
---|
1000 |
|
---|
1001 |
|
---|
1002 | case M_BUTTON_PREV:
|
---|
1003 | fEvtNb-- ;
|
---|
1004 |
|
---|
1005 | if (fEvtNb < 1 ) {
|
---|
1006 | fEvtNb++ ;
|
---|
1007 |
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | sprintf (wort2, "%d", fEvtNb ) ;
|
---|
1011 | fDirEvtNb->RemoveEntry(1) ;
|
---|
1012 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
---|
1013 | fDirEvtNb->MapSubwindows() ;
|
---|
1014 | fDirEvtNb->Layout() ;
|
---|
1015 |
|
---|
1016 | ReadinEvt() ;
|
---|
1017 |
|
---|
1018 | DrawEvtParam() ;
|
---|
1019 |
|
---|
1020 | break;
|
---|
1021 |
|
---|
1022 |
|
---|
1023 | case M_BUTTON_NEXT:
|
---|
1024 | fEvtNb++ ;
|
---|
1025 |
|
---|
1026 | sprintf (wort2, "%d", fEvtNb ) ;
|
---|
1027 | fDirEvtNb->RemoveEntry(1) ;
|
---|
1028 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
---|
1029 | fDirEvtNb->MapSubwindows() ;
|
---|
1030 | fDirEvtNb->Layout() ;
|
---|
1031 |
|
---|
1032 | ReadinEvt() ;
|
---|
1033 |
|
---|
1034 | DrawEvtParam() ;
|
---|
1035 |
|
---|
1036 | break;
|
---|
1037 |
|
---|
1038 |
|
---|
1039 |
|
---|
1040 | case M_CTRL_EXIT:
|
---|
1041 | CloseWindow() ;
|
---|
1042 | break;
|
---|
1043 |
|
---|
1044 | case M_CTRL_PWD:
|
---|
1045 | printf ("WorkingDirectory -> %s <- \n", gSystem->WorkingDirectory() ) ;
|
---|
1046 | break ;
|
---|
1047 |
|
---|
1048 | case M_CTRL_PATH:
|
---|
1049 | printf ("Input Path: -> %s <- \n", fInputPath ) ;
|
---|
1050 | break ;
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | break;
|
---|
1054 |
|
---|
1055 | case kCM_CHECKBUTTON:
|
---|
1056 |
|
---|
1057 | break;
|
---|
1058 |
|
---|
1059 | case kCM_RADIOBUTTON:
|
---|
1060 | if (parm1 >= M_BUTTON_WAVELEN && parm1 <= M_BUTTON_DIRE)
|
---|
1061 | {
|
---|
1062 | for (Int_t i=0; i<5; ++i)
|
---|
1063 | if (fRadioEvt[i]->WidgetId() != parm1)
|
---|
1064 | fRadioEvt[i]->SetState(kButtonUp);
|
---|
1065 | }
|
---|
1066 |
|
---|
1067 | DrawEvtParam() ;
|
---|
1068 |
|
---|
1069 | break;
|
---|
1070 |
|
---|
1071 |
|
---|
1072 | case kCM_MENU:
|
---|
1073 | switch (parm1) {
|
---|
1074 | case M_FILE_EXIT:
|
---|
1075 | CloseWindow() ;
|
---|
1076 | break;
|
---|
1077 |
|
---|
1078 | }
|
---|
1079 | break ;
|
---|
1080 |
|
---|
1081 | default:
|
---|
1082 | break;
|
---|
1083 |
|
---|
1084 | }
|
---|
1085 |
|
---|
1086 | case kC_CONTAINER:
|
---|
1087 | switch (GET_SUBMSG(msg)) {
|
---|
1088 |
|
---|
1089 | // case kCT_ITEMCLICK:
|
---|
1090 | // printf ("itemclick\n");
|
---|
1091 | // break;
|
---|
1092 |
|
---|
1093 |
|
---|
1094 | case kCT_ITEMDBLCLICK:
|
---|
1095 | //
|
---|
1096 | // process the double click in the file view container
|
---|
1097 | //
|
---|
1098 |
|
---|
1099 | if ( parm1 == kButton1) {
|
---|
1100 | if ( fFileCont->NumSelected() == 1 ) {
|
---|
1101 | //
|
---|
1102 | // one file selected
|
---|
1103 | //
|
---|
1104 | item = (TGFileItem *) fFileCont->GetNextSelected(&np) ;
|
---|
1105 |
|
---|
1106 | if ( S_ISDIR(item->GetType()) ) { // file is directory
|
---|
1107 |
|
---|
1108 | sprintf (wort, "%s", item->GetItemName()->GetString()) ;
|
---|
1109 |
|
---|
1110 | //
|
---|
1111 | // check if in this directory the file cer000001 exits
|
---|
1112 | // if it exists, do not open the stuff
|
---|
1113 | //
|
---|
1114 |
|
---|
1115 | if ( CerFileExist( wort ) ) {
|
---|
1116 |
|
---|
1117 | fSelectButton->SetState(kButtonUp) ;
|
---|
1118 |
|
---|
1119 | new TGMsgBox(fClient->GetRoot(), this,
|
---|
1120 | "Information",
|
---|
1121 | "This is a directory containing cer files\n click on select to chose it!",
|
---|
1122 | kMBIconAsterisk, buttons, &retval);
|
---|
1123 |
|
---|
1124 | }
|
---|
1125 | else {
|
---|
1126 | sprintf (fInputPath,"\0") ;
|
---|
1127 | fSelectButton->SetState(kButtonDisabled) ;
|
---|
1128 | fDir2->RemoveEntry(1) ;
|
---|
1129 | fDir2->AddEntry(fInputPath,1) ;
|
---|
1130 | fDir2->MapSubwindows() ;
|
---|
1131 | fDir2->Layout() ;
|
---|
1132 |
|
---|
1133 | fDir3->RemoveEntry(1) ;
|
---|
1134 | fDir3->AddEntry(fInputPath,1) ;
|
---|
1135 | fDir3->MapSubwindows() ;
|
---|
1136 | fDir3->Layout() ;
|
---|
1137 |
|
---|
1138 | sprintf (wort2, "\0" ) ;
|
---|
1139 | fDirEvtNb->RemoveEntry(1) ;
|
---|
1140 | fDirEvtNb->AddEntry( wort2, 1 ) ;
|
---|
1141 | fDirEvtNb->MapSubwindows() ;
|
---|
1142 | fDirEvtNb->Layout() ;
|
---|
1143 |
|
---|
1144 | //
|
---|
1145 | // goto directory
|
---|
1146 | //
|
---|
1147 | fFileCont->ChangeDirectory ( wort ) ;
|
---|
1148 | gSystem->ChangeDirectory( wort ) ;
|
---|
1149 |
|
---|
1150 | sprintf (wort, "%s", gSystem->WorkingDirectory() ) ;
|
---|
1151 | fDir->RemoveEntry(1) ;
|
---|
1152 | fDir->AddEntry( wort, 1 ) ;
|
---|
1153 | fDir->MapSubwindows() ;
|
---|
1154 | fDir->Layout() ;
|
---|
1155 | }
|
---|
1156 |
|
---|
1157 | }
|
---|
1158 | else { // item is a file
|
---|
1159 | sprintf (testfile, "%s", item->GetItemName()->GetString() ) ;
|
---|
1160 |
|
---|
1161 | //
|
---|
1162 | // determine the file type by extensions
|
---|
1163 | //
|
---|
1164 |
|
---|
1165 | for (Int_t i = 0 ; i<5; i++)
|
---|
1166 | extens[i] = '\0' ;
|
---|
1167 |
|
---|
1168 | for ( Int_t i=0; testfile[i] != '\0'; i++) {
|
---|
1169 | if ( testfile[i] == '.') {
|
---|
1170 | strncpy (extens, &testfile[i+1], 4 ) ;
|
---|
1171 | break ;
|
---|
1172 | }
|
---|
1173 | }
|
---|
1174 |
|
---|
1175 | //
|
---|
1176 | // postscript file
|
---|
1177 | //
|
---|
1178 |
|
---|
1179 | if ( ! strcmp(extens, "ps") ) {
|
---|
1180 | sprintf ( command, "gv %s/%s &",
|
---|
1181 | gSystem->WorkingDirectory(),
|
---|
1182 | testfile ) ;
|
---|
1183 | gSystem->Exec(command) ;
|
---|
1184 | break ;
|
---|
1185 | }
|
---|
1186 |
|
---|
1187 |
|
---|
1188 |
|
---|
1189 |
|
---|
1190 | }
|
---|
1191 | }
|
---|
1192 | }
|
---|
1193 | else if ( parm1 == kButton3) { // right mouse double click
|
---|
1194 | printf ("huschel kButton3\n");
|
---|
1195 | }
|
---|
1196 |
|
---|
1197 | break;
|
---|
1198 |
|
---|
1199 | }
|
---|
1200 | break ;
|
---|
1201 |
|
---|
1202 |
|
---|
1203 | default:
|
---|
1204 | break;
|
---|
1205 | }
|
---|
1206 | return kTRUE;
|
---|
1207 | }
|
---|
1208 |
|
---|
1209 |
|
---|