]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | ||
10 | #include "AliEveTPCSector2D.h" | |
11 | #include "AliEveTPCSector3D.h" | |
12 | ||
13 | #include <EveDet/AliEveTPCSectorData.h> | |
14 | ||
15 | #include <TEveTrans.h> | |
16 | ||
17 | #include <TBuffer3D.h> | |
18 | #include <TBuffer3DTypes.h> | |
19 | #include <TVirtualPad.h> | |
20 | #include <TVirtualViewer3D.h> | |
21 | ||
22 | #include <TH1S.h> | |
23 | #include <TH2S.h> | |
24 | #include <TVirtualPad.h> | |
25 | ||
26 | //============================================================================== | |
27 | //============================================================================== | |
28 | // AliEveTPCSector2D | |
29 | //============================================================================== | |
30 | ||
31 | //______________________________________________________________________________ | |
32 | // | |
33 | // Displays TPC raw-data in 2D. | |
34 | // | |
35 | // fShowMax: true - display maximum value for given time interval | |
36 | // false - display integral | |
37 | // fAverage: only available when fShowMax = false; divide by time window width | |
38 | // | |
39 | // fUseTexture: use OpenGL textures to display data (fast rendering, | |
40 | // updates take the same time) | |
41 | // | |
42 | ||
43 | ClassImp(AliEveTPCSector2D) | |
44 | ||
45 | /******************************************************************************/ | |
46 | ||
47 | AliEveTPCSector2D::AliEveTPCSector2D(const Text_t* n, const Text_t* t) : | |
48 | AliEveTPCSectorViz(n,t), | |
49 | ||
50 | fShowMax (kTRUE), | |
51 | fAverage (kFALSE), | |
52 | ||
53 | fUseTexture (kTRUE), | |
54 | fPickEmpty (kFALSE), | |
55 | fPickMode (1) | |
56 | { | |
57 | // Constructor. | |
58 | } | |
59 | ||
60 | /******************************************************************************/ | |
61 | ||
62 | void AliEveTPCSector2D::MakeSector3D() | |
63 | { | |
64 | // Make a 3D sector with same setting as this one. | |
65 | // It is added as a child ot this object. | |
66 | ||
67 | AliEveTPCSector3D* s = new AliEveTPCSector3D; | |
68 | s->SetDataSource(fTPCData); | |
69 | s->SetSectorID(fSectorID); | |
70 | s->SetAutoTrans(fAutoTrans); | |
71 | s->CopyVizParams(this); | |
72 | AddElement(s); | |
73 | ElementChanged(kFALSE, kTRUE); | |
74 | } | |
75 | ||
76 | /******************************************************************************/ | |
77 | ||
78 | void AliEveTPCSector2D::ComputeBBox() | |
79 | { | |
80 | // Compute boundig-box. | |
81 | ||
82 | const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg(); | |
83 | const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg(); | |
84 | ||
85 | BBoxInit(); | |
86 | Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2; | |
87 | fBBox[0] = -w; | |
88 | fBBox[1] = w; | |
89 | fBBox[2] = iSeg.GetRLow(); | |
90 | fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight(); | |
91 | fBBox[4] = -0.5; // Fake z-width to 1 cm. | |
92 | fBBox[5] = 0.5; | |
93 | } | |
94 | ||
95 | /******************************************************************************/ | |
96 | ||
97 | void AliEveTPCSector2D::PadSelected(Int_t row, Int_t pad) | |
98 | { | |
99 | // Called when ctrl-mouse-left-click registered over a pad. | |
100 | ||
101 | // EVE -> Std convention | |
102 | Int_t sseg = fSectorID, srow = row; | |
103 | if (row >= AliEveTPCSectorData::GetInnSeg().GetNRows()) { | |
104 | sseg += 36; | |
105 | srow -= AliEveTPCSectorData::GetInnSeg().GetNRows(); | |
106 | } | |
107 | switch (fPickMode) | |
108 | { | |
109 | case 0: { | |
110 | printf("AliEveTPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n", | |
111 | sseg, srow, pad); | |
112 | break; | |
113 | } | |
114 | case 1: { | |
115 | AliEveTPCSectorData* sectorData = GetSectorData(); | |
116 | if (sectorData == 0) return; | |
117 | Int_t mint = fMinTime; | |
118 | Int_t maxt = fMaxTime; | |
119 | TH1S* h = new TH1S(Form("Seg%d_Row%d_TEvePad%d", sseg, srow, pad), | |
120 | Form("Segment %d, Row %d, TEvePad %d", sseg, srow, pad), | |
121 | maxt - mint +1 , mint, maxt); | |
122 | h->SetXTitle("Time"); | |
123 | h->SetYTitle("ADC"); | |
124 | AliEveTPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad); | |
125 | while (i.Next()) | |
126 | h->Fill(i.Time(), i.Signal()); | |
127 | h->Draw(); | |
128 | gPad->Modified(); | |
129 | gPad->Update(); | |
130 | break; | |
131 | } | |
132 | case 2: { | |
133 | AliEveTPCSectorData* sectorData = GetSectorData(); | |
134 | if (sectorData == 0) return; | |
135 | Int_t mint = fMinTime; | |
136 | Int_t maxt = fMaxTime; | |
137 | Int_t npad = AliEveTPCSectorData::GetNPadsInRow(row); | |
138 | TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow), | |
139 | Form("Segment %d, Row %d", sseg, srow), | |
140 | maxt - mint +1 , mint, maxt, | |
141 | npad, 0, npad - 1); | |
142 | h->SetXTitle("Time"); | |
143 | h->SetYTitle("TEvePad"); | |
144 | h->SetZTitle("ADC"); | |
145 | AliEveTPCSectorData::RowIterator i = sectorData->MakeRowIterator(row); | |
146 | while (i.NextPad()) | |
147 | while (i.Next()) | |
148 | h->Fill(i.Time(), i.TEvePad(), i.Signal()); | |
149 | h->Draw(); | |
150 | gPad->Modified(); | |
151 | gPad->Update(); | |
152 | break; | |
153 | } | |
154 | } // switch | |
155 | } | |
156 | ||
157 | /******************************************************************************/ | |
158 | ||
159 | void AliEveTPCSector2D::Paint(Option_t* ) | |
160 | { | |
161 | // Paint object. | |
162 | ||
163 | if(fRnrSelf == kFALSE) | |
164 | return; | |
165 | ||
166 | TBuffer3D buffer(TBuffer3DTypes::kGeneric); | |
167 | ||
168 | // Section kCore | |
169 | buffer.fID = this; | |
170 | buffer.fColor = GetMainColor(); | |
171 | buffer.fTransparency = GetMainTransparency(); | |
172 | if (HasMainTrans()) RefMainTrans().SetBuffer3D(buffer); | |
173 | buffer.SetSectionsValid(TBuffer3D::kCore); | |
174 | ||
175 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); | |
176 | if (reqSections == TBuffer3D::kNone) { | |
177 | return; | |
178 | } | |
179 | ||
180 | Error("AliEveTPCSector2D::Paint", "only direct OpenGL rendering supported."); | |
181 | } |