Changeset 9017 for trunk


Ignore:
Timestamp:
07/20/08 15:21:42 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9016 r9017  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20
     21 2008/07/20 Thomas Bretz
     22
     23   * callisto.cc, star.cc, mjobs/MDataSet.cc, mjobs/MJCalibrateSignal.cc,
     24     mjobs/MJCalibration.cc, mjobs/MJPedestal.cc, mjoptim/MJOptimize.cc,
     25     mmain/MEventDisplay.cc:
     26     - replaced Setup*Runs by GetRuns
     27
     28   * datacenter/macros/buildsequenceentries.C:
     29     - output if something is deleted
     30
     31   * datacenter/macros/plotdb.C:
     32     - added kGroupByDay option
     33     - some small changes
     34     - made group by work with "as"
     35     - made use of TEnv obsolete
     36
     37   * datacenter/macros/plotrundb.C:
     38     - added telescope number as otpion
     39
     40   * datacenter/scripts/checkfilesforsequenceavail:
     41     - added telescope number 1 to call of checkfileavail.C
     42
     43   * mbase/MTime.cc:
     44     - made SetSqlDateTime more flexible
     45
     46
    2047
    2148 2008/07/19 Thomas Bretz
  • trunk/MagicSoft/Mars/callisto.cc

    r8999 r9017  
    122122}
    123123
    124 static void PrintFiles(const MSequence &seq, const TString &kInpathD, Bool_t raw, Bool_t showall)
     124static void PrintFiles(const MSequence &seq, const TString &kInpathD, Bool_t showall)
    125125{
    126126    const char *prep = showall ? "Found" : "Scheduled";
    127127
    128128    MDirIter Next1, Next2, Next3;
    129     seq.SetupPedRuns(Next1, kInpathD, raw);
    130     seq.SetupCalRuns(Next2, kInpathD, raw);
    131     seq.SetupDatRuns(Next3, kInpathD, raw);
     129    seq.GetRuns(Next1, MSequence::kRawPed, kInpathD);
     130    seq.GetRuns(Next2, MSequence::kRawCal, kInpathD);
     131    seq.GetRuns(Next3, MSequence::kRawDat, kInpathD);
    132132
    133133    gLog << all;
     
    310310    //
    311311    if (kPrintFiles)
    312         PrintFiles(seq, kInpathD, !seq.IsMonteCarlo(), kFALSE);
     312        PrintFiles(seq, kInpathD, kFALSE);
    313313    if (kPrintFound)
    314         PrintFiles(seq, kInpathD, !seq.IsMonteCarlo(), kTRUE);
     314        PrintFiles(seq, kInpathD, kTRUE);
    315315
    316316//    if (seq.HasMoon())
  • trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C

    r9014 r9017  
    446446        if (IsDummy())
    447447        {
    448             cout << "       + unlink " << fname << endl;
    449             cout << "       + " << cmd1 << endl;
    450             cout << "       + " << cmd2 << endl;
     448            cout << "       + would unlink " << fname << endl;
     449            cout << "       + would remove " << cmd1 << endl;
     450            cout << "       + would remove " << cmd2 << endl;
    451451            return kTRUE;
    452452        }
     453
     454        cout << "       + will unlink " << fname << endl;
     455        cout << "       + will remove " << cmd1 << endl;
     456        cout << "       + will remove " << cmd2 << endl;
    453457
    454458        gSystem->Unlink(fname);
  • trunk/MagicSoft/Mars/datacenter/macros/plotdb.C

    r8988 r9017  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.48 2008-06-30 09:36:34 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: plotdb.C,v 1.49 2008-07-20 14:21:40 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    6363
    6464#include <TH1.h>
    65 #include <TEnv.h>
    6665#include <TPad.h>
    6766#include <TLine.h>
     
    9089        kGroupByPrimary,
    9190        kGroupByHour,
     91        kGroupByDay,
    9292        kGroupByNight,
    9393        kGroupByWeek,
     
    159159        while ((row=res.Next()))
    160160        {
     161            Int_t pos=0;
    161162            // Get all fields of this row
    162             const char *date = (*row)[0];
    163             const char *zd   = (*row)[1];
    164             const char *val  = (*row)[2];
    165             const char *snum = res.GetFieldCount()>3 ? (*row)[3] : 0;
    166             const char *verr = res.GetFieldCount()>4 ? (*row)[5] : 0;
     163            const char *date  = (*row)[pos++];
     164            const char *zd    = (*row)[pos++];
     165            const char *val   = (*row)[pos++];
     166            const char *zderr = fGroupBy!=kNone ? (*row)[pos++] : 0;
     167            const char *verr  = fGroupBy!=kNone ? (*row)[pos++] : 0;
     168            const char *snum  = fDataSet        ? (*row)[pos++] : 0;
    167169
    168170            delete row;
     
    383385            fDataSet = NULL;
    384386        }
    385         if (!filename.IsNull())
    386             fDataSet = new MDataSet(filename);
     387
     388        fPrimaryNumber="";
     389
     390        if (filename.IsNull())
     391            return;
     392
     393        fDataSet = new MDataSet(filename);
     394        fPrimaryNumber="Sequences.fSequenceFirst";
    387395    }
    388396    void SetPlotRange(Float_t min, Float_t max/*, Int_t n=5*/) { fPlotMin = min; fPlotMax = max; }
     
    395403    void SetGroupBy(GroupBy_t b=kGroupByWeek) { fGroupBy=b; }
    396404    void SetPrimaryDate(const char *ts) { fPrimaryDate=ts; }
    397     void SetPrimaryNumber(const char *ts) { fPrimaryNumber=ts; }
     405    void SetPrimaryNumber(const char *ts) { }
    398406    void SetSecondary(const char *ts) { fSecondary=ts; }
    399407
    400408    MStatusDisplay *GetDisplay() { return fDisplay; }
     409    MSQLMagic &GetServer() { return fServer; }
    401410
    402411    Bool_t Plot(const char *value, Float_t min=0, Float_t max=-1, Float_t resolution=0)
     
    424433        case kGroupByNight:
    425434            query += Form("DATE_FORMAT(ADDDATE(%s,Interval 12 hour), '%%Y-%%m-%%d 00:00:00') AS %s ", fPrimaryDate.Data(), valued.Data()+1);
     435            break;
     436        case kGroupByDay:
     437            query += Form("DATE_FORMAT(%s, '%%Y-%%m-%%d 00:00:00') AS %s ", fPrimaryDate.Data(), valued.Data()+1);
    426438            break;
    427439        case kGroupByWeek:
     
    445457            query += ", ";
    446458            query += value;
     459        }
     460        else
     461        {
     462            TString v(value);
     463
     464            TString as = v(TPRegexp(" +[aA][sS] +[a-zA-Z0-9]+ *$"));
     465            Ssiz_t  p  = v.Index(as);
     466
     467            v.Prepend("(");
     468            v.Insert(p<=0?v.Length():p+1, ")");
     469
     470            query += ", AVG";
     471            query += v;
     472            query += ", AVG(";
     473            query += fSecondary;
     474            query += "), STD";
     475            query += v;
     476            query += ", STD(";
     477            query += fSecondary;
     478            query += ")";
     479        }
     480
     481        if (fDataSet)
     482        {
    447483            query += ", ";
    448484            query += fPrimaryNumber;
    449             query += " ";
    450         }
    451         else
    452         {
    453             query += ", AVG(";
    454             query += fSecondary;
    455             query += "), AVG(";
    456             query += value;
    457             query += "), ";
    458             query += fPrimaryNumber;
    459             query += ", STD(";
    460             query += fSecondary;
    461             query += "), STD(";
    462             query += value;
    463             query += ") ";
    464         }
    465 
    466         query += Form("FROM %s ", tabled.Data());
     485        }
     486
     487        query += Form(" FROM %s ", tabled.Data());
    467488
    468489        const Bool_t interval = !fRequestFrom.IsNull() && !fRequestTo.IsNull();
    469490
    470491        TString where(fCondition);
    471         /*
    472         if (!fDataSet && !interval && tablev=="Star")
    473         {
    474             if (!where.IsNull())
    475                 where += " AND ";
    476             where += "Star.fMuonNumber>300 ";
    477         }
    478         */
    479492        if (interval)
    480493        {
     
    521534        return kTRUE;
    522535    }
     536//    ClassDef(MPlot, 0)
    523537};
     538
     539//ClassImp(MPlot);
    524540
    525541void plotalldb(MPlot &plot)
    526542{
    527543    //plot.SetGroupBy(MPlot::kGroupByNight);
     544    //plot.SetDataSet("dataset.txt");
    528545
    529546    plot.SetPrimaryDate("Sequences.fRunStart");
    530     plot.SetPrimaryNumber("Sequences.fSequenceFirst");
    531547    plot.SetSecondary("(Sequences.fZenithDistanceMin+Sequences.fZenithDistanceMax)/2 as '<Zd>'");
    532548
     
    668684int plotdb(TString from, TString to, const char *dataset=0)
    669685{
    670     TEnv env("sql.rc");
    671 
    672     MSQLMagic serv(env);
     686    MSQLMagic serv("sql.rc");
    673687    if (!serv.IsConnected())
    674688    {
     
    700714int plotdb(const char *ds)
    701715{
    702     TEnv env("sql.rc");
    703 
    704     MSQLMagic serv(env);
     716    MSQLMagic serv("sql.rc");
    705717    if (!serv.IsConnected())
    706718    {
     
    732744int plotdb(Int_t period, const char *dataset="")
    733745{
    734     TEnv env("sql.rc");
    735 
    736     MSQLMagic serv(env);
     746    MSQLMagic serv("sql.rc");
    737747    if (!serv.IsConnected())
    738748    {
  • trunk/MagicSoft/Mars/datacenter/macros/plotrundb.C

    r8996 r9017  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1.6 2008-07-05 19:01:42 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: plotrundb.C,v 1.7 2008-07-20 14:21:40 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    6161#include "plotdb.C"
    6262
    63 void plotall(MPlot &plot)
     63void plotall(MPlot &plot, Int_t tel=0)
    6464{
    6565    plot.SetGroupBy(MPlot::kGroupByNight);
     
    7373    cond += t.GetSqlDateTime();
    7474    cond += "'";
     75    if (tel>0)
     76    {
     77        query[0] += " AND fTelescopeNumber=";
     78        query[0] += tel;
     79    }
    7580    plot.SetCondition(cond);
    7681
  • trunk/MagicSoft/Mars/datacenter/scripts/checkfilesforsequenceavail

    r8513 r9017  
    7373   makedir $checkfileavailpath  >> $scriptlog 2>&1
    7474   checkfileavaillog=$checkfileavailpath/$program-$sequence.log
    75    
     75
    7676   sequencefile=$sequpath/$no/sequence$no2.txt
    7777
     
    7979   setstatus "start" >> $scriptlog 2>&1
    8080
    81    check1=`root -q -b $macrospath/checkfileavail.C+\(\""$sequencefile\""\) | tee $checkfileavaillog | intgrep`
     81   check1=`root -q -b $macrospath/checkfileavail.C+\(\""$sequencefile\",1"\) | tee $checkfileavaillog | intgrep`
    8282
    8383   case $check1 in
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r9012 r9017  
    403403        return kFALSE;
    404404
    405     UInt_t  y, mon, d, h, m, s;
     405    UInt_t  y, mon, d, h, m, s, ms;
     406
     407    if (7==sscanf(str, "%04u-%02u-%02u %02u:%02u:%02u.%u", &y, &mon, &d, &h, &m, &s, &ms))
     408        return Set(y, mon, d, h, m, s, ms);
     409
    406410    if (6==sscanf(str, "%04u-%02u-%02u %02u:%02u:%02u", &y, &mon, &d, &h, &m, &s))
    407411        return Set(y, mon, d, h, m, s);
     412
     413    if (5==sscanf(str, "%04u-%02u-%02u %02u:%02u", &y, &mon, &d, &h, &m))
     414        return Set(y, mon, d, h, m);
     415
     416    if (4==sscanf(str, "%04u-%02u-%02u %02u", &y, &mon, &d, &h))
     417        return Set(y, mon, d, h);
    408418
    409419    if (3==sscanf(str, "%04u-%02u-%02u", &y, &mon, &d))
  • trunk/MagicSoft/Mars/mjobs/MDataSet.cc

    r8989 r9017  
    633633        }
    634634
    635         if (seq->SetupDatRuns(files, MSequence::kImages)<=0)
     635        if (seq->GetRuns(files, MSequence::kImages)<=0)
    636636            return kFALSE;
    637637    }
  • trunk/MagicSoft/Mars/mjobs/MJCalibrateSignal.cc

    r8999 r9017  
    260260    if (fSequence.IsValid())
    261261    {
    262         if (fSequence.SetupDatRuns(iter, 0, !fSequence.IsMonteCarlo())<=0)
     262        if (fSequence.GetRuns(iter, MSequence::kRawDat)<=0)
    263263            return kFALSE;
    264264    }
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r9005 r9017  
    14831483
    14841484    MDirIter iter;
    1485     if (fSequence.SetupCalRuns(iter, 0, !fSequence.IsMonteCarlo())<=0)
     1485    if (fSequence.GetRuns(iter, MSequence::kRawCal)<=0)
    14861486        return kFALSE;
    14871487
  • trunk/MagicSoft/Mars/mjobs/MJPedestal.cc

    r9005 r9017  
    949949    {
    950950        const Int_t n0 = IsUseData()
    951             ? fSequence.SetupDatRuns(iter, 0, !fSequence.IsMonteCarlo())
    952             : fSequence.SetupPedRuns(iter, 0, !fSequence.IsMonteCarlo());
     951            ? fSequence.GetRuns(iter, MSequence::kRawDat)
     952            : fSequence.GetRuns(iter, MSequence::kRawPed);
    953953
    954954        if (n0<=0)
  • trunk/MagicSoft/Mars/mjoptim/MJOptimize.cc

    r8957 r9017  
    250250        if (!seq->IsValid())
    251251            return kFALSE;
    252         if (seq->SetupDatRuns(files)<=0)
     252        if (seq->GetRuns(files, MSequence::kRootDat)<=0)
    253253            return kFALSE;
    254254    }
  • trunk/MagicSoft/Mars/mmain/MEventDisplay.cc

    r8999 r9017  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.64 2008-07-14 19:59:11 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MEventDisplay.cc,v 1.65 2008-07-20 14:21:39 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    227227    {
    228228        MDirIter iter;
    229         if (seq->SetupDatRuns(iter, MSequence::kCalibrated)<=0)
     229        if (seq->GetRuns(iter, MSequence::kCalibrated)<=0)
    230230            return;
    231231        read->AddFiles(iter);
  • trunk/MagicSoft/Mars/star.cc

    r8999 r9017  
    8484
    8585    MDirIter Next;
    86     seq.SetupDatRuns(Next, MSequence::kCalibrated, kInpathD);
     86    seq.GetRuns(Next, MSequence::kCalibrated, kInpathD);
    8787
    8888    gLog << all;
Note: See TracChangeset for help on using the changeset viewer.