]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTPCSectorViz.h
Handle missing rec-point tree in a uniform way: return null pointer to TEvePointSet.
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSectorViz.h
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #ifndef AliEveTPCSectorViz_H
11 #define AliEveTPCSectorViz_H
12
13 #include <TEveElement.h>
14
15 #include <TNamed.h>
16 #include <TAtt3D.h>
17 #include <TAttBBox.h>
18
19 class AliEveTPCData; class AliEveTPCSectorData;
20
21 class AliEveTPCSectorVizEditor;
22 class AliEveTPCSector2D;  class AliEveTPCSector2DEditor;  class AliEveTPCSector2DGL;
23 class AliEveTPCSector3D;  class AliEveTPCSector3DEditor;  class AliEveTPCSector3DGL;
24
25 //------------------------------------------------------------------------------
26 // AliEveTPCSectorViz
27 //
28 // Base-class for visualization of data for one TPC sector.
29 //
30
31 class AliEveTPCSectorViz : public TEveElement,
32                            public TNamed,
33                            public TAtt3D,
34                            public TAttBBox
35 {
36   friend class AliEveTPCSectorVizEditor;
37   friend class AliEveTPCSector2D;
38   friend class AliEveTPCSector2DEditor;
39   friend class AliEveTPCSector2DGL;
40   friend class AliEveTPCSector3D;
41   friend class AliEveTPCSector3DEditor;
42   friend class AliEveTPCSector3DGL;
43
44 public:
45   AliEveTPCSectorViz(const Text_t* n="AliEveTPCSectorViz", const Text_t* t=0);
46   virtual ~AliEveTPCSectorViz();
47
48   virtual void CopyVizParams(const AliEveTPCSectorViz& v);
49
50   virtual UInt_t IncRTS() { return ++fRTS; }
51   virtual Bool_t CanEditMainColor() const { return kTRUE; }
52
53   void SetDataSource(AliEveTPCData* data);
54   void SetSectorID(Int_t id);
55
56   AliEveTPCData* GetData()     const { return fTPCData; }
57   Int_t          GetSectorID() const { return fSectorID; }
58   AliEveTPCSectorData* GetSectorData() const;
59
60   Int_t GetMinTime() const { return fMinTime; }
61   Int_t GetMaxTime() const { return fMaxTime; }
62   void SetMinTime(Int_t mt)    { fMinTime   = mt; IncRTS(); }
63   void SetMaxTime(Int_t mt)    { fMaxTime   = mt; IncRTS(); }
64   void SetThreshold(Short_t t);
65   void SetMaxVal(Int_t mv);
66
67   void SetRnrInn(Bool_t r)     { fRnrInn  = r; IncRTS(); }
68   void SetRnrOut1(Bool_t r)    { fRnrOut1 = r; IncRTS(); }
69   void SetRnrOut2(Bool_t r)    { fRnrOut2 = r; IncRTS(); }
70
71   void SetFrameColor(Color_t col)     { fFrameColor = col; IncRTS(); }
72   virtual void SetRnrFrame(Bool_t rf) { fRnrFrame = rf;  IncRTS(); }
73   void SetAutoTrans(Bool_t t);
74
75   void SetUseTrans(Bool_t t);
76
77 protected:
78   AliEveTPCData    *fTPCData;    //  Source of data.
79   Int_t             fSectorID;   //  Id of the displayed sector.
80
81   Int_t             fMinTime;    //  Min time-bin to display.
82   Int_t             fMaxTime;    //  Max time-bin to display.
83   Short_t           fThreshold;  //  Threshold for display/
84   Int_t             fMaxVal;     //  Maximum signal-value, all above is of the same color.
85
86   Bool_t            fRnrInn;     //  Render inner segment.
87   Bool_t            fRnrOut1;    //  Render middle segment.
88   Bool_t            fRnrOut2;    //  Render outer segment.
89
90   Color_t           fFrameColor; //  Color of the frame, the main color.
91   Bool_t            fRnrFrame;   //  Render frame.
92   Bool_t            fAutoTrans;  //  Automatically calculate transformation based on sector id.
93   UInt_t            fRTS;        //! Rendering TimeStamp
94
95   mutable UChar_t  *fColorArray; //  Color array caching signal to color mapping.
96
97   void SetupColor(Int_t val, UChar_t* pix) const;
98   void ClearColorArray();
99   void SetupColorArray() const;
100   UChar_t* ColorFromArray(Int_t val) const;
101   void     ColorFromArray(Int_t val, UChar_t* pix) const;
102
103 private:
104   AliEveTPCSectorViz(const AliEveTPCSectorViz&);            // Not implemented
105   AliEveTPCSectorViz& operator=(const AliEveTPCSectorViz&); // Not implemented
106
107   ClassDef(AliEveTPCSectorViz, 0); // Base-class for visualization of data for one TPC sector.
108 };
109
110
111 // --- Inlines ---
112
113 inline UChar_t* AliEveTPCSectorViz::ColorFromArray(Int_t val) const
114 {
115   if(val < fThreshold) val = fThreshold;
116   if(val > fMaxVal)    val = fMaxVal;
117   return fColorArray + 4 * (val - fThreshold);
118 }
119
120 inline void AliEveTPCSectorViz::ColorFromArray(Int_t val, UChar_t* pix) const
121 {
122   UChar_t* c = ColorFromArray(val);
123   pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3];
124 }
125
126 #endif