Changeset 3788 for trunk/MagicSoft/Mars
- Timestamp:
- 04/21/04 15:38:08 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3787 r3788 18 18 19 19 -*-*- END OF LINE -*-*- 20 2004/04/21: Thomas Bretz 21 22 * mbase/MTask.cc, mbase/MTaskList.cc: 23 - let MTask in list fTaskProcess to be used as a counter 24 25 * mdata/MDataChain.[h,cc]: 26 - added some treatments for combinations of +/- signs 27 28 * mfbase/MFilterList.[h,cc]: 29 - added a new constructor to simplyfy filter-inversions 30 31 * mfileio/MReadReports.cc: 32 - added comment 33 34 * mhbase/MBinning.[h,cc]: 35 - added new constructor to simplify calls in macros 36 37 * mhbase/MFillH.[h,cc]: 38 - added fDrawOption to be used in MStatusDisplay 39 40 * mhist/MHFalseSource.cc: 41 - added comment 42 43 44 20 45 2004/04/20: Thomas Bretz 21 46 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r3666 r3788 77 77 // etc. PostProcess is only executed in case of 78 78 // PreProcess was successfull (returned kTRUE) 79 // 80 // 81 // Remark: Using a MTask in your tasklist doesn't make much sense, 82 // because it is doing nothing. However it is a nice tool 83 // to count something (exspecially if used together with a 84 // filter) 85 // 79 86 // 80 87 // Version 1: … … 391 398 void MTask::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const 392 399 { 393 if (!OverwritesProcess() )400 if (!OverwritesProcess() && IsA()!=MTask::Class()) 394 401 return; 395 402 … … 447 454 // Check whether we reached the base class MTask 448 455 // 449 if ( TString(cls->GetName())=="MTask")456 if (cls==MTask::Class()) 450 457 return kFALSE; 451 458 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r3666 r3788 43 43 // from the list. 44 44 // 45 // Remark: The Process function is only executed if the class of your task 46 // overloads Process() or if the task itself is a MTask. This 47 // means if you have a task without Process() (only PreProcess 48 // and PostProcess no time is lost during execution) 49 // 45 50 // Warning: 46 51 // Be carefull if you are writing your tasklist … … 300 305 // -------------------------------------------------------------------------- 301 306 // 307 // removes a task from the list (used in PreProcess). 308 // if kIsOwner is set the task is deleted. (see SetOwner()) 309 // 310 void MTaskList::Remove(MTask *task) 311 { 312 TObject *obj = fTasks->Remove(task); 313 314 if (TestBit(kIsOwner)) 315 delete obj; 316 } 317 318 // -------------------------------------------------------------------------- 319 // 320 // do pre processing (before eventloop) of all tasks in the task-list 321 // Only if a task overwrites the Process function the task is 322 // added to the fTaskProcess-List. This makes the execution of the 323 // tasklist a little bit (only a little bit) faster, bacause tasks 324 // doing no Processing are not Processed. 325 // 326 Int_t MTaskList::PreProcess(MParList *pList) 327 { 328 *fLog << all << "Preprocessing... " << flush; 329 if (fDisplay) 330 { 331 // Set status lines 332 fDisplay->SetStatusLine1("PreProcessing..."); 333 fDisplay->SetStatusLine2(""); 334 } 335 336 fParList = pList; 337 338 // 339 // Make sure, that the ReadyToSave flag is not reset from a tasklist 340 // running as a task in another tasklist. 341 // 342 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset); 343 if (!noreset) 344 fParList->SetBit(MParList::kDoNotReset); 345 346 // 347 // create the Iterator over the tasklist 348 // 349 TIter Next(fTasks); 350 351 MTask *task=NULL; 352 353 // 354 // loop over all tasks for preproccesing 355 // 356 while ((task=(MTask*)Next())) 357 { 358 // 359 // PreProcess the task and check for it's return value. 360 // 361 switch (task->CallPreProcess(fParList)) 362 { 363 case kFALSE: 364 return kFALSE; 365 366 case kTRUE: 367 // Handle GUI events (display changes, mouse clicks) 368 if (fDisplay) 369 gSystem->ProcessEvents(); 370 continue; 371 372 case kSKIP: 373 Remove(task); 374 continue; 375 } 376 377 *fLog << err << dbginf << "PreProcess of " << task->GetDescriptor(); 378 *fLog << " returned an unknown value... aborting." << endl; 379 return kFALSE; 380 } 381 382 *fLog << all << endl; 383 384 // 385 // Reset the ReadyToSave flag. 386 // 387 if (!noreset) 388 { 389 fParList->SetReadyToSave(kFALSE); 390 fParList->ResetBit(MParList::kDoNotReset); 391 } 392 393 // 394 // loop over all tasks to fill fTasksProcess 395 // 396 Next.Reset(); 397 fTasksProcess.Clear(); 398 while ((task=(MTask*)Next())) 399 if (task->IsA()==MTask::Class() || task->OverwritesProcess()) 400 fTasksProcess.Add(task); 401 402 return kTRUE; 403 } 404 405 // -------------------------------------------------------------------------- 406 // 302 407 // do reinit of all tasks in the task-list 303 408 // … … 348 453 pList->ResetBit(MParList::kDoNotReset); 349 454 } 350 351 return kTRUE;352 }353 354 // --------------------------------------------------------------------------355 //356 // removes a task from the list (used in PreProcess).357 // if kIsOwner is set the task is deleted. (see SetOwner())358 //359 void MTaskList::Remove(MTask *task)360 {361 TObject *obj = fTasks->Remove(task);362 363 if (TestBit(kIsOwner))364 delete obj;365 }366 367 // --------------------------------------------------------------------------368 //369 // do pre processing (before eventloop) of all tasks in the task-list370 // Only if a task overwrites the Process function the task is371 // added to the fTaskProcess-List. This makes the execution of the372 // tasklist a little bit (only a little bit) faster, bacause tasks373 // doing no Processing are not Processed.374 //375 Int_t MTaskList::PreProcess(MParList *pList)376 {377 *fLog << all << "Preprocessing... " << flush;378 if (fDisplay)379 {380 // Set status lines381 fDisplay->SetStatusLine1("PreProcessing...");382 fDisplay->SetStatusLine2("");383 }384 385 fParList = pList;386 387 //388 // Make sure, that the ReadyToSave flag is not reset from a tasklist389 // running as a task in another tasklist.390 //391 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset);392 if (!noreset)393 fParList->SetBit(MParList::kDoNotReset);394 395 //396 // create the Iterator over the tasklist397 //398 TIter Next(fTasks);399 400 MTask *task=NULL;401 402 //403 // loop over all tasks for preproccesing404 //405 while ((task=(MTask*)Next()))406 {407 //408 // PreProcess the task and check for it's return value.409 //410 switch (task->CallPreProcess(fParList))411 {412 case kFALSE:413 return kFALSE;414 415 case kTRUE:416 // Handle GUI events (display changes, mouse clicks)417 if (fDisplay)418 gSystem->ProcessEvents();419 continue;420 421 case kSKIP:422 Remove(task);423 continue;424 }425 426 *fLog << err << dbginf << "PreProcess of " << task->GetDescriptor();427 *fLog << " returned an unknown value... aborting." << endl;428 return kFALSE;429 }430 431 *fLog << all << endl;432 433 //434 // Reset the ReadyToSave flag.435 //436 if (!noreset)437 {438 fParList->SetReadyToSave(kFALSE);439 fParList->ResetBit(MParList::kDoNotReset);440 }441 442 //443 // loop over all tasks to fill fTasksProcess444 //445 Next.Reset();446 fTasksProcess.Clear();447 while ((task=(MTask*)Next()))448 if (task->OverwritesProcess())449 fTasksProcess.Add(task);450 455 451 456 return kTRUE; -
trunk/MagicSoft/Mars/mdata/MDataChain.cc
r3666 r3788 45 45 // "MCameraLV.fPowerSupplyA.fVoltagePos5V" 46 46 // 47 // You can also use brackets:47 // You can also use parantheses: 48 48 // "HillasDource.fDist / (MHillas.fLength + MHillas.fWidth)" 49 49 // … … 57 57 // While a^b returns a to the power of b 58 58 // 59 // Warning: There is no priority rule build in. So better use brackets59 // Warning: There is no priority rule build in. So better use parantheses 60 60 // to get correct results. The rule is parsed/evaluated from the left 61 61 // to the right, which means: … … 158 158 // - The possibility to use other objects inheriting from MData 159 159 // is missing. 160 // - By automatic pre-adding brackets to the rule it would be possible160 // - By automatic pre-adding parantheses to the rule it would be possible 161 161 // to implement priorities for operators. 162 162 // … … 365 365 } 366 366 367 void MDataChain::SimplifyString(TString &txt) const 368 { 369 while (txt.First("--")>=0 || txt.First("++")>=0 || 370 txt.First("+-")>=0 || txt.First("-+")>=0) 371 { 372 txt.ReplaceAll("--", "+"); 373 txt.ReplaceAll("++", "+"); 374 txt.ReplaceAll("-+", "-"); 375 txt.ReplaceAll("+-", "-"); 376 } 377 } 378 367 379 // -------------------------------------------------------------------------- 368 380 // … … 371 383 MData *MDataChain::ParseString(TString txt, Int_t level) 372 384 { 385 if (level==0) 386 SimplifyString(txt); 387 373 388 MData *member0=NULL; 374 389 … … 387 402 { 388 403 // 389 // Search for the corresponding bracket 390 // 391 Int_t first=GetBracket(txt, '(', ')'); 392 404 // Search for the corresponding parantheses 405 // 406 const Int_t first=GetBracket(txt, '(', ')'); 393 407 if (first==txt.Length()) 394 408 { … … 400 414 401 415 // 402 // Make a copy of the 'interieur' and delete the substring ä416 // Make a copy of the 'interieur' and delete the substring 403 417 // including the brackets 404 418 // … … 462 476 if (txt[0]!='-' && txt[0]!='+') 463 477 { 464 *fLog << err << dbginf << "Syntax Error: First argument of symbol'";465 *fLog << txt[0] << "' missing." << endl;478 *fLog << err << dbginf << "Syntax Error: First argument of '"; 479 *fLog << txt[0] << "' opartor missing." << endl; 466 480 if (member0) 467 481 delete member0; -
trunk/MagicSoft/Mars/mdata/MDataChain.h
r3666 r3788 44 44 Int_t GetBracket(TString txt, char open, char close); 45 45 46 void SimplifyString(TString &txt) const; 46 47 MData *ParseString(TString txt, Int_t level); 47 48 MData *ParseDataMember(TString txt); -
trunk/MagicSoft/Mars/mfbase/MFilterList.cc
r3682 r3788 38 38 // invert the meaning of a filter, by eg: 39 39 // 40 // MF anyfilter("MHillas.fAlpha"); 41 // 42 // MFilterList alist; 43 // alist.AddToList(&anyfilter); 44 // 45 // alist.SetInverted(); 40 // MF anyfilter("MHillas.fAlpha"); 41 // 42 // MFilterList alist; 43 // alist.AddToList(&anyfilter); 44 // 45 // alist.SetInverted(); 46 // 47 // or do 48 // 49 // MFilterList alist(&anyfilter); 50 // 46 51 // 47 52 // Adding the filterlist to the eventloop will process all contained filters. … … 72 77 // -------------------------------------------------------------------------- 73 78 // 74 // Constructor. 79 // Wrapper to simplify constructors. 80 // 81 void MFilterList::Init(const char *name, const char *title) 82 { 83 fName = name ? name : gsDefName.Data(); 84 fTitle = title ? title : gsDefTitle.Data(); 85 86 gROOT->GetListOfCleanups()->Add(&fFilters); 87 fFilters.SetBit(kMustCleanup); 88 89 fFilterType = kEAnd; 90 } 91 92 // -------------------------------------------------------------------------- 93 // 94 // Default Constructor. 75 95 // 76 96 // Specify the boolean operation which is used to evaluate the … … 91 111 MFilterList::MFilterList(const char *type, const char *name, const char *title) 92 112 { 93 fName = name ? name : gsDefName.Data(); 94 fTitle = title ? title : gsDefTitle.Data(); 95 96 gROOT->GetListOfCleanups()->Add(&fFilters); 97 fFilters.SetBit(kMustCleanup); 98 99 fFilterType = kEAnd; 113 Init(name, title); 100 114 101 115 TString str(type); … … 113 127 // -------------------------------------------------------------------------- 114 128 // 129 // Constructor. 130 // 131 // Setup an '&&' filter list, adds the filter to the list and 132 // call MFilterList::SetInverted() 133 // 134 // To be used as a logical NOT. 135 // 136 MFilterList::MFilterList(MFilter *f, const char *name, const char *title) 137 { 138 Init(name, title); 139 140 SetInverted(); 141 AddToList(f); 142 } 143 144 // -------------------------------------------------------------------------- 145 // 115 146 // CopyConstructor 116 147 // -
trunk/MagicSoft/Mars/mfbase/MFilterList.h
r3573 r3788 31 31 void StreamPrimitive(ofstream &out) const; 32 32 33 void Init(const char *name, const char *title); 34 33 35 public: 34 36 MFilterList(const char *type="&&", const char *name=NULL, const char *title=NULL); 37 MFilterList(MFilter *f, const char *name=NULL, const char *title=NULL); 35 38 MFilterList(MFilterList &ts); 36 39 ~MFilterList() -
trunk/MagicSoft/Mars/mfileio/MReadReports.cc
r3497 r3788 127 127 // All calls to AddTree _must_ be BEFORE the calls to AddFile! 128 128 // 129 // To be done: A flag(?) telling whether the headers can be skipped. 130 // 129 131 void MReadReports::AddTree(const char *tree, const char *time, Bool_t master) 130 132 { -
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r2735 r3788 61 61 62 62 SetEdges(10, 0, 1); 63 64 63 fType = kIsDefault; 65 64 } 66 65 66 MBinning::MBinning(Int_t nbins, Axis_t lo, Axis_t hi, const char *name, const char *opt="", const char *title=NULL) 67 { 68 fName = name ? name : gsDefName.Data(); 69 fTitle = title ? title : gsDefTitle.Data(); 70 71 SetEdges(nbins, lo, hi, opt); 72 73 } 67 74 void MBinning::SetEdges(const TAxis &axe) 68 75 { … … 110 117 111 118 fType = kIsLinear; 119 } 120 121 // -------------------------------------------------------------------------- 122 // 123 // Calls SetEdgesLog if opt contains "log" 124 // Calls SetEdgesCos if opt contains "cos" 125 // Calls SetEdges in all other cases 126 // 127 void MBinning::SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up, const char *opt) 128 { 129 const TString o(opt); 130 if (o.Contains("log", TString::kIgnoreCase)) 131 { 132 SetEdgesLog(nbins, lo, up); 133 return; 134 } 135 if (o.Contains("cos", TString::kIgnoreCase)) 136 { 137 SetEdgesCos(nbins, lo, up); 138 return; 139 } 140 SetEdges(nbins, lo, up); 112 141 } 113 142 -
trunk/MagicSoft/Mars/mhbase/MBinning.h
r2735 r3788 32 32 public: 33 33 MBinning(const char *name=NULL, const char *title=NULL); 34 MBinning(Int_t nbins, Axis_t lo, Axis_t hi, const char *name, const char *opt="", const char *title=NULL); 34 35 35 36 void SetEdges(const TArrayD &arr) … … 42 43 void SetEdges(const TH1 &h, const Char_t axis='x'); 43 44 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up); 45 void SetEdges(const Int_t nbins, const Axis_t lo, Axis_t up, const char *opt); 44 46 void SetEdgesLog(const Int_t nbins, const Axis_t lo, Axis_t up); 45 47 void SetEdgesCos(const Int_t nbins, const Axis_t lo, Axis_t up); -
trunk/MagicSoft/Mars/mhbase/MFillH.cc
r3500 r3788 340 340 // -------------------------------------------------------------------------- 341 341 // 342 // Use this to set a draw option used when drawing automatically to the 343 // status display. 344 // 345 void MFillH::SetDrawOption(Option_t *option="") 346 { 347 fDrawOption = option; 348 } 349 350 // -------------------------------------------------------------------------- 351 // 342 352 // Creates a new tab in a status display with the name of the MH class, 343 353 // if fDisplay is set and the MH-class overwrites the Draw function … … 357 367 358 368 fCanvas = &fDisplay->AddTab(fNameTab.IsNull() ? fH->GetName() : fNameTab.Data()); 359 fH->Draw( );369 fH->Draw(fDrawOption); 360 370 361 371 return kTRUE; … … 549 559 if (fDisplay && fDisplay->HasCanvas(fCanvas)) 550 560 { 561 const TString opt(Form("nonew %s", fDrawOption)); 551 562 fCanvas->cd(); 552 fH->DrawClone( "nonew");563 fH->DrawClone(opt); 553 564 fCanvas->Modified(); 554 565 fCanvas->Update(); -
trunk/MagicSoft/Mars/mhbase/MFillH.h
r3500 r3788 38 38 TCanvas *fCanvas; //! Canvas used to update a MStatusDisplay at the end of a loop 39 39 40 TString fDrawOption; // Draw option for status display 41 40 42 TString ExtractName(const char *name) const; 41 43 TString ExtractClass(const char *name) const; … … 63 65 void SetWeight(const char *name) { fWeightName = name; } 64 66 67 void SetDrawOption(Option_t *option=""); 68 Option_t *GetDrawOption() const { return fDrawOption; } 69 65 70 Int_t PreProcess(MParList *pList); 66 71 Bool_t ReInit(MParList *pList); -
trunk/MagicSoft/Mars/mhist/MHFalseSource.cc
r3682 r3788 107 107 // - currently a constant pointing position is assumed in Fill() 108 108 // - the center of rotation need not to be the camera center 109 // - ERRORS on each alpha bin to estimate the chi^2 correctly! 110 // (sqrt(N)/binwidth) needed for WOlfgangs proposed caluclation 111 // of alpha(Li/Ma) 109 112 // 110 113 //////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.