2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
10 #ifndef AliEveTPCSectorViz_H
11 #define AliEveTPCSectorViz_H
13 #include <TEveElement.h>
19 class AliEveTPCData; class AliEveTPCSectorData;
21 class AliEveTPCSectorVizEditor;
22 class AliEveTPCSector2D; class AliEveTPCSector2DEditor; class AliEveTPCSector2DGL;
23 class AliEveTPCSector3D; class AliEveTPCSector3DEditor; class AliEveTPCSector3DGL;
25 //------------------------------------------------------------------------------
28 // Base-class for visualization of data for one TPC sector.
31 class AliEveTPCSectorViz : public TEveElement,
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;
44 AliEveTPCSectorViz(const AliEveTPCSectorViz&); // Not implemented
45 AliEveTPCSectorViz& operator=(const AliEveTPCSectorViz&); // Not implemented
48 AliEveTPCData *fTPCData; // Source of data.
49 Int_t fSectorID; // Id of the displayed sector.
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.
56 Bool_t fRnrInn; // Render inner segment.
57 Bool_t fRnrOut1; // Render middle segment.
58 Bool_t fRnrOut2; // Render outer segment.
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
65 mutable UChar_t *fColorArray; // Color array caching signal to color mapping.
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;
74 AliEveTPCSectorViz(const Text_t* n="AliEveTPCSectorViz", const Text_t* t=0);
75 virtual ~AliEveTPCSectorViz();
77 virtual void CopyVizParams(const AliEveTPCSectorViz& v);
79 virtual UInt_t IncRTS() { return ++fRTS; }
80 virtual Bool_t CanEditMainColor() const { return kTRUE; }
82 void SetDataSource(AliEveTPCData* data);
83 void SetSectorID(Int_t id);
85 AliEveTPCData* GetData() const { return fTPCData; }
86 Int_t GetSectorID() const { return fSectorID; }
87 AliEveTPCSectorData* GetSectorData() const;
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);
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(); }
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);
104 void SetUseTrans(Bool_t t);
106 ClassDef(AliEveTPCSectorViz, 1); // Base-class for visualization of data for one TPC sector.
109 //------------------------------------------------------------------------------
111 inline UChar_t* AliEveTPCSectorViz::ColorFromArray(Int_t val) const
113 if(val < fThreshold) val = fThreshold;
114 if(val > fMaxVal) val = fMaxVal;
115 return fColorArray + 4 * (val - fThreshold);
118 inline void AliEveTPCSectorViz::ColorFromArray(Int_t val, UChar_t* pix) const
120 UChar_t* c = ColorFromArray(val);
121 pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3];