]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSector2D.cxx
Remove EVE/Reve/ sub-module.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2D.cxx
CommitLineData
b56d8877 1// $Header$
2
915dabe1 3#include "TPCSector2D.h"
32e219c2 4#include "TPCSector3D.h"
5a5a1232 5
915dabe1 6#include <Alieve/TPCData.h>
7#include <Alieve/TPCSectorData.h>
8
84aff7a4 9#include <TEveManager.h>
32e219c2 10
915dabe1 11#include <AliTPCParam.h>
5a5a1232 12
092578a7 13#include <TBuffer3D.h>
14#include <TBuffer3DTypes.h>
15#include <TVirtualPad.h>
16#include <TVirtualViewer3D.h>
17
96ff1952 18#include <TH1S.h>
19#include <TH2S.h>
20#include <TVirtualPad.h>
5a5a1232 21using namespace Alieve;
22using namespace std;
23
092578a7 24//______________________________________________________________________
25// TPCSector2D
26//
27// Displays TPC raw-data in 2D.
28//
29// fShowMax: true - display maximum value for given time interval
30// false - display integral
31// fAverage: only available when fShowMax = false; divide by time window width
32//
33// fUseTexture: use OpenGL textures to display data (fast rendering,
34// updates take the same time)
35//
36
2aef44c1 37ClassImp(TPCSector2D)
5a5a1232 38
39/**************************************************************************/
40
092578a7 41TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
42 TPCSectorViz(n,t),
b56d8877 43
092578a7 44 fShowMax (kTRUE),
45 fAverage (kFALSE),
915dabe1 46
a8600b56 47 fUseTexture (kTRUE),
48 fPickEmpty (kFALSE),
32e219c2 49 fPickMode (1)
092578a7 50{}
5a5a1232 51
915dabe1 52TPCSector2D::~TPCSector2D()
092578a7 53{}
5a5a1232 54
55/**************************************************************************/
56
32e219c2 57void TPCSector2D::MakeSector3D()
58{
59 TPCSector3D* s = new TPCSector3D;
60 s->SetDataSource(fTPCData);
61 s->SetSectorID(fSectorID);
62 s->SetAutoTrans(fAutoTrans);
84aff7a4 63 gEve->AddElement(s, this);
64 gEve->Redraw3D();
32e219c2 65}
66
67/**************************************************************************/
68
915dabe1 69void TPCSector2D::ComputeBBox()
5a5a1232 70{
915dabe1 71 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
72 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
5a5a1232 73
606c4ed7 74 BBoxInit();
915dabe1 75 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
76 fBBox[0] = -w;
77 fBBox[1] = w;
78 fBBox[2] = iSeg.GetRLow();
79 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
80 fBBox[4] = -0.5; // Fake z-width to 1 cm.
81 fBBox[5] = 0.5;
5a5a1232 82}
83
84/**************************************************************************/
85
96ff1952 86void TPCSector2D::PadSelected(Int_t row, Int_t pad)
87{
88 // Called when ctrl-mouse-left-click registered over a pad.
89
90 // EVE -> Std convention
91 Int_t sseg = fSectorID, srow = row;
92 if (row >= TPCSectorData::GetInnSeg().GetNRows()) {
6aa260e3 93 sseg += 36;
96ff1952 94 srow -= TPCSectorData::GetInnSeg().GetNRows();
95 }
96 switch (fPickMode)
97 {
98 case 0: {
99 printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
100 sseg, srow, pad);
101 break;
102 }
103 case 1: {
104 TPCSectorData* sectorData = GetSectorData();
105 if (sectorData == 0) return;
106 Int_t mint = fMinTime;
107 Int_t maxt = fMaxTime;
84aff7a4 108 TH1S* h = new TH1S(Form("Seg%d_Row%d_TEvePad%d", sseg, srow, pad),
109 Form("Segment %d, Row %d, TEvePad %d", sseg, srow, pad),
96ff1952 110 maxt - mint +1 , mint, maxt);
111 h->SetXTitle("Time");
112 h->SetYTitle("ADC");
113 TPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad);
114 while (i.Next())
115 h->Fill(i.Time(), i.Signal());
116 h->Draw();
117 gPad->Modified();
118 gPad->Update();
119 break;
120 }
121 case 2: {
122 TPCSectorData* sectorData = GetSectorData();
123 if (sectorData == 0) return;
124 Int_t mint = fMinTime;
125 Int_t maxt = fMaxTime;
126 Int_t npad = TPCSectorData::GetNPadsInRow(row);
127 TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
128 Form("Segment %d, Row %d", sseg, srow),
129 maxt - mint +1 , mint, maxt,
130 npad, 0, npad - 1);
131 h->SetXTitle("Time");
84aff7a4 132 h->SetYTitle("TEvePad");
96ff1952 133 h->SetZTitle("ADC");
134 TPCSectorData::RowIterator i = sectorData->MakeRowIterator(row);
135 while (i.NextPad())
136 while (i.Next())
84aff7a4 137 h->Fill(i.Time(), i.TEvePad(), i.Signal());
96ff1952 138 h->Draw();
139 gPad->Modified();
140 gPad->Update();
141 break;
142 }
143 } // switch
144}
145
146/**************************************************************************/
147
915dabe1 148void TPCSector2D::Paint(Option_t* )
5a5a1232 149{
2caed564 150 if(fRnrSelf == kFALSE)
092578a7 151 return;
152
5a5a1232 153 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
154
155 // Section kCore
156 buffer.fID = this;
157 buffer.fColor = 1;
158 buffer.fTransparency = 0;
601bca51 159 fHMTrans.SetBuffer3D(buffer);
5a5a1232 160 buffer.SetSectionsValid(TBuffer3D::kCore);
161
5a5a1232 162 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
163 if (reqSections == TBuffer3D::kNone) {
5a5a1232 164 return;
165 }
915dabe1 166
601bca51 167 Error("TPCSector2D::Paint", "only direct OpenGL rendering supported.");
5a5a1232 168}