Changeset 3666 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 04/06/04 13:41:56 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r3568 r3666 333 333 334 334 // 335 // Update current speed each second336 // 337 if (fDisplay && t0-t2>(TTime)1 000)338 { 339 const Int_t speed = 1000*(num-start)/(long int)(t0-t2);335 // Update current speed each 1.5 second 336 // 337 if (fDisplay && t0-t2>(TTime)1500) 338 { 339 const Float_t speed = 1000.*(num-start)/(long int)(t0-t2); 340 340 TString txt = "Processing..."; 341 341 if (speed>0) 342 342 { 343 343 txt += " ("; 344 txt += speed;344 txt += (Int_t)speed; 345 345 txt += "Evts/s"; 346 346 if (fNumEvents>0) 347 347 { 348 348 txt += ", est: "; 349 txt += (int)(( long int)(t0-t2)*fNumEvents/(60000.*(num-start)));350 txt += "m ";349 txt += (int)((fNumEvents-num)/speed/60)+1; 350 txt += "min"; 351 351 } 352 352 //txt += (int)fmod(entries/(1000.*(num-start)/(long int)(t0-t2)), 60); … … 356 356 fDisplay->SetStatusLine1(txt); 357 357 start = num; 358 t2 = t 1;358 t2 = t0; 359 359 } 360 360 -
trunk/MagicSoft/Mars/mbase/MMath.cc
r3597 r3666 52 52 // -------------------------------------------------------------------------- 53 53 // 54 // Symmetrized significance - this is somehow analog to 55 // SignificanceLiMaSigned 56 // 57 // Returns Significance(s,b) if s>b otherwise -Significance(b, s); 58 // 59 Double_t MMath::SignificanceSym(Double_t s, Double_t b) 60 { 61 return s>b ? Significance(s, b) : -Significance(b, s); 62 } 63 64 // -------------------------------------------------------------------------- 65 // 54 66 // calculates the significance according to Li & Ma 55 67 // ApJ 272 (1983) 317, Formula 17 … … 58 70 // b // b: number of off events 59 71 // alpha = t_on/t_off; // t: observation time 72 // 73 // The significance has the same (positive!) value for s>b and b>s. 60 74 // 61 75 // Returns -1 if sum<0 or alpha<0 or the argument of sqrt<0 … … 77 91 return l+m<0 ? -1 : TMath::Sqrt((l+m)*2); 78 92 } 93 94 // -------------------------------------------------------------------------- 95 // 96 // Calculates MMath::SignificanceLiMa(s, b, alpha). Returns 0 if the 97 // calculation has failed. Otherwise the Li/Ma significance which was 98 // calculated. If s<b a negative value is returned. 99 // 100 Double_t MMath::SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha) 101 { 102 const Double_t sig = SignificanceLiMa(s, b, alpha); 103 if (sig<=0) 104 return 0; 105 106 return TMath::Sign(sig, s-b); 107 } -
trunk/MagicSoft/Mars/mbase/MMath.h
r3582 r3666 10 10 public: 11 11 static Double_t Significance(Double_t s, Double_t b); 12 static Double_t SignificanceSym(Double_t s, Double_t b); 12 13 static Double_t SignificanceLiMa(Double_t s, Double_t b, Double_t alpha=1); 14 static Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1); 13 15 14 16 ClassDef(MMath, 0) -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r3574 r3666 407 407 TMethodCall *MParContainer::GetterMethod(const char *name) const 408 408 { 409 TClass *cls = IsA()->GetBaseDataMember(name); 409 const TString n(name); 410 const Int_t pos1 = n.First('.'); 411 412 const TString part1 = pos1<0 ? n : n(0, pos1); 413 const TString part2 = pos1<0 ? TString("") : n(pos1+1, n.Length()); 414 415 TClass *cls = IsA()->GetBaseDataMember(part1); 410 416 if (cls) 411 417 { 412 TDataMember *member = cls->GetDataMember( name);418 TDataMember *member = cls->GetDataMember(part1); 413 419 if (!member) 414 420 { 415 *fLog << err << "Datamember '" << name<< "' not in " << GetDescriptor() << endl;421 *fLog << err << "Datamember '" << part1 << "' not in " << GetDescriptor() << endl; 416 422 return NULL; 423 } 424 425 // This handles returning references of contained objects, eg 426 // class X { TObject fO; TObject &GetO() { return fO; } }; 427 if (!member->IsBasic() && !part2.IsNull()) 428 { 429 cls = gROOT->GetClass(member->GetTypeName()); 430 if (!cls) 431 { 432 *fLog << err << "Datamember " << part1 << " ["; 433 *fLog << member->GetTypeName() << "] not in dictionary." << endl; 434 return NULL; 435 } 436 if (!cls->InheritsFrom(MParContainer::Class())) 437 { 438 *fLog << err << "Datamember " << part1 << " ["; 439 *fLog << member->GetTypeName() << "] does not inherit from "; 440 *fLog << "MParContainer." << endl; 441 return NULL; 442 } 443 444 const MParContainer *sub = (MParContainer*)((ULong_t)this+member->GetOffset()); 445 return sub->GetterMethod(part2); 446 } 447 448 if (member->IsaPointer()) 449 { 450 *fLog << warn << "Data-member " << part1 << " is a pointer..." << endl; 451 *fLog << dbginf << "Not yet implemented!" << endl; 452 //TClass *test = gROOT->GetClass(member->GetTypeName()); 453 return 0; 417 454 } 418 455 … … 422 459 } 423 460 424 *fLog << warn << "No standard access for '" << name<< "' in ";461 *fLog << warn << "No standard access for '" << part1 << "' in "; 425 462 *fLog << GetDescriptor() << " or one of its base classes." << endl; 426 463 … … 428 465 429 466 *fLog << warn << "Trying to find MethodCall '" << ClassName(); 430 *fLog << "::Get" << name<< "' instead <LEAKS MEMORY>" << endl;431 call = new TMethodCall(IsA(), (TString)"Get"+ name, "");467 *fLog << "::Get" << part1 << "' instead <LEAKS MEMORY>" << endl; 468 call = new TMethodCall(IsA(), (TString)"Get"+part1, ""); 432 469 if (call->GetMethod()) 433 470 return call; … … 436 473 437 474 *fLog << warn << "Trying to find MethodCall '" << ClassName(); 438 *fLog << "::" << name<< "' instead <LEAKS MEMORY>" << endl;439 call = new TMethodCall(IsA(), name, "");475 *fLog << "::" << part1 << "' instead <LEAKS MEMORY>" << endl; 476 call = new TMethodCall(IsA(), part1, ""); 440 477 if (call->GetMethod()) 441 478 return call; … … 443 480 delete call; 444 481 445 *fLog << err << "Sorry, no getter method found for " << name<< endl;482 *fLog << err << "Sorry, no getter method found for " << part1 << endl; 446 483 return NULL; 447 484 } -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r3512 r3666 1433 1433 // where (eg Eventloop) first! 1434 1434 1435 gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl;1435 //gLog << dbg << fName << " is on heap: " << (int)IsOnHeap() << endl; 1436 1436 1437 1437 if (TestBit(kExitLoopOnExit) || TestBit(kExitLoopOnClose)) … … 1443 1443 if (fIsLocked<=0 && IsOnHeap()) 1444 1444 { 1445 gLog << dbg << "delete " << fName << ";" << endl;1445 //gLog << dbg << "delete " << fName << ";" << endl; 1446 1446 delete this; 1447 1447 } 1448 1448 fStatus = kFileExit; 1449 gLog << dbg << fName << ".fStatus=kFileExit;" << endl;1449 //gLog << dbg << fName << ".fStatus=kFileExit;" << endl; 1450 1450 } 1451 1451 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r3497 r3666 106 106 MTask::MTask(const char *name, const char *title) 107 107 : fFilter(NULL), fSerialNumber(0), fIsPreprocessed(kFALSE), 108 f NumExecutions(0), fStopwatch(0)108 fStopwatch(0) 109 109 { 110 110 fName = name ? name : "MTask"; … … 194 194 Int_t MTask::CallPreProcess(MParList *plist) 195 195 { 196 fNumExecutions = 0;197 196 fStopwatch->Reset(); 198 197 … … 240 239 return kTRUE; 241 240 242 fNumExecutions++;243 244 241 fStopwatch->Start(kFALSE); 245 242 const Int_t rc = Process(); … … 346 343 // -------------------------------------------------------------------------- 347 344 // 348 // Return total CPU execution time of task 345 // Return the total number of calls to Process(). If Process() was not 346 // called due to a set filter this is not counted. 347 // 348 UInt_t MTask::GetNumExecutions() const 349 { 350 return (UInt_t)fStopwatch->Counter(); 351 } 352 353 // -------------------------------------------------------------------------- 354 // 355 // Return total CPU execution time in seconds of calls to Process(). 356 // If Process() was not called due to a set filter this is not counted. 349 357 // 350 358 Double_t MTask::GetCpuTime() const … … 355 363 // -------------------------------------------------------------------------- 356 364 // 357 // Return total real execution time of task 365 // Return total real execution time in seconds of calls to Process(). 366 // If Process() was not called due to a set filter this is not counted. 358 367 // 359 368 Double_t MTask::GetRealTime() const … … 366 375 // Prints the relative time spent in Process() (relative means relative to 367 376 // its parent Tasklist) and the number of times Process() was executed. 377 // Don't wonder if the sum of the tasks in a tasklist is not 100%, 378 // because only the call to Process() of the task is measured. The 379 // time of the support structure is ignored. The faster your analysis is 380 // the more time is 'wasted' in the support structure. 381 // Only the CPU time is displayed. This means that exspecially task 382 // which have a huge part of file i/o will be underestimated in their 383 // relative wasted time. 368 384 // For convinience the lvl argument results in a number of spaces at the 369 385 // beginning of the line. So that the structur of a tasklist can be … … 379 395 380 396 *fLog << all << setfill(' ') << setw(lvl) << " "; 381 if (fStopwatch->CpuTime()>0 && time>0) 382 *fLog << setw(3) << (Int_t)(fStopwatch->CpuTime()/time*100+.5) << "% "; 397 398 if (GetCpuTime()>0 && time>0 && GetCpuTime()>=0.001*time) 399 *fLog << Form("%5.1f", GetCpuTime()/time*100) << "% "; 383 400 else 384 *fLog << " ";401 *fLog << " "; 385 402 *fLog << GetDescriptor() << "\t"; 386 *fLog << dec << fNumExecutions;403 *fLog << dec << GetNumExecutions(); 387 404 if (fFilter) 388 405 *fLog << " <" << fFilter->GetName() << ">"; -
trunk/MagicSoft/Mars/mbase/MTask.h
r3497 r3666 29 29 30 30 Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList) 31 UInt_t fNumExecutions; //! Number of Excutions32 31 33 TStopwatch *fStopwatch; //! 32 TStopwatch *fStopwatch; //! Count the execution time and number of executions 34 33 35 34 virtual Int_t PreProcess(MParList *pList); … … 74 73 // Filter functions 75 74 virtual void SetFilter(MFilter *filter) { fFilter=filter; } 76 const MFilter *GetFilter() const { return fFilter; }77 MFilter *GetFilter() { return fFilter; } // for MContinue only75 const MFilter *GetFilter() const { return fFilter; } 76 MFilter *GetFilter() { return fFilter; } // for MContinue only 78 77 79 78 // Display functions … … 86 85 TString AddSerialNumber(const TString &str) const { return AddSerialNumber(str, fSerialNumber); } 87 86 88 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; }89 Byte_t GetSerialNumber() const{ return fSerialNumber; }87 virtual void SetSerialNumber(Byte_t num) { fSerialNumber = num; } 88 Byte_t GetSerialNumber() const { return fSerialNumber; } 90 89 91 90 const char *GetDescriptor() const; 92 91 93 92 // Task execution statistics 94 UInt_t GetNumExecutions() const { return fNumExecutions; }93 UInt_t GetNumExecutions() const; 95 94 Double_t GetCpuTime() const; 96 95 Double_t GetRealTime() const; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r3497 r3666 635 635 if (title) 636 636 *fLog << "\t" << fTitle; 637 if (time>=0) 638 *fLog << Form(" %5.1f", GetCpuTime()/time*100) << "%"; 639 else 640 *fLog << " 100.0%"; 637 641 *fLog << endl; 638 642 } -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r3497 r3666 70 70 71 71 void Print(Option_t *opt = "") const; 72 void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time= 0) const;72 void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=-1) const; 73 73 void SetOwner(Bool_t enable=kTRUE); 74 74 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r3371 r3666 362 362 const Double_t sum = (r1+r2)/(24*3600); 363 363 364 return fmod(sum, 1)*TMath::TwoPi() +TMath::TwoPi();364 return fmod(sum, 1)*TMath::TwoPi();//+TMath::TwoPi(); 365 365 } 366 366
Note:
See TracChangeset
for help on using the changeset viewer.