StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TTablePoints.h
1 // @(#)root/table:$Id$
2 // Author: Valery Fine 14/05/99 (E-mail: fine@bnl.gov)
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TTablePoints
13 #define ROOT_TTablePoints
14 
15 #include "TPoints3DABC.h"
16 #include "TTableSorter.h"
17 #include "TTable.h"
18 
19 class TTablePoints : public TPoints3DABC
20 {
21 protected:
22  TTableSorter *fTableSorter;
23  const void *fKey; // pointer to key value to select rows
24  Int_t fFirstRow; // The first row to take in account
25  Int_t fSize;
26  void *fRows; // Pointer the first row of the STAF table
27 
28  virtual void SetTablePointer(void *table);
29  TTablePoints();
30 public:
31  TTablePoints(TTableSorter *sorter,const void *key,Option_t *opt="");
32  TTablePoints(TTableSorter *sorter, Int_t keyIndex,Option_t *opt="");
33  ~TTablePoints(){}
34  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
35  virtual Int_t GetLastPosition()const;
36  virtual Float_t GetX(Int_t idx) const = 0;
37  virtual Float_t GetY(Int_t idx) const = 0;
38  virtual Float_t GetZ(Int_t idx) const = 0;
39  virtual void *GetTable();
40  virtual Option_t *GetOption() const { return 0;}
41  virtual Int_t Indx(Int_t sortedIndx) const;
42  virtual Int_t SetLastPosition(Int_t idx);
43  virtual void SetOption(Option_t *){;}
44  virtual Int_t SetPoint(Int_t, Float_t, Float_t, Float_t ){return -1;}
45  virtual Int_t SetPoints(Int_t , Float_t *, Option_t *){return -1;}
46  virtual Int_t Size() const;
47  ClassDef(TTablePoints,0) // Defines the TTable as an element of "event" geometry
48 };
49 
50 //____________________________________________________________________________
51 // return the index of the origial row by its index from the sorted table
52 inline Int_t TTablePoints::Indx(Int_t sortedIndx) const
53 {return fTableSorter?fTableSorter->GetIndex(fFirstRow+sortedIndx):-1;}
54 //____________________________________________________________________________
55 // return the pointer to the original table object
56 inline void *TTablePoints::GetTable(){
57  void *ret = 0;
58  if (fTableSorter) {
59  TTable *t = fTableSorter->GetTable();
60  if (t) ret = t->GetArray();
61  }
62  return ret;
63 }
64 //____________________________________________________________________________
65 inline Int_t TTablePoints::Size() const { return fSize;}
66 //____________________________________________________________________________
67 inline Int_t TTablePoints::GetLastPosition() const {return Size()-1;}
68 
69 //____________________________________________________________________________
70 inline Int_t TTablePoints::SetLastPosition(Int_t idx)
71 {
72  Int_t pos = GetLastPosition();
73  fSize = TMath::Min(pos,idx)+1;
74  return pos;
75 }
76 
77 #endif
78 
TTablePoints()
to be documented
Int_t GetIndex(UInt_t sortedIndex) const
returns the original index of the row by its sorted index
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
virtual TTable * GetTable() const
to be documented
Definition: TTable.h:48