Changeset 4729 for trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
- Timestamp:
- 08/25/04 13:20:16 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJPedestal.cc
r4723 r4729 90 90 // 91 91 MJPedestal::MJPedestal(const char *name, const char *title) 92 : f Env(0), fRuns(0), fSequence(0), fExtractor(NULL), fDisplayType(kNormalDisplay),93 fDataCheck(kFALSE), fUseData(kFALSE) , fOverwrite(kFALSE), fMaxEvents(0)92 : fRuns(0), fExtractor(NULL), fDisplayType(kNormalDisplay), 93 fDataCheck(kFALSE), fUseData(kFALSE) 94 94 { 95 95 fName = name ? name : "MJPedestal"; … … 97 97 } 98 98 99 MJPedestal::~MJPedestal()100 {101 if (fEnv)102 delete fEnv;103 }104 105 99 const char* MJPedestal::GetOutputFile() const 106 100 { 107 if (fSequence )108 return Form("%s/calped%06d.root", (const char*)f OutputPath, fSequence->GetSequence());101 if (fSequence.IsValid()) 102 return Form("%s/calped%06d.root", (const char*)fPathOut, fSequence.GetSequence()); 109 103 110 104 if (!fRuns) 111 105 return ""; 112 106 113 return Form("%s/%s-F0.root", (const char*)f OutputPath, (const char*)fRuns->GetRunsAsFileName());107 return Form("%s/%s-F0.root", (const char*)fPathOut, (const char*)fRuns->GetRunsAsFileName()); 114 108 } 115 109 … … 160 154 TString title = fDisplay->GetTitle(); 161 155 title += "-- Pedestal "; 162 if (fSequence )163 title += fSequence ->GetName();156 if (fSequence.IsValid()) 157 title += fSequence.GetName(); 164 158 else 165 159 if (fRuns) // FIXME: What to do if an environmentfile was used? … … 468 462 Bool_t MJPedestal::WriteResult() 469 463 { 470 if (f OutputPath.IsNull())464 if (fPathOut.IsNull()) 471 465 return kTRUE; 472 466 … … 503 497 } 504 498 505 void MJPedestal::SetOutputPath(const char *path)506 {507 fOutputPath = path;508 if (fOutputPath.EndsWith("/"))509 fOutputPath = fOutputPath(0, fOutputPath.Length()-1);510 }511 512 // --------------------------------------------------------------------------513 //514 // Set the path from which the sequence files are read515 //516 void MJPedestal::SetInputPath(const char *path)517 {518 fInputPath = path;519 if (fInputPath.EndsWith("/"))520 fInputPath = fInputPath(0, fInputPath.Length()-1);521 }522 523 void MJPedestal::SetEnv(const char *env)524 {525 if (fEnv)526 delete fEnv;527 fEnv = new TEnv(env);528 }529 530 499 Bool_t MJPedestal::Process() 531 500 { … … 536 505 } 537 506 538 // --------------------------------------------------------------------------539 //540 // MJPedestsl allows to setup several option by a resource file:541 // MJPedestal.OutputPath: path542 // MJPedestal.MaxEvents: 1000543 // MJPedestal.AllowOverwrite: yes, no544 // MJPedestal.UseData: yes, no (use DatRuns from sequence instead of PedRuns)545 //546 // For more details see the class description and the corresponding Getters547 //548 void MJPedestal::CheckEnv()549 {550 if (!fEnv)551 return;552 553 TString e1 = fEnv->GetValue(Form("%s.OutputPath", fName.Data()), "");554 if (!e1.IsNull())555 {556 e1.ReplaceAll("\015", "");557 SetOutputPath(e1);558 }559 560 SetMaxEvents(fEnv->GetValue(Form("%s.MaxEvents", fName.Data()), fMaxEvents));561 SetOverwrite(fEnv->GetValue(Form("%s.AllowOverwrite", fName.Data()), fOverwrite));562 563 fUseData = fEnv->GetValue(Form("%s.UseData", fName.Data()), fUseData);564 }565 566 507 Bool_t MJPedestal::ProcessFile() 567 508 { 568 if (!fRuns && !fEnv && !fSequence) 569 { 570 *fLog << err << "Neither AddRuns nor SetSequence nor SetEnv was called... abort." << endl; 571 return kFALSE; 572 } 573 if (!fSequence && fRuns && fRuns->GetNumRuns() != fRuns->GetNumEntries()) 574 { 575 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl; 576 return kFALSE; 577 } 509 if (!fSequence.IsValid()) 510 { 511 if (!fRuns) 512 { 513 *fLog << err << "Neither AddRuns nor SetSequence nor SetEnv was called... abort." << endl; 514 return kFALSE; 515 } 516 if (fRuns && fRuns->GetNumRuns() != fRuns->GetNumEntries()) 517 { 518 *fLog << err << "Number of files found doesn't match number of runs... abort." << endl; 519 return kFALSE; 520 } 521 } 522 523 //if (!CheckEnv()) 524 // return kFALSE; 525 526 CheckEnv(); 527 528 // -------------------------------------------------------------------------------- 578 529 579 530 *fLog << inf; 580 531 fLog->Separator(GetDescriptor()); 581 532 *fLog << "Calculate MPedestalCam from Runs "; 582 if (fSequence )583 *fLog << fSequence ->GetName() << endl;533 if (fSequence.IsValid()) 534 *fLog << fSequence.GetName() << endl; 584 535 else 585 536 if (fRuns) 586 537 *fLog << fRuns->GetRunsAsString() << endl; 587 538 else 588 *fLog << "in " << fEnv->GetName()<< endl;539 *fLog << "in Resource File." << endl; 589 540 *fLog << endl; 590 541 591 CheckEnv();542 // -------------------------------------------------------------------------------- 592 543 593 544 MParList plist; … … 600 551 601 552 MDirIter iter; 602 if (fSequence) 603 { 604 const Int_t n = fUseData ? fSequence->SetupDatRuns(iter, fInputPath) : fSequence->SetupPedRuns(iter, fInputPath); 605 if (n==0) 553 if (fSequence.IsValid()) 554 { 555 const Int_t n0 = fUseData ? fSequence.SetupDatRuns(iter, fPathData) : fSequence.SetupPedRuns(iter, fPathData); 556 const Int_t n1 = fUseData ? fSequence.GetNumDatRuns() : fSequence.GetNumPedRuns(); 557 if (n0==0) 606 558 { 607 559 *fLog << err << "ERROR - No input files of sequence found!" << endl; 608 560 return kFALSE; 609 561 } 562 if (n0!=n1) 563 { 564 *fLog << err << "ERROR - Number of files found (" << n0 << ") doesn't match number of files in sequence (" << n1 << ")" << endl; 565 return kFALSE; 566 } 610 567 } 611 568 612 569 if (fDataCheck) 613 570 { 614 if (fRuns || fSequence )615 rawread.AddFiles(fSequence ? iter : *fRuns);571 if (fRuns || fSequence.IsValid()) 572 rawread.AddFiles(fSequence.IsValid() ? iter : *fRuns); 616 573 tlist.AddToList(&rawread); 617 574 } … … 619 576 { 620 577 read.DisableAutoScheme(); 621 if (fRuns || fSequence )622 read.AddFiles(fSequence ? iter : *fRuns);578 if (fRuns || fSequence.IsValid()) 579 read.AddFiles(fSequence.IsValid() ? iter : *fRuns); 623 580 tlist.AddToList(&read); 624 581 } 625 // Enable logging to file626 //*fLog.SetOutputFile(lname, kTRUE);627 582 628 583 // Setup Tasklist … … 662 617 evtloop.SetDisplay(fDisplay); 663 618 evtloop.SetLogStream(fLog); 664 if ( fEnv)665 evtloop.ReadEnv(* fEnv);619 if (GetEnv()) 620 evtloop.ReadEnv(*GetEnv()); 666 621 667 622 // if (!WriteEventloop(evtloop))
Note:
See TracChangeset
for help on using the changeset viewer.