/[PAMELA software]/eventviewer/flight/src/FEVpamevcontrol.cpp
ViewVC logotype

Contents of /eventviewer/flight/src/FEVpamevcontrol.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Tue Oct 14 09:21:27 2008 UTC (16 years, 2 months ago) by mocchiut
Branch: MAIN
CVS Tags: v4r00
Changes since 1.7: +4 -0 lines
Radio buttons bug fixed

1 #include <math.h>
2 #include <stdio.h>
3 #include <iostream>
4 #include <iomanip>
5 #include <fstream>
6 #include <sstream>
7 #if (__GNUC__ == 3) && (__GNUC_MINOR__ == 2)
8 char* operator+( std::streampos&, char* );
9 #endif
10 //
11 #include <TObjectTable.h>
12 #include <TGClient.h>
13 #include <TGButton.h>
14 #include <TGComboBox.h>
15 #include <TGLabel.h>
16 #include <TGTextEntry.h>
17 #include <TGFrame.h>
18 #include <TGButtonGroup.h>
19 #include <TGProgressBar.h>
20 #include <TGMsgBox.h>
21 #include <TGComboBox.h>
22 #include <TTree.h>
23 #include <TClassEdit.h>
24 #include <TObject.h>
25 #include <TList.h>
26 #include <TSystem.h>
27 #include <TSystemDirectory.h>
28 #include <TString.h>
29 #include <TFile.h>
30 #include <TClass.h>
31 #include <TCanvas.h>
32 #include <TH1.h>
33 #include <TH1F.h>
34 #include <TH2D.h>
35 #include <TLatex.h>
36 #include <TPad.h>
37 #include <TPaveLabel.h>
38 #include <TLine.h>
39 #include <TPolyLine.h>
40 #include <TChain.h>
41 #include <TApplication.h>
42 #include <TVirtualX.h>
43 #include <TGClient.h>
44 #include <TGWindow.h>
45 #include <TEllipse.h>
46 #include <TArrow.h>
47 #include <TStyle.h>
48 //
49 #include <PamLevel2.h>
50 //
51 #include <FEVpamevcontrol.h>
52 //
53 ClassImp(PAMevcontrol);
54 ClassImp(CalorimeterCalibration);
55 //
56
57 using namespace std;
58
59 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){
60 if ( to == 0 ){
61 Int_t t2length = s2.Length();
62 s1 = "";
63 to = t2length;
64 };
65 for (Int_t i = from; i<to; i++){
66 s1.Append(s2[i],1);
67 };
68 }
69
70 void stringappend(TString& s1, const TString& s2){
71 Int_t t2length = s2.Length();
72 for (Int_t i = 0; i<t2length; i++){
73 s1.Append(s2[i],1);
74 };
75 }
76
77 CalorimeterCalibration::CalorimeterCalibration() {
78 fname = "dw_000000_000.dat";
79 status = 0;
80 for (Int_t i=0; i<2;i++){
81 for (Int_t j=0; j<22;j++){
82 for (Int_t m=0; m<96;m++){
83 mip[i][j][m] = 0.;
84 ermip[i][j][m] = 0.;
85 chi2[i][j][m] = 0.;
86 ndf[i][j][m] = 0.;
87 mask[i][j][m] = 0.;
88 for (Int_t a = 0; a < 4 ; a++){
89 fp[a][i][j][m] = 0.;
90 fpe[a][i][j][m] = 0.;
91 };
92 };
93 };
94 };
95 };
96
97 PAMevcontrol::PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,Variables & var, Levels &level, TCanvas &figure) : TGMainFrame(p, w, h){
98 //
99 SetCleanup(kDeepCleanup);
100 DontCallClose();
101 Connect("CloseWindow()","PAMevcontrol",this,"Terminate()");
102 //
103 clev = &level;
104 cvar = &var;
105 thefigure = &figure;
106 //
107 cframe1 = new TGCompositeFrame(this, 280, 40, kVerticalFrame);
108 TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
109 TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
110 TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
111 TGCompositeFrame *cframe5 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
112 gf = new TGGroupFrame(cframe1, "Detectors");
113 TGGroupFrame *gf2 = new TGGroupFrame(cframe5, "Appearance");
114 TGGroupFrame *inputf = new TGGroupFrame(cframe2, "Input");
115 TGGroupFrame *jumpf = new TGGroupFrame(cframe3, "Jump to");
116 TGGroupFrame *savef = new TGGroupFrame(cframe4, "Save figure as");
117 //
118 TGHorizontalFrame *htexts = new TGHorizontalFrame(savef,400,800);
119 TGHorizontalFrame *htextsl = new TGHorizontalFrame(cframe4,400,800);
120 TGHorizontalFrame *htext = new TGHorizontalFrame(inputf,400,800);
121 TGHorizontalFrame *htext2 = new TGHorizontalFrame(inputf,400,800);
122 TGHorizontalFrame *htext3 = new TGHorizontalFrame(jumpf,400,800);
123 TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80);
124 TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800);
125 for (Int_t fr=0; fr<12; fr++) hframedec[fr] = new TGHorizontalFrame(gf, 7, 7);
126 TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf2, 280, 40);
127 TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf2,280,10);
128 TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 40);
129 TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800);
130 //
131 TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1);
132 fText->SetText(cvar->thefilename.Data());
133 TGTextButton *Load = new TGTextButton(htext,"Load");
134 Load->Connect("Pressed()","TGTextEntry",fText,"ReturnPressed()");
135 fText->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilename()");
136 fText->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
137 htext->AddFrame(fText, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5));
138 htext->AddFrame(Load, new TGLayoutHints(kLHintsCenterX,0,5,5,5));
139 inputf->AddFrame(new TGLabel(inputf, new TGHotString("Filename:")));
140 inputf->AddFrame(htext, new TGLayoutHints(kLHintsExpandX));
141 //
142 fText2 = new TGTextEntry(htext2, new TGTextBuffer(20),-1);
143 fText2->SetText(cvar->thefilter.Data());
144 TGTextButton *Load2 = new TGTextButton(htext2,"Load");
145 Load2->Connect("Clicked()","TGTextEntry",fText2,"ReturnPressed()");
146 Load2->SetToolTipText("Clear box and click to unload file");
147 fText2->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilter()");
148 fText2->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
149 htext2->AddFrame(fText2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5));
150 htext2->AddFrame(Load2, new TGLayoutHints(kLHintsCenterX,0,5,5,5));
151 inputf->AddFrame(new TGLabel(inputf, new TGHotString("Selection file:")));
152 inputf->AddFrame(htext2, new TGLayoutHints(kLHintsExpandX));
153 //
154 cframe2->AddFrame(inputf,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
155 //
156 //
157 //
158 fComboDec = new TGComboBox(gf, 98);
159 fComboDec->AddEntry(" - Select Detector -", 11);
160 fComboDec->AddEntry("PSCU - ORB", 0);
161 fComboDec->AddEntry("Run", 1);
162 fComboDec->AddEntry("Trigger", 2);
163 fComboDec->AddEntry("ToF", 3);
164 fComboDec->AddEntry("Tracker", 4);
165 fComboDec->AddEntry("Anticounter", 5);
166 fComboDec->AddEntry("Calorimeter", 6);
167 fComboDec->AddEntry("S4", 7);
168 fComboDec->AddEntry("ND", 8);
169 fComboDec->AddEntry("Software info", 9);
170 fComboDec->AddEntry("ALL", 10);
171 fComboDec->Select(11);
172 fComboDec->Resize(150,23);
173 gf->AddFrame(fComboDec, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX| kLHintsLeft, 5, 7, 7, 7));
174 fComboDec->Connect("Selected(Int_t)","PAMevcontrol",this,"refreshdec(Int_t)");
175 //
176 // PSCU/Orbital
177 //
178 fshoworb = new TGTextButton(hframedec[0], "Show Data");
179 fshoworb->Connect("Clicked()","PAMevcontrol", this,"showorbdata()");
180 if ( !cvar->ORB ) fshoworb->SetState(kButtonDisabled);
181 hframedec[0]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
182 //
183 // RUN
184 //
185 fshowrun = new TGTextButton(hframedec[1], "Show Data");
186 fshowrun->Connect("Clicked()","PAMevcontrol", this,"showrundata()");
187 if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled);
188 hframedec[1]->AddFrame(fshowrun, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
189 //
190 // Trigger
191 //
192 fshowtrg = new TGTextButton(hframedec[2], "Show Data");
193 fshowtrg->Connect("Clicked()","PAMevcontrol", this,"showtrgdata()");
194 if ( !cvar->TRG ) fshowtrg->SetState(kButtonDisabled);
195 hframedec[2]->AddFrame(fshowtrg, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
196 //
197 // TOF
198 //
199 fchktof = new TGCheckButton(hframedec[3], "Show");
200 fchktof->Connect("Clicked()","PAMevcontrol", this,"chktof()");
201 if ( cvar->TOF ) fchktof->SetState(kButtonDown);
202 hframedec[3]->AddFrame(fchktof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
203 fshowtof = new TGTextButton(hframedec[3], "Show Data");
204 fshowtof->Connect("Clicked()","PAMevcontrol", this,"showtofdata()");
205 if ( !cvar->TOF ) fshowtof->SetState(kButtonDisabled);
206 hframedec[3]->AddFrame(fshowtof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
207 //
208 // Tracker
209 //
210 fchktrk = new TGCheckButton(hframedec[4], "Show");
211 fchktrk->Connect("Clicked()","PAMevcontrol",this,"chktrk()");
212 if ( cvar->TRK ) fchktrk->SetState(kButtonDown);
213 hframedec[4]->AddFrame(fchktrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
214 fshowtrk = new TGTextButton(hframedec[4], "Show Data");
215 fshowtrk->Connect("Clicked()","PAMevcontrol", this,"showtrkdata()");
216 if ( !cvar->TRK ) fshowtrk->SetState(kButtonDisabled);
217 hframedec[4]->AddFrame(fshowtrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
218 //
219 // AC
220 //
221 fchkac = new TGCheckButton(hframedec[5], "Show");
222 fchkac->Connect("Clicked()","PAMevcontrol", this,"chkac()");
223 if ( cvar->AC ) fchkac->SetState(kButtonDown);
224 hframedec[5]->AddFrame(fchkac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
225 fshowac = new TGTextButton(hframedec[5], "Show Data");
226 fshowac->Connect("Clicked()","PAMevcontrol", this,"showacdata()");
227 if ( !cvar->AC ) fshowac->SetState(kButtonDisabled);
228 hframedec[5]->AddFrame(fshowac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
229 //
230 // Calorimeter
231 //
232 fchkcalo = new TGCheckButton(hframedec[6], "Show");
233 fchkcalo->Connect("Clicked()","PAMevcontrol",this,"chkcalo()");
234 if ( cvar->CALO ) fchkcalo->SetState(kButtonDown);
235 hframedec[6]->AddFrame(fchkcalo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
236 fchkcalost = new TGCheckButton(hframedec[6], "Track");
237 fchkcalost->Connect("Clicked()","PAMevcontrol",this,"chkcalost()");
238 if ( cvar->CALO ) fchkcalost->SetState(kButtonUp);
239 hframedec[6]->AddFrame(fchkcalost, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,2,5,5));
240 fshowcal = new TGTextButton(hframedec[6], "Show Data");
241 fshowcal->Connect("Clicked()","PAMevcontrol", this,"showcaldata()");
242 if ( !cvar->CALO ) fshowcal->SetState(kButtonDisabled);
243 hframedec[6]->AddFrame(fshowcal, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
244 //
245 // S4
246 //
247 fchks4 = new TGCheckButton(hframedec[7], "Show");
248 fchks4->Connect("Clicked()","PAMevcontrol",this,"chks4()");
249 if ( cvar->S4 ) fchks4->SetState(kButtonDown);
250 hframedec[7]->AddFrame(fchks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
251 fshows4 = new TGTextButton(hframedec[7], "Show Data");
252 fshows4->Connect("Clicked()","PAMevcontrol", this,"shows4data()");
253 if ( !cvar->S4 ) fshows4->SetState(kButtonDisabled);
254 hframedec[7]->AddFrame(fshows4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
255 //
256 // ND
257 //
258 fchknd = new TGCheckButton(hframedec[8], "Show");
259 fchknd->Connect("Clicked()","PAMevcontrol",this,"chknd()");
260 if ( cvar->ND ) fchknd->SetState(kButtonDown);
261 hframedec[8]->AddFrame(fchknd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
262 fshownd = new TGTextButton(hframedec[8], "Show Data");
263 fshownd->Connect("Clicked()","PAMevcontrol", this,"shownddata()");
264 if ( !cvar->ND ) fshownd->SetState(kButtonDisabled);
265 hframedec[8]->AddFrame(fshownd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
266 //
267 // Software infos
268 //
269 fshowsi = new TGTextButton(hframedec[9], "Show Data");
270 fshowsi->Connect("Clicked()","PAMevcontrol", this,"showsidata()");
271 if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled);
272 hframedec[9]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
273 //
274 // All data
275 //
276 fshowall = new TGTextButton(hframedec[10], "Show Data");
277 fshowall->Connect("Clicked()","PAMevcontrol", this,"showalldata()");
278 hframedec[10]->AddFrame(fshowall, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
279 //
280 // for (Int_t fr=0; fr<11; fr++) gf->AddFrame(hframedec[fr], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,1,1,1));
281 //
282 gf->AddFrame(hframedec[11], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,17,17));
283 //
284 // for (Int_t fr=0; fr<11; fr++) gf->AddFrame(hframedec[fr],new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5));
285 // gf->GetLayoutManager()->SetPadBottom(5);
286 // gf->MapSubwindows();
287 //
288 fchkinfo = new TGCheckButton(hframe3, "Infos");
289 fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");
290 if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown);
291 hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5));
292 //
293 fchknames = new TGCheckButton(hframe3, "Names");
294 fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");
295 if ( cvar->VINFOS ) fchknames->SetState(kButtonDown);
296 hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
297 fchkpalette = new TGCheckButton(hframe3, "Palette");
298 fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");
299 if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown);
300 hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));
301 gf2->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX));
302 //
303 TGVButtonGroup *group = new TGVButtonGroup(hframe4);
304 bwc0 = new TGRadioButton(group, "Colour");
305 bwc1 = new TGRadioButton(group, "B/W");
306 if ( cvar->bw ){
307 bwc1->SetState(kButtonDown);
308 } else {
309 bwc0->SetState(kButtonDown);
310 };
311 bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");
312 bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");
313 hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
314 //
315 //
316 // ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");
317 // ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");
318 // if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
319 // hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
320
321 fgetl0 = new TGTextButton(hframe5, "Get L0 file");
322 fgetl0->Connect("Clicked()","PAMevcontrol", this,"getl0file()");
323 hframe5->AddFrame(fgetl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
324
325 ffl0 = new TGCheckButton(hframe5, "Force RAW");
326 ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");
327 if ( cvar->fl0 ) ffl0->SetState(kButtonDown);
328 if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);
329 hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
330 //
331 hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));
332 gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));
333 //
334 cframe1->AddFrame(gf, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
335 // cframe1->Resize(280,10);
336 // cframe1->GetLayoutManager()->SetDefaultHeight(5);
337 // MapWindow();
338 //
339 cframe5->AddFrame(gf2, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
340 //
341 TGHButtonGroup *jgroup = new TGHButtonGroup(htext4);
342 jbwc0 = new TGRadioButton(jgroup, "packet ");
343 jbwc1 = new TGRadioButton(jgroup, "progressive");
344 jbwc1->SetState(kButtonDown);
345 jbwc0->Connect("Pressed()", "PAMevcontrol",this,"radioevent()");
346 jbwc1->Connect("Pressed()", "PAMevcontrol",this,"radioprog()");
347 htext4->AddFrame(jgroup,new TGLayoutHints(kLHintsExpandX,1,1,0,0));
348 //
349 TGTextEntry *fText3 = new TGTextEntry(htext3, new TGTextBuffer(6),-1);
350 TGTextButton *Jump = new TGTextButton(htext3,"go");
351 Jump->Connect("Clicked()","TGTextEntry",fText3,"ReturnPressed()");
352 fText3->Connect("ReturnPressed()", "PAMevcontrol", this,"jumpto()");
353 htext3->AddFrame(new TGLabel(htext3, new TGHotString("number")), new TGLayoutHints(kLHintsExpandX,0,0,1,1));
354 htext3->AddFrame(fText3, new TGLayoutHints(kLHintsExpandX, 0, 8, 0, 0));
355 htext3->AddFrame(Jump, new TGLayoutHints(kLHintsExpandX,0,0,0,0));
356 jumpf->AddFrame(htext4, new TGLayoutHints(kLHintsExpandX,0,0,1,1)); //
357 jumpf->AddFrame(htext3, new TGLayoutHints(kLHintsExpandX,0,0,0,1)); //
358 //
359 cframe3->AddFrame(jumpf,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
360 //
361 fText4 = new TGTextEntry(htexts, new TGTextBuffer(18),-1);
362 TGTextButton *save = new TGTextButton(htextsl,"save");
363 save->Connect("Clicked()","TGTextEntry",fText4,"ReturnPressed()");
364 fText4->Connect("ReturnPressed()", "PAMevcontrol", this,"saveas()");
365 fText4->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()");
366 htexts->AddFrame(fText4, new TGLayoutHints(kLHintsExpandX, 0, 8, 1, 1));
367 //
368 fCombo = new TGComboBox(htexts, 98);
369 fCombo->AddEntry(".ps", 0);
370 fCombo->AddEntry(".eps", 1);
371 fCombo->AddEntry(".gif", 2);
372 fCombo->AddEntry(".jpg", 3);
373 fCombo->AddEntry(".tiff", 4);
374 fCombo->AddEntry(".xpm", 5);
375 fCombo->AddEntry(".pdf", 6);
376 fCombo->AddEntry(".xml", 7);
377 fCombo->AddEntry(".png", 8);
378 fCombo->AddEntry(".svg", 9);
379 fCombo->AddEntry(".root", 10);
380 fCombo->AddEntry(".C", 11);
381 fCombo->Select(0);
382 fCombo->Resize(50,23);
383 // htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsCenterX | kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX, 0, 8, 1, 1));
384 htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY| kLHintsRight, 2, 2, 2, 1));
385 //
386 htextsl->AddFrame(save, new TGLayoutHints(kLHintsExpandX,0,0,2,1));
387 savef->AddFrame(htexts, new TGLayoutHints(kLHintsExpandX,0,0,2,5));
388 // savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,5,2,5,2));
389 savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,8,0,5,2));
390 //
391 cframe4->AddFrame(savef,new TGLayoutHints(kLHintsExpandX,5,5,5,5));
392 //
393 fHProg1 = new TGHProgressBar(hfrprog, TGProgressBar::kFancy, 260);
394 fHProg1->SetBarColor("green");
395 fHProg1->ShowPosition();
396 hfrprog->AddFrame(fHProg1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX,5,5,5,5));
397 //
398 //
399 TGTextButton *prev = new TGTextButton(hframe,"< &Back");
400 prev->Connect("Clicked()","PAMevcontrol",this,"prev()");
401 hframe->AddFrame(prev, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
402 //
403 TGTextButton *exit = new TGTextButton(hframe,"E&xit");//,"gApplication->Terminate(0)");
404 exit->Connect("Clicked()","PAMevcontrol",this,"Terminate()");
405 exit->SetToolTipText("Quit the event viewer");
406 hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
407 //
408 bstop = new TGTextButton(hframe,"&Stop");
409 bstop->Connect("Clicked()","PAMevcontrol",this,"stop()");
410 hframe->AddFrame(bstop, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
411 bstop->SetState(kButtonDisabled);
412 //
413 TGTextButton *next = new TGTextButton(hframe,"&Next >");
414 next->Connect("Clicked()","PAMevcontrol",this,"next()");
415 hframe->AddFrame(next, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4));
416 //
417 //
418 // AddFrame(htext, new TGLayoutHints(kLHintsExpandX,2,2,15,1));
419 AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
420 AddFrame(cframe1, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
421 AddFrame(cframe5, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
422 AddFrame(cframe3, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
423 AddFrame(cframe4, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
424 AddFrame(hfrprog, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
425 AddFrame(hframe, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
426 // Set a name to the main frame
427 SetWindowName("PAMELA Event Viewer control panel");
428 // Map all subwindows of main frame
429 MapSubwindows();
430 // Initialize the layout algorithm
431 Resize(GetDefaultSize());
432 // Map main frame
433 MapWindow();
434 //
435 gf->HideFrame(hframedec[11]);
436 for (Int_t fr=0; fr<11; fr++){
437 gf->AddFrame(hframedec[fr],new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5));
438 gf->HideFrame(hframedec[fr]);
439 };
440 gf->MapSubwindows();
441 //
442 }
443
444 void PAMevcontrol::DIALOG(Int_t ty, TString warn){
445 //
446 // ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR
447 //
448 Int_t retval;
449 TString title;
450 EMsgBoxIcon mb_icon = kMBIconStop;
451 if ( ty == 0 ){
452 title="INFO";
453 mb_icon = kMBIconAsterisk;
454 };
455 if ( ty == 1 ){
456 title="WARNING!";
457 mb_icon = kMBIconExclamation;
458 };
459 if ( ty == 2 ){
460 title="ERROR!!";
461 mb_icon = kMBIconStop;
462 };
463 new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval);
464 }
465
466 void PAMevcontrol::refreshdec(Int_t n){
467 //
468 for (Int_t i=0; i<11; i++){
469 gf->HideFrame(hframedec[i]);
470 };
471 //
472 if ( n < 11 ){
473 gf->ShowFrame(hframedec[n]);
474 };
475 };
476
477
478 void PAMevcontrol::showorbdata(){
479 cvar->showorb = !cvar->showorb;
480 if ( !cvar->showorb ) fshoworb->SetText("Show Data");
481 if ( cvar->showorb ) fshoworb->SetText("Hide Data");
482 // printf("orb \n");
483 };
484
485 void PAMevcontrol::showtrgdata(){
486 cvar->showtrg = !cvar->showtrg;
487 if ( !cvar->showtrg ) fshowtrg->SetText("Show Data");
488 if ( cvar->showtrg ) fshowtrg->SetText("Hide Data");
489 // printf("trg \n");
490 };
491
492 void PAMevcontrol::showrundata(){
493 cvar->showrun = !cvar->showrun;
494 if ( !cvar->showrun ) fshowrun->SetText("Show Data");
495 if ( cvar->showrun ) fshowrun->SetText("Hide Data");
496 // printf("run \n");
497 };
498
499 void PAMevcontrol::showcaldata(){
500 cvar->showcal = !cvar->showcal;
501 if ( !cvar->showcal ) fshowcal->SetText("Show Data");
502 if ( cvar->showcal ) fshowcal->SetText("Hide Data");
503 // printf("cal \n");
504 };
505
506 void PAMevcontrol::chkcalost(){
507 if ( cvar->CALOT ) {
508 cvar->CALOT = 0;
509 } else {
510 cvar->CALOT = 1;
511 };
512 cvar->i--;
513 cvar->nevents = 0;
514 cvar->firstevno = 0;
515 cvar->lastevno = 0;
516 cvar->refresh = true;
517 };
518
519 void PAMevcontrol::showtrkdata(){
520 cvar->showtrk = !cvar->showtrk;
521 if ( !cvar->showtrk ) fshowtrk->SetText("Show Data");
522 if ( cvar->showtrk ) fshowtrk->SetText("Hide Data");
523 // printf("trk \n");
524 };
525
526 void PAMevcontrol::showtofdata(){
527 cvar->showtof = !cvar->showtof;
528 if ( !cvar->showtof ) fshowtof->SetText("Show Data");
529 if ( cvar->showtof ) fshowtof->SetText("Hide Data");
530 // printf("tof \n");
531 };
532
533 void PAMevcontrol::showacdata(){
534 cvar->showac = !cvar->showac;
535 if ( !cvar->showac ) fshowac->SetText("Show Data");
536 if ( cvar->showac ) fshowac->SetText("Hide Data");
537 // printf("ac \n");
538 };
539
540 void PAMevcontrol::shownddata(){
541 cvar->shownd = !cvar->shownd;
542 if ( !cvar->shownd ) fshownd->SetText("Show Data");
543 if ( cvar->shownd ) fshownd->SetText("Hide Data");
544 // printf("nd \n");
545 };
546
547 void PAMevcontrol::shows4data(){
548 cvar->shows4 = !cvar->shows4;
549 if ( !cvar->shows4 ) fshows4->SetText("Show Data");
550 if ( cvar->shows4 ) fshows4->SetText("Hide Data");
551 // printf("s4 \n");
552 };
553
554 void PAMevcontrol::showsidata(){
555 cvar->showsi = !cvar->showsi;
556 if ( !cvar->showsi ) fshowsi->SetText("Show Data");
557 if ( cvar->showsi ) fshowsi->SetText("Hide Data");
558 // printf("si \n");
559 };
560
561 void PAMevcontrol::showalldata(){
562 cvar->showall = !cvar->showall;
563 if ( !cvar->showall ) fshowall->SetText("Show Data");
564 if ( cvar->showall ) fshowall->SetText("Hide Data");
565 // printf("all \n");
566 };
567
568 void PAMevcontrol::SetFilename() {
569 TGTextEntry *entry = (TGTextEntry*)gTQSender;
570 TString text = entry->GetText();
571 cvar->thefilename=text.Data();
572 cvar->i = 0;
573 cvar->nevents = 0;
574 cvar->firstevno = 0;
575 cvar->lastevno = 0;
576 if ( cvar->fl0 ) {
577 cvar->fl0 = false;
578 ffl0->SetState(kButtonUp);
579 };
580 cvar->restart = true;
581 cvar->waitforever = false;
582 }
583
584 void PAMevcontrol::getl0file() {
585 //
586 TString host = "mysql://localhost/pamelaprod";
587 TString user = "anonymous";
588 TString psw = "";
589 const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
590 const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
591 const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
592 if ( !pamdbhost ) pamdbhost = "";
593 if ( !pamdbuser ) pamdbuser = "";
594 if ( !pamdbpsw ) pamdbpsw = "";
595 if ( strcmp(pamdbhost,"") ) host = pamdbhost;
596 if ( strcmp(pamdbuser,"") ) user = pamdbuser;
597 if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
598 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
599 cout<<"Connecting to DB"<<endl;
600 cout<<"HOST "<<host<<endl;
601 cout<<"USER "<<user<<endl;
602 cout<<"PSW "<<psw<<endl;
603 cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
604 TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
605 //
606 TSQLResult *pResult;
607 TSQLRow *Row;
608 //
609 if( dbc && dbc->IsConnected() ){
610 //
611 // Retrieve the file
612 //
613 if ( clev->file == 2 ){
614 //
615 // Starting from level2
616 //
617 GL_ROOT glroot = GL_ROOT();
618 if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){
619 //
620 cvar->thefilename= glroot.PATH + glroot.NAME;
621 cvar->nevents = 0;
622 cvar->firstevno = 0;
623 cvar->lastevno = 0;
624 if ( cvar->fl0 ) {
625 cvar->fl0 = false;
626 ffl0->SetState(kButtonUp);
627 };
628 cvar->restart = true;
629 cvar->waitforever = false;
630 //
631 if ( cvar->thefilter != "" ){
632 cvar->thefilter="";
633 cvar->selex = true;
634 };
635 cvar->i = cvar->EVF + cvar->i ;
636 //cvar->refresh = true;
637 // cvar->file = 0;
638 //
639 } else {
640 stringstream warning;
641 warning.str("");
642 warning << " Problems getting Level0 file ";
643 DIALOG(2,warning.str().c_str());
644 };
645 } else {
646 //
647 // starting from L0
648 //
649 stringstream query;
650 query.str("");
651 query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;";
652 // printf(" query is %s \n",query.str().c_str());
653 pResult = dbc->Query(query.str().c_str());
654 Row = pResult->Next();
655 UInt_t idrl0 = 0;
656 if ( Row ){
657 idrl0 = (UInt_t)atoll(Row->GetField(0));
658 };
659 //
660 query.str("");
661 query << " SELECT ID,ID_ROOT_L2,EV_FROM FROM GL_RUN WHERE EV_FROM<="<<cvar->i<<" AND EV_TO>="<< cvar->i<<" AND ID_ROOT_L0="<< idrl0 <<";";
662 // printf(" query is %s \n",query.str().c_str());
663 pResult = dbc->Query(query.str().c_str());
664 Row = pResult->Next();
665 UInt_t idrl2 = 0;
666 UInt_t idrlun = 0;
667 UInt_t evfrom = 0;
668 if ( Row ){
669 idrlun = (UInt_t)atoll(Row->GetField(0));
670 idrl2 = (UInt_t)atoll(Row->GetField(1));
671 evfrom = (UInt_t)atoll(Row->GetField(2));
672 };
673 //
674 query.str("");
675 query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;";
676 // printf(" query is %s \n",query.str().c_str());
677 pResult = dbc->Query(query.str().c_str());
678 Row = pResult->Next();
679 UInt_t coren = 0;
680 while ( Row ){
681 if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break;
682 coren += (UInt_t)atoll(Row->GetField(1));
683 Row = pResult->Next();
684 };
685 coren += cvar->i - evfrom;
686 //
687 GL_ROOT glroot = GL_ROOT();
688 if( !glroot.Query_GL_ROOT(idrl2,dbc) ){
689 //
690 cvar->i = coren;
691 //
692 cvar->thefilename= glroot.PATH + glroot.NAME;
693 cvar->nevents = 0;
694 cvar->firstevno = 0;
695 cvar->lastevno = 0;
696 if ( cvar->fl0 ) {
697 cvar->fl0 = false;
698 ffl0->SetState(kButtonUp);
699 };
700 cvar->restart = true;
701 cvar->waitforever = false;
702 //
703 if ( cvar->thefilter != "" ){
704 cvar->thefilter="";
705 cvar->selex = true;
706 };
707 //
708 } else {
709 stringstream warning;
710 warning.str("");
711 warning << " Problems getting Level2 file ";
712 DIALOG(2,warning.str().c_str());
713 };
714 // stringstream warning;
715 // warning.str("");
716 // warning << " Not yet implemented ";
717 // DIALOG(2,warning.str().c_str());
718 };
719 //
720 } else {
721 stringstream warning;
722 warning.str("");
723 warning << " Problems connectiong to DB! ";
724 DIALOG(2,warning.str().c_str());
725 };
726 dbc->Close();
727 };
728
729 void PAMevcontrol::CheckLevel() {
730 if ( clev->file == 2 ){
731 ffl0->SetState(kButtonDisabled);
732 // if ( !cvar->tracknds4 ) {
733 // ftrks4->SetState(kButtonUp);
734 // } else {
735 // ftrks4->SetState(kButtonDown);
736 // };
737 } else {
738 //ftrks4->SetState(kButtonDisabled);
739 if ( !cvar->fl0 ) {
740 ffl0->SetState(kButtonUp);
741 } else {
742 ffl0->SetState(kButtonDown);
743 };
744 };
745 if ( clev->file == 2 ){
746 fgetl0->SetText("Get L0 file");
747 } else {
748 fgetl0->SetText("Get L2 file");
749 };
750 }
751
752 void PAMevcontrol::SetSearching() {
753 bstop->SetState(kButtonUp);
754 };
755
756 void PAMevcontrol::StopSearching() {
757 bstop->SetState(kButtonDisabled);
758 };
759
760 void PAMevcontrol::RefreshButtons() {
761 if ( cvar->jumprog ){
762 jbwc1->SetState(kButtonDown);
763 jbwc0->SetState(kButtonUp);
764 } else {
765 jbwc1->SetState(kButtonUp);
766 jbwc0->SetState(kButtonDown);
767 };
768 if ( cvar->fl0 ){
769 ffl0->SetState(kButtonDown);
770 } else {
771 ffl0->SetState(kButtonUp);
772 };
773 // if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
774 if ( cvar->bw ){
775 bwc1->SetState(kButtonDown);
776 bwc0->SetState(kButtonUp);
777 } else {
778 bwc0->SetState(kButtonDown);
779 bwc1->SetState(kButtonUp);
780 };
781 if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);
782 if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);
783 if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);
784 //
785 if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);
786 if ( cvar->CALO ){
787 fchkcalo->SetState(kButtonDown);
788 fshowcal->SetState(kButtonUp);
789 } else {
790 fchkcalo->SetState(kButtonUp);
791 fchkcalost->SetState(kButtonDisabled);
792 fshowcal->SetState(kButtonDisabled);
793 };
794 //
795 if ( cvar->ND ){
796 fchknd->SetState(kButtonDown);
797 fshownd->SetState(kButtonUp);
798 } else {
799 fchknd->SetState(kButtonUp);
800 fshownd->SetState(kButtonDisabled);
801 };
802 //
803 if ( cvar->S4 ){
804 fchks4->SetState(kButtonDown);
805 fshows4->SetState(kButtonUp);
806 } else {
807 fchks4->SetState(kButtonUp);
808 fshows4->SetState(kButtonDisabled);
809 };
810 //
811 if ( cvar->TRK ){
812 fchktrk->SetState(kButtonDown);
813 fshowtrk->SetState(kButtonUp);
814 } else {
815 fchktrk->SetState(kButtonUp);
816 fshowtrk->SetState(kButtonDisabled);
817 }
818 //
819 if ( cvar->AC ){
820 fchkac->SetState(kButtonDown);
821 fshowac->SetState(kButtonUp);
822 } else {
823 fchkac->SetState(kButtonUp);
824 fshowac->SetState(kButtonDisabled);
825 };
826 //
827 if ( cvar->TOF ){
828 fchktof->SetState(kButtonDown);
829 fshowtof->SetState(kButtonUp);
830 } else {
831 fchktof->SetState(kButtonUp);
832 fshowtof->SetState(kButtonDisabled);
833 };
834 //
835 CheckLevel();
836 //
837 };
838
839 void PAMevcontrol::SetFilter() {
840 TGTextEntry *entry = (TGTextEntry*)gTQSender;
841 TString text = entry->GetText();
842 cvar->thefilter=text.Data();
843 cvar->i--;
844 cvar->selex = true;
845 cvar->nevents = 0;
846 cvar->firstevno = 0;
847 cvar->lastevno = 0;
848 cvar->refresh = true;
849 }
850
851 void PAMevcontrol::CompleteText() {
852 TGTextEntry *entry = (TGTextEntry*)gTQSender;
853 TString text = entry->GetText();
854 Int_t curspos = entry->GetCursorPosition();
855 Int_t ncurspos = 0;
856 TString textrem;
857 stringcopy(textrem,text,curspos,text.Length());
858 text.Resize(curspos);
859 if ( !strcmp(text.Data(),"") ) {
860 stringstream ntext;
861 ntext.str("");
862 ntext << gSystem->ExpandPathName("$HOME");
863 text = ntext.str().c_str();
864 curspos=ntext.str().length();
865 };
866 char *test = gSystem->ExpandPathName(text.Data());
867 const char *dir = gSystem->DirName(test);
868 const char *base = gSystem->BaseName(test);
869 TString lbase = base;
870 Int_t lenbase = lbase.Length();
871 TSystemDirectory *tsd = new TSystemDirectory("",dir);
872 TSystemFile *file;
873 TList *lsmatch = new TList;
874 Int_t numf = 0;
875 Int_t numgo = 0;
876 Int_t charmac = 0;
877 TString tbase;
878 Int_t k = 0;
879 stringstream newtext;
880 TSystemFile *mfile;
881 TSystemFile nfile;
882 TList *lsf = new TList;
883 const char *ctbase;
884 if ( !tsd->GetListOfFiles() ){
885 gVirtualX->Bell(0);
886 goto end;
887 };
888 lsf = tsd->GetListOfFiles();
889 file = (TSystemFile*)lsf->First();
890 //
891 while( (TSystemFile*)lsf->After(file) ){
892 numf++;
893 file = (TSystemFile*)lsf->After(file);
894 if ( !strncmp(file->GetName(),base,lenbase) ){
895 numgo++;
896 lsmatch->AddLast(file);
897 const char *ctbase = file->GetName();
898 tbase = ctbase;
899 charmac = tbase.Length();
900 };
901 };
902 newtext.str("");
903 if ( numgo > 0 ){
904 mfile = (TSystemFile*)lsmatch->First();
905 ctbase = mfile->GetName();
906 while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
907 mfile = (TSystemFile*)lsmatch->After(mfile);
908 ctbase = mfile->GetName();
909 };
910 tbase = ctbase;
911 base = ctbase;
912 charmac = tbase.Length();;
913 while( (TSystemFile*)lsmatch->After(mfile) ){
914 mfile = (TSystemFile*)lsmatch->After(mfile);
915 ctbase = mfile->GetName();
916 while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
917 mfile = (TSystemFile*)lsmatch->After(mfile);
918 ctbase = mfile->GetName();
919 };
920 tbase = ctbase;
921 k = 0;
922 for ( Int_t i=lenbase; i<=tbase.Length(); i++){
923 if ( !strncmp(tbase.Data(),base,i) && strcmp(tbase.Data(),base) ){
924 k = i;
925 };
926 };
927 if ( k <= charmac){
928 charmac = k;
929 };
930 };
931 gVirtualX->Bell(0);
932 };
933 if ( !charmac ) {
934 gVirtualX->Bell(0);
935 goto end;
936 };
937 tbase.Resize(charmac);
938 if ( !strcmp(dir,"") || !strcmp(dir,"/") ){
939 newtext << "/" << tbase.Data();
940 } else {
941 newtext << dir << "/" << tbase.Data();
942 };
943 nfile = TSystemFile(tbase.Data(),dir);
944 if ( nfile.IsDirectory() && numgo == 1 ) newtext << "/";
945 ncurspos = newtext.str().length();
946 if ( textrem.Length() ) newtext << textrem.Data();
947 entry->SetText(newtext.str().c_str());
948 entry->SetCursorPosition(ncurspos);
949 end:
950 lsf->Clear();
951 lsmatch->Clear();
952 }
953
954 void PAMevcontrol::saveas() {
955 TString text = fText4->GetText();
956 Int_t sel=fCombo->GetSelected();
957 TString ty;
958 switch (sel){
959 case (0):
960 ty = ".ps";
961 break;
962 case (1):
963 ty = ".eps";
964 break;
965 case (2):
966 ty = ".gif";
967 break;
968 case (3):
969 ty = ".jpg";
970 break;
971 case (4):
972 ty = ".tiff";
973 break;
974 case (5):
975 ty = ".xpm";
976 break;
977 case (6):
978 ty = ".pdf";
979 break;
980 case (7):
981 ty = ".xml";
982 break;
983 case (8):
984 ty = ".png";
985 break;
986 case (9):
987 ty = ".svg";
988 break;
989 case (10):
990 ty = ".root";
991 break;
992 case (11):
993 ty = ".C";
994 break;
995 };
996 if ( sel == 0 ) ty = ".ps";
997 stringstream name;
998 if ( strcmp(text.Data(),"") ){
999 name.str("");
1000 name << text.Data();
1001 name << ty.Data();
1002 thefigure->SaveAs(name.str().c_str());
1003 name.str("");
1004 name << " Saved as ";
1005 name << text.Data();
1006 name << ty.Data();
1007 DIALOG(0,name.str().c_str());
1008 printf(" Saved as %s%s \n",text.Data(),ty.Data());
1009 };
1010 }
1011
1012 void PAMevcontrol::increment(float val) {
1013 fHProg1->Reset();
1014 fHProg1->SetPosition(val);
1015 gSystem->ProcessEvents();
1016 }
1017
1018 void PAMevcontrol::forcel0() {
1019 cvar->fl0 = !cvar->fl0;
1020 cvar->alrforc = false;
1021 cvar->i--;
1022 cvar->nevents = 0;
1023 cvar->firstevno = 0;
1024 cvar->lastevno = 0;
1025 cvar->refresh = true;
1026 }
1027
1028 void PAMevcontrol::clearselfi(){
1029 fText2->SetText("");
1030 }
1031
1032 void PAMevcontrol::upgrnamfi(){
1033 fText4->SetText(cvar->svas.Data());
1034 fText4->SetCursorPosition(fText4->GetMaxLength());
1035 }
1036
1037 void PAMevcontrol::jumpto() {
1038 TGTextEntry *entry = (TGTextEntry*)gTQSender;
1039 TString text = entry->GetText();
1040 Int_t j;
1041 j = atoi(text.Data());
1042 if ( cvar->jumprog ){
1043 if ( j < 1 || j > cvar->nevents ) {
1044 printf("\n You can choose between 1 and %i \n",(int)cvar->nevents);
1045 stringstream warning;
1046 warning.str("");
1047 warning << "You can choose between 1 and ";
1048 warning << (int)cvar->nevents;
1049 DIALOG(1,warning.str().c_str());
1050 } else {
1051 stringstream warning;
1052 // warning.str("");
1053 // warning << "Jumping to progressive number ";
1054 // warning << j;
1055 // DIALOG(0,warning.str().c_str());
1056 printf("\n Jumping to progressive number %i\n\n",j);
1057 cvar->i = j-2;
1058 cvar->goon = true;
1059 SetSearching();
1060 };
1061 } else {
1062 if ( j < cvar->firstevno || j > cvar->lastevno ) {
1063 printf("\n You can choose between %i and %i \n",cvar->firstevno,cvar->lastevno);
1064 stringstream warning;
1065 warning.str("");
1066 warning << "You can choose between ";
1067 warning << cvar->firstevno;
1068 warning << " and ";
1069 warning << cvar->lastevno;
1070 DIALOG(1,warning.str().c_str());
1071 } else {
1072 // stringstream warning;
1073 // warning.str("");
1074 // warning << "Jumping to event number ";
1075 // warning << j;
1076 // DIALOG(0,warning.str().c_str());
1077 printf("\n Jumping to packet number %i\n\n",j);
1078 cvar->jumpto = j;
1079 cvar->jumpen = true;
1080 cvar->goon = true;
1081 SetSearching();
1082 };
1083 };
1084 entry->SetText("");
1085 }
1086
1087 void PAMevcontrol::radioevent() {
1088 cvar->jumprog = false;
1089 }
1090
1091 void PAMevcontrol::radioprog() {
1092 cvar->jumprog = true;
1093 }
1094
1095 void PAMevcontrol::radiocolor() {
1096 if ( !cvar->goon ){
1097 if ( cvar->bw ) {
1098 cvar->bw = 0;
1099 cvar->i--;
1100 cvar->goon = true;
1101 };
1102 };
1103 }
1104
1105 void PAMevcontrol::radiobw() {
1106 if ( !cvar->goon ){
1107 if ( !cvar->bw ) {
1108 cvar->bw = 1;
1109 cvar->i--;
1110 cvar->goon = true;
1111 };
1112 };
1113 }
1114
1115 void PAMevcontrol::radiotrack() {
1116 if ( cvar->tracknds4 ) {
1117 cvar->tracknds4 = 0;
1118 } else {
1119 cvar->tracknds4 = 1;
1120 };
1121 cvar->i--;
1122 cvar->goon = true;
1123 }
1124
1125 void PAMevcontrol::chktof() {
1126 if ( cvar->TOF ) {
1127 cvar->TOF = 0;
1128 } else {
1129 cvar->TOF = 1;
1130 };
1131 cvar->i--;
1132 cvar->nevents = 0;
1133 cvar->firstevno = 0;
1134 cvar->lastevno = 0;
1135 cvar->refresh = true;
1136 }
1137
1138 void PAMevcontrol::chkac() {
1139 if ( cvar->AC ) {
1140 cvar->AC = 0;
1141 } else {
1142 cvar->AC = 1;
1143 };
1144 cvar->i--;
1145 cvar->nevents = 0;
1146 cvar->firstevno = 0;
1147 cvar->lastevno = 0;
1148 cvar->refresh = true;
1149 }
1150
1151 void PAMevcontrol::chktrk() {
1152 if ( cvar->TRK ) {
1153 cvar->TRK = 0;
1154 } else {
1155 cvar->TRK = 1;
1156 };
1157 cvar->i--;
1158 cvar->nevents = 0;
1159 cvar->firstevno = 0;
1160 cvar->lastevno = 0;
1161 cvar->refresh = true;
1162 }
1163
1164 void PAMevcontrol::chkcalo() {
1165 if ( cvar->CALO ) {
1166 cvar->CALO = 0;
1167 } else {
1168 cvar->CALO = 1;
1169 };
1170 cvar->i--;
1171 cvar->nevents = 0;
1172 cvar->firstevno = 0;
1173 cvar->lastevno = 0;
1174 cvar->refresh = true;
1175 }
1176
1177 void PAMevcontrol::chks4() {
1178 if ( cvar->S4 ) {
1179 cvar->S4 = 0;
1180 } else {
1181 cvar->S4 = 1;
1182 };
1183 cvar->i--;
1184 cvar->nevents = 0;
1185 cvar->firstevno = 0;
1186 cvar->lastevno = 0;
1187 cvar->refresh = true;
1188 }
1189
1190 void PAMevcontrol::chknd() {
1191 if ( cvar->ND ) {
1192 cvar->ND = 0;
1193 } else {
1194 cvar->ND = 1;
1195 };
1196 cvar->i--;
1197 cvar->nevents = 0;
1198 cvar->firstevno = 0;
1199 cvar->lastevno = 0;
1200 cvar->refresh = true;
1201 }
1202
1203 void PAMevcontrol::chkinfo() {
1204 if ( cvar->INFOS ) {
1205 cvar->INFOS = 0;
1206 } else {
1207 cvar->INFOS = 1;
1208 };
1209 cvar->i--;
1210 cvar->goon = true;
1211 }
1212
1213 void PAMevcontrol::chknames() {
1214 if ( cvar->VINFOS ) {
1215 cvar->VINFOS = 0;
1216 } else {
1217 cvar->VINFOS = 1;
1218 };
1219 cvar->i--;
1220 cvar->goon = true;
1221 }
1222
1223 void PAMevcontrol::chkpalette() {
1224 if ( cvar->PALETTE ) {
1225 cvar->PALETTE = 0;
1226 } else {
1227 cvar->PALETTE = 1;
1228 };
1229 cvar->i--;
1230 cvar->goon = true;
1231 }
1232
1233 void PAMevcontrol::next() {
1234 SetSearching();
1235 if ( cvar->i == cvar->nevents-1 ) {
1236 printf("This is the last event, you can't go forward! \n");
1237 DIALOG(1,"This is the last event!");
1238 } else {
1239 cvar->goon = true;
1240 cvar->doflag = 1;
1241 };
1242 }
1243
1244 void PAMevcontrol::stop() {
1245 DIALOG(1,"Stop searching");
1246 cvar->doflag = 3;
1247 }
1248
1249 void PAMevcontrol::prev() {
1250 SetSearching();
1251 if ( cvar->i > 0 ) {
1252 printf("WARNING: going backward!\n\n");
1253 cvar->doflag = 2;
1254 cvar->goon = true;
1255 } else {
1256 printf("This is the first event, you can't go backward! \n");
1257 DIALOG(1,"This is the first event!");
1258 };
1259 }
1260
1261 void PAMevcontrol::Terminate() {
1262 gSystem->ProcessEvents();
1263 gApplication->Terminate(0);
1264 }
1265
1266 PAMevcontrol::~PAMevcontrol() {
1267 // Clean up used widgets: frames, buttons, layouthints
1268 Cleanup();
1269 delete this;
1270 }

  ViewVC Help
Powered by ViewVC 1.1.23