Ignore:
Timestamp:
01/11/07 14:56:24 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r8224 r8244  
    130130#include "MLogManip.h"
    131131
     132#include "MEnv.h"
    132133#include "MJob.h"
    133134#include "MAstro.h"
     
    202203{
    203204    TString d(path);
     205    if (d.IsNull())
     206        d = fDataPath;
    204207
    205208    const Bool_t def = d.IsNull();
     
    207210    // For this particular case we assume that the files are added one by
    208211    // one without wildcards.
    209     const Int_t n0  = iter.GetNumEntries();
     212    const Int_t n0 = iter.GetNumEntries();
    210213
    211214    // Setup path
     
    291294        }
    292295
     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
    293313        // Add Path/File to TIter
    294314        iter.AddDirectory(d, n, 0);
     
    358378MSequence::LightCondition_t MSequence::ReadLightCondition(TEnv &env) const
    359379{
    360     TString str = env.GetValue("LightCondition", "n/a");
     380    TString str = env.GetValue("LightConditions", "n/a");
    361381    if (!str.CompareTo("n/a", TString::kIgnoreCase))
    362382        return kNA;
    363     if (!str.CompareTo("NoMoon", TString::kIgnoreCase))
     383    if (!str.CompareTo("No_Moon", TString::kIgnoreCase))
    364384        return kNoMoon;
    365385    if (!str.CompareTo("Twilight", TString::kIgnoreCase))
     
    370390        return kDay;
    371391
    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;
    373395    return kNA;
    374396}
     
    378400// Read the file fname as setup file for the sequence.
    379401//
    380 MSequence::MSequence(const char *fname)
     402MSequence::MSequence(const char *fname, const char *path)
    381403{
    382404    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
    398427    fLastRun   = env.GetValue("LastRun",   -1);
    399428    fNumEvents = env.GetValue("NumEvents", -1);
     
    402431    fLightCondition = ReadLightCondition(env);
    403432
     433    TString str;
    404434    str = env.GetValue("Start", "");
    405435    fStart.SetSqlDateTime(str);
     
    426456    GetFileNames(env, fPedRuns);
    427457    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    }
    428470}
    429471
     
    437479    if (!IsValid())
    438480    {
    439         gLog << "Sequence: " << fName << " <invalid>" << endl;
     481        gLog << "Sequence: " << fFileName << " <invalid>" << endl;
    440482        return;
    441483    }
     
    475517        gLog << " " << fDatRuns[i];
    476518    gLog << endl;
     519
     520    if (!fDataPath.IsNull())
     521        gLog << endl << "DataPath: " << fDataPath << endl;
    477522}
    478523
     
    480525//
    481526// 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.
    483529// If you have the runs locally use path="."
    484530// Using raw=kTRUE you get correspodning raw-files setup.
    485531// Return the number of files added.
     532//
    486533UInt_t MSequence::SetupPedRuns(MDirIter &iter, const char *path, Bool_t raw) const
    487534{
     
    492539//
    493540// 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.
    495543// If you have the runs locally use path="."
    496544// Using raw=kTRUE you get correspodning raw-files setup.
     
    505553//
    506554// 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.
    508557// If you have the runs locally use path="."
    509558// Using raw=kTRUE you get correspodning raw-files setup.
     
    518567//
    519568// 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.
    521571// If you have the runs locally use path="."
    522572// Using raw=kTRUE you get correspodning raw-files setup.
     
    531581//
    532582// 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.
    534585// If you have the runs locally use path="."
    535586// Using raw=kTRUE you get correspodning raw-files setup.
Note: See TracChangeset for help on using the changeset viewer.