Ignore:
Timestamp:
07/29/05 23:13:12 (19 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/datacenter/macros
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/buildsequenceentries.C

    r7215 r7232  
    3131// to group the runs of one night into sequences, this marco:
    3232// - reads the runinformation of one night from the database
    33 // - sorts the runs by source
    34 // - groups the runs to sequences such that each run belongs
     33// - group the runs into sets of following runs with the same conditions
     34// - groups the runs in this sets to sequences such that each run belongs
    3535//   to the nearest (in time) calibration run
    36 //
    37 // apart from that the runs in one sequence must have the same
    38 // hv-settings, trigger tables, light conditions, DT tables,
    39 // trigger delay tables and testflag
     36// - check if the runs with the same runtype have the same calibration script
     37//   and the same trigger tables
    4038//
    4139/////////////////////////////////////////////////////////////////////////////
     
    6260int debug = 0;
    6361
    64 Bool_t DeleteSequence(MSQLServer &serv, Int_t sequ, Bool_t dummy)
     62Bool_t DeleteSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t sequ, Bool_t dummy)
    6563{
    6664    TString query1(Form("DELETE FROM Calibration WHERE fSequenceFirst=%d", sequ));
     
    7068    TString query5(Form("DELETE FROM Sequences WHERE fSequenceFirst=%d AND fManuallyChangedKEY=1", sequ));
    7169
    72     TString fname(Form("/mnt/stk01/sequences/%04d/sequence%08d.txt", sequ/10000, sequ));
    73     TString command(Form("rm -r /magic/data/callisto/%04d/%08d/", sequ/10000, sequ));
    74     TString command2(Form("rm -r /magic/data/star/%04d/%08d/", sequ/10000, sequ));
     70    TString fname(Form("%s/%04d/sequence%08d.txt", sequpath.Data(),sequ/10000, sequ));
     71    TString command(Form("rm -r %s/callisto/%04d/%08d/", datapath.Data(), sequ/10000, sequ));
     72    TString command2(Form("rm -r %s/star/%04d/%08d/", datapath.Data(), sequ/10000, sequ));
    7573
    7674    if (dummy)
     
    177175}
    178176
    179 Bool_t CheckSequence(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)
     177Bool_t CheckSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
    180178{
    181179    Bool_t rc=kFALSE;
     
    213211            {
    214212                cout << "deleting sequence " << sequences.At(i) << "... <" << i << ">" << endl;
    215                 if(!DeleteSequence(serv, sequences.At(i), dummy))
     213                if(!DeleteSequence(serv, datapath, sequpath, sequences.At(i), dummy))
    216214                   rc=kFALSE;
    217215            }
     
    267265        {
    268266            cout << "different sequsizes -> deleting sequence " << sequences.At(0) << endl;
    269             return DeleteSequence(serv, sequences.At(0), dummy);
     267            return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy);
    270268        }
    271269
     
    275273                continue;
    276274            cout << "different runs -> deleting sequence " << sequences.At(0) << endl;
    277             return DeleteSequence(serv, sequences.At(0), dummy);
     275            return DeleteSequence(serv, datapath, sequpath, sequences.At(0), dummy);
    278276        }
    279277
     
    405403}
    406404
    407 Bool_t NewSequence(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)
     405Bool_t NewSequence(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
    408406{
    409407    cout << "Found Sequence (" << from << ", " << to << ") ... checking runs..." << flush;
     
    429427    cout << "checking Sequence..." << endl;
    430428
    431     if (!CheckSequence(serv, from, to, dummy))
     429    if (!CheckSequence(serv, datapath, sequpath, from, to, dummy))
    432430    {
    433431        cout << " inserting sequence not necessary" << endl;
     
    446444}
    447445
    448 Bool_t Process(MSQLServer &serv, Int_t from, Int_t to, Bool_t dummy)
     446Bool_t Process(MSQLServer &serv, TString datapath, TString sequpath, Int_t from, Int_t to, Bool_t dummy)
    449447{
    450448
     
    589587            if (n!=-1)
    590588            {
    591                 if (!NewSequence(serv, start, last, dummy))
     589                if (!NewSequence(serv, datapath, sequpath, start, last, dummy))
    592590                {
    593591                    rc = kFALSE;
     
    605603    if (n!=-1 && start!=last)
    606604    {
    607         if (!NewSequence(serv, start, last, dummy))
     605        if (!NewSequence(serv, datapath, sequpath, start, last, dummy))
    608606            rc = kFALSE;
    609607    }
     
    617615
    618616
    619 int buildsequenceentries(TString day, Bool_t dummy=kTRUE)
     617int buildsequenceentries(TString day, TString datapath, TString sequpath, Bool_t dummy=kTRUE)
    620618{
    621619    TEnv env("sql.rc");
     
    704702        cout << endl << "datablock from " << runstart2 << " to " << runstop2 << endl;
    705703
    706         if (!Process(serv, runstart2, runstop2, dummy))
     704        if (!Process(serv, datapath, sequpath, runstart2, runstop2, dummy))
    707705            rc = kFALSE;
    708706
     
    712710
    713711
    714 int buildsequenceentries()
     712int buildsequenceentries(TString datapath, TString sequpath, Bool_t dummy=kTRUE)
    715713{
    716714    TEnv env("sql.rc");
     
    733731    {
    734732        cout << "date: " << (*row)[0] << endl;
    735         buildsequenceentries((*row)[0]);
     733        buildsequenceentries((*row)[0], dummy);
    736734    }
    737735
  • trunk/MagicSoft/Mars/datacenter/macros/createdataset.C

    r7167 r7232  
    2727// createdataset.C
    2828// ===============
     29//
     30// this script is not run automatically
     31// the purpose of this script is to make it easier for people to write
     32// datasetfiles
     33//
     34// be careful with the path in this macro, if you use it for test-reasons!
    2935//
    3036/////////////////////////////////////////////////////////////////////////////
  • trunk/MagicSoft/Mars/datacenter/macros/findcacofiles.C

    r7182 r7232  
    4444
    4545
    46 int findcacofiles(TString date)
     46int findcacofiles(TString date, TString logpath)
    4747{
    4848    TEnv env("sql.rc");
     
    7272    }
    7373
    74     Int_t idx = date.First('-');
    75     TString year = date(0, idx);
    76     cout << "year: " << year << endl;
    77 
    78     ofstream fout("/magic/datacenter/autologs/filesondisk/"+year+"/findcacofiles-"+date+".txt");
     74    TString filename(Form("%s/findcacofiles-%s.txt", logpath.Data(), date.Data()));
     75    ofstream fout(filename, ios::app);
    7976    if (!fout)
    8077    {
    81         cout << "ERROR - Cannot open file." << endl;
    82         return kFALSE;
     78        cout << "ERROR - Cannot open file " << filename << endl;
     79        return 0;
    8380    }
    84     TString runnumber=0;
     81
    8582    TSQLRow *row=0;
    8683    while ((row = res->Next()))
  • trunk/MagicSoft/Mars/datacenter/macros/getdolist.C

    r7182 r7232  
    4545
    4646
    47 int getdolist(TString table, TString column, TString date)
     47int getdolist(TString table, TString column, TString date, TString listpath)
    4848{
    4949    TEnv env("sql.rc");
     
    118118        return 0;
    119119
    120     ofstream fout("/magic/datacenter/lists/ToDo-"+table+"-"+column+".txt", ios::app);
    121 //    ofstream fout("/data/MAGIC/datacenter/"+table+"-"+column+".txt", ios::app);
     120    TString filename(Form("%s/ToDo%s-%s.txt", listpath.Data(), table.Data(), column.Data()));
     121    ofstream fout(filename, ios::app);
     122    if (!fout)
     123    {
     124        cout << "ERROR - Cannot open file " << filename << endl;
     125        return 0;
     126    }
    122127
    123128    TSQLRow *row=0;
  • trunk/MagicSoft/Mars/datacenter/macros/resetcolumn.C

    r7112 r7232  
    3333// for this step in the DB has to be reset. This can be done with this macro.
    3434//
    35 // As arguments you have to give the column, the table and the from which
     35// As arguments you have to give the column, the table and from which
    3636// to which Date/Sequence/Run you want to reset the value.
    3737//
  • trunk/MagicSoft/Mars/datacenter/macros/writesequencefile.C

    r7168 r7232  
    233233}
    234234
    235 Bool_t GetSequence(MSQLServer &serv, TSQLRow &data)
     235Bool_t GetSequence(MSQLServer &serv, TSQLRow &data, TString sequpath)
    236236{
    237237    UShort_t y;
     
    257257        return kFALSE;
    258258
    259     TString fname(Form("/mnt/stk01/sequences/%04d/sequence%08d.txt", atoi(data[0])/10000, atoi(data[0])));
     259    TString fname(Form("%s/sequences/%04d/sequence%08d.txt", sequpath.Data(), atoi(data[0])/10000, atoi(data[0])));
    260260    cout << "Creating " << fname << "..." << flush;
    261261
     
    308308
    309309// This tool will work from Period017 (2004_05_17) on...
    310 int writesequencefile(Int_t sequno)
     310int writesequencefile(Int_t sequno, TString sequpath)
    311311{
    312312    TEnv env("sql.rc");
     
    333333    TSQLRow *row = 0;
    334334    while ((row = res->Next()))
    335         if (!GetSequence(serv, *row))
     335        if (!GetSequence(serv, *row, sequpath))
    336336            return 0;
    337337
Note: See TracChangeset for help on using the changeset viewer.