Logo ROOT   6.12/07
Reference Guide
TTablePoints.h
Go to the documentation of this file.
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:
23  const void *fKey; // pointer to key value to select rows
24  Int_t fFirstRow; // The first row to take in account
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="");
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 inline void TTablePoints::SetTablePointer(void *table){ fRows = table;}
52 
53 //____________________________________________________________________________
54 // return the index of the origial row by its index from the sorted table
55 inline Int_t TTablePoints::Indx(Int_t sortedIndx) const
56 {return fTableSorter?fTableSorter->GetIndex(fFirstRow+sortedIndx):-1;}
57 //____________________________________________________________________________
58 // return the pointer to the original table object
59 inline void *TTablePoints::GetTable(){
60  void *ret = 0;
61  if (fTableSorter) {
63  if (t) ret = t->GetArray();
64  }
65  return ret;
66 }
67 //____________________________________________________________________________
68 inline Int_t TTablePoints::Size() const { return fSize;}
69 //____________________________________________________________________________
70 inline Int_t TTablePoints::GetLastPosition() const {return Size()-1;}
71 
72 //____________________________________________________________________________
74 {
75  Int_t pos = GetLastPosition();
76  fSize = TMath::Min(pos,idx)+1;
77  return pos;
78 }
79 
80 #endif
81 
Int_t GetIndex(UInt_t sortedIndex) const
returns the original index of the row by its sorted index
virtual Int_t Size() const
Definition: TTablePoints.h:68
virtual Float_t GetY(Int_t idx) const =0
virtual TTable * GetTable() const
to be documented
TTableSorter * fTableSorter
Definition: TTablePoints.h:22
virtual Int_t SetPoints(Int_t, Float_t *, Option_t *)
Definition: TTablePoints.h:45
TTablePoints()
to be documented
float Float_t
Definition: RtypesCore.h:53
virtual Int_t GetLastPosition() const
Definition: TTablePoints.h:70
const char Option_t
Definition: RtypesCore.h:62
virtual void * GetTable()
Definition: TTablePoints.h:59
Abstract class to define Arrays of 3D points.
Definition: TPoints3DABC.h:25
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:168
int Int_t
Definition: RtypesCore.h:41
const void * fKey
Definition: TTablePoints.h:23
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a 3-D points.
virtual Float_t GetZ(Int_t idx) const =0
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual Option_t * GetOption() const
Definition: TTablePoints.h:40
void * fRows
Definition: TTablePoints.h:26
virtual Int_t SetLastPosition(Int_t idx)
Definition: TTablePoints.h:73
virtual Int_t Indx(Int_t sortedIndx) const
Definition: TTablePoints.h:55
void * GetArray() const
Definition: TTable.h:280
virtual Float_t GetX(Int_t idx) const =0
virtual void SetOption(Option_t *)
Definition: TTablePoints.h:43
Definition: TTable.h:48
Int_t fFirstRow
Definition: TTablePoints.h:24
virtual void SetTablePointer(void *table)
Definition: TTablePoints.h:51
virtual Int_t SetPoint(Int_t, Float_t, Float_t, Float_t)
Definition: TTablePoints.h:44