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