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 |
|
|
#include <FEVpamevcontrol.h> |
50 |
|
|
// |
51 |
|
|
ClassImp(PAMevcontrol); |
52 |
|
|
ClassImp(CalorimeterCalibration); |
53 |
|
|
// |
54 |
|
|
|
55 |
|
|
using namespace std; |
56 |
|
|
|
57 |
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
58 |
|
|
if ( to == 0 ){ |
59 |
|
|
Int_t t2length = s2.Length(); |
60 |
|
|
s1 = ""; |
61 |
|
|
to = t2length; |
62 |
|
|
}; |
63 |
|
|
for (Int_t i = from; i<to; i++){ |
64 |
|
|
s1.Append(s2[i],1); |
65 |
|
|
}; |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
void stringappend(TString& s1, const TString& s2){ |
69 |
|
|
Int_t t2length = s2.Length(); |
70 |
|
|
for (Int_t i = 0; i<t2length; i++){ |
71 |
|
|
s1.Append(s2[i],1); |
72 |
|
|
}; |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
CalorimeterCalibration::CalorimeterCalibration() { |
76 |
|
|
fname = "dw_000000_000.dat"; |
77 |
|
|
status = 0; |
78 |
|
|
for (Int_t i=0; i<2;i++){ |
79 |
|
|
for (Int_t j=0; j<22;j++){ |
80 |
|
|
for (Int_t m=0; m<96;m++){ |
81 |
|
|
mip[i][j][m] = 0.; |
82 |
|
|
ermip[i][j][m] = 0.; |
83 |
|
|
chi2[i][j][m] = 0.; |
84 |
|
|
ndf[i][j][m] = 0.; |
85 |
|
|
mask[i][j][m] = 0.; |
86 |
|
|
for (Int_t a = 0; a < 4 ; a++){ |
87 |
|
|
fp[a][i][j][m] = 0.; |
88 |
|
|
fpe[a][i][j][m] = 0.; |
89 |
|
|
}; |
90 |
|
|
}; |
91 |
|
|
}; |
92 |
|
|
}; |
93 |
|
|
}; |
94 |
|
|
|
95 |
|
|
PAMevcontrol::PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,Variables & var, Levels &level, TCanvas &figure) : TGMainFrame(p, w, h){ |
96 |
|
|
// |
97 |
|
|
SetCleanup(kDeepCleanup); |
98 |
|
|
DontCallClose(); |
99 |
|
|
Connect("CloseWindow()","PAMevcontrol",this,"Terminate()"); |
100 |
|
|
// |
101 |
|
|
clev = &level; |
102 |
|
|
cvar = &var; |
103 |
|
|
thefigure = &figure; |
104 |
|
|
// |
105 |
mocchiut |
1.3 |
cframe1 = new TGCompositeFrame(this, 280, 40, kVerticalFrame); |
106 |
mocchiut |
1.1 |
TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); |
107 |
|
|
TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); |
108 |
|
|
TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); |
109 |
mocchiut |
1.3 |
TGCompositeFrame *cframe5 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); |
110 |
|
|
gf = new TGGroupFrame(cframe1, "Detectors"); |
111 |
|
|
TGGroupFrame *gf2 = new TGGroupFrame(cframe5, "Appearance"); |
112 |
mocchiut |
1.1 |
TGGroupFrame *inputf = new TGGroupFrame(cframe2, "Input"); |
113 |
|
|
TGGroupFrame *jumpf = new TGGroupFrame(cframe3, "Jump to"); |
114 |
|
|
TGGroupFrame *savef = new TGGroupFrame(cframe4, "Save figure as"); |
115 |
|
|
// |
116 |
|
|
TGHorizontalFrame *htexts = new TGHorizontalFrame(savef,400,800); |
117 |
|
|
TGHorizontalFrame *htextsl = new TGHorizontalFrame(cframe4,400,800); |
118 |
|
|
TGHorizontalFrame *htext = new TGHorizontalFrame(inputf,400,800); |
119 |
|
|
TGHorizontalFrame *htext2 = new TGHorizontalFrame(inputf,400,800); |
120 |
|
|
TGHorizontalFrame *htext3 = new TGHorizontalFrame(jumpf,400,800); |
121 |
|
|
TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80); |
122 |
|
|
TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800); |
123 |
mocchiut |
1.3 |
for (Int_t fr=0; fr<12; fr++) hframedec[fr] = new TGHorizontalFrame(gf, 7, 7); |
124 |
|
|
TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf2, 280, 40); |
125 |
|
|
TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf2,280,10); |
126 |
mocchiut |
1.1 |
TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 40); |
127 |
|
|
TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800); |
128 |
|
|
// |
129 |
|
|
TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1); |
130 |
|
|
fText->SetText(cvar->thefilename.Data()); |
131 |
|
|
TGTextButton *Load = new TGTextButton(htext,"Load"); |
132 |
|
|
Load->Connect("Pressed()","TGTextEntry",fText,"ReturnPressed()"); |
133 |
|
|
fText->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilename()"); |
134 |
|
|
fText->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); |
135 |
|
|
htext->AddFrame(fText, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5)); |
136 |
mocchiut |
1.3 |
htext->AddFrame(Load, new TGLayoutHints(kLHintsCenterX,0,5,5,5)); |
137 |
mocchiut |
1.1 |
inputf->AddFrame(new TGLabel(inputf, new TGHotString("Filename:"))); |
138 |
|
|
inputf->AddFrame(htext, new TGLayoutHints(kLHintsExpandX)); |
139 |
|
|
// |
140 |
|
|
fText2 = new TGTextEntry(htext2, new TGTextBuffer(20),-1); |
141 |
|
|
fText2->SetText(cvar->thefilter.Data()); |
142 |
|
|
TGTextButton *Load2 = new TGTextButton(htext2,"Load"); |
143 |
|
|
Load2->Connect("Clicked()","TGTextEntry",fText2,"ReturnPressed()"); |
144 |
mocchiut |
1.2 |
Load2->SetToolTipText("Clear box and click to unload file"); |
145 |
mocchiut |
1.1 |
fText2->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilter()"); |
146 |
|
|
fText2->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); |
147 |
|
|
htext2->AddFrame(fText2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5)); |
148 |
mocchiut |
1.3 |
htext2->AddFrame(Load2, new TGLayoutHints(kLHintsCenterX,0,5,5,5)); |
149 |
mocchiut |
1.1 |
inputf->AddFrame(new TGLabel(inputf, new TGHotString("Selection file:"))); |
150 |
|
|
inputf->AddFrame(htext2, new TGLayoutHints(kLHintsExpandX)); |
151 |
|
|
// |
152 |
|
|
cframe2->AddFrame(inputf,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); |
153 |
|
|
// |
154 |
mocchiut |
1.3 |
// |
155 |
|
|
// |
156 |
|
|
fComboDec = new TGComboBox(gf, 98); |
157 |
|
|
fComboDec->AddEntry(" - Select Detector -", 11); |
158 |
|
|
fComboDec->AddEntry("PSCU - ORB", 0); |
159 |
|
|
fComboDec->AddEntry("Run", 1); |
160 |
|
|
fComboDec->AddEntry("Trigger", 2); |
161 |
|
|
fComboDec->AddEntry("ToF", 3); |
162 |
|
|
fComboDec->AddEntry("Tracker", 4); |
163 |
|
|
fComboDec->AddEntry("Anticounter", 5); |
164 |
|
|
fComboDec->AddEntry("Calorimeter", 6); |
165 |
|
|
fComboDec->AddEntry("S4", 7); |
166 |
|
|
fComboDec->AddEntry("ND", 8); |
167 |
|
|
fComboDec->AddEntry("Software info", 9); |
168 |
|
|
fComboDec->AddEntry("ALL", 10); |
169 |
|
|
fComboDec->Select(11); |
170 |
|
|
fComboDec->Resize(150,23); |
171 |
|
|
gf->AddFrame(fComboDec, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX| kLHintsLeft, 5, 7, 7, 7)); |
172 |
|
|
fComboDec->Connect("Selected(Int_t)","PAMevcontrol",this,"refreshdec(Int_t)"); |
173 |
|
|
// |
174 |
|
|
// PSCU/Orbital |
175 |
|
|
// |
176 |
|
|
fshoworb = new TGTextButton(hframedec[0], "Show Data"); |
177 |
|
|
fshoworb->Connect("Clicked()","PAMevcontrol", this,"showorbdata()"); |
178 |
|
|
if ( !cvar->ORB ) fshoworb->SetState(kButtonDisabled); |
179 |
|
|
hframedec[0]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5)); |
180 |
|
|
// |
181 |
|
|
// RUN |
182 |
|
|
// |
183 |
|
|
fshowrun = new TGTextButton(hframedec[1], "Show Data"); |
184 |
|
|
fshowrun->Connect("Clicked()","PAMevcontrol", this,"showrundata()"); |
185 |
|
|
if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled); |
186 |
|
|
hframedec[1]->AddFrame(fshowrun, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5)); |
187 |
|
|
// |
188 |
|
|
// Trigger |
189 |
|
|
// |
190 |
|
|
fshowtrg = new TGTextButton(hframedec[2], "Show Data"); |
191 |
|
|
fshowtrg->Connect("Clicked()","PAMevcontrol", this,"showtrgdata()"); |
192 |
|
|
if ( !cvar->TRG ) fshowtrg->SetState(kButtonDisabled); |
193 |
|
|
hframedec[2]->AddFrame(fshowtrg, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5)); |
194 |
|
|
// |
195 |
|
|
// TOF |
196 |
|
|
// |
197 |
|
|
fchktof = new TGCheckButton(hframedec[3], "Show"); |
198 |
mocchiut |
1.1 |
fchktof->Connect("Clicked()","PAMevcontrol", this,"chktof()"); |
199 |
|
|
if ( cvar->TOF ) fchktof->SetState(kButtonDown); |
200 |
mocchiut |
1.3 |
hframedec[3]->AddFrame(fchktof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
201 |
|
|
fshowtof = new TGTextButton(hframedec[3], "Show Data"); |
202 |
|
|
fshowtof->Connect("Clicked()","PAMevcontrol", this,"showtofdata()"); |
203 |
|
|
if ( !cvar->TOF ) fshowtof->SetState(kButtonDisabled); |
204 |
|
|
hframedec[3]->AddFrame(fshowtof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
205 |
|
|
// |
206 |
|
|
// Tracker |
207 |
|
|
// |
208 |
|
|
fchktrk = new TGCheckButton(hframedec[4], "Show"); |
209 |
|
|
fchktrk->Connect("Clicked()","PAMevcontrol",this,"chktrk()"); |
210 |
|
|
if ( cvar->TRK ) fchktrk->SetState(kButtonDown); |
211 |
|
|
hframedec[4]->AddFrame(fchktrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
212 |
|
|
fshowtrk = new TGTextButton(hframedec[4], "Show Data"); |
213 |
|
|
fshowtrk->Connect("Clicked()","PAMevcontrol", this,"showtrkdata()"); |
214 |
|
|
if ( !cvar->TRK ) fshowtrk->SetState(kButtonDisabled); |
215 |
|
|
hframedec[4]->AddFrame(fshowtrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
216 |
|
|
// |
217 |
|
|
// AC |
218 |
mocchiut |
1.1 |
// |
219 |
mocchiut |
1.3 |
fchkac = new TGCheckButton(hframedec[5], "Show"); |
220 |
mocchiut |
1.1 |
fchkac->Connect("Clicked()","PAMevcontrol", this,"chkac()"); |
221 |
|
|
if ( cvar->AC ) fchkac->SetState(kButtonDown); |
222 |
mocchiut |
1.3 |
hframedec[5]->AddFrame(fchkac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
223 |
|
|
fshowac = new TGTextButton(hframedec[5], "Show Data"); |
224 |
|
|
fshowac->Connect("Clicked()","PAMevcontrol", this,"showacdata()"); |
225 |
|
|
if ( !cvar->AC ) fshowac->SetState(kButtonDisabled); |
226 |
|
|
hframedec[5]->AddFrame(fshowac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
227 |
mocchiut |
1.1 |
// |
228 |
mocchiut |
1.3 |
// Calorimeter |
229 |
|
|
// |
230 |
|
|
fchkcalo = new TGCheckButton(hframedec[6], "Show"); |
231 |
|
|
fchkcalo->Connect("Clicked()","PAMevcontrol",this,"chkcalo()"); |
232 |
|
|
if ( cvar->CALO ) fchkcalo->SetState(kButtonDown); |
233 |
|
|
hframedec[6]->AddFrame(fchkcalo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
234 |
|
|
fchkcalost = new TGCheckButton(hframedec[6], "Track"); |
235 |
|
|
fchkcalost->Connect("Clicked()","PAMevcontrol",this,"chkcalost()"); |
236 |
|
|
if ( cvar->CALO ) fchkcalost->SetState(kButtonUp); |
237 |
|
|
hframedec[6]->AddFrame(fchkcalost, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,2,5,5)); |
238 |
|
|
fshowcal = new TGTextButton(hframedec[6], "Show Data"); |
239 |
|
|
fshowcal->Connect("Clicked()","PAMevcontrol", this,"showcaldata()"); |
240 |
|
|
if ( !cvar->CALO ) fshowcal->SetState(kButtonDisabled); |
241 |
|
|
hframedec[6]->AddFrame(fshowcal, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
242 |
mocchiut |
1.1 |
// |
243 |
mocchiut |
1.3 |
// S4 |
244 |
mocchiut |
1.1 |
// |
245 |
mocchiut |
1.3 |
fchks4 = new TGCheckButton(hframedec[7], "Show"); |
246 |
mocchiut |
1.1 |
fchks4->Connect("Clicked()","PAMevcontrol",this,"chks4()"); |
247 |
|
|
if ( cvar->S4 ) fchks4->SetState(kButtonDown); |
248 |
mocchiut |
1.3 |
hframedec[7]->AddFrame(fchks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
249 |
|
|
fshows4 = new TGTextButton(hframedec[7], "Show Data"); |
250 |
|
|
fshows4->Connect("Clicked()","PAMevcontrol", this,"shows4data()"); |
251 |
|
|
if ( !cvar->S4 ) fshows4->SetState(kButtonDisabled); |
252 |
|
|
hframedec[7]->AddFrame(fshows4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
253 |
|
|
// |
254 |
|
|
// ND |
255 |
mocchiut |
1.1 |
// |
256 |
mocchiut |
1.3 |
fchknd = new TGCheckButton(hframedec[8], "Show"); |
257 |
mocchiut |
1.1 |
fchknd->Connect("Clicked()","PAMevcontrol",this,"chknd()"); |
258 |
|
|
if ( cvar->ND ) fchknd->SetState(kButtonDown); |
259 |
mocchiut |
1.3 |
hframedec[8]->AddFrame(fchknd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
260 |
|
|
fshownd = new TGTextButton(hframedec[8], "Show Data"); |
261 |
|
|
fshownd->Connect("Clicked()","PAMevcontrol", this,"shownddata()"); |
262 |
|
|
if ( !cvar->ND ) fshownd->SetState(kButtonDisabled); |
263 |
|
|
hframedec[8]->AddFrame(fshownd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5)); |
264 |
|
|
// |
265 |
|
|
// Software infos |
266 |
|
|
// |
267 |
|
|
fshowsi = new TGTextButton(hframedec[9], "Show Data"); |
268 |
|
|
fshowsi->Connect("Clicked()","PAMevcontrol", this,"showorbdata()"); |
269 |
|
|
if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled); |
270 |
|
|
hframedec[9]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
271 |
mocchiut |
1.1 |
// |
272 |
mocchiut |
1.3 |
// All data |
273 |
|
|
// |
274 |
|
|
fshowall = new TGTextButton(hframedec[10], "Show Data"); |
275 |
|
|
fshowall->Connect("Clicked()","PAMevcontrol", this,"showorbdata()"); |
276 |
|
|
hframedec[10]->AddFrame(fshowall, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5)); |
277 |
|
|
// |
278 |
|
|
// for (Int_t fr=0; fr<11; fr++) gf->AddFrame(hframedec[fr], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,1,1,1)); |
279 |
|
|
// |
280 |
|
|
gf->AddFrame(hframedec[11], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,17,17)); |
281 |
mocchiut |
1.1 |
// |
282 |
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)); |
283 |
|
|
// gf->GetLayoutManager()->SetPadBottom(5); |
284 |
|
|
// gf->MapSubwindows(); |
285 |
mocchiut |
1.1 |
// |
286 |
mocchiut |
1.2 |
fchkinfo = new TGCheckButton(hframe3, "Infos"); |
287 |
mocchiut |
1.1 |
fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()"); |
288 |
|
|
if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); |
289 |
mocchiut |
1.3 |
hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5)); |
290 |
mocchiut |
1.1 |
// |
291 |
mocchiut |
1.2 |
fchknames = new TGCheckButton(hframe3, "Names"); |
292 |
mocchiut |
1.1 |
fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()"); |
293 |
|
|
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); |
294 |
mocchiut |
1.3 |
hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5)); |
295 |
mocchiut |
1.2 |
fchkpalette = new TGCheckButton(hframe3, "Palette"); |
296 |
mocchiut |
1.1 |
fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()"); |
297 |
|
|
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); |
298 |
mocchiut |
1.3 |
hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5)); |
299 |
|
|
gf2->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX)); |
300 |
mocchiut |
1.1 |
// |
301 |
|
|
TGVButtonGroup *group = new TGVButtonGroup(hframe4); |
302 |
|
|
bwc0 = new TGRadioButton(group, "Colour"); |
303 |
|
|
bwc1 = new TGRadioButton(group, "B/W"); |
304 |
|
|
if ( cvar->bw ){ |
305 |
|
|
bwc1->SetState(kButtonDown); |
306 |
|
|
} else { |
307 |
|
|
bwc0->SetState(kButtonDown); |
308 |
|
|
}; |
309 |
|
|
bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()"); |
310 |
|
|
bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()"); |
311 |
mocchiut |
1.3 |
hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,5,5,5)); |
312 |
mocchiut |
1.1 |
// |
313 |
|
|
// |
314 |
|
|
ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND"); |
315 |
|
|
ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()"); |
316 |
|
|
if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
317 |
mocchiut |
1.3 |
hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
318 |
mocchiut |
1.1 |
ffl0 = new TGCheckButton(hframe5, "Force LEVEL0"); |
319 |
|
|
ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()"); |
320 |
|
|
if ( cvar->fl0 ) ffl0->SetState(kButtonDown); |
321 |
|
|
if ( !cvar->fl0 ) ffl0->SetState(kButtonUp); |
322 |
mocchiut |
1.3 |
hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5)); |
323 |
|
|
// |
324 |
|
|
hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5)); |
325 |
|
|
gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX)); |
326 |
mocchiut |
1.1 |
// |
327 |
mocchiut |
1.3 |
cframe1->AddFrame(gf, new TGLayoutHints(kLHintsExpandX,5,5,5,5)); |
328 |
|
|
// cframe1->Resize(280,10); |
329 |
|
|
// cframe1->GetLayoutManager()->SetDefaultHeight(5); |
330 |
|
|
// MapWindow(); |
331 |
mocchiut |
1.1 |
// |
332 |
mocchiut |
1.3 |
cframe5->AddFrame(gf2, new TGLayoutHints(kLHintsExpandX,5,5,5,5)); |
333 |
mocchiut |
1.1 |
// |
334 |
|
|
TGHButtonGroup *jgroup = new TGHButtonGroup(htext4); |
335 |
|
|
jbwc0 = new TGRadioButton(jgroup, "packet "); |
336 |
|
|
jbwc1 = new TGRadioButton(jgroup, "progressive"); |
337 |
|
|
jbwc1->SetState(kButtonDown); |
338 |
|
|
jbwc0->Connect("Pressed()", "PAMevcontrol",this,"radioevent()"); |
339 |
|
|
jbwc1->Connect("Pressed()", "PAMevcontrol",this,"radioprog()"); |
340 |
|
|
htext4->AddFrame(jgroup,new TGLayoutHints(kLHintsExpandX,1,1,0,0)); |
341 |
|
|
// |
342 |
|
|
TGTextEntry *fText3 = new TGTextEntry(htext3, new TGTextBuffer(6),-1); |
343 |
|
|
TGTextButton *Jump = new TGTextButton(htext3,"go"); |
344 |
|
|
Jump->Connect("Clicked()","TGTextEntry",fText3,"ReturnPressed()"); |
345 |
|
|
fText3->Connect("ReturnPressed()", "PAMevcontrol", this,"jumpto()"); |
346 |
|
|
htext3->AddFrame(new TGLabel(htext3, new TGHotString("number")), new TGLayoutHints(kLHintsExpandX,0,0,1,1)); |
347 |
|
|
htext3->AddFrame(fText3, new TGLayoutHints(kLHintsExpandX, 0, 8, 0, 0)); |
348 |
|
|
htext3->AddFrame(Jump, new TGLayoutHints(kLHintsExpandX,0,0,0,0)); |
349 |
|
|
jumpf->AddFrame(htext4, new TGLayoutHints(kLHintsExpandX,0,0,1,1)); // |
350 |
|
|
jumpf->AddFrame(htext3, new TGLayoutHints(kLHintsExpandX,0,0,0,1)); // |
351 |
|
|
// |
352 |
|
|
cframe3->AddFrame(jumpf,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); |
353 |
|
|
// |
354 |
|
|
fText4 = new TGTextEntry(htexts, new TGTextBuffer(18),-1); |
355 |
|
|
TGTextButton *save = new TGTextButton(htextsl,"save"); |
356 |
|
|
save->Connect("Clicked()","TGTextEntry",fText4,"ReturnPressed()"); |
357 |
|
|
fText4->Connect("ReturnPressed()", "PAMevcontrol", this,"saveas()"); |
358 |
|
|
fText4->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); |
359 |
|
|
htexts->AddFrame(fText4, new TGLayoutHints(kLHintsExpandX, 0, 8, 1, 1)); |
360 |
|
|
// |
361 |
|
|
fCombo = new TGComboBox(htexts, 98); |
362 |
|
|
fCombo->AddEntry(".ps", 0); |
363 |
|
|
fCombo->AddEntry(".eps", 1); |
364 |
|
|
fCombo->AddEntry(".gif", 2); |
365 |
|
|
fCombo->AddEntry(".jpg", 3); |
366 |
|
|
fCombo->AddEntry(".tiff", 4); |
367 |
|
|
fCombo->AddEntry(".xpm", 5); |
368 |
|
|
fCombo->AddEntry(".pdf", 6); |
369 |
|
|
fCombo->AddEntry(".xml", 7); |
370 |
|
|
fCombo->AddEntry(".png", 8); |
371 |
|
|
fCombo->AddEntry(".svg", 9); |
372 |
|
|
fCombo->AddEntry(".root", 10); |
373 |
|
|
fCombo->AddEntry(".C", 11); |
374 |
|
|
fCombo->Select(0); |
375 |
|
|
fCombo->Resize(50,23); |
376 |
|
|
// htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsCenterX | kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX, 0, 8, 1, 1)); |
377 |
mocchiut |
1.3 |
htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY| kLHintsRight, 2, 2, 2, 1)); |
378 |
mocchiut |
1.1 |
// |
379 |
|
|
htextsl->AddFrame(save, new TGLayoutHints(kLHintsExpandX,0,0,2,1)); |
380 |
|
|
savef->AddFrame(htexts, new TGLayoutHints(kLHintsExpandX,0,0,2,5)); |
381 |
|
|
// savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,5,2,5,2)); |
382 |
|
|
savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,8,0,5,2)); |
383 |
|
|
// |
384 |
|
|
cframe4->AddFrame(savef,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); |
385 |
|
|
// |
386 |
|
|
fHProg1 = new TGHProgressBar(hfrprog, TGProgressBar::kFancy, 260); |
387 |
|
|
fHProg1->SetBarColor("green"); |
388 |
|
|
fHProg1->ShowPosition(); |
389 |
|
|
hfrprog->AddFrame(fHProg1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX,5,5,5,5)); |
390 |
|
|
// |
391 |
|
|
// |
392 |
|
|
TGTextButton *prev = new TGTextButton(hframe,"< &Back"); |
393 |
|
|
prev->Connect("Clicked()","PAMevcontrol",this,"prev()"); |
394 |
|
|
hframe->AddFrame(prev, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); |
395 |
|
|
// |
396 |
|
|
TGTextButton *exit = new TGTextButton(hframe,"E&xit");//,"gApplication->Terminate(0)"); |
397 |
|
|
exit->Connect("Clicked()","PAMevcontrol",this,"Terminate()"); |
398 |
|
|
exit->SetToolTipText("Quit the event viewer"); |
399 |
|
|
hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); |
400 |
|
|
// |
401 |
|
|
bstop = new TGTextButton(hframe,"&Stop"); |
402 |
|
|
bstop->Connect("Clicked()","PAMevcontrol",this,"stop()"); |
403 |
|
|
hframe->AddFrame(bstop, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); |
404 |
|
|
bstop->SetState(kButtonDisabled); |
405 |
|
|
// |
406 |
|
|
TGTextButton *next = new TGTextButton(hframe,"&Next >"); |
407 |
|
|
next->Connect("Clicked()","PAMevcontrol",this,"next()"); |
408 |
|
|
hframe->AddFrame(next, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); |
409 |
|
|
// |
410 |
|
|
// |
411 |
|
|
// AddFrame(htext, new TGLayoutHints(kLHintsExpandX,2,2,15,1)); |
412 |
|
|
AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
413 |
|
|
AddFrame(cframe1, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
414 |
mocchiut |
1.3 |
AddFrame(cframe5, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
415 |
mocchiut |
1.1 |
AddFrame(cframe3, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
416 |
|
|
AddFrame(cframe4, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
417 |
|
|
AddFrame(hfrprog, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
418 |
mocchiut |
1.3 |
AddFrame(hframe, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); |
419 |
mocchiut |
1.1 |
// Set a name to the main frame |
420 |
|
|
SetWindowName("PAMELA Event Viewer control panel"); |
421 |
|
|
// Map all subwindows of main frame |
422 |
|
|
MapSubwindows(); |
423 |
|
|
// Initialize the layout algorithm |
424 |
|
|
Resize(GetDefaultSize()); |
425 |
|
|
// Map main frame |
426 |
|
|
MapWindow(); |
427 |
mocchiut |
1.3 |
// |
428 |
|
|
gf->HideFrame(hframedec[11]); |
429 |
|
|
for (Int_t fr=0; fr<11; fr++){ |
430 |
|
|
gf->AddFrame(hframedec[fr],new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5)); |
431 |
|
|
gf->HideFrame(hframedec[fr]); |
432 |
|
|
}; |
433 |
|
|
gf->MapSubwindows(); |
434 |
|
|
// |
435 |
mocchiut |
1.1 |
} |
436 |
|
|
|
437 |
|
|
void PAMevcontrol::DIALOG(Int_t ty, TString warn){ |
438 |
|
|
// |
439 |
|
|
// ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR |
440 |
|
|
// |
441 |
|
|
Int_t retval; |
442 |
|
|
TString title; |
443 |
|
|
EMsgBoxIcon mb_icon = kMBIconStop; |
444 |
|
|
if ( ty == 0 ){ |
445 |
|
|
title="INFO"; |
446 |
|
|
mb_icon = kMBIconAsterisk; |
447 |
|
|
}; |
448 |
|
|
if ( ty == 1 ){ |
449 |
|
|
title="WARNING!"; |
450 |
|
|
mb_icon = kMBIconExclamation; |
451 |
|
|
}; |
452 |
|
|
if ( ty == 2 ){ |
453 |
|
|
title="ERROR!!"; |
454 |
|
|
mb_icon = kMBIconStop; |
455 |
|
|
}; |
456 |
|
|
new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); |
457 |
|
|
} |
458 |
|
|
|
459 |
mocchiut |
1.3 |
void PAMevcontrol::refreshdec(Int_t n){ |
460 |
|
|
// |
461 |
|
|
for (Int_t i=0; i<11; i++){ |
462 |
|
|
gf->HideFrame(hframedec[i]); |
463 |
|
|
}; |
464 |
|
|
// |
465 |
|
|
if ( n < 11 ){ |
466 |
|
|
gf->ShowFrame(hframedec[n]); |
467 |
|
|
}; |
468 |
|
|
}; |
469 |
|
|
|
470 |
|
|
|
471 |
|
|
void PAMevcontrol::showorbdata(){ |
472 |
|
|
printf("orb \n"); |
473 |
|
|
}; |
474 |
|
|
|
475 |
|
|
void PAMevcontrol::showtrgdata(){ |
476 |
|
|
printf("trg \n"); |
477 |
|
|
}; |
478 |
|
|
|
479 |
|
|
void PAMevcontrol::showrundata(){ |
480 |
|
|
printf("run \n"); |
481 |
|
|
}; |
482 |
|
|
|
483 |
|
|
void PAMevcontrol::showcaldata(){ |
484 |
|
|
printf("cal \n"); |
485 |
|
|
}; |
486 |
|
|
|
487 |
|
|
void PAMevcontrol::chkcalost(){ |
488 |
|
|
if ( cvar->CALO ) { |
489 |
|
|
cvar->CALO = 0; |
490 |
|
|
} else { |
491 |
|
|
cvar->CALO = 1; |
492 |
|
|
}; |
493 |
|
|
cvar->i--; |
494 |
|
|
cvar->nevents = 0; |
495 |
|
|
cvar->firstevno = 0; |
496 |
|
|
cvar->lastevno = 0; |
497 |
|
|
cvar->refresh = true; |
498 |
|
|
}; |
499 |
|
|
|
500 |
|
|
void PAMevcontrol::showtrkdata(){ |
501 |
|
|
printf("trk \n"); |
502 |
|
|
}; |
503 |
|
|
|
504 |
|
|
void PAMevcontrol::showtofdata(){ |
505 |
|
|
printf("tof \n"); |
506 |
|
|
}; |
507 |
|
|
|
508 |
|
|
void PAMevcontrol::showacdata(){ |
509 |
|
|
printf("ac \n"); |
510 |
|
|
}; |
511 |
|
|
|
512 |
|
|
void PAMevcontrol::shownddata(){ |
513 |
|
|
printf("nd \n"); |
514 |
|
|
}; |
515 |
|
|
|
516 |
|
|
void PAMevcontrol::shows4data(){ |
517 |
|
|
printf("s4 \n"); |
518 |
|
|
}; |
519 |
|
|
|
520 |
|
|
void PAMevcontrol::showsidata(){ |
521 |
|
|
printf("si \n"); |
522 |
|
|
}; |
523 |
|
|
|
524 |
|
|
void PAMevcontrol::showalldata(){ |
525 |
|
|
printf("all \n"); |
526 |
|
|
}; |
527 |
mocchiut |
1.1 |
|
528 |
|
|
void PAMevcontrol::SetFilename() { |
529 |
|
|
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
530 |
|
|
TString text = entry->GetText(); |
531 |
|
|
cvar->thefilename=text.Data(); |
532 |
|
|
cvar->nevents = 0; |
533 |
|
|
cvar->firstevno = 0; |
534 |
|
|
cvar->lastevno = 0; |
535 |
|
|
if ( cvar->fl0 ) { |
536 |
|
|
cvar->fl0 = false; |
537 |
|
|
ffl0->SetState(kButtonUp); |
538 |
|
|
}; |
539 |
|
|
cvar->restart = true; |
540 |
|
|
cvar->waitforever = false; |
541 |
|
|
} |
542 |
|
|
|
543 |
|
|
void PAMevcontrol::CheckLevel() { |
544 |
|
|
if ( clev->file == 2 ){ |
545 |
|
|
ffl0->SetState(kButtonDisabled); |
546 |
|
|
if ( !cvar->tracknds4 ) { |
547 |
|
|
ftrks4->SetState(kButtonUp); |
548 |
|
|
} else { |
549 |
|
|
ftrks4->SetState(kButtonDown); |
550 |
|
|
}; |
551 |
|
|
} else { |
552 |
|
|
ftrks4->SetState(kButtonDisabled); |
553 |
|
|
if ( !cvar->fl0 ) { |
554 |
|
|
ffl0->SetState(kButtonUp); |
555 |
|
|
} else { |
556 |
|
|
ffl0->SetState(kButtonDown); |
557 |
|
|
}; |
558 |
|
|
}; |
559 |
|
|
} |
560 |
|
|
|
561 |
|
|
void PAMevcontrol::SetSearching() { |
562 |
|
|
bstop->SetState(kButtonUp); |
563 |
|
|
}; |
564 |
|
|
|
565 |
|
|
void PAMevcontrol::StopSearching() { |
566 |
|
|
bstop->SetState(kButtonDisabled); |
567 |
|
|
}; |
568 |
|
|
|
569 |
mocchiut |
1.2 |
void PAMevcontrol::RefreshButtons() { |
570 |
|
|
if ( cvar->jumprog ){ |
571 |
|
|
jbwc1->SetState(kButtonDown); |
572 |
|
|
} else { |
573 |
|
|
jbwc0->SetState(kButtonDown); |
574 |
|
|
}; |
575 |
|
|
if ( cvar->fl0 ){ |
576 |
|
|
ffl0->SetState(kButtonDown); |
577 |
|
|
} else { |
578 |
|
|
ffl0->SetState(kButtonUp); |
579 |
|
|
}; |
580 |
|
|
if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); |
581 |
|
|
if ( cvar->bw ){ |
582 |
|
|
bwc1->SetState(kButtonDown); |
583 |
|
|
} else { |
584 |
|
|
bwc0->SetState(kButtonDown); |
585 |
|
|
}; |
586 |
|
|
if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp); |
587 |
|
|
if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp); |
588 |
|
|
if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp); |
589 |
|
|
if ( cvar->CALO ) fchkcalo->SetState(kButtonDown); else fchkcalo->SetState(kButtonUp); |
590 |
mocchiut |
1.3 |
if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp); |
591 |
mocchiut |
1.2 |
if ( cvar->ND ) fchknd->SetState(kButtonDown); else fchknd->SetState(kButtonUp); |
592 |
|
|
if ( cvar->S4 ) fchks4->SetState(kButtonDown); else fchks4->SetState(kButtonUp); |
593 |
|
|
if ( cvar->TRK ) fchktrk->SetState(kButtonDown); else fchktrk->SetState(kButtonUp); |
594 |
|
|
if ( cvar->AC ) fchkac->SetState(kButtonDown); else fchkac->SetState(kButtonUp); |
595 |
|
|
if ( cvar->TOF ) fchktof->SetState(kButtonDown); else fchktof->SetState(kButtonUp); |
596 |
|
|
}; |
597 |
|
|
|
598 |
mocchiut |
1.1 |
void PAMevcontrol::SetFilter() { |
599 |
|
|
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
600 |
|
|
TString text = entry->GetText(); |
601 |
|
|
cvar->thefilter=text.Data(); |
602 |
|
|
cvar->i--; |
603 |
|
|
cvar->selex = true; |
604 |
|
|
cvar->nevents = 0; |
605 |
|
|
cvar->firstevno = 0; |
606 |
|
|
cvar->lastevno = 0; |
607 |
|
|
cvar->refresh = true; |
608 |
|
|
} |
609 |
|
|
|
610 |
|
|
void PAMevcontrol::CompleteText() { |
611 |
|
|
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
612 |
|
|
TString text = entry->GetText(); |
613 |
|
|
Int_t curspos = entry->GetCursorPosition(); |
614 |
|
|
Int_t ncurspos = 0; |
615 |
|
|
TString textrem; |
616 |
|
|
stringcopy(textrem,text,curspos,text.Length()); |
617 |
|
|
text.Resize(curspos); |
618 |
|
|
if ( !strcmp(text.Data(),"") ) { |
619 |
|
|
stringstream ntext; |
620 |
|
|
ntext.str(""); |
621 |
|
|
ntext << gSystem->ExpandPathName("$HOME"); |
622 |
|
|
text = ntext.str().c_str(); |
623 |
|
|
curspos=ntext.str().length(); |
624 |
|
|
}; |
625 |
|
|
char *test = gSystem->ExpandPathName(text.Data()); |
626 |
|
|
const char *dir = gSystem->DirName(test); |
627 |
|
|
const char *base = gSystem->BaseName(test); |
628 |
|
|
TString lbase = base; |
629 |
|
|
Int_t lenbase = lbase.Length(); |
630 |
|
|
TSystemDirectory *tsd = new TSystemDirectory("",dir); |
631 |
|
|
TSystemFile *file; |
632 |
|
|
TList *lsmatch = new TList; |
633 |
|
|
Int_t numf = 0; |
634 |
|
|
Int_t numgo = 0; |
635 |
|
|
Int_t charmac = 0; |
636 |
|
|
TString tbase; |
637 |
|
|
Int_t k = 0; |
638 |
|
|
stringstream newtext; |
639 |
|
|
TSystemFile *mfile; |
640 |
|
|
TSystemFile nfile; |
641 |
|
|
TList *lsf = new TList; |
642 |
|
|
const char *ctbase; |
643 |
|
|
if ( !tsd->GetListOfFiles() ){ |
644 |
|
|
gVirtualX->Bell(0); |
645 |
|
|
goto end; |
646 |
|
|
}; |
647 |
|
|
lsf = tsd->GetListOfFiles(); |
648 |
|
|
file = (TSystemFile*)lsf->First(); |
649 |
|
|
// |
650 |
|
|
while( (TSystemFile*)lsf->After(file) ){ |
651 |
|
|
numf++; |
652 |
|
|
file = (TSystemFile*)lsf->After(file); |
653 |
|
|
if ( !strncmp(file->GetName(),base,lenbase) ){ |
654 |
|
|
numgo++; |
655 |
|
|
lsmatch->AddLast(file); |
656 |
|
|
const char *ctbase = file->GetName(); |
657 |
|
|
tbase = ctbase; |
658 |
|
|
charmac = tbase.Length(); |
659 |
|
|
}; |
660 |
|
|
}; |
661 |
|
|
newtext.str(""); |
662 |
|
|
if ( numgo > 0 ){ |
663 |
|
|
mfile = (TSystemFile*)lsmatch->First(); |
664 |
|
|
ctbase = mfile->GetName(); |
665 |
|
|
while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) { |
666 |
|
|
mfile = (TSystemFile*)lsmatch->After(mfile); |
667 |
|
|
ctbase = mfile->GetName(); |
668 |
|
|
}; |
669 |
|
|
tbase = ctbase; |
670 |
|
|
base = ctbase; |
671 |
|
|
charmac = tbase.Length();; |
672 |
|
|
while( (TSystemFile*)lsmatch->After(mfile) ){ |
673 |
|
|
mfile = (TSystemFile*)lsmatch->After(mfile); |
674 |
|
|
ctbase = mfile->GetName(); |
675 |
|
|
while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) { |
676 |
|
|
mfile = (TSystemFile*)lsmatch->After(mfile); |
677 |
|
|
ctbase = mfile->GetName(); |
678 |
|
|
}; |
679 |
|
|
tbase = ctbase; |
680 |
|
|
k = 0; |
681 |
|
|
for ( Int_t i=lenbase; i<=tbase.Length(); i++){ |
682 |
|
|
if ( !strncmp(tbase.Data(),base,i) && strcmp(tbase.Data(),base) ){ |
683 |
|
|
k = i; |
684 |
|
|
}; |
685 |
|
|
}; |
686 |
|
|
if ( k <= charmac){ |
687 |
|
|
charmac = k; |
688 |
|
|
}; |
689 |
|
|
}; |
690 |
|
|
gVirtualX->Bell(0); |
691 |
|
|
}; |
692 |
|
|
if ( !charmac ) { |
693 |
|
|
gVirtualX->Bell(0); |
694 |
|
|
goto end; |
695 |
|
|
}; |
696 |
|
|
tbase.Resize(charmac); |
697 |
|
|
if ( !strcmp(dir,"") || !strcmp(dir,"/") ){ |
698 |
|
|
newtext << "/" << tbase.Data(); |
699 |
|
|
} else { |
700 |
|
|
newtext << dir << "/" << tbase.Data(); |
701 |
|
|
}; |
702 |
|
|
nfile = TSystemFile(tbase.Data(),dir); |
703 |
|
|
if ( nfile.IsDirectory() && numgo == 1 ) newtext << "/"; |
704 |
|
|
ncurspos = newtext.str().length(); |
705 |
|
|
if ( textrem.Length() ) newtext << textrem.Data(); |
706 |
|
|
entry->SetText(newtext.str().c_str()); |
707 |
|
|
entry->SetCursorPosition(ncurspos); |
708 |
|
|
end: |
709 |
|
|
lsf->Clear(); |
710 |
|
|
lsmatch->Clear(); |
711 |
|
|
} |
712 |
|
|
|
713 |
|
|
void PAMevcontrol::saveas() { |
714 |
|
|
TString text = fText4->GetText(); |
715 |
|
|
Int_t sel=fCombo->GetSelected(); |
716 |
|
|
TString ty; |
717 |
|
|
switch (sel){ |
718 |
|
|
case (0): |
719 |
|
|
ty = ".ps"; |
720 |
|
|
break; |
721 |
|
|
case (1): |
722 |
|
|
ty = ".eps"; |
723 |
|
|
break; |
724 |
|
|
case (2): |
725 |
|
|
ty = ".gif"; |
726 |
|
|
break; |
727 |
|
|
case (3): |
728 |
|
|
ty = ".jpg"; |
729 |
|
|
break; |
730 |
|
|
case (4): |
731 |
|
|
ty = ".tiff"; |
732 |
|
|
break; |
733 |
|
|
case (5): |
734 |
|
|
ty = ".xpm"; |
735 |
|
|
break; |
736 |
|
|
case (6): |
737 |
|
|
ty = ".pdf"; |
738 |
|
|
break; |
739 |
|
|
case (7): |
740 |
|
|
ty = ".xml"; |
741 |
|
|
break; |
742 |
|
|
case (8): |
743 |
|
|
ty = ".png"; |
744 |
|
|
break; |
745 |
|
|
case (9): |
746 |
|
|
ty = ".svg"; |
747 |
|
|
break; |
748 |
|
|
case (10): |
749 |
|
|
ty = ".root"; |
750 |
|
|
break; |
751 |
|
|
case (11): |
752 |
|
|
ty = ".C"; |
753 |
|
|
break; |
754 |
|
|
}; |
755 |
|
|
if ( sel == 0 ) ty = ".ps"; |
756 |
|
|
stringstream name; |
757 |
|
|
if ( strcmp(text.Data(),"") ){ |
758 |
|
|
name.str(""); |
759 |
|
|
name << text.Data(); |
760 |
|
|
name << ty.Data(); |
761 |
|
|
thefigure->SaveAs(name.str().c_str()); |
762 |
|
|
name.str(""); |
763 |
|
|
name << " Saved as "; |
764 |
|
|
name << text.Data(); |
765 |
|
|
name << ty.Data(); |
766 |
|
|
DIALOG(0,name.str().c_str()); |
767 |
|
|
printf(" Saved as %s%s \n",text.Data(),ty.Data()); |
768 |
|
|
}; |
769 |
|
|
} |
770 |
|
|
|
771 |
|
|
void PAMevcontrol::increment(float val) { |
772 |
|
|
fHProg1->Reset(); |
773 |
|
|
fHProg1->SetPosition(val); |
774 |
|
|
gSystem->ProcessEvents(); |
775 |
|
|
} |
776 |
|
|
|
777 |
|
|
void PAMevcontrol::forcel0() { |
778 |
|
|
if ( cvar->fl0 ) { |
779 |
|
|
cvar->fl0 = false; |
780 |
|
|
} else { |
781 |
|
|
cvar->fl0 = true; |
782 |
|
|
}; |
783 |
|
|
cvar->alrforc = false; |
784 |
|
|
cvar->i--; |
785 |
|
|
cvar->nevents = 0; |
786 |
|
|
cvar->firstevno = 0; |
787 |
|
|
cvar->lastevno = 0; |
788 |
|
|
cvar->refresh = true; |
789 |
|
|
} |
790 |
|
|
|
791 |
|
|
void PAMevcontrol::clearselfi(){ |
792 |
|
|
fText2->SetText(""); |
793 |
|
|
} |
794 |
|
|
|
795 |
|
|
void PAMevcontrol::upgrnamfi(){ |
796 |
|
|
fText4->SetText(cvar->svas.Data()); |
797 |
|
|
fText4->SetCursorPosition(fText4->GetMaxLength()); |
798 |
|
|
} |
799 |
|
|
|
800 |
|
|
void PAMevcontrol::jumpto() { |
801 |
|
|
TGTextEntry *entry = (TGTextEntry*)gTQSender; |
802 |
|
|
TString text = entry->GetText(); |
803 |
|
|
Int_t j; |
804 |
|
|
j = atoi(text.Data()); |
805 |
|
|
if ( cvar->jumprog ){ |
806 |
|
|
if ( j < 1 || j > cvar->nevents ) { |
807 |
|
|
printf("\n You can choose between 1 and %i \n",(int)cvar->nevents); |
808 |
|
|
stringstream warning; |
809 |
|
|
warning.str(""); |
810 |
|
|
warning << "You can choose between 1 and "; |
811 |
|
|
warning << (int)cvar->nevents; |
812 |
|
|
DIALOG(1,warning.str().c_str()); |
813 |
|
|
} else { |
814 |
|
|
stringstream warning; |
815 |
|
|
// warning.str(""); |
816 |
|
|
// warning << "Jumping to progressive number "; |
817 |
|
|
// warning << j; |
818 |
|
|
// DIALOG(0,warning.str().c_str()); |
819 |
|
|
printf("\n Jumping to progressive number %i\n\n",j); |
820 |
|
|
cvar->i = j-2; |
821 |
|
|
cvar->goon = true; |
822 |
|
|
SetSearching(); |
823 |
|
|
}; |
824 |
|
|
} else { |
825 |
|
|
if ( j < cvar->firstevno || j > cvar->lastevno ) { |
826 |
|
|
printf("\n You can choose between %i and %i \n",cvar->firstevno,cvar->lastevno); |
827 |
|
|
stringstream warning; |
828 |
|
|
warning.str(""); |
829 |
|
|
warning << "You can choose between "; |
830 |
|
|
warning << cvar->firstevno; |
831 |
|
|
warning << " and "; |
832 |
|
|
warning << cvar->lastevno; |
833 |
|
|
DIALOG(1,warning.str().c_str()); |
834 |
|
|
} else { |
835 |
|
|
// stringstream warning; |
836 |
|
|
// warning.str(""); |
837 |
|
|
// warning << "Jumping to event number "; |
838 |
|
|
// warning << j; |
839 |
|
|
// DIALOG(0,warning.str().c_str()); |
840 |
|
|
printf("\n Jumping to packet number %i\n\n",j); |
841 |
|
|
cvar->jumpto = j; |
842 |
|
|
cvar->jumpen = true; |
843 |
|
|
cvar->goon = true; |
844 |
|
|
SetSearching(); |
845 |
|
|
}; |
846 |
|
|
}; |
847 |
|
|
entry->SetText(""); |
848 |
|
|
} |
849 |
|
|
|
850 |
|
|
void PAMevcontrol::radioevent() { |
851 |
|
|
cvar->jumprog = false; |
852 |
|
|
} |
853 |
|
|
|
854 |
|
|
void PAMevcontrol::radioprog() { |
855 |
|
|
cvar->jumprog = true; |
856 |
|
|
} |
857 |
|
|
|
858 |
|
|
void PAMevcontrol::radiocolor() { |
859 |
|
|
if ( !cvar->goon ){ |
860 |
|
|
if ( cvar->bw ) { |
861 |
|
|
cvar->bw = 0; |
862 |
|
|
cvar->i--; |
863 |
|
|
cvar->goon = true; |
864 |
|
|
}; |
865 |
|
|
}; |
866 |
|
|
} |
867 |
|
|
|
868 |
|
|
void PAMevcontrol::radiobw() { |
869 |
|
|
if ( !cvar->goon ){ |
870 |
|
|
if ( !cvar->bw ) { |
871 |
|
|
cvar->bw = 1; |
872 |
|
|
cvar->i--; |
873 |
|
|
cvar->goon = true; |
874 |
|
|
}; |
875 |
|
|
}; |
876 |
|
|
} |
877 |
|
|
|
878 |
|
|
void PAMevcontrol::radiotrack() { |
879 |
|
|
if ( cvar->tracknds4 ) { |
880 |
|
|
cvar->tracknds4 = 0; |
881 |
|
|
} else { |
882 |
|
|
cvar->tracknds4 = 1; |
883 |
|
|
}; |
884 |
|
|
cvar->i--; |
885 |
|
|
cvar->goon = true; |
886 |
|
|
} |
887 |
|
|
|
888 |
|
|
void PAMevcontrol::chktof() { |
889 |
|
|
if ( cvar->TOF ) { |
890 |
|
|
cvar->TOF = 0; |
891 |
|
|
} else { |
892 |
|
|
cvar->TOF = 1; |
893 |
|
|
}; |
894 |
|
|
cvar->i--; |
895 |
|
|
cvar->nevents = 0; |
896 |
|
|
cvar->firstevno = 0; |
897 |
|
|
cvar->lastevno = 0; |
898 |
|
|
cvar->refresh = true; |
899 |
|
|
} |
900 |
|
|
|
901 |
|
|
void PAMevcontrol::chkac() { |
902 |
|
|
if ( cvar->AC ) { |
903 |
|
|
cvar->AC = 0; |
904 |
|
|
} else { |
905 |
|
|
cvar->AC = 1; |
906 |
|
|
}; |
907 |
|
|
cvar->i--; |
908 |
|
|
cvar->nevents = 0; |
909 |
|
|
cvar->firstevno = 0; |
910 |
|
|
cvar->lastevno = 0; |
911 |
|
|
cvar->refresh = true; |
912 |
|
|
} |
913 |
|
|
|
914 |
|
|
void PAMevcontrol::chktrk() { |
915 |
|
|
if ( cvar->TRK ) { |
916 |
|
|
cvar->TRK = 0; |
917 |
|
|
} else { |
918 |
|
|
cvar->TRK = 1; |
919 |
|
|
}; |
920 |
|
|
cvar->i--; |
921 |
|
|
cvar->nevents = 0; |
922 |
|
|
cvar->firstevno = 0; |
923 |
|
|
cvar->lastevno = 0; |
924 |
|
|
cvar->refresh = true; |
925 |
|
|
} |
926 |
|
|
|
927 |
|
|
void PAMevcontrol::chkcalo() { |
928 |
|
|
if ( cvar->CALO ) { |
929 |
|
|
cvar->CALO = 0; |
930 |
|
|
} else { |
931 |
|
|
cvar->CALO = 1; |
932 |
|
|
}; |
933 |
|
|
cvar->i--; |
934 |
|
|
cvar->nevents = 0; |
935 |
|
|
cvar->firstevno = 0; |
936 |
|
|
cvar->lastevno = 0; |
937 |
|
|
cvar->refresh = true; |
938 |
|
|
} |
939 |
|
|
|
940 |
|
|
void PAMevcontrol::chks4() { |
941 |
|
|
if ( cvar->S4 ) { |
942 |
|
|
cvar->S4 = 0; |
943 |
|
|
} else { |
944 |
|
|
cvar->S4 = 1; |
945 |
|
|
}; |
946 |
|
|
cvar->i--; |
947 |
|
|
cvar->nevents = 0; |
948 |
|
|
cvar->firstevno = 0; |
949 |
|
|
cvar->lastevno = 0; |
950 |
|
|
cvar->refresh = true; |
951 |
|
|
} |
952 |
|
|
|
953 |
|
|
void PAMevcontrol::chknd() { |
954 |
|
|
if ( cvar->ND ) { |
955 |
|
|
cvar->ND = 0; |
956 |
|
|
} else { |
957 |
|
|
cvar->ND = 1; |
958 |
|
|
}; |
959 |
|
|
cvar->i--; |
960 |
|
|
cvar->nevents = 0; |
961 |
|
|
cvar->firstevno = 0; |
962 |
|
|
cvar->lastevno = 0; |
963 |
|
|
cvar->refresh = true; |
964 |
|
|
} |
965 |
|
|
|
966 |
|
|
void PAMevcontrol::chkinfo() { |
967 |
|
|
if ( cvar->INFOS ) { |
968 |
|
|
cvar->INFOS = 0; |
969 |
|
|
} else { |
970 |
|
|
cvar->INFOS = 1; |
971 |
|
|
}; |
972 |
|
|
cvar->i--; |
973 |
|
|
cvar->goon = true; |
974 |
|
|
} |
975 |
|
|
|
976 |
|
|
void PAMevcontrol::chknames() { |
977 |
|
|
if ( cvar->VINFOS ) { |
978 |
|
|
cvar->VINFOS = 0; |
979 |
|
|
} else { |
980 |
|
|
cvar->VINFOS = 1; |
981 |
|
|
}; |
982 |
|
|
cvar->i--; |
983 |
|
|
cvar->goon = true; |
984 |
|
|
} |
985 |
|
|
|
986 |
|
|
void PAMevcontrol::chkpalette() { |
987 |
|
|
if ( cvar->PALETTE ) { |
988 |
|
|
cvar->PALETTE = 0; |
989 |
|
|
} else { |
990 |
|
|
cvar->PALETTE = 1; |
991 |
|
|
}; |
992 |
|
|
cvar->i--; |
993 |
|
|
cvar->goon = true; |
994 |
|
|
} |
995 |
|
|
|
996 |
|
|
void PAMevcontrol::next() { |
997 |
|
|
SetSearching(); |
998 |
|
|
if ( cvar->i == cvar->nevents-1 ) { |
999 |
|
|
printf("This is the last event, you can't go forward! \n"); |
1000 |
|
|
DIALOG(1,"This is the last event!"); |
1001 |
|
|
} else { |
1002 |
|
|
cvar->goon = true; |
1003 |
|
|
cvar->doflag = 1; |
1004 |
|
|
}; |
1005 |
|
|
} |
1006 |
|
|
|
1007 |
|
|
void PAMevcontrol::stop() { |
1008 |
|
|
DIALOG(1,"Stop searching"); |
1009 |
|
|
cvar->doflag = 3; |
1010 |
|
|
} |
1011 |
|
|
|
1012 |
|
|
void PAMevcontrol::prev() { |
1013 |
|
|
SetSearching(); |
1014 |
|
|
if ( cvar->i > 0 ) { |
1015 |
|
|
printf("WARNING: going backward!\n\n"); |
1016 |
|
|
cvar->doflag = 2; |
1017 |
|
|
cvar->goon = true; |
1018 |
|
|
} else { |
1019 |
|
|
printf("This is the first event, you can't go backward! \n"); |
1020 |
|
|
DIALOG(1,"This is the first event!"); |
1021 |
|
|
}; |
1022 |
|
|
} |
1023 |
|
|
|
1024 |
|
|
void PAMevcontrol::Terminate() { |
1025 |
|
|
gSystem->ProcessEvents(); |
1026 |
|
|
gApplication->Terminate(0); |
1027 |
|
|
} |
1028 |
|
|
|
1029 |
|
|
PAMevcontrol::~PAMevcontrol() { |
1030 |
|
|
// Clean up used widgets: frames, buttons, layouthints |
1031 |
|
|
Cleanup(); |
1032 |
|
|
delete this; |
1033 |
|
|
} |