]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSectorViz.h
a2e75e2bf6a0dec56c7ccec00de117481113eace
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSectorViz.h
1 // $Header$
2
3 #ifndef ALIEVE_TPCSectorViz_H
4 #define ALIEVE_TPCSectorViz_H
5
6 #include <Reve/RenderElement.h>
7
8 #include <TNamed.h> 
9 #include <TAtt3D.h>
10 #include <TAttBBox.h>
11
12
13 namespace Alieve {
14
15 class TPCData; class TPCSectorData;
16
17 class TPCSectorVizEditor;
18 class TPCSector2D;  class TPCSector2DEditor;  class TPCSector2DGL;
19 class TPCSector3D;  class TPCSector3DEditor;  class TPCSector3DGL;
20
21 class TPCSectorViz : public TNamed, public TAtt3D, public TAttBBox,
22                      public Reve::RenderElement
23 {
24   friend class TPCSectorVizEditor;
25   friend class TPCSector2D;
26   friend class TPCSector2DEditor;
27   friend class TPCSector2DGL;
28   friend class TPCSector3D;
29   friend class TPCSector3DEditor;
30   friend class TPCSector3DGL;
31
32 protected:
33   TPCData*    fTPCData; 
34   Int_t       fSectorID;
35
36   Int_t       fMinTime;     
37   Int_t       fMaxTime;
38   Short_t     fThreshold;
39   Int_t       fMaxVal;
40
41   Bool_t      fRnrInn;
42   Bool_t      fRnrOut1;
43   Bool_t      fRnrOut2;
44
45   Color_t     fFrameColor;
46   Bool_t      fRnrFrame;
47   Bool_t      fTrans;
48   Double_t    fMatrix[16];
49   UInt_t      fRTS;       //! Rendering TimeStamp
50
51   void SetupColor(Int_t val, UChar_t* pix) const;
52
53   mutable UChar_t* fColorArray;
54   void ClearColorArray();
55   void SetupColorArray() const;
56   UChar_t* ColorFromArray(Int_t val) const;
57   void     ColorFromArray(Int_t val, UChar_t* pix) const;
58
59 public:
60   TPCSectorViz(const Text_t* n="TPCSectorViz", const Text_t* t=0);
61   virtual ~TPCSectorViz();
62
63   virtual void CopyVizParams(const TPCSectorViz& v);
64
65   virtual UInt_t IncRTS()           { return ++fRTS; }
66   virtual Bool_t CanEditMainColor() { return true; }
67
68   void SetDataSource(TPCData* data);
69   void SetSectorID(Int_t id);
70
71   TPCData*       GetData()     const { return fTPCData; }
72   Int_t          GetSectorID() const { return fSectorID; }
73   TPCSectorData* GetSectorData() const;
74
75   void SetMinTime(Int_t mt)    { fMinTime   = mt; IncRTS(); }
76   void SetMaxTime(Int_t mt)    { fMaxTime   = mt; IncRTS(); }
77   void SetThreshold(Short_t t);
78   void SetMaxVal(Int_t mv);
79
80   void SetRnrInn(Bool_t r)     { fRnrInn  = r; IncRTS(); }
81   void SetRnrOut1(Bool_t r)    { fRnrOut1 = r; IncRTS(); }
82   void SetRnrOut2(Bool_t r)    { fRnrOut2 = r; IncRTS(); }
83
84   void SetFrameColor(Color_t col)     { fFrameColor = col; IncRTS(); }
85   virtual void SetRnrFrame(Bool_t rf) { fRnrFrame = rf;  IncRTS(); }
86   void SetTrans(Bool_t t);
87
88   ClassDef(TPCSectorViz, 1); // Base-class for TPC raw-data visualization
89 }; // endclass TPCSectorViz
90
91
92 inline UChar_t* TPCSectorViz::ColorFromArray(Int_t val) const
93 {
94   if(val < fThreshold) val = fThreshold;
95   if(val > fMaxVal)    val = fMaxVal;
96   return fColorArray + 4 * (val - fThreshold);
97 }
98
99 inline void TPCSectorViz::ColorFromArray(Int_t val, UChar_t* pix) const
100 {
101   UChar_t* c = ColorFromArray(val);
102   pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3];
103 }
104
105 }
106
107 #endif