Changeset 1472 for trunk/MagicSoft/Mars/mfileio
- Timestamp:
- 08/01/02 15:22:34 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mfileio
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mfileio/FileIOLinkDef.h
r1382 r1472 5 5 #pragma link off all functions; 6 6 7 #pragma link C++ class MChain+; 7 8 #pragma link C++ class MReadTree+; 8 9 #pragma link C++ class MReadMarsFile+; -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.cc
r1381 r1472 50 50 // -------------------------------------------------------------------------- 51 51 // 52 // Default constructor. Don't use it. 53 // 54 MReadMarsFile::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 // 52 62 // Default constructor. It creates a MReadTree object to read the 53 63 // RunHeaders and disables Auto Scheme for this tree. -
trunk/MagicSoft/Mars/mfileio/MReadMarsFile.h
r1381 r1472 20 20 21 21 public: 22 MReadMarsFile(); 22 23 MReadMarsFile(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL); 23 24 ~MReadMarsFile(); … … 25 26 Int_t AddFile(const char *fname); 26 27 27 ClassDef(MReadMarsFile, 0) // Reads a tree from file(s)28 ClassDef(MReadMarsFile, 1) // Reads a tree from file(s) 28 29 }; 29 30 -
trunk/MagicSoft/Mars/mfileio/MReadTree.cc
r1471 r1472 54 54 55 55 #include <TFile.h> // TFile::GetName 56 #include <TChain.h>57 56 #include <TSystem.h> // gSystem->ExpandPath 58 57 #include <TGProgressBar.h> … … 63 62 #include "MLogManip.h" 64 63 65 #include "M Time.h"64 #include "MChain.h" 66 65 #include "MFilter.h" 67 66 #include "MParList.h" … … 70 69 ClassImp(MReadTree); 71 70 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 // 75 MReadTree::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 115 90 // the Tree you want to read and adds the given file (if you gave one). 116 91 // More files can be added using MReadTree::AddFile. … … 806 781 TString name = ToLower(fName); 807 782 808 out << " " << ClassName() << " " << name << "( ";809 out << fChain->GetName() << " , \"" << fName << "\", \"" << fTitle << "\");" << endl;783 out << " " << ClassName() << " " << name << "(\""; 784 out << fChain->GetName() << "\", \"" << fName << "\", \"" << fTitle << "\");" << endl; 810 785 811 786 TIter Next(fChain->GetListOfFiles()); -
trunk/MagicSoft/Mars/mfileio/MReadTree.h
r1471 r1472 40 40 41 41 public: 42 MReadTree(); 42 43 MReadTree(const char *treename, const char *filename=NULL, const char *name=NULL, const char *title=NULL); 43 44 ~MReadTree(); … … 73 74 virtual void SavePrimitive(ofstream &out, Option_t *o=""); 74 75 75 ClassDef(MReadTree, 0) // Reads a tree from file(s)76 ClassDef(MReadTree, 1) // Reads a tree from file(s) 76 77 }; 77 78 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1471 r1472 51 51 // -------------------------------------------------------------------------- 52 52 // 53 // Default constructor. It is there to support some root stuff. 54 // Don't use it. 55 // 56 MWriteRootFile::MWriteRootFile() : fOut(NULL) 57 { 58 fName = "MWriteRootFile"; 59 fTitle = "Task which writes a root-output file"; 60 61 fBranches.SetOwner(); 62 } 63 64 // -------------------------------------------------------------------------- 65 // 53 66 // Specify the name of the root file. You can also give an option ("UPDATE" 54 67 // and "RECREATE" would make sense only) as well as the file title and … … 391 404 out << fOut->GetTitle() << "\", "; 392 405 out << fOut->GetCompressionLevel() << ", \""; 393 out << fName << "\", " << fTitle << "\");" << endl;;406 out << fName << "\", \"" << fTitle << "\");" << endl;; 394 407 395 408 MRootFileBranch *entry; -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.h
r1471 r1472 16 16 { 17 17 private: 18 TTree *fTree; 19 TBranch *fBranch; 18 TTree *fTree; //! 19 TBranch *fBranch; //! 20 20 21 MParContainer *fContainer; 21 MParContainer *fContainer; //! 22 22 TString fContName; 23 23 … … 29 29 30 30 public: 31 MRootFileBranch() : fTree(NULL), fBranch(NULL), fContainer(NULL) 32 { 33 Init(NULL, NULL); 34 fContName = ""; 35 } 36 31 37 MRootFileBranch(const char *cname, const char *tname=NULL, const char *ttitle=NULL) 32 38 : fTree(NULL), fBranch(NULL), fContainer(NULL) … … 52 58 void SetTree(TTree *tree) { fTree = tree; } 53 59 54 ClassDef(MRootFileBranch, 0) // Storage container for MWriteRootFile to store TBranch informations60 ClassDef(MRootFileBranch, 1) // Storage container for MWriteRootFile to store TBranch informations 55 61 }; 56 62 … … 61 67 62 68 TObjArray fBranches; 63 TObjArray fTrees; 69 TObjArray fTrees; //! 64 70 65 71 void CheckAndWrite() const; … … 69 75 70 76 public: 77 MWriteRootFile(); 71 78 MWriteRootFile(const char *fname, 72 79 const Option_t *opt="RECREATE", … … 87 94 void SavePrimitive(ofstream &out, Option_t *o=""); 88 95 89 ClassDef(MWriteRootFile, 0) // Class to write one container to a root file96 ClassDef(MWriteRootFile, 1) // Class to write one container to a root file 90 97 }; 91 98 -
trunk/MagicSoft/Mars/mfileio/Makefile
r1382 r1472 31 31 .SUFFIXES: .c .cc .cxx .h .hxx .o 32 32 33 SRCFILES = MReadTree.cc \ 33 SRCFILES = MChain.cc \ 34 MReadTree.cc \ 34 35 MReadMarsFile.cc \ 35 36 MWriteFile.cc \
Note:
See TracChangeset
for help on using the changeset viewer.