Changeset 4575 for trunk/MagicSoft


Ignore:
Timestamp:
08/11/04 10:35:11 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/merpp.cc

    r4452 r4575  
    88#include "MSqlInsertRun.h"
    99#include "MRawFileWrite.h"
    10 
    11 #include "MReportFileRead.h"
     10#include "MReportFileReadCC.h"
    1211#include "MWriteRootFile.h"
    1312
     
    7776    gLog << "     --start=yyyy-mm-dd/hh:mm:ss.mmm  Start event time for merpping report files" << endl;
    7877    gLog << "     --stop=yyyy-mm-dd/hh:mm:ss.mmm   Stop  event time for merpping report files" << endl;
    79     gLog << "     --run=#                          Only data corresponding to this run number" << endl;
     78    gLog << "     --run=#                          Only data corresponding to this run number (from RUN-REPORT)" << endl;
     79    gLog << "     --runfile=#                      Check that CC file corresponds to this run (from .rep header)" << endl;
     80    gLog << "     --sumfile                        Check that CC file is a all night summary (from .rep header)" << endl;
     81    gLog << "     --allfiles                       Don't check file type for CC files <default>" << endl;
    8082    gLog << "     --debug[=n]                      Enable root debugging (Default: gDebug=1)" << endl;
    8183    gLog << "     -?, -h, --help                   This help" << endl << endl;
     
    133135    const Int_t   kRunNumber   = arg.HasOption("--run=") ? arg.GetIntAndRemove("--run=") : -1;
    134136    const TString kSqlDataBase(arg.GetStringAndRemove("--sql="));
     137
     138    Int_t kRunFile = arg.HasOption("--runfile=") ? arg.GetIntAndRemove("--runfile=") : -1;
     139    if (arg.HasOnlyAndRemove("--sumfile"))
     140        kRunFile = 0;
    135141
    136142    if (kTimeStart)
     
    284290        write = w;
    285291
    286         MReportFileRead *r = new MReportFileRead(kNamein);
     292        MReportFileReadCC *r = new MReportFileReadCC(kNamein);
    287293        r->SetTimeStart(kTimeStart);
    288294        r->SetTimeStop(kTimeStop);
     
    294300        else
    295301        {
     302            r->SetRunNumber(kRunFile);
    296303            r->AddToList("MReportCC");
    297304            //r->AddToList("MReportDAQ");
  • trunk/MagicSoft/Mars/mreport/MReport.cc

    r3589 r4575  
    9191// argument.
    9292//
    93 Int_t MReport::InterpreteBody(TString &str)
     93Int_t MReport::InterpreteBody(TString &str, Int_t ver)
    9494{
    9595    *fLog << warn << "No interpreter existing for: " << fIdentifier << endl;
     
    105105// SetupReading must be called successfully before.
    106106//
    107 Int_t MReport::Interprete(TString &str, const MTime &start, const MTime &stop)
     107Int_t MReport::Interprete(TString &str, const MTime &start, const MTime &stop, Int_t ver)
    108108{
    109109    if (!InterpreteHeader(str))
     
    116116        return -1;
    117117
    118     const Int_t rc = InterpreteBody(str);
     118    const Int_t rc = InterpreteBody(str, ver);
    119119    if (rc != kTRUE)
    120120        return rc;
  • trunk/MagicSoft/Mars/mreport/MReport.h

    r2892 r4575  
    2525
    2626    virtual Bool_t SetupReading(MParList &plist);
    27     virtual Int_t  InterpreteBody(TString &str);
     27    virtual Int_t  InterpreteBody(TString &str, Int_t ver);
    2828
    29     Int_t  Interprete(TString &str, const MTime &start, const MTime &stop);
     29    Int_t  Interprete(TString &str, const MTime &start, const MTime &stop, const Int_t ver);
    3030    Bool_t CheckIdentifier(TString &str) const
    3131    {
  • trunk/MagicSoft/Mars/mreport/MReportCC.cc

    r2892 r4575  
    5858// Interprete the body of the CC-REPORT string
    5959//
    60 Int_t MReportCC::InterpreteBody(TString &str)
     60Int_t MReportCC::InterpreteBody(TString &str, Int_t ver)
    6161{
    6262    // Remove the 30 tokens of the subsystem status
  • trunk/MagicSoft/Mars/mreport/MReportCC.h

    r2892 r4575  
    1414    Float_t fSolarRadiation; // [W/m^2] IR-Radiation
    1515
    16     Int_t InterpreteBody(TString &str);
     16    Int_t InterpreteBody(TString &str, Int_t ver);
    1717
    1818public:
  • trunk/MagicSoft/Mars/mreport/MReportCamera.cc

    r4569 r4575  
    447447// Interprete the body of the CAMERA-REPORT string
    448448//
    449 Int_t MReportCamera::InterpreteBody(TString &str)
     449Int_t MReportCamera::InterpreteBody(TString &str, Int_t ver)
    450450{
    451451    if (!InterpreteCamera(str))
  • trunk/MagicSoft/Mars/mreport/MReportCamera.h

    r4569 r4575  
    4040    Bool_t InterpreteHOT(TString &str);
    4141
    42     Int_t  InterpreteBody(TString &str);
     42    Int_t  InterpreteBody(TString &str, Int_t ver);
    4343
    4444public:
  • trunk/MagicSoft/Mars/mreport/MReportCurrents.cc

    r2892 r4575  
    7070// Interprete the body of the DC-REPORT string
    7171//
    72 Int_t MReportCurrents::InterpreteBody(TString &str)
     72Int_t MReportCurrents::InterpreteBody(TString &str, Int_t ver)
    7373{
    7474    Int_t len;
  • trunk/MagicSoft/Mars/mreport/MReportCurrents.h

    r2892 r4575  
    1717
    1818    Bool_t SetupReading(MParList &plist);
    19     Int_t InterpreteBody(TString &str);
     19    Int_t InterpreteBody(TString &str, Int_t ver);
    2020
    2121public:
  • trunk/MagicSoft/Mars/mreport/MReportDAQ.cc

    r2892 r4575  
    4848}
    4949
    50 Int_t MReportDAQ::InterpreteBody(TString &str)
     50Int_t MReportDAQ::InterpreteBody(TString &str, Int_t ver)
    5151{
    5252    *fLog << dbg << "D" << flush;
  • trunk/MagicSoft/Mars/mreport/MReportDAQ.h

    r2892 r4575  
    99{
    1010private:
    11     Int_t InterpreteBody(TString &str);
     11    Int_t InterpreteBody(TString &str, Int_t ver);
    1212
    1313public:
  • trunk/MagicSoft/Mars/mreport/MReportDrive.cc

    r3667 r4575  
    8888// Interprete the body of the DRIVE-REPORT string
    8989//
    90 Int_t MReportDrive::InterpreteBody(TString &str)
     90Int_t MReportDrive::InterpreteBody(TString &str, Int_t ver)
    9191{
    9292    MAstro::String2Angle(str, fRa);
  • trunk/MagicSoft/Mars/mreport/MReportDrive.h

    r2892 r4575  
    2323    Double_t fErrorAz;    // [?] sistem error in the azimuth angle axis
    2424
    25     Int_t InterpreteBody(TString &str);
     25    Int_t InterpreteBody(TString &str, Int_t ver);
    2626
    2727public:
  • trunk/MagicSoft/Mars/mreport/MReportFileRead.cc

    r3568 r4575  
    5656using namespace std;
    5757
    58 const TString MReportFileRead::gsReportHeader ="[CC Report File]";
    59 const TString MReportFileRead::gsVersionPrefix="Arehucas Version Number";
    60 
    6158// --------------------------------------------------------------------------
    6259//
     
    6562//
    6663MReportFileRead::MReportFileRead(const char *fname, const char *name, const char *title)
    67     : fFileName(fname), fIn(NULL)
     64    : fFileName(fname), fVersion(-1), fIn(NULL)
    6865{
    6966    fName  = name  ? name  : "MReportFileRead";
    70     fTitle = title ? title : "Read task to read Central Control report files";
     67    fTitle = title ? title : "Read task to read general report files";
    7168
    7269    fIn = new ifstream;
     
    137134    fList->Add(help);
    138135    return kTRUE;
    139 }
    140 
    141 // --------------------------------------------------------------------------
    142 //
    143 // Check whether the file header corresponds to a central control file
    144 // header and check for the existance of a correct version number.
    145 // The version number may later be used to be able to read different
    146 // file versions
    147 //
    148 Int_t MReportFileRead::CheckFileHeader() const
    149 {
    150     Int_t line = 0;
    151 
    152     TString str;
    153     str.ReadLine(*fIn);   // Read to EOF or newline
    154     if (str != gsReportHeader)
    155     {
    156         *fLog << err << "ERROR - First line doesn't match '" << gsReportHeader <<"' ";
    157         *fLog << "in file '" << fFileName << "'"<<endl;
    158         return line;
    159     }
    160     line++;
    161 
    162     str.ReadLine(*fIn);   // Read to EOF or newline
    163     if (!str.BeginsWith(gsVersionPrefix))
    164     {
    165         *fLog << err << "ERROR - Version prefix '" << gsVersionPrefix <<"' ";
    166         *fLog << "not found in second line of file '" << fFileName << "'"<<endl;
    167         return line;
    168     }
    169     line++;
    170 
    171     str.Remove(0, gsVersionPrefix.Length());
    172     str = str.Strip(TString::kBoth);
    173 
    174     TString ver = str(TRegexp("^[0-9][0-9][0-9][0-9][0-9][0-9]-[0-9]$"));
    175     if (ver.IsNull())
    176     {
    177         *fLog << err << "ERROR - Version string '" << str <<"' doesn't ";
    178         *fLog << "match regular expression." << endl;
    179         return line;
    180     }
    181 
    182     *fLog << dbg << "Report File version: <" << ver << ">" << endl;
    183 
    184     return line;
    185136}
    186137
     
    257208    }
    258209
    259     const Int_t rc = rep->Interprete(str, fStart, fStop);
     210    const Int_t rc = rep->Interprete(str, fStart, fStop, fVersion);
    260211
    261212    switch (rc)
  • trunk/MagicSoft/Mars/mreport/MReportFileRead.h

    r2711 r4575  
    2323{
    2424private:
    25     static const TString gsReportHeader;
    26     static const TString gsVersionPrefix;
     25    TString     fFileName;  // Name of the input file
    2726
    28     TString     fFileName;
    29     ifstream   *fIn;         //! buffered input stream (file to read from)
     27    THashTable *fList;      // List of possible reports to be interpreted
    3028
    31     THashTable *fList;
     29    MTime   fStart;         // Time range which should be read from file
     30    MTime   fStop;          // Time range which should be read from file
    3231
    33     MTime fStart;            // Time range which should be read from file
    34     MTime fStop;             // Time range which should be read from file
     32    ULong_t fNumLine;       // line counter
    3533
    36     ULong_t fNumLine;        // line counter
     34    Int_t   fVersion;       // File format version
    3735
    3836    enum { kHasNoHeader = BIT(14) };
     
    4240    Int_t PostProcess();
    4341
    44     Int_t CheckFileHeader() const;
     42    virtual Int_t CheckFileHeader() { return 0; }
    4543    MReport *GetReport(const TString &str) const;
    4644    MReport *GetReport(MReportHelp *help) const;
    4745    MReportHelp *GetReportHelp(const TString &str) const;
     46
     47protected:
     48    ifstream   *fIn;         //! buffered input stream (file to read from)
     49    void SetVersion(Int_t v) { fVersion = v; }
    4850
    4951public:
     
    5759    Bool_t AddToList(const char *name) const;
    5860
    59     ClassDef(MReportFileRead, 0)// Task to read the central control report file
     61    ClassDef(MReportFileRead, 0)// Task to read general report file
    6062};
    6163
  • trunk/MagicSoft/Mars/mreport/MReportHelp.cc

    r2892 r4575  
    138138// successfull interpretations.
    139139//
    140 Int_t MReportHelp::Interprete(TString &str, const MTime &start, const MTime &stop)
     140Int_t MReportHelp::Interprete(TString &str, const MTime &start, const MTime &stop, Int_t ver)
    141141{
    142     const Int_t rc = fReport->Interprete(str, start, stop);
     142    const Int_t rc = fReport->Interprete(str, start, stop, ver);
    143143
    144144    switch (rc)
  • trunk/MagicSoft/Mars/mreport/MReportHelp.h

    r2892 r4575  
    3030    MReport *GetReport() { return fReport; }
    3131
    32     Int_t Interprete(TString &str, const MTime &start, const MTime &stop);
     32    Int_t Interprete(TString &str, const MTime &start, const MTime &stop, Int_t ver);
    3333
    3434    Bool_t SetupReading(MParList &plist);
  • trunk/MagicSoft/Mars/mreport/MReportRun.cc

    r3818 r4575  
    5757// Interprete the body of the RUN-REPORT string
    5858//
    59 Int_t MReportRun::InterpreteBody(TString &str)
     59Int_t MReportRun::InterpreteBody(TString &str, Int_t ver)
    6060{
    6161    const Int_t ws = str.First(' ');
  • trunk/MagicSoft/Mars/mreport/MReportRun.h

    r2892 r4575  
    1212    TString fSourceName;
    1313
    14     Int_t InterpreteBody(TString &str);
     14    Int_t InterpreteBody(TString &str, Int_t ver);
    1515
    1616public:
  • trunk/MagicSoft/Mars/mreport/MReportTrigger.cc

    r2892 r4575  
    5252// Interprete the body of the TRIGGER-REPORT string
    5353//
    54 Int_t MReportTrigger::InterpreteBody(TString &str)
     54Int_t MReportTrigger::InterpreteBody(TString &str, Int_t ver)
    5555{
    5656    str = str.Strip(TString::kLeading);
  • trunk/MagicSoft/Mars/mreport/MReportTrigger.h

    r3148 r4575  
    2222    //TArrayF fRates;           //[Hz] currently undefined
    2323
    24     Int_t InterpreteBody(TString &str);
     24    Int_t InterpreteBody(TString &str, Int_t ver);
    2525
    2626public:
  • trunk/MagicSoft/Mars/mreport/Makefile

    r3927 r4575  
    3131           MReportTrigger.cc \
    3232           MReportCurrents.cc \
    33            MReportFileRead.cc
     33           MReportFileRead.cc \
     34           MReportFileReadCC.cc
    3435
    3536############################################################
  • trunk/MagicSoft/Mars/mreport/ReportLinkDef.h

    r2800 r4575  
    1717#pragma link C++ class MReportHelp+;
    1818#pragma link C++ class MReportFileRead+;
     19#pragma link C++ class MReportFileReadCC+;
    1920
    2021#endif
Note: See TracChangeset for help on using the changeset viewer.