]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveDet/AliEveTOFStrip.cxx
TOF Raw data and clusters visualization
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTOFStrip.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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 **************************************************************************/
fd31e9de 9
d810d0de 10#include "AliEveTOFStrip.h"
8616d353 11
84aff7a4 12#include <TEveManager.h>
8616d353 13
14#include <AliTOFdigit.h>
28a21457 15#include <AliTOFGeometry.h>
8616d353 16
17#include <TStyle.h>
d810d0de 18
fd31e9de 19Bool_t AliEveTOFStrip::fgStaticInitDone = kFALSE;
d810d0de 20TEveFrameBox* AliEveTOFStrip::fgTOFstripFrameBox = 0;
21TEveRGBAPalette* AliEveTOFStrip::fgTOFstripPalette = 0;
8616d353 22
23//_______________________________________________________
d810d0de 24ClassImp(AliEveTOFStrip)
8616d353 25
26/* ************************************************************************ */
27
d810d0de 28AliEveTOFStrip::AliEveTOFStrip(const Text_t* n, const Text_t* t) :
84aff7a4 29 TEveQuadSet(n, t),
28a21457 30 fTOFgeometry(new AliTOFGeometry()),
8616d353 31 fTOFarray(0),
32 fSector(-1), fPlate(-1), fStrip(-1),
fd31e9de 33 fDx(0), fDz(0),
34 fGeoManager(0)
8616d353 35{
36
ee9d8eca 37 //fGeoManager = (TGeoManager*)gEve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
8616d353 38 if (!fGeoManager) printf("ERROR: no TGeo\n");
39
40}
41/* ************************************************************************ */
42
d810d0de 43AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
fd31e9de 44 Int_t nSector, Int_t nPlate, Int_t nStrip) :
45 TEveQuadSet(Form("Strip%i", nStrip)),
28a21457 46 fTOFgeometry(new AliTOFGeometry()),
8616d353 47 fTOFarray(0),
48 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
49 fDx(0), fDz(0),
50 fGeoManager(localGeoManager)
51{
51346b82 52
8616d353 53 //if (!fGeoManager) printf("ERROR: no TGeo\n");
54
55 InitModule();
56
57}
58/* ************************************************************************ */
59
d810d0de 60AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
fd31e9de 61 Int_t nSector, Int_t nPlate, Int_t nStrip,
62 TClonesArray *tofArray) :
63 TEveQuadSet(Form("Strip%i", nStrip)),
28a21457 64 fTOFgeometry(new AliTOFGeometry()),
8616d353 65 fTOFarray(tofArray),
66 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
67 fDx(0), fDz(0),
68 fGeoManager(localGeoManager)
69{
70
71 InitModule();
72
73}
74/* ************************************************************************ */
75
d810d0de 76AliEveTOFStrip::~AliEveTOFStrip()
8616d353 77{
78
79 fGeoManager = 0x0;
80 delete fGeoManager;
81
82 fTOFarray = 0x0;
83 delete fTOFarray;
84
85}
86
87/* ************************************************************************ */
88/*
d810d0de 89void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info)
8616d353 90{
91 if(fInfo) fInfo->DecRefCount();
92 fInfo = info;
93 if(fInfo) fInfo->IncRefCount();
94
95}
96*/
97/* ************************************************************************ */
d810d0de 98void AliEveTOFStrip::InitStatics()
8616d353 99{
100 if (fgStaticInitDone) return;
101
102 Float_t dx = 2.5*48;
103 Float_t dz = 3.5*2;
84aff7a4 104 fgTOFstripFrameBox = new TEveFrameBox();
8616d353 105
106 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
107 fgTOFstripFrameBox->SetFrameColor((Color_t) 32);//31);
108
84aff7a4 109 //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT
110 fgTOFstripPalette = new TEveRGBAPalette(0, 8192); // TDC
8616d353 111
112 fgStaticInitDone = kTRUE;
113}
114
115/* ************************************************************************ */
d810d0de 116void AliEveTOFStrip::InitModule()
8616d353 117{
118
119 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
120 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
121
122 if (!fgStaticInitDone) InitStatics();
123
124 SetFrame(fgTOFstripFrameBox);
125 SetPalette(fgTOFstripPalette);
126 //fFrame = fgTOFstripFrameBox;
127 //fPalette = fgTOFstripPalette;
128
51346b82 129 LoadQuads();
8616d353 130 ComputeBBox();
131 SetTrans();
132
133}
134
135/* ************************************************************************ */
d810d0de 136void AliEveTOFStrip::LoadQuads()
8616d353 137{
138
139 //Int_t n_col = gStyle->GetNumberOfColors();
140
141 Int_t iPadX = -1;
142 Int_t iPadZ = -1;
143 Int_t tdc = -1;
144 Int_t tot = -1;
145 Float_t x = -1;
146 Float_t z = -1;
147
84aff7a4 148 Reset(kQT_RectangleXZFixedY, kFALSE, 32);
8616d353 149
150 AliTOFdigit *tofDigit;
151
152 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
153
154 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
155
156 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
157
158 iPadX = tofDigit->GetPadx();
159 iPadZ = tofDigit->GetPadz();
160
161 tot = tofDigit->GetToT();
162 tdc = tofDigit->GetTdc();
163
164 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
165 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
166
167 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
168
169 AddQuad(x, z, 2.5, 3.5);
170 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
171
172 // In principle could have color based on number of neigbours. We
173 // can insert the time-of-flight value for each pad
174 //QuadValue((Int_t)tot);
175 QuadValue((Int_t)tdc);
176
177 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
178
179 }
180
181 RefitPlex();
51346b82 182
8616d353 183}
184
185/* ************************************************************ */
d810d0de 186void AliEveTOFStrip::SetTrans()
8616d353 187{
188
189 fHMTrans.UnitTrans();
190
191 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
192 Char_t path[100];
193 //fTOFgeometry->GetVolumePath(det,path);
194 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
195
196 fGeoManager->cd(path);
197 TGeoHMatrix global = *fGeoManager->GetCurrentMatrix();
198 Double_t *rotMat = global.GetRotationMatrix();
51346b82 199
8616d353 200 /*
201 // ok till 19 April 2007
202 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[1], rotMat[2]);
203 fHMTrans.SetBaseVec(2, rotMat[3], rotMat[4], rotMat[5]);
204 fHMTrans.SetBaseVec(3, rotMat[6], rotMat[7], rotMat[8]);
205 */
206
207 fHMTrans.SetBaseVec(1, rotMat[0], rotMat[3], rotMat[6]);
208 fHMTrans.SetBaseVec(2, rotMat[1], rotMat[4], rotMat[7]);
209 fHMTrans.SetBaseVec(3, rotMat[2], rotMat[5], rotMat[8]);
210
211 Double_t *tr = global.GetTranslation();
212 fHMTrans.SetBaseVec(4, tr);
213
214}