]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
b56d8877 | 3 | |
d810d0de | 4 | /************************************************************************** |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
5a5a1232 | 9 | |
d810d0de | 10 | #include "AliEveTPCSector2D.h" |
11 | #include "AliEveTPCSector3D.h" | |
12 | ||
cb4245bb | 13 | #include <EveDet/AliEveTPCSectorData.h> |
915dabe1 | 14 | |
a15e6d7d | 15 | #include <TEveTrans.h> |
5a5a1232 | 16 | |
092578a7 | 17 | #include <TBuffer3D.h> |
18 | #include <TBuffer3DTypes.h> | |
19 | #include <TVirtualPad.h> | |
20 | #include <TVirtualViewer3D.h> | |
21 | ||
96ff1952 | 22 | #include <TH1S.h> |
23 | #include <TH2S.h> | |
24 | #include <TVirtualPad.h> | |
d810d0de | 25 | |
a15e6d7d | 26 | //============================================================================== |
27 | //============================================================================== | |
28 | // AliEveTPCSector2D | |
29 | //============================================================================== | |
5a5a1232 | 30 | |
57ffa5fb | 31 | //______________________________________________________________________________ |
092578a7 | 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 | ||
d810d0de | 43 | ClassImp(AliEveTPCSector2D) |
5a5a1232 | 44 | |
57ffa5fb | 45 | /******************************************************************************/ |
5a5a1232 | 46 | |
d810d0de | 47 | AliEveTPCSector2D::AliEveTPCSector2D(const Text_t* n, const Text_t* t) : |
48 | AliEveTPCSectorViz(n,t), | |
b56d8877 | 49 | |
092578a7 | 50 | fShowMax (kTRUE), |
51 | fAverage (kFALSE), | |
915dabe1 | 52 | |
a8600b56 | 53 | fUseTexture (kTRUE), |
54 | fPickEmpty (kFALSE), | |
32e219c2 | 55 | fPickMode (1) |
a97abca8 | 56 | { |
57 | // Constructor. | |
58 | } | |
5a5a1232 | 59 | |
57ffa5fb | 60 | /******************************************************************************/ |
5a5a1232 | 61 | |
d810d0de | 62 | void AliEveTPCSector2D::MakeSector3D() |
32e219c2 | 63 | { |
a97abca8 | 64 | // Make a 3D sector with same setting as this one. |
65 | // It is added as a child ot this object. | |
66 | ||
d810d0de | 67 | AliEveTPCSector3D* s = new AliEveTPCSector3D; |
32e219c2 | 68 | s->SetDataSource(fTPCData); |
69 | s->SetSectorID(fSectorID); | |
70 | s->SetAutoTrans(fAutoTrans); | |
5aec5309 | 71 | s->CopyVizParams(this); |
a15e6d7d | 72 | AddElement(s); |
73 | ElementChanged(kFALSE, kTRUE); | |
32e219c2 | 74 | } |
75 | ||
57ffa5fb | 76 | /******************************************************************************/ |
32e219c2 | 77 | |
d810d0de | 78 | void AliEveTPCSector2D::ComputeBBox() |
5a5a1232 | 79 | { |
a97abca8 | 80 | // Compute boundig-box. |
81 | ||
d810d0de | 82 | const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg(); |
83 | const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg(); | |
5a5a1232 | 84 | |
606c4ed7 | 85 | BBoxInit(); |
915dabe1 | 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; | |
5a5a1232 | 93 | } |
94 | ||
57ffa5fb | 95 | /******************************************************************************/ |
5a5a1232 | 96 | |
d810d0de | 97 | void AliEveTPCSector2D::PadSelected(Int_t row, Int_t pad) |
96ff1952 | 98 | { |
99 | // Called when ctrl-mouse-left-click registered over a pad. | |
100 | ||
101 | // EVE -> Std convention | |
102 | Int_t sseg = fSectorID, srow = row; | |
d810d0de | 103 | if (row >= AliEveTPCSectorData::GetInnSeg().GetNRows()) { |
6aa260e3 | 104 | sseg += 36; |
d810d0de | 105 | srow -= AliEveTPCSectorData::GetInnSeg().GetNRows(); |
96ff1952 | 106 | } |
107 | switch (fPickMode) | |
108 | { | |
109 | case 0: { | |
d810d0de | 110 | printf("AliEveTPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n", |
96ff1952 | 111 | sseg, srow, pad); |
112 | break; | |
113 | } | |
114 | case 1: { | |
d810d0de | 115 | AliEveTPCSectorData* sectorData = GetSectorData(); |
96ff1952 | 116 | if (sectorData == 0) return; |
117 | Int_t mint = fMinTime; | |
118 | Int_t maxt = fMaxTime; | |
84aff7a4 | 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), | |
96ff1952 | 121 | maxt - mint +1 , mint, maxt); |
122 | h->SetXTitle("Time"); | |
123 | h->SetYTitle("ADC"); | |
d810d0de | 124 | AliEveTPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad); |
96ff1952 | 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: { | |
d810d0de | 133 | AliEveTPCSectorData* sectorData = GetSectorData(); |
96ff1952 | 134 | if (sectorData == 0) return; |
135 | Int_t mint = fMinTime; | |
136 | Int_t maxt = fMaxTime; | |
d810d0de | 137 | Int_t npad = AliEveTPCSectorData::GetNPadsInRow(row); |
96ff1952 | 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"); | |
84aff7a4 | 143 | h->SetYTitle("TEvePad"); |
96ff1952 | 144 | h->SetZTitle("ADC"); |
d810d0de | 145 | AliEveTPCSectorData::RowIterator i = sectorData->MakeRowIterator(row); |
96ff1952 | 146 | while (i.NextPad()) |
147 | while (i.Next()) | |
84aff7a4 | 148 | h->Fill(i.Time(), i.TEvePad(), i.Signal()); |
96ff1952 | 149 | h->Draw(); |
150 | gPad->Modified(); | |
151 | gPad->Update(); | |
152 | break; | |
153 | } | |
154 | } // switch | |
155 | } | |
156 | ||
57ffa5fb | 157 | /******************************************************************************/ |
96ff1952 | 158 | |
d810d0de | 159 | void AliEveTPCSector2D::Paint(Option_t* ) |
5a5a1232 | 160 | { |
a97abca8 | 161 | // Paint object. |
162 | ||
2caed564 | 163 | if(fRnrSelf == kFALSE) |
092578a7 | 164 | return; |
165 | ||
5a5a1232 | 166 | TBuffer3D buffer(TBuffer3DTypes::kGeneric); |
167 | ||
168 | // Section kCore | |
169 | buffer.fID = this; | |
68ca2fe7 | 170 | buffer.fColor = GetMainColor(); |
171 | buffer.fTransparency = GetMainTransparency(); | |
a15e6d7d | 172 | if (HasMainTrans()) RefMainTrans().SetBuffer3D(buffer); |
5a5a1232 | 173 | buffer.SetSectionsValid(TBuffer3D::kCore); |
51346b82 | 174 | |
5a5a1232 | 175 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); |
176 | if (reqSections == TBuffer3D::kNone) { | |
5a5a1232 | 177 | return; |
178 | } | |
915dabe1 | 179 | |
d810d0de | 180 | Error("AliEveTPCSector2D::Paint", "only direct OpenGL rendering supported."); |
5a5a1232 | 181 | } |