Ignore:
Timestamp:
07/11/05 10:34:49 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
2 edited

Legend:

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

    r7170 r7179  
    4949//
    5050// The sequence number are used to concatenate the filenames of the
    51 // sequences using the file structure used in the datacenter.
     51// sequences using the file structure used in the datacenter. Each sequence
     52// can be added to the on and off data at the same time but only once.
    5253//
    5354// If you have different file names you can overwrite the default file names
     
    6061//
    6162// Resource file entries are case sensitive!
     63//
     64// IMPORTANT:
     65//   * Run filenames must begin with a string which allows correct
     66//     ordering in time, otherwise synchronization might fail.
     67//   * Sequence filenames should also have names allowing to order them
     68//     in time, but it is not necessary.
    6269//
    6370// MISSING (27/01/04): The default name and paths cannot be used yet, because
     
    9097// --------------------------------------------------------------------------
    9198//
    92 // Copy the run numbers from the TString runs into the TArrayI data
     99// Copy the sequence numbers from the TString runs into the TArrayI data
     100// Sequences which are twice in the list are only added once. In this case
     101// a warning is emitted.
    93102//
    94103void MDataSet::Split(TString &runs, TArrayI &data) const
     
    103112        TString num = runs(regexp);
    104113
    105         const Int_t n = data.GetSize();
     114        const Int_t seq = atoi(num.Data());
     115        const Int_t n   = data.GetSize();
     116
     117        // skip already existing entries
     118        int i;
     119        for (i=0; i<n; i++)
     120            if (data[i] == seq)
     121                break;
     122
     123        if (i<n)
     124        {
     125            *fLog << warn << "WARNING - Sequence #" << seq << " alraedy in list... skipped." << endl;
     126            continue;
     127        }
     128
     129        // set new entry
    106130        data.Set(n+1);
    107         data[n] = atoi(num.Data());
    108 
     131        data[n] = seq;
     132
     133        // remove entry from string
    109134        runs.Remove(0, runs.First(num)+num.Length());
    110135    }
    111136}
    112137
     138// --------------------------------------------------------------------------
     139//
     140// After resolving the sequence filename and directory either from the
     141// default (/magic/data/sequences/0004/sequence00004000.txt) or from
     142// the corresponding entries in the dataset file.
     143// The entries are sorted by filename.
     144//
    113145void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const
    114146{
     
    235267}
    236268
     269// --------------------------------------------------------------------------
     270//
     271// Adds all sequences contained in list to the MDirIter. After adding
     272// everything MDirIter::Sort is called to sort all entries by name.
     273//
    237274Bool_t MDataSet::AddSequencesFromList(const TList &list, MDirIter &files)
    238275{
     
    251288        seq.SetupDatRuns(files, MSequence::kImages, dir.IsNull() ? 0 : dir.Data());
    252289    }
     290
     291    // This is important in case of synchronisation, because the
     292    // files in the sequences can be interleaved (eg W1, W2)
     293    // Filenames MUST begin with an appropriate string which allow
     294    // to order them correctly in time!
     295    files.Sort();
    253296
    254297    if (gLog.GetDebugLevel()>4)
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r6964 r7179  
    3131//
    3232//  A sequence is a collection of runs which should be used together.
     33//  Any run can be contained only once.
    3334//
    3435//  Here is an example how a file describing a sequence could look like:
     
    152153// --------------------------------------------------------------------------
    153154//
    154 // Copy the run numbers from the TString runs into the TArrayI data
     155// Copy the run numbers from the TString runs into the TArrayI data.
     156// Runs which are twice in the list are only added once. In this case
     157// a warning is emitted.
    155158//
    156159void MSequence::Split(TString &runs, TArrayI &data) const
     
    165168        TString num = runs(regexp);
    166169
    167         const Int_t n = data.GetSize();
     170        const Int_t run = atoi(num.Data());
     171        const Int_t n   = data.GetSize();
     172
     173        // skip already existing entries
     174        int i;
     175        for (i=0; i<n; i++)
     176            if (data[i] == run)
     177                break;
     178
     179        if (i<n)
     180        {
     181            *fLog << warn << "WARNING - Run #" << run << " alraedy in list... skipped." << endl;
     182            continue;
     183        }
     184
     185        // set new entry
    168186        data.Set(n+1);
    169         data[n] = atoi(num.Data());
     187        data[n] = run;
    170188
    171189        runs.Remove(0, runs.First(num)+num.Length());
    172190    }
    173191}
    174 /*
    175 UInt_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, const char *path, char *id, Bool_t raw) const
    176 {
    177     TString d(path);
    178 
    179     // Setup path
    180     if (d.IsNull())
    181     {
    182         d = GetStandardPath();
    183         d += raw ? "rawfiles/" : "merpp/";
    184         d += fNight.GetStringFmt("%Y/%m/%d");
    185     }
    186     else
    187         gSystem->ExpandPathName(d);
    188 
    189     for (int i=0; i<arr.GetSize(); i++)
    190     {
    191         // R. DeLosReyes and T. Bretz
    192         // Changes to read the DAQ numbering format. Changes takes place
    193         // between runs 35487 and 00035488 (2004_08_30)
    194         const char *fmt = arr[i]>35487 ? "%08d_%s_*_E" : "%05d_%s_*_E";
    195 
    196         TString n;
    197 
    198         // Create file name
    199         n =  fNight.GetStringFmt("%Y%m%d_");
    200         n += Form(fmt, arr[i], id);
    201         n += raw ? ".raw" : ".root";
    202 
    203         // Add Path/File to TIter
    204         iter.AddDirectory(d, n, 0);
    205     }
    206 
    207     return iter.GetNumEntries();
    208 }
    209 */
     192
    210193UInt_t MSequence::SetupRuns(MDirIter &iter, const TArrayI &arr, FileType_t type, const char *path) const
    211194{
Note: See TracChangeset for help on using the changeset viewer.