Ignore:
Timestamp:
08/01/02 15:22:34 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mfileio
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h

    r1382 r1472  
    55#pragma link off all functions;
    66
     7#pragma link C++ class MChain+;
    78#pragma link C++ class MReadTree+;
    89#pragma link C++ class MReadMarsFile+;
  • trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc

    r1381 r1472  
    5050// --------------------------------------------------------------------------
    5151//
     52//  Default constructor. Don't use it.
     53//
     54MReadMarsFile::MReadMarsFile() : fRun(NULL)
     55{
     56    fName  = "MReadMarsFile";
     57    fTitle = "Task to loop over all events in a tree of a Mars file.";
     58}
     59
     60// --------------------------------------------------------------------------
     61//
    5262//  Default constructor. It creates a MReadTree object to read the
    5363//  RunHeaders and disables Auto Scheme for this tree.
  • trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h

    r1381 r1472  
    2020 
    2121public:
     22    MReadMarsFile();
    2223    MReadMarsFile(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
    2324    ~MReadMarsFile();
     
    2526    Int_t AddFile(const char *fname);
    2627
    27     ClassDef(MReadMarsFile, 0)  // Reads a tree from file(s)
     28    ClassDef(MReadMarsFile, 1)  // Reads a tree from file(s)
    2829};
    2930
  • trunk/MagicSoft/Mars/mfileio/MReadTree.cc

    r1471 r1472  
    5454
    5555#include <TFile.h>           // TFile::GetName
    56 #include <TChain.h>
    5756#include <TSystem.h>         // gSystem->ExpandPath
    5857#include <TGProgressBar.h>
     
    6362#include "MLogManip.h"
    6463
    65 #include "MTime.h"
     64#include "MChain.h"
    6665#include "MFilter.h"
    6766#include "MParList.h"
     
    7069ClassImp(MReadTree);
    7170
    72 class MChain : public TChain
    73 {
    74 private:
    75     Bool_t fNotified;
    76 
    77 public:
    78     MChain() : TChain(), fNotified(kFALSE) {}
    79     MChain(const char *name, const char *title="") : TChain(name, title), fNotified(kFALSE) {}
    80 
    81     void ResetTree() { fTree = 0; }
    82 
    83     virtual Bool_t Notify() { fNotified = kTRUE; return kTRUE; }
    84     virtual void   SetNotify(TObject *obj) { fNotify = obj; fNotified = kFALSE; }
    85 
    86     Int_t LoadTree(Int_t entry)
    87     {
    88         //
    89         // This is the code from TChain::LoadTree but skips the
    90         // notification in LoadTree. If LoadTree raises the notification
    91         // a flag is set and the notification is done by hand. This
    92         // is done to be able to catch the return value from Notify. If
    93         // it has not been successfull -15 is returned.
    94         // This is to support return values from Notify()/Reinit()
    95         //
    96         TObject *notify = GetNotify();
    97 
    98         SetNotify(this);
    99 
    100         Int_t rc = TChain::LoadTree(entry);
    101 
    102         if (rc >= 0 && fNotified && notify)
    103             if (!notify->Notify())
    104                 rc = -15;
    105 
    106         SetNotify(notify);
    107 
    108         return rc;
    109     }
    110 };
    111 
    112 // --------------------------------------------------------------------------
    113 //
    114 //  Default constructor. It creates an TChain instance which represents the
     71// --------------------------------------------------------------------------
     72//
     73//  Default constructor. Don't use it.
     74//
     75MReadTree::MReadTree()
     76    : fNumEntry(0), fBranchChoosing(kFALSE), fAutoEnable(kTRUE), fProgress(NULL)
     77{
     78    fName  = "MReadTree";
     79    fTitle = "Task to loop over all events in one single tree";
     80
     81    fVetoList = NULL;
     82    fNotify = NULL;
     83
     84    fChain = NULL;
     85}
     86
     87// --------------------------------------------------------------------------
     88//
     89//  Constructor. It creates an TChain instance which represents the
    11590//  the Tree you want to read and adds the given file (if you gave one).
    11691//  More files can be added using MReadTree::AddFile.
     
    806781    TString name = ToLower(fName);
    807782
    808     out << "   " << ClassName() << " " << name << "(";
    809     out << fChain->GetName() << ", \"" << fName << "\", \"" << fTitle << "\");" << endl;
     783    out << "   " << ClassName() << " " << name << "(\"";
     784    out << fChain->GetName() << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl;
    810785
    811786    TIter Next(fChain->GetListOfFiles());
  • trunk/MagicSoft/Mars/mfileio/MReadTree.h

    r1471 r1472  
    4040
    4141public:
     42    MReadTree();
    4243    MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL);
    4344    ~MReadTree();
     
    7374    virtual void   SavePrimitive(ofstream &out, Option_t *o="");
    7475
    75     ClassDef(MReadTree, 0)      // Reads a tree from file(s)
     76    ClassDef(MReadTree, 1)      // Reads a tree from file(s)
    7677};
    7778
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r1471 r1472  
    5151// --------------------------------------------------------------------------
    5252//
     53// Default constructor. It is there to support some root stuff.
     54// Don't use it.
     55//
     56MWriteRootFile::MWriteRootFile() : fOut(NULL)
     57{
     58    fName  = "MWriteRootFile";
     59    fTitle = "Task which writes a root-output file";
     60
     61    fBranches.SetOwner();
     62}
     63
     64// --------------------------------------------------------------------------
     65//
    5366// Specify the name of the root file. You can also give an option ("UPDATE"
    5467// and "RECREATE" would make sense only) as well as the file title and
     
    391404    out << fOut->GetTitle() << "\", ";
    392405    out << fOut->GetCompressionLevel() << ", \"";
    393     out << fName << "\", " << fTitle << "\");" << endl;;
     406    out << fName << "\", \"" << fTitle << "\");" << endl;;
    394407
    395408    MRootFileBranch *entry;
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h

    r1471 r1472  
    1616{
    1717private:
    18     TTree         *fTree;
    19     TBranch       *fBranch;
     18    TTree         *fTree;       //!
     19    TBranch       *fBranch;     //!
    2020
    21     MParContainer *fContainer;
     21    MParContainer *fContainer;  //!
    2222    TString        fContName;
    2323
     
    2929
    3030public:
     31    MRootFileBranch() : fTree(NULL), fBranch(NULL), fContainer(NULL)
     32    {
     33        Init(NULL, NULL);
     34        fContName = "";
     35    }
     36
    3137    MRootFileBranch(const char *cname, const char *tname=NULL, const char *ttitle=NULL)
    3238        : fTree(NULL), fBranch(NULL), fContainer(NULL)
     
    5258    void SetTree(TTree *tree)              { fTree = tree; }
    5359
    54     ClassDef(MRootFileBranch, 0) // Storage container for MWriteRootFile to store TBranch informations
     60    ClassDef(MRootFileBranch, 1) // Storage container for MWriteRootFile to store TBranch informations
    5561};
    5662
     
    6167
    6268    TObjArray fBranches;
    63     TObjArray fTrees;
     69    TObjArray fTrees;     //!
    6470
    6571    void        CheckAndWrite() const;
     
    6975
    7076public:
     77    MWriteRootFile();
    7178    MWriteRootFile(const char *fname,
    7279                   const Option_t *opt="RECREATE",
     
    8794    void SavePrimitive(ofstream &out, Option_t *o="");
    8895
    89     ClassDef(MWriteRootFile, 0) // Class to write one container to a root file
     96    ClassDef(MWriteRootFile, 1) // Class to write one container to a root file
    9097};
    9198
  • trunk/MagicSoft/Mars/mfileio/Makefile

    r1382 r1472  
    3131.SUFFIXES: .c .cc .cxx .h .hxx .o
    3232
    33 SRCFILES = MReadTree.cc \
     33SRCFILES = MChain.cc \
     34           MReadTree.cc \
    3435           MReadMarsFile.cc \
    3536           MWriteFile.cc \
Note: See TracChangeset for help on using the changeset viewer.