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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Fri Mar 30 11:16:43 2007 UTC (17 years, 8 months ago) by mocchiut
Branch: MAIN
CVS Tags: v2r01
Changes since 1.3: +149 -23 lines
Yet another small upgrade

1 mocchiut 1.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 mocchiut 1.4 #include <PamLevel2.h>
50     //
51 mocchiut 1.1 #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 mocchiut 1.3 cframe1 = new TGCompositeFrame(this, 280, 40, kVerticalFrame);
108 mocchiut 1.1 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 mocchiut 1.3 TGCompositeFrame *cframe5 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
112     gf = new TGGroupFrame(cframe1, "Detectors");
113     TGGroupFrame *gf2 = new TGGroupFrame(cframe5, "Appearance");
114 mocchiut 1.1 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 mocchiut 1.3 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 mocchiut 1.1 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 mocchiut 1.3 htext->AddFrame(Load, new TGLayoutHints(kLHintsCenterX,0,5,5,5));
139 mocchiut 1.1 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 mocchiut 1.2 Load2->SetToolTipText("Clear box and click to unload file");
147 mocchiut 1.1 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 mocchiut 1.3 htext2->AddFrame(Load2, new TGLayoutHints(kLHintsCenterX,0,5,5,5));
151 mocchiut 1.1 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 mocchiut 1.3 //
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 mocchiut 1.1 fchktof->Connect("Clicked()","PAMevcontrol", this,"chktof()");
201     if ( cvar->TOF ) fchktof->SetState(kButtonDown);
202 mocchiut 1.3 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 mocchiut 1.1 //
221 mocchiut 1.3 fchkac = new TGCheckButton(hframedec[5], "Show");
222 mocchiut 1.1 fchkac->Connect("Clicked()","PAMevcontrol", this,"chkac()");
223     if ( cvar->AC ) fchkac->SetState(kButtonDown);
224 mocchiut 1.3 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 mocchiut 1.1 //
230 mocchiut 1.3 // 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 mocchiut 1.1 //
245 mocchiut 1.3 // S4
246 mocchiut 1.1 //
247 mocchiut 1.3 fchks4 = new TGCheckButton(hframedec[7], "Show");
248 mocchiut 1.1 fchks4->Connect("Clicked()","PAMevcontrol",this,"chks4()");
249     if ( cvar->S4 ) fchks4->SetState(kButtonDown);
250 mocchiut 1.3 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 mocchiut 1.1 //
258 mocchiut 1.3 fchknd = new TGCheckButton(hframedec[8], "Show");
259 mocchiut 1.1 fchknd->Connect("Clicked()","PAMevcontrol",this,"chknd()");
260     if ( cvar->ND ) fchknd->SetState(kButtonDown);
261 mocchiut 1.3 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,"showorbdata()");
271     if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled);
272     hframedec[9]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
273 mocchiut 1.1 //
274 mocchiut 1.3 // All data
275     //
276     fshowall = new TGTextButton(hframedec[10], "Show Data");
277     fshowall->Connect("Clicked()","PAMevcontrol", this,"showorbdata()");
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 mocchiut 1.1 //
284 mocchiut 1.3 // 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 mocchiut 1.1 //
288 mocchiut 1.2 fchkinfo = new TGCheckButton(hframe3, "Infos");
289 mocchiut 1.1 fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");
290     if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown);
291 mocchiut 1.3 hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5));
292 mocchiut 1.1 //
293 mocchiut 1.2 fchknames = new TGCheckButton(hframe3, "Names");
294 mocchiut 1.1 fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");
295     if ( cvar->VINFOS ) fchknames->SetState(kButtonDown);
296 mocchiut 1.3 hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
297 mocchiut 1.2 fchkpalette = new TGCheckButton(hframe3, "Palette");
298 mocchiut 1.1 fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");
299     if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown);
300 mocchiut 1.3 hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));
301     gf2->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX));
302 mocchiut 1.1 //
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 mocchiut 1.4 hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
314 mocchiut 1.1 //
315     //
316 mocchiut 1.4 // 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 mocchiut 1.1 ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");
327     if ( cvar->fl0 ) ffl0->SetState(kButtonDown);
328     if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);
329 mocchiut 1.4 hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
330 mocchiut 1.3 //
331     hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));
332     gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));
333 mocchiut 1.1 //
334 mocchiut 1.3 cframe1->AddFrame(gf, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
335     // cframe1->Resize(280,10);
336     // cframe1->GetLayoutManager()->SetDefaultHeight(5);
337     // MapWindow();
338 mocchiut 1.1 //
339 mocchiut 1.3 cframe5->AddFrame(gf2, new TGLayoutHints(kLHintsExpandX,5,5,5,5));
340 mocchiut 1.1 //
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 mocchiut 1.3 htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY| kLHintsRight, 2, 2, 2, 1));
385 mocchiut 1.1 //
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 mocchiut 1.3 AddFrame(cframe5, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
422 mocchiut 1.1 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 mocchiut 1.3 AddFrame(hframe, new TGLayoutHints(kLHintsExpandX,1,1,1,1));
426 mocchiut 1.1 // 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 mocchiut 1.3 //
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 mocchiut 1.1 }
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 mocchiut 1.3 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     printf("orb \n");
480     };
481    
482     void PAMevcontrol::showtrgdata(){
483     printf("trg \n");
484     };
485    
486     void PAMevcontrol::showrundata(){
487     printf("run \n");
488     };
489    
490     void PAMevcontrol::showcaldata(){
491     printf("cal \n");
492     };
493    
494     void PAMevcontrol::chkcalost(){
495 mocchiut 1.4 if ( cvar->CALOT ) {
496     cvar->CALOT = 0;
497 mocchiut 1.3 } else {
498 mocchiut 1.4 cvar->CALOT = 1;
499 mocchiut 1.3 };
500     cvar->i--;
501     cvar->nevents = 0;
502     cvar->firstevno = 0;
503     cvar->lastevno = 0;
504     cvar->refresh = true;
505     };
506    
507     void PAMevcontrol::showtrkdata(){
508     printf("trk \n");
509     };
510    
511     void PAMevcontrol::showtofdata(){
512     printf("tof \n");
513     };
514    
515     void PAMevcontrol::showacdata(){
516     printf("ac \n");
517     };
518    
519     void PAMevcontrol::shownddata(){
520     printf("nd \n");
521     };
522    
523     void PAMevcontrol::shows4data(){
524     printf("s4 \n");
525     };
526    
527     void PAMevcontrol::showsidata(){
528     printf("si \n");
529     };
530    
531     void PAMevcontrol::showalldata(){
532     printf("all \n");
533     };
534 mocchiut 1.1
535     void PAMevcontrol::SetFilename() {
536     TGTextEntry *entry = (TGTextEntry*)gTQSender;
537     TString text = entry->GetText();
538     cvar->thefilename=text.Data();
539     cvar->nevents = 0;
540     cvar->firstevno = 0;
541     cvar->lastevno = 0;
542     if ( cvar->fl0 ) {
543     cvar->fl0 = false;
544     ffl0->SetState(kButtonUp);
545     };
546     cvar->restart = true;
547     cvar->waitforever = false;
548     }
549    
550 mocchiut 1.4 void PAMevcontrol::getl0file() {
551     //
552     TString host = "mysql://localhost/pamelaprod";
553     TString user = "anonymous";
554     TString psw = "";
555     const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
556     const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
557     const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
558     if ( !pamdbhost ) pamdbhost = "";
559     if ( !pamdbuser ) pamdbuser = "";
560     if ( !pamdbpsw ) pamdbpsw = "";
561     if ( strcmp(pamdbhost,"") ) host = pamdbhost;
562     if ( strcmp(pamdbuser,"") ) user = pamdbuser;
563     if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
564     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
565     cout<<"Connecting to DB"<<endl;
566     cout<<"HOST "<<host<<endl;
567     cout<<"USER "<<user<<endl;
568     cout<<"PSW "<<psw<<endl;
569     cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
570     TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
571     if( dbc && dbc->IsConnected() ){
572     //
573     // Starting from level2
574     //
575     if ( clev->file == 2 ){
576     GL_ROOT glroot = GL_ROOT();
577     if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){
578     //
579     cvar->thefilename= glroot.PATH + glroot.NAME;
580     cvar->nevents = 0;
581     cvar->firstevno = 0;
582     cvar->lastevno = 0;
583     if ( cvar->fl0 ) {
584     cvar->fl0 = false;
585     ffl0->SetState(kButtonUp);
586     };
587     cvar->restart = true;
588     cvar->waitforever = false;
589     //
590     if ( cvar->thefilter != "" ){
591     cvar->thefilter="";
592     cvar->selex = true;
593     };
594     cvar->i = -(cvar->EVF + cvar->i -1);
595     //cvar->refresh = true;
596     // cvar->file = 0;
597     //
598     } else {
599     stringstream warning;
600     warning.str("");
601     warning << " Problems getting Level0 file ";
602     DIALOG(2,warning.str().c_str());
603     };
604     } else {
605     //
606     // starting from L0
607     //
608     stringstream warning;
609     warning.str("");
610     warning << " Not yet implemented ";
611     DIALOG(2,warning.str().c_str());
612     };
613     //
614     } else {
615     stringstream warning;
616     warning.str("");
617     warning << " Problems connectiong to DB! ";
618     DIALOG(2,warning.str().c_str());
619     };
620     dbc->Close();
621     };
622    
623 mocchiut 1.1 void PAMevcontrol::CheckLevel() {
624     if ( clev->file == 2 ){
625     ffl0->SetState(kButtonDisabled);
626 mocchiut 1.4 // if ( !cvar->tracknds4 ) {
627     // ftrks4->SetState(kButtonUp);
628     // } else {
629     // ftrks4->SetState(kButtonDown);
630     // };
631 mocchiut 1.1 } else {
632 mocchiut 1.4 //ftrks4->SetState(kButtonDisabled);
633 mocchiut 1.1 if ( !cvar->fl0 ) {
634     ffl0->SetState(kButtonUp);
635     } else {
636     ffl0->SetState(kButtonDown);
637     };
638     };
639     }
640    
641     void PAMevcontrol::SetSearching() {
642     bstop->SetState(kButtonUp);
643     };
644    
645     void PAMevcontrol::StopSearching() {
646     bstop->SetState(kButtonDisabled);
647     };
648    
649 mocchiut 1.2 void PAMevcontrol::RefreshButtons() {
650     if ( cvar->jumprog ){
651     jbwc1->SetState(kButtonDown);
652     } else {
653     jbwc0->SetState(kButtonDown);
654     };
655     if ( cvar->fl0 ){
656     ffl0->SetState(kButtonDown);
657     } else {
658     ffl0->SetState(kButtonUp);
659     };
660 mocchiut 1.4 // if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
661 mocchiut 1.2 if ( cvar->bw ){
662     bwc1->SetState(kButtonDown);
663     } else {
664     bwc0->SetState(kButtonDown);
665     };
666     if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);
667     if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);
668     if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);
669 mocchiut 1.4 //
670 mocchiut 1.3 if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);
671 mocchiut 1.4 if ( cvar->CALO ){
672     fchkcalo->SetState(kButtonDown);
673     fshowcal->SetState(kButtonUp);
674     } else {
675     fchkcalo->SetState(kButtonUp);
676     fchkcalost->SetState(kButtonDisabled);
677     fshowcal->SetState(kButtonDisabled);
678     };
679     //
680     if ( cvar->ND ){
681     fchknd->SetState(kButtonDown);
682     fshownd->SetState(kButtonUp);
683     } else {
684     fchknd->SetState(kButtonUp);
685     fshownd->SetState(kButtonDisabled);
686     };
687     //
688     if ( cvar->S4 ){
689     fchks4->SetState(kButtonDown);
690     fshows4->SetState(kButtonUp);
691     } else {
692     fchks4->SetState(kButtonUp);
693     fshows4->SetState(kButtonDisabled);
694     };
695     //
696     if ( cvar->TRK ){
697     fchktrk->SetState(kButtonDown);
698     fshowtrk->SetState(kButtonUp);
699     } else {
700     fchktrk->SetState(kButtonUp);
701     fshowtrk->SetState(kButtonDisabled);
702     }
703     //
704     if ( cvar->AC ){
705     fchkac->SetState(kButtonDown);
706     fshowac->SetState(kButtonUp);
707     } else {
708     fchkac->SetState(kButtonUp);
709     fshowac->SetState(kButtonDisabled);
710     };
711     //
712     if ( cvar->TOF ){
713     fchktof->SetState(kButtonDown);
714     fshowtof->SetState(kButtonUp);
715     } else {
716     fchktof->SetState(kButtonUp);
717     fshowtof->SetState(kButtonDisabled);
718     };
719     //
720     CheckLevel();
721     //
722 mocchiut 1.2 };
723    
724 mocchiut 1.1 void PAMevcontrol::SetFilter() {
725     TGTextEntry *entry = (TGTextEntry*)gTQSender;
726     TString text = entry->GetText();
727     cvar->thefilter=text.Data();
728     cvar->i--;
729     cvar->selex = true;
730     cvar->nevents = 0;
731     cvar->firstevno = 0;
732     cvar->lastevno = 0;
733     cvar->refresh = true;
734     }
735    
736     void PAMevcontrol::CompleteText() {
737     TGTextEntry *entry = (TGTextEntry*)gTQSender;
738     TString text = entry->GetText();
739     Int_t curspos = entry->GetCursorPosition();
740     Int_t ncurspos = 0;
741     TString textrem;
742     stringcopy(textrem,text,curspos,text.Length());
743     text.Resize(curspos);
744     if ( !strcmp(text.Data(),"") ) {
745     stringstream ntext;
746     ntext.str("");
747     ntext << gSystem->ExpandPathName("$HOME");
748     text = ntext.str().c_str();
749     curspos=ntext.str().length();
750     };
751     char *test = gSystem->ExpandPathName(text.Data());
752     const char *dir = gSystem->DirName(test);
753     const char *base = gSystem->BaseName(test);
754     TString lbase = base;
755     Int_t lenbase = lbase.Length();
756     TSystemDirectory *tsd = new TSystemDirectory("",dir);
757     TSystemFile *file;
758     TList *lsmatch = new TList;
759     Int_t numf = 0;
760     Int_t numgo = 0;
761     Int_t charmac = 0;
762     TString tbase;
763     Int_t k = 0;
764     stringstream newtext;
765     TSystemFile *mfile;
766     TSystemFile nfile;
767     TList *lsf = new TList;
768     const char *ctbase;
769     if ( !tsd->GetListOfFiles() ){
770     gVirtualX->Bell(0);
771     goto end;
772     };
773     lsf = tsd->GetListOfFiles();
774     file = (TSystemFile*)lsf->First();
775     //
776     while( (TSystemFile*)lsf->After(file) ){
777     numf++;
778     file = (TSystemFile*)lsf->After(file);
779     if ( !strncmp(file->GetName(),base,lenbase) ){
780     numgo++;
781     lsmatch->AddLast(file);
782     const char *ctbase = file->GetName();
783     tbase = ctbase;
784     charmac = tbase.Length();
785     };
786     };
787     newtext.str("");
788     if ( numgo > 0 ){
789     mfile = (TSystemFile*)lsmatch->First();
790     ctbase = mfile->GetName();
791     while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
792     mfile = (TSystemFile*)lsmatch->After(mfile);
793     ctbase = mfile->GetName();
794     };
795     tbase = ctbase;
796     base = ctbase;
797     charmac = tbase.Length();;
798     while( (TSystemFile*)lsmatch->After(mfile) ){
799     mfile = (TSystemFile*)lsmatch->After(mfile);
800     ctbase = mfile->GetName();
801     while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) {
802     mfile = (TSystemFile*)lsmatch->After(mfile);
803     ctbase = mfile->GetName();
804     };
805     tbase = ctbase;
806     k = 0;
807     for ( Int_t i=lenbase; i<=tbase.Length(); i++){
808     if ( !strncmp(tbase.Data(),base,i) && strcmp(tbase.Data(),base) ){
809     k = i;
810     };
811     };
812     if ( k <= charmac){
813     charmac = k;
814     };
815     };
816     gVirtualX->Bell(0);
817     };
818     if ( !charmac ) {
819     gVirtualX->Bell(0);
820     goto end;
821     };
822     tbase.Resize(charmac);
823     if ( !strcmp(dir,"") || !strcmp(dir,"/") ){
824     newtext << "/" << tbase.Data();
825     } else {
826     newtext << dir << "/" << tbase.Data();
827     };
828     nfile = TSystemFile(tbase.Data(),dir);
829     if ( nfile.IsDirectory() && numgo == 1 ) newtext << "/";
830     ncurspos = newtext.str().length();
831     if ( textrem.Length() ) newtext << textrem.Data();
832     entry->SetText(newtext.str().c_str());
833     entry->SetCursorPosition(ncurspos);
834     end:
835     lsf->Clear();
836     lsmatch->Clear();
837     }
838    
839     void PAMevcontrol::saveas() {
840     TString text = fText4->GetText();
841     Int_t sel=fCombo->GetSelected();
842     TString ty;
843     switch (sel){
844     case (0):
845     ty = ".ps";
846     break;
847     case (1):
848     ty = ".eps";
849     break;
850     case (2):
851     ty = ".gif";
852     break;
853     case (3):
854     ty = ".jpg";
855     break;
856     case (4):
857     ty = ".tiff";
858     break;
859     case (5):
860     ty = ".xpm";
861     break;
862     case (6):
863     ty = ".pdf";
864     break;
865     case (7):
866     ty = ".xml";
867     break;
868     case (8):
869     ty = ".png";
870     break;
871     case (9):
872     ty = ".svg";
873     break;
874     case (10):
875     ty = ".root";
876     break;
877     case (11):
878     ty = ".C";
879     break;
880     };
881     if ( sel == 0 ) ty = ".ps";
882     stringstream name;
883     if ( strcmp(text.Data(),"") ){
884     name.str("");
885     name << text.Data();
886     name << ty.Data();
887     thefigure->SaveAs(name.str().c_str());
888     name.str("");
889     name << " Saved as ";
890     name << text.Data();
891     name << ty.Data();
892     DIALOG(0,name.str().c_str());
893     printf(" Saved as %s%s \n",text.Data(),ty.Data());
894     };
895     }
896    
897     void PAMevcontrol::increment(float val) {
898     fHProg1->Reset();
899     fHProg1->SetPosition(val);
900     gSystem->ProcessEvents();
901     }
902    
903     void PAMevcontrol::forcel0() {
904     if ( cvar->fl0 ) {
905     cvar->fl0 = false;
906     } else {
907     cvar->fl0 = true;
908     };
909     cvar->alrforc = false;
910     cvar->i--;
911     cvar->nevents = 0;
912     cvar->firstevno = 0;
913     cvar->lastevno = 0;
914     cvar->refresh = true;
915     }
916    
917     void PAMevcontrol::clearselfi(){
918     fText2->SetText("");
919     }
920    
921     void PAMevcontrol::upgrnamfi(){
922     fText4->SetText(cvar->svas.Data());
923     fText4->SetCursorPosition(fText4->GetMaxLength());
924     }
925    
926     void PAMevcontrol::jumpto() {
927     TGTextEntry *entry = (TGTextEntry*)gTQSender;
928     TString text = entry->GetText();
929     Int_t j;
930     j = atoi(text.Data());
931     if ( cvar->jumprog ){
932     if ( j < 1 || j > cvar->nevents ) {
933     printf("\n You can choose between 1 and %i \n",(int)cvar->nevents);
934     stringstream warning;
935     warning.str("");
936     warning << "You can choose between 1 and ";
937     warning << (int)cvar->nevents;
938     DIALOG(1,warning.str().c_str());
939     } else {
940     stringstream warning;
941     // warning.str("");
942     // warning << "Jumping to progressive number ";
943     // warning << j;
944     // DIALOG(0,warning.str().c_str());
945     printf("\n Jumping to progressive number %i\n\n",j);
946     cvar->i = j-2;
947     cvar->goon = true;
948     SetSearching();
949     };
950     } else {
951     if ( j < cvar->firstevno || j > cvar->lastevno ) {
952     printf("\n You can choose between %i and %i \n",cvar->firstevno,cvar->lastevno);
953     stringstream warning;
954     warning.str("");
955     warning << "You can choose between ";
956     warning << cvar->firstevno;
957     warning << " and ";
958     warning << cvar->lastevno;
959     DIALOG(1,warning.str().c_str());
960     } else {
961     // stringstream warning;
962     // warning.str("");
963     // warning << "Jumping to event number ";
964     // warning << j;
965     // DIALOG(0,warning.str().c_str());
966     printf("\n Jumping to packet number %i\n\n",j);
967     cvar->jumpto = j;
968     cvar->jumpen = true;
969     cvar->goon = true;
970     SetSearching();
971     };
972     };
973     entry->SetText("");
974     }
975    
976     void PAMevcontrol::radioevent() {
977     cvar->jumprog = false;
978     }
979    
980     void PAMevcontrol::radioprog() {
981     cvar->jumprog = true;
982     }
983    
984     void PAMevcontrol::radiocolor() {
985     if ( !cvar->goon ){
986     if ( cvar->bw ) {
987     cvar->bw = 0;
988     cvar->i--;
989     cvar->goon = true;
990     };
991     };
992     }
993    
994     void PAMevcontrol::radiobw() {
995     if ( !cvar->goon ){
996     if ( !cvar->bw ) {
997     cvar->bw = 1;
998     cvar->i--;
999     cvar->goon = true;
1000     };
1001     };
1002     }
1003    
1004     void PAMevcontrol::radiotrack() {
1005     if ( cvar->tracknds4 ) {
1006     cvar->tracknds4 = 0;
1007     } else {
1008     cvar->tracknds4 = 1;
1009     };
1010     cvar->i--;
1011     cvar->goon = true;
1012     }
1013    
1014     void PAMevcontrol::chktof() {
1015     if ( cvar->TOF ) {
1016     cvar->TOF = 0;
1017     } else {
1018     cvar->TOF = 1;
1019     };
1020     cvar->i--;
1021     cvar->nevents = 0;
1022     cvar->firstevno = 0;
1023     cvar->lastevno = 0;
1024     cvar->refresh = true;
1025     }
1026    
1027     void PAMevcontrol::chkac() {
1028     if ( cvar->AC ) {
1029     cvar->AC = 0;
1030     } else {
1031     cvar->AC = 1;
1032     };
1033     cvar->i--;
1034     cvar->nevents = 0;
1035     cvar->firstevno = 0;
1036     cvar->lastevno = 0;
1037     cvar->refresh = true;
1038     }
1039    
1040     void PAMevcontrol::chktrk() {
1041     if ( cvar->TRK ) {
1042     cvar->TRK = 0;
1043     } else {
1044     cvar->TRK = 1;
1045     };
1046     cvar->i--;
1047     cvar->nevents = 0;
1048     cvar->firstevno = 0;
1049     cvar->lastevno = 0;
1050     cvar->refresh = true;
1051     }
1052    
1053     void PAMevcontrol::chkcalo() {
1054     if ( cvar->CALO ) {
1055     cvar->CALO = 0;
1056     } else {
1057     cvar->CALO = 1;
1058     };
1059     cvar->i--;
1060     cvar->nevents = 0;
1061     cvar->firstevno = 0;
1062     cvar->lastevno = 0;
1063     cvar->refresh = true;
1064     }
1065    
1066     void PAMevcontrol::chks4() {
1067     if ( cvar->S4 ) {
1068     cvar->S4 = 0;
1069     } else {
1070     cvar->S4 = 1;
1071     };
1072     cvar->i--;
1073     cvar->nevents = 0;
1074     cvar->firstevno = 0;
1075     cvar->lastevno = 0;
1076     cvar->refresh = true;
1077     }
1078    
1079     void PAMevcontrol::chknd() {
1080     if ( cvar->ND ) {
1081     cvar->ND = 0;
1082     } else {
1083     cvar->ND = 1;
1084     };
1085     cvar->i--;
1086     cvar->nevents = 0;
1087     cvar->firstevno = 0;
1088     cvar->lastevno = 0;
1089     cvar->refresh = true;
1090     }
1091    
1092     void PAMevcontrol::chkinfo() {
1093     if ( cvar->INFOS ) {
1094     cvar->INFOS = 0;
1095     } else {
1096     cvar->INFOS = 1;
1097     };
1098     cvar->i--;
1099     cvar->goon = true;
1100     }
1101    
1102     void PAMevcontrol::chknames() {
1103     if ( cvar->VINFOS ) {
1104     cvar->VINFOS = 0;
1105     } else {
1106     cvar->VINFOS = 1;
1107     };
1108     cvar->i--;
1109     cvar->goon = true;
1110     }
1111    
1112     void PAMevcontrol::chkpalette() {
1113     if ( cvar->PALETTE ) {
1114     cvar->PALETTE = 0;
1115     } else {
1116     cvar->PALETTE = 1;
1117     };
1118     cvar->i--;
1119     cvar->goon = true;
1120     }
1121    
1122     void PAMevcontrol::next() {
1123     SetSearching();
1124     if ( cvar->i == cvar->nevents-1 ) {
1125     printf("This is the last event, you can't go forward! \n");
1126     DIALOG(1,"This is the last event!");
1127     } else {
1128     cvar->goon = true;
1129     cvar->doflag = 1;
1130     };
1131     }
1132    
1133     void PAMevcontrol::stop() {
1134     DIALOG(1,"Stop searching");
1135     cvar->doflag = 3;
1136     }
1137    
1138     void PAMevcontrol::prev() {
1139     SetSearching();
1140     if ( cvar->i > 0 ) {
1141     printf("WARNING: going backward!\n\n");
1142     cvar->doflag = 2;
1143     cvar->goon = true;
1144     } else {
1145     printf("This is the first event, you can't go backward! \n");
1146     DIALOG(1,"This is the first event!");
1147     };
1148     }
1149    
1150     void PAMevcontrol::Terminate() {
1151     gSystem->ProcessEvents();
1152     gApplication->Terminate(0);
1153     }
1154    
1155     PAMevcontrol::~PAMevcontrol() {
1156     // Clean up used widgets: frames, buttons, layouthints
1157     Cleanup();
1158     delete this;
1159     }

  ViewVC Help
Powered by ViewVC 1.1.23