3 #include "TPCSectorViz.h"
5 #include <Alieve/TPCData.h>
6 #include <Alieve/TPCSectorData.h>
7 #include <AliTPCParam.h>
13 using namespace Alieve;
15 //______________________________________________________________________
18 // Base class for TPC raw-data visualization.
19 // See TPCSector2D and TPCSector3D for concrete implementations.
21 ClassImp(TPCSectorViz)
23 /**************************************************************************/
25 TPCSectorViz::TPCSectorViz(const Text_t* n, const Text_t* t) :
26 Reve::RenderElement(fFrameColor),
41 fFrameColor ((Color_t) 4),
49 TPCSectorViz::~TPCSectorViz()
51 if(fTPCData) fTPCData->DecRefCount();
52 delete [] fColorArray;
55 void TPCSectorViz::CopyVizParams(const TPCSectorViz& v)
57 fMinTime = v.fMinTime;
58 fMaxTime = v.fMaxTime;
59 fThreshold = v.fThreshold;
63 fRnrOut1 = v.fRnrOut1;
64 fRnrOut2 = v.fRnrOut2;
67 /**************************************************************************/
69 void TPCSectorViz::SetDataSource(TPCData* data)
71 if(data == fTPCData) return;
72 if(fTPCData) fTPCData->DecRefCount();
74 if(fTPCData) fTPCData->IncRefCount();
78 void TPCSectorViz::SetSectorID(Int_t id)
84 SetAutoTrans(kTRUE); // Force repositioning.
88 TPCSectorData* TPCSectorViz::GetSectorData() const
90 return fTPCData ? fTPCData->GetSectorData(fSectorID) : 0;
93 /**************************************************************************/
95 void TPCSectorViz::SetThreshold(Short_t t)
97 fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1));
102 void TPCSectorViz::SetMaxVal(Int_t mv)
104 fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1));
109 /**************************************************************************/
111 void TPCSectorViz::SetAutoTrans(Bool_t trans)
115 fHMTrans.UnitTrans();
117 using namespace TMath;
118 Float_t c = Cos((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
119 Float_t s = Sin((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
120 Float_t z = TPCSectorData::GetZLength();
122 if(fSectorID >= 18) {
138 /**************************************************************************/
140 void TPCSectorViz::SetupColor(Int_t val, UChar_t* pixel) const
142 using namespace TMath;
143 Float_t div = Max(1, fMaxVal - fThreshold);
144 Int_t nCol = gStyle->GetNumberOfColors();
145 Int_t cBin = (Int_t) Nint(nCol*(val - fThreshold)/div);
147 ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
150 void TPCSectorViz::ClearColorArray()
153 delete [] fColorArray;
158 void TPCSectorViz::SetupColorArray() const
163 fColorArray = new UChar_t [4 * (fMaxVal - fThreshold + 1)];
164 UChar_t* p = fColorArray;
165 for(Int_t v=fThreshold; v<=fMaxVal; ++v, p+=4)