]>
Commit | Line | Data |
---|---|---|
3626c858 | 1 | #ifndef ALIEVE_MUONChamber_H |
2 | #define ALIEVE_MUONChamber_H | |
3 | ||
4 | #include <Reve/RenderElement.h> | |
5 | #include <Reve/QuadSet.h> | |
6 | ||
7 | #include <TNamed.h> | |
8 | #include <TAtt3D.h> | |
9 | #include <TAttBBox.h> | |
10 | ||
11 | namespace Alieve { | |
12 | ||
13 | class MUONData; | |
14 | class MUONChamberData; | |
15 | class MUONChamberEditor; | |
16 | class MUONChamberGL; | |
17 | ||
18 | class MUONChamber : public Reve::RenderElement, | |
19 | public TNamed, | |
20 | public TAtt3D, | |
21 | public TAttBBox | |
22 | ||
23 | { | |
24 | ||
25 | friend class MUONChamberGL; | |
26 | friend class MUONChamberEditor; | |
27 | ||
28 | MUONChamber(const MUONChamber&); // Not implemented | |
29 | MUONChamber& operator=(const MUONChamber&); // Not implemented | |
30 | ||
31 | protected: | |
32 | ||
33 | void UpdateQuads(); | |
34 | ||
35 | MUONData* fMUONData; // data for the current event | |
36 | Color_t fFrameColor; // main coloring | |
37 | UInt_t fRTS; //! Rendering Time Stamp | |
38 | Int_t fChamberID; // number of the chamber, 0 to 13 | |
39 | Reve::OldQuadSet fQuadSet1; // 1st cathode plane digits | |
40 | Reve::OldQuadSet fQuadSet2; // 2nd cathode plane digits | |
41 | Short_t fThreshold; // digit amplitude threshold | |
42 | Int_t fMaxVal; // digit amplitude maximum value | |
43 | ||
44 | void SetupColor(Int_t val, UChar_t* pix) const; | |
45 | ||
46 | mutable UChar_t* fColorArray; | |
47 | void ClearColorArray(); | |
48 | void SetupColorArray() const; | |
49 | UChar_t* ColorFromArray(Int_t val) const; | |
50 | void ColorFromArray(Int_t val, UChar_t* pix) const; | |
51 | Int_t ColorIndex(Int_t val) const; | |
52 | ||
53 | public: | |
54 | ||
55 | MUONChamber(const Text_t* n = "MUONChamber", const Text_t* t = 0); | |
56 | virtual ~MUONChamber(); | |
57 | ||
58 | virtual void ComputeBBox(); | |
59 | virtual void Paint(Option_t* option = ""); | |
60 | virtual UInt_t IncRTS() { return ++fRTS; }; | |
61 | virtual Bool_t CanEditMainColor() { return kTRUE; } | |
62 | ||
63 | void SetDataSource(MUONData *data); | |
64 | void SetChamberID(Int_t id); | |
65 | void SetFrameColor(Color_t col) { fFrameColor = col; IncRTS(); }; | |
66 | MUONData* GetData() const { return fMUONData; }; | |
67 | MUONChamberData* GetChamberData() const; | |
68 | Int_t GetID() const { return fChamberID; }; | |
69 | void SetThreshold(Short_t t); | |
70 | void SetMaxVal(Int_t mv); | |
71 | ||
72 | ClassDef(MUONChamber,1); // Visualisation of the MUON chambers | |
73 | ||
74 | }; | |
75 | ||
76 | inline UChar_t* MUONChamber::ColorFromArray(Int_t val) const | |
77 | { | |
78 | if(val < fThreshold) val = fThreshold; | |
79 | if(val > fMaxVal) val = fMaxVal; | |
80 | return fColorArray + 4 * (val - fThreshold); | |
81 | } | |
82 | ||
83 | inline void MUONChamber::ColorFromArray(Int_t val, UChar_t* pix) const | |
84 | { | |
85 | UChar_t* c = ColorFromArray(val); | |
86 | pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3]; | |
87 | } | |
88 | ||
89 | } | |
90 | ||
91 | #endif |