Logo ROOT   6.16/01
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
20{
21protected:
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);
30public:
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// return the index of the origial row by its index from the sorted table
52inline 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
57 void *ret = 0;
58 if (fTableSorter) {
60 if (t) ret = t->GetArray();
61 }
62 return ret;
63}
64//____________________________________________________________________________
65inline Int_t TTablePoints::Size() const { return fSize;}
66//____________________________________________________________________________
67inline Int_t TTablePoints::GetLastPosition() const {return Size()-1;}
68
69//____________________________________________________________________________
71{
72 Int_t pos = GetLastPosition();
73 fSize = TMath::Min(pos,idx)+1;
74 return pos;
75}
76
77#endif
78
int Int_t
Definition: RtypesCore.h:41
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:324
Abstract class to define Arrays of 3D points.
Definition: TPoints3DABC.h:25
virtual void * GetTable()
Definition: TTablePoints.h:56
Int_t fFirstRow
Definition: TTablePoints.h:24
void * fRows
Definition: TTablePoints.h:26
TTableSorter * fTableSorter
Definition: TTablePoints.h:22
virtual Option_t * GetOption() const
Definition: TTablePoints.h:40
virtual Int_t Size() const
Definition: TTablePoints.h:65
virtual void SetTablePointer(void *table)
virtual Int_t SetPoints(Int_t, Float_t *, Option_t *)
Definition: TTablePoints.h:45
const void * fKey
Definition: TTablePoints.h:23
virtual Float_t GetX(Int_t idx) const =0
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute distance from point px,py to a 3-D points.
virtual Int_t Indx(Int_t sortedIndx) const
Definition: TTablePoints.h:52
TTablePoints()
to be documented
virtual Float_t GetZ(Int_t idx) const =0
virtual Float_t GetY(Int_t idx) const =0
virtual Int_t GetLastPosition() const
Definition: TTablePoints.h:67
virtual Int_t SetPoint(Int_t, Float_t, Float_t, Float_t)
Definition: TTablePoints.h:44
virtual Int_t SetLastPosition(Int_t idx)
Definition: TTablePoints.h:70
virtual void SetOption(Option_t *)
Definition: TTablePoints.h:43
virtual TTable * GetTable() const
to be documented
Int_t GetIndex(UInt_t sortedIndex) const
returns the original index of the row by its sorted index
Definition: TTable.h:48
void * GetArray() const
Definition: TTable.h:280
Short_t Min(Short_t a, Short_t b)
Definition: TMathBase.h:180
void table()
Definition: table.C:85