Processing SPD Mean Vertex only in PHYSICS runs.
[u/mrichter/AliRoot.git] / STEER / TTreeStream.h
CommitLineData
cd246117 1#ifndef TTREESTREAM_H
2#define TTREESTREAM_H
3///////////////////////////////////////////////////////////////////////////////
4// //
5// TTreeSRedirector //
6
7#include "TObject.h"
8#include "TString.h"
06c19f2e 9#include "TTree.h"
cd246117 10class TFile;
11class TObjArray;
12class TTree;
13class TDataType;
14
15class TTreeDataElement: public TNamed {
16 friend class TTreeStream;
17 public:
18 TTreeDataElement(Char_t type);
19 TTreeDataElement(TDataType* type);
20 TTreeDataElement(TClass* cl);
21 void SetPointer(void* pointer) {fPointer=pointer;}
22 Char_t GetType() const {return fType;}
23 protected:
90e48c0c 24
25 TTreeDataElement(const TTreeDataElement & tde);
26 TTreeDataElement & operator=(const TTreeDataElement & tde);
27
cd246117 28 Char_t fType; // type of data element
29 TDataType *fDType; //data type pointer
30 TClass *fClass; //data type pointer
31 void * fPointer; // pointer to element
fdf65bb5 32 ClassDef(TTreeDataElement,2)
cd246117 33};
34
35class TTreeStream: public TNamed {
36 friend class TTreeSRedirector;
37public:
38 TTreeStream(const char *treename);
39 ~TTreeStream();
40 void Close();
41 static void Test();
42 Int_t CheckIn(Char_t type, void *pointer);
43 //Int_t CheckIn(const char *type, void *pointer);
44 Int_t CheckIn(TObject *o);
45 void BuildTree();
46 void Fill();
06c19f2e 47 Double_t GetSize(){ return fTree->GetZipBytes();}
cd246117 48 TTreeStream& Endl();
49 //
50 TTreeStream &operator<<(Bool_t &b){CheckIn('B',&b);return *this;}
51 TTreeStream &operator<<(Char_t &c){CheckIn('B',&c);return *this;}
52 TTreeStream &operator<<(UChar_t &c){CheckIn('b',&c);return *this;}
53 TTreeStream &operator<<(Short_t &h){CheckIn('S',&h);return *this;}
54 TTreeStream &operator<<(UShort_t &h){CheckIn('s',&h);return *this;}
55 TTreeStream &operator<<(Int_t &i){CheckIn('I',&i);return *this;}
56 TTreeStream &operator<<(UInt_t &i){CheckIn('i',&i);return *this;}
57 TTreeStream &operator<<(Long_t &l){CheckIn('L',&l);return *this;}
58 TTreeStream &operator<<(ULong_t &l){CheckIn('l',&l);return *this;}
59 TTreeStream &operator<<(Long64_t &l){CheckIn('L',&l);return *this;}
60 TTreeStream &operator<<(ULong64_t &l){CheckIn('l',&l);return *this;}
61 TTreeStream &operator<<(Float_t &f){CheckIn('F',&f);return *this;}
62 TTreeStream &operator<<(Double_t &d){CheckIn('D',&d);return *this;}
63 TTreeStream &operator<<(TObject*o){CheckIn(o);return *this;}
4f57cad7 64 TTreeStream &operator<<(const Char_t *name);
cd246117 65 protected:
66 //
90e48c0c 67
68 TTreeStream(const TTreeStream & ts);
69 TTreeStream & operator=(const TTreeStream & ts);
70
cd246117 71 TObjArray *fElements; //array of elements
72 TObjArray *fBranches; //pointers to branches
73 TTree *fTree; //data storage
74 Int_t fCurrentIndex; //index of current element
75 Int_t fId; //identifier of layout
cd246117 76 TString fNextName; //name for next entry
77 Int_t fNextNameCounter; //next name counter
78 Int_t fStatus; //status of the layout
79 ClassDef(TTreeStream,1)
80};
81
82
83
84class TTreeSRedirector: public TObject {
85public:
86 TTreeSRedirector(const char *fname);
9996a03b 87 virtual ~TTreeSRedirector();
cd246117 88 void Close();
89 static void Test();
df1e0cdc 90 void StoreObject(TObject* object);
91 TFile * GetFile() {return fFile;};
cd246117 92 virtual TTreeStream &operator<<(Int_t id);
93 virtual TTreeStream &operator<<(const char *name);
94 private:
90e48c0c 95
96 TTreeSRedirector(const TTreeSRedirector & tsr);
97 TTreeSRedirector & operator=(const TTreeSRedirector & tsr);
98
cd246117 99 TFile* fFile; //file
100 TObjArray *fDataLayouts; //array of data layouts
101 ClassDef(TTreeSRedirector,1)
102};
103
104
105
106
107#endif