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