Removed some comment crap.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSectorViz.cxx
CommitLineData
092578a7 1// $Header$
2
3#include "TPCSectorViz.h"
4
5#include <Alieve/TPCData.h>
6#include <Alieve/TPCSectorData.h>
7#include <AliTPCParam.h>
8
9#include <TStyle.h>
10#include <TColor.h>
11
12using namespace Reve;
13using namespace Alieve;
14
15//______________________________________________________________________
16// TPCSectorViz
17//
18// Base class for TPC raw-data visualization.
19// See TPCSector2D and TPCSector3D for concrete implementations.
20
21ClassImp(TPCSectorViz)
22
23/**************************************************************************/
24
25TPCSectorViz::TPCSectorViz(const Text_t* n, const Text_t* t) :
26 TNamed(n, t),
27 Reve::RenderElement(fFrameColor),
28
29 fTPCData (0),
30 fSectorID (0),
31
32 fMinTime (0),
33 fMaxTime (450),
34 fThreshold (5),
35 fMaxVal (80),
36
37 fRnrInn (kTRUE),
38 fRnrOut1 (kTRUE),
39 fRnrOut2 (kTRUE),
40
41 fFrameColor ((Color_t) 4),
42 fRnrFrame (kTRUE),
43 fTrans (kFALSE),
44 fRTS (1)
45{}
46
47TPCSectorViz::~TPCSectorViz()
48{
49 if(fTPCData) fTPCData->DecRefCount();
50}
51
52/**************************************************************************/
53
092578a7 54void TPCSectorViz::SetDataSource(TPCData* data)
55{
56 if(data == fTPCData) return;
57 if(fTPCData) fTPCData->DecRefCount();
58 fTPCData = data;
59 if(fTPCData) fTPCData->IncRefCount();
60 IncRTS();
61}
62
63void TPCSectorViz::SetSectorID(Int_t segment)
64{
65 if(segment < 0 ) segment = 0;
66 if(segment > 35) segment = 35;
67 fSectorID = segment;
68 IncRTS();
69}
70
71TPCSectorData* TPCSectorViz::GetSectorData() const
72{
73 return fTPCData ? fTPCData->GetSectorData(fSectorID) : 0;
74}
75
76/**************************************************************************/
77
78void TPCSectorViz::SetTrans(Bool_t trans)
79{
80 fTrans = trans;
81 if(fTrans) {
82 for (Int_t k=0; k<16; ++k)
83 fMatrix[k] = 0.;
84
85 using namespace TMath;
86 Float_t c = Cos((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
87 Float_t s = Sin((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
88 Float_t z = TPCSectorData::GetParam().GetZLength();
89 if(fSectorID >= 18) z = -z;
90
91 // column major
92 fMatrix[0] = -c;
93 fMatrix[1] = -s;
94 fMatrix[4] = -s;
95 fMatrix[5] = c;
96 fMatrix[10] = -1;
97 fMatrix[14] = z;
98 fMatrix[15] = 1;
99 }
100}
101
102/**************************************************************************/
103
104void TPCSectorViz::SetupColor(Int_t val, UChar_t* pixel) const
105{
106 using namespace TMath;
107 Float_t div = Max(1, fMaxVal - fThreshold);
108 Int_t nCol = gStyle->GetNumberOfColors();
109 Int_t cBin = (Int_t) Nint(nCol*(val - fThreshold)/div);
110
111 ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
112}