]>
Commit | Line | Data |
---|---|---|
b56d8877 | 1 | // $Header$ |
2 | ||
915dabe1 | 3 | #include "TPCSector2D.h" |
5a5a1232 | 4 | |
915dabe1 | 5 | #include <Alieve/TPCData.h> |
6 | #include <Alieve/TPCSectorData.h> | |
7 | ||
8 | #include <AliTPCParam.h> | |
5a5a1232 | 9 | |
092578a7 | 10 | #include <TBuffer3D.h> |
11 | #include <TBuffer3DTypes.h> | |
12 | #include <TVirtualPad.h> | |
13 | #include <TVirtualViewer3D.h> | |
14 | ||
96ff1952 | 15 | #include <TH1S.h> |
16 | #include <TH2S.h> | |
17 | #include <TVirtualPad.h> | |
18 | ||
5a5a1232 | 19 | using namespace Reve; |
20 | using namespace Alieve; | |
21 | using namespace std; | |
22 | ||
092578a7 | 23 | //______________________________________________________________________ |
24 | // TPCSector2D | |
25 | // | |
26 | // Displays TPC raw-data in 2D. | |
27 | // | |
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 | |
31 | // | |
32 | // fUseTexture: use OpenGL textures to display data (fast rendering, | |
33 | // updates take the same time) | |
34 | // | |
35 | ||
2aef44c1 | 36 | ClassImp(TPCSector2D) |
5a5a1232 | 37 | |
38 | /**************************************************************************/ | |
39 | ||
092578a7 | 40 | TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) : |
41 | TPCSectorViz(n,t), | |
b56d8877 | 42 | |
092578a7 | 43 | fShowMax (kTRUE), |
44 | fAverage (kFALSE), | |
915dabe1 | 45 | |
a8600b56 | 46 | fUseTexture (kTRUE), |
47 | fPickEmpty (kFALSE), | |
48 | fPickMode (0) | |
092578a7 | 49 | {} |
5a5a1232 | 50 | |
915dabe1 | 51 | TPCSector2D::~TPCSector2D() |
092578a7 | 52 | {} |
5a5a1232 | 53 | |
54 | /**************************************************************************/ | |
55 | ||
915dabe1 | 56 | void TPCSector2D::ComputeBBox() |
5a5a1232 | 57 | { |
915dabe1 | 58 | const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg(); |
59 | const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg(); | |
5a5a1232 | 60 | |
606c4ed7 | 61 | #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) |
5a5a1232 | 62 | bbox_init(); |
606c4ed7 | 63 | #else |
64 | BBoxInit(); | |
65 | #endif | |
915dabe1 | 66 | Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2; |
67 | fBBox[0] = -w; | |
68 | fBBox[1] = w; | |
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. | |
72 | fBBox[5] = 0.5; | |
5a5a1232 | 73 | } |
74 | ||
75 | /**************************************************************************/ | |
76 | ||
96ff1952 | 77 | void TPCSector2D::PadSelected(Int_t row, Int_t pad) |
78 | { | |
79 | // Called when ctrl-mouse-left-click registered over a pad. | |
80 | ||
81 | // EVE -> Std convention | |
82 | Int_t sseg = fSectorID, srow = row; | |
83 | if (row >= TPCSectorData::GetInnSeg().GetNRows()) { | |
6aa260e3 | 84 | sseg += 36; |
96ff1952 | 85 | srow -= TPCSectorData::GetInnSeg().GetNRows(); |
86 | } | |
87 | switch (fPickMode) | |
88 | { | |
89 | case 0: { | |
90 | printf("TPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n", | |
91 | sseg, srow, pad); | |
92 | break; | |
93 | } | |
94 | case 1: { | |
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"); | |
103 | h->SetYTitle("ADC"); | |
104 | TPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad); | |
105 | while (i.Next()) | |
106 | h->Fill(i.Time(), i.Signal()); | |
107 | h->Draw(); | |
108 | gPad->Modified(); | |
109 | gPad->Update(); | |
110 | break; | |
111 | } | |
112 | case 2: { | |
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, | |
121 | npad, 0, npad - 1); | |
122 | h->SetXTitle("Time"); | |
123 | h->SetYTitle("Pad"); | |
124 | h->SetZTitle("ADC"); | |
125 | TPCSectorData::RowIterator i = sectorData->MakeRowIterator(row); | |
126 | while (i.NextPad()) | |
127 | while (i.Next()) | |
128 | h->Fill(i.Time(), i.Pad(), i.Signal()); | |
129 | h->Draw(); | |
130 | gPad->Modified(); | |
131 | gPad->Update(); | |
132 | break; | |
133 | } | |
134 | } // switch | |
135 | } | |
136 | ||
137 | /**************************************************************************/ | |
138 | ||
915dabe1 | 139 | void TPCSector2D::Paint(Option_t* ) |
5a5a1232 | 140 | { |
2caed564 | 141 | if(fRnrSelf == kFALSE) |
092578a7 | 142 | return; |
143 | ||
5a5a1232 | 144 | TBuffer3D buffer(TBuffer3DTypes::kGeneric); |
145 | ||
146 | // Section kCore | |
147 | buffer.fID = this; | |
148 | buffer.fColor = 1; | |
149 | buffer.fTransparency = 0; | |
601bca51 | 150 | fHMTrans.SetBuffer3D(buffer); |
5a5a1232 | 151 | buffer.SetSectionsValid(TBuffer3D::kCore); |
152 | ||
5a5a1232 | 153 | Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); |
154 | if (reqSections == TBuffer3D::kNone) { | |
5a5a1232 | 155 | return; |
156 | } | |
915dabe1 | 157 | |
601bca51 | 158 | Error("TPCSector2D::Paint", "only direct OpenGL rendering supported."); |
5a5a1232 | 159 | } |