AliRoot Core  d69033e (d69033e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliSegmentArray.h
Go to the documentation of this file.
1 #ifndef ALISEGMENTARRAY_H
2 #define ALISEGMENTARRAY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 /* $Id$ */
7 
12 
13 #include "TNamed.h"
14 #include "TError.h"
15 #include "TObjArray.h"
16 
17 class TTree;
18 class TBranch;
19 class TFile;
20 class TArrayI;
21 class AliSegmentID;
22 
23 class AliSegmentArray: public TNamed{
24 public:
26  AliSegmentArray(const char *classname, Int_t n); //
27  virtual ~AliSegmentArray();
28  Bool_t SetClass(const char *classname); //set class of stored object
29  const AliSegmentID * At(Int_t i); //return pointer to segment with index i
30  const AliSegmentID * operator[](Int_t i); //return pointer to segment with index i
31 
32  Bool_t AddSegment(AliSegmentID *segment); // add segment to array
33  AliSegmentID * AddSegment(Int_t index); //create objet and set index
34  Bool_t MakeArray(Int_t n); //make array of pointers to Segments
35  void ClearSegment(Int_t index); //remove segment from active
36  virtual AliSegmentID * NewSegment(); //dynamicaly create new segment
37  //input output functions
38  TTree * GetTree(){return fTree;} //return pointer to connected tree
39 
40  virtual void MakeTree(char *file=0); //Make tree with the name
41  virtual void MakeTree(TTree* tree); //Make tree with the name
42 
43  virtual Bool_t ConnectTree(const char * treeName); //connect tree from current directory
44  virtual Bool_t ConnectTree(TTree* tree); //connect tree from current directory
45 
46  virtual AliSegmentID * LoadSegment(Int_t index);//load segment with index to the memory
47  virtual AliSegmentID * LoadEntry(Int_t index); //load segment entry from position index in tree
48  virtual void StoreSegment(Int_t index);//write segmen persistent
49  Bool_t MakeDictionary(Int_t size);//create index table for tree
50  TClass * GetClass() {return fClass;}
51 
52 protected:
53  AliSegmentArray(const AliSegmentArray &segment); //copy constructor
54  AliSegmentArray &operator = (const AliSegmentArray & segment); //assignment operator
56  TArrayI * fTreeIndex;
57  Int_t fNSegment;
58  TTree * fTree;
59  Bool_t fTreeOwner;
60  TBranch * fBranch;
61 private:
62  TClass * fClass;
63 
65  ClassDef(AliSegmentArray,3)
67 
68 };
69 
70 
71 
73 {
75 
76  if ( (i<0) || (i>=fNSegment)) return 0;
77  return (AliSegmentID *)(fSegment->At(i));
78 
79 }
80 
81 inline const AliSegmentID* AliSegmentArray::At(Int_t i)
82 {
84 
85  if ( (i<0) || (i>=fNSegment)) return 0;
86  return (AliSegmentID *)(fSegment->At(i));
87 }
88 
89 #endif //ALISEGMENTARRAY_H
AliSegmentID object.
Definition: AliSegmentID.h:15
Bool_t AddSegment(AliSegmentID *segment)
void ClearSegment(Int_t index)
#define TObjArray
virtual AliSegmentID * LoadSegment(Int_t index)
AliSegmentArray & operator=(const AliSegmentArray &segment)
Bool_t MakeArray(Int_t n)
Int_t fNSegment
number of alocated segments
TObjArray * fSegment
! pointer to array of pointers to segment
TTree * tree
const AliSegmentID * At(Int_t i)
virtual void StoreSegment(Int_t index)
virtual void MakeTree(char *file=0)
virtual Bool_t ConnectTree(const char *treeName)
Bool_t fTreeOwner
flag determing the ownership of the fTree
virtual ~AliSegmentArray()
const AliSegmentID * operator[](Int_t i)
TClass * GetClass()
virtual AliSegmentID * LoadEntry(Int_t index)
Bool_t SetClass(const char *classname)
virtual AliSegmentID * NewSegment()
TBranch * fBranch
! total branch
TTree * fTree
! tree with segment objects
TArrayI * fTreeIndex
! pointers(index) table in tree
Bool_t MakeDictionary(Int_t size)
TClass * fClass
! class type of included objects