// -*- mode: c++ -*- // // $Id: BrOutputTreeModule.h,v 1.4 2001/12/14 15:37:51 cholm Exp $ // $Author: cholm $ // $Date: 2001/12/14 15:37:51 $ // $Copyright: (C) 2001 BRAHMS Collaboration // #ifndef BRAT_BrOutputTreeModule #define BRAT_BrOutputTreeModule #ifndef BRAT_BrIOModule #include "BrIOModule.h" #endif #ifndef BRAT_BrEvent #include "BrEvent.h" #endif #ifndef ROOT_TFile #include "TFile.h" #endif #ifndef ROOT_TTree #include "TTree.h" #endif class BrOutputTreeElement : public TObject { private: TString fClassName; // Name of class TString fName; // Name of instance TString fBranchName; // Name of instance Bool_t fIsTable; // True if instance is data table Int_t fBufSize; // Branch buffer size Int_t fSplitLevel; // Branch split level TObject* fStore; // TClonesArray if input is data table, else instance TBranch* fBranch; // Branch for (and not owned by) this element public: BrOutputTreeElement(const Char_t* className, const Char_t* name, const Char_t* branchName, Bool_t isTable, Int_t arrSize, Int_t bufSize, Int_t splitLevel); virtual ~BrOutputTreeElement(); virtual void Branch(TTree* t); virtual void Event(BrEventNode* ev); virtual void Print(); ClassDef(BrOutputTreeElement,0) // BRAHMS output tree module utility class. }; class BrOutputTreeModule : public BrIOModule { private: TFile* fFile; // ROOT file TTree* fTree; // Tree Int_t fAutoSave; // Tree branch auto save TObjArray* fElements; // Array of TTrackTreeElements protected: virtual void Setup(); public: BrOutputTreeModule(); BrOutputTreeModule(const Char_t* name, const Char_t* title); virtual ~BrOutputTreeModule (); virtual void AddElement(const Char_t* className, const Char_t* name, const Char_t* branchName, Bool_t isTable = kFALSE, Int_t arrSize = 100, Int_t bufSize = 32000, Int_t splitLevel = 99); virtual void AddElement(const Char_t* className, const Char_t* name, Bool_t isTable = kFALSE, Int_t arrSize = 100, Int_t bufSize = 32000, Int_t splitLevel = 99); virtual Bool_t Close(); virtual void Event(BrEvent* event); virtual Int_t GetAutoSave() const { return fAutoSave; } virtual Bool_t Open(const Char_t*, const Option_t* option=0); virtual void Print(Option_t* option="B") const; // *MENU* virtual void SetAutoSave(Int_t autos = 10000000); ClassDef(BrOutputTreeModule,0) // BRAHMS module for writing an output tree }; #endif //____________________________________________________________________ // // $Log: BrOutputTreeModule.h,v $ // Revision 1.4 2001/12/14 15:37:51 cholm // Modified the classes to allow the concept of file set, introduced via // BrIOModule. Also use new Info method rather than explicit // if (Verbose() > 4) // cout << "Opening file ladida" << endl; // // Revision 1.3 2001/11/21 12:57:08 pchristi // Added the oppertunity to set the branchname instead of having classname as branchname. // // Revision 1.2 2001/10/20 20:37:01 jens // Small fixes in the description // // Revision 1.1 2001/10/20 03:44:45 jens // New class BrOutputTreeModule // //