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