2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
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 **************************************************************************/
10 #include "AliEveTPCSector2D.h"
11 #include "AliEveTPCSector3D.h"
13 #include <EveDet/AliEveTPCSectorData.h>
15 #include <TEveTrans.h>
17 #include <TBuffer3D.h>
18 #include <TBuffer3DTypes.h>
19 #include <TVirtualPad.h>
20 #include <TVirtualViewer3D.h>
24 #include <TVirtualPad.h>
26 //==============================================================================
27 //==============================================================================
29 //==============================================================================
31 //______________________________________________________________________________
33 // Displays TPC raw-data in 2D.
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
39 // fUseTexture: use OpenGL textures to display data (fast rendering,
40 // updates take the same time)
43 ClassImp(AliEveTPCSector2D)
45 /******************************************************************************/
47 AliEveTPCSector2D::AliEveTPCSector2D(const Text_t* n, const Text_t* t) :
48 AliEveTPCSectorViz(n,t),
60 /******************************************************************************/
62 void AliEveTPCSector2D::MakeSector3D()
64 // Make a 3D sector with same setting as this one.
65 // It is added as a child ot this object.
67 AliEveTPCSector3D* s = new AliEveTPCSector3D;
68 s->SetDataSource(fTPCData);
69 s->SetSectorID(fSectorID);
70 s->SetAutoTrans(fAutoTrans);
71 s->CopyVizParams(this);
73 ElementChanged(kFALSE, kTRUE);
76 /******************************************************************************/
78 void AliEveTPCSector2D::ComputeBBox()
80 // Compute boundig-box.
82 const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg();
83 const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg();
86 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
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.
95 /******************************************************************************/
97 void AliEveTPCSector2D::PadSelected(Int_t row, Int_t pad)
99 // Called when ctrl-mouse-left-click registered over a pad.
101 // EVE -> Std convention
102 Int_t sseg = fSectorID, srow = row;
103 if (row >= AliEveTPCSectorData::GetInnSeg().GetNRows()) {
105 srow -= AliEveTPCSectorData::GetInnSeg().GetNRows();
110 printf("AliEveTPCSector2DGL::ProcessSelection segment=%d, row=%d, pad=%d\n",
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");
124 AliEveTPCSectorData::PadIterator i = sectorData->MakePadIterator(row, pad);
126 h->Fill(i.Time(), i.Signal());
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,
142 h->SetXTitle("Time");
143 h->SetYTitle("TEvePad");
145 AliEveTPCSectorData::RowIterator i = sectorData->MakeRowIterator(row);
148 h->Fill(i.Time(), i.TEvePad(), i.Signal());
157 /******************************************************************************/
159 void AliEveTPCSector2D::Paint(Option_t* )
163 if(fRnrSelf == kFALSE)
166 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
170 buffer.fColor = GetMainColor();
171 buffer.fTransparency = GetMainTransparency();
172 if (HasMainTrans()) RefMainTrans().SetBuffer3D(buffer);
173 buffer.SetSectionsValid(TBuffer3D::kCore);
175 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
176 if (reqSections == TBuffer3D::kNone) {
180 Error("AliEveTPCSector2D::Paint", "only direct OpenGL rendering supported.");