]>
Commit | Line | Data |
---|---|---|
905654c2 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
37391c63 | 16 | // $Id$ |
17 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
37391c63 | 19 | /// \class AliMUONTriggerGUIboard |
20 | /// | |
21 | /// Single trigger board object with geometry information, strips and digits | |
22 | /// | |
23 | /// \author Bogdan Vulpescu, LPC Clermont-Ferrand | |
3d1463c8 | 24 | //----------------------------------------------------------------------------- |
905654c2 | 25 | |
8b067dfe | 26 | #include <TClonesArray.h> |
905654c2 | 27 | #include <TBox.h> |
8b067dfe | 28 | #include <TMath.h> |
29 | ||
30 | #include "AliMUONGeometryTransformer.h" | |
905654c2 | 31 | |
32 | #include "AliMUONTriggerGUIboard.h" | |
33 | ||
34 | /// \cond CLASSIMP | |
35 | ClassImp(AliMUONTriggerGUIboard) | |
36 | /// \endcond | |
37 | ||
38 | //__________________________________________________________________________ | |
8b067dfe | 39 | AliMUONTriggerGUIboard::AliMUONTriggerGUIboard() |
905654c2 | 40 | : TObject(), |
41 | fName(0), | |
8b067dfe | 42 | fCrateName(0), |
905654c2 | 43 | fID(-1), |
44 | fStatus(0), | |
45 | fPosition(0), | |
46 | fYOver(0), | |
47 | fXSix(0), | |
48 | fXSiy1(0), | |
49 | fXSiy2(0), | |
50 | fYSix1(0), | |
51 | fYSix2(0), | |
52 | fYSiy(0), | |
53 | fDetElemId(0), | |
54 | fIdCircuit(-1), | |
8b067dfe | 55 | fIsOpen(0), |
56 | fNPadsX(), | |
57 | fNPadsY(), | |
58 | fPadsX(), | |
59 | fPadsY() | |
905654c2 | 60 | { |
61 | /// board main constructor | |
62 | ||
8b067dfe | 63 | fName = new TString(""); |
64 | fCrateName = new TString(""); | |
905654c2 | 65 | |
66 | for (Int_t i = 0; i < kNMT; i++) { | |
67 | fXCenter[i] = 0.; | |
68 | fYCenter[i] = 0.; | |
69 | fZCenter[i] = 0.; | |
70 | fXWidth[i] = 0.; | |
71 | fYWidth[i] = 0.; | |
72 | for (Int_t is = 0; is < kNS; is++) { | |
73 | fXDig[i][is] = 0; | |
74 | fYDig[i][is] = 0; | |
75 | fXDigBox[i][is] = new TBox(0,0,0,0); | |
76 | fYDigBox[i][is] = new TBox(0,0,0,0); | |
77 | fXDigBox[i][is]->SetBit(kCannotPick); | |
78 | fYDigBox[i][is]->SetBit(kCannotPick); | |
79 | fXDigBox[i][is]->SetFillStyle(1001); | |
80 | fYDigBox[i][is]->SetFillStyle(1001); | |
81 | fXDigBox[i][is]->SetFillColor(4); | |
82 | fYDigBox[i][is]->SetFillColor(4); | |
83 | } | |
84 | } | |
85 | ||
86 | fXSix = -1; | |
87 | fXSiy1 = -1; | |
88 | fXSiy2 = -1; | |
89 | ||
90 | fYSix1 = -1; | |
91 | fYSix2 = -1; | |
92 | fYSiy = -1; | |
93 | ||
94 | fDetElemId = -1; | |
95 | fIdCircuit = -1; | |
96 | ||
97 | fIsOpen = kFALSE; | |
98 | ||
99 | fYOver = 0; | |
100 | fPosition = 0; | |
101 | ||
8b067dfe | 102 | for (Int_t i = 0; i < kNMT; i++) { |
103 | fPadsX[i] = new TClonesArray("AliMpPad",16); fNPadsX[i] = 0; | |
104 | fPadsY[i] = new TClonesArray("AliMpPad",16); fNPadsY[i] = 0; | |
105 | } | |
106 | ||
905654c2 | 107 | } |
108 | ||
f182ec5f | 109 | //__________________________________________________________________________ |
110 | AliMUONTriggerGUIboard::AliMUONTriggerGUIboard(TRootIOCtor* /*ioCtor*/) | |
111 | : TObject(), | |
112 | fName(0), | |
113 | fCrateName(0), | |
114 | fID(-1), | |
115 | fStatus(0), | |
116 | fPosition(0), | |
117 | fYOver(0), | |
118 | fXSix(0), | |
119 | fXSiy1(0), | |
120 | fXSiy2(0), | |
121 | fYSix1(0), | |
122 | fYSix2(0), | |
123 | fYSiy(0), | |
124 | fDetElemId(0), | |
125 | fIdCircuit(-1), | |
126 | fIsOpen(0), | |
127 | fNPadsX(), | |
128 | fNPadsY(), | |
129 | fPadsX(), | |
130 | fPadsY() | |
131 | { | |
132 | /// board standard constructor | |
133 | ||
134 | } | |
135 | ||
905654c2 | 136 | //__________________________________________________________________________ |
137 | AliMUONTriggerGUIboard::~AliMUONTriggerGUIboard() | |
138 | { | |
139 | /// board destructor | |
140 | ||
141 | delete fName; | |
142 | ||
143 | for (Int_t imt = 0; imt < kNMT; imt++) { | |
144 | for (Int_t is = 0; is < kNS; is++) { | |
145 | delete fXDigBox[imt][is]; | |
146 | delete fYDigBox[imt][is]; | |
147 | } | |
148 | } | |
149 | ||
150 | } | |
151 | ||
905654c2 | 152 | //__________________________________________________________________________ |
153 | void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2) | |
154 | { | |
155 | /// set coordinates of "is" x-strip box in chamber "imt" | |
156 | ||
157 | fXDigBox[imt][is]->SetX1(x1); | |
158 | fXDigBox[imt][is]->SetY1(y1); | |
159 | fXDigBox[imt][is]->SetX2(x2); | |
160 | fXDigBox[imt][is]->SetY2(y2); | |
161 | ||
162 | } | |
163 | ||
164 | //__________________________________________________________________________ | |
165 | void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2) | |
166 | { | |
167 | /// set coordinates of "is" y-strip box in chamber "imt" | |
168 | ||
169 | fYDigBox[imt][is]->SetX1(x1); | |
170 | fYDigBox[imt][is]->SetY1(y1); | |
171 | fYDigBox[imt][is]->SetX2(x2); | |
172 | fYDigBox[imt][is]->SetY2(y2); | |
173 | ||
174 | } | |
175 | ||
176 | //__________________________________________________________________________ | |
177 | void AliMUONTriggerGUIboard::ClearXDigits() | |
178 | { | |
179 | /// delete the set x-digits | |
180 | ||
181 | for (Int_t imt = 0; imt < kNMT; imt++) { | |
182 | for (Int_t is = 0; is < kNS; is++) { | |
183 | fXDig[imt][is] = 0; | |
184 | } | |
185 | } | |
186 | ||
187 | } | |
188 | ||
189 | //__________________________________________________________________________ | |
190 | void AliMUONTriggerGUIboard::ClearYDigits() | |
191 | { | |
192 | /// delete the set y-digits | |
193 | ||
194 | for (Int_t imt = 0; imt < kNMT; imt++) { | |
195 | for (Int_t is = 0; is < kNS; is++) { | |
196 | fYDig[imt][is] = 0; | |
197 | } | |
198 | } | |
199 | ||
200 | } | |
8b067dfe | 201 | |
202 | //__________________________________________________________________________ | |
203 | void AliMUONTriggerGUIboard::MakeGeometry() | |
204 | { | |
205 | /// create the display geometry from the mapping pads | |
206 | ||
207 | AliMpPad *pad; | |
208 | ||
209 | // circuit number and manu channel (from x-strips) | |
210 | for (Int_t ich = 0; ich < kNMT; ich++) { | |
211 | if (fNPadsX[ich]) { | |
212 | pad = (AliMpPad*)fPadsX[ich]->At(0); | |
168e9c4d | 213 | fIdCircuit = pad->GetLocalBoardId(0); |
8b067dfe | 214 | break; |
215 | } | |
216 | } | |
217 | ||
218 | // position index | |
219 | if (fName->Length()) { | |
220 | if (fName->Contains("12")) fPosition = 1; | |
221 | if (fName->Contains("34")) fPosition = 2; | |
222 | if (fName->Contains("56")) fPosition = 3; | |
223 | if (fName->Contains("78")) fPosition = 4; | |
224 | } | |
225 | ||
226 | // position index for common y-strip boards | |
227 | for (Int_t ich = 0; ich < kNMT; ich++) { | |
228 | if (fNPadsY[ich]) { | |
2129750f | 229 | pad = (AliMpPad*)fPadsY[ich]->At(0); |
8b067dfe | 230 | fYOver = pad->GetNofLocations(); |
231 | break; | |
232 | } | |
233 | } | |
234 | ||
235 | // pad indices | |
236 | Int_t padxIx = -1, padxIy1 = +999, padxIy2 = -999; | |
237 | Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999; | |
238 | for (Int_t ip = 0; ip < fNPadsX[0]; ip++) { | |
239 | pad = (AliMpPad*)fPadsX[0]->At(ip); | |
168e9c4d | 240 | padxIx = pad->GetIx(); |
241 | padxIy1 = TMath::Min(padxIy1,pad->GetIy()); | |
242 | padxIy2 = TMath::Max(padxIy2,pad->GetIy()); | |
8b067dfe | 243 | } |
244 | for (Int_t ip = 0; ip < fNPadsY[0]; ip++) { | |
245 | pad = (AliMpPad*)fPadsY[0]->At(ip); | |
168e9c4d | 246 | padyIy = pad->GetIy(); |
247 | padyIx1 = TMath::Min(padyIx1,pad->GetIx()); | |
248 | padyIx2 = TMath::Max(padyIx2,pad->GetIx()); | |
8b067dfe | 249 | } |
250 | fXSix = padxIx; | |
251 | fXSiy1 = padxIy1; | |
252 | fXSiy2 = padxIy2; | |
253 | fYSiy = padyIy; | |
254 | fYSix1 = padyIx1; | |
255 | fYSix2 = padyIx2; | |
256 | ||
257 | // position and dimension | |
258 | ||
259 | AliMUONGeometryTransformer transformer; | |
260 | transformer.LoadGeometryData("transform.dat"); | |
261 | ||
262 | Float_t minX, maxX, minY, maxY; | |
263 | Float_t dx, dy; | |
deb44363 | 264 | Float_t xloc, yloc, xglo=0., yglo=0., zglo=0.; |
8b067dfe | 265 | for (Int_t ich = 0; ich < kNMT; ich++) { |
266 | minX = +9999; maxX = -9999; | |
267 | minY = +9999; maxY = -9999; | |
268 | for (Int_t ix = 0; ix < fNPadsX[ich]; ix++) { | |
269 | pad = (AliMpPad*)fPadsX[ich]->At(ix); | |
6e97fbb8 | 270 | xloc = pad->GetPositionX(); |
271 | yloc = pad->GetPositionY(); | |
272 | dx = pad->GetDimensionX(); | |
273 | dy = pad->GetDimensionY(); | |
8b067dfe | 274 | transformer.Local2Global((11+ich)*100+GetDetElemId(), xloc, yloc, 0, xglo, yglo, zglo); |
275 | minX = TMath::Min(minX,(xglo-dx)); | |
276 | maxX = TMath::Max(maxX,(xglo+dx)); | |
277 | minY = TMath::Min(minY,(yglo-dy)); | |
278 | maxY = TMath::Max(maxY,(yglo+dy)); | |
279 | } | |
280 | fXCenter[ich] = 0.5*(minX+maxX); | |
281 | fYCenter[ich] = 0.5*(minY+maxY); | |
282 | fZCenter[ich] = zglo; | |
283 | fXWidth[ich] = maxX-minX; | |
284 | fYWidth[ich] = maxY-minY; | |
285 | // truncate to same precision as in the old guimap files | |
286 | fXCenter[ich] = 0.01*TMath::Nint(fXCenter[ich]*100.0); | |
287 | fYCenter[ich] = 0.01*TMath::Nint(fYCenter[ich]*100.0); | |
288 | fXWidth[ich] = 0.01*TMath::Nint(fXWidth[ich]*100.0); | |
289 | fYWidth[ich] = 0.01*TMath::Nint(fYWidth[ich]*100.0); | |
290 | ||
291 | } | |
292 | ||
293 | // delete the pads arrays | |
294 | for (Int_t ich = 0; ich < kNMT; ich++) { | |
295 | delete fPadsX[ich]; fNPadsX[ich] = 0; | |
296 | delete fPadsY[ich]; fNPadsY[ich] = 0; | |
297 | } | |
298 | ||
299 | } | |
300 | ||
301 | //__________________________________________________________________________ | |
302 | Int_t AliMUONTriggerGUIboard::GetLine() const | |
303 | { | |
304 | /// get detector side | |
305 | if (fName->Length() >= 5) { | |
306 | const Char_t *name = fName->Data(); | |
307 | TString sline = TString(name[4]); | |
308 | return sline.Atoi(); | |
309 | } | |
310 | ||
311 | return -1; | |
312 | ||
313 | } | |
314 | ||
315 | //__________________________________________________________________________ | |
316 | Int_t AliMUONTriggerGUIboard::GetCol() const | |
317 | { | |
318 | /// get detector side | |
319 | if (fName->Length() >= 5) { | |
320 | const Char_t *name = fName->Data(); | |
321 | TString scol = TString(name[2]); | |
322 | return scol.Atoi(); | |
323 | } | |
324 | ||
325 | return -1; | |
326 | ||
327 | } | |
328 | ||
329 | //__________________________________________________________________________ | |
330 | Int_t AliMUONTriggerGUIboard::GetSide() const | |
331 | { | |
332 | /// get detector side | |
333 | if (fName->Length() >= 5) { | |
334 | const Char_t *name = fName->Data(); | |
335 | if (!strncmp(name,"L",1)) return 0; | |
336 | if (!strncmp(name,"R",1)) return 1; | |
337 | } | |
338 | ||
339 | return -1; | |
340 | ||
341 | } | |
342 | ||
343 | //__________________________________________________________________________ | |
344 | void AliMUONTriggerGUIboard::PrintBoard() const | |
345 | { | |
346 | /// print information on this board | |
347 | ||
348 | printf("Name: %s Id %3d Circ %3d DetElemId %2d Pos %1d YOver %1d\n",GetBoardName(),GetNumber(),GetIdCircuit(),GetDetElemId(),GetPosition(),GetYOver()); | |
349 | printf("NStrips: X %2d Y %2d \n",GetNStripX(),GetNStripY()); | |
350 | printf("Pad indices: X: ix %3d iy1 %3d iy2 %3d \n",GetXSix(),GetXSiy1(),GetXSiy2()); | |
351 | printf("Pad indices: Y: iy %3d ix1 %3d ix2 %3d \n",GetYSiy(),GetYSix1(),GetYSix2()); | |
352 | printf("Position and dimension:\n"); | |
353 | for (Int_t imt = 0; imt < 4; imt++) { | |
354 | printf("MT=%1d: X %9.4f Y %9.4f Z %10.4f \n",imt,GetXCenter(imt),GetYCenter(imt),GetZCenter(imt)); | |
355 | printf(" DX %7.4f DY %7.4f \n",GetXWidth(imt),GetYWidth(imt)); | |
356 | } | |
357 | ||
358 | } | |
359 |