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