library: libTable #include "TTable3Points.h"

# TTable3Points

class description - source file - inheritance tree (.pdf)

## class TTable3Points : public TTablePoints

| Inheritance Chart:
`TObject`
| <- | `TPoints3DABC`
| <- | `TTablePoints`
| <- | `TTable3Points` |

        public:

                                 TTable3Points()
                                 TTable3Points(TTableSorter* sorter, const void* key, const Char_t* xName = "x", const Char_t* yName = "y", const Char_t* zName = "z", Option_t* opt = "")
                                 TTable3Points(TTableSorter* sorter, Int_t keyIndex, const Char_t* xName = "x", const Char_t* yName = "y", const Char_t* zName = "z", Option_t* opt = "")
                                 TTable3Points(const TTable3Points&)
                                 ~TTable3Points()
                  static TClass* Class()
                 virtual Float_t GetAnyPoint(Int_t idx, TTable3Points::EPointDirection xAxis) const
                   virtual Int_t GetKey(Int_t)
                   virtual Int_t GetN() const
                virtual Float_t* GetP() const
                   virtual Int_t GetTotalKeys()
                 virtual Float_t GetX(Int_t idx) const
          virtual const Float_t* GetXYZ(Int_t) const
                virtual Float_t* GetXYZ(Float_t* xyz, Int_t idx, Int_t num = 1) const
                 virtual Float_t GetY(Int_t idx) const
                 virtual Float_t GetZ(Int_t idx) const
                 virtual TClass* IsA() const
                    virtual void PaintPoints(int, float*, const char*)
                    virtual void SetAnyColumn(const Char_t* anyName, TTable3Points::EPointDirection indx)
                   virtual Int_t SetKeyByIndx(Int_t)
                   virtual Int_t SetKeyByValue(Int_t)
                    virtual void SetXColumn(const Char_t* xName)
                    virtual void SetYColumn(const Char_t* yName)
                    virtual void SetZColumn(const Char_t* zName)
                    virtual void ShowMembers(TMemberInspector& insp, char* parent)
                    virtual void Streamer(TBuffer& b)
                            void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

          ULong_t* fColumnOffset  !

        public:

          static const TTable3Points::EPointDirection kXPoints
          static const TTable3Points::EPointDirection kYPoints
          static const TTable3Points::EPointDirection kZPoints
          static const TTable3Points::EPointDirection kTotalSize

## Class Description

       TTable3Points class is to create 3D view of any 3 columns of the TTable objects
       with one and the same "key column value".

       For example all values of the column "x[0]" "x[1]" "x[2]" of the

g2t_tpc_hit

     table
       from the rows with one and same "track_id" column value will be regarded
       as an image of one and the same "track".
       The last means all those points will be painted with one and the same 3D
       attributes like "color", "size", "style", "light","markers", "connections"  etc.

       The original TTable object must be pre-sorted by "key column" via TTableSorter
       class

     void   CreatePoints(Tg2t_tpc_hit *points)
     {
       g2t_tpc_hit_st *p = points->GetTable();

      TTable3Points *track = 0;
      TString tr;
      tr = "track_p";
      TTable &ttt = *((TTable *)points);
      // Track2Line MUST be on heap otherwise 3D view will crash just code leaves this
      // subroutine
      We will assemble all points by its "track_p" field.

      TTableSorter *Track2Line = new TTableSorter (ttt,"track_p");

      Int_t i = 0;
      Char_t buffer[10];
      Int_t ntracks = 0;
      const Int_t maxtracks = 5;
    //---------------------------- Fill tracks -------------------
      long currentId = -1;
      long newId =  0;
      g2t_tpc_hit_st *hitPoint = 0;
      TVolume *thisTrack[7] = {0,0,0,0,0,0,0}; // seven volumes for 7 different colors
      Int_t  MaxRowtoCount = 5000; // 5000;
      Int_t  MaxTracks = Track2Line->CountKeys();
      MaxTracks = 100;
      for (i=0;i<Track2Line->GetNRows() && ntracks <  MaxTracks ;i++)
      {
       hitPoint = p + Track2Line->GetIndex(i);
       newId =  hitPoint->track_p;
       if (newId != currentId)  { // The hit for the new track has been found

         const Char_t *xName = "x[0]";
         const Char_t *yName = "x[1]";
         const Char_t *zName = "x[2]";

         track =  new TTable3Points(Track2Line,(const void *)&newId,xName,yName,zName);

         // Create a shape for this node
         TPolyLineShape *trackShape  =  new TPolyLineShape(track);
         trackShape->SetVisibility(1);
         Int_t colorIndx = ntracks%7;
         trackShape->SetColorAttribute(colorIndx+kGreen);
         trackShape->SetLineStyle(1);
         trackShape->SetSizeAttribute(2);
         // Create a node to hold it
         if (!thisTrack[colorIndx])  {
             thisTrack[colorIndx] = new TVolume("hits","hits",trackShape);
             thisTrack[colorIndx]->Mark();
             thisTrack[colorIndx]->SetVisibility();
             TVolumePosition *pp = hall->Add(thisTrack[colorIndx]);
             if (!pp) printf(" no position %d\n",ntrack);
         }
         else
           thisTrack[colorIndx]->Add(trackShape);
         currentId = newId;
         ntracks++;
       }
     }

TTable3Points():fColumnOffset(0)

TTable3Points(TTableSorter *sorter,const void *key, const Char_t *xName, const Char_t *yName, const Char_t *zName ,Option_t *opt) : TTablePoints(sorter,key,opt)

TTable3Points(TTableSorter *sorter,Int_t keyIndex, const Char_t *xName, const Char_t *yName, const Char_t *zName ,Option_t *opt) : TTablePoints(sorter,keyIndex,opt)

~TTable3Points()

Float_t GetAnyPoint(Int_t idx, EPointDirection xAxis) const

void SetAnyColumn(const Char_t *anyName, EPointDirection indx)

Float_t* GetXYZ(Float_t *xyz,Int_t idx, Int_t num) const

### Inline Functions

                     void SetXColumn(const Char_t* xName)
                     void SetYColumn(const Char_t* yName)
                     void SetZColumn(const Char_t* zName)
                    Int_t GetTotalKeys()
                    Int_t GetKey(Int_t)
                    Int_t SetKeyByIndx(Int_t)
                    Int_t SetKeyByValue(Int_t)
                  Float_t GetX(Int_t idx) const
                  Float_t GetY(Int_t idx) const
                  Float_t GetZ(Int_t idx) const
                     void PaintPoints(int, float*, const char*)
                 Float_t* GetXYZ(Float_t* xyz, Int_t idx, Int_t num = 1) const
                 Float_t* GetP() const
                    Int_t GetN() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
            TTable3Points TTable3Points(const TTable3Points&)

Author: Valery Fine 10/05/99 (E-mail: fine@bnl.gov)
Last update: root/star:$Name: $:$Id: TTable3Points.cxx,v 1.2 2003/01/27 20:41:37 brun Exp $