Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 326 | f9daq | 1 | // You can try to increase the font size in $(ROOTSYS)/etc/system.rootrc or in your own custom ~/.rootrc | 
        
| 2 | #include <TApplication.h> | 
        ||
| 3 | #include <TGClient.h> | 
        ||
| 4 | #include <TCanvas.h> | 
        ||
| 5 | #include <TF1.h> | 
        ||
| 6 | #include <TRandom.h> | 
        ||
| 7 | #include <TGButton.h> | 
        ||
| 8 | #include <TRootEmbeddedCanvas.h> | 
        ||
| 9 | #include <TGSimpleTableInterface.h> | 
        ||
| 10 | #include <TGTable.h> | 
        ||
| 11 | #include <TGLabel.h> | 
        ||
| 12 | #include <TGFrame.h> | 
        ||
| 13 | #include <TGNumberEntry.h> | 
        ||
| 14 | #include <TGLayout.h> | 
        ||
| 15 | #include <TGStatusBar.h> | 
        ||
| 16 | #include <TGTableLayout.h> | 
        ||
| 17 | #include <TGTextEntry.h> | 
        ||
| 18 | #include <TGComboBox.h> | 
        ||
| 19 | #include <TGButton.h> | 
        ||
| 20 | #include <TGTab.h> | 
        ||
| 21 | #include <TTimer.h> | 
        ||
| 22 | #include <TColor.h> | 
        ||
| 23 | #include <TH2F.h> | 
        ||
| 24 | #include <TFile.h> | 
        ||
| 25 | #include <TStyle.h> | 
        ||
| 26 | |||
| 27 | #include "Feb_Gui.h" | 
        ||
| 28 | #include <stdint.h> | 
        ||
| 29 | #include "dataio.h" | 
        ||
| 30 | #include "sa02lib.h" | 
        ||
| 31 | |||
| 32 | #include <sys/time.h> | 
        ||
| 33 | #include <sys/stat.h> | 
        ||
| 34 | #include <signal.h> | 
        ||
| 35 | |||
| 36 | |||
| 37 | #define TRUE 1 | 
        ||
| 38 | #define FALSE 0 | 
        ||
| 39 | #define TIMEOUT 3 | 
        ||
| 40 | int timer_out;  | 
        ||
| 41 | struct sigaction oact;  | 
        ||
| 42 | |||
| 43 | |||
| 44 | int ctrl_c=0;  | 
        ||
| 45 | |||
| 46 | void | 
        ||
| 47 | set_plot_style()  | 
        ||
| 48 | { | 
        ||
| 49 | const Int_t NRGBs = 5;  | 
        ||
| 50 | const Int_t NCont = 255;  | 
        ||
| 51 | |||
| 52 | Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };  | 
        ||
| 53 | Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };  | 
        ||
| 54 | Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };  | 
        ||
| 55 | Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };  | 
        ||
| 56 | TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);  | 
        ||
| 57 | gStyle->SetNumberContours(NCont);  | 
        ||
| 58 | } | 
        ||
| 59 | |||
| 60 | void sa02Timerast (int signumber)  | 
        ||
| 61 | { | 
        ||
| 62 | timer_out = TRUE;  | 
        ||
| 63 | sa02TimerOut = TRUE;  | 
        ||
| 64 | sa02Printf("->>> TIMEOUT !!!\n");  | 
        ||
| 65 | ctrl_c = 1;  | 
        ||
| 66 | |||
| 67 | } | 
        ||
| 68 | |||
| 69 | |||
| 70 | void tmlnk (int tout)  | 
        ||
| 71 | { | 
        ||
| 72 | timer_out = FALSE;  | 
        ||
| 73 | struct sigaction act;  | 
        ||
| 74 | struct itimerval tdelay;  | 
        ||
| 75 | |||
| 76 | act.sa_handler = sa02Timerast;  | 
        ||
| 77 | sigemptyset (&act.sa_mask);  | 
        ||
| 78 | act.sa_flags = 0;  | 
        ||
| 79 | |||
| 80 | tdelay.it_value.tv_sec = tout / 100;  | 
        ||
| 81 | tdelay.it_value.tv_usec = 10000 * (tout % 100);  | 
        ||
| 82 | tdelay.it_interval.tv_sec = 0;  | 
        ||
| 83 | tdelay.it_interval.tv_usec = 0;  | 
        ||
| 84 | |||
| 85 | if (sigaction (SIGALRM, &act, &oact) < 0)  | 
        ||
| 86 |     { | 
        ||
| 87 | perror ("sigaction(tmlnk)");  | 
        ||
| 88 | exit (EXIT_FAILURE);  | 
        ||
| 89 |     } | 
        ||
| 90 | if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)  | 
        ||
| 91 |     { | 
        ||
| 92 | perror ("setitimer(tmlnk)");  | 
        ||
| 93 | exit (EXIT_FAILURE);  | 
        ||
| 94 |     } | 
        ||
| 95 | } | 
        ||
| 96 | |||
| 97 | void tmulk ()  | 
        ||
| 98 | { | 
        ||
| 99 | struct itimerval tdelay;  | 
        ||
| 100 | |||
| 101 | tdelay.it_value.tv_sec = 0;  | 
        ||
| 102 | tdelay.it_value.tv_usec = 0;  | 
        ||
| 103 | tdelay.it_interval.tv_sec = 0;  | 
        ||
| 104 | tdelay.it_interval.tv_usec = 0;  | 
        ||
| 105 | |||
| 106 | if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)  | 
        ||
| 107 |     { | 
        ||
| 108 | perror ("setitimer(tmulk)");  | 
        ||
| 109 | exit (EXIT_FAILURE);  | 
        ||
| 110 |     } | 
        ||
| 111 | if (sigaction (SIGALRM, &oact, NULL) < 0)  | 
        ||
| 112 |     { | 
        ||
| 113 | perror ("sigaction(tmulk)");  | 
        ||
| 114 | exit (EXIT_FAILURE);  | 
        ||
| 115 |     } | 
        ||
| 116 | } | 
        ||
| 117 | |||
| 118 | |||
| 119 | int GetTime(char *x)  | 
        ||
| 120 | { | 
        ||
| 121 |     time_t rawtime; | 
        ||
| 122 | struct tm * timeinfo;  | 
        ||
| 123 | time ( &rawtime );  | 
        ||
| 124 | timeinfo = localtime ( &rawtime );  | 
        ||
| 125 | sprintf(x,"%s",asctime (timeinfo));  | 
        ||
| 126 | int len=strlen(x);  | 
        ||
| 127 | if (len) x[len-1]=0;  | 
        ||
| 128 | return 0;  | 
        ||
| 129 | } | 
        ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | void sa02Tmlnk (int tout)  | 
        ||
| 135 | { | 
        ||
| 136 | sa02TimerOut = FALSE;  | 
        ||
| 137 | tmlnk (tout);  | 
        ||
| 138 |     //  ResetTimer (p1h, P1_DAQ_TIMEOUT); | 
        ||
| 139 | } | 
        ||
| 140 | |||
| 141 | void sa02Tmulk ()  | 
        ||
| 142 | { | 
        ||
| 143 | tmulk();  | 
        ||
| 144 | } | 
        ||
| 145 | |||
| 146 | |||
| 147 | void FebMainFrame::GuiTimer()  | 
        ||
| 148 | { | 
        ||
| 149 | char cmd[100];  | 
        ||
| 150 | GetTime(cmd);  | 
        ||
| 151 | fStatusBar->SetText(cmd,0);  | 
        ||
| 152 |     /* Canvas ni thread safe | 
        ||
| 153 |     if (gCanvas){ | 
        ||
| 154 |        gCanvas->GetCanvas()->Modified(); | 
        ||
| 155 |        gCanvas->GetCanvas()->Update(); | 
        ||
| 156 |     } | 
        ||
| 157 |     */ | 
        ||
| 158 | } | 
        ||
| 159 | |||
| 160 | |||
| 161 | |||
| 162 | int FebMainFrame::FillHistogram(float y, unsigned int *rdata)  | 
        ||
| 163 | { | 
        ||
| 164 | |||
| 165 | |||
| 166 | for (int ich=0; ich<144*4; ich++){  | 
        ||
| 167 | int xch = (143 - ich%144) + ich/144*144;  | 
        ||
| 168 |           //fHisto->Fill(xch,y,rdata[2+ich]); | 
        ||
| 169 | fHisto->Fill(xch,y,ich%144);  | 
        ||
| 170 |     } | 
        ||
| 171 | |||
| 172 | return 0;  | 
        ||
| 173 | } | 
        ||
| 174 | |||
| 175 | //---------------------------------------------------- | 
        ||
| 176 | |||
| 177 | void FebMainFrame::StartDaq(int mode)  | 
        ||
| 178 | { | 
        ||
| 179 | |||
| 180 | int daqmode =(fDaqMode)? (int ) fDaqMode->GetSelected(): 0;  | 
        ||
| 181 | const char *sdaqmode= (fDaqMode)? fDaqMode->GetSelectedEntry()->GetTitle(): NULL;  | 
        ||
| 182 | |||
| 183 | int tpenb = fTpEnb->IsOn();  | 
        ||
| 184 | unsigned int addr= (fAddress)? fAddress->GetNumber() : 0;  | 
        ||
| 185 | sa02BoardType= (fBoardType)? fBoardType->GetNumber() : 0;  | 
        ||
| 186 | unsigned int boardnumber= (fBoardNumber)? fBoardNumber->GetNumber(): 0;  | 
        ||
| 187 | int sa02BoardMask = (1<< boardnumber);  | 
        ||
| 188 | const char * fname = (fFilename)? fFilename->GetText(): NULL;  | 
        ||
| 189 | unsigned int neve= (fNeve)? fNeve->GetNumber(): 0;  | 
        ||
| 190 | unsigned int nx = (fNx)? fNx->GetNumber(): 0;  | 
        ||
| 191 | unsigned int x0 = (fX0)? fX0->GetNumber(): 0;  | 
        ||
| 192 | unsigned int dx = (fDx)? fDx->GetNumber(): 0;  | 
        ||
| 193 | unsigned int chip = (fAsicChip)? fAsicChip->GetNumber(): 0;  | 
        ||
| 194 | unsigned int channel= (fAsicChannel)? fAsicChannel->GetNumber(): 0;  | 
        ||
| 195 | |||
| 196 | unsigned int trgtype = (fTriggerType)? (int ) fTriggerType->GetSelected(): 0;  | 
        ||
| 197 | unsigned int trglen = (fTrgLen)? fTrgLen->GetNumber(): 0;  | 
        ||
| 198 | unsigned int data = (fData)? fData->GetNumber(): 0;  | 
        ||
| 199 | unsigned int offset = (fOffset)? fOffset->GetNumber(): 0;  | 
        ||
| 200 | |||
| 201 | |||
| 202 | TGTextLBEntry *fp = (fFPGACmd)? (TGTextLBEntry *)fFPGACmd->GetSelectedEntry(): NULL;  | 
        ||
| 203 | const char *cmd= (fp)? fp->GetTitle(): NULL;  | 
        ||
| 204 | |||
| 205 | int icmd = (strlen(cmd))?sa02GetCmdCode((char *) cmd) : 0;  | 
        ||
| 206 | TGTextLBEntry *febout = (fFEBOut1)? (TGTextLBEntry *)fFEBOut1->GetSelectedEntry(): NULL;  | 
        ||
| 207 | const char *sfebout= (febout)? febout->GetTitle(): NULL;  | 
        ||
| 208 | int sindex = (fFEBOut1)? (int ) fFEBOut1->GetSelected(): 0;  | 
        ||
| 209 |     sindex--; | 
        ||
| 210 | int vmeinterface= (fVmeInterface)? (int ) fVmeInterface->GetSelected(): 0;  | 
        ||
| 211 | |||
| 212 | |||
| 213 | if (mode<3){  | 
        ||
| 214 | printf("Interface %d\t address 0x%0x\t", vmeinterface, addr);  | 
        ||
| 215 | printf("board type %d\t", sa02BoardType);  | 
        ||
| 216 | printf("number %d tpenb %d\n", boardnumber, tpenb);  | 
        ||
| 217 |     } | 
        ||
| 218 | |||
| 219 | |||
| 220 | uint32_t response[2]= {0,0};  | 
        ||
| 221 | |||
| 222 | |||
| 223 | if (vmeinterface == ZYNQ_XILLINUX) addr =0;  | 
        ||
| 224 | sa02SetAddress(addr);  | 
        ||
| 225 | VME_START(vmeinterface);  | 
        ||
| 226 | |||
| 227 | switch (mode) {  | 
        ||
| 228 | case 1:{  | 
        ||
| 229 | printf("FEB cmd %s\t", cmd);  | 
        ||
| 230 | printf("x0 %d\t", x0);  | 
        ||
| 231 | printf("chip %d\t", chip);  | 
        ||
| 232 | printf("channel %d\n", channel);  | 
        ||
| 233 | sa02Cmd(boardnumber, icmd, x0, chip, channel,1,response);  | 
        ||
| 234 | break;  | 
        ||
| 235 |     } | 
        ||
| 236 | case 2: {  | 
        ||
| 237 | char serial[255];  | 
        ||
| 238 | double sdata[20];  | 
        ||
| 239 | sa02Status( boardnumber, serial,sdata);  | 
        ||
| 240 | if (fStatusBar) fStatusBar->SetText(serial,2);  | 
        ||
| 241 | break;  | 
        ||
| 242 |     } | 
        ||
| 243 | case 3:{  | 
        ||
| 244 | printf("Selecting NIM Output %s index= %d\n", sfebout, sindex);  | 
        ||
| 245 | if (sindex>=0) Sa02SetPtsOutput(sindex);  | 
        ||
| 246 | break;  | 
        ||
| 247 |     } | 
        ||
| 248 | case 4:{  | 
        ||
| 249 | printf("TrgType %d\n", trgtype);  | 
        ||
| 250 | printf("TrgLen %d\n", trglen);  | 
        ||
| 251 | uint32_t r = Sa02SelectTriggerWithMaskAndLength (trgtype, sa02BoardMask , trglen);  | 
        ||
| 252 | printf("In 0x%08x Out 0x%08x\n", trgtype | (sa02BoardMask << 4) | (trglen << 16) ,r);  | 
        ||
| 253 | break;  | 
        ||
| 254 |     } | 
        ||
| 255 | case 5:{  | 
        ||
| 256 | const char * fparam = (fParamFile)? fParamFile->GetText(): NULL;  | 
        ||
| 257 | printf("ASIC Parameter File %s\n", fparam);  | 
        ||
| 258 | sa02LoadParametersFromFile( fparam , sa02BoardMask );  | 
        ||
| 259 | break;  | 
        ||
| 260 |     } | 
        ||
| 261 | case 6:{  | 
        ||
| 262 | printf("Read addr 0x%04x\t", offset);  | 
        ||
| 263 | VME_A32D32_R(addr+offset,&data);  | 
        ||
| 264 | printf("data 0x%08x\n", data);  | 
        ||
| 265 | break;  | 
        ||
| 266 |     } | 
        ||
| 267 | case 7:{  | 
        ||
| 268 | printf("Write to addr 0x%04x\t", offset);  | 
        ||
| 269 | printf("data 0x%08x\n", data);  | 
        ||
| 270 | VME_A32D32_W(addr+offset,data);  | 
        ||
| 271 | break;  | 
        ||
| 272 |     } | 
        ||
| 273 | |||
| 274 | case 0:{  | 
        ||
| 275 | printf("scan FEB cmd %s\t", cmd);  | 
        ||
| 276 | printf("chip %d\t", chip);  | 
        ||
| 277 | printf("channel %d\n", channel);  | 
        ||
| 278 | printf("neve %d\t", neve);  | 
        ||
| 279 | printf("x0 %d\t", x0);  | 
        ||
| 280 | printf("dx %d\t", dx);  | 
        ||
| 281 | printf("nx %d\n", nx);  | 
        ||
| 282 | printf("output filename %s\n", fname);  | 
        ||
| 283 | |||
| 284 | gStyle->SetOptStat(0);  | 
        ||
| 285 | TCanvas *c = (fEcanvas)? fEcanvas->GetCanvas(): NULL;  | 
        ||
| 286 | if (fHisto) delete fHisto;  | 
        ||
| 287 | |||
| 288 | fHisto = new TH2F(cmd,cmd,144,-0.5,143.5,nx,x0-dx*0.5, x0+(nx-0.5)*dx);  | 
        ||
| 289 | if (c){  | 
        ||
| 290 | c->cd();  | 
        ||
| 291 | fHisto->Draw("colz");  | 
        ||
| 292 | c->Modified();  | 
        ||
| 293 | c->Update();  | 
        ||
| 294 |       } | 
        ||
| 295 | ctrl_c = 0;  | 
        ||
| 296 | int maxsize = 144*10;  | 
        ||
| 297 | uint32_t rdata[maxsize];  | 
        ||
| 298 | |||
| 299 | printf("Start daqmode=%d %s\n", daqmode,sdaqmode);  | 
        ||
| 300 | Sa02DaqMode (daqmode);  | 
        ||
| 301 | |||
| 302 | time_t t,told;  | 
        ||
| 303 | time(&t);  | 
        ||
| 304 | told = t;  | 
        ||
| 305 | for (int ix=0; ix<nx; ix++){  | 
        ||
| 306 | uint32_t data = ix*dx+x0;  | 
        ||
| 307 | for (int board=0; board<4; board++){  | 
        ||
| 308 | sa02Cmd(board, icmd, data, chip, channel,1,response);  | 
        ||
| 309 | Sa02TestPulseEnable(board, tpenb); // Enable/disable test pulse  | 
        ||
| 310 |         } | 
        ||
| 311 | printf(".");  | 
        ||
| 312 | Sa02SetNeve(neve);  | 
        ||
| 313 | sa02Reset();  | 
        ||
| 314 | |||
| 315 | int nb=0;  | 
        ||
| 316 | do {  | 
        ||
| 317 | if (trgtype == 1) Sa02SoftwareTrigger();  | 
        ||
| 318 | nb=1;  | 
        ||
| 319 |           //nb  = sa02Read(sa02BoardMask, rdata ); | 
        ||
| 320 |         } | 
        ||
| 321 | while ( nb==0 && !ctrl_c);  | 
        ||
| 322 | if (ctrl_c) break;  | 
        ||
| 323 | FillHistogram(data,rdata);  | 
        ||
| 324 | time(&t);  | 
        ||
| 325 | if (t!=told){  | 
        ||
| 326 | if (c){ c->Modified(); c->Update(); }  | 
        ||
| 327 | told=t;  | 
        ||
| 328 |         } | 
        ||
| 329 | |||
| 330 | |||
| 331 |       } | 
        ||
| 332 | if (c){ c->Modified(); c->Update(); }  | 
        ||
| 333 | printf("End\n");  | 
        ||
| 334 | |||
| 335 | TFile *rootfile= new TFile(fname,"RECREATE");  | 
        ||
| 336 | fHisto->Write();  | 
        ||
| 337 | rootfile->Write();  | 
        ||
| 338 | rootfile->ls();  | 
        ||
| 339 | rootfile->Close();  | 
        ||
| 340 |       delete rootfile; | 
        ||
| 341 | |||
| 342 | |||
| 343 | break;  | 
        ||
| 344 |     } | 
        ||
| 345 |   } | 
        ||
| 346 | |||
| 347 | |||
| 348 | VME_STOP();  | 
        ||
| 349 | |||
| 350 |    //if (ctrl_c) gApplication->Terminate(); | 
        ||
| 351 | } | 
        ||
| 352 | |||
| 353 | void FebMainFrame::CanvasPrint()  | 
        ||
| 354 | { | 
        ||
| 355 | printf("Print\n");  | 
        ||
| 356 | if (fEcanvas)  | 
        ||
| 357 |     { | 
        ||
| 358 | TCanvas *c = fEcanvas->GetCanvas();  | 
        ||
| 359 | if (c) c->SaveAs("sa02_gui.pdf");  | 
        ||
| 360 |         else | 
        ||
| 361 |         { | 
        ||
| 362 | printf("canvas does not exist....!\n");  | 
        ||
| 363 |         } | 
        ||
| 364 |     } | 
        ||
| 365 | |||
| 366 | } | 
        ||
| 367 | |||
| 368 | void FebMainFrame::Table( TGCompositeFrame *p, UInt_t w, UInt_t h )  | 
        ||
| 369 | { | 
        ||
| 370 | |||
| 371 |     // Create an array to hold a bunch of numbers | 
        ||
| 372 | Int_t i = 0, j = 0;  | 
        ||
| 373 | UInt_t nrows = 6, ncolumns = 5;  | 
        ||
| 374 | Double_t** data = new Double_t*[nrows];  | 
        ||
| 375 | for (i = 0; i < nrows; i++)  | 
        ||
| 376 |     { | 
        ||
| 377 | data[i] = new Double_t[ncolumns];  | 
        ||
| 378 | for (j = 0; j < ncolumns; j++)  | 
        ||
| 379 |         { | 
        ||
| 380 | data[i][j] = 10 * i + j;  | 
        ||
| 381 |         } | 
        ||
| 382 |     } | 
        ||
| 383 | |||
| 384 | |||
| 385 |     // Create an interface | 
        ||
| 386 | TGSimpleTableInterface *iface = new TGSimpleTableInterface(data, w, h);  | 
        ||
| 387 | |||
| 388 |     // Create the table | 
        ||
| 389 | TGTable *table = new TGTable(p, 999, iface);  | 
        ||
| 390 | |||
| 391 |     // Add the table to the main frame | 
        ||
| 392 | p->AddFrame(table, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY));  | 
        ||
| 393 | |||
| 394 |     //Update data | 
        ||
| 395 | data[5][1] = 3.01;  | 
        ||
| 396 |     //update the table view | 
        ||
| 397 | table->Update();  | 
        ||
| 398 | |||
| 399 | |||
| 400 | //   return mainframe; | 
        ||
| 401 | |||
| 402 | } | 
        ||
| 403 | |||
| 404 | |||
| 405 | /* | 
        ||
| 406 | |||
| 407 | class MyTable : public TGMainFrame { | 
        ||
| 408 | private: | 
        ||
| 409 | TGTextEntry *fTEItem[12]; | 
        ||
| 410 | ... | 
        ||
| 411 | MyTable::MyTable(const TGWindow *p, UInt_t w, UInt_t h) | 
        ||
| 412 | : TGMainFrame(p, w, h){ | 
        ||
| 413 | Int_t ncols = 3, nrows = 0; | 
        ||
| 414 | fLMMatrix = new TGMatrixLayout(this, nrows, ncols); | 
        ||
| 415 | this->SetLayoutManager(fLMMatrix); | 
        ||
| 416 | fLO1 = new TGLayoutHints(kLHintsExpandX, 2, 2, 2, 2); | 
        ||
| 417 | char text[10]; | 
        ||
| 418 | for(Int_t i=0; i < 12; i++){ | 
        ||
| 419 | fTEItem[i] = new TGTextEntry | 
        ||
| 420 | (this, fTBItem[i] = new TGTextBuffer(100)); | 
        ||
| 421 | sprintf(text,"Entry %i", i+1); | 
        ||
| 422 | fTBItem[i]->AddText(0,text); | 
        ||
| 423 | fTEItem[i]->Resize(120, fTEItem[i]->GetDefaultHeight()); | 
        ||
| 424 | this->AddFrame(fTEItem[i], fLO1); | 
        ||
| 425 | } | 
        ||
| 426 | |||
| 427 | */ | 
        ||
| 428 | |||
| 429 | |||
| 430 | |||
| 431 | |||
| 432 | TGFrame * TGLabeledWidget(TGFrame *main, const char* text, TGFrame *widget, TGLayoutHints *layout)  | 
        ||
| 433 | { | 
        ||
| 434 | TGHorizontalFrame *fH=new TGHorizontalFrame(main, 200,40);  | 
        ||
| 435 | widget->ReparentWindow(fH);  | 
        ||
| 436 | fH->AddFrame(new TGLabel( fH ,text), layout);  | 
        ||
| 437 | widget->Resize(150,widget->GetDefaultHeight());  | 
        ||
| 438 | fH->AddFrame(widget, layout);  | 
        ||
| 439 | |||
| 440 | return fH;  | 
        ||
| 441 | } | 
        ||
| 442 | |||
| 443 | |||
| 444 | void FebMainFrame::ScanFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)  | 
        ||
| 445 | { | 
        ||
| 446 | |||
| 447 | // Creates widgets of the example | 
        ||
| 448 | fEcanvas = new TRootEmbeddedCanvas ("Ecanvas",p,600,400);  | 
        ||
| 449 | p->AddFrame(fEcanvas, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10,10,10,1));  | 
        ||
| 450 | TGHorizontalFrame *hframe=new TGHorizontalFrame(p, 200,40);  | 
        ||
| 451 | |||
| 452 | TGTextButton *start = new TGTextButton(hframe,"&Start");  | 
        ||
| 453 | start->Connect("Clicked()","FebMainFrame",this,"StartDaq(=0)");  | 
        ||
| 454 | start->ChangeOptions(start->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 455 | start->SetWrapLength(-1);  | 
        ||
| 456 | |||
| 457 | start->Resize(80,start->GetDefaultHeight());  | 
        ||
| 458 | hframe->AddFrame(start, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 459 | |||
| 460 | |||
| 461 | TGTextButton *stop = new TGTextButton(hframe,"&Stop");  | 
        ||
| 462 | stop->Connect("Clicked()","FebMainFrame",this,"StopDaq()");  | 
        ||
| 463 | stop->ChangeOptions(stop->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 464 | stop->SetWrapLength(-1);  | 
        ||
| 465 | stop->Resize(80,stop->GetDefaultHeight());  | 
        ||
| 466 | hframe->AddFrame(stop, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 467 | |||
| 468 | TGTextButton *single = new TGTextButton(hframe,"&Single Cmd");  | 
        ||
| 469 | single->Connect("Clicked()","FebMainFrame",this,"StartDaq(=1)");  | 
        ||
| 470 | single->ChangeOptions(single->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 471 | single->Resize(80,single->GetDefaultHeight());  | 
        ||
| 472 | hframe->AddFrame(single, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 473 | |||
| 474 | TGTextButton *status = new TGTextButton(hframe,"&Status");  | 
        ||
| 475 | status->Connect("Clicked()","FebMainFrame",this,"StartDaq(=2)");  | 
        ||
| 476 | status->ChangeOptions(status->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 477 | status->Resize(80,status->GetDefaultHeight());  | 
        ||
| 478 | hframe->AddFrame(status, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 479 | |||
| 480 | TGTextButton *febout = new TGTextButton(hframe,"&Set Out1");  | 
        ||
| 481 | febout->Connect("Clicked()","FebMainFrame",this,"StartDaq(=3)");  | 
        ||
| 482 | febout->ChangeOptions(febout->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 483 | febout->Resize(80,febout->GetDefaultHeight());  | 
        ||
| 484 | hframe->AddFrame(febout, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 485 | |||
| 486 | TGTextButton *settrg = new TGTextButton(hframe,"&Set Trigger");  | 
        ||
| 487 | settrg->Connect("Clicked()","FebMainFrame",this,"StartDaq(=4)");  | 
        ||
| 488 | settrg->ChangeOptions(settrg->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 489 | settrg->Resize(80,settrg->GetDefaultHeight());  | 
        ||
| 490 | hframe->AddFrame(settrg, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 491 | |||
| 492 | TGTextButton *loadpar = new TGTextButton(hframe,"&Load Pars");  | 
        ||
| 493 | loadpar->Connect("Clicked()","FebMainFrame",this,"StartDaq(=5)");  | 
        ||
| 494 | loadpar->ChangeOptions(loadpar->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 495 | loadpar->Resize(80,loadpar->GetDefaultHeight());  | 
        ||
| 496 | hframe->AddFrame(loadpar, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 497 | |||
| 498 | |||
| 499 | TGTextButton *print = new TGTextButton(hframe,"&Print");  | 
        ||
| 500 | print->Connect("Clicked()","FebMainFrame",this,"CanvasPrint()");  | 
        ||
| 501 | print->ChangeOptions(print->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 502 | print->Resize(80,print->GetDefaultHeight());  | 
        ||
| 503 | hframe->AddFrame(print, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 504 | |||
| 505 | |||
| 506 | p->AddFrame(hframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));  | 
        ||
| 507 | |||
| 508 |     //TGGroupFrame *trg=new TGGroupFrame(p, "Trigger Parameters"); | 
        ||
| 509 | const Int_t ncols = 2, nrows = 13;  | 
        ||
| 510 | TGGroupFrame *matrika=new TGGroupFrame(p, "Run Parameters");  | 
        ||
| 511 | TGTableLayout *fLMMatrix = new TGTableLayout(matrika, (nrows+1)/2, ncols*2);  | 
        ||
| 512 | matrika->SetLayoutManager(fLMMatrix);  | 
        ||
| 513 | |||
| 514 | TGNumberEntry *gEntry[nrows];  | 
        ||
| 515 | char name[0xff]="";  | 
        ||
| 516 | |||
| 517 | char labels[nrows][20]= {  | 
        ||
| 518 | "FEB Out1","DAQ Mode","Trigger Type","Trigger Length",  | 
        ||
| 519 | "FPGA Command", "Initial Value", "Step size","Number of steps",  | 
        ||
| 520 | "Number of events",  | 
        ||
| 521 | "Asic Chip","Asic Channel",  | 
        ||
| 522 | "Filename","ASIC Parameters"  | 
        ||
| 523 | };  | 
        ||
| 524 | int initial_values[nrows]= {0,0,0,1000,0,400,10,40,100,0,0,0};  | 
        ||
| 525 | const char sfebout[55][64]={  | 
        ||
| 526 | "Digital Feb0","Digital Feb1","Digital Feb2","Digital Feb3",  | 
        ||
| 527 | "Error 0", "Error 1", "Error 2", "Error 3",  | 
        ||
| 528 | "BellePtsTrigger", "Veto", "write_t", "read_t",  | 
        ||
| 529 | "dataBufFul", "hwe", "softtrigger", "hardtrigger", "reset_t",  | 
        ||
| 530 | "DATA_FRAME0", "DATA_FRAME1", "DATA_FRAME1", "DATA_FRAME1",  | 
        ||
| 531 | "RX_FRAME0", "RX_FRAME1", "RX_FRAME2", "RX_FRAME3",  | 
        ||
| 532 | "TX_FRAME0", "TX_FRAME1", "TX_FRAME2", "TX_FRAME3",  | 
        ||
| 533 | "DATA_CLK0", "DATA_CLK1", "DATA_CLK2", "DATA_CLK3",  | 
        ||
| 534 | "RX_CLK0", "RX_CLK1", "RX_CLK2", "RX_CLK3",  | 
        ||
| 535 | "TX_CLK0", "TX_CLK1", "TX_CLK2", "TX_CLK3",  | 
        ||
| 536 | "DATA_DATA0", "DATA_DATA1", "DATA_DATA2", "DATA_DATA3",  | 
        ||
| 537 | "RX_DATA0", "RX_DATA1", "RX_DATA2", "RX_DATA3",  | 
        ||
| 538 | "TX_DATA0", "TX_DATA1", "TX_DATA2", "TX_DATA3",  | 
        ||
| 539 | "lclk", "outTrigger"  | 
        ||
| 540 | };  | 
        ||
| 541 | |||
| 542 | |||
| 543 | const char fpgastr[18][10]= { "FE","TP","DLY0","MUX","MUXASIC",  | 
        ||
| 544 | "VTH0","VTH1","TPLVL0","TPLVL1","GREG","CREG",  | 
        ||
| 545 | "CMON","TMON0","TMON1", "ADC_READ", "ADC_RESET","DMON"};  | 
        ||
| 546 | |||
| 547 | for (int i=0; i<nrows; i++)  | 
        ||
| 548 |     { | 
        ||
| 549 | sprintf(name,"%s %d",name,i);  | 
        ||
| 550 | TGLabel *label = new TGLabel( matrika ,labels[i]);  | 
        ||
| 551 | int dx = i/((nrows+1)/2)*2;  | 
        ||
| 552 | int dy = i%((nrows+1)/2);  | 
        ||
| 553 |         //label->Resize(100+i*10,label->GetDefaultHeight()); | 
        ||
| 554 | matrika->AddFrame(label,new TGTableLayoutHints(dx,dx+1,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,0,0));  | 
        ||
| 555 | switch (i)  | 
        ||
| 556 |         { | 
        ||
| 557 | |||
| 558 | case 1:{  | 
        ||
| 559 |           // combo box layout hints | 
        ||
| 560 | TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);  | 
        ||
| 561 |           // combo box widget | 
        ||
| 562 | fDaqMode = new TGComboBox(matrika,100);  | 
        ||
| 563 | fDaqMode->AddEntry("Event Mode", 0);  | 
        ||
| 564 | fDaqMode->AddEntry("Scaler Mode", 1);  | 
        ||
| 565 | fDaqMode->AddEntry("Test Mode - Nresponse frames", 2);  | 
        ||
| 566 | fDaqMode->AddEntry("Test Mode - channel address", 3);  | 
        ||
| 567 | fDaqMode->Resize(100, 20);  | 
        ||
| 568 |           // Entry3 is selected as current | 
        ||
| 569 | fDaqMode->Select(1);  | 
        ||
| 570 | matrika->AddFrame(fDaqMode, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 571 | break;  | 
        ||
| 572 |         } | 
        ||
| 573 | |||
| 574 | case 4:  | 
        ||
| 575 |         { | 
        ||
| 576 |             // combo box layout hints | 
        ||
| 577 | TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);  | 
        ||
| 578 |             // combo box widget | 
        ||
| 579 | fFPGACmd = new TGComboBox(matrika,100);  | 
        ||
| 580 | for (int k = 0; k < 17; k++) fFPGACmd->AddEntry(fpgastr[k], k+1);  | 
        ||
| 581 | fFPGACmd->Resize(100, 20);  | 
        ||
| 582 |             // Entry3 is selected as current | 
        ||
| 583 | fFPGACmd->Select(7);  | 
        ||
| 584 | matrika->AddFrame(fFPGACmd, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 585 | break;  | 
        ||
| 586 |         } | 
        ||
| 587 | case 2:  | 
        ||
| 588 |         { | 
        ||
| 589 |             // combo box layout hints | 
        ||
| 590 | TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);  | 
        ||
| 591 |             // combo box widget | 
        ||
| 592 | fTriggerType = new TGComboBox(matrika,100);  | 
        ||
| 593 | fTriggerType->AddEntry("Software", 1);  | 
        ||
| 594 | fTriggerType->AddEntry("External", 2);  | 
        ||
| 595 | fTriggerType->AddEntry("Internal", 3);  | 
        ||
| 596 | fTriggerType->Resize(100, 20);  | 
        ||
| 597 |             // Entry3 is selected as current | 
        ||
| 598 | fTriggerType->Select(3);  | 
        ||
| 599 | matrika->AddFrame(fTriggerType, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 600 | break;  | 
        ||
| 601 |         } | 
        ||
| 602 | case 0:  | 
        ||
| 603 |         { | 
        ||
| 604 |             // combo box layout hints | 
        ||
| 605 | TGLayoutHints *fLcombo = new TGLayoutHints(kLHintsTop | kLHintsLeft,5,5,5,5);  | 
        ||
| 606 |             // combo box widget | 
        ||
| 607 | fFEBOut1 = new TGComboBox(matrika,100);  | 
        ||
| 608 | for (int k = 0; k < 55; k++) fFEBOut1->AddEntry(sfebout[k], k+1);  | 
        ||
| 609 | fFEBOut1->Resize(100, 20);  | 
        ||
| 610 |             // Entry3 is selected as current | 
        ||
| 611 | fFEBOut1->Select(1);  | 
        ||
| 612 | matrika->AddFrame(fFEBOut1, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 613 | break;  | 
        ||
| 614 |         } | 
        ||
| 615 | case nrows-2:  | 
        ||
| 616 |         { | 
        ||
| 617 | fFilename = new TGTextEntry( matrika,"feb.root");  | 
        ||
| 618 | fFilename->Resize(200,fFilename->GetDefaultHeight());  | 
        ||
| 619 | matrika->AddFrame( fFilename, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 620 | break;  | 
        ||
| 621 |         } | 
        ||
| 622 | case nrows-1:  | 
        ||
| 623 |         { | 
        ||
| 624 | fParamFile = new TGTextEntry( matrika,"../parameters/feb1_0-default.param");  | 
        ||
| 625 | fParamFile->Resize(200,fParamFile->GetDefaultHeight());  | 
        ||
| 626 | matrika->AddFrame( fParamFile, new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 627 | break;  | 
        ||
| 628 |         } | 
        ||
| 629 | default:  | 
        ||
| 630 | gEntry[i]= new TGNumberEntry( matrika,initial_values[i]);  | 
        ||
| 631 | gEntry[i]->Resize(50,gEntry[i]->GetDefaultHeight());  | 
        ||
| 632 | gEntry[i]->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);  | 
        ||
| 633 | matrika->AddFrame(gEntry[i],new TGTableLayoutHints(dx+1,dx+2,dy,dy+1,kLHintsLeft| kLHintsCenterY,2,2,2,2));  | 
        ||
| 634 | break;  | 
        ||
| 635 |         } | 
        ||
| 636 | |||
| 637 | |||
| 638 |     } | 
        ||
| 639 | p->AddFrame(matrika,new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX | kLHintsExpandY,2,2,2,2));  | 
        ||
| 640 | |||
| 641 | |||
| 642 | |||
| 643 | |||
| 644 | fTrgLen =gEntry[3];  | 
        ||
| 645 | fX0 =gEntry[5];  | 
        ||
| 646 | fDx =gEntry[6];  | 
        ||
| 647 | fNx =gEntry[7];  | 
        ||
| 648 | fNeve =gEntry[8];  | 
        ||
| 649 | fAsicChip =gEntry[9];  | 
        ||
| 650 | fAsicChannel=gEntry[10];  | 
        ||
| 651 | |||
| 652 | } | 
        ||
| 653 | |||
| 654 | |||
| 655 | void FebMainFrame::ScanXYFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)  | 
        ||
| 656 | { | 
        ||
| 657 | |||
| 658 | |||
| 659 | } | 
        ||
| 660 | |||
| 661 | void FebMainFrame::LowLevelFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)  | 
        ||
| 662 | { | 
        ||
| 663 | |||
| 664 | TGLayoutHints *f0 = new TGLayoutHints(kLHintsLeft| kLHintsTop,5,5,3,4);  | 
        ||
| 665 | TGHorizontalFrame *hframe=new TGHorizontalFrame(p, 200,40);  | 
        ||
| 666 | |||
| 667 | |||
| 668 | |||
| 669 | hframe->AddFrame( TGLabeledWidget(hframe, "Offset",fOffset = new TGNumberEntry( hframe ,0 ) , f0));  | 
        ||
| 670 | fOffset->SetFormat(TGNumberFormat::kNESHex);  | 
        ||
| 671 | fOffset->SetNumber(0x0FFC);  | 
        ||
| 672 | |||
| 673 | TGTextButton *read = new TGTextButton(hframe,"&Read");  | 
        ||
| 674 | read->Connect("Clicked()","FebMainFrame",this,"StartDaq(=6)");  | 
        ||
| 675 | read->ChangeOptions(read->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 676 | read->SetWrapLength(-1);  | 
        ||
| 677 | read->Resize(80,read->GetDefaultHeight());  | 
        ||
| 678 | hframe->AddFrame(read, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 679 | |||
| 680 | hframe->AddFrame( TGLabeledWidget(hframe, "Data", fData = new TGNumberEntry( hframe ,0 ) , f0));  | 
        ||
| 681 | fData->SetFormat(TGNumberFormat::kNESHex);  | 
        ||
| 682 | fData->SetNumber(0xFAF5);  | 
        ||
| 683 | |||
| 684 | TGTextButton *write = new TGTextButton(hframe,"&Write");  | 
        ||
| 685 | write->Connect("Clicked()","FebMainFrame",this,"StartDaq(=7)");  | 
        ||
| 686 | write->ChangeOptions(write->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 687 | write->SetWrapLength(-1);  | 
        ||
| 688 | |||
| 689 | write->Resize(80,write->GetDefaultHeight());  | 
        ||
| 690 | hframe->AddFrame(write, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 691 | |||
| 692 | |||
| 693 | p->AddFrame(hframe,new TGLayoutHints(kLHintsCenterX,2,2,2,2));  | 
        ||
| 694 | |||
| 695 | |||
| 696 | |||
| 697 | |||
| 698 | |||
| 699 | } | 
        ||
| 700 | |||
| 701 | |||
| 702 | void FebMainFrame::SettingsFrame( TGCompositeFrame *p,UInt_t w,UInt_t h)  | 
        ||
| 703 | { | 
        ||
| 704 | Table(p, 6 ,5 );  | 
        ||
| 705 | } | 
        ||
| 706 | |||
| 707 | |||
| 708 | |||
| 709 | FebMainFrame::FebMainFrame( TGWindow *p,UInt_t w,UInt_t h) : TGMainFrame(p,w,h)  | 
        ||
| 710 | { | 
        ||
| 711 | TGLayoutHints *f0 = new TGLayoutHints(kLHintsLeft| kLHintsTop,5,5,3,4);  | 
        ||
| 712 | |||
| 713 | TGHorizontalFrame *topframe=new TGHorizontalFrame(this, 200,40);  | 
        ||
| 714 | |||
| 715 | topframe->AddFrame( TGLabeledWidget(topframe, "Interface", fVmeInterface = new TGComboBox( topframe ,0 ) , f0));  | 
        ||
| 716 | |||
| 717 | fVmeInterface->AddEntry("CAEN_V1718", 0);  | 
        ||
| 718 | fVmeInterface->AddEntry("WIENER_VMEMM", 1);  | 
        ||
| 719 | fVmeInterface->AddEntry("WIENER_VMUSB", 2);  | 
        ||
| 720 | fVmeInterface->AddEntry("ZYNQ_XILLINUX", 3);  | 
        ||
| 721 | fVmeInterface->Select(3);  | 
        ||
| 722 | fVmeInterface->Resize(120, 20);  | 
        ||
| 723 | |||
| 724 | |||
| 725 | topframe->AddFrame( TGLabeledWidget(topframe, "VMEAddr", fAddress = new TGNumberEntry( topframe ,0 ) , f0));  | 
        ||
| 726 | topframe->AddFrame( TGLabeledWidget(topframe, "Board No",fBoardNumber = new TGNumberEntry( topframe ,0 ) , f0));  | 
        ||
| 727 | fBoardNumber->Resize(50,fBoardNumber->GetDefaultHeight());  | 
        ||
| 728 | |||
| 729 | topframe->AddFrame( TGLabeledWidget(topframe, "Type", fBoardType = new TGNumberEntry( topframe ,2 ) , f0));  | 
        ||
| 730 | fAddress->SetFormat(TGNumberFormat::kNESHex);  | 
        ||
| 731 | fAddress->SetNumber(0x26000000);  | 
        ||
| 732 | fAddress->Resize(100,fAddress->GetDefaultHeight());  | 
        ||
| 733 | fBoardNumber->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);  | 
        ||
| 734 | fBoardType->SetFormat(TGNumberFormat::kNESInteger,TGNumberFormat::kNEANonNegative);  | 
        ||
| 735 | fBoardType->Resize(50,fBoardType->GetDefaultHeight());  | 
        ||
| 736 | |||
| 737 | fTpEnb = new TGCheckButton(topframe,"TpEnb",1);  | 
        ||
| 738 | fTpEnb->SetToolTipText("Enable or disable test pulse generation");  | 
        ||
| 739 | |||
| 740 | topframe->AddFrame( fTpEnb , f0 );  | 
        ||
| 741 | |||
| 742 | |||
| 743 | TGTextButton *exit = new TGTextButton(topframe,"&Exit", "gApplication->Terminate()");  | 
        ||
| 744 | exit->ChangeOptions(exit->GetOptions() | kFixedWidth); // | kFixedSize  | 
        ||
| 745 | exit->Resize(80,exit->GetDefaultHeight());  | 
        ||
| 746 | topframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4));  | 
        ||
| 747 | |||
| 748 | |||
| 749 | |||
| 750 | AddFrame(topframe, f0);  | 
        ||
| 751 | |||
| 752 | // tab widget | 
        ||
| 753 | TGTab *fTab = new TGTab(this,w,h);  | 
        ||
| 754 | |||
| 755 |     // container of "Tab1" | 
        ||
| 756 | TGCompositeFrame * fCompositeFrame0 = fTab->AddTab("Threshold Scan");  | 
        ||
| 757 | fCompositeFrame0->SetLayoutManager(new TGVerticalLayout(fCompositeFrame0));  | 
        ||
| 758 | ScanFrame(fCompositeFrame0 ,w,h);  | 
        ||
| 759 | |||
| 760 |     // container of "Tab2" | 
        ||
| 761 | TGCompositeFrame *fCompositeFrame1 = fTab->AddTab("Low Level");  | 
        ||
| 762 | fCompositeFrame1->SetLayoutManager(new TGVerticalLayout(fCompositeFrame1));  | 
        ||
| 763 | LowLevelFrame(fCompositeFrame1 ,w,h);  | 
        ||
| 764 | |||
| 765 |     // container of "Tab3" | 
        ||
| 766 | TGCompositeFrame *fCompositeFrame2 = fTab->AddTab("XY Scan");  | 
        ||
| 767 | fCompositeFrame2->SetLayoutManager(new TGVerticalLayout(fCompositeFrame2));  | 
        ||
| 768 | ScanXYFrame(fCompositeFrame2 ,w,h);  | 
        ||
| 769 | |||
| 770 |     // container of "Tab4" | 
        ||
| 771 | TGCompositeFrame *fCompositeFrame3 = fTab->AddTab("ASIC Parameters");  | 
        ||
| 772 | fCompositeFrame3->SetLayoutManager(new TGVerticalLayout(fCompositeFrame3));  | 
        ||
| 773 | SettingsFrame(fCompositeFrame3 ,w,h);  | 
        ||
| 774 | |||
| 775 | fTab->SetTab(0);  | 
        ||
| 776 | fTab->Resize(fTab->GetDefaultSize());  | 
        ||
| 777 | |||
| 778 | AddFrame(fTab, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));  | 
        ||
| 779 |     //fTab->MoveResize(2,8,486,328); | 
        ||
| 780 | |||
| 781 |     // status bar | 
        ||
| 782 | Int_t parts[] = {33, 10, 10, 47};  | 
        ||
| 783 | fStatusBar = new TGStatusBar(this,50,10,kHorizontalFrame);  | 
        ||
| 784 | fStatusBar->SetParts(parts,4);  | 
        ||
| 785 | AddFrame(fStatusBar,new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX,0,0,2,0));  | 
        ||
| 786 | // fill status bar fields with information; selected is the object | 
        ||
| 787 | // below the cursor; atext contains pixel coordinates info | 
        ||
| 788 |     /* | 
        ||
| 789 |     fStatusBar->SetText(selected->GetTitle(),0); | 
        ||
| 790 |     fStatusBar->SetText(selected->GetName(),1); | 
        ||
| 791 |     fStatusBar->SetText(atext,2); | 
        ||
| 792 |     StatusBar->SetText(selected->GetObjectInfo(px,py),3); | 
        ||
| 793 | |||
| 794 |        TGStatusBar *fStatusBar = new TGStatusBar(this, 3,w,24); | 
        ||
| 795 |        fStatusBar->SetName("fStatusBar"); | 
        ||
| 796 | |||
| 797 | |||
| 798 |        AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom| kLHintsLeft | kLHintsExpandX)); | 
        ||
| 799 | |||
| 800 |     */ | 
        ||
| 801 |     //fStatusBar1332->MoveResize(0,344,480,24); | 
        ||
| 802 | |||
| 803 | |||
| 804 | // Sets window name and shows the main frame | 
        ||
| 805 | SetWindowName("ARICH FEB User Interface");  | 
        ||
| 806 | MapSubwindows();  | 
        ||
| 807 | Resize(GetDefaultSize());  | 
        ||
| 808 | MapWindow();  | 
        ||
| 809 | |||
| 810 | fTimer = new TTimer(1000, kFALSE);  | 
        ||
| 811 | fTimer->Connect("Timeout()", "FebMainFrame", this, "GuiTimer()");  | 
        ||
| 812 | fTimer->TurnOn();  | 
        ||
| 813 | fTimer->Start(1000, kFALSE); // 1 second single-shot if kTRUE  | 
        ||
| 814 | |||
| 815 | // intercept routine | 
        ||
| 816 | if (signal (SIGINT, sa02Timerast) == SIG_ERR)  | 
        ||
| 817 |     { | 
        ||
| 818 | perror ("sigignore");  | 
        ||
| 819 |     } | 
        ||
| 820 | fHisto=NULL;  | 
        ||
| 821 | set_plot_style();  | 
        ||
| 822 | } |