]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveDet/AliEveTOFStrip.cxx
update for the new location of TRD performance train
[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),
a8256688 32 fThreshold (5), fMaxVal (80),
8616d353 33 fSector(-1), fPlate(-1), fStrip(-1),
fd31e9de 34 fDx(0), fDz(0),
35 fGeoManager(0)
8616d353 36{
37
81515106 38 //fGeoManager = AliEveEventManager::AssertGeometry();
8616d353 39 if (!fGeoManager) printf("ERROR: no TGeo\n");
40
41}
42/* ************************************************************************ */
43
d810d0de 44AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
fd31e9de 45 Int_t nSector, Int_t nPlate, Int_t nStrip) :
46 TEveQuadSet(Form("Strip%i", nStrip)),
28a21457 47 fTOFgeometry(new AliTOFGeometry()),
8616d353 48 fTOFarray(0),
a8256688 49 fThreshold (5), fMaxVal (80),
8616d353 50 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
51 fDx(0), fDz(0),
52 fGeoManager(localGeoManager)
53{
51346b82 54
8616d353 55 //if (!fGeoManager) printf("ERROR: no TGeo\n");
56
57 InitModule();
58
59}
60/* ************************************************************************ */
61
d810d0de 62AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager,
fd31e9de 63 Int_t nSector, Int_t nPlate, Int_t nStrip,
64 TClonesArray *tofArray) :
65 TEveQuadSet(Form("Strip%i", nStrip)),
28a21457 66 fTOFgeometry(new AliTOFGeometry()),
8616d353 67 fTOFarray(tofArray),
a8256688 68 fThreshold (5), fMaxVal (80),
8616d353 69 fSector(nSector), fPlate(nPlate), fStrip(nStrip),
70 fDx(0), fDz(0),
71 fGeoManager(localGeoManager)
72{
73
74 InitModule();
75
76}
77/* ************************************************************************ */
78
d810d0de 79AliEveTOFStrip::~AliEveTOFStrip()
8616d353 80{
81
82 fGeoManager = 0x0;
83 delete fGeoManager;
84
85 fTOFarray = 0x0;
86 delete fTOFarray;
87
88}
89
90/* ************************************************************************ */
91/*
d810d0de 92void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info)
8616d353 93{
94 if(fInfo) fInfo->DecRefCount();
95 fInfo = info;
96 if(fInfo) fInfo->IncRefCount();
97
98}
99*/
100/* ************************************************************************ */
d810d0de 101void AliEveTOFStrip::InitStatics()
8616d353 102{
103 if (fgStaticInitDone) return;
104
105 Float_t dx = 2.5*48;
106 Float_t dz = 3.5*2;
84aff7a4 107 fgTOFstripFrameBox = new TEveFrameBox();
8616d353 108
109 fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz);
cbbce9c1 110 fgTOFstripFrameBox->SetFrameColor(Color_t(32));
55ee7431 111 fgTOFstripFrameBox->IncRefCount();
8616d353 112
84aff7a4 113 //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT
82dabae7 114 //fgTOFstripPalette = new TEveRGBAPalette(0, 192); // TDC
115 fgTOFstripPalette = new TEveRGBAPalette(0, 100000); // TDC
116 fgTOFstripPalette->SetOverflowAction(2);
117 fgTOFstripPalette->SetUnderflowAction(2);
55ee7431 118 fgTOFstripPalette->IncRefCount();
8616d353 119
120 fgStaticInitDone = kTRUE;
121}
122
123/* ************************************************************************ */
d810d0de 124void AliEveTOFStrip::InitModule()
8616d353 125{
126
127 fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX();
128 fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ();
129
130 if (!fgStaticInitDone) InitStatics();
131
132 SetFrame(fgTOFstripFrameBox);
133 SetPalette(fgTOFstripPalette);
134 //fFrame = fgTOFstripFrameBox;
135 //fPalette = fgTOFstripPalette;
136
51346b82 137 LoadQuads();
8616d353 138 ComputeBBox();
139 SetTrans();
140
141}
142
143/* ************************************************************************ */
d810d0de 144void AliEveTOFStrip::LoadQuads()
8616d353 145{
146
147 //Int_t n_col = gStyle->GetNumberOfColors();
148
149 Int_t iPadX = -1;
150 Int_t iPadZ = -1;
151 Int_t tdc = -1;
152 Int_t tot = -1;
153 Float_t x = -1;
154 Float_t z = -1;
155
84aff7a4 156 Reset(kQT_RectangleXZFixedY, kFALSE, 32);
8616d353 157
158 AliTOFdigit *tofDigit;
159
160 //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries());
161
162 for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) {
163
164 tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii);
165
166 iPadX = tofDigit->GetPadx();
167 iPadZ = tofDigit->GetPadz();
168
169 tot = tofDigit->GetToT();
170 tdc = tofDigit->GetTdc();
171
172 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ);
173 //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip);
174
175 fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z);
176
177 AddQuad(x, z, 2.5, 3.5);
178 //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5);
179
180 // In principle could have color based on number of neigbours. We
181 // can insert the time-of-flight value for each pad
182 //QuadValue((Int_t)tot);
183 QuadValue((Int_t)tdc);
a8256688 184 QuadId(tofDigit);
8616d353 185
186 //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z);
187
188 }
189
190 RefitPlex();
51346b82 191
8616d353 192}
193
194/* ************************************************************ */
d810d0de 195void AliEveTOFStrip::SetTrans()
8616d353 196{
8616d353 197 //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1};
198 Char_t path[100];
199 //fTOFgeometry->GetVolumePath(det,path);
200 fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path);
201
202 fGeoManager->cd(path);
a15e6d7d 203 SetTransMatrix(*fGeoManager->GetCurrentMatrix());
8616d353 204}
a8256688 205
206/******************************************************************************/
207void AliEveTOFStrip::SetThreshold(Short_t t)
208{
209 fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1));
210 // ClearColorArray();
211}
212
213/******************************************************************************/
214
215void AliEveTOFStrip::SetMaxVal(Int_t mv)
216{
217 fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1));
218 //ClearColorArray();
219}
220
221/******************************************************************************/
222
223void AliEveTOFStrip::DigitSelected(Int_t idx)
224{
225 // Override control-click from TEveQuadSet
226
227 DigitBase_t* qb = GetDigit(idx);
228 TObject* obj = qb->fId.GetObject();
229 AliTOFdigit* digs = dynamic_cast<AliTOFdigit*>(obj);
230 // printf("AliEveTOFStrip::QuadSelected "); Print();
231 /*
232 printf(" idx = %5i, value = %5d, obj = 0x%lx, digit = 0x%lx ",
233 idx, qb->fValue, (ULong_t)obj, (ULong_t)digs);
234 */
235 if (digs)
236 printf("\n Sector = %2i Plate = %1i Strip = %2i PadZ = %1i PadX = %2i ToT = %3i Tof = %5i\n",
237 fSector , fPlate, fStrip, digs->GetPadz(), digs->GetPadx(), digs->GetToT(), digs->GetTdc());
238 else printf("\n");
239
240}
241
242/******************************************************************************/