| 1 | 
 //------------------------------------------------------------------------------------------------------------------------------------------------------- | 
 //------------------------------------------------------------------------------------------------------------------------------------------------------- | 
| 2 | 
 // | 
 // | 
| 3 | 
 //   EventViewer.c      version 8.00  (2005-11-24) | 
 //   EventViewer.c      version 9.03  (2006-03-10) | 
| 4 | 
 // | 
 // | 
| 5 | 
 //   Shows PAMELA events - Emiliano Mocchiutti | 
 //   Shows PAMELA events - Emiliano Mocchiutti | 
| 6 | 
 // | 
 // | 
| 10 | 
 // | 
 // | 
| 11 | 
 //   Standard use: | 
 //   Standard use: | 
| 12 | 
 // | 
 // | 
| 13 | 
 //   root[0] .L ShowEvent.c | 
 //   bash> EventViewer | 
 | 
 //   root[1] ShowEvent("/home/dati/filesFromYoda/DW_050112_00600/"); | 
  | 
| 14 | 
 // | 
 // | 
| 15 | 
 //   For further informations use: | 
 //   For further informations use: | 
| 16 | 
 // | 
 // | 
| 17 | 
 //   root[3] ShowEvent(); | 
 //   EventViewer --help | 
| 18 | 
 // | 
 // | 
| 19 | 
 //   or | 
 //   or | 
| 20 | 
 // | 
 // | 
| 21 | 
 //   root[4] ShowEvent("help"); | 
 //   EventViewer --version | 
| 22 | 
 //   | 
 //   | 
| 23 | 
 //------------------------------------------------------------------------------------------------------------------------------------------------------- | 
 //------------------------------------------------------------------------------------------------------------------------------------------------------- | 
| 24 | 
 // | 
 // | 
| 25 | 
 //   Changelog: | 
 //   Changelog: | 
| 26 | 
 // | 
 // | 
| 27 | 
  | 
 //   9.02 - 9.03 (2006-03-10): Figure still editable during searching, fixed. Fixed CPU consuming. | 
| 28 | 
  | 
 // | 
| 29 | 
  | 
 //   9.01 - 9.02 (2006-03-09): Now reads tracker software output from v3r02. Small bugs fixed (figure not editable now and complete text inside the GUI if there are only files with the same name). | 
| 30 | 
  | 
 // | 
| 31 | 
  | 
 //   9.00 - 9.01 (2006-03-03): Many bugs fixed and some correction in the behaviour in some cases (many thanks to Silvio for help in developing and debugging!). | 
| 32 | 
  | 
 // | 
| 33 | 
  | 
 //   8.02 - 9.00 (2006-02-17): Added the Graphic User Interface, fixed some old bugs, many new features (on fly load and unload files and selection files, stop searching | 
| 34 | 
  | 
 //                             while in selection mode, on fly level0/best level switching, fork the application/no text output flag,... ) | 
| 35 | 
  | 
 // | 
| 36 | 
  | 
 //   8.01 - 8.02 (2006-02-16): Don't show positions not used in determine the track. Shows S4 mip values in standard mode (not scientific notation). | 
| 37 | 
  | 
 // | 
| 38 | 
  | 
 //   8.00 - 8.01 (2006-01-10): Added tracker measured positions used to determine the track. | 
| 39 | 
  | 
 // | 
| 40 | 
 //   7.03 - 8.00 (2005-11-24): many changes to compile the macro. The code is still very redundant and heavy but some bugs were fixed and now it should be more stable. | 
 //   7.03 - 8.00 (2005-11-24): many changes to compile the macro. The code is still very redundant and heavy but some bugs were fixed and now it should be more stable. | 
| 41 | 
 //                             Do not require anymore the AcFunctions.h header, a clone has been written (aclev1class.h). | 
 //                             Do not require anymore the AcFunctions.h header, a clone has been written (aclev1class.h). | 
| 42 | 
 // | 
 // | 
| 174 | 
 #include <iostream> | 
 #include <iostream> | 
| 175 | 
 #include <iomanip> | 
 #include <iomanip> | 
| 176 | 
 // | 
 // | 
| 177 | 
  | 
 #include <TObjectTable.h> | 
| 178 | 
  | 
 #include <TGClient.h> | 
| 179 | 
  | 
 #include <TGButton.h> | 
| 180 | 
  | 
 #include <TGComboBox.h> | 
| 181 | 
  | 
 #include <TGLabel.h> | 
| 182 | 
  | 
 #include <TGTextEntry.h> | 
| 183 | 
  | 
 #include <TGFrame.h> | 
| 184 | 
  | 
 #include <TGButtonGroup.h> | 
| 185 | 
  | 
 #include <TGProgressBar.h> | 
| 186 | 
  | 
 #include <TGMsgBox.h> | 
| 187 | 
  | 
 #include <TGComboBox.h> | 
| 188 | 
  | 
 // | 
| 189 | 
 #include <TTree.h> | 
 #include <TTree.h> | 
| 190 | 
 #include <TClassEdit.h> | 
 #include <TClassEdit.h> | 
| 191 | 
 #include <TObject.h> | 
 #include <TObject.h> | 
| 282 | 
         gSystem->Unload(libload.str().c_str()); | 
         gSystem->Unload(libload.str().c_str()); | 
| 283 | 
 #endif | 
 #endif | 
| 284 | 
 } | 
 } | 
| 285 | 
  | 
  | 
| 286 | 
  | 
 // | 
| 287 | 
  | 
 // GUI | 
| 288 | 
  | 
 // | 
| 289 | 
  | 
  | 
| 290 | 
  | 
 class PAMevcontrol : public TGMainFrame { | 
| 291 | 
  | 
  | 
| 292 | 
  | 
  private: | 
| 293 | 
  | 
   TGHProgressBar *fHProg1; | 
| 294 | 
  | 
   TGTextEntry *fText2; | 
| 295 | 
  | 
   TGTextEntry *fText4; | 
| 296 | 
  | 
   TGComboBox *fCombo; | 
| 297 | 
  | 
   TCanvas *thefigure; | 
| 298 | 
  | 
   struct Variables *cvar; | 
| 299 | 
  | 
  | 
| 300 | 
  | 
  public: | 
| 301 | 
  | 
   PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,struct Variables & var, TCanvas &figure); | 
| 302 | 
  | 
   virtual ~PAMevcontrol(); | 
| 303 | 
  | 
   void chktof(); | 
| 304 | 
  | 
   void chkac(); | 
| 305 | 
  | 
   void chktrk(); | 
| 306 | 
  | 
   void chkcalo(); | 
| 307 | 
  | 
   void chks4(); | 
| 308 | 
  | 
   void chknd(); | 
| 309 | 
  | 
   void chkinfo(); | 
| 310 | 
  | 
   void chknames(); | 
| 311 | 
  | 
   void chkpalette(); | 
| 312 | 
  | 
   void radiocolor(); | 
| 313 | 
  | 
   void radiobw(); | 
| 314 | 
  | 
   void radiotrack(); | 
| 315 | 
  | 
   void forcel0(); | 
| 316 | 
  | 
   void next(); | 
| 317 | 
  | 
   void prev(); | 
| 318 | 
  | 
   void stop(); | 
| 319 | 
  | 
   void SetFilename(); | 
| 320 | 
  | 
   void SetFilter(); | 
| 321 | 
  | 
   void jumpto(); | 
| 322 | 
  | 
   void radioevent(); | 
| 323 | 
  | 
   void radioprog(); | 
| 324 | 
  | 
   void saveas(); | 
| 325 | 
  | 
   void CompleteText(); | 
| 326 | 
  | 
   void Close(); | 
| 327 | 
  | 
   void increment(float val); | 
| 328 | 
  | 
   void DIALOG(Int_t ty, TString warn); | 
| 329 | 
  | 
   void clearselfi(); | 
| 330 | 
  | 
   void upgrnamfi(); | 
| 331 | 
  | 
   void Terminate(); | 
| 332 | 
  | 
   ClassDef(PAMevcontrol,0); | 
| 333 | 
  | 
 }; | 
| 334 | 
  | 
  | 
| 335 | 
  | 
 PAMevcontrol::PAMevcontrol(const TGWindow *p,UInt_t w,UInt_t h,Variables & var, TCanvas &figure) : TGMainFrame(p, w, h){ | 
| 336 | 
  | 
   // | 
| 337 | 
  | 
   SetCleanup(kDeepCleanup); | 
| 338 | 
  | 
   DontCallClose(); | 
| 339 | 
  | 
   Connect("CloseWindow()","PAMevcontrol",this,"Terminate()"); | 
| 340 | 
  | 
   // | 
| 341 | 
  | 
   cvar = &var;  | 
| 342 | 
  | 
   thefigure = &figure; | 
| 343 | 
  | 
   // | 
| 344 | 
  | 
   TGCompositeFrame *cframe1 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); | 
| 345 | 
  | 
   TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); | 
| 346 | 
  | 
   TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); | 
| 347 | 
  | 
   TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame); | 
| 348 | 
  | 
   TGGroupFrame *gf = new TGGroupFrame(cframe1, "Appearance"); | 
| 349 | 
  | 
   TGGroupFrame *inputf = new TGGroupFrame(cframe2, "Input"); | 
| 350 | 
  | 
   TGGroupFrame *jumpf = new TGGroupFrame(cframe3, "Jump to"); | 
| 351 | 
  | 
   TGGroupFrame *savef = new TGGroupFrame(cframe4, "Save figure as"); | 
| 352 | 
  | 
   // | 
| 353 | 
  | 
   TGHorizontalFrame *htexts = new TGHorizontalFrame(savef,400,800); | 
| 354 | 
  | 
   TGHorizontalFrame *htextsl = new TGHorizontalFrame(cframe4,400,800); | 
| 355 | 
  | 
   TGHorizontalFrame *htext = new TGHorizontalFrame(inputf,400,800); | 
| 356 | 
  | 
   TGHorizontalFrame *htext2 = new TGHorizontalFrame(inputf,400,800); | 
| 357 | 
  | 
   TGHorizontalFrame *htext3 = new TGHorizontalFrame(jumpf,400,800); | 
| 358 | 
  | 
   TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80); | 
| 359 | 
  | 
   TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800); | 
| 360 | 
  | 
   TGHorizontalFrame *hframe1 = new TGHorizontalFrame(gf, 280, 50); | 
| 361 | 
  | 
   TGHorizontalFrame *hframe2 = new TGHorizontalFrame(gf, 280, 40); | 
| 362 | 
  | 
   TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf, 280, 40); | 
| 363 | 
  | 
   TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf,280,10); | 
| 364 | 
  | 
   TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 40); | 
| 365 | 
  | 
   TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800); | 
| 366 | 
  | 
   // | 
| 367 | 
  | 
   TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1); | 
| 368 | 
  | 
   fText->SetText(cvar->thefilename.Data()); | 
| 369 | 
  | 
   TGTextButton *Load = new TGTextButton(htext,"Load"); | 
| 370 | 
  | 
   Load->Connect("Pressed()","TGTextEntry",fText,"ReturnPressed()"); | 
| 371 | 
  | 
   fText->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilename()"); | 
| 372 | 
  | 
   fText->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); | 
| 373 | 
  | 
   htext->AddFrame(fText, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5)); | 
| 374 | 
  | 
   htext->AddFrame(Load, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,0,5,5,5)); | 
| 375 | 
  | 
   inputf->AddFrame(new TGLabel(inputf, new TGHotString("Filename:"))); | 
| 376 | 
  | 
   inputf->AddFrame(htext, new TGLayoutHints(kLHintsExpandX)); | 
| 377 | 
  | 
   // | 
| 378 | 
  | 
   fText2 = new TGTextEntry(htext2, new TGTextBuffer(20),-1); | 
| 379 | 
  | 
   fText2->SetText(cvar->thefilter.Data()); | 
| 380 | 
  | 
   TGTextButton *Load2 = new TGTextButton(htext2,"Load"); | 
| 381 | 
  | 
   Load2->Connect("Clicked()","TGTextEntry",fText2,"ReturnPressed()"); | 
| 382 | 
  | 
   fText2->Connect("ReturnPressed()", "PAMevcontrol", this,"SetFilter()"); | 
| 383 | 
  | 
   fText2->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); | 
| 384 | 
  | 
   htext2->AddFrame(fText2, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY, 0, 5, 5, 5)); | 
| 385 | 
  | 
   htext2->AddFrame(Load2, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,0,5,5,5)); | 
| 386 | 
  | 
   inputf->AddFrame(new TGLabel(inputf, new TGHotString("Selection file:"))); | 
| 387 | 
  | 
   inputf->AddFrame(htext2, new TGLayoutHints(kLHintsExpandX)); | 
| 388 | 
  | 
   // | 
| 389 | 
  | 
   cframe2->AddFrame(inputf,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); | 
| 390 | 
  | 
   // | 
| 391 | 
  | 
   TGCheckButton *fchktof = new TGCheckButton(hframe1, "TOF");    | 
| 392 | 
  | 
   fchktof->Connect("Clicked()","PAMevcontrol", this,"chktof()");  | 
| 393 | 
  | 
   if ( cvar->TOF ) fchktof->SetState(kButtonDown); | 
| 394 | 
  | 
   hframe1->AddFrame(fchktof, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,5,5,5)); | 
| 395 | 
  | 
   // | 
| 396 | 
  | 
   TGCheckButton *fchkac = new TGCheckButton(hframe1, "AC");    | 
| 397 | 
  | 
   fchkac->Connect("Clicked()","PAMevcontrol", this,"chkac()");    | 
| 398 | 
  | 
   if ( cvar->AC ) fchkac->SetState(kButtonDown); | 
| 399 | 
  | 
   hframe1->AddFrame(fchkac, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,25,5,5)); | 
| 400 | 
  | 
   // | 
| 401 | 
  | 
   TGCheckButton *fchktrk = new TGCheckButton(hframe1, "Tracker");    | 
| 402 | 
  | 
   fchktrk->Connect("Clicked()","PAMevcontrol",this,"chktrk()");    | 
| 403 | 
  | 
   if ( cvar->TRK ) fchktrk->SetState(kButtonDown); | 
| 404 | 
  | 
   hframe1->AddFrame(fchktrk, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5)); | 
| 405 | 
  | 
   // | 
| 406 | 
  | 
   gf->AddFrame(hframe1, new TGLayoutHints(kLHintsExpandX)); | 
| 407 | 
  | 
   // | 
| 408 | 
  | 
   TGCheckButton *fchks4 = new TGCheckButton(hframe2, "S4");    | 
| 409 | 
  | 
   fchks4->Connect("Clicked()","PAMevcontrol",this,"chks4()");    | 
| 410 | 
  | 
   if ( cvar->S4 ) fchks4->SetState(kButtonDown); | 
| 411 | 
  | 
   hframe2->AddFrame(fchks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,15,5,5)); | 
| 412 | 
  | 
   // | 
| 413 | 
  | 
   TGCheckButton *fchknd = new TGCheckButton(hframe2, "ND");    | 
| 414 | 
  | 
   fchknd->Connect("Clicked()","PAMevcontrol",this,"chknd()");    | 
| 415 | 
  | 
   if ( cvar->ND ) fchknd->SetState(kButtonDown); | 
| 416 | 
  | 
   hframe2->AddFrame(fchknd, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,25,5,5)); | 
| 417 | 
  | 
   // | 
| 418 | 
  | 
   TGCheckButton *fchkcalo = new TGCheckButton(hframe2, "Calorimeter");    | 
| 419 | 
  | 
   fchkcalo->Connect("Clicked()","PAMevcontrol",this,"chkcalo()");    | 
| 420 | 
  | 
   if ( cvar->CALO ) fchkcalo->SetState(kButtonDown); | 
| 421 | 
  | 
   hframe2->AddFrame(fchkcalo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,2,5,5)); | 
| 422 | 
  | 
   // | 
| 423 | 
  | 
   gf->AddFrame(hframe2, new TGLayoutHints(kLHintsExpandX)); | 
| 424 | 
  | 
   // | 
| 425 | 
  | 
   TGCheckButton *fchkinfo = new TGCheckButton(hframe3, "Infos");    | 
| 426 | 
  | 
   fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");    | 
| 427 | 
  | 
   if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); | 
| 428 | 
  | 
   hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,0,5,5,5)); | 
| 429 | 
  | 
   // | 
| 430 | 
  | 
   TGCheckButton *fchknames = new TGCheckButton(hframe3, "Names");    | 
| 431 | 
  | 
   fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");    | 
| 432 | 
  | 
   if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); | 
| 433 | 
  | 
   hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,5,5,5)); | 
| 434 | 
  | 
   TGCheckButton *fchkpalette = new TGCheckButton(hframe3, "Palette");    | 
| 435 | 
  | 
   fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");    | 
| 436 | 
  | 
   if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); | 
| 437 | 
  | 
   hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5)); | 
| 438 | 
  | 
   gf->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX)); | 
| 439 | 
  | 
   // | 
| 440 | 
  | 
   TGVButtonGroup *group = new TGVButtonGroup(hframe4); | 
| 441 | 
  | 
   TGRadioButton *bwc0; | 
| 442 | 
  | 
   TGRadioButton *bwc1; | 
| 443 | 
  | 
   bwc0 = new TGRadioButton(group, "Colour"); | 
| 444 | 
  | 
   bwc1 = new TGRadioButton(group, "B/W"); | 
| 445 | 
  | 
   if ( cvar->bw ){ | 
| 446 | 
  | 
     bwc1->SetState(kButtonDown); | 
| 447 | 
  | 
   } else { | 
| 448 | 
  | 
     bwc0->SetState(kButtonDown); | 
| 449 | 
  | 
   }; | 
| 450 | 
  | 
   bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()"); | 
| 451 | 
  | 
   bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()"); | 
| 452 | 
  | 
   hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,1,5,5,5)); | 
| 453 | 
  | 
   // | 
| 454 | 
  | 
   // | 
| 455 | 
  | 
   TGCheckButton *ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");    | 
| 456 | 
  | 
   ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");    | 
| 457 | 
  | 
   if ( cvar->tracknds4) ftrks4->SetState(kButtonDown); | 
| 458 | 
  | 
   hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,2,5,5)); | 
| 459 | 
  | 
   TGCheckButton *ffl0 = new TGCheckButton(hframe5, "Force LEVEL0"); | 
| 460 | 
  | 
   ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()"); | 
| 461 | 
  | 
   if ( cvar->fl0 ) ffl0->SetState(kButtonDown); | 
| 462 | 
  | 
   hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,5,2,5,5)); | 
| 463 | 
  | 
   // | 
| 464 | 
  | 
   hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY,10,5,5,5)); | 
| 465 | 
  | 
   gf->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX)); | 
| 466 | 
  | 
   // | 
| 467 | 
  | 
   cframe1->AddFrame(gf, new TGLayoutHints(kLHintsExpandX)); | 
| 468 | 
  | 
   // | 
| 469 | 
  | 
   TGHButtonGroup *jgroup = new TGHButtonGroup(htext4); | 
| 470 | 
  | 
   TGRadioButton *jbwc0; | 
| 471 | 
  | 
   TGRadioButton *jbwc1; | 
| 472 | 
  | 
   jbwc0 = new TGRadioButton(jgroup, "event      "); | 
| 473 | 
  | 
   jbwc1 = new TGRadioButton(jgroup, "progressive"); | 
| 474 | 
  | 
   jbwc1->SetState(kButtonDown); | 
| 475 | 
  | 
   jbwc0->Connect("Pressed()", "PAMevcontrol",this,"radioevent()"); | 
| 476 | 
  | 
   jbwc1->Connect("Pressed()", "PAMevcontrol",this,"radioprog()"); | 
| 477 | 
  | 
   htext4->AddFrame(jgroup,new TGLayoutHints(kLHintsExpandX,1,1,0,0)); | 
| 478 | 
  | 
   // | 
| 479 | 
  | 
   TGTextEntry *fText3 = new TGTextEntry(htext3, new TGTextBuffer(6),-1); | 
| 480 | 
  | 
   TGTextButton *Jump = new TGTextButton(htext3,"go"); | 
| 481 | 
  | 
   Jump->Connect("Clicked()","TGTextEntry",fText3,"ReturnPressed()"); | 
| 482 | 
  | 
   fText3->Connect("ReturnPressed()", "PAMevcontrol", this,"jumpto()"); | 
| 483 | 
  | 
   htext3->AddFrame(new TGLabel(htext3, new TGHotString("number")), new TGLayoutHints(kLHintsExpandX,0,0,1,1)); | 
| 484 | 
  | 
   htext3->AddFrame(fText3, new TGLayoutHints(kLHintsExpandX, 0, 8, 0, 0)); | 
| 485 | 
  | 
   htext3->AddFrame(Jump, new TGLayoutHints(kLHintsExpandX,0,0,0,0)); | 
| 486 | 
  | 
   jumpf->AddFrame(htext4, new TGLayoutHints(kLHintsExpandX,0,0,1,1)); // | 
| 487 | 
  | 
   jumpf->AddFrame(htext3, new TGLayoutHints(kLHintsExpandX,0,0,0,1)); // | 
| 488 | 
  | 
   // | 
| 489 | 
  | 
   cframe3->AddFrame(jumpf,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); | 
| 490 | 
  | 
   // | 
| 491 | 
  | 
   fText4 = new TGTextEntry(htexts, new TGTextBuffer(18),-1); | 
| 492 | 
  | 
   TGTextButton *save = new TGTextButton(htextsl,"save"); | 
| 493 | 
  | 
   save->Connect("Clicked()","TGTextEntry",fText4,"ReturnPressed()"); | 
| 494 | 
  | 
   fText4->Connect("ReturnPressed()", "PAMevcontrol", this,"saveas()"); | 
| 495 | 
  | 
   fText4->Connect("TabPressed()", "PAMevcontrol", this,"CompleteText()"); | 
| 496 | 
  | 
   htexts->AddFrame(fText4, new TGLayoutHints(kLHintsExpandX, 0, 8, 1, 1)); | 
| 497 | 
  | 
   // | 
| 498 | 
  | 
   fCombo = new TGComboBox(htexts, 98); | 
| 499 | 
  | 
   fCombo->AddEntry(".ps", 0); | 
| 500 | 
  | 
   fCombo->AddEntry(".eps", 1); | 
| 501 | 
  | 
   fCombo->AddEntry(".gif", 2); | 
| 502 | 
  | 
   fCombo->AddEntry(".jpg", 3); | 
| 503 | 
  | 
   fCombo->AddEntry(".tiff", 4); | 
| 504 | 
  | 
   fCombo->AddEntry(".xpm", 5); | 
| 505 | 
  | 
   fCombo->AddEntry(".pdf", 6); | 
| 506 | 
  | 
   fCombo->AddEntry(".xml", 7); | 
| 507 | 
  | 
   fCombo->AddEntry(".png", 8); | 
| 508 | 
  | 
   fCombo->AddEntry(".svg", 9); | 
| 509 | 
  | 
   fCombo->AddEntry(".root", 10); | 
| 510 | 
  | 
   fCombo->AddEntry(".C", 11); | 
| 511 | 
  | 
   fCombo->Select(0); | 
| 512 | 
  | 
   fCombo->Resize(50,23); | 
| 513 | 
  | 
   //  htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsCenterX | kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX, 0, 8, 1, 1)); | 
| 514 | 
  | 
   htexts->AddFrame(fCombo, new TGLayoutHints(kLHintsExpandY | kLHintsRight, 2, 2, 2, 1)); | 
| 515 | 
  | 
   // | 
| 516 | 
  | 
   htextsl->AddFrame(save, new TGLayoutHints(kLHintsExpandX,0,0,2,1)); | 
| 517 | 
  | 
   savef->AddFrame(htexts, new TGLayoutHints(kLHintsExpandX,0,0,2,5)); | 
| 518 | 
  | 
   //  savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,5,2,5,2)); | 
| 519 | 
  | 
   savef->AddFrame(htextsl, new TGLayoutHints(kLHintsExpandX,8,0,5,2)); | 
| 520 | 
  | 
   // | 
| 521 | 
  | 
   cframe4->AddFrame(savef,new TGLayoutHints(kLHintsExpandX,5,5,5,5)); | 
| 522 | 
  | 
   // | 
| 523 | 
  | 
   fHProg1 = new TGHProgressBar(hfrprog, TGProgressBar::kFancy, 260); | 
| 524 | 
  | 
   fHProg1->SetBarColor("green"); | 
| 525 | 
  | 
   fHProg1->ShowPosition(); | 
| 526 | 
  | 
   hfrprog->AddFrame(fHProg1, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY | kLHintsExpandX,5,5,5,5)); | 
| 527 | 
  | 
   // | 
| 528 | 
  | 
   // | 
| 529 | 
  | 
   TGTextButton *prev = new TGTextButton(hframe,"< &Back"); | 
| 530 | 
  | 
   prev->Connect("Clicked()","PAMevcontrol",this,"prev()"); | 
| 531 | 
  | 
   hframe->AddFrame(prev, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); | 
| 532 | 
  | 
   // | 
| 533 | 
  | 
   TGTextButton *exit = new TGTextButton(hframe,"E&xit"); | 
| 534 | 
  | 
   exit->Connect("Clicked()","PAMevcontrol",this,"Terminate()"); | 
| 535 | 
  | 
   //,"gApplication->Terminate(0)"); | 
| 536 | 
  | 
   exit->SetToolTipText("Quit the event viewer"); | 
| 537 | 
  | 
   hframe->AddFrame(exit, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); | 
| 538 | 
  | 
   // | 
| 539 | 
  | 
   TGTextButton *stop = new TGTextButton(hframe,"&Stop"); | 
| 540 | 
  | 
   stop->Connect("Clicked()","PAMevcontrol",this,"stop()"); | 
| 541 | 
  | 
   hframe->AddFrame(stop, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); | 
| 542 | 
  | 
   // | 
| 543 | 
  | 
   TGTextButton *next = new TGTextButton(hframe,"&Next >"); | 
| 544 | 
  | 
   next->Connect("Clicked()","PAMevcontrol",this,"next()"); | 
| 545 | 
  | 
   hframe->AddFrame(next, new TGLayoutHints(kLHintsCenterX | kLHintsExpandX,5,5,3,4)); | 
| 546 | 
  | 
   // | 
| 547 | 
  | 
   // | 
| 548 | 
  | 
   //  AddFrame(htext, new TGLayoutHints(kLHintsExpandX,2,2,15,1)); | 
| 549 | 
  | 
   AddFrame(cframe2, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); | 
| 550 | 
  | 
   AddFrame(cframe1, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); | 
| 551 | 
  | 
   AddFrame(cframe3, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); | 
| 552 | 
  | 
   AddFrame(cframe4, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); | 
| 553 | 
  | 
   AddFrame(hfrprog, new TGLayoutHints(kLHintsExpandX,1,1,1,1)); | 
| 554 | 
  | 
   AddFrame(hframe, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,1,1,1,1)); | 
| 555 | 
  | 
   // Set a name to the main frame | 
| 556 | 
  | 
   SetWindowName("PAMELA Event Viewer control panel"); | 
| 557 | 
  | 
   // Map all subwindows of main frame | 
| 558 | 
  | 
   MapSubwindows(); | 
| 559 | 
  | 
   // Initialize the layout algorithm | 
| 560 | 
  | 
   Resize(GetDefaultSize()); | 
| 561 | 
  | 
   // Map main frame | 
| 562 | 
  | 
   MapWindow(); | 
| 563 | 
  | 
 } | 
| 564 | 
  | 
  | 
| 565 | 
  | 
 void PAMevcontrol::DIALOG(Int_t ty, TString warn){     | 
| 566 | 
  | 
     // | 
| 567 | 
  | 
     // ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR | 
| 568 | 
  | 
     // | 
| 569 | 
  | 
     Int_t retval; | 
| 570 | 
  | 
     TString title; | 
| 571 | 
  | 
     EMsgBoxIcon mb_icon = kMBIconStop; | 
| 572 | 
  | 
     if ( ty == 0 ){ | 
| 573 | 
  | 
         title="INFO"; | 
| 574 | 
  | 
         mb_icon = kMBIconAsterisk; | 
| 575 | 
  | 
     }; | 
| 576 | 
  | 
     if ( ty == 1 ){ | 
| 577 | 
  | 
         title="WARNING!"; | 
| 578 | 
  | 
         mb_icon = kMBIconExclamation; | 
| 579 | 
  | 
     }; | 
| 580 | 
  | 
     if ( ty == 2 ){ | 
| 581 | 
  | 
         title="ERROR!!"; | 
| 582 | 
  | 
         mb_icon = kMBIconStop; | 
| 583 | 
  | 
     }; | 
| 584 | 
  | 
     new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval); | 
| 585 | 
  | 
 } | 
| 586 | 
  | 
  | 
| 587 | 
  | 
  | 
| 588 | 
  | 
 void PAMevcontrol::SetFilename() { | 
| 589 | 
  | 
     TGTextEntry *entry = (TGTextEntry*)gTQSender; | 
| 590 | 
  | 
     TString text = entry->GetText(); | 
| 591 | 
  | 
     cvar->thefilename=text.Data(); | 
| 592 | 
  | 
     cvar->nevents = 0; | 
| 593 | 
  | 
     cvar->firstevno = 0; | 
| 594 | 
  | 
     cvar->lastevno = 0; | 
| 595 | 
  | 
     cvar->restart = true; | 
| 596 | 
  | 
     cvar->waitforever = false; | 
| 597 | 
  | 
 } | 
| 598 | 
  | 
  | 
| 599 | 
  | 
 void PAMevcontrol::SetFilter() { | 
| 600 | 
  | 
     TGTextEntry *entry = (TGTextEntry*)gTQSender; | 
| 601 | 
  | 
     TString text = entry->GetText(); | 
| 602 | 
  | 
     cvar->thefilter=text.Data(); | 
| 603 | 
  | 
     cvar->i--; | 
| 604 | 
  | 
     cvar->selex = false; | 
| 605 | 
  | 
     cvar->nevents = 0; | 
| 606 | 
  | 
     cvar->firstevno = 0; | 
| 607 | 
  | 
     cvar->lastevno = 0; | 
| 608 | 
  | 
     cvar->refresh = true; | 
| 609 | 
  | 
 } | 
| 610 | 
  | 
  | 
| 611 | 
  | 
 void PAMevcontrol::CompleteText() { | 
| 612 | 
  | 
     TGTextEntry *entry = (TGTextEntry*)gTQSender; | 
| 613 | 
  | 
     TString text = entry->GetText(); | 
| 614 | 
  | 
     Int_t curspos = entry->GetCursorPosition(); | 
| 615 | 
  | 
     Int_t ncurspos = 0; | 
| 616 | 
  | 
     TString textrem; | 
| 617 | 
  | 
     stringcopy(textrem,text,curspos,text.Length()); | 
| 618 | 
  | 
     text.Resize(curspos); | 
| 619 | 
  | 
     if ( !strcmp(text.Data(),"") ) { | 
| 620 | 
  | 
         stringstream ntext; | 
| 621 | 
  | 
         ntext.str(""); | 
| 622 | 
  | 
         ntext << gSystem->ExpandPathName("$HOME"); | 
| 623 | 
  | 
         text = ntext.str().c_str(); | 
| 624 | 
  | 
         curspos=ntext.str().length();    | 
| 625 | 
  | 
     }; | 
| 626 | 
  | 
     char *test = gSystem->ExpandPathName(text.Data()); | 
| 627 | 
  | 
     const char *dir = gSystem->DirName(test); | 
| 628 | 
  | 
     const char *base = gSystem->BaseName(test); | 
| 629 | 
  | 
     TString lbase = base; | 
| 630 | 
  | 
     Int_t lenbase = lbase.Length(); | 
| 631 | 
  | 
     TSystemDirectory *tsd = new TSystemDirectory("",dir); | 
| 632 | 
  | 
     TSystemFile *file; | 
| 633 | 
  | 
     TList *lsmatch = new TList; | 
| 634 | 
  | 
     Int_t numf = 0; | 
| 635 | 
  | 
     Int_t numgo = 0; | 
| 636 | 
  | 
     Int_t charmac = 0; | 
| 637 | 
  | 
     TString tbase; | 
| 638 | 
  | 
     Int_t k = 0; | 
| 639 | 
  | 
     stringstream newtext; | 
| 640 | 
  | 
     TSystemFile *mfile; | 
| 641 | 
  | 
     TSystemFile nfile; | 
| 642 | 
  | 
     TList *lsf = new TList; | 
| 643 | 
  | 
     const char *ctbase; | 
| 644 | 
  | 
     if ( !tsd->GetListOfFiles() ){ | 
| 645 | 
  | 
         gVirtualX->Bell(0); | 
| 646 | 
  | 
         goto end; | 
| 647 | 
  | 
     }; | 
| 648 | 
  | 
     lsf = tsd->GetListOfFiles(); | 
| 649 | 
  | 
     file = (TSystemFile*)lsf->First(); | 
| 650 | 
  | 
     // | 
| 651 | 
  | 
     while( (TSystemFile*)lsf->After(file) ){ | 
| 652 | 
  | 
         numf++; | 
| 653 | 
  | 
         file = (TSystemFile*)lsf->After(file); | 
| 654 | 
  | 
         if ( !strncmp(file->GetName(),base,lenbase) ){ | 
| 655 | 
  | 
             numgo++; | 
| 656 | 
  | 
             lsmatch->AddLast(file); | 
| 657 | 
  | 
             const char *ctbase = file->GetName(); | 
| 658 | 
  | 
             tbase = ctbase; | 
| 659 | 
  | 
             charmac = tbase.Length(); | 
| 660 | 
  | 
         }; | 
| 661 | 
  | 
     }; | 
| 662 | 
  | 
     newtext.str(""); | 
| 663 | 
  | 
     if ( numgo > 0 ){ | 
| 664 | 
  | 
       mfile = (TSystemFile*)lsmatch->First(); | 
| 665 | 
  | 
       ctbase = mfile->GetName();     | 
| 666 | 
  | 
       while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) { | 
| 667 | 
  | 
         mfile = (TSystemFile*)lsmatch->After(mfile);  | 
| 668 | 
  | 
         ctbase = mfile->GetName(); | 
| 669 | 
  | 
       }; | 
| 670 | 
  | 
       tbase = ctbase; | 
| 671 | 
  | 
       base = ctbase;     | 
| 672 | 
  | 
       charmac = tbase.Length();; | 
| 673 | 
  | 
       while( (TSystemFile*)lsmatch->After(mfile) ){ | 
| 674 | 
  | 
         mfile = (TSystemFile*)lsmatch->After(mfile);  | 
| 675 | 
  | 
         ctbase = mfile->GetName(); | 
| 676 | 
  | 
         while ( (!strcmp(ctbase,"..") || !strcmp(ctbase,".")) && (TSystemFile*)lsmatch->After(mfile) ) { | 
| 677 | 
  | 
           mfile = (TSystemFile*)lsmatch->After(mfile);  | 
| 678 | 
  | 
           ctbase = mfile->GetName(); | 
| 679 | 
  | 
         }; | 
| 680 | 
  | 
         tbase = ctbase; | 
| 681 | 
  | 
         k = 0; | 
| 682 | 
  | 
         for ( Int_t i=lenbase; i<=tbase.Length(); i++){ | 
| 683 | 
  | 
           if ( !strncmp(tbase.Data(),base,i) && strcmp(tbase.Data(),base) ){ | 
| 684 | 
  | 
             k = i; | 
| 685 | 
  | 
           }; | 
| 686 | 
  | 
         }; | 
| 687 | 
  | 
         if ( k <= charmac){ | 
| 688 | 
  | 
           charmac = k;           | 
| 689 | 
  | 
         }; | 
| 690 | 
  | 
       }; | 
| 691 | 
  | 
       gVirtualX->Bell(0); | 
| 692 | 
  | 
     }; | 
| 693 | 
  | 
     if ( !charmac ) { | 
| 694 | 
  | 
         gVirtualX->Bell(0); | 
| 695 | 
  | 
         goto end; | 
| 696 | 
  | 
     }; | 
| 697 | 
  | 
     tbase.Resize(charmac); | 
| 698 | 
  | 
     if ( !strcmp(dir,"") || !strcmp(dir,"/") ){ | 
| 699 | 
  | 
         newtext << "/" << tbase.Data(); | 
| 700 | 
  | 
     } else { | 
| 701 | 
  | 
         newtext << dir << "/" << tbase.Data(); | 
| 702 | 
  | 
     }; | 
| 703 | 
  | 
     nfile = TSystemFile(tbase.Data(),dir); | 
| 704 | 
  | 
     if ( nfile.IsDirectory() && numgo == 1 ) newtext << "/"; | 
| 705 | 
  | 
     ncurspos = newtext.str().length(); | 
| 706 | 
  | 
     if ( textrem.Length() ) newtext << textrem.Data();     | 
| 707 | 
  | 
     entry->SetText(newtext.str().c_str()); | 
| 708 | 
  | 
     entry->SetCursorPosition(ncurspos); | 
| 709 | 
  | 
  end: | 
| 710 | 
  | 
     lsf->Clear(); | 
| 711 | 
  | 
     lsmatch->Clear();     | 
| 712 | 
  | 
 } | 
| 713 | 
  | 
  | 
| 714 | 
  | 
 void PAMevcontrol::saveas() { | 
| 715 | 
  | 
     TString text = fText4->GetText(); | 
| 716 | 
  | 
     Int_t sel=fCombo->GetSelected(); | 
| 717 | 
  | 
     TString ty; | 
| 718 | 
  | 
     switch (sel){ | 
| 719 | 
  | 
     case (0): | 
| 720 | 
  | 
         ty = ".ps"; | 
| 721 | 
  | 
         break; | 
| 722 | 
  | 
     case (1): | 
| 723 | 
  | 
         ty = ".eps"; | 
| 724 | 
  | 
         break; | 
| 725 | 
  | 
     case (2): | 
| 726 | 
  | 
         ty = ".gif"; | 
| 727 | 
  | 
         break; | 
| 728 | 
  | 
     case (3): | 
| 729 | 
  | 
         ty = ".jpg"; | 
| 730 | 
  | 
         break; | 
| 731 | 
  | 
     case (4): | 
| 732 | 
  | 
         ty = ".tiff"; | 
| 733 | 
  | 
         break; | 
| 734 | 
  | 
     case (5): | 
| 735 | 
  | 
         ty = ".xpm"; | 
| 736 | 
  | 
         break; | 
| 737 | 
  | 
     case (6): | 
| 738 | 
  | 
         ty = ".pdf"; | 
| 739 | 
  | 
         break; | 
| 740 | 
  | 
     case (7): | 
| 741 | 
  | 
         ty = ".xml"; | 
| 742 | 
  | 
         break; | 
| 743 | 
  | 
     case (8): | 
| 744 | 
  | 
         ty = ".png"; | 
| 745 | 
  | 
         break; | 
| 746 | 
  | 
     case (9): | 
| 747 | 
  | 
         ty = ".svg"; | 
| 748 | 
  | 
         break; | 
| 749 | 
  | 
     case (10): | 
| 750 | 
  | 
         ty = ".root"; | 
| 751 | 
  | 
         break; | 
| 752 | 
  | 
     case (11): | 
| 753 | 
  | 
         ty = ".C"; | 
| 754 | 
  | 
         break; | 
| 755 | 
  | 
     }; | 
| 756 | 
  | 
     if ( sel == 0 ) ty = ".ps"; | 
| 757 | 
  | 
     stringstream name; | 
| 758 | 
  | 
     if ( strcmp(text.Data(),"") ){ | 
| 759 | 
  | 
         name.str(""); | 
| 760 | 
  | 
         name << text.Data(); | 
| 761 | 
  | 
         name << ty.Data(); | 
| 762 | 
  | 
         thefigure->SaveAs(name.str().c_str()); | 
| 763 | 
  | 
         name.str(""); | 
| 764 | 
  | 
         name << " Saved as "; | 
| 765 | 
  | 
         name << text.Data(); | 
| 766 | 
  | 
         name << ty.Data();     | 
| 767 | 
  | 
         DIALOG(0,name.str().c_str()); | 
| 768 | 
  | 
         printf(" Saved as %s%s \n",text.Data(),ty.Data()); | 
| 769 | 
  | 
     }; | 
| 770 | 
  | 
 } | 
| 771 | 
  | 
  | 
| 772 | 
  | 
 void PAMevcontrol::increment(float val) { | 
| 773 | 
  | 
     fHProg1->SetPosition(val); | 
| 774 | 
  | 
     fHProg1->DoRedraw(); | 
| 775 | 
  | 
     gSystem->ProcessEvents(); | 
| 776 | 
  | 
 } | 
| 777 | 
  | 
  | 
| 778 | 
  | 
 void PAMevcontrol::forcel0() { | 
| 779 | 
  | 
     if ( cvar->fl0 ) { | 
| 780 | 
  | 
         cvar->fl0 = false; | 
| 781 | 
  | 
     } else { | 
| 782 | 
  | 
         cvar->fl0 = true; | 
| 783 | 
  | 
     }; | 
| 784 | 
  | 
     cvar->alrforc = false; | 
| 785 | 
  | 
     cvar->i--; | 
| 786 | 
  | 
     cvar->nevents = 0; | 
| 787 | 
  | 
     cvar->firstevno = 0; | 
| 788 | 
  | 
     cvar->lastevno = 0; | 
| 789 | 
  | 
     cvar->refresh = true; | 
| 790 | 
  | 
 } | 
| 791 | 
  | 
  | 
| 792 | 
  | 
 void PAMevcontrol::clearselfi(){ | 
| 793 | 
  | 
     fText2->SetText("");    | 
| 794 | 
  | 
 } | 
| 795 | 
  | 
  | 
| 796 | 
  | 
 void PAMevcontrol::upgrnamfi(){ | 
| 797 | 
  | 
     fText4->SetText(cvar->svas.Data());    | 
| 798 | 
  | 
     fText4->SetCursorPosition(fText4->GetMaxLength()); | 
| 799 | 
  | 
 } | 
| 800 | 
  | 
  | 
| 801 | 
  | 
 void PAMevcontrol::jumpto() { | 
| 802 | 
  | 
     TGTextEntry *entry = (TGTextEntry*)gTQSender; | 
| 803 | 
  | 
     TString text = entry->GetText(); | 
| 804 | 
  | 
     Int_t j; | 
| 805 | 
  | 
     j = atoi(text.Data()); | 
| 806 | 
  | 
     if ( cvar->jumprog ){ | 
| 807 | 
  | 
         if ( j < 1 || j > cvar->nevents ) { | 
| 808 | 
  | 
             printf("\n You can choose between 1 and %i \n",(int)cvar->nevents); | 
| 809 | 
  | 
             stringstream warning; | 
| 810 | 
  | 
             warning.str(""); | 
| 811 | 
  | 
             warning << "You can choose between 1 and "; | 
| 812 | 
  | 
             warning << (int)cvar->nevents; | 
| 813 | 
  | 
             DIALOG(1,warning.str().c_str()); | 
| 814 | 
  | 
         } else {  | 
| 815 | 
  | 
             stringstream warning; | 
| 816 | 
  | 
             warning.str(""); | 
| 817 | 
  | 
             warning << "Jumping to progressive number "; | 
| 818 | 
  | 
             warning << j; | 
| 819 | 
  | 
             DIALOG(0,warning.str().c_str()); | 
| 820 | 
  | 
             printf("\n Jumping to progressive number %i\n\n",j); | 
| 821 | 
  | 
             cvar->i = j-2; | 
| 822 | 
  | 
             cvar->goon = true; | 
| 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 event number %i\n\n",j); | 
| 841 | 
  | 
             cvar->jumpto = j; | 
| 842 | 
  | 
             cvar->jumpen = true; | 
| 843 | 
  | 
             cvar->goon = true; | 
| 844 | 
  | 
         }; | 
| 845 | 
  | 
     }; | 
| 846 | 
  | 
     entry->SetText("");     | 
| 847 | 
  | 
 } | 
| 848 | 
  | 
  | 
| 849 | 
  | 
 void PAMevcontrol::radioevent() { | 
| 850 | 
  | 
     cvar->jumprog = false;     | 
| 851 | 
  | 
 } | 
| 852 | 
  | 
  | 
| 853 | 
  | 
 void PAMevcontrol::radioprog() { | 
| 854 | 
  | 
     cvar->jumprog = true;     | 
| 855 | 
  | 
 } | 
| 856 | 
  | 
  | 
| 857 | 
  | 
 void PAMevcontrol::radiocolor() { | 
| 858 | 
  | 
     if ( !cvar->goon ){ | 
| 859 | 
  | 
         if ( cvar->bw ) { | 
| 860 | 
  | 
             cvar->bw = 0; | 
| 861 | 
  | 
             cvar->i--; | 
| 862 | 
  | 
             cvar->goon = true; | 
| 863 | 
  | 
         }; | 
| 864 | 
  | 
     }; | 
| 865 | 
  | 
 } | 
| 866 | 
  | 
  | 
| 867 | 
  | 
 void PAMevcontrol::radiobw() { | 
| 868 | 
  | 
     if ( !cvar->goon ){ | 
| 869 | 
  | 
         if ( !cvar->bw ) { | 
| 870 | 
  | 
             cvar->bw = 1; | 
| 871 | 
  | 
             cvar->i--; | 
| 872 | 
  | 
             cvar->goon = true; | 
| 873 | 
  | 
         }; | 
| 874 | 
  | 
     }; | 
| 875 | 
  | 
 } | 
| 876 | 
  | 
  | 
| 877 | 
  | 
 void PAMevcontrol::radiotrack() { | 
| 878 | 
  | 
   if ( cvar->tracknds4 ) { | 
| 879 | 
  | 
     cvar->tracknds4 = 0; | 
| 880 | 
  | 
   } else { | 
| 881 | 
  | 
     cvar->tracknds4 = 1; | 
| 882 | 
  | 
   }; | 
| 883 | 
  | 
     cvar->i--; | 
| 884 | 
  | 
     cvar->goon = true; | 
| 885 | 
  | 
 } | 
| 886 | 
  | 
  | 
| 887 | 
  | 
 void PAMevcontrol::chktof() { | 
| 888 | 
  | 
   if ( cvar->TOF ) { | 
| 889 | 
  | 
     cvar->TOF = 0; | 
| 890 | 
  | 
   } else { | 
| 891 | 
  | 
     cvar->TOF = 1; | 
| 892 | 
  | 
   }; | 
| 893 | 
  | 
   cvar->i--; | 
| 894 | 
  | 
   cvar->nevents = 0; | 
| 895 | 
  | 
   cvar->firstevno = 0; | 
| 896 | 
  | 
   cvar->lastevno = 0; | 
| 897 | 
  | 
   cvar->refresh = true; | 
| 898 | 
  | 
 } | 
| 899 | 
  | 
  | 
| 900 | 
  | 
 void PAMevcontrol::chkac() { | 
| 901 | 
  | 
   if ( cvar->AC ) { | 
| 902 | 
  | 
     cvar->AC = 0; | 
| 903 | 
  | 
   } else { | 
| 904 | 
  | 
     cvar->AC = 1; | 
| 905 | 
  | 
   }; | 
| 906 | 
  | 
   cvar->i--; | 
| 907 | 
  | 
   cvar->nevents = 0; | 
| 908 | 
  | 
   cvar->firstevno = 0; | 
| 909 | 
  | 
   cvar->lastevno = 0; | 
| 910 | 
  | 
   cvar->refresh = true; | 
| 911 | 
  | 
 } | 
| 912 | 
  | 
  | 
| 913 | 
  | 
 void PAMevcontrol::chktrk() { | 
| 914 | 
  | 
   if ( cvar->TRK ) { | 
| 915 | 
  | 
     cvar->TRK = 0; | 
| 916 | 
  | 
   } else { | 
| 917 | 
  | 
     cvar->TRK = 1; | 
| 918 | 
  | 
   }; | 
| 919 | 
  | 
   cvar->i--; | 
| 920 | 
  | 
   cvar->nevents = 0; | 
| 921 | 
  | 
   cvar->firstevno = 0; | 
| 922 | 
  | 
   cvar->lastevno = 0; | 
| 923 | 
  | 
   cvar->refresh = true; | 
| 924 | 
  | 
 } | 
| 925 | 
  | 
  | 
| 926 | 
  | 
 void PAMevcontrol::chkcalo() { | 
| 927 | 
  | 
   if ( cvar->CALO ) { | 
| 928 | 
  | 
     cvar->CALO = 0; | 
| 929 | 
  | 
   } else { | 
| 930 | 
  | 
     cvar->CALO = 1; | 
| 931 | 
  | 
   }; | 
| 932 | 
  | 
   cvar->i--; | 
| 933 | 
  | 
   cvar->nevents = 0; | 
| 934 | 
  | 
   cvar->firstevno = 0; | 
| 935 | 
  | 
   cvar->lastevno = 0; | 
| 936 | 
  | 
   cvar->refresh = true; | 
| 937 | 
  | 
 } | 
| 938 | 
  | 
  | 
| 939 | 
  | 
 void PAMevcontrol::chks4() { | 
| 940 | 
  | 
   if ( cvar->S4 ) { | 
| 941 | 
  | 
     cvar->S4 = 0; | 
| 942 | 
  | 
   } else { | 
| 943 | 
  | 
     cvar->S4 = 1; | 
| 944 | 
  | 
   }; | 
| 945 | 
  | 
   cvar->i--; | 
| 946 | 
  | 
   cvar->nevents = 0; | 
| 947 | 
  | 
   cvar->firstevno = 0; | 
| 948 | 
  | 
   cvar->lastevno = 0; | 
| 949 | 
  | 
   cvar->refresh = true;   | 
| 950 | 
  | 
 } | 
| 951 | 
  | 
  | 
| 952 | 
  | 
 void PAMevcontrol::chknd() { | 
| 953 | 
  | 
   if ( cvar->ND ) { | 
| 954 | 
  | 
     cvar->ND = 0; | 
| 955 | 
  | 
   } else { | 
| 956 | 
  | 
     cvar->ND = 1; | 
| 957 | 
  | 
   }; | 
| 958 | 
  | 
   cvar->i--; | 
| 959 | 
  | 
   cvar->nevents = 0; | 
| 960 | 
  | 
   cvar->firstevno = 0; | 
| 961 | 
  | 
   cvar->lastevno = 0; | 
| 962 | 
  | 
   cvar->refresh = true; | 
| 963 | 
  | 
 } | 
| 964 | 
  | 
  | 
| 965 | 
  | 
 void PAMevcontrol::chkinfo() { | 
| 966 | 
  | 
   if ( cvar->INFOS ) { | 
| 967 | 
  | 
     cvar->INFOS = 0; | 
| 968 | 
  | 
   } else { | 
| 969 | 
  | 
     cvar->INFOS = 1; | 
| 970 | 
  | 
   }; | 
| 971 | 
  | 
   cvar->i--; | 
| 972 | 
  | 
   cvar->goon = true; | 
| 973 | 
  | 
 } | 
| 974 | 
  | 
  | 
| 975 | 
  | 
 void PAMevcontrol::chknames() { | 
| 976 | 
  | 
   if ( cvar->VINFOS ) { | 
| 977 | 
  | 
     cvar->VINFOS = 0; | 
| 978 | 
  | 
   } else { | 
| 979 | 
  | 
     cvar->VINFOS = 1; | 
| 980 | 
  | 
   }; | 
| 981 | 
  | 
   cvar->i--; | 
| 982 | 
  | 
   cvar->goon = true; | 
| 983 | 
  | 
 } | 
| 984 | 
  | 
  | 
| 985 | 
  | 
 void PAMevcontrol::chkpalette() { | 
| 986 | 
  | 
   if ( cvar->PALETTE ) { | 
| 987 | 
  | 
     cvar->PALETTE = 0; | 
| 988 | 
  | 
   } else { | 
| 989 | 
  | 
     cvar->PALETTE = 1; | 
| 990 | 
  | 
   }; | 
| 991 | 
  | 
   cvar->i--; | 
| 992 | 
  | 
   cvar->goon = true; | 
| 993 | 
  | 
 } | 
| 994 | 
  | 
  | 
| 995 | 
  | 
 void PAMevcontrol::next() { | 
| 996 | 
  | 
     if ( cvar->i == cvar->nevents-1  ) { | 
| 997 | 
  | 
         printf("This is the last event, you can't go forward! \n"); | 
| 998 | 
  | 
         DIALOG(1,"This is the last event!"); | 
| 999 | 
  | 
     } else { | 
| 1000 | 
  | 
         cvar->goon = true; | 
| 1001 | 
  | 
         cvar->doflag = 1; | 
| 1002 | 
  | 
     };     | 
| 1003 | 
  | 
 } | 
| 1004 | 
  | 
  | 
| 1005 | 
  | 
 void PAMevcontrol::stop() { | 
| 1006 | 
  | 
     DIALOG(1,"Stop searching"); | 
| 1007 | 
  | 
     cvar->doflag = 3; | 
| 1008 | 
  | 
 } | 
| 1009 | 
  | 
  | 
| 1010 | 
  | 
 void PAMevcontrol::prev() { | 
| 1011 | 
  | 
     if ( cvar->i > 0  ) { | 
| 1012 | 
  | 
         printf("WARNING: going backward!\n\n"); | 
| 1013 | 
  | 
         cvar->doflag = 2; | 
| 1014 | 
  | 
         cvar->goon = true; | 
| 1015 | 
  | 
     } else { | 
| 1016 | 
  | 
         printf("This is the first event, you can't go backward! \n"); | 
| 1017 | 
  | 
         DIALOG(1,"This is the first event!"); | 
| 1018 | 
  | 
     }; | 
| 1019 | 
  | 
 } | 
| 1020 | 
  | 
  | 
| 1021 | 
  | 
 void PAMevcontrol::Close() { | 
| 1022 | 
  | 
     Cleanup(); | 
| 1023 | 
  | 
     CloseWindow(); | 
| 1024 | 
  | 
 } | 
| 1025 | 
  | 
  | 
| 1026 | 
  | 
 void PAMevcontrol::Terminate() { | 
| 1027 | 
  | 
     Close(); | 
| 1028 | 
  | 
     gApplication->Terminate(0); | 
| 1029 | 
  | 
 } | 
| 1030 | 
  | 
  | 
| 1031 | 
  | 
 PAMevcontrol::~PAMevcontrol() { | 
| 1032 | 
  | 
   // Clean up used widgets: frames, buttons, layouthints | 
| 1033 | 
  | 
   Cleanup(); | 
| 1034 | 
  | 
   delete this; | 
| 1035 | 
  | 
 } | 
| 1036 | 
  | 
  | 
| 1037 | 
 //********************************************************************************** | 
 //********************************************************************************** | 
| 1038 | 
 //                           LEVEL0        SUBROUTINES                            // | 
 //                           LEVEL0        SUBROUTINES                            // | 
| 1039 | 
 //********************************************************************************** | 
 //********************************************************************************** | 
| 1149 | 
                         gDirectory->Delete(yevent.str().c_str()); | 
                         gDirectory->Delete(yevent.str().c_str()); | 
| 1150 | 
                         TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); | 
                         TH2F *Xview = new TH2F(xevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); | 
| 1151 | 
                         TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);       | 
                         TH2F *Yview = new TH2F(yevent.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);       | 
| 1152 | 
                         Int_t colo = 38; | 
                         Int_t colo; | 
| 1153 | 
  | 
                         if ( var.bw ){ | 
| 1154 | 
  | 
                             colo = 17; | 
| 1155 | 
  | 
                         } else { | 
| 1156 | 
  | 
                             colo = 38; | 
| 1157 | 
  | 
                         }; | 
| 1158 | 
                         Xview->SetFillColor(colo); | 
                         Xview->SetFillColor(colo); | 
| 1159 | 
                         Yview->SetFillColor(colo); | 
                         Yview->SetFillColor(colo); | 
| 1160 | 
                         if ( l == 0 ) { | 
                         if ( l == 0 ) { | 
| 1179 | 
 } | 
 } | 
| 1180 | 
  | 
  | 
| 1181 | 
 void ShowND(Int_t evno, TTree *otr, Variables & var){ | 
 void ShowND(Int_t evno, TTree *otr, Variables & var){ | 
| 1182 | 
     Int_t        tmpSize;     | 
     Int_t tmpSize;     | 
| 1183 | 
     Int_t yUpperTrig = 0; | 
     Int_t yUpperTrig = 0; | 
| 1184 | 
     Int_t yUpperBk = 0; | 
     Int_t yUpperBk = 0; | 
| 1185 | 
     Int_t yBottomBk = 0; | 
     Int_t yBottomBk = 0; | 
| 1567 | 
     }; | 
     }; | 
| 1568 | 
     // | 
     // | 
| 1569 | 
     // Draw crosses | 
     // Draw crosses | 
| 1570 | 
     // | 
     //     | 
| 1571 | 
     if ( ncro ) { | 
     if ( ncro && var.AC ) { | 
| 1572 | 
         trplv->cd(); | 
         trplv->cd(); | 
| 1573 | 
         trplv->Range(0.,0.,2076.,3100.); | 
         trplv->Range(0.,0.,2076.,3100.); | 
| 1574 | 
         for ( Int_t i = 0; i<ncro; i++){ | 
         for ( Int_t i = 0; i<ncro; i++){ | 
| 3724 | 
     var.nstrip=(int)calo->nstrip; | 
     var.nstrip=(int)calo->nstrip; | 
| 3725 | 
 } | 
 } | 
| 3726 | 
  | 
  | 
| 3727 | 
 void ShowTRKL1(Int_t evno, TTree *ttr1, Variables & var){ | 
 void ShowTRKL1(Int_t evno, TTree *ttr1, Variables & var, PAMevcontrol *pamgui){ | 
| 3728 | 
     // | 
     // | 
| 3729 | 
     Int_t syncro = 1; | 
     Int_t syncro = 1; | 
| 3730 | 
     Int_t itr = evno; | 
     Int_t itr = evno; | 
| 3737 | 
     settrklev1(ttr1,trk); | 
     settrklev1(ttr1,trk); | 
| 3738 | 
     if ( itr >= trnevents ){ | 
     if ( itr >= trnevents ){ | 
| 3739 | 
         printf(" WARNING: no more tracker level1 data.\n"); | 
         printf(" WARNING: no more tracker level1 data.\n"); | 
| 3740 | 
  | 
         pamgui->DIALOG(1," No more tracker level1 data "); | 
| 3741 | 
         nodata = 1; | 
         nodata = 1; | 
| 3742 | 
         goto goon; | 
         goto goon; | 
| 3743 | 
     }; | 
     }; | 
| 3748 | 
     if ( pktnum != ev2.pkt_num1 || obt != ev2.obt1 ){ | 
     if ( pktnum != ev2.pkt_num1 || obt != ev2.obt1 ){ | 
| 3749 | 
         if ( pktnum > ev2.pkt_num1 || obt > ev2.obt1 ){ | 
         if ( pktnum > ev2.pkt_num1 || obt > ev2.obt1 ){ | 
| 3750 | 
             itr++; | 
             itr++; | 
| 3751 | 
             if ( syncro ) printf(" WARNING: lost sync! try to recover... \n"); | 
             if ( syncro ){ | 
| 3752 | 
  | 
                 printf(" WARNING: lost sync! try to recover... \n"); | 
| 3753 | 
  | 
                 pamgui->DIALOG(1," Lost sync! try to recover "); | 
| 3754 | 
  | 
             }; | 
| 3755 | 
             syncro = 0;          | 
             syncro = 0;          | 
| 3756 | 
             goto trkcalosync; | 
             goto trkcalosync; | 
| 3757 | 
         }; | 
         }; | 
| 3758 | 
         if ( pktnum < ev2.pkt_num1 || obt < ev2.obt1 ){ | 
         if ( pktnum < ev2.pkt_num1 || obt < ev2.obt1 ){ | 
| 3759 | 
             printf(" WARNING: no tracker level2 data. \n"); | 
             printf(" WARNING: no tracker level2 data. \n"); | 
| 3760 | 
  | 
             pamgui->DIALOG(1," No more tracker level2 data "); | 
| 3761 | 
             nodata = 1; | 
             nodata = 1; | 
| 3762 | 
             goto goon; | 
             goto goon; | 
| 3763 | 
         }; | 
         }; | 
| 3764 | 
     }; | 
     }; | 
| 3765 | 
     // | 
     // | 
| 3766 | 
     if ( !syncro ) printf(" ...synchronization recovered! \n");  | 
     if ( !syncro ) { | 
| 3767 | 
  | 
         printf(" ...synchronization recovered! \n");  | 
| 3768 | 
  | 
         pamgui->DIALOG(0," Synchronization recovered! "); | 
| 3769 | 
  | 
     }; | 
| 3770 | 
     syncro = 1; | 
     syncro = 1; | 
| 3771 | 
     // | 
     // | 
| 3772 | 
  goon: struct Trklev1 ev; | 
  goon: struct Trklev1 ev; | 
| 3773 | 
     ev.good1 = (Bool_t)ev2.good1; | 
     ev.good1 = (Bool_t)ev2.good1; | 
| 3774 | 
     ev.nev1 = ev2.nev1; | 
     ev.nev1 = ev2.nev1; | 
| 3775 | 
  | 
     ev.whic_calib1 = ev2.whic_calib1; | 
| 3776 | 
  | 
     ev.swcode1 = ev2.swcode1; | 
| 3777 | 
     ev.pkt_type1 = ev2.pkt_type1; | 
     ev.pkt_type1 = ev2.pkt_type1; | 
| 3778 | 
     ev.pkt_num1 = ev2.pkt_num1; | 
     ev.pkt_num1 = ev2.pkt_num1; | 
| 3779 | 
     ev.obt1 = ev2.obt1; | 
     ev.obt1 = ev2.obt1; | 
| 3780 | 
     ev.which_calib1 = ev2.which_calib1; | 
     ev.cpu_crc1 = (Bool_t)ev2.cpu_crc1; | 
| 3781 | 
     ev.nclstr1 = ev2.nclstr1; | 
     ev.nclstr1 = ev2.nclstr1; | 
| 3782 | 
     ev.totcllength = ev2.totcllength; | 
     ev.totcllength = ev2.totcllength; | 
| 3783 | 
     for ( Int_t ii = 0 ; ii<8500; ii++){ | 
     for ( Int_t ii = 0 ; ii<8500; ii++){ | 
| 3793 | 
         ev.indmax[ii] = (Int_t)ev2.indmax[ii]; | 
         ev.indmax[ii] = (Int_t)ev2.indmax[ii]; | 
| 3794 | 
     }; | 
     }; | 
| 3795 | 
     for ( Int_t ii = 0 ; ii<12 ; ii++){ | 
     for ( Int_t ii = 0 ; ii<12 ; ii++){ | 
| 3796 | 
  | 
         ev.crc1[ii] = ev2.crc1[ii];    | 
| 3797 | 
         for ( Int_t ij = 0 ; ij<24 ; ij++){      | 
         for ( Int_t ij = 0 ; ij<24 ; ij++){      | 
| 3798 | 
             ev.cnev[ij][ii] = ev2.cnev[ii][ij]; | 
             ev.cnev[ij][ii] = ev2.cnev[ii][ij]; | 
| 3799 | 
         }; | 
         }; | 
| 3944 | 
             linea = new TLine(-7.05,10.,7.05,10.); | 
             linea = new TLine(-7.05,10.,7.05,10.); | 
| 3945 | 
             linea1y = new TLine(0.,10.,0.,30.);      | 
             linea1y = new TLine(0.,10.,0.,30.);      | 
| 3946 | 
         }; | 
         }; | 
| 3947 | 
         linea->SetLineWidth(4); | 
         linea->SetLineWidth(2); | 
| 3948 | 
         linea->SetLineColor(linecol); | 
         linea->SetLineColor(linecol); | 
| 3949 | 
         linea->Draw(); | 
         linea->Draw(); | 
| 3950 | 
         if ( l%2 ) {  | 
         if ( l%2 ) {  | 
| 4084 | 
     // | 
     // | 
| 4085 | 
     // Draw crosses | 
     // Draw crosses | 
| 4086 | 
     // | 
     // | 
| 4087 | 
     trplv->cd(); | 
     if ( var.AC ) { | 
| 4088 | 
     trplv->Range(-7.05,-8.1,7.05,8.1); | 
         trplv->cd(); | 
| 4089 | 
     for ( Int_t i = 0; i<6; i++){ | 
         trplv->Range(-7.05,-8.1,7.05,8.1); | 
| 4090 | 
         if ( mask[i] ){ | 
         for ( Int_t i = 0; i<6; i++){ | 
| 4091 | 
             // | 
             if ( mask[i] ){ | 
| 4092 | 
             Float_t cdx = (0.55/mag[i])*var.sfx; | 
                 // | 
| 4093 | 
             Float_t cdy = (0.55/mag[i])*var.sfy; | 
                 Float_t cdx = (0.55/mag[i])*var.sfx; | 
| 4094 | 
             Float_t lwx = (0.019)*var.sfy; | 
                 Float_t cdy = (0.55/mag[i])*var.sfy; | 
| 4095 | 
             Float_t lwy = (0.019)*var.sfx; | 
                 Float_t lwx = (0.019)*var.sfy; | 
| 4096 | 
             // | 
                 Float_t lwy = (0.019)*var.sfx; | 
| 4097 | 
             linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy); | 
                 // | 
| 4098 | 
             linea->SetLineWidth((int)lwx); | 
                 linea = new TLine(yh1[i]-lwx/2.,xh[i]-cdy,yh1[i]-lwx/2.,xh[i]+cdy); | 
| 4099 | 
             linea->SetLineColor(sigcol1); | 
                 linea->SetLineWidth((int)lwx); | 
| 4100 | 
             linea->Draw(); | 
                 linea->SetLineColor(sigcol1); | 
| 4101 | 
             linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.); | 
                 linea->Draw(); | 
| 4102 | 
             linea->SetLineWidth((int)lwy); | 
                 linea = new TLine(yh1[i]-cdx,xh[i]-lwy/2.,yh1[i]+cdx,xh[i]-lwy/2.); | 
| 4103 | 
             linea->SetLineColor(sigcol1); | 
                 linea->SetLineWidth((int)lwy); | 
| 4104 | 
             linea->Draw(); | 
                 linea->SetLineColor(sigcol1); | 
| 4105 | 
             // | 
                 linea->Draw(); | 
| 4106 | 
             linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy); | 
                 // | 
| 4107 | 
             linea->SetLineWidth((int)lwx); | 
                 linea = new TLine(yh2[i]-lwx/2.,xh[i]-cdy,yh2[i]-lwx/2.,xh[i]+cdy); | 
| 4108 | 
             linea->SetLineColor(sigcol2); | 
                 linea->SetLineWidth((int)lwx); | 
| 4109 | 
             linea->Draw(); | 
                 linea->SetLineColor(sigcol2); | 
| 4110 | 
             linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.); | 
                 linea->Draw(); | 
| 4111 | 
             linea->SetLineWidth((int)lwy); | 
                 linea = new TLine(yh2[i]-cdy,xh[i]-lwy/2.,yh2[i]+cdx,xh[i]-lwy/2.); | 
| 4112 | 
             linea->SetLineColor(sigcol2); | 
                 linea->SetLineWidth((int)lwy); | 
| 4113 | 
             linea->Draw(); | 
                 linea->SetLineColor(sigcol2); | 
| 4114 | 
  | 
                 linea->Draw(); | 
| 4115 | 
  | 
             }; | 
| 4116 | 
         }; | 
         }; | 
| 4117 | 
     }; | 
     }; | 
| 4118 | 
 } | 
 } | 
| 4798 | 
     // | 
     // | 
| 4799 | 
 } | 
 } | 
| 4800 | 
  | 
  | 
| 4801 | 
 void ShowTOFL1(Int_t j, TTree *toftr, Variables & var){ | 
 void ShowTOFL1(Int_t j, TTree *toftr, Variables & var, PAMevcontrol *pamgui){ | 
| 4802 | 
     // | 
     // | 
| 4803 | 
     for (Int_t i=0 ; i<5; i++){ | 
     for (Int_t i=0 ; i<5; i++){ | 
| 4804 | 
         var.beta[i] = 0.; | 
         var.beta[i] = 0.; | 
| 4814 | 
     Int_t obt = 0; | 
     Int_t obt = 0; | 
| 4815 | 
  trkcalosync: if ( itr >= trnevents ){ | 
  trkcalosync: if ( itr >= trnevents ){ | 
| 4816 | 
         printf(" WARNING: no more tof level1 data.\n"); | 
         printf(" WARNING: no more tof level1 data.\n"); | 
| 4817 | 
  | 
         pamgui->DIALOG(1," No more tof level1 data "); | 
| 4818 | 
         return; | 
         return; | 
| 4819 | 
  | 
     } else { | 
| 4820 | 
  | 
         if ( !var.nosig ) toftr->GetEntry(itr); | 
| 4821 | 
     }; | 
     }; | 
 | 
     if ( !var.nosig ) toftr->GetEntry(itr); | 
  | 
| 4822 | 
     pktnum = var.headc; | 
     pktnum = var.headc; | 
| 4823 | 
     obt = var.etime; | 
     obt = var.etime; | 
| 4824 | 
     if ( pktnum != ntof.pkt_num || obt != ntof.obt ){ | 
     if ( pktnum != ntof.pkt_num || obt != ntof.obt ){ | 
| 4825 | 
         if ( pktnum > ntof.pkt_num || obt > ntof.obt ){ | 
         if ( pktnum > ntof.pkt_num || obt > ntof.obt ){ | 
| 4826 | 
             itr++; | 
             itr++; | 
| 4827 | 
             if ( syncro ) printf(" WARNING: lost sync! try to recover... \n"); | 
             if ( syncro ){ | 
| 4828 | 
  | 
                 printf(" WARNING: lost sync! try to recover... \n"); | 
| 4829 | 
  | 
                 pamgui->DIALOG(1," Lost sync! try to recover "); | 
| 4830 | 
  | 
             }; | 
| 4831 | 
             syncro = 0;          | 
             syncro = 0;          | 
| 4832 | 
             goto trkcalosync; | 
             goto trkcalosync; | 
| 4833 | 
         }; | 
         }; | 
| 4834 | 
         if ( pktnum < ntof.pkt_num || obt < ntof.obt ){ | 
         if ( pktnum < ntof.pkt_num || obt < ntof.obt ){ | 
| 4835 | 
             printf(" WARNING: no tof level1 data. \n"); | 
             printf(" WARNING: no tof level1 data. \n"); | 
| 4836 | 
  | 
             pamgui->DIALOG(1," No more tof level1 data "); | 
| 4837 | 
             return; | 
             return; | 
| 4838 | 
         }; | 
         }; | 
| 4839 | 
     }; | 
     }; | 
| 4840 | 
     // | 
     // | 
| 4841 | 
     if ( !syncro ) printf(" ...synchronization recovered! \n");             | 
     if ( !syncro ){ | 
| 4842 | 
  | 
         printf(" ...synchronization recovered! \n");        | 
| 4843 | 
  | 
         pamgui->DIALOG(0," Synchronization recovered! "); | 
| 4844 | 
  | 
     }; | 
| 4845 | 
     syncro = 1; | 
     syncro = 1; | 
| 4846 | 
     // | 
     // | 
| 4847 | 
     if ( !var.nosig ) { | 
     if ( !var.nosig ) { | 
| 5438 | 
 //                           LEVEL2        SUBROUTINES                            // | 
 //                           LEVEL2        SUBROUTINES                            // | 
| 5439 | 
 //********************************************************************************** | 
 //********************************************************************************** | 
| 5440 | 
  | 
  | 
| 5441 | 
 void ShowTRACK(Int_t evno, TTree *ttr, Variables & var){ | 
 void ShowTRACK(Int_t evno, TTree *ttr, Variables & var, PAMevcontrol *pamgui){ | 
| 5442 | 
     // | 
     // | 
| 5443 | 
     var.rig = 0.; | 
     var.rig = 0.; | 
| 5444 | 
     var.chi2 = 0.; | 
     var.chi2 = 0.; | 
| 5453 | 
     Int_t obt = 0; | 
     Int_t obt = 0; | 
| 5454 | 
  trkcalosync: if ( itr >= trnevents ){ | 
  trkcalosync: if ( itr >= trnevents ){ | 
| 5455 | 
         printf(" WARNING: no more tracker level2 data.\n"); | 
         printf(" WARNING: no more tracker level2 data.\n"); | 
| 5456 | 
  | 
         pamgui->DIALOG(1," No more tracker level2 data "); | 
| 5457 | 
         return; | 
         return; | 
| 5458 | 
     }; | 
     }; | 
| 5459 | 
     if ( !var.nosig ) ttr->GetEntry(itr); | 
     if ( !var.nosig ) ttr->GetEntry(itr); | 
| 5462 | 
     if ( pktnum != trk.pkt_num || obt != trk.obt ){ | 
     if ( pktnum != trk.pkt_num || obt != trk.obt ){ | 
| 5463 | 
         if ( pktnum > trk.pkt_num || obt > trk.obt ){ | 
         if ( pktnum > trk.pkt_num || obt > trk.obt ){ | 
| 5464 | 
             itr++; | 
             itr++; | 
| 5465 | 
             if ( syncro ) printf(" WARNING: lost sync! try to recover... \n"); | 
             if ( syncro ) { | 
| 5466 | 
  | 
                 printf(" WARNING: lost sync! try to recover... \n"); | 
| 5467 | 
  | 
                 pamgui->DIALOG(1," Lost sync! try to recover "); | 
| 5468 | 
  | 
             }; | 
| 5469 | 
             syncro = 0;          | 
             syncro = 0;          | 
| 5470 | 
             goto trkcalosync; | 
             goto trkcalosync; | 
| 5471 | 
         }; | 
         }; | 
| 5472 | 
         if ( pktnum < trk.pkt_num || obt < trk.obt ){ | 
         if ( pktnum < trk.pkt_num || obt < trk.obt ){ | 
| 5473 | 
             printf(" WARNING: no tracker level2 data. \n"); | 
             printf(" WARNING: no tracker level2 data. \n"); | 
| 5474 | 
  | 
             pamgui->DIALOG(1," No more tracker level2 data "); | 
| 5475 | 
             return; | 
             return; | 
| 5476 | 
         }; | 
         }; | 
| 5477 | 
     }; | 
     }; | 
| 5478 | 
     // | 
     // | 
| 5479 | 
     if ( !syncro ) printf(" ...synchronization recovered! \n");             | 
     if ( !syncro ){ | 
| 5480 | 
  | 
         printf(" ...synchronization recovered! \n");        | 
| 5481 | 
  | 
         pamgui->DIALOG(0," Synchronization recovered! "); | 
| 5482 | 
  | 
     }; | 
| 5483 | 
     // | 
     // | 
| 5484 | 
     if ( trk.ntrk > 0 ){ | 
     if ( trk.ntrk > 0 ){ | 
| 5485 | 
         Int_t l = 0; | 
         Int_t l = 0; | 
| 5613 | 
                 // | 
                 // | 
| 5614 | 
                 // Plane View | 
                 // Plane View | 
| 5615 | 
                 // | 
                 // | 
| 5616 | 
                 TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1); | 
                 if ( var.AC ){ | 
| 5617 | 
                 trackp1->SetLineColor(trcol); | 
                     TPolyLine *trackp1 = new TPolyLine(50,ptx1,pty1); | 
| 5618 | 
                 trackp1->SetLineWidth(1); | 
                     trackp1->SetLineColor(trcol); | 
| 5619 | 
                 trackp1->Draw(); | 
                     trackp1->SetLineWidth(1); | 
| 5620 | 
                 //printf("sto stapando trk ntrk %i image %i trcol %i \n",trk.ntrk,trk.image[l],trcol); | 
                     trackp1->Draw(); | 
| 5621 | 
                 TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2); | 
                     TPolyLine *trackp2 = new TPolyLine(50,ptx2,pty2); | 
| 5622 | 
                 trackp2->SetLineColor(trcol); | 
                     trackp2->SetLineColor(trcol); | 
| 5623 | 
                 trackp2->SetLineWidth(1); | 
                     trackp2->SetLineWidth(1); | 
| 5624 | 
                 trackp2->SetLineStyle(3); | 
                     trackp2->SetLineStyle(3); | 
| 5625 | 
                 trackp2->Draw(); | 
                     trackp2->Draw(); | 
| 5626 | 
  | 
                 }; | 
| 5627 | 
  | 
                 // | 
| 5628 | 
  | 
                 // Dots on measured points | 
| 5629 | 
  | 
                 // | 
| 5630 | 
  | 
                 TEllipse *elli; | 
| 5631 | 
  | 
                 Float_t x; | 
| 5632 | 
  | 
                 Float_t y; | 
| 5633 | 
  | 
                 Float_t z1; | 
| 5634 | 
  | 
                 Float_t z2; | 
| 5635 | 
  | 
                 Int_t dcol; | 
| 5636 | 
  | 
                 if ( var.bw ){ | 
| 5637 | 
  | 
                     dcol = 12; | 
| 5638 | 
  | 
                         } else { | 
| 5639 | 
  | 
                     dcol = 2; | 
| 5640 | 
  | 
                 }; | 
| 5641 | 
  | 
                 for (Int_t g = 0; g<6; g++){ | 
| 5642 | 
  | 
                     if ( trk.xgood[l][g] ) { | 
| 5643 | 
  | 
                         x = trk.xm[l][g]*var.sfx/100. + var.xxvc; | 
| 5644 | 
  | 
                         z1 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yxvc;                    | 
| 5645 | 
  | 
                         elli = new TEllipse(x,z1,0.004,0.004,0.,-180.); | 
| 5646 | 
  | 
                         elli->SetFillStyle(1001); | 
| 5647 | 
  | 
                         elli->SetFillColor(dcol); | 
| 5648 | 
  | 
                         elli->Draw(); | 
| 5649 | 
  | 
                     }; | 
| 5650 | 
  | 
                     if ( trk.ygood[l][g] ) { | 
| 5651 | 
  | 
                         y = trk.ym[l][g]*var.sfx/100. + var.xyvc; | 
| 5652 | 
  | 
                         z2 = (trk.zm[l][g]+11.2)*var.sfy/100. + var.yyvc;                    | 
| 5653 | 
  | 
                         elli = new TEllipse(y,z2,0.004,0.004,0.,-180.); | 
| 5654 | 
  | 
                         elli->SetFillStyle(1001); | 
| 5655 | 
  | 
                         elli->SetFillColor(dcol); | 
| 5656 | 
  | 
                         elli->Draw(); | 
| 5657 | 
  | 
                     }; | 
| 5658 | 
  | 
                 }; | 
| 5659 | 
  | 
                 // | 
| 5660 | 
  | 
                 // | 
| 5661 | 
             } else { | 
             } else { | 
| 5662 | 
  | 
                 pamgui->DIALOG(1," Failed in determining the track! "); | 
| 5663 | 
                 printf(" WARNING: failed in determining the track! \n"); | 
                 printf(" WARNING: failed in determining the track! \n"); | 
| 5664 | 
             }; | 
             }; | 
| 5665 | 
             l++; | 
             l++; | 
| 5921 | 
  | 
  | 
| 5922 | 
  | 
  | 
| 5923 | 
 void ShowPalette(Int_t bw){ | 
 void ShowPalette(Int_t bw){ | 
| 5924 | 
     Float_t xp = 0.33; | 
     Float_t xp = 0.40; | 
| 5925 | 
     Float_t yp = 0.02; | 
     Float_t yp = 0.02; | 
| 5926 | 
     Float_t xw = 0.35; | 
     Float_t xw = 0.2325; | 
| 5927 | 
     Float_t yh = 0.19; | 
     Float_t yh = 0.19; | 
| 5928 | 
  | 
     //    Float_t xp = 0.33; | 
| 5929 | 
  | 
     //Float_t yp = 0.02; | 
| 5930 | 
  | 
     //Float_t xw = 0.35; | 
| 5931 | 
  | 
     //Float_t yh = 0.19; | 
| 5932 | 
     Double_t xx[5] = {xp, xp+xw, xp+xw, xp, xp}; | 
     Double_t xx[5] = {xp, xp+xw, xp+xw, xp, xp}; | 
| 5933 | 
     Double_t yy[5] = {yp, yp, yp+yh, yp+yh, yp}; | 
     Double_t yy[5] = {yp, yp, yp+yh, yp+yh, yp}; | 
| 5934 | 
     TPolyLine *fpale = new TPolyLine(5,xx,yy); | 
     TPolyLine *fpale = new TPolyLine(5,xx,yy); | 
| 5939 | 
     txt->SetTextSize(0.01); | 
     txt->SetTextSize(0.01); | 
| 5940 | 
     txt->DrawLatex(xp+0.005,yp+yh-0.015,"PALETTE"); | 
     txt->DrawLatex(xp+0.005,yp+yh-0.015,"PALETTE"); | 
| 5941 | 
     txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, CALO, S4 [MIP]:"); | 
     txt->DrawLatex(xp+0.005,yp+yh-0.04,"TOF, CALO, S4 [MIP]:"); | 
| 5942 | 
     Float_t xwc = (xp+0.01)/6.; | 
     //    Float_t xwc = (xp+0.01)/6.; | 
| 5943 | 
  | 
     Float_t xwc = (xw-0.01)/6.; | 
| 5944 | 
  | 
     Float_t axwc = xwc+0.02; | 
| 5945 | 
     Float_t yhc = 0.03;     | 
     Float_t yhc = 0.03;     | 
| 5946 | 
     Int_t colo = 0; | 
     Int_t colo = 0; | 
| 5947 | 
     Float_t yc = 0.135; | 
     Float_t yc = 0.135; | 
| 5948 | 
     TPolyLine *fc1[6]; | 
     TPolyLine *fc1[6]; | 
| 5949 | 
     if ( bw ){ | 
     if ( bw ){ | 
| 5950 | 
         for ( Int_t j=0; j<6; j++){ | 
         for ( Int_t j=0; j<6; j++){ | 
| 5951 | 
             Float_t xc = 0.335+(j*xwc); | 
             //      Float_t xc = 0.335+(j*xwc); | 
| 5952 | 
  | 
             Float_t xc = 0.005+xp+(j*xwc); | 
| 5953 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
| 5954 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 5955 | 
             fc1[j] = new TPolyLine(5,xx,yy); | 
             fc1[j] = new TPolyLine(5,xx,yy); | 
| 6000 | 
         Float_t yc = 0.08; | 
         Float_t yc = 0.08; | 
| 6001 | 
         TPolyLine *fc2[6]; | 
         TPolyLine *fc2[6]; | 
| 6002 | 
         for ( Int_t j=0; j<6; j++){ | 
         for ( Int_t j=0; j<6; j++){ | 
| 6003 | 
             Float_t xc = 0.335+(j*xwc); | 
             Float_t xc = 0.005+xp+(j*xwc); | 
| 6004 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
| 6005 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 6006 | 
             fc2[j] = new TPolyLine(5,xx,yy); | 
             fc2[j] = new TPolyLine(5,xx,yy); | 
| 6051 | 
         yc = 0.025; | 
         yc = 0.025; | 
| 6052 | 
         TPolyLine *fc3[3]; | 
         TPolyLine *fc3[3]; | 
| 6053 | 
         for ( Int_t j=0; j<3; j++){ | 
         for ( Int_t j=0; j<3; j++){ | 
| 6054 | 
             Float_t xc = 0.335+(j*xwc); | 
             Float_t xc = 0.005+xp+(j*axwc); | 
| 6055 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc}; | 
| 6056 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 6057 | 
             fc3[j] = new TPolyLine(5,xx,yy); | 
             fc3[j] = new TPolyLine(5,xx,yy); | 
| 6058 | 
             fc3[j]->SetLineColor(1); | 
             fc3[j]->SetLineColor(1); | 
| 6083 | 
         }; | 
         }; | 
| 6084 | 
     } else { | 
     } else { | 
| 6085 | 
         for ( Int_t j=0; j<6; j++){ | 
         for ( Int_t j=0; j<6; j++){ | 
| 6086 | 
             Float_t xc = 0.335+(j*xwc); | 
             Float_t xc = 0.005+xp+(j*xwc); | 
| 6087 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
| 6088 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 6089 | 
             fc1[j] = new TPolyLine(5,xx,yy); | 
             fc1[j] = new TPolyLine(5,xx,yy); | 
| 6134 | 
         Float_t yc = 0.08; | 
         Float_t yc = 0.08; | 
| 6135 | 
         TPolyLine *fc2[6]; | 
         TPolyLine *fc2[6]; | 
| 6136 | 
         for ( Int_t j=0; j<6; j++){ | 
         for ( Int_t j=0; j<6; j++){ | 
| 6137 | 
             Float_t xc = 0.335+(j*xwc); | 
             Float_t xc = 0.005+xp+(j*xwc); | 
| 6138 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
| 6139 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 6140 | 
             fc2[j] = new TPolyLine(5,xx,yy); | 
             fc2[j] = new TPolyLine(5,xx,yy); | 
| 6185 | 
         yc = 0.025; | 
         yc = 0.025; | 
| 6186 | 
         TPolyLine *fc3[3]; | 
         TPolyLine *fc3[3]; | 
| 6187 | 
         for ( Int_t j=0; j<3; j++){ | 
         for ( Int_t j=0; j<3; j++){ | 
| 6188 | 
             Float_t xc = 0.335+(j*xwc); | 
             Float_t xc = 0.005+xp+(j*axwc); | 
| 6189 | 
             Double_t xx[5] = {xc, xc+xwc, xc+xwc, xc, xc}; | 
             Double_t xx[5] = {xc, xc+axwc, xc+axwc, xc, xc}; | 
| 6190 | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
             Double_t yy[5] = {yc, yc, yc+yhc, yc+yhc, yc}; | 
| 6191 | 
             fc3[j] = new TPolyLine(5,xx,yy); | 
             fc3[j] = new TPolyLine(5,xx,yy); | 
| 6192 | 
             fc3[j]->SetLineColor(1); | 
             fc3[j]->SetLineColor(1); | 
| 6248 | 
         x1->Draw(); | 
         x1->Draw(); | 
| 6249 | 
     }; | 
     }; | 
| 6250 | 
 } | 
 } | 
 | 
 // | 
  | 
 | 
 // | 
  | 
 | 
 // | 
  | 
 | 
 void ShowHelp(){ | 
  | 
 | 
     char input[256]; | 
  | 
 | 
     printf("\n USE:\n\n The only input needed is the path to the directory (\"filename\") created by YODA\n for the data file you want to analyze.\n Standard use:\n  root[0] .L ShowEvent.c\n  root[1] ShowEvent(\"/home/dati/filesFromYoda/DW_050112_00600/\");\n \n\n\n\n\n\n"); | 
  | 
 | 
     printf("Press <enter> to continue\n"); | 
  | 
 | 
     cin.getline(input,256); | 
  | 
 | 
     printf(" FEATURES:\n\n  ShowEvent(TString filename, Int_t fromevent = 0, Int_t toevent = 0,\n             TString selfile = \"\", Int_t FORCELEVEL = -1,\n            Int_t ctrlword = 509, Int_t BW=0, TString outDir = \"\",\n            TString calcalibfile = \"\")\n  Input variables\n   *  fromevent = the first event to be shown (0 means \"show all\")\n"); | 
  | 
 | 
     printf("   *  toevent = the last event to be shown (NB: if fromevent differs from zero\n                and toevent is equal zero only one event will be shown,\n                number \"fromevent\")\n\n\n\n"); | 
  | 
 | 
     printf("Press <enter> to continue\n"); | 
  | 
 | 
     cin.getline(input,256); | 
  | 
 | 
     printf("   *  ctrword is an integer which can be used as a mask to customize the figure:\n           ctrword bit:    10    9    8    7     6    5     4    3      2     1   \n      detector   : special TOF   AC  TRK  CALO   S4    ND  infos names legenda\n      Examples:\n           ctrword = 509 = 0111111101 : all detectors+infos are printed(DEFAULT)\n           ctrword = 511 = 0111111111 : show all\n           ctrword = 505 = 0111111001 : don't print infos on figure\n           ctrword = 507 = 0111111011 : show detector names+legenda (no infos)\n           ctrword = 8   = 0000001000 : show only ND\n           ctrword = 1019 = 1111111011 : show all but infos without signals\n\n"); | 
  | 
 | 
     printf("Press <enter> to continue\n"); | 
  | 
 | 
     cin.getline(input,256); | 
  | 
 | 
     printf("\n\n      When the \"special\" bit is set NO SIGNAL will be shown in the detectors.\n      It can be used to draw a draft of the PAMELA apparatus without any event.\n "); | 
  | 
 | 
     printf("   *  selfile = selection file. Can be used to select events.\n                Default is \"\" that is no selection applied.\n"); | 
  | 
 | 
     printf("   *  FORCELEVEL = to force a certain level visualization.\n                   For the moment only level0 can be forced.\n"); | 
  | 
 | 
     printf("   *  BW = 0 flag to display black and white figures.\n             Default is 0, colours, set it to 1 to have BW visualization.\n"); | 
  | 
 | 
     printf("   *  outDir = directory where to place figures (if you want to print them).\n               Default is \"filename\".\n\n"); | 
  | 
 | 
     printf("Press <enter> to continue\n"); | 
  | 
 | 
     cin.getline(input,256); | 
  | 
 | 
     printf("   *  calcalibfile = the calorimeter needs a calibration to display events. If a\n                     calibration is not in the file you want to analylze put \n                      here the path to a directory created by YODA for a data \n                     file with calorimeter calibration. Default is \"filename\".\n"); | 
  | 
 | 
     printf("\n\n For further informations read the README.ShowEvent file.\n"); | 
  | 
 | 
     return; | 
  | 
 | 
 } | 
  | 
| 6251 | 
  | 
  | 
| 6252 | 
 // | 
 // | 
| 6253 | 
 // MAIN ROUTINE | 
 // MAIN ROUTINE | 
| 6254 | 
 // | 
 // | 
| 6255 | 
 void ShowEvent(TString filename="help", TString selfile="", Int_t ctrlword = 509, Int_t FORCELEV = -1, Int_t fromevent = 0, Int_t toevent = 0, TString outDir = ""){ | 
 void ShowEvent(TString filename="help", TString selfile="", Int_t ctrlword = 509, Int_t FORCELEV = -1, Int_t fromevent = 0, Int_t toevent = 0, TString outDir = ""){ | 
 | 
     gROOT->GetListOfCanvases()->Delete(); | 
  | 
 | 
     gDirectory->GetList()->Delete(); | 
  | 
| 6256 | 
     TString calcalibfile = ""; | 
     TString calcalibfile = ""; | 
| 6257 | 
     TString startingdir = gSystem->WorkingDirectory(); | 
     TString startingdir = gSystem->WorkingDirectory(); | 
| 6258 | 
     const char* startingdir2 = gSystem->WorkingDirectory(); | 
     const char* startingdir2 = gSystem->WorkingDirectory(); | 
| 6259 | 
     TString path; | 
     TString path; | 
| 6260 | 
     stringcopy(path,startingdir2); | 
     stringcopy(path,startingdir2); | 
 | 
     Int_t BW = 0; | 
  | 
| 6261 | 
 #if defined (__CINT__)   | 
 #if defined (__CINT__)   | 
| 6262 | 
     emicheckLib(); | 
     emicheckLib(); | 
| 6263 | 
     const char *pamlib=gSystem->Getenv("PAM_LIB"); | 
     const char *pamlib=gSystem->Getenv("PAM_LIB"); | 
| 6281 | 
     stringstream calfile; | 
     stringstream calfile; | 
| 6282 | 
     calfile.str(""); | 
     calfile.str(""); | 
| 6283 | 
     calfile << pam_calib << "/CaloADC2MIP.root"; | 
     calfile << pam_calib << "/CaloADC2MIP.root"; | 
| 6284 | 
  | 
     Int_t selection = 0; | 
| 6285 | 
  | 
     Bool_t firsttime = true; | 
| 6286 | 
  | 
     // | 
| 6287 | 
  | 
     // | 
| 6288 | 
  | 
  restart: | 
| 6289 | 
  | 
     gROOT->GetListOfCanvases()->Delete(); | 
| 6290 | 
  | 
     gDirectory->GetList()->Delete(); | 
| 6291 | 
  | 
     // | 
| 6292 | 
  | 
     struct Variables var; | 
| 6293 | 
  | 
     Bool_t loadselfs = true; | 
| 6294 | 
  | 
     Bool_t popup = false; | 
| 6295 | 
  | 
     PAMevcontrol *pamgui = 0; | 
| 6296 | 
  | 
     var.restart = false; | 
| 6297 | 
  | 
     var.waitforever = false; | 
| 6298 | 
  | 
     var.jumprog = true; | 
| 6299 | 
  | 
     var.jumpen = false; | 
| 6300 | 
  | 
     //    Int_t njumpen = 0; | 
| 6301 | 
     struct Levels level; | 
     struct Levels level; | 
| 6302 | 
     // | 
     // | 
| 6303 | 
     const char *name= filename; | 
     const char *name= filename; | 
| 6304 | 
     if ( filename == "" || !strcmp(name,"help") ){ | 
     if ( filename == "" || !strcmp(name,"help") ){ | 
| 6305 | 
         ShowHelp(); | 
         //      ShowHelp(); | 
| 6306 | 
         return; | 
         //      return; | 
| 6307 | 
  | 
         var.waitforever = true; | 
| 6308 | 
     }; | 
     }; | 
| 6309 | 
     // | 
     // | 
| 6310 | 
  | 
     Float_t mip[2][22][96]; | 
| 6311 | 
  | 
     Int_t okcalo = 0; | 
| 6312 | 
  | 
     TTree *ctree = 0; | 
| 6313 | 
  | 
     TFile *chfile; | 
| 6314 | 
  | 
     CalorimeterCalibration *ccalo = 0; | 
| 6315 | 
  | 
     Long64_t cnevents = 0; | 
| 6316 | 
     // | 
     // | 
| 6317 | 
  | 
     var.goon = false; | 
| 6318 | 
  | 
     var.refresh = false; | 
| 6319 | 
  | 
     var.fl0 = false; | 
| 6320 | 
  | 
      | 
| 6321 | 
  | 
     if ( FORCELEV == 0 ) var.fl0 = true; | 
| 6322 | 
     // | 
     // | 
| 6323 | 
     if ( FORCELEV != -1 ) printf("\n WARNING: FORCING LEVEL%i DATA \n\n",FORCELEV); | 
     //  Define some variables | 
| 6324 | 
     // | 
     // | 
| 6325 | 
     // LOAD SELECTION FILE | 
     Int_t OBT = 0; | 
| 6326 | 
  | 
     Int_t DOBT = 0; | 
| 6327 | 
  | 
     Int_t ifout = 0; | 
| 6328 | 
  | 
     Int_t OOBT = 0; | 
| 6329 | 
     // | 
     // | 
| 6330 | 
     Int_t selection = 0; | 
     // here windows dimension (based on the computer screen size) and position and dimension of figures | 
| 6331 | 
  | 
     // | 
| 6332 | 
  | 
     Int_t  xw, yw; | 
| 6333 | 
  | 
     UInt_t ww, hw; | 
| 6334 | 
  | 
     gVirtualX->GetWindowSize(gClient->GetRoot()->GetId(),xw,yw,ww,hw); | 
| 6335 | 
  | 
     Float_t winx = (float)ww*0.80; | 
| 6336 | 
  | 
     Float_t winy = (float)hw*0.80; // 95 | 
| 6337 | 
  | 
     Float_t winrap = winx/winy; | 
| 6338 | 
  | 
     TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy); | 
| 6339 | 
  | 
     //    GetCanvas->SetBit(kNotEditable); | 
| 6340 | 
  | 
     // | 
| 6341 | 
  | 
     var.bw = 0; | 
| 6342 | 
  | 
     //    var.xxvc = 0.17; | 
| 6343 | 
  | 
     var.xxvc = 0.20; | 
| 6344 | 
  | 
     var.yxvc = 0.44; | 
| 6345 | 
  | 
     //    var.xyvc = 0.83; | 
| 6346 | 
  | 
     var.xyvc = 0.815; | 
| 6347 | 
  | 
     var.yyvc = 0.44; | 
| 6348 | 
  | 
     //     | 
| 6349 | 
  | 
     var.sfx = 0.81/winrap; | 
| 6350 | 
  | 
     var.sfy = 0.81; | 
| 6351 | 
  | 
     // | 
| 6352 | 
  | 
     //var.nds4 = 0.4; | 
| 6353 | 
  | 
     var.nds4 = var.sfx; | 
| 6354 | 
  | 
     var.xcat = 0.515; | 
| 6355 | 
  | 
     //var.xcat = 0.56; | 
| 6356 | 
  | 
     var.ycat = 0.74; | 
| 6357 | 
  | 
     // | 
| 6358 | 
  | 
     var.tracknds4 = 1; | 
| 6359 | 
  | 
     // | 
| 6360 | 
  | 
     var.thefilename = filename.Data(); | 
| 6361 | 
  | 
     var.thefilter = selfile.Data(); | 
| 6362 | 
  | 
     // | 
| 6363 | 
  | 
     //  book the canvas | 
| 6364 | 
  | 
     // | 
| 6365 | 
  | 
     TLatex *text=new TLatex(); | 
| 6366 | 
  | 
     stringstream testo; | 
| 6367 | 
  | 
     stringstream testo2; | 
| 6368 | 
  | 
     stringstream testo3; | 
| 6369 | 
  | 
     figure->Range(0.,0.,1.,1.); | 
| 6370 | 
  | 
     gStyle->SetOptDate(0);  | 
| 6371 | 
  | 
     gStyle->SetOptStat(0); | 
| 6372 | 
  | 
     gStyle->SetLabelSize(0); | 
| 6373 | 
  | 
     gStyle->SetNdivisions(1,"X"); | 
| 6374 | 
  | 
     gStyle->SetNdivisions(1,"Y");        | 
| 6375 | 
  | 
     // | 
| 6376 | 
  | 
     stringstream libload; | 
| 6377 | 
  | 
     Int_t doflag = 1; | 
| 6378 | 
  | 
     Int_t thefirst = 1; | 
| 6379 | 
  | 
     Int_t trackdone1 = 0; | 
| 6380 | 
  | 
     Int_t trackdone2 = 0; | 
| 6381 | 
  | 
     Int_t seldone = 0; | 
| 6382 | 
  | 
     Float_t headc = 0.; | 
| 6383 | 
  | 
     Float_t headcold = 0.; | 
| 6384 | 
  | 
     Int_t i = 0; | 
| 6385 | 
  | 
     Int_t isOK = 0; | 
| 6386 | 
  | 
     Int_t jumpto = 0; | 
| 6387 | 
  | 
     struct Calib calib; | 
| 6388 | 
  | 
     Int_t b[4]; | 
| 6389 | 
  | 
     Int_t si = 0; | 
| 6390 | 
  | 
     var.selex = false; | 
| 6391 | 
  | 
     var.alrforc = false; | 
| 6392 | 
  | 
     // | 
| 6393 | 
  | 
     // from here to refresh | 
| 6394 | 
  | 
     // | 
| 6395 | 
  | 
  refresh: | 
| 6396 | 
  | 
     // | 
| 6397 | 
  | 
     selfile = var.thefilter.Data(); | 
| 6398 | 
  | 
     if ( calcalibfile == "" ) calcalibfile = filename; | 
| 6399 | 
  | 
     if ( outDir == "" ) outDir = filename;     | 
| 6400 | 
  | 
     // | 
| 6401 | 
  | 
     if ( var.fl0 == true ) { | 
| 6402 | 
  | 
       FORCELEV = 0; | 
| 6403 | 
  | 
     } else { | 
| 6404 | 
  | 
       if ( var.refresh ) FORCELEV = -1; | 
| 6405 | 
  | 
     }; | 
| 6406 | 
  | 
     // | 
| 6407 | 
  | 
     // clear levels! | 
| 6408 | 
  | 
     // | 
| 6409 | 
  | 
     level.calo = -10; | 
| 6410 | 
  | 
     level.calol2 = -10; | 
| 6411 | 
  | 
     level.tof = -10; | 
| 6412 | 
  | 
     level.track = -10; | 
| 6413 | 
  | 
     level.track2 = -10; | 
| 6414 | 
  | 
     level.s4 = -10; | 
| 6415 | 
  | 
     level.ac = -10; | 
| 6416 | 
  | 
     level.nd = -10; | 
| 6417 | 
  | 
     // | 
| 6418 | 
  | 
     TString fififile =  getFilename(filename); | 
| 6419 | 
  | 
     const char *file = fififile; | 
| 6420 | 
  | 
     // | 
| 6421 | 
  | 
     // | 
| 6422 | 
  | 
     // | 
| 6423 | 
  | 
     if ( !var.refresh ){ | 
| 6424 | 
  | 
       var.SHOWDEC = 0; | 
| 6425 | 
  | 
       var.TOF = 0; | 
| 6426 | 
  | 
       var.AC = 0; | 
| 6427 | 
  | 
       var.TRK = 0; | 
| 6428 | 
  | 
       var.CALO = 0; | 
| 6429 | 
  | 
       var.S4 = 0; | 
| 6430 | 
  | 
       var.ND = 0; | 
| 6431 | 
  | 
       var.INFOS = 0; | 
| 6432 | 
  | 
       var.VINFOS = 0; | 
| 6433 | 
  | 
       var.PALETTE = 0; | 
| 6434 | 
  | 
       if ( ctrlword & (1<<0) ) {  | 
| 6435 | 
  | 
         var.PALETTE = 1; | 
| 6436 | 
  | 
         printf("Show Palette\n"); | 
| 6437 | 
  | 
       }; | 
| 6438 | 
  | 
       if ( ctrlword & (1<<1) ) {  | 
| 6439 | 
  | 
         var.VINFOS = 1; | 
| 6440 | 
  | 
         printf("Show Verbose Text Informations\n"); | 
| 6441 | 
  | 
       }; | 
| 6442 | 
  | 
       if ( ctrlword & (1<<2) ) {  | 
| 6443 | 
  | 
         var.INFOS = 1; | 
| 6444 | 
  | 
         printf("Show Text Informations\n"); | 
| 6445 | 
  | 
       }; | 
| 6446 | 
  | 
       if ( ctrlword & (1<<3) ) { | 
| 6447 | 
  | 
         var.ND = 1; | 
| 6448 | 
  | 
       }; | 
| 6449 | 
  | 
       if ( ctrlword & (1<<4) ) { | 
| 6450 | 
  | 
         var.S4 = 1; | 
| 6451 | 
  | 
       }; | 
| 6452 | 
  | 
       if ( ctrlword & (1<<5) ) {  | 
| 6453 | 
  | 
         var.CALO = 1; | 
| 6454 | 
  | 
       }; | 
| 6455 | 
  | 
       if ( ctrlword & (1<<6) ) { | 
| 6456 | 
  | 
         var.TRK = 1; | 
| 6457 | 
  | 
       }; | 
| 6458 | 
  | 
       if ( ctrlword & (1<<7) ) { | 
| 6459 | 
  | 
         var.AC = 1; | 
| 6460 | 
  | 
       }; | 
| 6461 | 
  | 
       if ( ctrlword & (1<<8) ) { | 
| 6462 | 
  | 
         var.TOF = 1; | 
| 6463 | 
  | 
       }; | 
| 6464 | 
  | 
       if ( ctrlword & (1<<9) ) { | 
| 6465 | 
  | 
         var.SHOWDEC = 1; | 
| 6466 | 
  | 
         fromevent = 1; | 
| 6467 | 
  | 
         toevent = 1; | 
| 6468 | 
  | 
         printf("\n ** WARNING! YOU HAVE CHOSEN TO SHOW ONLY DETECTORS AND NO SIGNALS! **\n\n"); | 
| 6469 | 
  | 
         gSystem->Exec("sleep 5");  | 
| 6470 | 
  | 
       }; | 
| 6471 | 
  | 
     }; | 
| 6472 | 
  | 
     // | 
| 6473 | 
  | 
     // Pop up the GUI | 
| 6474 | 
  | 
     // | 
| 6475 | 
  | 
     if ( !popup ) { | 
| 6476 | 
  | 
         pamgui = new PAMevcontrol(gClient->GetRoot(),400,800,var,*figure); | 
| 6477 | 
  | 
         popup = true; | 
| 6478 | 
  | 
     }; | 
| 6479 | 
  | 
     if ( firsttime ){ | 
| 6480 | 
  | 
         firsttime = false; | 
| 6481 | 
  | 
         if ( filename == "" ) pamgui->DIALOG(0," Insert the filename and press load to start "); | 
| 6482 | 
  | 
     }; | 
| 6483 | 
  | 
     // | 
| 6484 | 
  | 
     while( var.waitforever ) {  | 
| 6485 | 
  | 
         if ( !gROOT->GetListOfCanvases()->FindObject(figure)  ) {  | 
| 6486 | 
  | 
             pamgui->Close(); | 
| 6487 | 
  | 
             gSystem->ProcessEvents();  | 
| 6488 | 
  | 
             gApplication->Terminate(0); | 
| 6489 | 
  | 
         }; | 
| 6490 | 
  | 
         gSystem->ProcessEvents();  | 
| 6491 | 
  | 
         gSystem->Sleep(10); | 
| 6492 | 
  | 
     }; | 
| 6493 | 
  | 
     if ( var.restart ){ | 
| 6494 | 
  | 
         filename = var.thefilename.Data(); | 
| 6495 | 
  | 
         pamgui->Close(); | 
| 6496 | 
  | 
         goto restart; | 
| 6497 | 
  | 
     }; | 
| 6498 | 
  | 
     // | 
| 6499 | 
  | 
     // | 
| 6500 | 
  | 
     // | 
| 6501 | 
  | 
     if ( FORCELEV != -1 ) { | 
| 6502 | 
  | 
         printf("\n WARNING: FORCING LEVEL%i DATA \n\n",FORCELEV); | 
| 6503 | 
  | 
         if ( !var.alrforc ) { | 
| 6504 | 
  | 
             pamgui->DIALOG(1," Forcing LEVEL0 data "); | 
| 6505 | 
  | 
             var.alrforc = true; | 
| 6506 | 
  | 
         }; | 
| 6507 | 
  | 
     }; | 
| 6508 | 
  | 
     // | 
| 6509 | 
  | 
     // LOAD SELECTION FILE | 
| 6510 | 
  | 
     //     | 
| 6511 | 
     if ( selfile == ""  ){ | 
     if ( selfile == ""  ){ | 
| 6512 | 
  | 
         if ( !var.selex && selection ) pamgui->DIALOG(0," Selection file unloaded "); | 
| 6513 | 
  | 
         var.selex = true; | 
| 6514 | 
         selection = 0; | 
         selection = 0; | 
| 6515 | 
  | 
 #if !defined (__CINT__) | 
| 6516 | 
  | 
         if ( !var.refresh ) { | 
| 6517 | 
  | 
           gROOT->Reset(); | 
| 6518 | 
  | 
           stringstream paminc; | 
| 6519 | 
  | 
           paminc.str(""); | 
| 6520 | 
  | 
           const char *testinc = gSystem->Getenv("PAM_INC");      | 
| 6521 | 
  | 
           if ( !testinc ) { | 
| 6522 | 
  | 
               const char *pam_calib = pathtocalibration(); | 
| 6523 | 
  | 
               paminc << pam_calib << "../include/"; | 
| 6524 | 
  | 
           } else { | 
| 6525 | 
  | 
               paminc << testinc; | 
| 6526 | 
  | 
           }; | 
| 6527 | 
  | 
           stringstream carica; | 
| 6528 | 
  | 
           carica.str(""); | 
| 6529 | 
  | 
           carica << paminc.str().c_str() << "/eventviewer.h"; | 
| 6530 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6531 | 
  | 
         }; | 
| 6532 | 
  | 
 #endif | 
| 6533 | 
     } else { | 
     } else { | 
| 6534 | 
 #if !defined (__CINT__) | 
 #if !defined (__CINT__) | 
| 6535 | 
         // | 
         // | 
| 6536 | 
         // if running the compiled program we must load header files for the selection macros! | 
         // if running the compiled program we must load header files for the selection macros! | 
| 6537 | 
         // | 
         // | 
| 6538 | 
         gROOT->Reset(); | 
         //        if ( !var.refresh ) { | 
| 6539 | 
         stringstream paminc; | 
         if ( loadselfs ) { | 
| 6540 | 
         paminc.str(""); | 
           loadselfs = false;   | 
| 6541 | 
         const char *testinc = gSystem->Getenv("PAM_INC");        | 
           gROOT->Reset(); | 
| 6542 | 
         if ( testinc == "" ){ | 
           stringstream paminc; | 
| 6543 | 
  | 
           paminc.str(""); | 
| 6544 | 
  | 
           const char *testinc = gSystem->Getenv("PAM_INC");      | 
| 6545 | 
  | 
           if ( !testinc ){ | 
| 6546 | 
             const char *pam_calib = pathtocalibration(); | 
             const char *pam_calib = pathtocalibration(); | 
| 6547 | 
             paminc << pam_calib << "../include/"; | 
             paminc << pam_calib << "../include/"; | 
| 6548 | 
         } else { | 
           } else { | 
| 6549 | 
             paminc << testinc; | 
             paminc << testinc; | 
| 6550 | 
  | 
           }; | 
| 6551 | 
  | 
           stringstream carica; | 
| 6552 | 
  | 
           carica.str(""); | 
| 6553 | 
  | 
           carica << paminc.str().c_str() << "/eventviewer.h"; | 
| 6554 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6555 | 
  | 
           carica.str(""); | 
| 6556 | 
  | 
           carica << paminc.str().c_str() << "/trklev1struct.h"; | 
| 6557 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6558 | 
  | 
           carica.str(""); | 
| 6559 | 
  | 
           carica << paminc.str().c_str() << "/ctrkstruct.h"; | 
| 6560 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6561 | 
  | 
           carica.str(""); | 
| 6562 | 
  | 
           carica << paminc.str().c_str() << "/ctrkinclude.h"; | 
| 6563 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6564 | 
  | 
           carica.str(""); | 
| 6565 | 
  | 
           carica << paminc.str().c_str() << "/ctofstruct.h"; | 
| 6566 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6567 | 
  | 
           carica.str(""); | 
| 6568 | 
  | 
           carica << paminc.str().c_str() << "/ctofinclude.h"; | 
| 6569 | 
  | 
           gROOT->LoadMacro(carica.str().c_str()); | 
| 6570 | 
         }; | 
         }; | 
 | 
         stringstream carica; | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/eventviewer.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/trklev1struct.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/ctrkstruct.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/ctrkinclude.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/ctofstruct.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
 | 
         carica.str(""); | 
  | 
 | 
         carica << paminc.str().c_str() << "/ctofinclude.h"; | 
  | 
 | 
         gROOT->LoadMacro(carica.str().c_str()); | 
  | 
| 6571 | 
 #endif | 
 #endif | 
| 6572 | 
         // | 
         // | 
| 6573 | 
         // load the selection macro | 
         // load the selection macro | 
| 6574 | 
         // | 
         // | 
| 6575 | 
         selection = gROOT->LoadMacro(selfile); | 
         selection = gROOT->LoadMacro(selfile); | 
| 6576 | 
         if ( selection ){ | 
         if ( selection ){ | 
| 6577 | 
  | 
             stringstream dialog; | 
| 6578 | 
  | 
             dialog.str(""); | 
| 6579 | 
  | 
             dialog << var.thefilter.Data(); | 
| 6580 | 
  | 
             dialog << " : no such file!"; | 
| 6581 | 
  | 
             pamgui->DIALOG(2,dialog.str().c_str()); | 
| 6582 | 
             printf("\n\n ERROR! cannot read the selection file you give me as input! \n"); | 
             printf("\n\n ERROR! cannot read the selection file you give me as input! \n"); | 
| 6583 | 
             selection = 0; | 
             selection = 0; | 
| 6584 | 
             printf("\n WARNING! no selection file loaded! \n\n"); | 
             printf("\n WARNING! no selection file loaded! \n\n"); | 
| 6585 | 
  | 
             pamgui->DIALOG(1," No selection file loaded! "); | 
| 6586 | 
  | 
             pamgui->clearselfi(); | 
| 6587 | 
         } else { | 
         } else { | 
| 6588 | 
             printf("\n\n Selection file loaded \n\n The first event will be shown anyway. \n\n");                            | 
             printf("\n\n Selection file loaded \n\n The first event will be shown anyway. \n\n");                            | 
| 6589 | 
  | 
             if ( !var.selex ) pamgui->DIALOG(0," Selection file successfully loaded "); | 
| 6590 | 
  | 
             var.selex = true; | 
| 6591 | 
             selection = 1; | 
             selection = 1; | 
| 6592 | 
         }; | 
         }; | 
| 6593 | 
     }; | 
     }; | 
| 6594 | 
     // | 
     // | 
| 6595 | 
  | 
     //  LOAD FILES     | 
| 6596 | 
     // | 
     // | 
 | 
     //  LOAD FILES | 
  | 
 | 
     // | 
  | 
 | 
     Int_t SHOWDEC = 0; | 
  | 
 | 
     Int_t TOF = 0; | 
  | 
 | 
     Int_t AC = 0; | 
  | 
 | 
     Int_t TRK = 0; | 
  | 
 | 
     Int_t CALO = 0; | 
  | 
 | 
     Int_t S4 = 0; | 
  | 
 | 
     Int_t ND = 0; | 
  | 
 | 
     Int_t INFOS = 0; | 
  | 
 | 
     Int_t VINFOS = 0; | 
  | 
 | 
     Int_t PALETTE = 0; | 
  | 
 | 
     // | 
  | 
 | 
     if ( ctrlword & (1<<0) ) {  | 
  | 
 | 
         PALETTE = 1; | 
  | 
 | 
         printf("Show Palette\n"); | 
  | 
 | 
     }; | 
  | 
 | 
     if ( BW ) printf(" --> Black and White visualization! \n"); | 
  | 
 | 
     if ( ctrlword & (1<<1) ) {  | 
  | 
 | 
         VINFOS = 1; | 
  | 
 | 
         printf("Show Verbose Text Informations\n"); | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<2) ) {  | 
  | 
 | 
         INFOS = 1; | 
  | 
 | 
         printf("Show Text Informations\n"); | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<3) ) { | 
  | 
 | 
         ND = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<4) ) { | 
  | 
 | 
         S4 = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<5) ) {  | 
  | 
 | 
         CALO = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<6) ) { | 
  | 
 | 
         TRK = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<7) ) { | 
  | 
 | 
         AC = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<8) ) { | 
  | 
 | 
         TOF = 1; | 
  | 
 | 
     }; | 
  | 
 | 
     if ( ctrlword & (1<<9) ) { | 
  | 
 | 
         SHOWDEC = 1; | 
  | 
 | 
         fromevent = 1; | 
  | 
 | 
         toevent = 1; | 
  | 
 | 
         printf("\n ** WARNING! YOU HAVE CHOSEN TO SHOW ONLY DETECTORS AND NO SIGNALS! **\n\n"); | 
  | 
 | 
         gSystem->Exec("sleep 5");  | 
  | 
 | 
     }; | 
  | 
 | 
     // | 
  | 
 | 
     TString fififile =  getFilename(filename); | 
  | 
 | 
     const char *file = fififile; | 
  | 
| 6597 | 
     // | 
     // | 
| 6598 | 
     Int_t trk1noev = 0; | 
     Int_t trk1noev = 0; | 
| 6599 | 
     Int_t trk2noev = 0; | 
     Int_t trk2noev = 0; | 
| 6611 | 
     TFile       *tofFileL1 = 0; | 
     TFile       *tofFileL1 = 0; | 
| 6612 | 
     TTree       *toftr = 0; | 
     TTree       *toftr = 0; | 
| 6613 | 
     // | 
     // | 
| 6614 | 
  | 
     // check if user has given as input a correct path  | 
| 6615 | 
  | 
     // | 
| 6616 | 
  | 
     ifstream myfile; | 
| 6617 | 
  | 
     stringstream hfile; | 
| 6618 | 
  | 
     TString textslash; | 
| 6619 | 
  | 
     Int_t minus = 0; | 
| 6620 | 
  | 
     stringcopy(textslash,filename,filename.Length()-1,filename.Length()); | 
| 6621 | 
  | 
     if ( !strcmp(textslash.Data(),"/") ){ | 
| 6622 | 
  | 
         minus = 1; | 
| 6623 | 
  | 
     } else { | 
| 6624 | 
  | 
         minus = 0; | 
| 6625 | 
  | 
     }; | 
| 6626 | 
  | 
     TString textrem; | 
| 6627 | 
  | 
     stringcopy(textrem,filename,filename.Length()-minus-15,filename.Length()-minus); | 
| 6628 | 
  | 
     hfile.str(""); | 
| 6629 | 
  | 
     hfile << filename.Data(); | 
| 6630 | 
  | 
     hfile << "/Physics/"; | 
| 6631 | 
  | 
     hfile << textrem.Data(); | 
| 6632 | 
  | 
     hfile << ".Physics.Header.root"; | 
| 6633 | 
  | 
     myfile.open(hfile.str().c_str()); | 
| 6634 | 
  | 
     if ( !myfile ){ | 
| 6635 | 
  | 
         printf("ERROR: no Header file, exiting...\n"); | 
| 6636 | 
  | 
         hfile << " - No header file! "; | 
| 6637 | 
  | 
         pamgui->DIALOG(2,hfile.str().c_str()); | 
| 6638 | 
  | 
         var.waitforever = true; | 
| 6639 | 
  | 
         goto refresh; | 
| 6640 | 
  | 
     }; | 
| 6641 | 
  | 
     myfile.close(); | 
| 6642 | 
  | 
     // | 
| 6643 | 
  | 
     // ok, open header file | 
| 6644 | 
  | 
     // | 
| 6645 | 
     headerFile = emigetFile(filename, "Physics", "Header"); | 
     headerFile = emigetFile(filename, "Physics", "Header"); | 
| 6646 | 
     if ( !headerFile ){ | 
     if ( !headerFile ){ | 
| 6647 | 
         printf("ERROR: no Header file, exiting...\n"); | 
         printf("ERROR: no Header file, exiting...\n"); | 
| 6648 | 
         return; | 
         pamgui->DIALOG(2," No header file! "); | 
| 6649 | 
  | 
         var.waitforever = true; | 
| 6650 | 
  | 
         goto refresh; | 
| 6651 | 
     }; | 
     }; | 
| 6652 | 
     TTree *otr = (TTree*)headerFile->Get("Pscu"); | 
     TTree *otr = (TTree*)headerFile->Get("Pscu"); | 
| 6653 | 
     printf("Get the Header informations\n"); | 
     printf("Get the Header informations\n"); | 
| 6655 | 
     triggerFile = emigetFile(filename, "Trigger"); | 
     triggerFile = emigetFile(filename, "Trigger"); | 
| 6656 | 
     if ( !triggerFile ){ | 
     if ( !triggerFile ){ | 
| 6657 | 
         printf("ERROR: no Trigger file, exiting...\n"); | 
         printf("ERROR: no Trigger file, exiting...\n"); | 
| 6658 | 
         return; | 
         pamgui->DIALOG(2," No trigger file! "); | 
| 6659 | 
  | 
         var.waitforever = true; | 
| 6660 | 
  | 
         goto refresh; | 
| 6661 | 
     }; | 
     }; | 
| 6662 | 
     otr->AddFriend("Trigger", triggerFile); | 
     otr->AddFriend("Trigger", triggerFile); | 
| 6663 | 
     printf("Get the Trigger informations\n"); | 
     printf("Get the Trigger informations\n"); | 
| 6672 | 
     TTree *ctrk = 0; | 
     TTree *ctrk = 0; | 
| 6673 | 
     TFile *trackcalibFile2 = 0; | 
     TFile *trackcalibFile2 = 0; | 
| 6674 | 
     TFile *trackerFile2b = 0; | 
     TFile *trackerFile2b = 0; | 
| 6675 | 
     if ( TRK ) { | 
     if ( var.TRK ) { | 
| 6676 | 
         if ( FORCELEV == 0 ){ | 
       if ( FORCELEV == 0 ){ | 
| 6677 | 
             trackerFile2 = emigetFile(filename, "Tracker"); | 
         trackerFile2 = emigetFile(filename, "Tracker"); | 
| 6678 | 
             if ( !trackerFile2 ){ | 
         if ( !trackerFile2 ){ | 
| 6679 | 
                 printf("WARNING: no Tracker file! \n"); | 
           printf("WARNING: no Tracker file! \n"); | 
| 6680 | 
                 TRK = 0; | 
           pamgui->DIALOG(1," No tracker file! "); | 
| 6681 | 
             } else { | 
           var.TRK = 0; | 
| 6682 | 
                 otr->AddFriend("Tracker", trackerFile2); | 
         } else { | 
| 6683 | 
                 printf("Show the Tracker detector, LEVEL0 data \n"); | 
           otr->AddFriend("Tracker", trackerFile2); | 
| 6684 | 
                 TRKLEV = 0; | 
           printf("Show the Tracker detector, LEVEL0 data \n"); | 
| 6685 | 
             }; | 
           TRKLEV = 0; | 
| 6686 | 
         } else { | 
         }; | 
| 6687 | 
             trackerFile = emigetFile(filename, "Physics.Level2", "Tracker"); | 
       } else { | 
| 6688 | 
  | 
         trackerFile = emigetFile(filename, "Physics.Level2", "Tracker"); | 
| 6689 | 
  | 
         if ( !trackerFile ){ | 
| 6690 | 
  | 
           // | 
| 6691 | 
  | 
           trackhead = emigetFile(filename, "CalibTrk1", "Header"); | 
| 6692 | 
  | 
           ctrk = (TTree*)trackhead->Get("Pscu"); | 
| 6693 | 
  | 
           // | 
| 6694 | 
  | 
           trackerFile = emigetFile(filename, "Physics.Level1", "Tracker"); | 
| 6695 | 
  | 
           trackcalibFile1 = emigetFile(filename, "CalibTrk1"); | 
| 6696 | 
  | 
           trackcalibFile2 = emigetFile(filename, "CalibTrk2"); | 
| 6697 | 
  | 
           // | 
| 6698 | 
  | 
           if ( !trackerFile || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){ | 
| 6699 | 
  | 
             trackerFile = emigetFile(filename, "Tracker"); | 
| 6700 | 
             if ( !trackerFile ){ | 
             if ( !trackerFile ){ | 
| 6701 | 
                 // | 
               printf("WARNING: no Tracker file! \n"); | 
| 6702 | 
                 trackhead = emigetFile(filename, "CalibTrk1", "Header"); | 
               pamgui->DIALOG(1," No tracker file! "); | 
| 6703 | 
                 ctrk = (TTree*)trackhead->Get("Pscu"); | 
               var.TRK = 0; | 
 | 
                 // | 
  | 
 | 
                 trackerFile = emigetFile(filename, "Physics.Level1", "Tracker"); | 
  | 
 | 
                 trackcalibFile1 = emigetFile(filename, "CalibTrk1"); | 
  | 
 | 
                 trackcalibFile2 = emigetFile(filename, "CalibTrk2"); | 
  | 
 | 
                 // | 
  | 
 | 
                 if ( !trackerFile || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){ | 
  | 
 | 
                     trackerFile = emigetFile(filename, "Tracker"); | 
  | 
 | 
                     if ( !trackerFile ){ | 
  | 
 | 
                         printf("WARNING: no Tracker file! \n"); | 
  | 
 | 
                         TRK = 0; | 
  | 
 | 
                     } else { | 
  | 
 | 
                         otr->AddFriend("Tracker", trackerFile); | 
  | 
 | 
                         printf("Show the Tracker detector, LEVEL0 data \n"); | 
  | 
 | 
                         TRKLEV = 0; | 
  | 
 | 
                     }; | 
  | 
 | 
                 } else { | 
  | 
 | 
                     ttr1 = (TTree*)trackerFile->Get("TrkLevel1"); | 
  | 
 | 
                     ctrk->AddFriend("CalibTrk1", trackcalibFile1);               | 
  | 
 | 
                     ctrk->AddFriend("CalibTrk2", trackcalibFile2);               | 
  | 
 | 
                     printf("Show the Tracker detector, LEVEL1 data \n"); | 
  | 
 | 
                     TRKLEV = 1;         | 
  | 
 | 
                     trk1noev = ttr1->GetEntries(); | 
  | 
 | 
                 }; | 
  | 
| 6704 | 
             } else { | 
             } else { | 
| 6705 | 
                 ttr = (TTree*)trackerFile->Get("TrkLevel2"); | 
               otr->AddFriend("Tracker", trackerFile); | 
| 6706 | 
                 trk2noev = ttr->GetEntries(); | 
               printf("Show the Tracker detector, LEVEL0 data \n"); | 
| 6707 | 
                 printf("Get the track informations (LEVEL2 Tracker data!)\n"); | 
               TRKLEV = 0; | 
| 6708 | 
                 STRACK = 1; | 
             }; | 
| 6709 | 
                 // | 
           } else { | 
| 6710 | 
                 trackhead = emigetFile(filename, "CalibTrk2", "Header"); | 
             ttr1 = (TTree*)trackerFile->Get("TrkLevel1"); | 
| 6711 | 
                 ctrk = (TTree*)trackhead->Get("Pscu"); | 
             ctrk->AddFriend("CalibTrk1", trackcalibFile1);               | 
| 6712 | 
                 // | 
             ctrk->AddFriend("CalibTrk2", trackcalibFile2);               | 
| 6713 | 
                 trackerFile2b = emigetFile(filename, "Physics.Level1", "Tracker"); | 
             printf("Show the Tracker detector, LEVEL1 data \n"); | 
| 6714 | 
                 trackcalibFile1 = emigetFile(filename, "CalibTrk1"); | 
             TRKLEV = 1;         | 
| 6715 | 
                 trackcalibFile2 = emigetFile(filename, "CalibTrk2"); | 
             trk1noev = ttr1->GetEntries(); | 
| 6716 | 
                 // | 
           }; | 
| 6717 | 
                 if ( !trackerFile2b || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){ | 
         } else { | 
| 6718 | 
                     printf(" WARNING: no LEVEL1 Tracker data, load LEVEL0 data \n");             | 
           ttr = (TTree*)trackerFile->Get("TrkLevel2"); | 
| 6719 | 
                     trackerFile2b = emigetFile(filename, "Tracker"); | 
           trk2noev = ttr->GetEntries(); | 
| 6720 | 
                     if ( !trackerFile2b ){ | 
           printf("Get the track informations (LEVEL2 Tracker data!)\n"); | 
| 6721 | 
                         printf("WARNING: no Tracker file! \n"); | 
           STRACK = 1; | 
| 6722 | 
                         TRK = 0; | 
           // | 
| 6723 | 
                     } else { | 
           trackhead = emigetFile(filename, "CalibTrk2", "Header"); | 
| 6724 | 
                         otr->AddFriend("Tracker", trackerFile2b); | 
           ctrk = (TTree*)trackhead->Get("Pscu"); | 
| 6725 | 
                         printf("Show the Tracker detector, LEVEL0 data \n"); | 
           // | 
| 6726 | 
                         TRKLEV = 0; | 
           trackerFile2b = emigetFile(filename, "Physics.Level1", "Tracker"); | 
| 6727 | 
                     }; | 
           trackcalibFile1 = emigetFile(filename, "CalibTrk1"); | 
| 6728 | 
                 } else { | 
           trackcalibFile2 = emigetFile(filename, "CalibTrk2"); | 
| 6729 | 
                     ttr1 = (TTree*)trackerFile2b->Get("TrkLevel1"); | 
           // | 
| 6730 | 
                     ctrk->AddFriend("CalibTrk1", trackcalibFile1);               | 
           if ( !trackerFile2b || !trackcalibFile1 || !trackcalibFile2 || !trackhead ){ | 
| 6731 | 
                     ctrk->AddFriend("CalibTrk2", trackcalibFile2);               | 
             printf(" WARNING: no LEVEL1 Tracker data, load LEVEL0 data \n");             | 
| 6732 | 
                     printf("Show the Tracker detector, LEVEL1 data \n"); | 
             trackerFile2b = emigetFile(filename, "Tracker"); | 
| 6733 | 
                     TRKLEV = 1;         | 
             if ( !trackerFile2b ){ | 
| 6734 | 
                     trk1noev = ttr1->GetEntries(); | 
               printf("WARNING: no Tracker file! \n"); | 
| 6735 | 
                 }; | 
               pamgui->DIALOG(1," No tracker file! "); | 
| 6736 | 
             }; | 
               var.TRK = 0; | 
| 6737 | 
         }; | 
             } else { | 
| 6738 | 
  | 
               otr->AddFriend("Tracker", trackerFile2b); | 
| 6739 | 
  | 
               printf("Show the Tracker detector, LEVEL0 data \n"); | 
| 6740 | 
  | 
               TRKLEV = 0; | 
| 6741 | 
  | 
             }; | 
| 6742 | 
  | 
           } else { | 
| 6743 | 
  | 
             ttr1 = (TTree*)trackerFile2b->Get("TrkLevel1"); | 
| 6744 | 
  | 
             ctrk->AddFriend("CalibTrk1", trackcalibFile1);               | 
| 6745 | 
  | 
             ctrk->AddFriend("CalibTrk2", trackcalibFile2);               | 
| 6746 | 
  | 
             printf("Show the Tracker detector, LEVEL1 data \n"); | 
| 6747 | 
  | 
             TRKLEV = 1;         | 
| 6748 | 
  | 
             trk1noev = ttr1->GetEntries(); | 
| 6749 | 
  | 
           }; | 
| 6750 | 
  | 
         }; | 
| 6751 | 
  | 
       }; | 
| 6752 | 
  | 
       level.track = TRKLEV; | 
| 6753 | 
  | 
       level.track2 = STRACK; | 
| 6754 | 
  | 
     } else { | 
| 6755 | 
  | 
       level.track = -10; | 
| 6756 | 
  | 
       level.track2 = -10; | 
| 6757 | 
     }; | 
     }; | 
| 6758 | 
     // | 
     // | 
| 6759 | 
     Int_t CALOLEV = 0; | 
     Int_t CALOLEV = 0; | 
| 6760 | 
     if ( CALO ) { | 
     if ( var.CALO ) { | 
| 6761 | 
         if ( FORCELEV == 0 ){ | 
         if ( FORCELEV == 0 ){ | 
| 6762 | 
             caloFile = emigetFile(filename, "Calorimeter"); | 
             caloFile = emigetFile(filename, "Calorimeter"); | 
| 6763 | 
             if ( !caloFile ){ | 
             if ( !caloFile ){ | 
| 6764 | 
                 printf("WARNING: no calorimeter file! \n"); | 
                 printf("WARNING: no calorimeter file! \n"); | 
| 6765 | 
                 CALO = 0; | 
                 pamgui->DIALOG(1," No calorimeter file! "); | 
| 6766 | 
  | 
                 var.CALO = 0; | 
| 6767 | 
             } else { | 
             } else { | 
| 6768 | 
                 otr->AddFriend("Calorimeter", caloFile); | 
                 otr->AddFriend("Calorimeter", caloFile); | 
| 6769 | 
                 printf("Show the Calorimeter detector, LEVEL0 data \n"); | 
                 printf("Show the Calorimeter detector, LEVEL0 data \n"); | 
| 6775 | 
                 caloFile = emigetFile(filename, "Calorimeter"); | 
                 caloFile = emigetFile(filename, "Calorimeter"); | 
| 6776 | 
                 if ( !caloFile ){ | 
                 if ( !caloFile ){ | 
| 6777 | 
                     printf("WARNING: no calorimeter file! \n"); | 
                     printf("WARNING: no calorimeter file! \n"); | 
| 6778 | 
                     CALO = 0; | 
                     pamgui->DIALOG(1," No calorimeter file! "); | 
| 6779 | 
  | 
                     var.CALO = 0; | 
| 6780 | 
                 } else { | 
                 } else { | 
| 6781 | 
                     otr->AddFriend("Calorimeter", caloFile); | 
                     otr->AddFriend("Calorimeter", caloFile); | 
| 6782 | 
                     printf("Show the Calorimeter detector, try to generate LEVEL1 data \n"); | 
                     printf("Show the Calorimeter detector, try to generate LEVEL1 data \n"); | 
| 6788 | 
                 CALOLEV = 1;             | 
                 CALOLEV = 1;             | 
| 6789 | 
             }; | 
             }; | 
| 6790 | 
         }; | 
         }; | 
| 6791 | 
  | 
         level.calo = CALOLEV; | 
| 6792 | 
  | 
         level.calol2 = -10; | 
| 6793 | 
  | 
     } else { | 
| 6794 | 
  | 
         level.calo = -10; | 
| 6795 | 
  | 
         level.calol2 = -10; | 
| 6796 | 
     }; | 
     }; | 
| 6797 | 
     // | 
     // | 
| 6798 | 
     if ( ND ) { | 
     if ( var.ND ) { | 
| 6799 | 
         neutronFile = emigetFile(filename, "Neutron"); | 
         neutronFile = emigetFile(filename, "Neutron"); | 
| 6800 | 
         if ( !neutronFile ){ | 
         if ( !neutronFile ){ | 
| 6801 | 
             printf("WARNING: no neutron detector file! \n"); | 
             printf("WARNING: no neutron detector file! \n"); | 
| 6802 | 
             ND = 0; | 
             pamgui->DIALOG(1," No neutron detector file! "); | 
| 6803 | 
  | 
             var.ND = 0; | 
| 6804 | 
         } else { | 
         } else { | 
| 6805 | 
             otr->AddFriend("Neutron", neutronFile); | 
             otr->AddFriend("Neutron", neutronFile); | 
| 6806 | 
             printf("Show the Neutron detector, LEVEL0 data \n"); | 
             printf("Show the Neutron detector, LEVEL0 data \n"); | 
| 6807 | 
         }; | 
         }; | 
| 6808 | 
  | 
         level.nd = 0; | 
| 6809 | 
  | 
     } else { | 
| 6810 | 
  | 
         level.nd = -10; | 
| 6811 | 
     }; | 
     }; | 
| 6812 | 
     // | 
     // | 
| 6813 | 
     if ( AC ) { | 
     if ( var.AC ) { | 
| 6814 | 
         if ( FORCELEV == 0 ){ | 
         if ( FORCELEV == 0 ){ | 
| 6815 | 
             acFile = emigetFile(filename, "Anticounter"); | 
             acFile = emigetFile(filename, "Anticounter"); | 
| 6816 | 
             if ( !acFile ){ | 
             if ( !acFile ){ | 
| 6817 | 
                 printf("WARNING: no AC file! \n"); | 
                 printf("WARNING: no AC file! \n"); | 
| 6818 | 
                 AC = 0; | 
                 pamgui->DIALOG(1," No anticounters file! "); | 
| 6819 | 
  | 
                 var.AC = 0; | 
| 6820 | 
             } else { | 
             } else { | 
| 6821 | 
                 otr->AddFriend("Anticounter", acFile); | 
                 otr->AddFriend("Anticounter", acFile); | 
| 6822 | 
                 printf("Show the Anticoincidence detector, LEVEL 0 data\n");                             | 
                 printf("Show the Anticoincidence detector, LEVEL 0 data\n");                             | 
| 6828 | 
                 acFile = emigetFile(filename, "Anticounter"); | 
                 acFile = emigetFile(filename, "Anticounter"); | 
| 6829 | 
                 if ( !acFile ){ | 
                 if ( !acFile ){ | 
| 6830 | 
                     printf("WARNING: no AC file! \n"); | 
                     printf("WARNING: no AC file! \n"); | 
| 6831 | 
                     AC = 0; | 
                     pamgui->DIALOG(1," No anticounters file! "); | 
| 6832 | 
  | 
                     var.AC = 0; | 
| 6833 | 
                 } else { | 
                 } else { | 
| 6834 | 
                     otr->AddFriend("Anticounter", acFile); | 
                     otr->AddFriend("Anticounter", acFile); | 
| 6835 | 
                     printf("Show the Anticoincidence detector, LEVEL 0 data\n");                                 | 
                     printf("Show the Anticoincidence detector, LEVEL 0 data\n");                                 | 
| 6841 | 
                 ACLEV = 1; | 
                 ACLEV = 1; | 
| 6842 | 
             }; | 
             }; | 
| 6843 | 
         }; | 
         }; | 
| 6844 | 
  | 
         level.ac = ACLEV; | 
| 6845 | 
  | 
     } else { | 
| 6846 | 
  | 
         level.ac = -10; | 
| 6847 | 
     }; | 
     }; | 
| 6848 | 
     Int_t S4LEV = 0; | 
     Int_t S4LEV = 0; | 
| 6849 | 
     if ( S4 ) { | 
     if ( var.S4 ) { | 
| 6850 | 
         s4File = emigetFile(filename, "S4"); | 
         s4File = emigetFile(filename, "S4"); | 
| 6851 | 
         if ( !s4File ){ | 
         if ( !s4File ){ | 
| 6852 | 
             printf("WARNING: no S4 file! \n"); | 
             printf("WARNING: no S4 file! \n"); | 
| 6853 | 
             S4 = 0; | 
             pamgui->DIALOG(1," No S4 file! "); | 
| 6854 | 
  | 
             var.S4 = 0; | 
| 6855 | 
         } else { | 
         } else { | 
| 6856 | 
             otr->AddFriend("S4", s4File); | 
             otr->AddFriend("S4", s4File); | 
| 6857 | 
             if ( FORCELEV != 0 ){ | 
             if ( FORCELEV != 0 ){ | 
| 6862 | 
                 S4LEV = 0; | 
                 S4LEV = 0; | 
| 6863 | 
             }; | 
             }; | 
| 6864 | 
         }; | 
         }; | 
| 6865 | 
  | 
         level.s4 = S4LEV; | 
| 6866 | 
  | 
     } else { | 
| 6867 | 
  | 
         level.s4 = -10; | 
| 6868 | 
     }; | 
     }; | 
| 6869 | 
     // | 
     // | 
| 6870 | 
     Int_t TOFLEV = 0;    | 
     Int_t TOFLEV = 0;    | 
| 6871 | 
     if ( TOF ) { | 
     if ( var.TOF ) { | 
| 6872 | 
         if ( FORCELEV != 0 ){ | 
         if ( FORCELEV != 0 ){ | 
| 6873 | 
             tofFileL1 = emigetFile(filename, "Physics.Level1","TofTrigger"); | 
             tofFileL1 = emigetFile(filename, "Physics.Level1","TofTrigger"); | 
| 6874 | 
             if ( !tofFileL1 ){   | 
             if ( !tofFileL1 ){   | 
| 6875 | 
                 tofFile = emigetFile(filename, "Tof"); | 
                 tofFile = emigetFile(filename, "Tof"); | 
| 6876 | 
                 if ( !tofFile ){         | 
                 if ( !tofFile ){         | 
| 6877 | 
                     printf("WARNING: no TOF file! \n"); | 
                     printf("WARNING: no TOF file! \n"); | 
| 6878 | 
  | 
                     pamgui->DIALOG(1," No TOF file! "); | 
| 6879 | 
                     printf("Show the Time of Flight detector, LEVEL0 (trigger board) data\n"); | 
                     printf("Show the Time of Flight detector, LEVEL0 (trigger board) data\n"); | 
| 6880 | 
                     //      TOF = 0; | 
                     //      var.TOF = 0; | 
| 6881 | 
                     TOFLEV = 0; | 
                     TOFLEV = 0; | 
| 6882 | 
                 } else { | 
                 } else { | 
| 6883 | 
                     otr->AddFriend("Tof", tofFile); | 
                     otr->AddFriend("Tof", tofFile); | 
| 6894 | 
             printf("Show the Time of Flight detector, LEVEL0 data\n"); | 
             printf("Show the Time of Flight detector, LEVEL0 data\n"); | 
| 6895 | 
             TOFLEV = 0; | 
             TOFLEV = 0; | 
| 6896 | 
         }; | 
         }; | 
| 6897 | 
  | 
         level.tof = TOFLEV; | 
| 6898 | 
  | 
     } else { | 
| 6899 | 
  | 
         level.tof = -10; | 
| 6900 | 
     }; | 
     }; | 
| 6901 | 
     //     | 
     //     | 
| 6902 | 
     printf("\n"); | 
     printf("\n"); | 
| 6911 | 
     if (nevents<=0) { | 
     if (nevents<=0) { | 
| 6912 | 
         headerFile->Close(); | 
         headerFile->Close(); | 
| 6913 | 
         triggerFile->Close(); | 
         triggerFile->Close(); | 
| 6914 | 
         if ( TRK ) trackerFile->Close(); | 
         if ( var.TRK ) trackerFile->Close(); | 
| 6915 | 
         if ( CALO )caloFile->Close(); | 
         if ( var.CALO )caloFile->Close(); | 
| 6916 | 
         if ( ND ) neutronFile->Close(); | 
         if ( var.ND ) neutronFile->Close(); | 
| 6917 | 
         if ( AC ) acFile->Close(); | 
         if ( var.AC ) acFile->Close(); | 
| 6918 | 
         if ( TOF ) tofFile->Close(); | 
         if ( var.TOF ) tofFile->Close(); | 
| 6919 | 
         if ( S4 ) s4File->Close(); | 
         if ( var.S4 ) s4File->Close(); | 
| 6920 | 
         printf("The file is empty, exiting...\n"); | 
         printf("The file is empty, exiting...\n"); | 
| 6921 | 
         return; | 
         pamgui->DIALOG(0," The file contains no physics data! "); | 
| 6922 | 
  | 
         var.waitforever = true; | 
| 6923 | 
  | 
         goto refresh; | 
| 6924 | 
     } | 
     } | 
| 6925 | 
     // | 
     // | 
| 6926 | 
     //  Define some variables | 
     if ( var.SHOWDEC ){ | 
 | 
     // | 
  | 
 | 
     Int_t OBT = 0; | 
  | 
 | 
     Int_t DOBT = 0; | 
  | 
 | 
     Int_t ifout = 0; | 
  | 
 | 
     Int_t OOBT = 0; | 
  | 
 | 
     // | 
  | 
 | 
     if ( calcalibfile == "" ) calcalibfile = filename; | 
  | 
 | 
     if ( outDir == "" ) outDir = filename; | 
  | 
 | 
     // | 
  | 
 | 
     struct Variables var; | 
  | 
 | 
     // | 
  | 
 | 
     if ( SHOWDEC ){ | 
  | 
| 6927 | 
         var.nosig = 1; | 
         var.nosig = 1; | 
| 6928 | 
     } else { | 
     } else { | 
| 6929 | 
         var.nosig = 0; | 
         var.nosig = 0; | 
| 6930 | 
     }; | 
     }; | 
| 6931 | 
     // | 
     // | 
 | 
     // here windows dimension (based on the computer screen size) and position and dimension of figures | 
  | 
 | 
     // | 
  | 
 | 
     Int_t  xw, yw; | 
  | 
 | 
     UInt_t ww, hw; | 
  | 
 | 
     gVirtualX->GetWindowSize(gClient->GetRoot()->GetId(),xw,yw,ww,hw); | 
  | 
 | 
     Float_t winx = (float)ww*0.95; | 
  | 
 | 
     Float_t winy = (float)hw*0.95; | 
  | 
 | 
     Float_t winrap = winx/winy; | 
  | 
 | 
     var.bw = 0; | 
  | 
 | 
     if ( BW ) var.bw = 1; | 
  | 
 | 
     var.xxvc = 0.17; | 
  | 
 | 
     var.yxvc = 0.44; | 
  | 
 | 
     var.xyvc = 0.83; | 
  | 
 | 
     var.yyvc = 0.44; | 
  | 
 | 
     //     | 
  | 
 | 
     var.sfx = 0.82/winrap; | 
  | 
 | 
     var.sfy = 0.82; | 
  | 
 | 
     // | 
  | 
 | 
     var.nds4 = 0.4; | 
  | 
 | 
     //var.nds4 = 0.85/winrap; | 
  | 
 | 
     var.xcat = 0.5; | 
  | 
 | 
     var.ycat = 0.74; | 
  | 
 | 
     // | 
  | 
 | 
     var.tracknds4 = 1; | 
  | 
 | 
     // | 
  | 
| 6932 | 
     //  READ the CALORIMETER ADC to MIP conversion table (if trying to generate level1 data) | 
     //  READ the CALORIMETER ADC to MIP conversion table (if trying to generate level1 data) | 
| 6933 | 
     // | 
     // | 
| 6934 | 
     Float_t mip[2][22][96]; | 
     if ( !var.refresh ){ | 
| 6935 | 
     Int_t okcalo = 0; | 
       if ( !CALOLEV && var.CALO ){ | 
 | 
     TTree *ctree = 0; | 
  | 
 | 
     TFile *chfile; | 
  | 
 | 
     CalorimeterCalibration *ccalo = 0; | 
  | 
 | 
     Long64_t cnevents = 0; | 
  | 
 | 
     if ( !CALOLEV && CALO ){ | 
  | 
| 6936 | 
         chfile = new TFile(calfile.str().c_str(),"READ","Calorimeter CALIBRATION data"); | 
         chfile = new TFile(calfile.str().c_str(),"READ","Calorimeter CALIBRATION data"); | 
| 6937 | 
         if ( chfile->IsZombie() ){ | 
         if ( chfile->IsZombie() ){ | 
| 6938 | 
             printf(" WARNING: no calorimeter calibration file! \n Using 26 as conversion factor for all strips. \n"); | 
           printf(" WARNING: no calorimeter calibration file! \n Using 26 as conversion factor for all strips. \n"); | 
| 6939 | 
             okcalo = 0; | 
           okcalo = 0; | 
| 6940 | 
         } else { | 
         } else { | 
| 6941 | 
             okcalo = 1; | 
           okcalo = 1; | 
| 6942 | 
             ctree = (TTree*)chfile->Get("CaloADC");   | 
           ctree = (TTree*)chfile->Get("CaloADC");   | 
| 6943 | 
             ctree->SetBranchAddress("Event", &ccalo);     | 
           ctree->SetBranchAddress("Event", &ccalo);     | 
| 6944 | 
             // | 
           // | 
| 6945 | 
             cnevents = ctree->GetEntries(); | 
           cnevents = ctree->GetEntries(); | 
| 6946 | 
             ctree->GetEntry(cnevents-1); | 
           ctree->GetEntry(cnevents-1); | 
| 6947 | 
         }; | 
         }; | 
| 6948 | 
         // | 
         // | 
| 6949 | 
         if ( okcalo ) { | 
         if ( okcalo ) { | 
| 6950 | 
             for (Int_t m = 0; m < 2 ; m++ ){ | 
           for (Int_t m = 0; m < 2 ; m++ ){ | 
| 6951 | 
                 for (Int_t k = 0; k < 22; k++ ){ | 
             for (Int_t k = 0; k < 22; k++ ){ | 
| 6952 | 
                     for (Int_t l = 0; l < 96; l++ ){ | 
               for (Int_t l = 0; l < 96; l++ ){ | 
| 6953 | 
                         if ( (ccalo->fp[1][m][k][l] > 20. && ccalo->fp[1][m][k][l] < 32.) || ccalo->mask[m][k][l] == 1. ) { | 
                 if ( (ccalo->fp[1][m][k][l] > 20. && ccalo->fp[1][m][k][l] < 32.) || ccalo->mask[m][k][l] == 1. ) { | 
| 6954 | 
                             if ( ccalo->mip[m][k][l] != 0. ){ | 
                   if ( ccalo->mip[m][k][l] != 0. ){ | 
| 6955 | 
                                 mip[m][k][l] = ccalo->mip[m][k][l]; | 
                     mip[m][k][l] = ccalo->mip[m][k][l]; | 
| 6956 | 
                             } else { | 
                   } else { | 
| 6957 | 
                                 mip[m][k][l] = 26. ; | 
                     mip[m][k][l] = 26. ; | 
| 6958 | 
                             }; | 
                   }; | 
| 6959 | 
                         } else { | 
                 } else { | 
| 6960 | 
                             mip[m][k][l] = 26. ; | 
                   mip[m][k][l] = 26. ; | 
 | 
                         }; | 
  | 
 | 
                     };      | 
  | 
| 6961 | 
                 }; | 
                 }; | 
| 6962 | 
  | 
               };            | 
| 6963 | 
             }; | 
             }; | 
| 6964 | 
  | 
           }; | 
| 6965 | 
         } else { | 
         } else { | 
| 6966 | 
             for (Int_t m = 0; m < 2 ; m++ ){ | 
           for (Int_t m = 0; m < 2 ; m++ ){ | 
| 6967 | 
                 for (Int_t k = 0; k < 22; k++ ){ | 
             for (Int_t k = 0; k < 22; k++ ){ | 
| 6968 | 
                     for (Int_t l = 0; l < 96; l++ ){ | 
                     for (Int_t l = 0; l < 96; l++ ){ | 
| 6969 | 
                         mip[m][k][l] = 26. ; | 
                       mip[m][k][l] = 26. ; | 
| 6970 | 
                     }; | 
                     }; | 
| 6971 | 
                 }; | 
                 }; | 
| 6972 | 
             }; | 
           }; | 
| 6973 | 
         }; | 
         }; | 
| 6974 | 
         chfile->Close(); | 
         chfile->Close(); | 
| 6975 | 
  | 
       }; | 
| 6976 | 
     }; | 
     }; | 
| 6977 | 
     // | 
     // | 
| 6978 | 
     //  Check that given input are inside the boundary conditions  | 
     //  Check that given input are inside the boundary conditions  | 
| 6979 | 
     // | 
     // | 
| 6980 | 
         if ( fromevent > toevent && toevent ){ | 
     if ( fromevent > toevent && toevent ){ | 
| 6981 | 
         printf("It must be fromevent < toevent \n"); | 
         printf("It must be fromevent < toevent \n"); | 
| 6982 | 
         return; | 
         return; | 
| 6983 | 
     }; | 
     }; | 
| 7003 | 
         }; | 
         }; | 
| 7004 | 
     }; | 
     }; | 
| 7005 | 
     // | 
     // | 
 | 
     //  book the canvas | 
  | 
 | 
     // | 
  | 
 | 
     TCanvas *figure = new TCanvas("PAMELA event viewer", "PAMELA event viewer",(int)winx,(int)winy); | 
  | 
 | 
     TLatex *text=new TLatex(); | 
  | 
 | 
     stringstream testo; | 
  | 
 | 
     stringstream testo2; | 
  | 
 | 
     stringstream testo3; | 
  | 
 | 
     figure->Range(0.,0.,1.,1.); | 
  | 
 | 
     gStyle->SetOptDate(0);  | 
  | 
 | 
     gStyle->SetOptStat(0); | 
  | 
 | 
     gStyle->SetLabelSize(0); | 
  | 
 | 
     gStyle->SetNdivisions(1,"X"); | 
  | 
 | 
     gStyle->SetNdivisions(1,"Y");        | 
  | 
 | 
     // | 
  | 
 | 
     stringstream libload; | 
  | 
 | 
     Int_t doflag = 1; | 
  | 
 | 
     Int_t thefirst = 1; | 
  | 
 | 
     Int_t trackdone1 = 0; | 
  | 
 | 
     Int_t trackdone2 = 0; | 
  | 
 | 
     Int_t seldone = 0; | 
  | 
 | 
     Float_t headc = 0.; | 
  | 
 | 
     Float_t headcold = 0.; | 
  | 
 | 
     Int_t i = minevent; | 
  | 
 | 
     Int_t OK = 0; | 
  | 
 | 
     Int_t jumpto = 0; | 
  | 
| 7006 | 
     // | 
     // | 
| 7007 | 
     otr->SetBranchAddress("Header", &eh); | 
     otr->SetBranchAddress("Header", &eh); | 
| 7008 | 
     otr->GetEntry(maxevent); | 
     otr->GetEntry(maxevent); | 
| 7011 | 
     otr->GetEntry(minevent); | 
     otr->GetEntry(minevent); | 
| 7012 | 
     ph = eh->GetPscuHeader(); | 
     ph = eh->GetPscuHeader(); | 
| 7013 | 
     Int_t firstevno = (int)ph->GetCounter(); | 
     Int_t firstevno = (int)ph->GetCounter(); | 
| 7014 | 
     struct Calib calib; | 
     if ( !var.refresh ) i = minevent; | 
| 7015 | 
     Int_t b[4]; | 
     var.refresh = false; | 
 | 
     Int_t si = 0; | 
  | 
| 7016 | 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 7017 | 
     //  MAIN LOOP STARTS HERE: run over all the events | 
     //  MAIN LOOP STARTS HERE: run over all the events | 
| 7018 | 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 
     ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | 
| 7019 | 
     while ( i < maxevent+1 ){ | 
         //    while ( i < maxevent+1 ){ | 
| 7020 | 
  | 
     while ( 1 ){ | 
| 7021 | 
  | 
         // | 
| 7022 | 
  | 
         // update progress bar | 
| 7023 | 
  | 
         // | 
| 7024 | 
  | 
         if ( popup ) pamgui->increment((float)(i+1)*100./(float)nevents); | 
| 7025 | 
         // | 
         // | 
| 7026 | 
         // clear canvas and variables | 
         // clear canvas and variables | 
| 7027 | 
         // | 
         // | 
| 7050 | 
             ph = eh->GetPscuHeader(); | 
             ph = eh->GetPscuHeader(); | 
| 7051 | 
             Int_t cjumpto = (int)ph->GetCounter(); | 
             Int_t cjumpto = (int)ph->GetCounter(); | 
| 7052 | 
             if ( cjumpto == jumpto ) jumpto = 0; | 
             if ( cjumpto == jumpto ) jumpto = 0; | 
| 7053 | 
             if ( jumpto && i == maxevent ) { | 
             if ( jumpto && (i == maxevent || i == si) ) { | 
| 7054 | 
                 i = si; | 
                 if ( var.jumpen && i == maxevent ) { | 
| 7055 | 
                 printf(" WARNING: NO EVENT WITH EVENT NUMBER %i \n",jumpto); | 
                     i = -1; | 
| 7056 | 
                 jumpto = 0; | 
                     var.jumpen = false; | 
| 7057 | 
  | 
                 } else { | 
| 7058 | 
  | 
                     i = si; | 
| 7059 | 
  | 
                     printf(" WARNING: NO EVENT WITH EVENT NUMBER %i \n",jumpto); | 
| 7060 | 
  | 
                     stringstream dialog; | 
| 7061 | 
  | 
                     dialog.str(""); | 
| 7062 | 
  | 
                     dialog << " No event with event number "; | 
| 7063 | 
  | 
                     dialog << jumpto; | 
| 7064 | 
  | 
                     pamgui->DIALOG(1,dialog.str().c_str()); | 
| 7065 | 
  | 
                     jumpto = 0; | 
| 7066 | 
  | 
                 }; | 
| 7067 | 
             }; | 
             }; | 
| 7068 | 
         }; | 
         }; | 
| 7069 | 
         // | 
         // | 
| 7070 | 
         OK = 0; | 
         isOK = 0; | 
| 7071 | 
         if ( !selection || ( i == minevent && !seldone) ){ | 
         if ( !selection || ( i == minevent && !seldone) || ( i == minevent || i == maxevent )){ | 
| 7072 | 
             OK = 1; | 
             if (  i == minevent && selection && seldone && doflag==2) pamgui->DIALOG(1," Stop searching, first event reached "); | 
| 7073 | 
  | 
             if (  i == maxevent && selection ) pamgui->DIALOG(1," Stop searching, last event reached "); | 
| 7074 | 
  | 
             isOK = 1; | 
| 7075 | 
             seldone = 1; | 
             seldone = 1; | 
| 7076 | 
         } else { | 
         } else { | 
| 7077 | 
             OK = 0; | 
             isOK = 0; | 
| 7078 | 
 #if defined (__CINT__) | 
 #if defined (__CINT__) | 
| 7079 | 
             OK = filter(i,otr,ttr,level); | 
             isOK = filter(i,otr,ttr,level); | 
| 7080 | 
 #endif | 
 #endif | 
| 7081 | 
 #if !defined (__CINT__) | 
 #if !defined (__CINT__) | 
| 7082 | 
             stringstream cintcom; | 
             stringstream cintcom; | 
| 7097 | 
             cintcom << "struct Levels &level = (struct Levels &)0x" << hex; | 
             cintcom << "struct Levels &level = (struct Levels &)0x" << hex; | 
| 7098 | 
             cintcom << &level; | 
             cintcom << &level; | 
| 7099 | 
             gROOT->ProcessLine(cintcom.str().c_str()); | 
             gROOT->ProcessLine(cintcom.str().c_str()); | 
| 7100 | 
             OK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level);"); | 
             isOK = gApplication->ProcessLine("filter((Int_t)a,(TTree *)otr,(TTree *)ttr,(Levels &)level);"); | 
| 7101 | 
 #endif | 
 #endif | 
| 7102 | 
             seldone = 1; | 
             seldone = 1; | 
| 7103 | 
             printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37); | 
             printf("Scanning data: %d%c done",100*(i-minevent)/(maxevent-minevent),37); | 
| 7106 | 
         // | 
         // | 
| 7107 | 
         // if the event is selected go on | 
         // if the event is selected go on | 
| 7108 | 
         // | 
         // | 
| 7109 | 
         if ( OK && !jumpto ) { | 
         if ( isOK && !jumpto ) { | 
| 7110 | 
  | 
             if ( var.doflag == 3 ) selection = 1; | 
| 7111 | 
             printf("\n"); | 
             printf("\n"); | 
| 7112 | 
  | 
             // | 
| 7113 | 
  | 
             figure->SetEditable(kTRUE); | 
| 7114 | 
  | 
             // | 
| 7115 | 
             figure->Clear(); | 
             figure->Clear(); | 
| 7116 | 
             figure->SetFillColor(10); | 
             figure->SetFillColor(10); | 
| 7117 | 
             figure->cd(); | 
             figure->cd(); | 
| 7163 | 
             // | 
             // | 
| 7164 | 
             // show TOF | 
             // show TOF | 
| 7165 | 
             // | 
             // | 
| 7166 | 
             if ( TOF ){ | 
             if ( var.TOF ){ | 
| 7167 | 
                 figure->cd();    | 
                 figure->cd();    | 
| 7168 | 
                 if ( TOFLEV == 0 ){ | 
                 if ( TOFLEV == 0 ){ | 
| 7169 | 
                     ShowTOF(i,otr,var); | 
                     ShowTOF(i,otr,var); | 
| 7174 | 
                     level.tof = 0; | 
                     level.tof = 0; | 
| 7175 | 
                 }; | 
                 }; | 
| 7176 | 
                 if ( TOFLEV == 1 ){ | 
                 if ( TOFLEV == 1 ){ | 
| 7177 | 
                     ShowTOFL1(i,toftr,var); | 
                     ShowTOFL1(i,toftr,var,pamgui); | 
| 7178 | 
                     level.tof = 1; | 
                     level.tof = 1; | 
| 7179 | 
                 }; | 
                 }; | 
| 7180 | 
             }; | 
             }; | 
| 7181 | 
             // | 
             // | 
| 7182 | 
             // show anticounters | 
             // show anticounters | 
| 7183 | 
             // | 
             // | 
| 7184 | 
             if ( AC ){ | 
             if ( var.AC ){ | 
| 7185 | 
                 figure->cd();    | 
                 figure->cd();    | 
| 7186 | 
                 if ( ACLEV == 0 ){ | 
                 if ( ACLEV == 0 ){ | 
| 7187 | 
                     ShowAC(i,otr,var,0);                 | 
                     ShowAC(i,otr,var,0);                 | 
| 7195 | 
             // | 
             // | 
| 7196 | 
             // show S4 | 
             // show S4 | 
| 7197 | 
             // | 
             // | 
| 7198 | 
             if ( S4 ){ | 
             if ( var.S4 ){ | 
| 7199 | 
                 figure->cd();    | 
                 figure->cd();    | 
| 7200 | 
                 if ( S4LEV == 0 ){ | 
                 if ( S4LEV == 0 ){ | 
| 7201 | 
                     ShowS4L0(i,otr,var);                 | 
                     ShowS4L0(i,otr,var);                 | 
| 7210 | 
             // | 
             // | 
| 7211 | 
             // show neutron detector | 
             // show neutron detector | 
| 7212 | 
             // | 
             // | 
| 7213 | 
             if ( ND ){ | 
             if ( var.ND ){ | 
| 7214 | 
                 figure->cd();    | 
                 figure->cd();    | 
| 7215 | 
                 ShowND(i,otr,var); | 
                 ShowND(i,otr,var); | 
| 7216 | 
                 level.nd = 0; | 
                 level.nd = 0; | 
| 7218 | 
             // | 
             // | 
| 7219 | 
             // show tracker | 
             // show tracker | 
| 7220 | 
             // | 
             // | 
| 7221 | 
             if ( TRK ){ | 
             if ( var.TRK ){ | 
| 7222 | 
                 // | 
                 // | 
| 7223 | 
                 // if we have level2 data show the track | 
                 // if we have level2 data show the track | 
| 7224 | 
                 // | 
                 // | 
| 7260 | 
                     }; | 
                     }; | 
| 7261 | 
                     level.track2 = 1; | 
                     level.track2 = 1; | 
| 7262 | 
                     figure->cd();        | 
                     figure->cd();        | 
| 7263 | 
                     ShowTRACK(i,ttr,var); | 
                     ShowTRACK(i,ttr,var,pamgui); | 
| 7264 | 
  | 
                 } else { | 
| 7265 | 
  | 
                     level.track2 = 0; | 
| 7266 | 
                 }; | 
                 }; | 
| 7267 | 
                 // | 
                 // | 
| 7268 | 
                 // show level1 data  | 
                 // show level1 data  | 
| 7313 | 
                             }; | 
                             }; | 
| 7314 | 
                         }; | 
                         }; | 
| 7315 | 
                     }; | 
                     }; | 
| 7316 | 
                     ShowTRKL1(i,ttr1,var); | 
                     ShowTRKL1(i,ttr1,var,pamgui); | 
| 7317 | 
                 }; | 
                 }; | 
| 7318 | 
                 // | 
                 // | 
| 7319 | 
                 // if everything fails, show at least level0 data | 
                 // if everything fails, show at least level0 data | 
| 7326 | 
             // | 
             // | 
| 7327 | 
             // show calorimeter | 
             // show calorimeter | 
| 7328 | 
             //   | 
             //   | 
| 7329 | 
             if ( CALO ){             | 
             if ( var.CALO ){         | 
| 7330 | 
                 figure->cd();    | 
                 figure->cd();    | 
| 7331 | 
                 // | 
                 // | 
| 7332 | 
                 // if we have LEVEL1 data | 
                 // if we have LEVEL1 data | 
| 7386 | 
             // | 
             // | 
| 7387 | 
             // SHOW INFOS | 
             // SHOW INFOS | 
| 7388 | 
             // | 
             // | 
| 7389 | 
             if ( INFOS ){ | 
             if ( var.INFOS ){ | 
| 7390 | 
                 figure->cd(); | 
                 figure->cd(); | 
| 7391 | 
                 text->SetTextAngle(0); | 
                 text->SetTextAngle(0); | 
| 7392 | 
                 text->SetTextFont(32); | 
                 text->SetTextFont(32); | 
| 7446 | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str()); | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str()); | 
| 7447 | 
                 txthi -= 0.03; | 
                 txthi -= 0.03; | 
| 7448 | 
                 testo3.str(""); | 
                 testo3.str(""); | 
| 7449 | 
                 testo3 << "S4: " << setprecision(2); | 
                 testo3 << "S4: ";// << setprecision(2); | 
| 7450 | 
                 testo3 << var.s4sig << " [MIP]   TOF: #beta(1,...,5) = ("; | 
                 testo3 << var.s4sig << " [MIP]   TOF: #beta(1,...,5) = ("; | 
| 7451 | 
                 testo3 << setprecision(3) << var.beta[0]; | 
                 testo3 << setprecision(3) << var.beta[0]; | 
| 7452 | 
                 testo3 << ","; | 
                 testo3 << ","; | 
| 7461 | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str());            | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str());            | 
| 7462 | 
                 txthi -= 0.03; | 
                 txthi -= 0.03; | 
| 7463 | 
                 testo3.str(""); | 
                 testo3.str(""); | 
| 7464 | 
                 testo3 << "ND: Trigger: neutrons = " << var.trup; | 
                 testo3 << "ND: Trig: " << var.trup; | 
| 7465 | 
                 testo3 << "  - Background: upper = " << var.bkup; | 
                 testo3 << "  - Bckgr: upper = " << var.bkup; | 
| 7466 | 
                 testo3 << " lower = " << var.bkbo; | 
                 testo3 << " lower = " << var.bkbo; | 
| 7467 | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str()); | 
                 text->DrawLatex(0.33,txthi,testo3.str().c_str()); | 
| 7468 | 
                 txthi -= 0.03; | 
                 txthi -= 0.03; | 
| 7471 | 
                 text->SetTextAngle(90); | 
                 text->SetTextAngle(90); | 
| 7472 | 
                 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE"); | 
                 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE"); | 
| 7473 | 
                 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE"); | 
                 text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE"); | 
| 7474 | 
                 if ( AC || TRK ){ | 
                 if ( var.AC ){ | 
| 7475 | 
                     text->SetTextAngle(90); | 
                     text->SetTextAngle(90); | 
| 7476 | 
                     text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE"); | 
                     text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE"); | 
| 7477 | 
                     text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE"); | 
                     text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE"); | 
| 7506 | 
                 // | 
                 // | 
| 7507 | 
                 text->SetTextSize(0.015);            | 
                 text->SetTextSize(0.015);            | 
| 7508 | 
                 text->SetTextFont(2); | 
                 text->SetTextFont(2); | 
| 7509 | 
                 DrawX(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,0.005,var); | 
                 DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508 | 
| 7510 | 
                 text->SetTextFont(32); | 
                 text->SetTextFont(32); | 
| 7511 | 
                 text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.508*var.sfy,"y"); | 
                 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y"); | 
| 7512 | 
                 TArrow *arr; | 
                 TArrow *arr; | 
| 7513 | 
                 arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.19*var.sfx,var.yxvc-0.508*var.sfy); | 
                 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.21*var.sfx,var.yxvc-0.328*var.sfy); | 
| 7514 | 
                 arr->SetArrowSize(0.005); | 
                 arr->SetArrowSize(0.005); | 
| 7515 | 
                 arr->Draw(); | 
                 arr->Draw(); | 
| 7516 | 
                 text->DrawLatex(var.xxvc-0.19*var.sfx,var.yxvc-0.515*var.sfy,"x"); | 
                 text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x"); | 
| 7517 | 
                 arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.23*var.sfx,var.yxvc-0.468*var.sfy); | 
                 arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.25*var.sfx,var.yxvc-0.288*var.sfy); | 
| 7518 | 
                 arr->SetArrowSize(0.005); | 
                 arr->SetArrowSize(0.005); | 
| 7519 | 
                 arr->Draw(); | 
                 arr->Draw(); | 
| 7520 | 
                 text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.468*var.sfy,"z"); | 
                 text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z"); | 
| 7521 | 
                 // | 
                 // | 
| 7522 | 
                 text->SetTextSize(0.015);            | 
                 text->SetTextSize(0.015);            | 
| 7523 | 
                 text->SetTextFont(2); | 
                 text->SetTextFont(2); | 
| 7524 | 
                 DrawX(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,0.005,var); | 
                 DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var); | 
| 7525 | 
                 text->SetTextFont(32); | 
                 text->SetTextFont(32); | 
| 7526 | 
                 text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.508*var.sfy,"x"); | 
                 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x"); | 
| 7527 | 
                 arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.18*var.sfx,var.yyvc-0.508*var.sfy); | 
                 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.2*var.sfx,var.yyvc-0.328*var.sfy); | 
| 7528 | 
                 arr->SetArrowSize(0.005); | 
                 arr->SetArrowSize(0.005); | 
| 7529 | 
                 arr->Draw(); | 
                 arr->Draw(); | 
| 7530 | 
                 text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.511*var.sfy,"y"); | 
                 text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y"); | 
| 7531 | 
                 arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.22*var.sfx,var.yyvc-0.468*var.sfy); | 
                 arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.24*var.sfx,var.yyvc-0.288*var.sfy); | 
| 7532 | 
                 arr->SetArrowSize(0.005); | 
                 arr->SetArrowSize(0.005); | 
| 7533 | 
                 arr->Draw(); | 
                 arr->Draw(); | 
| 7534 | 
                 text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.468*var.sfy,"z");           | 
                 text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");           | 
| 7535 | 
                 text->SetTextSize(0.01); | 
                 text->SetTextSize(0.01); | 
| 7536 | 
  | 
                 // | 
| 7537 | 
  | 
 /*              text->SetTextSize(0.015);            */ | 
| 7538 | 
  | 
 /*              text->SetTextFont(2); */ | 
| 7539 | 
  | 
 /*              DrawX(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,0.005,var); */ | 
| 7540 | 
  | 
 /*              text->SetTextFont(32); */ | 
| 7541 | 
  | 
 /*              text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.508*var.sfy,"y"); */ | 
| 7542 | 
  | 
 /*              TArrow *arr; */ | 
| 7543 | 
  | 
 /*              arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.19*var.sfx,var.yxvc-0.508*var.sfy); */ | 
| 7544 | 
  | 
 /*              arr->SetArrowSize(0.005); */ | 
| 7545 | 
  | 
 /*              arr->Draw(); */ | 
| 7546 | 
  | 
 /*              text->DrawLatex(var.xxvc-0.19*var.sfx,var.yxvc-0.515*var.sfy,"x"); */ | 
| 7547 | 
  | 
 /*              arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.23*var.sfx,var.yxvc-0.468*var.sfy); */ | 
| 7548 | 
  | 
 /*              arr->SetArrowSize(0.005); */ | 
| 7549 | 
  | 
 /*              arr->Draw(); */ | 
| 7550 | 
  | 
 /*              text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.468*var.sfy,"z"); */ | 
| 7551 | 
  | 
 /*              // */ | 
| 7552 | 
  | 
 /*              text->SetTextSize(0.015);            */ | 
| 7553 | 
  | 
 /*              text->SetTextFont(2); */ | 
| 7554 | 
  | 
 /*              DrawX(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,0.005,var); */ | 
| 7555 | 
  | 
 /*              text->SetTextFont(32); */ | 
| 7556 | 
  | 
 /*              text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.508*var.sfy,"x"); */ | 
| 7557 | 
  | 
 /*              arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.18*var.sfx,var.yyvc-0.508*var.sfy); */ | 
| 7558 | 
  | 
 /*              arr->SetArrowSize(0.005); */ | 
| 7559 | 
  | 
 /*              arr->Draw(); */ | 
| 7560 | 
  | 
 /*              text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.511*var.sfy,"y"); */ | 
| 7561 | 
  | 
 /*              arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.22*var.sfx,var.yyvc-0.468*var.sfy); */ | 
| 7562 | 
  | 
 /*              arr->SetArrowSize(0.005); */ | 
| 7563 | 
  | 
 /*              arr->Draw(); */ | 
| 7564 | 
  | 
 /*              text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.468*var.sfy,"z");           */ | 
| 7565 | 
  | 
 /*              text->SetTextSize(0.01); */ | 
| 7566 | 
             }; | 
             }; | 
| 7567 | 
             // | 
             // | 
| 7568 | 
             // SHOW PALETTE | 
             // SHOW PALETTE | 
| 7569 | 
             // | 
             // | 
| 7570 | 
             if ( PALETTE ) ShowPalette(var.bw); | 
             if ( var.PALETTE ) ShowPalette(var.bw); | 
| 7571 | 
             // | 
             // | 
| 7572 | 
             // SHOW VERBOSE INFOS | 
             // SHOW VERBOSE INFOS | 
| 7573 | 
             // | 
             // | 
| 7574 | 
             if ( VINFOS ){ | 
             if ( var.VINFOS ){ | 
| 7575 | 
                 figure->cd(); | 
                 figure->cd(); | 
| 7576 | 
                 text->SetTextAngle(0); | 
                 text->SetTextAngle(0); | 
| 7577 | 
                 text->SetTextFont(32); | 
                 text->SetTextFont(32); | 
| 7578 | 
                 text->SetTextColor(1); | 
                 text->SetTextColor(1); | 
| 7579 | 
                 text->SetTextSize(0.01); | 
                 text->SetTextSize(0.01); | 
| 7580 | 
                 text->SetTextAlign(12); | 
                 text->SetTextAlign(12); | 
| 7581 | 
                 if ( AC ){ | 
                 if ( var.AC ){ | 
| 7582 | 
                     // | 
                     // | 
| 7583 | 
                     // Plane view | 
                     // Plane view | 
| 7584 | 
                     // | 
                     // | 
| 7616 | 
                     text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2"); | 
                     text->DrawLatex(var.xyvc-0.170*var.sfx,var.yyvc+0.39*var.sfy,"CAT2"); | 
| 7617 | 
                     text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.39*var.sfy,"CAT1"); | 
                     text->DrawLatex(var.xyvc+0.13*var.sfx,var.yyvc+0.39*var.sfy,"CAT1"); | 
| 7618 | 
                 }; | 
                 }; | 
| 7619 | 
                 if  ( CALO ){ | 
                 if  ( var.CALO ){ | 
| 7620 | 
                     text->SetTextSize(0.020); | 
                     text->SetTextSize(0.020); | 
| 7621 | 
                     text->SetTextAngle(90); | 
                     text->SetTextAngle(90); | 
| 7622 | 
                     text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.290*var.sfy,"Calorimeter");                 | 
                     text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.290*var.sfy,"Calorimeter");                 | 
| 7624 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7625 | 
                     text->SetTextAngle(0); | 
                     text->SetTextAngle(0); | 
| 7626 | 
                 }; | 
                 }; | 
| 7627 | 
                 if  ( TRK ){ | 
                 if  ( var.TRK ){ | 
| 7628 | 
                     text->SetTextSize(0.020); | 
                     text->SetTextSize(0.020); | 
| 7629 | 
                     text->SetTextAngle(90); | 
                     text->SetTextAngle(90); | 
| 7630 | 
                     text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc+0.080*var.sfy,"Tracker");             | 
                     text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc+0.080*var.sfy,"Tracker");             | 
| 7632 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7633 | 
                     text->SetTextAngle(0); | 
                     text->SetTextAngle(0); | 
| 7634 | 
                 }; | 
                 }; | 
| 7635 | 
                 if  ( ND ){ | 
                 if  ( var.ND ){ | 
| 7636 | 
                     text->SetTextSize(0.020); | 
                     text->SetTextSize(0.020); | 
| 7637 | 
                     text->SetTextAngle(90); | 
                     //              text->SetTextAngle(90); | 
| 7638 | 
                     text->DrawLatex(var.xxvc-0.22*var.sfx,var.yxvc-0.430*var.sfy,"ND");          | 
                     text->DrawLatex(var.xxvc-0.25*var.sfx,var.yxvc-0.530*var.sfy,"ND");          | 
| 7639 | 
                     text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.430*var.sfy,"ND");          | 
                     text->DrawLatex(var.xyvc+0.22*var.sfx,var.yyvc-0.530*var.sfy,"ND");          | 
| 7640 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7641 | 
                     text->SetTextAngle(0); | 
                     text->SetTextAngle(0); | 
| 7642 | 
                 }; | 
                 }; | 
| 7643 | 
                 if  ( TOF ){ | 
                 if  ( var.TOF ){ | 
| 7644 | 
                     text->SetTextSize(0.020); | 
                     text->SetTextSize(0.020); | 
| 7645 | 
                     text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.130*var.sfy,"S3");          | 
                     text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.130*var.sfy,"S3");          | 
| 7646 | 
                     text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.350*var.sfy,"S2");          | 
                     text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc+0.350*var.sfy,"S2");          | 
| 7650 | 
                     text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.653*var.sfy,"S1");          | 
                     text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc+0.653*var.sfy,"S1");          | 
| 7651 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7652 | 
                 }; | 
                 }; | 
| 7653 | 
                 if  ( S4 ){ | 
                 if  ( var.S4 ){ | 
| 7654 | 
                     text->SetTextSize(0.020); | 
                     text->SetTextSize(0.020); | 
| 7655 | 
                     text->DrawLatex(var.xxvc-0.24*var.sfx,var.yxvc-0.350*var.sfy,"S4");          | 
                     text->DrawLatex(var.xxvc-0.28*var.sfx,var.yxvc-0.350*var.sfy,"S4");          | 
| 7656 | 
                     text->DrawLatex(var.xyvc+0.21*var.sfx,var.yyvc-0.350*var.sfy,"S4");          | 
                     text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.350*var.sfy,"S4");          | 
| 7657 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7658 | 
                 }; | 
                 }; | 
| 7659 | 
                 if ( !INFOS ){ | 
                 if ( !var.INFOS ){ | 
| 7660 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7661 | 
                     text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.520*var.sfy,"CPU SIDE"); | 
                     text->DrawLatex(var.xxvc-0.025*var.sfx,var.yxvc-0.520*var.sfy,"CPU SIDE"); | 
| 7662 | 
                     text->SetTextAngle(90); | 
                     text->SetTextAngle(90); | 
| 7663 | 
                     text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE"); | 
                     text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc+0.075*var.sfy,"CPU SIDE"); | 
| 7664 | 
                     text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE"); | 
                     text->DrawLatex(var.xyvc-0.17*var.sfx,var.yyvc+0.075*var.sfy,"VME SIDE"); | 
| 7665 | 
                     if ( AC || TRK ){ | 
                     if ( var.AC ){ | 
| 7666 | 
                         text->SetTextAngle(90); | 
                         text->SetTextAngle(90); | 
| 7667 | 
                         text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE"); | 
                         text->DrawLatex(var.xcat-0.235*var.sfx,var.ycat-0.025*var.sfy,"VME SIDE"); | 
| 7668 | 
                         text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE"); | 
                         text->DrawLatex(var.xcat+0.235*var.sfx,var.ycat-0.025*var.sfy,"CPU SIDE"); | 
| 7697 | 
                     // | 
                     // | 
| 7698 | 
                     text->SetTextSize(0.015);        | 
                     text->SetTextSize(0.015);        | 
| 7699 | 
                     text->SetTextFont(2); | 
                     text->SetTextFont(2); | 
| 7700 | 
                     DrawX(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,0.005,var); | 
                     DrawX(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,0.005,var); //508 | 
| 7701 | 
                     text->SetTextFont(32); | 
                     text->SetTextFont(32); | 
| 7702 | 
                     text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.508*var.sfy,"y"); | 
                     text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.328*var.sfy,"y"); | 
| 7703 | 
                     TArrow *arr; | 
                     TArrow *arr; | 
| 7704 | 
                     arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.19*var.sfx,var.yxvc-0.508*var.sfy); | 
                     arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.21*var.sfx,var.yxvc-0.328*var.sfy); | 
| 7705 | 
                     arr->SetArrowSize(0.005); | 
                     arr->SetArrowSize(0.005); | 
| 7706 | 
                     arr->Draw(); | 
                     arr->Draw(); | 
| 7707 | 
                     text->DrawLatex(var.xxvc-0.19*var.sfx,var.yxvc-0.515*var.sfy,"x"); | 
                     text->DrawLatex(var.xxvc-0.21*var.sfx,var.yxvc-0.335*var.sfy,"x"); | 
| 7708 | 
                     arr = new TArrow(var.xxvc-0.23*var.sfx,var.yxvc-0.508*var.sfy,var.xxvc-0.23*var.sfx,var.yxvc-0.468*var.sfy); | 
                     arr = new TArrow(var.xxvc-0.25*var.sfx,var.yxvc-0.328*var.sfy,var.xxvc-0.25*var.sfx,var.yxvc-0.288*var.sfy); | 
| 7709 | 
                     arr->SetArrowSize(0.005); | 
                     arr->SetArrowSize(0.005); | 
| 7710 | 
                     arr->Draw(); | 
                     arr->Draw(); | 
| 7711 | 
                     text->DrawLatex(var.xxvc-0.246*var.sfx,var.yxvc-0.468*var.sfy,"z"); | 
                     text->DrawLatex(var.xxvc-0.266*var.sfx,var.yxvc-0.288*var.sfy,"z"); | 
| 7712 | 
                     // | 
                     // | 
| 7713 | 
                     text->SetTextSize(0.015);        | 
                     text->SetTextSize(0.015);        | 
| 7714 | 
                     text->SetTextFont(2); | 
                     text->SetTextFont(2); | 
| 7715 | 
                     DrawX(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,0.005,var); | 
                     DrawX(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,0.005,var); | 
| 7716 | 
                     text->SetTextFont(32); | 
                     text->SetTextFont(32); | 
| 7717 | 
                     text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.508*var.sfy,"x"); | 
                     text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.328*var.sfy,"x"); | 
| 7718 | 
                     arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.18*var.sfx,var.yyvc-0.508*var.sfy); | 
                     arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.2*var.sfx,var.yyvc-0.328*var.sfy); | 
| 7719 | 
                     arr->SetArrowSize(0.005); | 
                     arr->SetArrowSize(0.005); | 
| 7720 | 
                     arr->Draw(); | 
                     arr->Draw(); | 
| 7721 | 
                     text->DrawLatex(var.xyvc+0.17*var.sfx,var.yyvc-0.511*var.sfy,"y"); | 
                     text->DrawLatex(var.xyvc+0.19*var.sfx,var.yyvc-0.335*var.sfy,"y"); | 
| 7722 | 
                     arr = new TArrow(var.xyvc+0.22*var.sfx,var.yyvc-0.508*var.sfy,var.xyvc+0.22*var.sfx,var.yyvc-0.468*var.sfy); | 
                     arr = new TArrow(var.xyvc+0.24*var.sfx,var.yyvc-0.328*var.sfy,var.xyvc+0.24*var.sfx,var.yyvc-0.288*var.sfy); | 
| 7723 | 
                     arr->SetArrowSize(0.005); | 
                     arr->SetArrowSize(0.005); | 
| 7724 | 
                     arr->Draw(); | 
                     arr->Draw(); | 
| 7725 | 
                     text->DrawLatex(var.xyvc+0.23*var.sfx,var.yyvc-0.468*var.sfy,"z");       | 
                     text->DrawLatex(var.xyvc+0.25*var.sfx,var.yyvc-0.288*var.sfy,"z");       | 
| 7726 | 
                     text->SetTextSize(0.01); | 
                     text->SetTextSize(0.01); | 
| 7727 | 
                 }; | 
                 }; | 
| 7728 | 
             }; | 
             }; | 
| 7732 | 
             figure->Modified(); | 
             figure->Modified(); | 
| 7733 | 
             figure->Update(); | 
             figure->Update(); | 
| 7734 | 
             figure->cd(); | 
             figure->cd(); | 
| 7735 | 
  | 
             figure->SetEditable(kFALSE); | 
| 7736 | 
             // | 
             // | 
| 7737 | 
             // print infos on terminal | 
             // print infos on terminal | 
| 7738 | 
             // | 
             // | 
| 7762 | 
             // Interact with user: do you want to continue, go backward, exit or print the figure? | 
             // Interact with user: do you want to continue, go backward, exit or print the figure? | 
| 7763 | 
             // | 
             // | 
| 7764 | 
             printf("\n\n\n\n\n\n\n\n\n\n"); | 
             printf("\n\n\n\n\n\n\n\n\n\n"); | 
| 7765 | 
             if ( i != maxevent ) {  | 
             si = i; | 
| 7766 | 
                 si = i; | 
             doflag = 1; | 
| 7767 | 
                 doflag = 1; | 
             jumpto = 0; | 
| 7768 | 
                 jumpto = 0; | 
             var.i = i; | 
| 7769 | 
                 TString figty = "ev"; | 
             var.doflag = doflag; | 
| 7770 | 
                 var.i = i; | 
             var.jumpto = jumpto; | 
| 7771 | 
                 var.doflag = doflag; | 
             var.nevents = nevents; | 
| 7772 | 
                 var.jumpto = jumpto; | 
             var.lastevno = lastevno; | 
| 7773 | 
                 var.nevents = nevents; | 
             var.firstevno = firstevno; | 
| 7774 | 
                 var.lastevno = lastevno; | 
             // | 
| 7775 | 
                 var.firstevno = firstevno; | 
             char *bw; | 
| 7776 | 
                 Int_t ifout = WhatToDoEV(var,file,outDir,figty,*figure); | 
             if ( var.bw ){ | 
| 7777 | 
                 i = var.i; | 
                 bw = "_bw"; | 
 | 
                 doflag = var.doflag; | 
  | 
 | 
                 jumpto = var.jumpto; | 
  | 
 | 
                 if ( i != si ) OOBT = 1000000000; | 
  | 
 | 
                 if ( maxevent < i+1 ) { | 
  | 
 | 
                     maxevent = nevents; | 
  | 
 | 
                     printf("WARNING: you have chosen an event number out of the starting range.\n         Range extended to %i\n\n",maxevent);           | 
  | 
 | 
                 }; | 
  | 
 | 
                 if ( ifout ) goto theend; | 
  | 
| 7778 | 
             } else { | 
             } else { | 
| 7779 | 
                 printf("\n\n");     | 
                 bw = ""; | 
| 7780 | 
  | 
             }; | 
| 7781 | 
  | 
             TString filenm = file; | 
| 7782 | 
  | 
             const string fil = (const char*)filenm; | 
| 7783 | 
  | 
             Int_t posiz = fil.find("dw_"); | 
| 7784 | 
  | 
             if ( posiz == -1 ) posiz = fil.find("DW_"); | 
| 7785 | 
  | 
             Int_t posiz2 = posiz+13; | 
| 7786 | 
  | 
             TString file2; | 
| 7787 | 
  | 
             stringcopy(file2,filenm,posiz,posiz2); | 
| 7788 | 
  | 
             const char *figrec = file2; | 
| 7789 | 
  | 
             const char *outdir = outDir; | 
| 7790 | 
  | 
             stringstream figsave;      | 
| 7791 | 
  | 
             figsave.str(""); | 
| 7792 | 
  | 
             figsave << outdir << "/"; | 
| 7793 | 
  | 
             figsave << figrec; | 
| 7794 | 
  | 
             figsave << "_ev_"; | 
| 7795 | 
  | 
             figsave << (var.i+1); | 
| 7796 | 
  | 
             figsave << bw; | 
| 7797 | 
  | 
             var.svas=figsave.str().c_str(); | 
| 7798 | 
  | 
             pamgui->upgrnamfi(); | 
| 7799 | 
  | 
             // | 
| 7800 | 
  | 
             var.jumpen = false; | 
| 7801 | 
  | 
             //      njumpen = 0; | 
| 7802 | 
  | 
             Int_t ifout = 0; | 
| 7803 | 
  | 
             while( !var.goon && !var.refresh && !var.restart ) {  | 
| 7804 | 
  | 
                 if ( !gROOT->GetListOfCanvases()->FindObject(figure)  ) {  | 
| 7805 | 
  | 
                     pamgui->Close(); | 
| 7806 | 
  | 
                     gSystem->ProcessEvents();  | 
| 7807 | 
  | 
                     gApplication->Terminate(0); | 
| 7808 | 
  | 
                 }; | 
| 7809 | 
  | 
                 gSystem->ProcessEvents();  | 
| 7810 | 
  | 
                 gSystem->Sleep(10); | 
| 7811 | 
  | 
             }; | 
| 7812 | 
  | 
             var.goon = false; | 
| 7813 | 
  | 
             if ( var.refresh || var.restart ){ | 
| 7814 | 
  | 
                 headerFile->Close(); | 
| 7815 | 
  | 
                 triggerFile->Close(); | 
| 7816 | 
  | 
                 if ( trackerFile ) trackerFile->Close(); | 
| 7817 | 
  | 
                 if ( trackerFile2 ) trackerFile2->Close(); | 
| 7818 | 
  | 
                 if ( caloFile )caloFile->Close(); | 
| 7819 | 
  | 
                 if ( neutronFile ) neutronFile->Close(); | 
| 7820 | 
  | 
                 if ( acFile ) acFile->Close(); | 
| 7821 | 
  | 
                 if ( tofFile ) tofFile->Close(); | 
| 7822 | 
  | 
                 if ( tofFileL1 ) tofFileL1->Close(); | 
| 7823 | 
  | 
                 if ( s4File ) s4File->Close();                             | 
| 7824 | 
  | 
                 if ( trackhead ) trackhead->Close();                               | 
| 7825 | 
  | 
                 if ( trackcalibFile1 ) trackcalibFile1->Close();                                   | 
| 7826 | 
  | 
                 if ( trackcalibFile2 ) trackcalibFile2->Close();                                   | 
| 7827 | 
  | 
                 if ( trackerFile2b ) trackerFile2b->Close();                               | 
| 7828 | 
  | 
                 if ( var.refresh ) goto refresh; | 
| 7829 | 
  | 
                 if ( var.restart ){ | 
| 7830 | 
  | 
                     filename = var.thefilename.Data(); | 
| 7831 | 
  | 
                     pamgui->Close(); | 
| 7832 | 
  | 
                     goto restart; | 
| 7833 | 
  | 
                 }; | 
| 7834 | 
  | 
             }; | 
| 7835 | 
  | 
             // | 
| 7836 | 
  | 
             i = var.i; | 
| 7837 | 
  | 
             doflag = var.doflag; | 
| 7838 | 
  | 
             jumpto = var.jumpto; | 
| 7839 | 
  | 
             if ( i != si ) OOBT = 1000000000; | 
| 7840 | 
  | 
             if ( maxevent < i ) { | 
| 7841 | 
  | 
                 maxevent = nevents; | 
| 7842 | 
  | 
                 printf("WARNING: you have chosen an event number out of the starting range.\n         Range extended to %i\n\n",maxevent);               | 
| 7843 | 
             }; | 
             }; | 
| 7844 | 
  | 
             if ( ifout ) goto theend; | 
| 7845 | 
         }; | 
         }; | 
| 7846 | 
         if ( doflag == 2 && i == 0 ) { | 
         if ( doflag == 2 && i == 0 ) { | 
| 7847 | 
             printf("\n WARNING: Cannot go backward! Going forward. \n"); | 
             printf("\n WARNING: Cannot go backward! Going forward. \n"); | 
| 7849 | 
         }; | 
         }; | 
| 7850 | 
         if ( doflag == 2 && i>0 ) i--; | 
         if ( doflag == 2 && i>0 ) i--; | 
| 7851 | 
         if ( doflag == 1 ) i++; | 
         if ( doflag == 1 ) i++; | 
| 7852 | 
  | 
         if ( var.doflag == 3 ) selection = 0; | 
| 7853 | 
         // | 
         // | 
| 7854 | 
         // if in selection mode, print out a event progress bar: | 
         // if in selection mode, print out a event progress bar: | 
| 7855 | 
         // | 
         // |