Changeset 8617 for trunk/MagicSoft


Ignore:
Timestamp:
06/28/07 20:49:30 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r8615 r8617  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21
     22 2007/06/28 Thomas Bretz
     23
     24   * mars.cc:
     25     - added new options to use a sequence file instead of a run
     26
     27   * mhbase/MFillH.h:
     28     - added new member function to reset weights
     29
     30   * mmain/MEventDisplay.[h,cc]:
     31     - added path argument to allow to give an input path
     32     - added to allow to setup a sequence file for reading
     33
     34   * mmain/Makefile:
     35     - added inlcude of mjobs for MSequence
     36
    2037
    2138
  • trunk/MagicSoft/Mars/mars.cc

    r8011 r8617  
    4545    gLog << all << endl;
    4646    gLog << "Sorry the usage is:" << endl;
    47     gLog << " mars [options] [filename]" << endl << endl;
     47    gLog << " mars [options] filename|number [path]" << endl << endl;
     48    gLog << " Arguments:" << endl;
     49    gLog << "   filename: Name of a merpped raw file, a calibrated (Y)," << endl;
     50    gLog << "             sequence file or sequence number." << endl;
     51    gLog << "   path:     Path where the data is stored in case of a" << endl;
     52    gLog << "             sequence (datacenter default if omitted)." << endl << endl;
    4853    gLog << " Options:" << endl;
     54    gLog.Usage();
     55    gLog << "   --config=mars.rc: Change configuration file" << endl;
     56    gLog << "                     <not yet implemented!>" << endl;
    4957    gLog.Usage();
    5058    gLog << "     -?/-h: This help" << endl << endl;
    5159}
     60
     61/*
     62Bool_t InflateRun(TString &run, Bool_t ismc)
     63{
     64    if (run.IsDigit())
     65    {
     66        const Int_t numrun = run.Atoi();
     67        seq = "/magic/";
     68        if (ismc)
     69            seq += ismc ? "montecarlo/" : "rawfiles/";
     70        seq += Form("sequences/%04d/sequence%08d.txt", numseq/10000, numseq);
     71        gLog << inf << "Inflated sequence file: " << seq << endl;
     72    }
     73
     74    if (!gSystem->AccessPathName(seq, kFileExists))
     75        return kTRUE;
     76
     77    gLog << err << "Sorry, sequence file '" << seq << "' doesn't exist." << endl;
     78    return kFALSE;
     79}
     80*/
    5281
    5382int main(int argc, char **argv)
     
    7099    }
    71100
     101    //const Bool_t  kIsSequence = arg.HasOnlyAndRemove("--seq");
     102    const TString kConfig = arg.GetStringAndRemove("--config=", "mars.rc");
     103
     104    if (arg.GetNumOptions()>0)
     105    {
     106        gLog << warn << "WARNING - Unknown commandline options..." << endl;
     107        arg.Print("options");
     108        gLog << endl;
     109        return 2;
     110    }
     111
     112    //
     113    // check for the right usage of the program
     114    //
     115    if (arg.GetNumArguments()>2)
     116    {
     117        Usage();
     118        return 2;
     119    }
     120
    72121    //
    73122    // This is to make argv[i] more readable inside the code
    74123    //
    75     const TString kFilename = arg.GetArgumentStr(0);
     124    TString kFilename = arg.GetArgumentStr(0);
     125    TString kInpathD  = arg.GetArgumentStr(1);
     126
     127    //if (!kIsSequence && !InflateRun(kFilename))
     128    //    return 3;
    76129
    77130#ifdef HAVE_XPM
     
    100153#endif
    101154
     155    /*
     156    MEnv env(kConfig);
     157    if (!env.IsValid())
     158    {
     159        gLog << err << "Configuration file " << kConfig << " not found." << endl;
     160        return 0xfe;
     161    }
     162    */
     163
    102164    //
    103165    // start the main window
     
    107169    else
    108170    {
    109         MEventDisplay *d = new MEventDisplay(kFilename);
     171        MEventDisplay *d = new MEventDisplay(kFilename, kInpathD);
    110172        d->SetBit(MStatusDisplay::kExitLoopOnExit);
    111173        d->SetTitle(kFilename);
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r8611 r8617  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.60 2007-06-26 16:59:21 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.61 2007-06-28 19:49:30 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    9595// Container
    9696//
     97#include "MSequence.h"                 // MSequence
     98#include "MDirIter.h"                  // MDirIter
    9799#include "MHillas.h"                   // MHillas::Print(const MGeomCam&)
    98100#include "MHillasExt.h"                // MHillasExt::Print(const MGeomCam&)
     
    118120//  Constructor.
    119121//
    120 MEventDisplay::MEventDisplay(const char *fname) : MStatusDisplay(), fEvtLoop(0)
     122MEventDisplay::MEventDisplay(const char *fname, const char *path) : MStatusDisplay(), fEvtLoop(0)
    121123{
    122124    //
    123125    // Setup Task list for hillas calculation
    124126    //
    125     SetupTaskList("Events", fname);
     127    SetupTaskList("Events", fname, path);
    126128
    127129    //
     
    163165{
    164166    TFile f(fname, "READ");
     167    if (f.IsZombie())
     168        return 0; // Not a root file
     169
    165170    TTree *t = (TTree*)f.Get(tree);
    166171    if (!t)
     
    181186//  preprocess tasks and read in first event (process)
    182187//
    183 void MEventDisplay::SetupTaskList(const char *tname, const char *fname)
    184 {
    185 //    MCalibrationChargeCam *ccam=0;
    186 //    MPedPhotCam           *pcam=0;
    187 
     188void MEventDisplay::SetupTaskList(const char *tname, TString fname, const char *path)
     189{
    188190    MBadPixelsCam *badpix = new MBadPixelsCam;
    189191
    190     const Int_t type = GetFileType(tname, fname);
     192    Int_t type = GetFileType(tname, fname);
    191193    switch (type)
    192194    {
     
    195197    case -2: gLog << err << "File type unknown... abort." << endl; return;
    196198    case -1: gLog << err << "Tree " << tname << " not found... abort." << endl; return;
    197     }
     199    case  0: gLog << inf << "Assuming Sequence file." << endl; break;
     200    }
     201
     202    if (type==0 && !MSequence::InflatePath(fname))
     203        return;
     204
     205    // Check if file is a sequence...
     206    MSequence *seq = type==0 ? new MSequence(fname, path) : new MSequence;
     207    if (type==0)
     208        type = 1;
    198209
    199210    //
     
    209220    plist->AddToList(tlist);
    210221    plist->AddToList(badpix);
    211 
    212     MReadMarsFile *read = new MReadMarsFile(tname, fname);
     222    plist->AddToList(seq);
     223
     224    MReadMarsFile *read = new MReadMarsFile(tname);
    213225    read->DisableAutoScheme();
     226    if (seq->IsValid())
     227    {
     228        MDirIter iter;
     229        if (seq->SetupDatRuns(iter, MSequence::kCalibrated)<=0)
     230            return;
     231        read->AddFiles(iter);
     232    }
     233    else
     234        read->AddFile(fname);
    214235    tlist->AddToList(read);
    215236
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.h

    r6569 r8617  
    3838
    3939    void UpdateDisplay();
    40     void SetupTaskList(const char *tname, const char *fname);
     40    void SetupTaskList(const char *tname, TString fname, const char *path);
    4141
    4242    void ReadFirstEvent();
     
    4848
    4949public:
    50     MEventDisplay(const char *fname);
     50    MEventDisplay(const char *fname, const char *path="");
    5151    ~MEventDisplay();
    5252
  • trunk/MagicSoft/Mars/mmain/Makefile

    r8611 r8617  
    2323           -I../mfileio -I../mimage -I../mhistmc -I../mgbase -I../mfbase  \
    2424           -I../mdata -I../msignal -I../mcalib -I../mbadpixels            \
    25            -I../mpointing -I../mpedestal -I../mmuon -I../mfilter
     25           -I../mpointing -I../mpedestal -I../mmuon -I../mfilter -I../mjobs
    2626
    2727SRCFILES = MBrowser.cc \
Note: See TracChangeset for help on using the changeset viewer.