]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDsegmentArrayBase.h
cd6ceae1ebb152869a8f40b6f694960bdd70c729
[u/mrichter/AliRoot.git] / TRD / AliTRDsegmentArrayBase.h
1 #ifndef ALISEGARRAYBASE_H
2 #define ALISEGARRAYBASE_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id: AliTRDsegmentArrayBase.h,v */
7
8 ////////////////////////////////////////////////
9 //  Manager class generaol Alice segment 
10 //  segment is for example one pad row in TPC //
11 ////////////////////////////////////////////////
12
13 #include "TNamed.h"
14 #include "TError.h"
15 #include "TObjArray.h"
16
17 //#include "AliTRDsegmentID.h"
18
19 class TTree;
20 class TBranch;
21 class AliTRDarrayI;
22 class AliTRDsegmentID;
23 class TObjArray;
24  
25 class AliTRDsegmentArrayBase: public TNamed{
26 public:
27   AliTRDsegmentArrayBase();
28   AliTRDsegmentArrayBase(Text_t *classname, Int_t n);  //
29   Bool_t  SetClass(Text_t *classname);  //set class of stored object
30   ~AliTRDsegmentArrayBase();
31   inline const AliTRDsegmentID * At(Int_t i); //return pointer to segment with index i 
32   inline const AliTRDsegmentID * operator[](Int_t i); //return pointer to segment with index i
33
34   Bool_t AddSegment(AliTRDsegmentID *segment); // add segment to array
35   AliTRDsegmentID * AddSegment(Int_t index);   //create objet and set index
36   Bool_t   MakeArray(Int_t n);       //make array of pointers to Segments
37   void ClearSegment(Int_t index); //remove segment from active   
38   virtual AliTRDsegmentID * NewSegment(); //dynamicaly create new segment 
39   //input output functions
40   TTree * GetTree(){return fTree;}      //return pointer to connected tree
41   
42   virtual void MakeTree();              //Make tree with the name
43   virtual Bool_t ConnectTree(const char * treeName); //connect tree from current directory 
44   virtual AliTRDsegmentID * LoadSegment(Int_t index);//load segment with index to the memory
45   virtual AliTRDsegmentID * LoadEntry(Int_t index); //load segment entry from position index in tree
46   virtual void StoreSegment(Int_t index);//write segmen persistent  
47   Bool_t  MakeDictionary(Int_t size);//create index table for tree
48   TClass * GetClass() {return fClass;}
49 public:
50   TObjArray  * fSegment;  //!pointer to array of pointers to segment
51   AliTRDarrayI    * fTreeIndex; //!pointers(index) table in tree
52   Int_t      fNSegment;   
53   TTree    * fTree;   //!tree with segment objects
54   TBranch  * fBranch; //!total branch 
55 private: 
56   TClass  *   fClass;    //!class type of included objects 
57   ClassDef(AliTRDsegmentArrayBase,1) 
58 };
59
60
61
62 const AliTRDsegmentID*  AliTRDsegmentArrayBase::operator[](Int_t i)
63 {
64   //
65   //return segment with given index
66   //
67   if ( (i<0) || (i>=fNSegment)) return 0; 
68   return (AliTRDsegmentID *)fSegment->At(i);
69 }
70 const AliTRDsegmentID*  AliTRDsegmentArrayBase::At(Int_t i)
71 {
72   //
73   //return segment with given index
74   //
75   if ( (i<0) || (i>=fNSegment)) return 0; 
76   return (AliTRDsegmentID *)((*fSegment)[i]);
77 }
78
79 #endif //ALISEGARRAY_H