ROOT logo
#ifndef ALISEGMENTARRAY_H
#define ALISEGMENTARRAY_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

////////////////////////////////////////////////
//  Manager class general Alice segment 
//  segment is for example one pad row in TPC //
////////////////////////////////////////////////

#include "TNamed.h"
#include "TError.h"
#include "TObjArray.h"

class TTree;
class TBranch;
class TFile;
class TArrayI;
class AliSegmentID;
 
class AliSegmentArray: public TNamed{
public:
  AliSegmentArray();
  AliSegmentArray(const char *classname, Int_t n);  // 
  virtual ~AliSegmentArray();
  Bool_t  SetClass(const char *classname);  //set class of stored object 
  const AliSegmentID * At(Int_t i); //return pointer to segment with index i 
  const AliSegmentID * operator[](Int_t i); //return pointer to segment with index i

  Bool_t AddSegment(AliSegmentID *segment); // add segment to array
  AliSegmentID * AddSegment(Int_t index);   //create objet and set index
  Bool_t   MakeArray(Int_t n);       //make array of pointers to Segments
  void ClearSegment(Int_t index); //remove segment from active   
  virtual AliSegmentID * NewSegment(); //dynamicaly create new segment 
  //input output functions
  TTree * GetTree(){return fTree;}      //return pointer to connected tree
  
  virtual void MakeTree(char *file=0);              //Make tree with the name
  virtual void MakeTree(TTree* tree);              //Make tree with the name

  virtual Bool_t ConnectTree(const char * treeName); //connect tree from current directory 
  virtual Bool_t ConnectTree(TTree* tree); //connect tree from current directory 
  
  virtual AliSegmentID * LoadSegment(Int_t index);//load segment with index to the memory
  virtual AliSegmentID * LoadEntry(Int_t index); //load segment entry from position index in tree
  virtual void StoreSegment(Int_t index);//write segmen persistent  
  Bool_t  MakeDictionary(Int_t size);//create index table for tree
  TClass * GetClass() {return fClass;}
  
protected:
  AliSegmentArray(const AliSegmentArray &segment); //copy constructor
  AliSegmentArray &operator = (const AliSegmentArray & segment); //assignment operator
  TObjArray  * fSegment;  //!pointer to array of pointers to segment
  TArrayI    * fTreeIndex; //!pointers(index) table in tree
  Int_t      fNSegment; //number of alocated segments   
  TTree    * fTree;   //!tree with segment objects
  Bool_t   fTreeOwner;// flag determing the ownership of the fTree
  TBranch  * fBranch; //!total branch
private: 
  TClass  *   fClass;    //!class type of included objects 
  ClassDef(AliSegmentArray,3) 
};



inline const AliSegmentID*  AliSegmentArray::operator[](Int_t i)
{
  //
  //return segment with given index
  //
  if ( (i<0) || (i>=fNSegment)) return 0; 
  return (AliSegmentID *)(fSegment->At(i));
  
}

inline const AliSegmentID*  AliSegmentArray::At(Int_t i)
{
  //
  //return segment with given index
  //
  if ( (i<0) || (i>=fNSegment)) return 0; 
  return (AliSegmentID *)(fSegment->At(i));
}

#endif //ALISEGMENTARRAY_H
 AliSegmentArray.h:1
 AliSegmentArray.h:2
 AliSegmentArray.h:3
 AliSegmentArray.h:4
 AliSegmentArray.h:5
 AliSegmentArray.h:6
 AliSegmentArray.h:7
 AliSegmentArray.h:8
 AliSegmentArray.h:9
 AliSegmentArray.h:10
 AliSegmentArray.h:11
 AliSegmentArray.h:12
 AliSegmentArray.h:13
 AliSegmentArray.h:14
 AliSegmentArray.h:15
 AliSegmentArray.h:16
 AliSegmentArray.h:17
 AliSegmentArray.h:18
 AliSegmentArray.h:19
 AliSegmentArray.h:20
 AliSegmentArray.h:21
 AliSegmentArray.h:22
 AliSegmentArray.h:23
 AliSegmentArray.h:24
 AliSegmentArray.h:25
 AliSegmentArray.h:26
 AliSegmentArray.h:27
 AliSegmentArray.h:28
 AliSegmentArray.h:29
 AliSegmentArray.h:30
 AliSegmentArray.h:31
 AliSegmentArray.h:32
 AliSegmentArray.h:33
 AliSegmentArray.h:34
 AliSegmentArray.h:35
 AliSegmentArray.h:36
 AliSegmentArray.h:37
 AliSegmentArray.h:38
 AliSegmentArray.h:39
 AliSegmentArray.h:40
 AliSegmentArray.h:41
 AliSegmentArray.h:42
 AliSegmentArray.h:43
 AliSegmentArray.h:44
 AliSegmentArray.h:45
 AliSegmentArray.h:46
 AliSegmentArray.h:47
 AliSegmentArray.h:48
 AliSegmentArray.h:49
 AliSegmentArray.h:50
 AliSegmentArray.h:51
 AliSegmentArray.h:52
 AliSegmentArray.h:53
 AliSegmentArray.h:54
 AliSegmentArray.h:55
 AliSegmentArray.h:56
 AliSegmentArray.h:57
 AliSegmentArray.h:58
 AliSegmentArray.h:59
 AliSegmentArray.h:60
 AliSegmentArray.h:61
 AliSegmentArray.h:62
 AliSegmentArray.h:63
 AliSegmentArray.h:64
 AliSegmentArray.h:65
 AliSegmentArray.h:66
 AliSegmentArray.h:67
 AliSegmentArray.h:68
 AliSegmentArray.h:69
 AliSegmentArray.h:70
 AliSegmentArray.h:71
 AliSegmentArray.h:72
 AliSegmentArray.h:73
 AliSegmentArray.h:74
 AliSegmentArray.h:75
 AliSegmentArray.h:76
 AliSegmentArray.h:77
 AliSegmentArray.h:78
 AliSegmentArray.h:79
 AliSegmentArray.h:80
 AliSegmentArray.h:81
 AliSegmentArray.h:82
 AliSegmentArray.h:83
 AliSegmentArray.h:84
 AliSegmentArray.h:85
 AliSegmentArray.h:86
 AliSegmentArray.h:87