Changeset 1880 for trunk/MagicSoft/Mars/mbase/MParContainer.cc
- Timestamp:
- 03/31/03 10:37:56 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r1794 r1880 40 40 #include <fstream.h> // ofstream, AsciiWrite 41 41 42 #include <T ROOT.h> // TROOT::Identlevel42 #include <TEnv.h> // Env::Lookup 43 43 #include <TClass.h> // IsA 44 44 #include <TObjArray.h> // TObjArray … … 54 54 #include "MEvtLoop.h" // gListOfPrimitives 55 55 #else 56 TList *gListOfPrimitives; 56 TList *gListOfPrimitives; // forard declaration in MParContainer.h 57 57 #endif 58 58 … … 122 122 // 123 123 void MParContainer::Copy(TObject &obj) 124 #if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01) 125 const 126 #endif 124 127 { 125 128 MParContainer &cont = (MParContainer&)obj; … … 449 452 return (MParContainer*)IsA()->New(); 450 453 } 454 455 // -------------------------------------------------------------------------- 456 // 457 // Read the contents/setup of a parameter container/task from a TEnv 458 // instance (steering card/setup file). 459 // The key to search for in the file should be of the syntax: 460 // prefix.vname 461 // While vname is a name which is specific for a single setup date 462 // (variable) of this container and prefix is something like: 463 // evtloopname.name 464 // While name is the name of the containers/tasks in the parlist/tasklist 465 // 466 // eg. Job4.MImgCleanStd.CleaningLevel1: 3.0 467 // Job4.MImgCleanStd.CleaningLevel2: 2.5 468 // 469 // If this cannot be found the next step is to search for 470 // MImgCleanStd.CleaningLevel1: 3.0 471 // And if this doesn't exist, too, we should search for: 472 // CleaningLevel1: 3.0 473 // 474 // Warning: The programmer is responsible for the names to be unique in 475 // all Mars classes. 476 // 477 Bool_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 478 { 479 if (!IsEnvDefined(env, prefix, "", print)) 480 return kFALSE; 481 482 *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but no " << IsA()->GetName() << "::ReadEnv." << endl; 483 return kTRUE; 484 } 485 486 // -------------------------------------------------------------------------- 487 // 488 // Write the contents/setup of a parameter container/task to a TEnv 489 // instance (steering card/setup file). 490 // The key to search for in the file should be of the syntax: 491 // prefix.vname 492 // While vname is a name which is specific for a single setup date 493 // (variable) of this container and prefix is something like: 494 // evtloopname.name 495 // While name is the name of the containers/tasks in the parlist/tasklist 496 // 497 // eg. Job4.MImgCleanStd.CleaningLevel1: 3.0 498 // Job4.MImgCleanStd.CleaningLevel2: 2.5 499 // 500 // If this cannot be found the next step is to search for 501 // MImgCleanStd.CleaningLevel1: 3.0 502 // And if this doesn't exist, too, we should search for: 503 // CleaningLevel1: 3.0 504 // 505 // Warning: The programmer is responsible for the names to be unique in 506 // all Mars classes. 507 // 508 Bool_t MParContainer::WriteEnv(TEnv &env, TString prefix, Bool_t print) const 509 { 510 if (!IsEnvDefined(env, prefix, "", print)) 511 return kFALSE; 512 513 *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but " << IsA()->GetName() << "::WriteEnv not overloaded." << endl; 514 return kTRUE; 515 } 516 517 Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const 518 { 519 if (!postfix.IsNull()) 520 postfix.Insert(0, "."); 521 522 return IsEnvDefined(env, prefix+fName+postfix, print); 523 } 524 525 Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString name, Bool_t print) const 526 { 527 if (print) 528 *fLog << all << GetDescriptor() << " - " << name << "... " << flush; 529 530 if (!((TEnv&)env).Defined(name)) 531 { 532 if (print) 533 *fLog << "not found." << endl; 534 return kFALSE; 535 } 536 537 if (print) 538 *fLog << "found." << endl; 539 540 return kTRUE; 541 } 542 543 Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Int_t dflt) const 544 { 545 return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt); 546 } 547 548 Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Double_t dflt) const 549 { 550 return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt); 551 } 552 553 const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, const char *dflt) const 554 { 555 return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt); 556 }
Note:
See TracChangeset
for help on using the changeset viewer.