- Timestamp:
- 11/05/01 10:35:36 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r1029 r1030 1 1 -*-*- END -*-*- 2 3 2001/11/01: Thomas Bretz 4 5 * mbase/MParContainer.cc: 6 - removed 'newname' from TObject::Clone call. 7 8 * mbase/MParContainer.h: 9 - layout changes 10 11 * mbase/MParList.h: 12 - changed destructor definition to virtual 13 14 * mbase/MReadTree.[h,cc]: 15 - added initialization for fProgress 16 - changed output 17 - move some code to new functions 18 - branch enabling now checks for the existance of the branch 19 - veto branch disables the corresponding sub branches now physically 20 - changed comments 21 22 * mdatacheck/MGDisplayAdc.cc: 23 - added some sanity checks 24 25 * meventdisp/MGCamDisplay.cc, meventdisp/MGEvtDisplay.[h,cc], 26 meventdisp/MGFadcDisp.cc: 27 - moved some code to MGEvtDisplay 28 29 * mhist/MFillH.cc: 30 - added warning to comment 31 32 * mhist/MHFadcCam.[h,cc]: 33 - added Clone-function. It seems, that this is necessary since 34 root 3.01 35 36 * mhist/MHFadcPix.cc: 37 - changed axis titles 38 39 * mmain/MAnalysis.cc: 40 - added progress bar 41 42 * mmain/MBrowser.[h,cc]: 43 - added layout hints to fTop1,2,3 44 - adde Create/DestroyProgrssBar 45 46 * mmain/MDataCheck.cc: 47 - changes to the layout 48 - disable auto scheme 49 - added progress bar 50 51 * mmain/MMonteCarlo.[h,cc]: 52 - layout changes 53 - added progress bar 54 55 * mraw/MRawEvtData.cc: 56 - new sanity check in Draw 57 58 59 2 60 2001/11/01: Thomas Bretz 3 61 … … 40 98 mgui/MGeomCam.cc, mhist/MHFadcPix.cc, mmc/MMcTrig.cxx: 41 99 - removed inline statement, to make it link on alpha 42 43 100 44 101 -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1003 r1030 87 87 { 88 88 89 MParContainer *named = (MParContainer*)TObject::Clone( newname);89 MParContainer *named = (MParContainer*)TObject::Clone(); 90 90 if (newname && strlen(newname)) named->SetName(newname); 91 91 return named; -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r1014 r1030 98 98 MParContainer(const MParContainer &named); 99 99 MParContainer& operator=(const MParContainer& rhs); 100 virtual ~MParContainer() {} 100 101 101 void SetLogStream(MLog *lg) { fLog = lg; } 102 virtual TObject *Clone(const char *newname="") const; 103 virtual Int_t Compare(const TObject *obj) const; 104 virtual void Copy(TObject &named); 105 virtual void FillBuffer(char *&buffer); 102 106 103 virtual TObject *Clone(const char *newname="") const; 104 virtual Int_t Compare(const TObject *obj) const; 105 virtual void Copy(TObject &named); 106 virtual void FillBuffer(char *&buffer); 107 virtual const char *GetName() const { return fName.Data(); } 108 virtual const char *GetTitle() const { return fTitle.Data(); } 109 virtual ULong_t Hash() { return fName.Hash(); } 110 virtual Bool_t IsSortable() const { return kTRUE; } 111 virtual void SetName(const char *name); // *MENU* 112 virtual void SetObject(const char *name, const char *title); 113 virtual void SetTitle(const char *title=""); // *MENU* 114 virtual void ls(Option_t *option="") const; 115 virtual void Print(Option_t *option="") const; 116 virtual Int_t Sizeof() const; 107 virtual const char *GetName() const { return fName.Data(); } 108 virtual const char *GetTitle() const { return fTitle.Data(); } 109 virtual ULong_t Hash() { return fName.Hash(); } 110 virtual Bool_t IsSortable() const { return kTRUE; } 117 111 118 virtual void Reset() { } 112 virtual void SetName(const char *name); // *MENU* 113 virtual void SetObject(const char *name, const char *title); 114 virtual void SetTitle(const char *title=""); // *MENU* 115 virtual void ls(Option_t *option="") const; 116 virtual void Print(Option_t *option="") const; 117 virtual Int_t Sizeof() const; 119 118 119 virtual void SetLogStream(MLog *lg) { fLog = lg; } 120 virtual void Reset() { } 120 121 virtual Bool_t IsReadyToSave() { return fReadyToSave; } 121 122 virtual void SetReadyToSave(Bool_t flag=kTRUE) { fReadyToSave=flag; } -
trunk/MagicSoft/Mars/mbase/MParList.h
r1014 r1030 24 24 { 25 25 private: 26 TOrdCollection *fContainer; // Collection of Parameter and Data Containers26 TOrdCollection *fContainer; // Collection of Parameter and Data Containers 27 27 TOrdCollection *fAutodelete; // All what this list contains is deleted in the destructor 28 28 … … 36 36 MParList(MParList &ts); 37 37 38 ~MParList();38 virtual ~MParList(); 39 39 40 40 Bool_t AddToList(MParContainer *obj, MParContainer *where = NULL); -
trunk/MagicSoft/Mars/mbase/MReadTree.cc
r1020 r1030 78 78 MReadTree::MReadTree(const char *tname, const char *fname, 79 79 const char *name, const char *title) 80 : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE) 80 : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL) 81 81 { 82 82 fName = name ? name : "MReadTree"; … … 165 165 // -------------------------------------------------------------------------- 166 166 // 167 // This is the implementation of the Auto Enabling Scheme. 168 // For more information see MTask::AddBranchToList. 169 // This function loops over all tasks in the tasklist and enables 170 // all branches which are requested by the tasks. 171 // 172 // To enable 'unknown' branches which are not in the Branchlist of 173 // the tasks you can call EnableBranch 167 // Checks whether a branch with the given name exists in the chain 168 // and sets the branch status of this branch corresponding to status. 169 // 170 void MReadTree::SetBranchStatus(TObject *branch, Bool_t status) 171 { 172 // 173 // Get branch name 174 // 175 const char *name = branch->GetName(); 176 177 // 178 // Check whether this branch really exists 179 // 180 if (!fChain->GetBranch(name)) 181 return; 182 183 // 184 // Set the branch status 185 // 186 fChain->SetBranchStatus(name, status); 187 *fLog << (status ? "Enabled" : "Disabled"); 188 *fLog << " subbranch '" << name << "'." << endl; 189 } 190 191 // -------------------------------------------------------------------------- 192 // 193 // Set the status of all branches in the list to status. 194 // 195 void MReadTree::SetBranchStatus(const TOrdCollection *list, Bool_t status) 196 { 197 // 198 // Loop over all subbranches in this master branch 199 // 200 TIter Next(list); 201 202 TObject *obj; 203 while ((obj=Next())) 204 SetBranchStatus(obj, status); 205 } 206 207 // -------------------------------------------------------------------------- 208 // 209 // This is the implementation of the Auto Enabling Scheme. 210 // For more information see MTask::AddBranchToList. 211 // This function loops over all tasks in the tasklist and enables 212 // all branches which are requested by the tasks. 213 // 214 // To enable 'unknown' branches which are not in the Branchlist of 215 // the tasks you can call EnableBranch 174 216 // 175 217 void MReadTree::EnableBranches(MParList *plist) 176 218 { 177 //178 // if auto enabling is off reject the request179 //180 if (!fAutoEnable)181 return;182 183 219 // 184 220 // check whether branch choosing must be switched on … … 198 234 199 235 // 200 // Loo over all tasks in the task list.236 // Loop over all tasks in the task list. 201 237 // 202 238 MTask *task; 203 239 TIter NextTask(tlist->GetList()); 204 240 while ((task=(MTask*)NextTask())) 205 { 206 // 207 // Loop over all branches of this task 208 // 209 TNamed *branch; 210 TIter NextBranch(task->GetListOfBranches()); 211 while ((branch=(TNamed*)NextBranch())) 212 { 213 // 214 // Get branch name to enable and enable the branch 215 // 216 const char *name = branch->GetName(); 217 218 *fLog << "Enabeling '" << name << "'." << endl; 219 220 fChain->SetBranchStatus(name, kTRUE); 221 } 222 } 241 SetBranchStatus(task->GetListOfBranches(), kTRUE); 242 } 243 244 // -------------------------------------------------------------------------- 245 // 246 // The disables all subbranches of the given master branch. 247 // 248 void MReadTree::DisableSubBranches(TBranch *branch) 249 { 250 // 251 // This is not necessary, it would work without. But the output 252 // may confuse the user... 253 // 254 if (fAutoEnable || fBranchChoosing) 255 return; 256 257 SetBranchStatus(branch->GetListOfBranches(), kFALSE); 223 258 } 224 259 … … 244 279 if (!fNumEntries) 245 280 { 246 *fLog << dbginf << "No entries found in chain (file/s)." << endl;281 *fLog << dbginf << "No entries found in file(s)." << endl; 247 282 return kFALSE; 248 283 } … … 276 311 if (fVetoList->FindObject(name)) 277 312 { 278 *fLog << "Branch " << name << " has veto... skipped." << endl; 313 *fLog << "Master branch " << name << " has veto... skipped." << endl; 314 DisableSubBranches(branch); 279 315 continue; 280 316 } … … 299 335 // 300 336 *fLog << dbginf << "Warning: Class '" << name << "' not existing in dictionary. Branch skipped." << endl; 337 DisableSubBranches(branch); 301 338 continue; 302 339 } … … 308 345 fChain->SetBranchAddress(name, pcont); 309 346 310 *fLog << " Branch" << name << " setup for reading." << endl;347 *fLog << "Master branch address " << name << " setup for reading." << endl; 311 348 312 349 num++; 313 350 } 314 351 315 *fLog << "MReadTree setup " << num << " branches." << endl; 316 317 EnableBranches(pList); 318 352 *fLog << "MReadTree setup " << num << " master branches addresses." << endl; 353 354 // 355 // If auto enabling scheme isn't disabled, do auto enabling 356 // 357 if (fAutoEnable) 358 EnableBranches(pList); 359 360 // 361 // If a progress bar is given set its range. 362 // 319 363 if (fProgress) 320 364 fProgress->SetRange(0, fNumEntries); … … 351 395 Bool_t MReadTree::DecEventNum(UInt_t dec) 352 396 { 353 //! 354 //! this function makes Process() read the event one (or more) before 355 //! the actual position (event) in the tree 356 //! 357 if (fNumEntry < dec/*+1*/) 358 { 359 *fLog << "MReadTree::SetPrevEvent: WARNING: " << fNumEntry/*-1*/ << "-" << dec << " out of Range." << endl; 397 if (fNumEntry-dec >= fNumEntries) 398 { 399 *fLog << "MReadTree::DecEventNum: WARNING - Event " << fNumEntry << "-"; 400 *fLog << dec << "=" << (Int_t)fNumEntry-dec << " out of Range." << endl; 360 401 return kFALSE; 361 402 } 362 403 363 fNumEntry -= dec /*+1*/;404 fNumEntry -= dec; 364 405 return kTRUE; 365 406 } … … 372 413 Bool_t MReadTree::IncEventNum(UInt_t inc) 373 414 { 374 //! 375 //! this function makes Process() read the next (or more) after 376 //! the actual position (event) in the tree 377 //! (Be careful: IncEventNum() or IncEventNum(1) does not chenge anything 378 //! in the standard behaviour of the task) 379 //! 380 if (fNumEntry+inc/*-1*/ >= fNumEntries) 381 { 382 *fLog << "MReadTree::SkipEvents: WARNING: " << fNumEntry/*-1*/ << "+" << inc << " out of Range." << endl; 415 if (fNumEntry+inc >= fNumEntries) 416 { 417 *fLog << "MReadTree::IncEventNum: WARNING - Event " << fNumEntry << "+"; 418 *fLog << inc << "=" << (Int_t)fNumEntry+inc << " out of Range." << endl; 383 419 return kFALSE; 384 420 } 385 421 386 fNumEntry += inc /*-1*/;422 fNumEntry += inc; 387 423 return kTRUE; 388 424 } … … 390 426 // -------------------------------------------------------------------------- 391 427 // 392 // this function makes Process() read event number nr next428 // This function makes Process() read event number nr next 393 429 // 394 430 // Remark: You can use this function after instatiating you MReadTree-object … … 397 433 Bool_t MReadTree::SetEventNum(UInt_t nr) 398 434 { 399 if (nr >=fNumEntries)400 { 401 *fLog << "MReadTree::SetEventNum: WARNING :" << nr << " out of Range." << endl;435 if (nr >= fNumEntries) 436 { 437 *fLog << "MReadTree::SetEventNum: WARNING - " << nr << " out of Range." << endl; 402 438 return kFALSE; 403 439 } … … 409 445 // -------------------------------------------------------------------------- 410 446 // 411 // If you don't want that an object is created for this branch 412 // and/or the branch address is set in the Preprocessing of 413 // MReadTree use VetoBranch. This saves mainly memory space. 447 // For the branch with the given name: 448 // 1) no object is automatically created 449 // 2) the branch address for this branch is not set 450 // (because we lack the object, see 1) 451 // 3) The whole branch (exactly: all its subbranches) are disabled 452 // this means are not read in memory by TTree:GetEntry 414 453 // 415 454 void MReadTree::VetoBranch(const char *name) -
trunk/MagicSoft/Mars/mbase/MReadTree.h
r1020 r1030 7 7 8 8 class TChain; 9 class TBranch; 9 10 class TGProgressBar; 10 11 … … 22 23 TOrdCollection *fVetoList; // List of Branches which are not allowed to get enabled 23 24 24 TGProgressBar *fProgress;// Possible display of status25 TGProgressBar *fProgress; // Possible display of status 25 26 27 void SetBranchStatus(const TOrdCollection *list, Bool_t status); 28 void SetBranchStatus(TObject *branch, Bool_t status); 29 30 void DisableSubBranches(TBranch *b); 26 31 void EnableBranches(MParList *plist); 27 32 void EnableBranchChoosing(); 28 33 34 Bool_t PreProcess(MParList *pList); 35 Bool_t Process(); 36 29 37 public: 30 38 MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL); 31 39 ~MReadTree(); 32 40 33 Bool_t PreProcess(MParList *pList); 34 Bool_t Process(); 41 Int_t AddFile(const char *fname); 42 void DisableAutoScheme() { fAutoEnable = kFALSE; } 43 void EnableBranch(const char *name); 44 void VetoBranch(const char *name); 35 45 36 46 void SetProgressBar(TGProgressBar *bar) { fProgress = bar; } 37 38 Int_t AddFile(const char *fname);39 void VetoBranch(const char *name);40 41 void EnableBranch(const char *name);42 47 43 48 Bool_t GetEvent(); … … 50 55 UInt_t GetEntries() const { return fNumEntries; } 51 56 52 void DisableAutoScheme() { fAutoEnable = kFALSE; } 53 54 ClassDef(MReadTree, 0) // Reads one tree 57 ClassDef(MReadTree, 0) // Reads a tree from file(s) 55 58 }; 56 59 -
trunk/MagicSoft/Mars/mdatacheck/MGDisplayAdc.cc
r961 r1030 279 279 } 280 280 281 // ======================================================================282 283 281 void MGDisplayAdc::CloseWindow() 284 282 { … … 289 287 delete this; 290 288 } 291 292 293 294 // ======================================================================295 // ======================================================================296 289 297 290 Bool_t MGDisplayAdc::BuildHistoList() … … 307 300 // 308 301 const Int_t nhi = fHists->GetEntries(); 309 for (Int_t i=0 ; i<nhi; i++) 302 303 for (Int_t i=0; i<nhi; i++) 310 304 fHistoList->AddEntry(fHists->GetHistHi(i)->GetName(), i+1); 311 305 … … 316 310 } 317 311 318 // ======================================================================319 // ======================================================================320 312 void MGDisplayAdc::UpdateHist() 321 313 { 322 314 const Int_t selected = fHistoList->GetSelected(); 315 316 if (selected<0) 317 { 318 cout << "MGDisplayAdc: No histograms found in list. " << endl; 319 return; 320 } 323 321 324 322 fHistoList->Select(selected); // ??? -
trunk/MagicSoft/Mars/meventdisp/MGCamDisplay.cc
r1015 r1030 115 115 plist->AddToList(pedest); 116 116 117 fInitOk = fEvtLoop->PreProcess();118 119 if (fInitOk)120 GetTaskList()->Process();121 122 117 return geom; 123 118 } … … 147 142 fDisplay = new MCamDisplay(geom); 148 143 fDisplay->Draw(); 149 150 144 fList->Add(fDisplay); 145 146 ReadFirstEvent(); 151 147 152 148 // … … 161 157 SetWindowName("Hillas Event Display"); 162 158 SetIconName("Hillas"); 163 164 UpdateDisplay();165 UpdateNumOfEvts();166 UpdateEventCounter();167 159 168 160 MapWindow(); … … 177 169 void MGCamDisplay::UpdateDisplay() 178 170 { 179 if (! fInitOk)171 if (!IsInitOk()) 180 172 return; 181 173 -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.cc
r1023 r1030 139 139 // -------------------------------------------------------------------------- 140 140 // 141 // Show the correct number of events142 //143 void MGEvtDisplay::UpdateNumOfEvts()144 {145 char txt[100];146 sprintf(txt, "out of %d Events", GetReader()->GetEntries());147 148 fNumOfEvts->SetText(new TGString(txt));149 }150 151 // --------------------------------------------------------------------------152 //153 141 // Add the second part of the top frame: This are the event number controls 154 142 // … … 405 393 AddMenuBar(); 406 394 AddFrames(fname, tname); 407 UpdateEventCounter();408 395 } 409 396 … … 435 422 // and updates the display 436 423 // 437 void MGEvtDisplay::ReadinEvent(UInt_t iEvt) 438 { 439 if (!fInitOk) 440 return; 441 442 Int_t buttons = 4; 443 Int_t retval = 0; 444 445 // 446 // first check if the new event is in the range of possible events 447 // 448 if (iEvt >= GetReader()->GetEntries()) 424 void MGEvtDisplay::ReadinEvent() 425 { 426 if (GetTaskList()->Process()) 449 427 { 450 new TGMsgBox(gClient->GetRoot(), this, "WARNING!", 451 "The event number is out of range!!!", 452 kMBIconExclamation, buttons, &retval); 428 GetReader()->DecEventNum(); 429 UpdateDisplay(); 453 430 } 454 else 455 { 456 GetReader()->SetEventNum(iEvt); 457 458 if (GetTaskList()->Process()) 459 UpdateDisplay(); 460 } 461 462 UpdateEventCounter(); 463 } 464 465 // -------------------------------------------------------------------------- 466 // 467 // Update the event counter 468 // 469 void MGEvtDisplay::UpdateEventCounter() 470 { 471 char txt[256]; 472 473 sprintf(txt, "%d", GetReader()->GetEventNum()); 474 475 fTxtEvtNr->SetText(txt); 431 432 fTxtEvtNr->SetText(Form("%d", GetReader()->GetEventNum()+1)); 433 } 434 435 void MGEvtDisplay::ReadFirstEvent() 436 { 437 fInitOk = fEvtLoop->PreProcess(); 438 439 if (fInitOk) 440 ReadinEvent(); 441 442 TGString *txt = new TGString(Form("out of %d Events", GetReader()->GetEntries())); 443 fNumOfEvts->SetText(txt); 476 444 } 477 445 … … 526 494 // -------------------------------------------------------------------------- 527 495 // 528 // 496 // ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 529 497 // 530 498 // Processes information from all GUI items. … … 535 503 Bool_t MGEvtDisplay::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) 536 504 { 537 switch(GET_MSG(msg)) 505 if (GET_MSG(msg)!=kC_TEXTENTRY && GET_MSG(msg)!=kC_COMMAND) 506 return kTRUE; 507 508 switch(GET_SUBMSG(msg)) 538 509 { 539 case kC_COMMAND: 510 case kTE_ENTER: 511 case kCM_BUTTON: 512 if (parm1==kClose) 513 { 514 CloseWindow(); 515 return kTRUE; 516 } 517 518 if (!fInitOk) 519 return kTRUE; 520 540 521 switch(GET_SUBMSG(msg)) 541 522 { 523 case kTE_ENTER: 524 if (GetReader()->SetEventNum(atoi(fTxtEvtNr->GetText())-1)) 525 ReadinEvent(); 526 return kTRUE; 527 542 528 case kCM_BUTTON: 543 529 switch (parm1) 544 530 { 545 531 case kEvtPrev: 546 // 547 // '-2' is because MReadTree::Process increases the 548 // Event number by one - this is the natural behaviour 549 // after reading one event 550 // 551 ReadinEvent(GetReader()->GetEventNum()-2); 532 if (GetReader()->DecEventNum()) 533 ReadinEvent(); 552 534 return kTRUE; 553 535 554 536 case kEvtNext: 555 // 556 // '+0' is because MReadTree::Process increases the 557 // Event number by one - this is the natural behaviour 558 // after reading one event 559 // 560 ReadinEvent(GetReader()->GetEventNum()); 561 return kTRUE; 562 563 case kClose: 564 CloseWindow(); 565 return kTRUE; 566 } 567 return kTRUE; 568 569 case kCM_MENU: 570 switch (parm1) 571 { 572 case kFileSaveAs: 573 SaveAsDialog(); 574 return kTRUE; 575 case kFileSaveAsRoot: 576 fCanvas->SaveAs("display.root"); 577 return kTRUE; 578 case kFileSaveAsC: 579 fCanvas->SaveSource("display.C"); 580 return kTRUE; 581 case kFileSaveAsPS: 582 fCanvas->SaveAs("display.ps"); 583 return kTRUE; 584 case kFileSaveAsEPS: 585 fCanvas->SaveAs("display.eps"); 586 return kTRUE; 587 case kFileSaveAsGIF: 588 fCanvas->SaveAs("display.gif"); 589 return kTRUE; 590 case kFilePrint: 591 fCanvas->Print(); 592 return kTRUE; 593 case kClose: 594 CloseWindow(); 537 if (GetReader()->IncEventNum()) 538 ReadinEvent(); 595 539 return kTRUE; 596 540 } … … 599 543 return kTRUE; 600 544 601 case kC_TEXTENTRY: 602 if (GET_SUBMSG(msg) == kTE_ENTER) 603 ReadinEvent(atoi(fTxtEvtNr->GetText())-1); 545 case kCM_MENU: 546 switch (parm1) 547 { 548 case kFileSaveAs: 549 SaveAsDialog(); 550 return kTRUE; 551 case kFileSaveAsRoot: 552 fCanvas->SaveAs("display.root"); 553 return kTRUE; 554 case kFileSaveAsC: 555 // FIXME: The line opening the canvas is wrong. 556 fCanvas->SaveSource("display.C"); 557 return kTRUE; 558 case kFileSaveAsPS: 559 fCanvas->SaveAs("display.ps"); 560 return kTRUE; 561 case kFileSaveAsEPS: 562 fCanvas->SaveAs("display.eps"); 563 return kTRUE; 564 case kFileSaveAsGIF: 565 fCanvas->SaveAs("display.gif"); 566 return kTRUE; 567 case kFilePrint: 568 fCanvas->Print(); 569 return kTRUE; 570 case kClose: 571 CloseWindow(); 572 return kTRUE; 573 } 604 574 return kTRUE; 605 575 } 606 607 576 return kTRUE; 608 577 } -
trunk/MagicSoft/Mars/meventdisp/MGEvtDisplay.h
r1023 r1030 40 40 41 41 void SaveAsDialog() const; 42 void ReadinEvent(); 42 43 43 void ReadinEvent(UInt_t iEvt);44 Bool_t fInitOk; 44 45 45 46 protected: … … 54 55 TGVerticalFrame *fMidFrame; 55 56 56 Bool_t fInitOk;57 58 57 MParList *GetParList() const; 59 58 MTaskList *GetTaskList() const; 60 59 MReadTree *GetReader() const; 61 60 62 void UpdateEventCounter();63 void UpdateNumOfEvts();61 void ReadFirstEvent(); 62 Bool_t IsInitOk() { return fInitOk; } 64 63 65 64 virtual void UpdateDisplay() = 0; -
trunk/MagicSoft/Mars/meventdisp/MGFadcDisp.cc
r991 r1030 125 125 // preprocess eventloop and read in first event (process) 126 126 // 127 fInitOk = fEvtLoop->PreProcess(); 128 129 if (fInitOk) 130 GetTaskList()->Process(); 127 GetReader()->DisableAutoScheme(); 128 ReadFirstEvent(); 131 129 132 130 // … … 144 142 SetWindowName("Fadc Event Display"); 145 143 SetIconName("Fadc"); 146 147 UpdateDisplay();148 UpdateNumOfEvts();149 UpdateEventCounter();150 144 151 145 MapWindow(); … … 220 214 void MGFadcDisp::UpdateDisplay() 221 215 { 222 if (! fInitOk)216 if (!IsInitOk()) 223 217 return; 224 218 -
trunk/MagicSoft/Mars/mhist/MFillH.cc
r1004 r1030 25 25 ////////////////////////////////////////////////////////////////////////////// 26 26 // // 27 // MFill 27 // MFillH // 28 28 // // 29 29 // This is a common interface (task) to fill mars histograms. Every mars // … … 35 35 // objects in the parameter list or by specifiing a pointer to the object. // 36 36 // (s. Constructor) // 37 // // 38 // WARNING: // 39 // Because MFillH is a generalized task to fill histograms it doesn't // 40 // know about which branches from a file are necessary to fill the // 41 // histograms. If you are reading data from a file which is directly // 42 // filled into a histogram via MFillH, please call either // 43 // MReadTree::DisableAutoScheme() or enable the necessary branches by // 44 // yourself, using MReadTree::EnableBranch() // 37 45 // // 38 46 // Input Containers: // -
trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
r1004 r1030 44 44 // creates an a list of histograms for all pixels and both gain channels 45 45 // 46 MHFadcCam::MHFadcCam (const char *name, const char *title) 46 #include <iostream.h> 47 MHFadcCam::MHFadcCam(const char *name, const char *title) 47 48 { 48 49 // 49 50 // set the name and title of this object 50 51 // 51 52 fName = name ? name : "MHFadcCam" ; 53 fTitle = title ? title : "Container for ADC spectra histograms" ; 52 fName = name ? name : "MHFadcCam"; 53 fTitle = title ? title : "Container for ADC spectra histograms"; 54 54 55 55 // … … 65 65 66 66 // -------------------------------------------------------------------------- 67 MHFadcCam::~MHFadcCam 67 MHFadcCam::~MHFadcCam() 68 68 { 69 69 delete fArray; 70 } 71 72 // -------------------------------------------------------------------------- 73 // 74 // Our own clone function is necessary since root 3.01/06 or Mars 0.4 75 // I don't know the reason 76 // 77 TObject *MHFadcCam::Clone(const char *) const 78 { 79 MHFadcCam *cam = new MHFadcCam; 80 81 for (int i=0; i<577; i++) 82 { 83 delete (*cam->fArray)[i]; 84 (*cam->fArray)[i] = (MHFadcPix*)(*fArray)[i]->Clone(); 85 } 86 return cam; 70 87 } 71 88 -
trunk/MagicSoft/Mars/mhist/MHFadcCam.h
r1015 r1030 26 26 27 27 public: 28 28 MHFadcCam(const char *name=NULL, const char *title=NULL); 29 29 ~MHFadcCam(); 30 30 … … 46 46 void DrawPix(UInt_t i) { (*this)[i]->Draw(); } 47 47 48 Int_t GetEntries() { return fArray->GetEntries(); } 48 Int_t GetEntries() const { return fArray->GetEntries(); } 49 50 TObject *Clone(const char *opt="") const; 49 51 50 52 ClassDef(MHFadcCam, 1) // A list of histograms storing the Fadc spektrum of one pixel -
trunk/MagicSoft/Mars/mhist/MHFadcPix.cc
r1027 r1030 54 54 55 55 fHistHi->SetDirectory(NULL); 56 fHistHi->SetXTitle(" Time/Slices");57 fHistHi->SetYTitle(" Signal");56 fHistHi->SetXTitle("Signal/FADC Units"); 57 fHistHi->SetYTitle("Count"); 58 58 59 59 delete [] name; … … 66 66 67 67 fHistLo->SetDirectory(NULL); 68 fHistLo->SetXTitle(" Time/Slices");69 fHistLo->SetYTitle(" Signal");68 fHistLo->SetXTitle("Signal/FADC Units"); 69 fHistLo->SetYTitle("Count"); 70 70 71 71 delete [] name; -
trunk/MagicSoft/Mars/mmain/MAnalysis.cc
r1021 r1030 31 31 #include <TGButton.h> // TGTextButton 32 32 #include <TGTextEntry.h> // TGNumberEntry 33 #include <TGProgressBar.h> // TGHProgressBar34 35 33 36 34 ClassImp(MAnalysis) … … 48 46 fList->Add(hillas); 49 47 50 TGLayoutHints *laybut = new TGLayoutHints(kLHints Top|kLHintsLeft, 10, 10, 5, 5);48 TGLayoutHints *laybut = new TGLayoutHints(kLHintsCenterY|kLHintsLeft, 10, 10, 5, 5); 51 49 fList->Add(laybut); 52 50 … … 209 207 } 210 208 211 TGHProgressBar bar(fTop2);212 TGLayoutHints laybar(kLHintsExpandX|kLHintsCenterY|kLHintsRight, 10, 10, 5, 5); //, 10); //, 5, 5);213 bar.SetWidth(150);214 fTop2->AddFrame(&bar, &laybar);215 Layout();216 MapSubwindows();217 218 209 // 219 210 // Create a empty Parameter List and an empty Task List … … 252 243 // 253 244 MReadTree read("Events", fInputFile); 254 read.SetProgressBar(&bar);255 245 256 246 MCerPhotCalc ncalc; … … 277 267 MEvtLoop evtloop; 278 268 evtloop.SetParList(&plist); 279 evtloop.SetProgressBar(&bar); 269 270 // 271 // Add ProgressBar to window 272 // 273 TGProgressBar *bar = CreateProgressBar(fTop2); 274 read.SetProgressBar(bar); 275 evtloop.SetProgressBar(bar); 276 280 277 // 281 278 // Execute your analysis … … 283 280 Bool_t rc = evtloop.Eventloop(); 284 281 285 fTop2->RemoveFrame(&bar); 286 Layout(); 287 MapSubwindows(); 282 // 283 // Remove progressbar from window 284 // 285 DestroyProgressBar(bar); 288 286 289 287 if (!rc) -
trunk/MagicSoft/Mars/mmain/MBrowser.cc
r952 r1030 34 34 #include <TGListBox.h> // TGListBox 35 35 #include <TGComboBox.h> // TGComboBox 36 #include <TGProgressBar.h> // TGHProgressBar 36 37 #include <TGFSContainer.h> // TGFileContainer 37 38 … … 80 81 void MBrowser::CreateUpperFrame(TGCompositeFrame *frametop) 81 82 { 83 TGLayoutHints *lay1 = new TGLayoutHints(kLHintsTop |kLHintsExpandX, 2, 2, 2, 0); 84 TGLayoutHints *lay2 = new TGLayoutHints(kLHintsCenterY|kLHintsExpandX, 2, 2, 2, 2); 85 TGLayoutHints *lay3 = new TGLayoutHints(kLHintsBottom |kLHintsExpandX, 2, 2, 0, 2); 86 fList->Add(lay1); 87 fList->Add(lay2); 88 fList->Add(lay3); 82 89 83 90 // 84 91 // *********** Create Contents of frame top (upper part) ********** 85 92 // 86 fTop1 = new TGHorizontalFrame(frametop, 300, 100); 87 fTop2 = new TGHorizontalFrame(frametop, 300, 100); 88 fTop3 = new TGHorizontalFrame(frametop, 300, 100); 89 90 frametop->AddFrame(fTop1); 91 frametop->AddFrame(fTop2); 92 frametop->AddFrame(fTop3); 93 fTop1 = new TGHorizontalFrame(frametop, 500, 50); 94 fTop2 = new TGHorizontalFrame(frametop, 500, 50); 95 fTop3 = new TGHorizontalFrame(frametop, 500, 50); 96 97 // FIXME: If I use TGLayoutHints the Progress Bar doesn't disappear! 98 frametop->AddFrame(fTop1);//, lay1); 99 frametop->AddFrame(fTop2);//, lay2); 100 frametop->AddFrame(fTop3);//, lay3); 93 101 94 102 fList->Add(fTop1); … … 271 279 // ---- Create the top window with a lot of buttons ---- 272 280 // 281 TGLayoutHints *layframetop = new TGLayoutHints(kLHintsExpandX); 282 fList->Add(layframetop); 283 273 284 TGCompositeFrame *frametop = new TGCompositeFrame(this, 300, 100, kVerticalFrame); 274 285 fList->Add(frametop); 275 AddFrame(frametop );286 AddFrame(frametop, layframetop); 276 287 277 288 linesep = new TGHorizontal3DLine(this); … … 297 308 // 298 309 ChangeDir(); 299 SetWMSizeHints(400, 350, 1000, 1000, 10, 10); // set the smallest and biggest size of the Main frame 300 } 301 302 303 // ====================================================================== 304 // ====================================================================== 310 SetWMSizeHints(400, 350, 1000, 1000, 10, 10); // set the smallest and biggest size of the Main frame 311 } 312 305 313 306 314 MBrowser::~MBrowser() … … 313 321 } 314 322 315 // ====================================================================== 316 // ====================================================================== 323 TGProgressBar *MBrowser::CreateProgressBar(TGHorizontalFrame *frame) 324 { 325 static TGLayoutHints laybar(kLHintsCenterY|kLHintsRight/*|kLHintsExpandX*/, 326 10, 10); 327 328 TGHProgressBar *bar=new TGHProgressBar(frame); 329 330 bar->SetWidth(150); 331 bar->ShowPosition(); 332 333 frame->AddFrame(bar, &laybar); 334 335 Layout(); 336 MapSubwindows(); 337 338 return bar; 339 } 340 341 void MBrowser::DestroyProgressBar(TGProgressBar *bar) 342 { 343 TGHorizontalFrame *frame = (TGHorizontalFrame*)bar->GetParent(); 344 345 frame->RemoveFrame(bar); 346 347 Layout(); 348 MapSubwindows(); 349 350 delete bar; 351 } 317 352 318 353 void MBrowser::CloseWindow() … … 326 361 } 327 362 328 329 // ======================================================================330 // ======================================================================331 332 363 Bool_t MBrowser::InputFileSelected() 333 364 { … … 337 368 return fInputFile[0]!='\0'; 338 369 } 339 340 341 // ======================================================================342 // ======================================================================343 370 344 371 void MBrowser::DisplError(const char *txt) -
trunk/MagicSoft/Mars/mmain/MBrowser.h
r1016 r1030 14 14 class TGListView; 15 15 class TGComboBox; 16 class TGProgressBar; 16 17 class TGPictureButton; 17 18 class TGFileContainer; … … 54 55 void ChangeDir(const char *txt=NULL); 55 56 57 TGProgressBar *CreateProgressBar(TGHorizontalFrame *frame); 58 void DestroyProgressBar(TGProgressBar *bar); 59 56 60 TGHorizontalFrame *fTop1; 57 61 TGHorizontalFrame *fTop2; -
trunk/MagicSoft/Mars/mmain/MDataCheck.cc
r1023 r1030 56 56 : MBrowser(main, p, w, h) 57 57 { 58 TGTextButton *pedadc = new TGTextButton(fTop 2, "ADC Spectra of Pedestals", kButPedAdc);59 TGTextButton *cradc = new TGTextButton(fTop 2, "ADC Specta of Cosmics", kButEvtAdc);58 TGTextButton *pedadc = new TGTextButton(fTop1, "ADC Spectra of Pedestals", kButPedAdc); 59 TGTextButton *cradc = new TGTextButton(fTop1, "ADC Specta of Cosmics", kButEvtAdc); 60 60 TGTextButton *pedtdc = new TGTextButton(fTop3, "TDC Spectra of Pedestals", kButPedTdc); 61 61 TGTextButton *crtdc = new TGTextButton(fTop3, "TDC Specta of Cosmics", kButEvtTdc); … … 74 74 fList->Add(laybut); 75 75 76 fTop 2->AddFrame(pedadc, laybut);77 fTop 2->AddFrame(cradc, laybut);76 fTop1->AddFrame(pedadc, laybut); 77 fTop1->AddFrame(cradc, laybut); 78 78 79 79 fTop3->AddFrame(pedtdc, laybut); … … 115 115 plist.AddToList(&tasks); 116 116 117 MReadTree read in(treeName, inputfile);118 tasks.AddToList(&readin);117 MReadTree read(treeName, inputfile); 118 read.DisableAutoScheme(); 119 119 120 MFillH fillspect("MRawEvtData", "MHFadcCam"); 121 tasks.AddToList(&fillspect); 120 MFillH fill("MRawEvtData", "MHFadcCam"); 121 122 tasks.AddToList(&read); 123 tasks.AddToList(&fill); 122 124 123 125 // … … 127 129 magic.SetParList(&plist); 128 130 129 // ADD ProgressBar, TGHProgressBar::ShowStatus(); 131 // 132 // Add ProgressBar to window 133 // 134 TGProgressBar *bar = CreateProgressBar(fTop1); 135 read.SetProgressBar(bar); 136 magic.SetProgressBar(bar); 130 137 131 138 // 132 // start the loop running139 // Execute your analysis 133 140 // 134 if (!magic.Eventloop()) 141 Bool_t rc = magic.Eventloop(300); 142 143 // 144 // Remove progressbar from window 145 // 146 DestroyProgressBar(bar); 147 148 if (!rc) 135 149 return; 136 150 -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.cc
r1016 r1030 32 32 #include <TGButton.h> // TGTextButton 33 33 #include <TGTextEntry.h> // TGTextEntry 34 #include <TGProgressBar.h> // TGHProgressBar 34 35 #include <TGButtonGroup.h> // TGVButtonGroup 35 36 … … 44 45 void MMonteCarlo::AddButtons() 45 46 { 46 TGTextButton *carea = new TGTextButton(fTop 1, "Collection Area", M_BUTTON_COLAREA);47 TGTextButton *trate = new TGTextButton(fTop 1, "Trigger Rate", M_BUTTON_RATE);48 TGTextButton *thold = new TGTextButton(fTop 1, "Threshold", M_BUTTON_THRESHOLD);47 TGTextButton *carea = new TGTextButton(fTop2, "Collection Area", M_BUTTON_COLAREA); 48 TGTextButton *trate = new TGTextButton(fTop2, "Trigger Rate", M_BUTTON_RATE); 49 TGTextButton *thold = new TGTextButton(fTop2, "Threshold", M_BUTTON_THRESHOLD); 49 50 50 51 fList->Add(carea); … … 59 60 fList->Add(laybut); 60 61 61 fTop 1->AddFrame(carea, laybut);62 fTop 1->AddFrame(trate, laybut);63 fTop 1->AddFrame(thold, laybut);62 fTop2->AddFrame(carea, laybut); 63 fTop2->AddFrame(trate, laybut); 64 fTop2->AddFrame(thold, laybut); 64 65 } 65 66 … … 208 209 } 209 210 210 void MMonteCarlo::CalculateCollectionArea() const211 void MMonteCarlo::CalculateCollectionArea() 211 212 { 212 213 // … … 231 232 // - Then we can fill the efficiency histograms 232 233 // 233 MReadTree reader("Events", fInputFile); 234 // reader.UseLeaf("fImpact"); 235 // reader.UseLeaf("fEnergy"); 236 // reader.UseLeaf("fNumFirstLevel"); 237 238 tlist.AddToList(&reader); 234 MReadTree read("Events", fInputFile); 235 tlist.AddToList(&read); 239 236 240 237 MMcCollectionAreaCalc effi; … … 248 245 249 246 // 250 // Start to loop over all events 251 // 252 if (!magic.Eventloop()) 247 // Add ProgressBar to window 248 // 249 TGProgressBar *bar = CreateProgressBar(fTop2); 250 read.SetProgressBar(bar); 251 magic.SetProgressBar(bar); 252 253 // 254 // Execute your analysis 255 // 256 Bool_t rc = magic.Eventloop(); 257 258 // 259 // Remove progressbar from window 260 // 261 DestroyProgressBar(bar); 262 263 if (!rc) 253 264 return; 254 265 … … 260 271 } 261 272 262 void MMonteCarlo::CalculateTriggerRate() const273 void MMonteCarlo::CalculateTriggerRate() 263 274 { 264 275 // This macro has two input parameter: … … 332 343 // analised trigger conditions should be set (BgR[]) 333 344 // 334 MReadTree reader("Events", fInputFile); 335 /* reader.UseLeaf("fImpact"); 336 reader.UseLeaf("fEnergy"); 337 reader.UseLeaf("fPhi"); 338 reader.UseLeaf("fTheta"); 339 reader.UseLeaf("fNumFirstLevel"); 340 reader.UseLeaf("fPhotElfromShower"); 341 */ 342 tlist.AddToList(&reader); 345 MReadTree read("Events", fInputFile); 346 tlist.AddToList(&read); 343 347 344 348 Float_t BgR[10]={660, 4, 0, 0, 0, 0, 0, 0, 0, 0}; … … 354 358 355 359 // 356 // Start to loop over all events 357 // 358 if (!magic.Eventloop()) 360 // Add ProgressBar to window 361 // 362 TGProgressBar *bar = CreateProgressBar(fTop2); 363 read.SetProgressBar(bar); 364 magic.SetProgressBar(bar); 365 366 // 367 // Execute your analysis 368 // 369 Bool_t rc = magic.Eventloop(); 370 371 // 372 // Remove progressbar from window 373 // 374 DestroyProgressBar(bar); 375 376 if (!rc) 359 377 return; 360 378 … … 362 380 } 363 381 364 void MMonteCarlo::CalculateThreshold() const382 void MMonteCarlo::CalculateThreshold() 365 383 { 366 384 const Int_t dim = GetDim(); … … 423 441 // like one dimension MMcThresholdCalc 424 442 // 443 425 444 MReadTree read("Events", fInputFile); 426 /* read.UseLeaf("fEnergy"); 427 read.UseLeaf("fNumFirstLevel"); 428 */ 445 429 446 MMcThresholdCalc calc(dim); 430 447 tlist.AddToList(&read); … … 435 452 436 453 // 437 // Begin the loop (if the loop wasn't successfull 438 // don't try to draw the results 439 // 440 if (!evtloop.Eventloop()) 454 // Add ProgressBar to window 455 // 456 TGProgressBar *bar = CreateProgressBar(fTop2); 457 read.SetProgressBar(bar); 458 evtloop.SetProgressBar(bar); 459 460 // 461 // Execute your analysis 462 // 463 Bool_t rc = evtloop.Eventloop(); 464 465 // 466 // Remove progressbar from window 467 // 468 DestroyProgressBar(bar); 469 470 if (!rc) 441 471 return; 442 472 -
trunk/MagicSoft/Mars/mmain/MMonteCarlo.h
r1016 r1030 20 20 Int_t GetDim() const; 21 21 22 void CalculateCollectionArea() const;23 void CalculateTriggerRate() const;24 void CalculateThreshold() const;22 void CalculateCollectionArea(); 23 void CalculateTriggerRate(); 24 void CalculateThreshold(); 25 25 26 26 void AddButtons(); -
trunk/MagicSoft/Mars/mraw/MRawEvtData.cc
r1004 r1030 209 209 void MRawEvtData::Draw(Option_t *opt) 210 210 { 211 // ----- AppendPad(opt);212 213 //214 // FIXME: BIG MEMORY LEAK! (( How and when are the objects deleted?)215 //211 if (GetNumPixels()==0) 212 { 213 *fLog << "Sorry, no pixel to draw!" << endl; 214 return; 215 } 216 216 217 217 TString str(opt); … … 247 247 graph->Draw("AC*"); 248 248 249 TH1F *hist = graph->GetHistogram(); 250 251 hist->SetXTitle("Time/FADC Slices"); 252 hist->SetYTitle("Signal/FADC Units"); 253 249 254 return; 250 255 } … … 269 274 270 275 TH1F *hist = new TH1F(name, "Hi Gain Samples FADC", n, 0, n); 276 hist->SetXTitle("Time/FADC Slices"); 277 hist->SetYTitle("Signal/FADC Units"); 271 278 272 279 for (int i=0; i<n; i++)
Note:
See TracChangeset
for help on using the changeset viewer.