]>
Commit | Line | Data |
---|---|---|
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 | AliEveTPCSectorViz(const AliEveTPCSectorViz&); // Not implemented | |
45 | AliEveTPCSectorViz& operator=(const AliEveTPCSectorViz&); // Not implemented | |
46 | ||
47 | protected: | |
48 | AliEveTPCData *fTPCData; // Source of data. | |
49 | Int_t fSectorID; // Id of the displayed sector. | |
50 | ||
51 | Int_t fMinTime; // Min time-bin to display. | |
52 | Int_t fMaxTime; // Max time-bin to display. | |
53 | Short_t fThreshold; // Threshold for display/ | |
54 | Int_t fMaxVal; // Maximum signal-value, all above is of the same color. | |
55 | ||
56 | Bool_t fRnrInn; // Render inner segment. | |
57 | Bool_t fRnrOut1; // Render middle segment. | |
58 | Bool_t fRnrOut2; // Render outer segment. | |
59 | ||
60 | Color_t fFrameColor; // Color of the frame, the main color. | |
61 | Bool_t fRnrFrame; // Render frame. | |
62 | Bool_t fAutoTrans; // Automatically calculate transformation based on sector id. | |
63 | UInt_t fRTS; //! Rendering TimeStamp | |
64 | ||
65 | mutable UChar_t *fColorArray; // Color array caching signal to color mapping. | |
66 | ||
67 | void SetupColor(Int_t val, UChar_t* pix) const; | |
68 | void ClearColorArray(); | |
69 | void SetupColorArray() const; | |
70 | UChar_t* ColorFromArray(Int_t val) const; | |
71 | void ColorFromArray(Int_t val, UChar_t* pix) const; | |
72 | ||
73 | public: | |
74 | AliEveTPCSectorViz(const Text_t* n="AliEveTPCSectorViz", const Text_t* t=0); | |
75 | virtual ~AliEveTPCSectorViz(); | |
76 | ||
77 | virtual void CopyVizParams(const AliEveTPCSectorViz& v); | |
78 | ||
79 | virtual UInt_t IncRTS() { return ++fRTS; } | |
80 | virtual Bool_t CanEditMainColor() const { return kTRUE; } | |
81 | ||
82 | void SetDataSource(AliEveTPCData* data); | |
83 | void SetSectorID(Int_t id); | |
84 | ||
85 | AliEveTPCData* GetData() const { return fTPCData; } | |
86 | Int_t GetSectorID() const { return fSectorID; } | |
87 | AliEveTPCSectorData* GetSectorData() const; | |
88 | ||
89 | Int_t GetMinTime() const { return fMinTime; } | |
90 | Int_t GetMaxTime() const { return fMaxTime; } | |
91 | void SetMinTime(Int_t mt) { fMinTime = mt; IncRTS(); } | |
92 | void SetMaxTime(Int_t mt) { fMaxTime = mt; IncRTS(); } | |
93 | void SetThreshold(Short_t t); | |
94 | void SetMaxVal(Int_t mv); | |
95 | ||
96 | void SetRnrInn(Bool_t r) { fRnrInn = r; IncRTS(); } | |
97 | void SetRnrOut1(Bool_t r) { fRnrOut1 = r; IncRTS(); } | |
98 | void SetRnrOut2(Bool_t r) { fRnrOut2 = r; IncRTS(); } | |
99 | ||
100 | void SetFrameColor(Color_t col) { fFrameColor = col; IncRTS(); } | |
101 | virtual void SetRnrFrame(Bool_t rf) { fRnrFrame = rf; IncRTS(); } | |
102 | void SetAutoTrans(Bool_t t); | |
103 | ||
104 | void SetUseTrans(Bool_t t); | |
105 | ||
106 | ClassDef(AliEveTPCSectorViz, 1); // Base-class for visualization of data for one TPC sector. | |
107 | }; | |
108 | ||
109 | //------------------------------------------------------------------------------ | |
110 | ||
111 | inline UChar_t* AliEveTPCSectorViz::ColorFromArray(Int_t val) const | |
112 | { | |
113 | if(val < fThreshold) val = fThreshold; | |
114 | if(val > fMaxVal) val = fMaxVal; | |
115 | return fColorArray + 4 * (val - fThreshold); | |
116 | } | |
117 | ||
118 | inline void AliEveTPCSectorViz::ColorFromArray(Int_t val, UChar_t* pix) const | |
119 | { | |
120 | UChar_t* c = ColorFromArray(val); | |
121 | pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3]; | |
122 | } | |
123 | ||
124 | #endif |