3 #include "TPCSectorViz.h"
5 #include <Alieve/TPCData.h>
6 #include <Alieve/TPCSectorData.h>
7 #include <AliTPCParam.h>
11 using namespace Alieve;
13 //______________________________________________________________________
16 // Base class for TPC raw-data visualization.
17 // See TPCSector2D and TPCSector3D for concrete implementations.
19 ClassImp(TPCSectorViz)
21 /**************************************************************************/
23 TPCSectorViz::TPCSectorViz(const Text_t* n, const Text_t* t) :
24 TEveElement(fFrameColor),
39 fFrameColor ((Color_t) 4),
47 TPCSectorViz::~TPCSectorViz()
49 if(fTPCData) fTPCData->DecRefCount();
50 delete [] fColorArray;
53 void TPCSectorViz::CopyVizParams(const TPCSectorViz& v)
55 fMinTime = v.fMinTime;
56 fMaxTime = v.fMaxTime;
57 fThreshold = v.fThreshold;
61 fRnrOut1 = v.fRnrOut1;
62 fRnrOut2 = v.fRnrOut2;
65 /**************************************************************************/
67 void TPCSectorViz::SetDataSource(TPCData* data)
69 if(data == fTPCData) return;
70 if(fTPCData) fTPCData->DecRefCount();
72 if(fTPCData) fTPCData->IncRefCount();
76 void TPCSectorViz::SetSectorID(Int_t id)
82 SetAutoTrans(kTRUE); // Force repositioning.
86 TPCSectorData* TPCSectorViz::GetSectorData() const
88 return fTPCData ? fTPCData->GetSectorData(fSectorID) : 0;
91 /**************************************************************************/
93 void TPCSectorViz::SetThreshold(Short_t t)
95 fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1));
100 void TPCSectorViz::SetMaxVal(Int_t mv)
102 fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1));
107 /**************************************************************************/
109 void TPCSectorViz::SetAutoTrans(Bool_t trans)
113 fHMTrans.UnitTrans();
115 using namespace TMath;
116 Float_t c = Cos((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
117 Float_t s = Sin((fSectorID + 0.5)*20*Pi()/180 - PiOver2());
118 Float_t z = TPCSectorData::GetZLength();
120 if(fSectorID >= 18) {
136 /**************************************************************************/
138 void TPCSectorViz::SetupColor(Int_t val, UChar_t* pixel) const
140 using namespace TMath;
141 Float_t div = Max(1, fMaxVal - fThreshold);
142 Int_t nCol = gStyle->GetNumberOfColors();
143 Int_t cBin = (Int_t) Nint(nCol*(val - fThreshold)/div);
145 TEveUtil::ColorFromIdx(gStyle->GetColorPalette(Min(nCol - 1, cBin)), pixel);
148 void TPCSectorViz::ClearColorArray()
151 delete [] fColorArray;
156 void TPCSectorViz::SetupColorArray() const
161 fColorArray = new UChar_t [4 * (fMaxVal - fThreshold + 1)];
162 UChar_t* p = fColorArray;
163 for(Int_t v=fThreshold; v<=fMaxVal; ++v, p+=4)