Changeset 7380


Ignore:
Timestamp:
10/01/05 19:37:29 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7378 r7380  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2005/10/01 Thomas Bretz
     22
     23   * mjobs/MDataSet.[h,cc]:
     24     - implemented two new options for constructor allowing to
     25       change the default path to image data and sequence files
     26     - fixed some typos
     27
     28   * mjobs/MSequence.[h,cc]:
     29     - implemented new light condition "day" for completeness
     30
     31   * ganymed.cc:
     32     - implemented twonew options --ind and --ins
     33
     34
    2035
    2136 2005/10/01
  • trunk/MagicSoft/Mars/NEWS

    r7379 r7380  
    22
    33 *** Version  <cvs>
     4
     5   - ganymed: Implemented two new options which allow
     6     to overwrite the default path to search for the sequence files
     7       --ins=/magic/sequences
     8     and where to search for the image data
     9       --ind=/magic/data/star
    410
    511
  • trunk/MagicSoft/Mars/ganymed.cc

    r7286 r7380  
    6363    gLog << "   --n=[n]                   Analysis number" << endl;
    6464    gLog << "   --out=path                Path to write the all output to [def=local path]" << endl;
     65    gLog << "   --ind=path                Path to data/star files [default=datacenter path]" << endl;
     66    gLog << "   --ins=path                Path to sequence files [default=datacenter path]" << endl;
    6567    gLog << "   --outf=filename           Filename for output file (eg. status display)" << endl;
    6668    gLog << "   --sum[=filename]          Enable writing of summary file (events after cut0)" << endl;
     
    127129    const TString kOutpath       = arg.GetStringAndRemove("--out=",  ".");
    128130    const TString kOutfile       = arg.GetStringAndRemove("--outf=",  "");
     131    const TString kPathDataFiles = arg.GetStringAndRemove("--ind=",  "");
     132    const TString kPathSequences = arg.GetStringAndRemove("--ins=",  "");
    129133    const Bool_t  kWriteSummary  = arg.HasOnlyAndRemove("--sum");
    130134    const TString kNameSummary   = arg.GetStringAndRemove("--sum=");
     
    180184    // Setup sequence and check its validity
    181185    //
    182     MDataSet seq(kSequences);
     186    MDataSet seq(kSequences, kPathSequences, kPathDataFiles);
    183187    if (kNumAnalysis>=0)
    184188        seq.SetNumAnalysis(kNumAnalysis);
  • trunk/MagicSoft/Mars/mjobs/MDataSet.cc

    r7358 r7380  
    9696using namespace std;
    9797
     98const TString MDataSet::fgCatalog       = "/magic/datacenter/setup/magic_favorites.edb";
     99const TString MDataSet::fgPathDataFiles = "/magic/data/star";
     100const TString MDataSet::fgPathSequences = "/magic/sequences";
     101
    98102// --------------------------------------------------------------------------
    99103//
     
    151155// The entries are sorted by filename.
    152156//
    153 void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const
     157void MDataSet::ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const
    154158{
    155159    for (int i=0; i<num.GetSize(); i++)
     
    158162        TString dir  = env.GetValue(Form("Sequence%08d.Dir",  num[i]), "");
    159163
     164        // Set default sequence file and dir name
     165        if (name.IsNull())
     166            name = Form("%s%04d/sequence%08d.txt", sequences.Data(), num[i]/10000, num[i]);
     167        if (dir.IsNull())
     168            dir = Form("%s%04d/%08d", data.Data(), num[i]/10000, num[i]);
     169
    160170        gSystem->ExpandPathName(name);
    161171        gSystem->ExpandPathName(dir);
    162 
    163         // Set default sequence file and dir name
    164         if (name.IsNull())
    165             name = Form("/magic/sequences/%04d/sequence%08d.txt", num[i]/10000, num[i]);
    166         if (dir.IsNull())
    167             dir = Form("/magic/data/star/%04d/%08d", num[i]/10000, num[i]);
    168172
    169173        if (gSystem->AccessPathName(name, kFileExists))
     
    185189// Read the file fname as setup file for the sequence.
    186190//
    187 MDataSet::MDataSet(const char *fname)
     191MDataSet::MDataSet(const char *fname, TString sequences, TString data)
    188192{
    189193    fName  = fname;
     
    191195    const char *expname = gSystem->ExpandPathName(fname);
    192196
    193     fTitle = Form("Sequences contained in file %s", expname);
     197    fTitle = Form("Dataset contained in file %s", expname);
     198
     199    const Bool_t access = !gSystem->AccessPathName(expname, kFileExists);
     200    if (!access)
     201        gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
    194202
    195203    TEnv env(expname);
    196204    delete [] expname;
    197205
     206    fNumAnalysis = env.GetValue("AnalysisNumber",  -1);
     207
    198208    TString str;
    199 
    200     fNumAnalysis = env.GetValue("AnalysisNumber",  -1);
    201 
    202     str = env.GetValue("SequencesOn", "");
     209    str = env.GetValue("SequencesOn",  "");
    203210    Split(str, fNumSequencesOn);
    204211    str = env.GetValue("SequencesOff", "");
    205212    Split(str, fNumSequencesOff);
    206213
    207     ResolveSequences(env, fNumSequencesOn,  fSequencesOn);
    208     ResolveSequences(env, fNumSequencesOff, fSequencesOff);
    209 
     214    SetupDefaultPath(sequences, fgPathSequences);
     215    SetupDefaultPath(data,      fgPathDataFiles);
     216
     217    ResolveSequences(env, fNumSequencesOn,  fSequencesOn,  sequences, data);
     218    ResolveSequences(env, fNumSequencesOff, fSequencesOff, sequences, data);
    210219
    211220    fNameSource   = env.GetValue("SourceName", "");
    212     fCatalog      = env.GetValue("Catalog",    "~/Software/data/magic_favorites.edb");
     221    fCatalog      = env.GetValue("Catalog",    fgCatalog);
    213222    fIsWobbleMode = env.GetValue("WobbleMode", kFALSE);
    214 
    215     //Print();
    216     /*
    217      GetFileNames(env, fSequencesOn);
    218      GetFileNames(env, fSequencesOff);
    219      */
     223    fComment      = env.GetValue("Comment",    "");
    220224}
    221225
     
    226230void MDataSet::PrintFile(const TObject &obj)
    227231{
    228     const Bool_t access = !gSystem->AccessPathName(obj.GetName(), kFileExists) && !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-';
    229     gLog << " " << (access?"+":"-") << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;
     232    const Char_t access =
     233        !gSystem->AccessPathName(obj.GetName(), kFileExists) &&
     234        !gSystem->AccessPathName(obj.GetTitle(), kFileExists) ? '+' : '-';
     235
     236    gLog << " " << access << " " << obj.GetName() << " <" << obj.GetTitle() << ">" << endl;
    230237}
    231238
     
    242249        return;
    243250    }
    244     gLog << "Analysis Number: " << fNumAnalysis << endl;
    245     gLog << "Sequences On:   ";
     251    gLog << "AnalysisNumber: " << fNumAnalysis << endl << endl;
     252    gLog << "SequencesOn:   ";
    246253    for (int i=0; i<fNumSequencesOn.GetSize(); i++)
    247254        gLog << " " << fNumSequencesOn[i];
    248255    gLog << endl;
    249     gLog << "Sequences Off:  ";
     256    gLog << "SequencesOff:  ";
    250257    for (int i=0; i<fNumSequencesOff.GetSize(); i++)
    251258        gLog << " " << fNumSequencesOff[i];
    252     gLog << endl;
     259    gLog << endl << endl;
    253260
    254261    gLog << "SourceName: " << fNameSource << endl;
    255     gLog << "Catalog:    " << fCatalog << endl;
    256 
    257     gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl;
    258 
    259     if (!TString(o).Contains("files", TString::kIgnoreCase))
     262    gLog << "Catalog: " << fCatalog << endl;
     263
     264    gLog << "WobbleMode: " << (fIsWobbleMode?"On":"Off") << endl << endl;
     265
     266    gLog << "Comment: " << fComment << endl;
     267
     268    if (TString(o).Contains("files", TString::kIgnoreCase))
     269    {
     270        TObject *obj=0;
     271
     272        gLog << endl;
     273        gLog << "On-Data Files:" << endl;
     274        TIter NextOn(&fSequencesOn);
     275        while ((obj=NextOn()))
     276            PrintFile(*obj);
     277
     278        gLog << endl;
     279        gLog << "Off-Data Files:" << endl;
     280        TIter NextOff(&fSequencesOff);
     281        while ((obj=NextOff()))
     282            PrintFile(*obj);
     283
    260284        return;
    261 
    262     TObject *obj=0;
    263 
    264     gLog << endl;
    265     gLog << "On-Data Files:" << endl;
    266     TIter NextOn(&fSequencesOn);
    267     while ((obj=NextOn()))
    268         PrintFile(*obj);
    269 
    270     gLog << endl;
    271     gLog << "Off-Data Files:" << endl;
    272     TIter NextOff(&fSequencesOff);
    273     while ((obj=NextOff()))
    274         PrintFile(*obj);
     285    }
    275286}
    276287
     
    481492    return kTRUE;
    482493}
     494
     495// --------------------------------------------------------------------------
     496//
     497// Calls ReplaceAll(old, news) for all Dir-entries
     498//
     499void MDataSet::ReplaceDir(TList &list, const TString &old, const TString &news) const
     500{
     501    TIter Next(&list);
     502    TNamed *name = 0;
     503    while ((name=(TNamed*)Next()))
     504    {
     505        TString dir = name->GetTitle();
     506        dir.ReplaceAll(old, news);
     507        name->SetTitle(dir);
     508    }
     509}
     510
     511// --------------------------------------------------------------------------
     512//
     513// Calls ReplaceAll(old, news) for all File-entries
     514//
     515void MDataSet::ReplaceFile(TList &list, const TString &old, const TString &news) const
     516{
     517    TIter Next(&list);
     518    TNamed *name = 0;
     519    while ((name=(TNamed*)Next()))
     520    {
     521        TString file = name->GetName();
     522        file.ReplaceAll(old, news);
     523        name->SetName(file);
     524    }
     525}
  • trunk/MagicSoft/Mars/mjobs/MDataSet.h

    r7142 r7380  
    1919{
    2020private:
     21    static const TString fgCatalog;       //! Default Catalog path
     22    static const TString fgPathDataFiles; //! Default path to data files
     23    static const TString fgPathSequences; //! Default path to sequences
     24
    2125    UInt_t  fNumAnalysis;     // Analysis number (artificial)
    2226
     
    3034    TString fCatalog;         // edb catalog (magic_favourites.edb)
    3135
     36    TString fComment;         // Comment from DS file
     37
    3238    Bool_t  fIsWobbleMode;    // Wobble Mode for this dataset?
    3339
    3440    void Split(TString &runs, TArrayI &data) const;
    35     void ResolveSequences(TEnv &env, const TArrayI &num, TList &list) const;
     41    void ResolveSequences(TEnv &env, const TArrayI &num, TList &list, const TString &sequences, const TString &data) const;
    3642    static void PrintFile(const TObject &obj);
     43
     44    void ReplaceDir(TList &list, const TString &old, const TString &news) const;
     45    void ReplaceFile(TList &list, const TString &old, const TString &news) const;
     46
     47    void SetupDefaultPath(TString &path, const TString &def) const
     48    {
     49        if (path.IsNull())
     50            path = def;
     51        if (!path.EndsWith("/"))
     52            path += "/";
     53    }
    3754
    3855public:
    3956    MDataSet() : fNumAnalysis((UInt_t)-1) { }
    40     MDataSet(const char *fname);
     57    MDataSet(const char *fname, TString sequences="", TString data="");
    4158
    4259    // Getter
     
    7188    Bool_t AddFilesOff(TChain &read) const;
    7289
     90    void ReplaceDir(const TString &old, const TString &news)
     91    {
     92        ReplaceDir(fSequencesOn,  old, news);
     93        ReplaceDir(fSequencesOff, old, news);
     94    }
     95
     96    void ReplaceFile(const TString &old, const TString &news)
     97    {
     98        ReplaceFile(fSequencesOn,  old, news);
     99        ReplaceFile(fSequencesOff, old, news);
     100    }
     101
    73102    // TObject
    74103    void Print(Option_t *o="") const;
  • trunk/MagicSoft/Mars/mjobs/MSequence.cc

    r7358 r7380  
    337337    if (!str.CompareTo("Moon", TString::kIgnoreCase))
    338338        return kMoon;
    339 
    340     gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight or moon." << endl;
     339    if (!str.CompareTo("Day", TString::kIgnoreCase))
     340        return kDay;
     341
     342    gLog << warn << "MSequence: LightCondition-tag not n/a, nomoon, twilight, moon or day." << endl;
    341343    return kNA;
    342344}
     
    353355
    354356    fTitle = Form("Sequence contained in file %s", expname);
     357
     358    const Bool_t access = !gSystem->AccessPathName(expname, kFileExists);
     359    if (!access)
     360        gLog << err << "ERROR - Dataset file " << expname << " not accessible!" << endl;
    355361
    356362    TEnv env(expname);
     
    414420    case kTwilight: gLog << "Twilight" << endl; break;
    415421    case kMoon:     gLog << "Moon" << endl;     break;
     422    case kDay:      gLog << "Day" << endl;     break;
    416423    }
    417424    gLog << "Start:          " << fStart << endl;
  • trunk/MagicSoft/Mars/mjobs/MSequence.h

    r6906 r7380  
    1919{
    2020public:
    21     enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon };
     21    enum LightCondition_t { kNA, kNoMoon, kTwilight, kMoon, kDay };
    2222    enum FileType_t {
    2323        kRawDat, kRawPed, kRawCal, kRawAll,
Note: See TracChangeset for help on using the changeset viewer.