]>
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 | //______________________________________________________________________________ |
092578a7 | 23 | // |
a97abca8 | 24 | // Visualization of TPC raw-data in 3D. |
092578a7 | 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 | { | |
a97abca8 | 42 | // Constructor. |
43 | ||
8ac84a96 | 44 | fRnrFrame = kFALSE; |
092578a7 | 45 | ComputeBBox(); |
46 | } | |
47 | ||
57ffa5fb | 48 | /******************************************************************************/ |
092578a7 | 49 | |
d810d0de | 50 | void AliEveTPCSector3D::SetRnrFrame(Bool_t rf) |
092578a7 | 51 | { |
a97abca8 | 52 | // Setter for fRnrFrame. |
53 | ||
092578a7 | 54 | if(fRnrFrame != rf) { |
55 | fRnrFrame = rf; | |
56 | IncRTS(); | |
57 | } | |
58 | } | |
59 | ||
57ffa5fb | 60 | /******************************************************************************/ |
092578a7 | 61 | |
d810d0de | 62 | void AliEveTPCSector3D::ComputeBBox() |
092578a7 | 63 | { |
a97abca8 | 64 | // Compute bounding box containing whole sector. |
65 | ||
d810d0de | 66 | const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg(); |
67 | const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg(); | |
092578a7 | 68 | |
606c4ed7 | 69 | BBoxInit(); |
32e219c2 | 70 | |
8ac84a96 | 71 | Float_t w = 0.5*o2Seg.GetNMaxPads()*o2Seg.GetPadWidth(); |
092578a7 | 72 | fBBox[0] = -w; |
73 | fBBox[1] = w; | |
74 | fBBox[2] = iSeg.GetRLow(); | |
75 | fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight(); | |
1a351260 | 76 | fBBox[4] = 0; |
d810d0de | 77 | fBBox[5] = AliEveTPCSectorData::GetZLength(); |
66e0d878 | 78 | Float_t* b = fBoxSet.AssertBBox(); |
79 | for(Int_t i=0; i<6; ++i) { b[i] = fBBox[i]; } | |
80 | ||
092578a7 | 81 | } |
82 | ||
d810d0de | 83 | void AliEveTPCSector3D::Paint(Option_t* /*option*/) |
092578a7 | 84 | { |
a97abca8 | 85 | // Paint object. |
86 | ||
2caed564 | 87 | if(fRnrSelf == kFALSE) |
8ac84a96 | 88 | return; |
89 | ||
90 | TBuffer3D buffer(TBuffer3DTypes::kGeneric); | |
91 | ||
92 | // Section kCore | |
93 | buffer.fID = this; | |
94 | buffer.fColor = 1; | |
95 | buffer.fTransparency = 0; | |
601bca51 | 96 | fHMTrans.SetBuffer3D(buffer); |
8ac84a96 | 97 | buffer.SetSectionsValid(TBuffer3D::kCore); |
51346b82 | 98 | |
8ac84a96 | 99 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); |
100 | if (reqSections == TBuffer3D::kNone) { | |
101 | return; | |
5987168b | 102 | } |
092578a7 | 103 | |
d810d0de | 104 | Error("AliEveTPCSector3D::Paint", "only direct OpenGL rendering supported."); |
8ac84a96 | 105 | return; |
092578a7 | 106 | } |
107 | ||
57ffa5fb | 108 | /******************************************************************************/ |
092578a7 | 109 | |
d810d0de | 110 | void AliEveTPCSector3D::LoadPadrow(AliEveTPCSectorData::RowIterator& iter, |
51346b82 | 111 | Float_t xs, Float_t ys, Float_t pw, Float_t ph) |
092578a7 | 112 | { |
a97abca8 | 113 | // Load data of one padrow. Fill internal boxset and pointset objects. |
114 | ||
092578a7 | 115 | Short_t pad, time, val; |
32e219c2 | 116 | Float_t x0, z0; |
9a7ad6a0 | 117 | Float_t ym = ys + 0.5*ph; |
9a7ad6a0 | 118 | Float_t zs = fZStep/fDriftVel; |
092578a7 | 119 | |
32e219c2 | 120 | while (iter.NextPad()) |
121 | { | |
84aff7a4 | 122 | pad = iter.TEvePad(); |
32e219c2 | 123 | while (iter.Next()) |
124 | { | |
092578a7 | 125 | time = iter.Time(); |
126 | val = iter.Signal(); | |
127 | ||
128 | if(val <= fThreshold || time < fMinTime || time > fMaxTime) | |
129 | continue; | |
130 | ||
32e219c2 | 131 | if(fPointSetOn && val <= fPointSetMaxVal) |
132 | { | |
dcb387f7 | 133 | fPointSetArray.Fill(xs + (pad+0.5)*pw, ym, (time+0.5)*zs, val); |
32e219c2 | 134 | } |
135 | else | |
136 | { | |
9a7ad6a0 | 137 | x0 = xs + pad*pw; |
9a7ad6a0 | 138 | z0 = time*zs; |
32e219c2 | 139 | fBoxSet.AddBox(x0, ys, z0, pw, ph, zs); |
140 | fBoxSet.DigitColor(ColorFromArray(val)); | |
9a7ad6a0 | 141 | } |
092578a7 | 142 | } |
143 | } | |
144 | } | |
145 | ||
a97abca8 | 146 | void AliEveTPCSector3D::UpdateBoxesAndPoints() |
092578a7 | 147 | { |
a97abca8 | 148 | // Populate BoxSet and PointSet with digit information. |
092578a7 | 149 | |
d810d0de | 150 | // printf("AliEveTPCSector3D update boxes\n"); |
092578a7 | 151 | |
84aff7a4 | 152 | fBoxSet.Reset(TEveBoxSet::kBT_AABox, kTRUE, 16384); |
dcb387f7 | 153 | fPointSetArray.RemoveElements(); |
092578a7 | 154 | |
d810d0de | 155 | AliEveTPCSectorData* data = GetSectorData(); |
092578a7 | 156 | if (data != 0) { |
157 | Bool_t isOn[3]; | |
158 | isOn[0] = fRnrInn; | |
159 | isOn[1] = fRnrOut1; | |
160 | isOn[2] = fRnrOut2; | |
161 | ||
8ac84a96 | 162 | SetupColorArray(); |
9a7ad6a0 | 163 | SetupPointSetArray(); |
8ac84a96 | 164 | |
092578a7 | 165 | // Loop over 3 main segments |
166 | for (Int_t sId = 0; sId <= 2; ++sId) { | |
167 | if(isOn[sId] == kFALSE) | |
168 | continue; | |
d810d0de | 169 | const AliEveTPCSectorData::SegmentInfo& sInfo = AliEveTPCSectorData::GetSeg(sId); |
092578a7 | 170 | Float_t sy = sInfo.GetRLow(); |
171 | for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) { | |
d810d0de | 172 | AliEveTPCSectorData::RowIterator i = data->MakeRowIterator(row); |
173 | Float_t sx = -0.5*AliEveTPCSectorData::GetNPadsInRow(row)*sInfo.GetPadWidth(); | |
092578a7 | 174 | LoadPadrow(i, sx, sy, sInfo.GetPadWidth(), sInfo.GetPadHeight()); |
175 | sy += sInfo.GetPadHeight(); | |
176 | } | |
177 | } | |
9a7ad6a0 | 178 | |
32e219c2 | 179 | fBoxSet.RefitPlex(); |
a97abca8 | 180 | if (fPointSetOn) |
9a7ad6a0 | 181 | fPointSetArray.CloseBins(); |
182 | } | |
183 | } | |
184 | ||
d810d0de | 185 | void AliEveTPCSector3D::SetupPointSetArray() |
9a7ad6a0 | 186 | { |
a97abca8 | 187 | // Setup fPointSetArray for current settings. |
188 | ||
189 | Int_t nBins = (Int_t) TMath::Nint(fPointFrac*gStyle->GetNumberOfColors()); | |
190 | if (nBins > 0) { | |
9a7ad6a0 | 191 | fPointSetOn = kTRUE; |
192 | fPointSetMaxVal = fThreshold + (Int_t) TMath::Nint(fPointFrac*(fMaxVal - fThreshold)); | |
193 | // printf("SetupPointSetArray frac=%f nbins=%d psmv=%d (%d,%d)\n", fPointFrac, nBins, fPointSetMaxVal, fThreshold, fMaxVal); | |
dcb387f7 | 194 | fPointSetArray.InitBins("", nBins, fThreshold, fPointSetMaxVal, kFALSE); |
a97abca8 | 195 | for (Int_t b=0; b<nBins; ++b) { |
9a7ad6a0 | 196 | fPointSetArray.GetBin(b)->SetMarkerColor(gStyle->GetColorPalette(b)); |
197 | } | |
198 | } else { | |
199 | fPointSetOn = kFALSE; | |
092578a7 | 200 | } |
092578a7 | 201 | } |