3 #include "TPCSector3D.h"
4 #include <Alieve/TPCSectorData.h>
7 #include <TBuffer3DTypes.h>
8 #include <TVirtualPad.h>
9 #include <TVirtualViewer3D.h>
13 using namespace Alieve;
15 //______________________________________________________________________
21 TPCSector3D::TPCSector3D(const Text_t* n, const Text_t* t) :
39 TPCSector3D::~TPCSector3D()
42 /**************************************************************************/
44 void TPCSector3D::SetRnrFrame(Bool_t rf)
52 /**************************************************************************/
54 void TPCSector3D::ComputeBBox()
56 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
57 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
61 Float_t w = 0.5*o2Seg.GetNMaxPads()*o2Seg.GetPadWidth();
64 fBBox[2] = iSeg.GetRLow();
65 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
67 fBBox[5] = TPCSectorData::GetZLength();
68 Float_t* b = fBoxSet.AssertBBox();
69 for(Int_t i=0; i<6; ++i) { b[i] = fBBox[i]; }
73 void TPCSector3D::Paint(Option_t* /*option*/)
75 if(fRnrSelf == kFALSE)
78 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
83 buffer.fTransparency = 0;
84 fHMTrans.SetBuffer3D(buffer);
85 buffer.SetSectionsValid(TBuffer3D::kCore);
87 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
88 if (reqSections == TBuffer3D::kNone) {
92 Error("TPCSector3D::Paint", "only direct OpenGL rendering supported.");
96 /**************************************************************************/
98 void TPCSector3D::LoadPadrow(TPCSectorData::RowIterator& iter,
99 Float_t xs, Float_t ys, Float_t pw, Float_t ph)
101 Short_t pad, time, val;
103 Float_t ym = ys + 0.5*ph;
104 Float_t zs = fZStep/fDriftVel;
106 while (iter.NextPad())
108 pad = iter.TEvePad();
114 if(val <= fThreshold || time < fMinTime || time > fMaxTime)
117 if(fPointSetOn && val <= fPointSetMaxVal)
119 fPointSetArray.Fill(xs + (pad+0.5)*pw, ym, (time+0.5)*zs, val);
125 fBoxSet.AddBox(x0, ys, z0, pw, ph, zs);
126 fBoxSet.DigitColor(ColorFromArray(val));
132 void TPCSector3D::UpdateBoxes()
134 // Populate parent class TEveBoxSet with digit information.
136 // printf("TPCSector3D update boxes\n");
138 fBoxSet.Reset(TEveBoxSet::kBT_AABox, kTRUE, 16384);
139 fPointSetArray.RemoveElements();
141 TPCSectorData* data = GetSectorData();
149 SetupPointSetArray();
151 // Loop over 3 main segments
152 for (Int_t sId = 0; sId <= 2; ++sId) {
153 if(isOn[sId] == kFALSE)
155 const TPCSectorData::SegmentInfo& sInfo = TPCSectorData::GetSeg(sId);
156 Float_t sy = sInfo.GetRLow();
157 for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) {
158 TPCSectorData::RowIterator i = data->MakeRowIterator(row);
159 Float_t sx = -0.5*TPCSectorData::GetNPadsInRow(row)*sInfo.GetPadWidth();
160 LoadPadrow(i, sx, sy, sInfo.GetPadWidth(), sInfo.GetPadHeight());
161 sy += sInfo.GetPadHeight();
167 fPointSetArray.CloseBins();
171 void TPCSector3D::SetupPointSetArray()
173 Int_t nBins = (Int_t) TMath::Nint(fPointFrac*gStyle->GetNumberOfColors());
176 fPointSetMaxVal = fThreshold + (Int_t) TMath::Nint(fPointFrac*(fMaxVal - fThreshold));
177 // printf("SetupPointSetArray frac=%f nbins=%d psmv=%d (%d,%d)\n", fPointFrac, nBins, fPointSetMaxVal, fThreshold, fMaxVal);
178 fPointSetArray.InitBins("", nBins, fThreshold, fPointSetMaxVal, kFALSE);
179 for(Int_t b=0; b<nBins; ++b) {
180 fPointSetArray.GetBin(b)->SetMarkerColor(gStyle->GetColorPalette(b));
183 fPointSetOn = kFALSE;