Changeset 8244 for trunk/MagicSoft/Mars/mjobs/MSequence.cc
- Timestamp:
- 01/11/07 14:56:24 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MSequence.cc
r8224 r8244 130 130 #include "MLogManip.h" 131 131 132 #include "MEnv.h" 132 133 #include "MJob.h" 133 134 #include "MAstro.h" … … 202 203 { 203 204 TString d(path); 205 if (d.IsNull()) 206 d = fDataPath; 204 207 205 208 const Bool_t def = d.IsNull(); … … 207 210 // For this particular case we assume that the files are added one by 208 211 // one without wildcards. 209 const Int_t n0 212 const Int_t n0 = iter.GetNumEntries(); 210 213 211 214 // Setup path … … 291 294 } 292 295 296 // Check existance and accessibility of file 297 MDirIter file(d, n, 0); 298 TString name = file(); 299 gSystem->ExpandPathName(name); 300 if (gSystem->AccessPathName(name, kFileExists)) 301 { 302 *fLog << err; 303 *fLog << "ERROR - File " << d << n << " not accessible!" << endl; 304 return 0; 305 } 306 if (!file().IsNull()) 307 { 308 *fLog << err; 309 *fLog << "ERROR - Searching for file " << d << n << " gave more than one result!" << endl; 310 return 0; 311 } 312 293 313 // Add Path/File to TIter 294 314 iter.AddDirectory(d, n, 0); … … 358 378 MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env) const 359 379 { 360 TString str = env.GetValue("LightCondition ", "n/a");380 TString str = env.GetValue("LightConditions", "n/a"); 361 381 if (!str.CompareTo("n/a", TString::kIgnoreCase)) 362 382 return kNA; 363 if (!str.CompareTo("No Moon", TString::kIgnoreCase))383 if (!str.CompareTo("No_Moon", TString::kIgnoreCase)) 364 384 return kNoMoon; 365 385 if (!str.CompareTo("Twilight", TString::kIgnoreCase)) … … 370 390 return kDay; 371 391 372 gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl; 392 gLog << warn; 393 gLog << "WARNING - in " << fFileName << ":" << endl; 394 gLog << " LightCondition-tag is '" << str << "' but must be n/a, no_moon, twilight, moon or day." << endl; 373 395 return kNA; 374 396 } … … 378 400 // Read the file fname as setup file for the sequence. 379 401 // 380 MSequence::MSequence(const char *fname )402 MSequence::MSequence(const char *fname, const char *path) 381 403 { 382 404 fName = fname; 383 384 const char *expname = gSystem->ExpandPathName(fname); 385 386 fTitle = Form("Sequence contained in file %s", expname); 387 388 const Bool_t access = !gSystem->AccessPathName(expname, kFileExists); 389 if (!access) 390 gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl; 391 392 TEnv env(expname); 393 delete [] expname; 394 395 TString str; 396 397 fSequence = env.GetValue("Sequence", -1); 405 fTitle = path; 406 407 fFileName = fname; 408 fDataPath = path; 409 410 gSystem->ExpandPathName(fName); 411 gSystem->ExpandPathName(fTitle); 412 413 const Bool_t rc1 = gSystem->AccessPathName(fName, kFileExists); 414 const Bool_t rc2 = gSystem->AccessPathName(fTitle, kFileExists); 415 416 if (rc1) 417 gLog << err << "ERROR - Sequence file '" << fName << "' doesn't exist." << endl; 418 if (rc2) 419 gLog << err << "ERROR - Directory '" << fTitle << "' doesn't exist." << endl; 420 421 MEnv env(fName); 422 423 fSequence = env.GetValue("Sequence", -1); 424 if (rc1 || rc2) 425 fSequence = (UInt_t)-1; 426 398 427 fLastRun = env.GetValue("LastRun", -1); 399 428 fNumEvents = env.GetValue("NumEvents", -1); … … 402 431 fLightCondition = ReadLightCondition(env); 403 432 433 TString str; 404 434 str = env.GetValue("Start", ""); 405 435 fStart.SetSqlDateTime(str); … … 426 456 GetFileNames(env, fPedRuns); 427 457 GetFileNames(env, fDatRuns); 458 459 // Dummies: 460 env.GetValue("ZdMin", 0); 461 env.GetValue("ZdMax", 0); 462 env.GetValue("L1TriggerTable", 0); 463 env.GetValue("L2TriggerTable", 0); 464 465 if (env.GetNumUntouched()>0) 466 { 467 gLog << warn << "WARNING - At least one resource in the dataset-file has not been touched!" << endl; 468 env.PrintUntouched(); 469 } 428 470 } 429 471 … … 437 479 if (!IsValid()) 438 480 { 439 gLog << "Sequence: " << f Name << " <invalid>" << endl;481 gLog << "Sequence: " << fFileName << " <invalid>" << endl; 440 482 return; 441 483 } … … 475 517 gLog << " " << fDatRuns[i]; 476 518 gLog << endl; 519 520 if (!fDataPath.IsNull()) 521 gLog << endl << "DataPath: " << fDataPath << endl; 477 522 } 478 523 … … 480 525 // 481 526 // Add all ped runs from the sequence to MDirIter. 482 // If path==0 the standard path of the data-center is assumed. 527 // If path==0 fDataPath is used instead. If it is also empty 528 // the standard path of the data-center is assumed. 483 529 // If you have the runs locally use path="." 484 530 // Using raw=kTRUE you get correspodning raw-files setup. 485 531 // Return the number of files added. 532 // 486 533 UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const 487 534 { … … 492 539 // 493 540 // Add all data runs from the sequence to MDirIter. 494 // If path==0 the standard path of the data-center is assumed. 541 // If path==0 fDataPath is used instead. If it is also empty 542 // the standard path of the data-center is assumed. 495 543 // If you have the runs locally use path="." 496 544 // Using raw=kTRUE you get correspodning raw-files setup. … … 505 553 // 506 554 // Add all runs from the sequence to MDirIter. 507 // If path==0 the standard path of the data-center is assumed. 555 // If path==0 fDataPath is used instead. If it is also empty 556 // the standard path of the data-center is assumed. 508 557 // If you have the runs locally use path="." 509 558 // Using raw=kTRUE you get correspodning raw-files setup. … … 518 567 // 519 568 // Add all calibration runs from the sequence to MDirIter. 520 // If path==0 the standard path of the data-center is assumed. 569 // If path==0 fDataPath is used instead. If it is also empty 570 // the standard path of the data-center is assumed. 521 571 // If you have the runs locally use path="." 522 572 // Using raw=kTRUE you get correspodning raw-files setup. … … 531 581 // 532 582 // Add all data runs from the sequence to MDirIter. 533 // If path==0 the standard path of the data-center is assumed. 583 // If path==0 fDataPath is used instead. If it is also empty 584 // the standard path of the data-center is assumed. 534 585 // If you have the runs locally use path="." 535 586 // Using raw=kTRUE you get correspodning raw-files setup.
Note:
See TracChangeset
for help on using the changeset viewer.