]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
3 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 4 | * full copyright notice. * |
d810d0de | 5 | **************************************************************************/ |
fd31e9de | 6 | |
fd54c9e3 | 7 | // $Id$ |
8 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
9 | ||
10 | // | |
11 | // Class to visualize the TOF digit information | |
12 | // in TOF sector frame | |
13 | // | |
14 | // Author: A. De Caro (email: decaro@sa.infn.t) | |
15 | // | |
16 | ||
17 | #include <TStyle.h> | |
18 | ||
19 | #include <TGeoManager.h> | |
20 | #include <TClonesArray.h> | |
8616d353 | 21 | |
84aff7a4 | 22 | #include <TEveManager.h> |
fd54c9e3 | 23 | #include <TEveRGBAPalette.h> |
24 | #include <TEveFrameBox.h> | |
8616d353 | 25 | |
26 | #include <AliTOFdigit.h> | |
28a21457 | 27 | #include <AliTOFGeometry.h> |
8616d353 | 28 | |
fd54c9e3 | 29 | #include "AliEveTOFStrip.h" |
d810d0de | 30 | |
fd31e9de | 31 | Bool_t AliEveTOFStrip::fgStaticInitDone = kFALSE; |
d810d0de | 32 | TEveFrameBox* AliEveTOFStrip::fgTOFstripFrameBox = 0; |
33 | TEveRGBAPalette* AliEveTOFStrip::fgTOFstripPalette = 0; | |
8616d353 | 34 | |
35 | //_______________________________________________________ | |
d810d0de | 36 | ClassImp(AliEveTOFStrip) |
8616d353 | 37 | |
38 | /* ************************************************************************ */ | |
39 | ||
d810d0de | 40 | AliEveTOFStrip::AliEveTOFStrip(const Text_t* n, const Text_t* t) : |
84aff7a4 | 41 | TEveQuadSet(n, t), |
28a21457 | 42 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 43 | fTOFarray(0), |
a8256688 | 44 | fThreshold (5), fMaxVal (80), |
8616d353 | 45 | fSector(-1), fPlate(-1), fStrip(-1), |
fd31e9de | 46 | fDx(0), fDz(0), |
47 | fGeoManager(0) | |
8616d353 | 48 | { |
fd54c9e3 | 49 | // ctr |
8616d353 | 50 | |
81515106 | 51 | //fGeoManager = AliEveEventManager::AssertGeometry(); |
8616d353 | 52 | if (!fGeoManager) printf("ERROR: no TGeo\n"); |
53 | ||
54 | } | |
55 | /* ************************************************************************ */ | |
56 | ||
d810d0de | 57 | AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager, |
fd31e9de | 58 | Int_t nSector, Int_t nPlate, Int_t nStrip) : |
59 | TEveQuadSet(Form("Strip%i", nStrip)), | |
28a21457 | 60 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 61 | fTOFarray(0), |
a8256688 | 62 | fThreshold (5), fMaxVal (80), |
8616d353 | 63 | fSector(nSector), fPlate(nPlate), fStrip(nStrip), |
64 | fDx(0), fDz(0), | |
65 | fGeoManager(localGeoManager) | |
66 | { | |
fd54c9e3 | 67 | // ctr |
51346b82 | 68 | |
8616d353 | 69 | //if (!fGeoManager) printf("ERROR: no TGeo\n"); |
70 | ||
71 | InitModule(); | |
72 | ||
73 | } | |
74 | /* ************************************************************************ */ | |
75 | ||
d810d0de | 76 | AliEveTOFStrip::AliEveTOFStrip(TGeoManager *localGeoManager, |
fd31e9de | 77 | Int_t nSector, Int_t nPlate, Int_t nStrip, |
78 | TClonesArray *tofArray) : | |
79 | TEveQuadSet(Form("Strip%i", nStrip)), | |
28a21457 | 80 | fTOFgeometry(new AliTOFGeometry()), |
8616d353 | 81 | fTOFarray(tofArray), |
a8256688 | 82 | fThreshold (5), fMaxVal (80), |
8616d353 | 83 | fSector(nSector), fPlate(nPlate), fStrip(nStrip), |
84 | fDx(0), fDz(0), | |
85 | fGeoManager(localGeoManager) | |
86 | { | |
fd54c9e3 | 87 | // ctr |
8616d353 | 88 | |
89 | InitModule(); | |
90 | ||
91 | } | |
92 | /* ************************************************************************ */ | |
93 | ||
d810d0de | 94 | AliEveTOFStrip::~AliEveTOFStrip() |
8616d353 | 95 | { |
fd54c9e3 | 96 | // dtr |
8616d353 | 97 | |
98 | fGeoManager = 0x0; | |
99 | delete fGeoManager; | |
100 | ||
101 | fTOFarray = 0x0; | |
102 | delete fTOFarray; | |
103 | ||
104 | } | |
105 | ||
106 | /* ************************************************************************ */ | |
107 | /* | |
d810d0de | 108 | void AliEveTOFStrip::SetDigitsInfo(AliEveTOFDigitsInfo* info) |
8616d353 | 109 | { |
110 | if(fInfo) fInfo->DecRefCount(); | |
111 | fInfo = info; | |
112 | if(fInfo) fInfo->IncRefCount(); | |
113 | ||
114 | } | |
115 | */ | |
116 | /* ************************************************************************ */ | |
d810d0de | 117 | void AliEveTOFStrip::InitStatics() |
8616d353 | 118 | { |
fd54c9e3 | 119 | // |
120 | // To initialize statistic variables | |
121 | // | |
122 | ||
8616d353 | 123 | if (fgStaticInitDone) return; |
124 | ||
125 | Float_t dx = 2.5*48; | |
126 | Float_t dz = 3.5*2; | |
84aff7a4 | 127 | fgTOFstripFrameBox = new TEveFrameBox(); |
8616d353 | 128 | |
129 | fgTOFstripFrameBox->SetAAQuadXZ(-dx*0.5, 0, -dz*0.5, dx, dz); | |
cbbce9c1 | 130 | fgTOFstripFrameBox->SetFrameColor(Color_t(32)); |
55ee7431 | 131 | fgTOFstripFrameBox->IncRefCount(); |
8616d353 | 132 | |
84aff7a4 | 133 | //fgTOFstripPalette = new TEveRGBAPalette(0, 2048); // TOT |
82dabae7 | 134 | //fgTOFstripPalette = new TEveRGBAPalette(0, 192); // TDC |
135 | fgTOFstripPalette = new TEveRGBAPalette(0, 100000); // TDC | |
136 | fgTOFstripPalette->SetOverflowAction(2); | |
137 | fgTOFstripPalette->SetUnderflowAction(2); | |
55ee7431 | 138 | fgTOFstripPalette->IncRefCount(); |
8616d353 | 139 | |
140 | fgStaticInitDone = kTRUE; | |
141 | } | |
142 | ||
143 | /* ************************************************************************ */ | |
d810d0de | 144 | void AliEveTOFStrip::InitModule() |
8616d353 | 145 | { |
fd54c9e3 | 146 | // |
147 | // To initialize TOF strip frame variables | |
148 | // | |
8616d353 | 149 | |
150 | fDx = fTOFgeometry->XPad()*fTOFgeometry->NpadX(); | |
151 | fDz = fTOFgeometry->ZPad()*fTOFgeometry->NpadZ(); | |
152 | ||
153 | if (!fgStaticInitDone) InitStatics(); | |
154 | ||
155 | SetFrame(fgTOFstripFrameBox); | |
156 | SetPalette(fgTOFstripPalette); | |
157 | //fFrame = fgTOFstripFrameBox; | |
158 | //fPalette = fgTOFstripPalette; | |
159 | ||
51346b82 | 160 | LoadQuads(); |
8616d353 | 161 | ComputeBBox(); |
162 | SetTrans(); | |
163 | ||
164 | } | |
165 | ||
166 | /* ************************************************************************ */ | |
d810d0de | 167 | void AliEveTOFStrip::LoadQuads() |
8616d353 | 168 | { |
fd54c9e3 | 169 | // |
170 | // Load TOF digit as illuminated pad | |
171 | // | |
8616d353 | 172 | |
173 | Int_t iPadX = -1; | |
174 | Int_t iPadZ = -1; | |
175 | Int_t tdc = -1; | |
176 | Int_t tot = -1; | |
177 | Float_t x = -1; | |
178 | Float_t z = -1; | |
179 | ||
84aff7a4 | 180 | Reset(kQT_RectangleXZFixedY, kFALSE, 32); |
8616d353 | 181 | |
182 | AliTOFdigit *tofDigit; | |
183 | ||
184 | //printf(" fTOFarray->GetEntries() = %4i \n",fTOFarray->GetEntries()); | |
185 | ||
186 | for (Int_t ii=0; ii<fTOFarray->GetEntries(); ii++) { | |
187 | ||
188 | tofDigit = (AliTOFdigit*)fTOFarray->UncheckedAt(ii); | |
189 | ||
190 | iPadX = tofDigit->GetPadx(); | |
191 | iPadZ = tofDigit->GetPadz(); | |
192 | ||
193 | tot = tofDigit->GetToT(); | |
194 | tdc = tofDigit->GetTdc(); | |
195 | ||
196 | //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %2i %1i\n", iPadX, iPadZ); | |
197 | //if (iPadX==23 || iPadX==24) printf(" %2i %1i %2i \n", fSector, fPlate, fStrip); | |
198 | ||
199 | fTOFgeometry->DetToStripRF(iPadX, iPadZ, x, z); | |
200 | ||
201 | AddQuad(x, z, 2.5, 3.5); | |
202 | //AddQuad(-2.5*0.5, -3.5*0.5, 2.5, 3.5); | |
203 | ||
204 | // In principle could have color based on number of neigbours. We | |
205 | // can insert the time-of-flight value for each pad | |
206 | //QuadValue((Int_t)tot); | |
207 | QuadValue((Int_t)tdc); | |
a8256688 | 208 | QuadId(tofDigit); |
8616d353 | 209 | |
210 | //if (fSector==4 && fPlate==2 && fStrip==0) printf(" %1i %2i %f %f \n", iPadZ, iPadX, x, z); | |
211 | ||
212 | } | |
213 | ||
214 | RefitPlex(); | |
51346b82 | 215 | |
8616d353 | 216 | } |
217 | ||
218 | /* ************************************************************ */ | |
d810d0de | 219 | void AliEveTOFStrip::SetTrans() |
8616d353 | 220 | { |
fd54c9e3 | 221 | // |
222 | // Set the translation matrix for TOF sector | |
223 | // | |
224 | ||
8616d353 | 225 | //Int_t det[5] = {fSector, fPlate, fStrip, -1, -1}; |
d19b0b37 | 226 | Char_t path[200]; |
8616d353 | 227 | //fTOFgeometry->GetVolumePath(det,path); |
228 | fTOFgeometry->GetVolumePath(fSector, fPlate, fStrip, path); | |
229 | ||
230 | fGeoManager->cd(path); | |
a15e6d7d | 231 | SetTransMatrix(*fGeoManager->GetCurrentMatrix()); |
8616d353 | 232 | } |
a8256688 | 233 | |
234 | /******************************************************************************/ | |
235 | void AliEveTOFStrip::SetThreshold(Short_t t) | |
236 | { | |
fd54c9e3 | 237 | // |
238 | // Set visualization threshold | |
239 | // | |
240 | ||
a8256688 | 241 | fThreshold = TMath::Min(t, (Short_t)(fMaxVal - 1)); |
242 | // ClearColorArray(); | |
243 | } | |
244 | ||
245 | /******************************************************************************/ | |
246 | ||
247 | void AliEveTOFStrip::SetMaxVal(Int_t mv) | |
248 | { | |
fd54c9e3 | 249 | // |
250 | // Set visualization max value | |
251 | // | |
252 | ||
a8256688 | 253 | fMaxVal = TMath::Max(mv, (Int_t)(fThreshold + 1)); |
254 | //ClearColorArray(); | |
255 | } | |
256 | ||
257 | /******************************************************************************/ | |
258 | ||
259 | void AliEveTOFStrip::DigitSelected(Int_t idx) | |
260 | { | |
fd54c9e3 | 261 | // |
262 | // Printout infos for TOF digit number idx | |
263 | // | |
a8256688 | 264 | |
fd54c9e3 | 265 | // Override control-click from TEveQuadSet |
d794819f | 266 | |
267 | TObject* obj = GetId(idx); | |
a8256688 | 268 | AliTOFdigit* digs = dynamic_cast<AliTOFdigit*>(obj); |
269 | // printf("AliEveTOFStrip::QuadSelected "); Print(); | |
d794819f | 270 | |
a8256688 | 271 | if (digs) |
272 | printf("\n Sector = %2i Plate = %1i Strip = %2i PadZ = %1i PadX = %2i ToT = %3i Tof = %5i\n", | |
273 | fSector , fPlate, fStrip, digs->GetPadz(), digs->GetPadx(), digs->GetToT(), digs->GetTdc()); | |
274 | else printf("\n"); | |
275 | ||
276 | } | |
277 | ||
278 | /******************************************************************************/ |