Changeset 12795 for trunk/Mars


Ignore:
Timestamp:
01/31/12 11:24:05 (13 years ago)
Author:
tbretz
Message:
implemented more arrays to be able to keep four different types of files; implemented a new keyword to keep the number of a corresponding DRS calibration file
File:
1 edited

Legend:

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

    r11410 r12795  
    181181//   + fTelescope
    182182//
     183//  Class Version 7:
     184//  ----------------
     185//   + fDrsRuns
     186//   + fDrsRunsSub
     187//   + fDrsFiles
     188//   + fDrsFilesSub
     189//   + fDrsSequence
     190//
    183191/////////////////////////////////////////////////////////////////////////////
    184192#include "MSequenceSQL.h"
     
    417425        switch (type&kFilePaths)
    418426        {
     427        case kDrs:
     428        case kFits:
     429            d += "raw/";
     430            d += fNight.GetStringFmt("%Y/%m/%d");
     431            break;
    419432        case kRaw:  // rawdata
    420433        case kRoot: // mcdata
     
    455468        // /magic/simulated/ceres/001/000/0001/cer123456
    456469        return MString::Format("cer%06d", -run);
     470    }
     471
     472    TString n;
     473
     474    if ((type&kRunType)==kDrsFile)
     475    {
     476        n += night.GetStringFmt("%Y%m%d_");
     477        n += MString::Format("%03d", run);
     478        n += ".drs.fits.?g?z?";
     479        return n;
     480    }
     481    if ((type&kFileType)==kFits)
     482    {
     483        n += night.GetStringFmt("%Y%m%d_");
     484        n += MString::Format("%03d", run);
     485        n += ".fits.?g?z?";
     486        return n;
    457487    }
    458488
     
    489519
    490520    // ------------- Create file name --------------
    491     TString n;
    492 
    493521    if (night)
    494522        n += night.GetStringFmt("%Y%m%d_");
     
    667695}
    668696
     697UInt_t MSequence::GetDrsFile() const
     698{
     699    if (fDrsRuns.GetSize()==0)
     700        return fDrsFiles[0];
     701
     702    UInt_t rc = 0;
     703    for (int i=0; i<fDrsFiles.GetSize(); i++)
     704    {
     705        for (int j=0; j<fPedRuns.GetSize(); j++)
     706        {
     707            if (fDrsFiles[i]==fPedRuns[j])
     708                rc = fDrsFiles[i];
     709        }
     710    }
     711
     712    return rc;
     713}
     714
    669715// --------------------------------------------------------------------------
    670716//
     
    675721TString MSequence::GetFileName(UInt_t i, const TArrayI &arr, const TArrayI &sub, FileType_t type, const char *path) const
    676722{
     723    if (i>=(UInt_t)arr.GetSize())
     724        return "";
     725
    677726    if (IsExcluded(arr[i], sub[i]))
    678727        return "0";
     
    693742    switch ((RunType_t)(type&(kRunType|kExcl)))
    694743    {
     744    case kDrsRun:
     745        r = &fDrsRuns;
     746        f = &fDrsRunsSub;
     747        break;
     748    case kDrsFile:
     749        r = &fDrsFiles;
     750        f = &fDrsFilesSub;
     751        break;
    695752    case kPed:
    696753        r = &fPedRuns;
     
    913970    fLastRun   = GetEnvValue2(env, prefix, "LastRun",   -1);
    914971    fNumEvents = GetEnvValue2(env, prefix, "NumEvents", -1);
     972    fDrsSequence = GetEnvValue2(env, prefix, "DrsSequence", 0);
    915973
    916974    TString str;
     
    935993    Split(env, prefix, "PedRuns", fPedRuns,  fPedRunsSub);
    936994    Split(env, prefix, "DatRuns", fDatRuns,  fDatRunsSub);
     995    Split(env, prefix, "DrsRuns", fDrsRuns,  fDrsRunsSub);
     996    Split(env, prefix, "DrsFiles",fDrsFiles, fDrsFilesSub);
    937997    Split(env, prefix, "Exclude", fExclRuns, fExclRunsSub);
     998
     999    if (fDrsRuns.GetSize()==0 && fDrsFiles.GetSize()>1)
     1000        gLog << warn << "WARNING - In a data sequence only one DrsFiles entry makes sense." << endl;
    9381001
    9391002    // Dummies:
     
    10891152//   fDatRuns
    10901153//   fDatRunsSub
     1154//   fDrsRuns
     1155//   fDrsRunsSub
    10911156//   fExclRuns
    10921157//   fExclRunsSub
     
    11041169        fPedRuns     == s.fPedRuns     &&
    11051170        fDatRuns     == s.fDatRuns     &&
     1171        fDrsRuns     == s.fDrsRuns     &&
    11061172        fExclRuns    == s.fExclRuns    &&
    11071173
     
    11091175        Check(fPedRunsSub,  s.fPedRunsSub) &&
    11101176        Check(fDatRunsSub,  s.fDatRunsSub) &&
     1177        Check(fDrsRunsSub,  s.fDrsRunsSub) &&
    11111178        Check(fExclRunsSub, s.fExclRunsSub);
    11121179}
     
    13971464    if (fLastRun!=(UInt_t)-1)
    13981465        out << pre << "LastRun:        " << fLastRun << endl;
     1466    if (fDrsSequence)
     1467        out << pre << "DrsSequence:    " << fDrsSequence << endl;
    13991468    if (fNumEvents!=(UInt_t)-1)
    14001469        out << pre << "NumEvents:      " << fNumEvents << endl;
     
    14161485        PrintRunsClassic(out, pre, "PedRuns:  ", fPedRuns);
    14171486        PrintRunsClassic(out, pre, "DataRuns: ", fDatRuns);
     1487        PrintRunsClassic(out, pre, "DrsRuns:  ", fDrsRuns);
     1488        PrintRunsClassic(out, pre, "DrsFiles: ", fDrsFiles);
    14181489        PrintRunsClassic(out, pre, "Exclude:  ", fExclRuns);
    14191490    }
     
    14251496        // Should we add a check forbidding the same run in
    14261497        // Cal/Ped/Data? What about the Exclude?
    1427         /*str +=*/ PrintRuns(out, pre, "Runs:    ", fRuns,     fRunsSub);
    1428         str += PrintRuns(out, pre, "CalRuns: ", fCalRuns,  fCalRunsSub);
    1429         str += PrintRuns(out, pre, "PedRuns: ", fPedRuns,  fPedRunsSub);
    1430         str += PrintRuns(out, pre, "DatRuns: ", fDatRuns,  fDatRunsSub);
    1431         str += PrintRuns(out, pre, "Exclude: ", fExclRuns, fExclRunsSub);
     1498        /*str +=*/ PrintRuns(out, pre, "Runs:     ", fRuns,     fRunsSub);
     1499        str += PrintRuns(out, pre, "CalRuns:  ", fCalRuns,  fCalRunsSub);
     1500        str += PrintRuns(out, pre, "PedRuns:  ", fPedRuns,  fPedRunsSub);
     1501        str += PrintRuns(out, pre, "DatRuns:  ", fDatRuns,  fDatRunsSub);
     1502        str += PrintRuns(out, pre, "DrsRuns:  ", fDrsRuns,  fDrsRunsSub);
     1503        str += PrintRuns(out, pre, "DrsFiles: ", fDrsFiles, fDrsFilesSub);
     1504        str += PrintRuns(out, pre, "Exclude:  ", fExclRuns, fExclRunsSub);
    14321505    }
    14331506
     
    14421515    if (!fComment.IsNull())
    14431516        out << pre << "Comment: " << fComment << endl;
     1517
     1518    if (GetDrsFile())
     1519        out << "# DrsFile: " << GetDrsFile() << endl;
    14441520}
    14451521
Note: See TracChangeset for help on using the changeset viewer.