]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSector3D.cxx
Merge from EVE-dev to HEAD.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector3D.cxx
CommitLineData
092578a7 1// $Header$
2
3#include "TPCSector3D.h"
4#include <Alieve/TPCSectorData.h>
5
6using namespace Reve;
7using namespace Alieve;
8
9//______________________________________________________________________
10// TPCSector3D
11//
12
13ClassImp(TPCSector3D)
14
15TPCSector3D::TPCSector3D(const Text_t* n, const Text_t* t) :
16 TPCSectorViz(n, t),
17
18 fBoxSet (n, t),
19 fDriftVel (1),
20 fZStep (250.0/450)
21{
22 fRnrFrame = false;
23 MakeFrameBox();
24 ComputeBBox();
25}
26
27TPCSector3D::~TPCSector3D()
28{}
29
30/**************************************************************************/
31
32UInt_t TPCSector3D::IncRTS()
33{
34 UpdateBoxes();
35 return ++fRTS;
36}
37
38void TPCSector3D::SetRnrFrame(Bool_t rf)
39{
40 if(fRnrFrame != rf) {
41 fRnrFrame = rf;
42 IncRTS();
43 }
44}
45
46/**************************************************************************/
47
48void TPCSector3D::ComputeBBox()
49{
50 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
51 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
52
53 bbox_init();
54 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
55 fBBox[0] = -w;
56 fBBox[1] = w;
57 fBBox[2] = iSeg.GetRLow();
58 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
59 fBBox[4] = -0.5;
60 fBBox[5] = 250.5;
61 dynamic_cast<TAttBBox&>(fBoxSet) = dynamic_cast<TAttBBox&>(*this);
62}
63
64void TPCSector3D::Paint(Option_t* option)
65{
66 if(fRnrElement)
67 fBoxSet.Paint(option);
68}
69
70/**************************************************************************/
71
72void TPCSector3D::MakeFrameBox()
73{
74 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
75 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
76
77 Float_t x1, x2, y1, y2, D;
78 x1 = 0.5*TPCSectorData::GetNPadsInRow(0)*iSeg.GetPadWidth();
79 x2 = 0.5*o2Seg.GetNMaxPads()*o2Seg.GetPadWidth();
80 y1 = iSeg.GetRLow();
81 y2 = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
82 D = 0.5*fZStep;
83
84 ColorFromIdx(fFrameColor, fFrameBox.color);
85 Float_t* p = fFrameBox.vertices;
86 // bottom
87 p[0] = -x1; p[1] = y1; p[2] = -D; p += 3;
88 p[0] = x1; p[1] = y1; p[2] = -D; p += 3;
89 p[0] = x2; p[1] = y2; p[2] = -D; p += 3;
90 p[0] = -x2; p[1] = y2; p[2] = -D; p += 3;
91 // top
92 p[0] = -x1; p[1] = y1; p[2] = D; p += 3;
93 p[0] = x1; p[1] = y1; p[2] = D; p += 3;
94 p[0] = x2; p[1] = y2; p[2] = D; p += 3;
95 p[0] = -x2; p[1] = y2; p[2] = D; p += 3;
96}
97
98/**************************************************************************/
99
100void TPCSector3D::LoadPadrow(TPCSectorData::RowIterator& iter,
101 Float_t xs, Float_t ys, Float_t pw, Float_t ph)
102{
103 Short_t pad, time, val;
104 Float_t x0, x1, z0, z1;
105 Float_t ye = ys + ph;
106
107 while (iter.NextPad()) {
108 pad = iter.Pad();
109 while (iter.Next()) {
110 time = iter.Time();
111 val = iter.Signal();
112
113 if(val <= fThreshold || time < fMinTime || time > fMaxTime)
114 continue;
115
116 fBoxSet.fBoxes.push_back(Reve::Box());
117 SetupColor(val, fBoxSet.fBoxes.back().color);
118 x0 = xs + pad*pw;
119 x1 = x0 + pw;
120 z0 = fZStep*time/fDriftVel;
121 z1 = z0 + fZStep/fDriftVel;
122 Float_t* p = fBoxSet.fBoxes.back().vertices;
123 // front
124 p[0] = x0; p[1] = ys; p[2] = z0; p += 3;
125 p[0] = x1; p[1] = ys; p[2] = z0; p += 3;
126 p[0] = x1; p[1] = ye; p[2] = z0; p += 3;
127 p[0] = x0; p[1] = ye; p[2] = z0; p += 3;
128 // back
129 z0 += fZStep;
130 p[0] = x0; p[1] = ys; p[2] = z0; p += 3;
131 p[0] = x1; p[1] = ys; p[2] = z0; p += 3;
132 p[0] = x1; p[1] = ye; p[2] = z0; p += 3;
133 p[0] = x0; p[1] = ye; p[2] = z0;
134 }
135 }
136}
137
138void TPCSector3D::UpdateBoxes()
139{
140 // Populate parent class Reve::BoxSet with digit information.
141
142 // printf("TPCSector3D update boxes\n");
143
144 fBoxSet.ClearSet();
145
146 TPCSectorData* data = GetSectorData();
147 if (data != 0) {
148 Bool_t isOn[3];
149 isOn[0] = fRnrInn;
150 isOn[1] = fRnrOut1;
151 isOn[2] = fRnrOut2;
152
153 // Loop over 3 main segments
154 for (Int_t sId = 0; sId <= 2; ++sId) {
155 if(isOn[sId] == kFALSE)
156 continue;
157 const TPCSectorData::SegmentInfo& sInfo = TPCSectorData::GetSeg(sId);
158 Float_t sy = sInfo.GetRLow();
159 for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) {
160 TPCSectorData::RowIterator i = data->MakeRowIterator(row);
161 Float_t sx = -0.5*TPCSectorData::GetNPadsInRow(row)*sInfo.GetPadWidth();
162 LoadPadrow(i, sx, sy, sInfo.GetPadWidth(), sInfo.GetPadHeight());
163 sy += sInfo.GetPadHeight();
164 }
165 }
166 }
167
168 if(fRnrFrame)
169 fBoxSet.fBoxes.push_back(fFrameBox);
170}