Ignore:
Timestamp:
01/21/02 20:52:12 (23 years ago)
Author:
rkb
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mbase
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r1080 r1203  
    3737#include "MParContainer.h"
    3838
     39#include <fstream.h>     // ofstream, AsciiWrite
     40
    3941#include <TClass.h>      // IsA
    4042#include <TROOT.h>       // TROOT::Identlevel
     43#include <TMethodCall.h> // TMethodCall, AsciiWrite
     44#include <TDataMember.h> // TDataMember, AsciiWrite
    4145#include <TVirtualPad.h> // gPad
    4246
     
    211215//
    212216//  If you want to use Ascii-Input/-Output (eg. MWriteAsciiFile) of a
    213 //  container, overload this function.
     217//  container, you may overload this function. If you don't overload it
     218//  the data member of a class are written to the file in the order of
     219//  appearance in the class header (be more specfic: root dictionary)
     220//  Only data members which are of integer (Bool_t, Int_t, ...) or
     221//  floating point (Float_t, Double_t, ...) type are written.
    214222//
    215223void MParContainer::AsciiWrite(ofstream &fout) const
    216224{
    217     *fLog << warn << "To use the the ascii output of " << GetName();
    218     *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl;
    219 }
     225    // *fLog << warn << "To use the the ascii output of " << GetName();
     226    // *fLog << " you have to overload " << ClassName() << "::AsciiWrite." << endl;
     227
     228    TDataMember *data = NULL;
     229
     230    TIter Next(IsA()->GetListOfDataMembers());
     231    while ((data=(TDataMember*)Next()))
     232    {
     233        if (!data->IsPersistent())
     234            continue;
     235
     236        /*const*/ TMethodCall *call = data->GetterMethod(); //FIXME: Root
     237        if (!call)
     238            continue;
     239
     240        switch (call->ReturnType())
     241        {
     242        case TMethodCall::kLong:
     243            Long_t l;
     244            call->Execute((void*)this, l); // FIXME: const, root
     245            fout << l << " ";
     246            continue;
     247
     248        case TMethodCall::kDouble:
     249            Double_t d;
     250            call->Execute((void*)this, d); // FIXME: const, root
     251            fout << d << " ";
     252            continue;
     253
     254        case TMethodCall::kOther:
     255            /* someone may want to enhance this? */
     256            continue;
     257        }
     258    }
     259}
  • trunk/MagicSoft/Mars/mbase/MReadMarsFile.cc

    r1172 r1203  
    114114    if (fRun->Process())
    115115    {
    116         TString name(GetFileName());
    117         name.Remove(0, name.Last('/')+1);
    118 
    119         *fLog << inf << "MReadMarsFile: Switching to '" << name << "' ";
     116        *fLog << inf << "MReadMarsFile: Switching to '" << GetFileName() << "' ";
    120117        *fLog << "(before event #" << GetEventNum()-1 << ")" << endl;
    121118
  • trunk/MagicSoft/Mars/mbase/MReadTree.cc

    r1192 r1203  
    407407    if (!fNumEntries)
    408408    {
    409         *fLog << warn << dbginf << "No entries found in file(s)." << endl;
     409        *fLog << warn << dbginf << "No entries found in file(s)" << endl;
    410410        return kFALSE;
    411411    }
     
    692692//  Return the name of the file we are actually reading from.
    693693//
    694 const char *MReadTree::GetFileName() const
    695 {
    696     return fChain->GetFile()->GetName();
     694TString MReadTree::GetFileName() const
     695{
     696    const TFile *file = fChain->GetFile();
     697
     698    if (!file)
     699        return TString("<unknown>");
     700
     701    TString name(file->GetName());
     702    name.Remove(0, name.Last('/')+1);
     703    return name;
    697704}
    698705
  • trunk/MagicSoft/Mars/mbase/MReadTree.h

    r1114 r1203  
    5858    UInt_t GetEntries() const  { return fNumEntries; }
    5959
    60     const char *GetFileName() const;
     60    TString GetFileName() const;
    6161
    6262    virtual void   AddNotify(TObject *obj);
Note: See TracChangeset for help on using the changeset viewer.