3 #include "TPCSector2D.h"
5 #include <Alieve/TPCData.h>
6 #include <Alieve/TPCSectorData.h>
8 #include <AliTPCParam.h>
10 #include <TBuffer3D.h>
11 #include <TBuffer3DTypes.h>
12 #include <TVirtualPad.h>
13 #include <TVirtualViewer3D.h>
17 #include <TVirtualPad.h>
20 using namespace Alieve;
23 //______________________________________________________________________
26 // Displays TPC raw-data in 2D.
28 // fShowMax: true - display maximum value for given time interval
29 // false - display integral
30 // fAverage: only available when fShowMax = false; divide by time window width
32 // fUseTexture: use OpenGL textures to display data (fast rendering,
33 // updates take the same time)
38 /**************************************************************************/
40 TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
51 TPCSector2D::~TPCSector2D()
54 /**************************************************************************/
56 void TPCSector2D::ComputeBBox()
58 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
59 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
61 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
66 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
69 fBBox[2] = iSeg.GetRLow();
70 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
71 fBBox[4] = -0.5; // Fake z-width to 1 cm.
75 /**************************************************************************/
77 void TPCSector2D::PadSelected(Int_t row, Int_t pad)
79 // Called when ctrl-mouse-left-click registered over a pad.
81 // EVE -> Std convention
82 Int_t sseg = fSectorID, srow = row;
83 if (row >= TPCSectorData::GetInnSeg().GetNRows()) {
85 srow -= TPCSectorData::GetInnSeg().GetNRows();
90 printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
95 TPCSectorData* sectorData = GetSectorData();
96 if (sectorData == 0) return;
97 Int_t mint = fMinTime;
98 Int_t maxt = fMaxTime;
99 TH1S* h = new TH1S(Form("Seg%d_Row%d_Pad%d", sseg, srow, pad),
100 Form("Segment %d, Row %d, Pad %d", sseg, srow, pad),
101 maxt - mint +1 , mint, maxt);
102 h->SetXTitle("Time");
104 TPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad);
106 h->Fill(i.Time(), i.Signal());
113 TPCSectorData* sectorData = GetSectorData();
114 if (sectorData == 0) return;
115 Int_t mint = fMinTime;
116 Int_t maxt = fMaxTime;
117 Int_t npad = TPCSectorData::GetNPadsInRow(row);
118 TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
119 Form("Segment %d, Row %d", sseg, srow),
120 maxt - mint +1 , mint, maxt,
122 h->SetXTitle("Time");
125 TPCSectorData::RowIterator i = sectorData->MakeRowIterator(row);
128 h->Fill(i.Time(), i.Pad(), i.Signal());
137 /**************************************************************************/
139 void TPCSector2D::Paint(Option_t* )
141 if(fRnrElement == kFALSE)
144 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
149 buffer.fTransparency = 0;
150 fHMTrans.SetBuffer3D(buffer);
151 buffer.SetSectionsValid(TBuffer3D::kCore);
153 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
154 if (reqSections == TBuffer3D::kNone) {
158 Error("TPCSector2D::Paint", "only direct OpenGL rendering supported.");