]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveMUONChamber.h
Merge changes from branches/dev/EVE. This branch was following development in ROOT...
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveMUONChamber.h
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel & Bogdan Vulpescu: 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 #ifndef AliEveMUONChamber_H
10 #define AliEveMUONChamber_H
11
12 #include <TEveElement.h>
13 #include <TEveQuadSet.h>
14 #include <TEvePointSet.h>
15
16 #include <TNamed.h>
17 #include <TAtt3D.h>
18 #include <TAttBBox.h>
19
20
21 class AliEveMUONData;
22 class AliEveMUONChamberData;
23 class AliEveMUONChamberEditor;
24 class AliEveMUONChamberGL;
25
26 class AliEveMUONChamber : public TEveElement,
27                           public TNamed,
28                           public TAtt3D,
29                           public TAttBBox
30 {
31   friend class AliEveMUONChamberGL;
32   friend class AliEveMUONChamberEditor;
33
34   AliEveMUONChamber(const AliEveMUONChamber&);            // Not implemented
35   AliEveMUONChamber& operator=(const AliEveMUONChamber&); // Not implemented
36
37 protected:
38   void UpdateQuads();
39
40   AliEveMUONData   *fMUONData;      // data for the current event
41   Color_t           fFrameColor;    // main coloring
42   UInt_t            fRTS;           //! Rendering Time Stamp
43   Int_t             fChamberID;     // number of the chamber, 0 to 13
44   TEveQuadSet       fQuadSet1;      // 1st cathode plane digits
45   TEveQuadSet       fQuadSet2;      // 2nd cathode plane digits
46   TEvePointSet      fPointSet1;     // reconstructed points (1st cathode)
47   TEvePointSet      fPointSet2;     // simulation hits
48   Short_t           fThreshold;     // digit amplitude threshold
49   Int_t             fMaxVal;        // digit amplitude maximum value
50   Int_t             fClusterSize;   // cluster point size
51   Int_t             fHitSize;       // hit point size
52
53   void SetupColor(Int_t val, UChar_t* pix) const;
54
55   mutable UChar_t  *fColorArray;    // color-cache
56
57   void     ClearColorArray();
58   void     SetupColorArray() const;
59   UChar_t* ColorFromArray(Int_t val) const;
60   void     ColorFromArray(Int_t val, UChar_t* pix) const;
61   Int_t    ColorIndex(Int_t val) const;
62
63 public:
64   AliEveMUONChamber(Int_t id, const Text_t* n = "AliEveMUONChamber", const Text_t* t = 0);
65   virtual ~AliEveMUONChamber();
66
67   virtual void   ComputeBBox();
68   virtual void   Paint(Option_t* option = "");
69   virtual UInt_t IncRTS()     { return ++fRTS; };
70   virtual Bool_t CanEditMainColor() const { return kTRUE; }
71
72   void SetDataSource(AliEveMUONData *data);
73   void SetChamberID(Int_t id);
74   void SetFrameColor(Color_t col)     { fFrameColor = col; IncRTS(); };
75   AliEveMUONData* GetData() const { return fMUONData; };
76   AliEveMUONChamberData* GetChamberData() const;
77   Int_t GetID() const { return fChamberID; };
78   void  SetThreshold(Short_t t);
79   void  SetMaxVal(Int_t mv);
80   void  SetClusterSize(Int_t size);
81   void  SetHitSize(Int_t size);
82
83   ClassDef(AliEveMUONChamber,1);  // Visualisation of the MUON chambers
84
85 };
86
87 inline UChar_t* AliEveMUONChamber::ColorFromArray(Int_t val) const
88 {
89   if(val < fThreshold) val = fThreshold;
90   if(val > fMaxVal)    val = fMaxVal;
91   return fColorArray + 4 * (val - fThreshold);
92 }
93
94 inline void AliEveMUONChamber::ColorFromArray(Int_t val, UChar_t* pix) const
95 {
96   UChar_t* c = ColorFromArray(val);
97   pix[0] = c[0]; pix[1] = c[1]; pix[2] = c[2]; pix[3] = c[3];
98 }
99
100 #endif