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