]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/AliEveTPCSector2D.cxx
Put all classes in Alieve/ sub-module out of the Alieve namespace and
[u/mrichter/AliRoot.git] / EVE / Alieve / 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 *
7 * full copyright notice. *
8 **************************************************************************/
5a5a1232 9
d810d0de 10#include "AliEveTPCSector2D.h"
11#include "AliEveTPCSector3D.h"
12
13#include <Alieve/AliEveTPCData.h>
14#include <Alieve/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
092578a7 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
46/**************************************************************************/
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)
092578a7 57{}
5a5a1232 58
d810d0de 59AliEveTPCSector2D::~AliEveTPCSector2D()
092578a7 60{}
5a5a1232 61
62/**************************************************************************/
63
d810d0de 64void AliEveTPCSector2D::MakeSector3D()
32e219c2 65{
d810d0de 66 AliEveTPCSector3D* s = new AliEveTPCSector3D;
32e219c2 67 s->SetDataSource(fTPCData);
68 s->SetSectorID(fSectorID);
69 s->SetAutoTrans(fAutoTrans);
84aff7a4 70 gEve->AddElement(s, this);
71 gEve->Redraw3D();
32e219c2 72}
73
74/**************************************************************************/
75
d810d0de 76void AliEveTPCSector2D::ComputeBBox()
5a5a1232 77{
d810d0de 78 const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg();
79 const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg();
5a5a1232 80
606c4ed7 81 BBoxInit();
915dabe1 82 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
83 fBBox[0] = -w;
84 fBBox[1] = w;
85 fBBox[2] = iSeg.GetRLow();
86 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
87 fBBox[4] = -0.5; // Fake z-width to 1 cm.
88 fBBox[5] = 0.5;
5a5a1232 89}
90
91/**************************************************************************/
92
d810d0de 93void AliEveTPCSector2D::PadSelected(Int_t row, Int_t pad)
96ff1952 94{
95 // Called when ctrl-mouse-left-click registered over a pad.
96
97 // EVE -> Std convention
98 Int_t sseg = fSectorID, srow = row;
d810d0de 99 if (row >= AliEveTPCSectorData::GetInnSeg().GetNRows()) {
6aa260e3 100 sseg += 36;
d810d0de 101 srow -= AliEveTPCSectorData::GetInnSeg().GetNRows();
96ff1952 102 }
103 switch (fPickMode)
104 {
105 case 0: {
d810d0de 106 printf("AliEveTPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
96ff1952 107 sseg, srow, pad);
108 break;
109 }
110 case 1: {
d810d0de 111 AliEveTPCSectorData* sectorData = GetSectorData();
96ff1952 112 if (sectorData == 0) return;
113 Int_t mint = fMinTime;
114 Int_t maxt = fMaxTime;
84aff7a4 115 TH1S* h = new TH1S(Form("Seg%d_Row%d_TEvePad%d", sseg, srow, pad),
116 Form("Segment %d, Row %d, TEvePad %d", sseg, srow, pad),
96ff1952 117 maxt - mint +1 , mint, maxt);
118 h->SetXTitle("Time");
119 h->SetYTitle("ADC");
d810d0de 120 AliEveTPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad);
96ff1952 121 while (i.Next())
122 h->Fill(i.Time(), i.Signal());
123 h->Draw();
124 gPad->Modified();
125 gPad->Update();
126 break;
127 }
128 case 2: {
d810d0de 129 AliEveTPCSectorData* sectorData = GetSectorData();
96ff1952 130 if (sectorData == 0) return;
131 Int_t mint = fMinTime;
132 Int_t maxt = fMaxTime;
d810d0de 133 Int_t npad = AliEveTPCSectorData::GetNPadsInRow(row);
96ff1952 134 TH2S* h = new TH2S(Form("Seg%d_Row%d", sseg, srow),
135 Form("Segment %d, Row %d", sseg, srow),
136 maxt - mint +1 , mint, maxt,
137 npad, 0, npad - 1);
138 h->SetXTitle("Time");
84aff7a4 139 h->SetYTitle("TEvePad");
96ff1952 140 h->SetZTitle("ADC");
d810d0de 141 AliEveTPCSectorData::RowIterator i = sectorData->MakeRowIterator(row);
96ff1952 142 while (i.NextPad())
143 while (i.Next())
84aff7a4 144 h->Fill(i.Time(), i.TEvePad(), i.Signal());
96ff1952 145 h->Draw();
146 gPad->Modified();
147 gPad->Update();
148 break;
149 }
150 } // switch
151}
152
153/**************************************************************************/
154
d810d0de 155void AliEveTPCSector2D::Paint(Option_t* )
5a5a1232 156{
2caed564 157 if(fRnrSelf == kFALSE)
092578a7 158 return;
159
5a5a1232 160 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
161
162 // Section kCore
163 buffer.fID = this;
164 buffer.fColor = 1;
165 buffer.fTransparency = 0;
601bca51 166 fHMTrans.SetBuffer3D(buffer);
5a5a1232 167 buffer.SetSectionsValid(TBuffer3D::kCore);
168
5a5a1232 169 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
170 if (reqSections == TBuffer3D::kNone) {
5a5a1232 171 return;
172 }
915dabe1 173
d810d0de 174 Error("AliEveTPCSector2D::Paint", "only direct OpenGL rendering supported.");
5a5a1232 175}