]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
092578a7 | 3 | |
d810d0de | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
9 | ||
10 | #include "AliEveTPCSector3D.h" | |
cb4245bb | 11 | #include <EveDet/AliEveTPCSectorData.h> |
092578a7 | 12 | |
8ac84a96 | 13 | #include <TBuffer3D.h> |
14 | #include <TBuffer3DTypes.h> | |
15 | #include <TVirtualPad.h> | |
16 | #include <TVirtualViewer3D.h> | |
17 | ||
9a7ad6a0 | 18 | #include <TStyle.h> |
19 | #include <TColor.h> | |
d810d0de | 20 | |
092578a7 | 21 | |
57ffa5fb | 22 | //______________________________________________________________________________ |
d810d0de | 23 | // AliEveTPCSector3D |
092578a7 | 24 | // |
25 | ||
d810d0de | 26 | ClassImp(AliEveTPCSector3D) |
092578a7 | 27 | |
d810d0de | 28 | AliEveTPCSector3D::AliEveTPCSector3D(const Text_t* n, const Text_t* t) : |
29 | AliEveTPCSectorViz(n, t), | |
9a7ad6a0 | 30 | |
31 | fBoxSet (n, t), | |
32 | fPointSetArray(n, t), | |
33 | fPointFrac (0.25), | |
1a351260 | 34 | fPointSize (3), |
092578a7 | 35 | |
265ecb21 | 36 | fPointSetOn (0), |
37 | fPointSetMaxVal (0), | |
38 | ||
092578a7 | 39 | fDriftVel (1), |
40 | fZStep (250.0/450) | |
41 | { | |
8ac84a96 | 42 | fRnrFrame = kFALSE; |
092578a7 | 43 | ComputeBBox(); |
44 | } | |
45 | ||
d810d0de | 46 | AliEveTPCSector3D::~AliEveTPCSector3D() |
092578a7 | 47 | {} |
48 | ||
57ffa5fb | 49 | /******************************************************************************/ |
092578a7 | 50 | |
d810d0de | 51 | void AliEveTPCSector3D::SetRnrFrame(Bool_t rf) |
092578a7 | 52 | { |
53 | if(fRnrFrame != rf) { | |
54 | fRnrFrame = rf; | |
55 | IncRTS(); | |
56 | } | |
57 | } | |
58 | ||
57ffa5fb | 59 | /******************************************************************************/ |
092578a7 | 60 | |
d810d0de | 61 | void AliEveTPCSector3D::ComputeBBox() |
092578a7 | 62 | { |
d810d0de | 63 | const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg(); |
64 | const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg(); | |
092578a7 | 65 | |
606c4ed7 | 66 | BBoxInit(); |
32e219c2 | 67 | |
8ac84a96 | 68 | Float_t w = 0.5*o2Seg.GetNMaxPads()*o2Seg.GetPadWidth(); |
092578a7 | 69 | fBBox[0] = -w; |
70 | fBBox[1] = w; | |
71 | fBBox[2] = iSeg.GetRLow(); | |
72 | fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight(); | |
1a351260 | 73 | fBBox[4] = 0; |
d810d0de | 74 | fBBox[5] = AliEveTPCSectorData::GetZLength(); |
66e0d878 | 75 | Float_t* b = fBoxSet.AssertBBox(); |
76 | for(Int_t i=0; i<6; ++i) { b[i] = fBBox[i]; } | |
77 | ||
092578a7 | 78 | } |
79 | ||
d810d0de | 80 | void AliEveTPCSector3D::Paint(Option_t* /*option*/) |
092578a7 | 81 | { |
2caed564 | 82 | if(fRnrSelf == kFALSE) |
8ac84a96 | 83 | return; |
84 | ||
85 | TBuffer3D buffer(TBuffer3DTypes::kGeneric); | |
86 | ||
87 | // Section kCore | |
88 | buffer.fID = this; | |
89 | buffer.fColor = 1; | |
90 | buffer.fTransparency = 0; | |
601bca51 | 91 | fHMTrans.SetBuffer3D(buffer); |
8ac84a96 | 92 | buffer.SetSectionsValid(TBuffer3D::kCore); |
51346b82 | 93 | |
8ac84a96 | 94 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); |
95 | if (reqSections == TBuffer3D::kNone) { | |
96 | return; | |
5987168b | 97 | } |
092578a7 | 98 | |
d810d0de | 99 | Error("AliEveTPCSector3D::Paint", "only direct OpenGL rendering supported."); |
8ac84a96 | 100 | return; |
092578a7 | 101 | } |
102 | ||
57ffa5fb | 103 | /******************************************************************************/ |
092578a7 | 104 | |
d810d0de | 105 | void AliEveTPCSector3D::LoadPadrow(AliEveTPCSectorData::RowIterator& iter, |
51346b82 | 106 | Float_t xs, Float_t ys, Float_t pw, Float_t ph) |
092578a7 | 107 | { |
108 | Short_t pad, time, val; | |
32e219c2 | 109 | Float_t x0, z0; |
9a7ad6a0 | 110 | Float_t ym = ys + 0.5*ph; |
9a7ad6a0 | 111 | Float_t zs = fZStep/fDriftVel; |
092578a7 | 112 | |
32e219c2 | 113 | while (iter.NextPad()) |
114 | { | |
84aff7a4 | 115 | pad = iter.TEvePad(); |
32e219c2 | 116 | while (iter.Next()) |
117 | { | |
092578a7 | 118 | time = iter.Time(); |
119 | val = iter.Signal(); | |
120 | ||
121 | if(val <= fThreshold || time < fMinTime || time > fMaxTime) | |
122 | continue; | |
123 | ||
32e219c2 | 124 | if(fPointSetOn && val <= fPointSetMaxVal) |
125 | { | |
dcb387f7 | 126 | fPointSetArray.Fill(xs + (pad+0.5)*pw, ym, (time+0.5)*zs, val); |
32e219c2 | 127 | } |
128 | else | |
129 | { | |
9a7ad6a0 | 130 | x0 = xs + pad*pw; |
9a7ad6a0 | 131 | z0 = time*zs; |
32e219c2 | 132 | fBoxSet.AddBox(x0, ys, z0, pw, ph, zs); |
133 | fBoxSet.DigitColor(ColorFromArray(val)); | |
9a7ad6a0 | 134 | } |
092578a7 | 135 | } |
136 | } | |
137 | } | |
138 | ||
d810d0de | 139 | void AliEveTPCSector3D::UpdateBoxes() |
092578a7 | 140 | { |
84aff7a4 | 141 | // Populate parent class TEveBoxSet with digit information. |
092578a7 | 142 | |
d810d0de | 143 | // printf("AliEveTPCSector3D update boxes\n"); |
092578a7 | 144 | |
84aff7a4 | 145 | fBoxSet.Reset(TEveBoxSet::kBT_AABox, kTRUE, 16384); |
dcb387f7 | 146 | fPointSetArray.RemoveElements(); |
092578a7 | 147 | |
d810d0de | 148 | AliEveTPCSectorData* data = GetSectorData(); |
092578a7 | 149 | if (data != 0) { |
150 | Bool_t isOn[3]; | |
151 | isOn[0] = fRnrInn; | |
152 | isOn[1] = fRnrOut1; | |
153 | isOn[2] = fRnrOut2; | |
154 | ||
8ac84a96 | 155 | SetupColorArray(); |
9a7ad6a0 | 156 | SetupPointSetArray(); |
8ac84a96 | 157 | |
092578a7 | 158 | // Loop over 3 main segments |
159 | for (Int_t sId = 0; sId <= 2; ++sId) { | |
160 | if(isOn[sId] == kFALSE) | |
161 | continue; | |
d810d0de | 162 | const AliEveTPCSectorData::SegmentInfo& sInfo = AliEveTPCSectorData::GetSeg(sId); |
092578a7 | 163 | Float_t sy = sInfo.GetRLow(); |
164 | for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) { | |
d810d0de | 165 | AliEveTPCSectorData::RowIterator i = data->MakeRowIterator(row); |
166 | Float_t sx = -0.5*AliEveTPCSectorData::GetNPadsInRow(row)*sInfo.GetPadWidth(); | |
092578a7 | 167 | LoadPadrow(i, sx, sy, sInfo.GetPadWidth(), sInfo.GetPadHeight()); |
168 | sy += sInfo.GetPadHeight(); | |
169 | } | |
170 | } | |
9a7ad6a0 | 171 | |
32e219c2 | 172 | fBoxSet.RefitPlex(); |
9a7ad6a0 | 173 | if(fPointSetOn) |
174 | fPointSetArray.CloseBins(); | |
175 | } | |
176 | } | |
177 | ||
d810d0de | 178 | void AliEveTPCSector3D::SetupPointSetArray() |
9a7ad6a0 | 179 | { |
180 | Int_t nBins = (Int_t) TMath::Nint(fPointFrac*gStyle->GetNumberOfColors()); | |
181 | if(nBins > 0) { | |
182 | fPointSetOn = kTRUE; | |
183 | fPointSetMaxVal = fThreshold + (Int_t) TMath::Nint(fPointFrac*(fMaxVal - fThreshold)); | |
184 | // printf("SetupPointSetArray frac=%f nbins=%d psmv=%d (%d,%d)\n", fPointFrac, nBins, fPointSetMaxVal, fThreshold, fMaxVal); | |
dcb387f7 | 185 | fPointSetArray.InitBins("", nBins, fThreshold, fPointSetMaxVal, kFALSE); |
9a7ad6a0 | 186 | for(Int_t b=0; b<nBins; ++b) { |
187 | fPointSetArray.GetBin(b)->SetMarkerColor(gStyle->GetColorPalette(b)); | |
188 | } | |
189 | } else { | |
190 | fPointSetOn = kFALSE; | |
092578a7 | 191 | } |
092578a7 | 192 | } |