Changeset 3336 for trunk


Ignore:
Timestamp:
02/26/04 17:22:46 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r3335 r3336  
    99   * macros/dohtml.C
    1010     - included the path msignals/
     11
    1112
    1213
     
    2526
    2627
     28
    2729 2004/02/26: Thomas Bretz
    2830
     
    8486   * mfbase/Makefile, mfbase/FBaseLinkDef.h, mfbase/FBaseIncl.h:
    8587     - added
     88
     89   * merpp.cc:
     90     - implemented control of gDebug (root debugging)
     91
     92   * mfileio/MWriteAsciiFile.[h,cc], mfileio/MWriteFile.[h,cc],
     93     mfileio/MWriteRootFile.[h,cc]:
     94     - implemented CheckAndWrite return value
     95
     96   * mfileio/MWriteRootFile.cc:
     97     - fixed updating already existing branches (eg concatenating report
     98       files)
    8699
    87100
  • trunk/MagicSoft/Mars/macros/dohtml.C

    r3335 r3336  
    4242    TString sourcedir;
    4343    sourcedir += "manalysis:";
     44    sourcedir += "mastro:";
    4445    sourcedir += "mbase:";
    4546    sourcedir += "mcamera:";
    4647    sourcedir += "mcalib:";
    4748    sourcedir += "mdata:";
     49    sourcedir += "mfbase:";
    4850    sourcedir += "mfileio:";
    4951    sourcedir += "mfilter:";
     
    99101    html.Convert("pedphotcalc.C",   "MARS - Example to use MPedPhotCalc");
    100102}
    101 
    102 
    103 
  • trunk/MagicSoft/Mars/macros/rootlogon.C

    r3308 r3336  
    9999    gInterpreter->AddIncludePath(dir+"macros");
    100100    gInterpreter->AddIncludePath(dir+"manalysis");
    101     gInterpreter->AddIncludePath(dir+"msignal");
     101    gInterpreter->AddIncludePath(dir+"mastro");
    102102    gInterpreter->AddIncludePath(dir+"mbase");
    103103    gInterpreter->AddIncludePath(dir+"mcamera");
    104104    gInterpreter->AddIncludePath(dir+"mcalib");
    105105    gInterpreter->AddIncludePath(dir+"mdata");
     106    gInterpreter->AddIncludePath(dir+"mfbase");
    106107    gInterpreter->AddIncludePath(dir+"mfileio");
    107108    gInterpreter->AddIncludePath(dir+"mfilter");
     
    120121    gInterpreter->AddIncludePath(dir+"mreflector");
    121122    gInterpreter->AddIncludePath(dir+"mreport");
     123    gInterpreter->AddIncludePath(dir+"msignal");
    122124    gInterpreter->AddIncludePath(dir+"mtools");
    123125
  • trunk/MagicSoft/Mars/merpp.cc

    r3328 r3336  
    6767    gLog << "     inputfile.txt:  Magic DC currents file." << endl;
    6868    gLog << "     ouputfile.root: Merpped root file." << endl;
    69     gLog << "     -c#:                             Compression level #=1..9 [default=2]" << endl;
    70     gLog << "     -v#:                             Verbosity level # [default=2]" << endl;
    71     gLog << "     -u, --update:                    Update file" << endl;
    72     gLog << "     -a, --no-colors:                 Do not use Ansii color codes" << endl;
     69    gLog << "     -c#                              Compression level #=1..9 [default=2]" << endl;
     70    gLog << "     -v#                              Verbosity level # [default=2]" << endl;
     71    gLog << "     -u, --update                     Update file" << endl;
     72    gLog << "     -a, --no-colors                  Do not use Ansii color codes" << endl;
    7373    gLog << "     --sql=mysql://user:password@url  Insert run into database <raw data only>" << endl;
    74     gLog << "     --start=yyyy-mm-dd/hh:mm:ss.mmm: Start event time for merpping report files" << endl;
    75     gLog << "     --stop=yyyy-mm-dd/hh:mm:ss.mmm:  Stop  event time for merpping report files" << endl;
    76     gLog << "     --run=#:                         Only data corresponding to this run number" << endl;
    77     gLog << "     -?, -h, --help:                  This help" << endl << endl;
     74    gLog << "     --start=yyyy-mm-dd/hh:mm:ss.mmm  Start event time for merpping report files" << endl;
     75    gLog << "     --stop=yyyy-mm-dd/hh:mm:ss.mmm   Stop  event time for merpping report files" << endl;
     76    gLog << "     --run=#                          Only data corresponding to this run number" << endl;
     77    gLog << "     --debug[=n]                      Enable root debugging (Default: gDebug=1)" << endl;
     78    gLog << "     -?, -h, --help                   This help" << endl << endl;
    7879    gLog << "   REMARK: At the moment you can process a .raw _or_ a .rep file, only!" << endl << endl;
    7980}
     
    114115
    115116    gLog.SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2);
     117
     118    gDebug = arg.HasOption("--debug=") ? arg.GetIntAndRemove("--debug=") : 0;
     119    if (gDebug==0 && arg.HasOnlyAndRemove("--debug"))
     120        gDebug=1;
    116121
    117122    MTime kTimeStart(AnalyseTime(arg.GetStringAndRemove("--start=")));
  • trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.cc

    r3238 r3336  
    188188// a warning message is print.
    189189//
    190 void MWriteAsciiFile::CheckAndWrite() const
     190Bool_t MWriteAsciiFile::CheckAndWrite() const
    191191{
    192192    Bool_t written = kFALSE;
     
    219219    }
    220220
    221     if (!written)
    222         return;
    223 
    224     *fOut << endl;
    225 
    226     if (num!=0)
    227         *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl;
     221    if (written)
     222    {
     223        *fOut << endl;
     224
     225        if (num!=0)
     226            *fLog << warn << "Warning - given number of objects doesn't fit number of written objects." << endl;
     227    }
     228    return kTRUE;
    228229}
    229230
  • trunk/MagicSoft/Mars/mfileio/MWriteAsciiFile.h

    r1664 r3336  
    2121    TObjArray fAutoDel; //! List of object to be deleted in the destructor
    2222
    23     virtual void  CheckAndWrite() const;
     23    virtual Bool_t CheckAndWrite() const;
    2424    virtual Bool_t IsFileOpen() const;
    2525    virtual Bool_t GetContainer(MParList *pList);
  • trunk/MagicSoft/Mars/mfileio/MWriteFile.cc

    r2958 r3336  
    7878    // write the container if it is already in changed state
    7979    //
    80     CheckAndWrite();
    81 
    82     return kTRUE;
     80    return CheckAndWrite();
    8381}
    8482
     
    9088Bool_t MWriteFile::ReInit(MParList *pList)
    9189{
    92     CheckAndWrite();
    93     return kTRUE;
     90    return CheckAndWrite();
    9491}
    9592
     
    10198Int_t MWriteFile::Process()
    10299{
    103     CheckAndWrite();
    104     return kTRUE;
     100    return CheckAndWrite();
    105101}
    106102
     
    115111    // check if the container changed state is set
    116112    //
    117     CheckAndWrite();
    118     return kTRUE;
     113    return CheckAndWrite();
    119114}
  • trunk/MagicSoft/Mars/mfileio/MWriteFile.h

    r2959 r3336  
    1515
    1616    virtual Bool_t      IsFileOpen() const = 0;
    17     virtual void        CheckAndWrite() const = 0;
     17    virtual Bool_t      CheckAndWrite() const = 0;
    1818    virtual Bool_t      GetContainer(MParList *pList) = 0;
    1919    virtual const char *GetFileName() const = 0;
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r3199 r3336  
    338338        entry->SetTree(tree);
    339339
     340        TString branchname(cname);
     341        branchname.Append(".");
     342
    340343        //
    341344        // Try to get the branch from the file.
    342345        // If the branch already exists the user specified one branch twice.
    343346        //
    344         TBranch *branch = tree->GetBranch(cname);
     347        TBranch *branch = tree->GetBranch(branchname);
    345348        if (branch)
    346349        {
    347             *fLog << err << "Branch '" << cname << "' already existing." << endl;
    348             return kFALSE;
    349         }
    350 
    351         //
    352         // Create a new branch in the actual tree. The branch has the name
    353         // container name. The type of the container is given by the
    354         // ClassName entry in the container. The Address is the address of a
    355         // pointer to the container (gotten from the branch entry). As
    356         // Basket size we specify a (more or less) common default value.
    357         // The containers should be written in Splitlevel=1
    358         //
    359         *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName() << "... " << flush;
    360 
    361         TString branchname(cname);
    362         branchname.Append(".");
    363         branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());
    364 
    365         //
    366         // If the branch couldn't be created we have a problem.
    367         //
    368         if (!branch)
    369         {
    370             *fLog << endl;
    371             *fLog << err << "Unable to create branch '" << cname << "'." << endl;
    372             return kFALSE;
    373         }
    374 
    375         *fLog << "done." << endl;
     350            *fLog << inf << "Branch '" << cname << "' already existing... updating." << endl;
     351            branch->SetAddress(entry->GetAddress());
     352        }
     353        else
     354        {
     355            //
     356            // Create a new branch in the actual tree. The branch has the name
     357            // container name. The type of the container is given by the
     358            // ClassName entry in the container. The Address is the address of a
     359            // pointer to the container (gotten from the branch entry). As
     360            // Basket size we specify a (more or less) common default value.
     361            // The containers should be written in Splitlevel=1
     362            //
     363            *fLog << inf << "Creating Branch " << cname << " of " << cont->ClassName();
     364            *fLog << " in tree " << tree->GetName() << "... " << flush;
     365
     366            branch = tree->Branch(branchname, cont->ClassName(), entry->GetAddress());
     367            //
     368            // If the branch couldn't be created we have a problem.
     369            //
     370            if (!branch)
     371            {
     372                *fLog << endl;
     373                *fLog << err << "Unable to create branch '" << cname << "'." << endl;
     374                return kFALSE;
     375            }
     376
     377            *fLog << "done." << endl;
     378        }
    376379
    377380        //
     
    398401// has the write flag, all containers in this tree are filled!
    399402//
    400 void MWriteRootFile::CheckAndWrite() const
     403Bool_t MWriteRootFile::CheckAndWrite() const
    401404{
    402405    TObject *obj;
     
    423426            b->GetTree()->SetBit(kFillTree);
    424427        else
    425             b->GetBranch()->Fill();
     428        {
     429            if (!b->GetBranch()->Fill())
     430            {
     431                *fLog << err << "ERROR - Zero bytes written to branch '" << b->GetBranch()->GetName() << "'... abort." << endl;
     432                return kFALSE;
     433            }
     434        }
    426435    }
    427436
     
    445454        // of written/filled entries.
    446455        //
    447         t->Fill();
    448456        t->ResetBit(kFillTree);
    449     }
     457        if (!t->Fill())
     458        {
     459            *fLog << err << "ERROR - Zero bytes written to tree '" << t->GetName() << "'... abort." << endl;
     460            return kFALSE;
     461        }
     462    }
     463    return kTRUE;
    450464}
    451465
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h

    r2604 r3336  
    7575    //UInt_t fNumEvents; //! Number of events written in a run
    7676
    77     void        CheckAndWrite() const;
     77    Bool_t      CheckAndWrite() const;
    7878    Bool_t      IsFileOpen() const;
    7979    Bool_t      GetContainer(MParList *pList);
Note: See TracChangeset for help on using the changeset viewer.