AliRoot Core  3abf5b4 (3abf5b4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONTriggerGUIboard.cxx
Go to the documentation of this file.
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 
16 // $Id$
17 
18 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
25 
26 #include <TClonesArray.h>
27 #include <TBox.h>
28 #include <TMath.h>
29 
31 
32 #include "AliMUONTriggerGUIboard.h"
33 
37 
38 //__________________________________________________________________________
40  : TObject(),
41  fName(0),
42  fCrateName(0),
43  fID(-1),
44  fStatus(0),
45  fPosition(0),
46  fYOver(0),
47  fXCenter(),
48  fYCenter(),
49  fZCenter(),
50  fXWidth(),
51  fYWidth(),
52  fXSix(0),
53  fXSiy1(0),
54  fXSiy2(0),
55  fYSix1(0),
56  fYSix2(0),
57  fYSiy(0),
58  fDetElemId(0),
59  fIdCircuit(-1),
60  fIsOpen(0),
61  fNPadsX(),
62  fNPadsY(),
63  fPadsX(),
64  fPadsY()
65 {
67 
68  fName = new TString("");
69  fCrateName = new TString("");
70 
71  for (Int_t i = 0; i < kNMT; i++) {
72  fXCenter[i] = 0.;
73  fYCenter[i] = 0.;
74  fZCenter[i] = 0.;
75  fXWidth[i] = 0.;
76  fYWidth[i] = 0.;
77  for (Int_t is = 0; is < kNS; is++) {
78  fXDig[i][is] = 0;
79  fYDig[i][is] = 0;
80  fXDigBox[i][is] = new TBox(0,0,0,0);
81  fYDigBox[i][is] = new TBox(0,0,0,0);
82  fXDigBox[i][is]->SetBit(kCannotPick);
83  fYDigBox[i][is]->SetBit(kCannotPick);
84  fXDigBox[i][is]->SetFillStyle(1001);
85  fYDigBox[i][is]->SetFillStyle(1001);
86  fXDigBox[i][is]->SetFillColor(4);
87  fYDigBox[i][is]->SetFillColor(4);
88  }
89  }
90 
91  fXSix = -1;
92  fXSiy1 = -1;
93  fXSiy2 = -1;
94 
95  fYSix1 = -1;
96  fYSix2 = -1;
97  fYSiy = -1;
98 
99  fDetElemId = -1;
100  fIdCircuit = -1;
101 
102  fIsOpen = kFALSE;
103 
104  fYOver = 0;
105  fPosition = 0;
106 
107  for (Int_t i = 0; i < kNMT; i++) {
108  fPadsX[i] = new TClonesArray("AliMpPad",16); fNPadsX[i] = 0;
109  fPadsY[i] = new TClonesArray("AliMpPad",16); fNPadsY[i] = 0;
110  }
111 
112 }
113 
114 //__________________________________________________________________________
116  : TObject(),
117  fName(0),
118  fCrateName(0),
119  fID(-1),
120  fStatus(0),
121  fPosition(0),
122  fYOver(0),
123  fXCenter(),
124  fYCenter(),
125  fZCenter(),
126  fXWidth(),
127  fYWidth(),
128  fXSix(0),
129  fXSiy1(0),
130  fXSiy2(0),
131  fYSix1(0),
132  fYSix2(0),
133  fYSiy(0),
134  fDetElemId(0),
135  fIdCircuit(-1),
136  fIsOpen(0),
137  fNPadsX(),
138  fNPadsY(),
139  fPadsX(),
140  fPadsY()
141 {
143 
144 }
145 
146 //__________________________________________________________________________
148 {
150 
151  delete fName;
152 
153  for (Int_t imt = 0; imt < kNMT; imt++) {
154  for (Int_t is = 0; is < kNS; is++) {
155  delete fXDigBox[imt][is];
156  delete fYDigBox[imt][is];
157  }
158  }
159 
160 }
161 
162 //__________________________________________________________________________
163 void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
164 {
166 
167  fXDigBox[imt][is]->SetX1(x1);
168  fXDigBox[imt][is]->SetY1(y1);
169  fXDigBox[imt][is]->SetX2(x2);
170  fXDigBox[imt][is]->SetY2(y2);
171 
172 }
173 
174 //__________________________________________________________________________
175 void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
176 {
178 
179  fYDigBox[imt][is]->SetX1(x1);
180  fYDigBox[imt][is]->SetY1(y1);
181  fYDigBox[imt][is]->SetX2(x2);
182  fYDigBox[imt][is]->SetY2(y2);
183 
184 }
185 
186 //__________________________________________________________________________
188 {
190 
191  for (Int_t imt = 0; imt < kNMT; imt++) {
192  for (Int_t is = 0; is < kNS; is++) {
193  fXDig[imt][is] = 0;
194  }
195  }
196 
197 }
198 
199 //__________________________________________________________________________
201 {
203 
204  for (Int_t imt = 0; imt < kNMT; imt++) {
205  for (Int_t is = 0; is < kNS; is++) {
206  fYDig[imt][is] = 0;
207  }
208  }
209 
210 }
211 
212 //__________________________________________________________________________
214 {
216 
217  AliMpPad *pad;
218 
219  // circuit number and manu channel (from x-strips)
220  for (Int_t ich = 0; ich < kNMT; ich++) {
221  if (fNPadsX[ich]) {
222  pad = (AliMpPad*)fPadsX[ich]->At(0);
223  fIdCircuit = pad->GetLocalBoardId(0);
224  break;
225  }
226  }
227 
228  // position index
229  if (fName->Length()) {
230  if (fName->Contains("12")) fPosition = 1;
231  if (fName->Contains("34")) fPosition = 2;
232  if (fName->Contains("56")) fPosition = 3;
233  if (fName->Contains("78")) fPosition = 4;
234  }
235 
236  // position index for common y-strip boards
237  for (Int_t ich = 0; ich < kNMT; ich++) {
238  if (fNPadsY[ich]) {
239  pad = (AliMpPad*)fPadsY[ich]->At(0);
240  fYOver = pad->GetNofLocations();
241  break;
242  }
243  }
244 
245  // pad indices
246  Int_t padxIx = -1, padxIy1 = +999, padxIy2 = -999;
247  Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999;
248  for (Int_t ip = 0; ip < fNPadsX[0]; ip++) {
249  pad = (AliMpPad*)fPadsX[0]->At(ip);
250  padxIx = pad->GetIx();
251  padxIy1 = TMath::Min(padxIy1,pad->GetIy());
252  padxIy2 = TMath::Max(padxIy2,pad->GetIy());
253  }
254  for (Int_t ip = 0; ip < fNPadsY[0]; ip++) {
255  pad = (AliMpPad*)fPadsY[0]->At(ip);
256  padyIy = pad->GetIy();
257  padyIx1 = TMath::Min(padyIx1,pad->GetIx());
258  padyIx2 = TMath::Max(padyIx2,pad->GetIx());
259  }
260  fXSix = padxIx;
261  fXSiy1 = padxIy1;
262  fXSiy2 = padxIy2;
263  fYSiy = padyIy;
264  fYSix1 = padyIx1;
265  fYSix2 = padyIx2;
266 
267  // position and dimension
268 
269  AliMUONGeometryTransformer transformer;
270  transformer.LoadGeometryData("transform.dat");
271 
272  Float_t minX, maxX, minY, maxY;
273  Float_t dx, dy;
274  Float_t xloc, yloc, xglo=0., yglo=0., zglo=0.;
275  for (Int_t ich = 0; ich < kNMT; ich++) {
276  minX = +9999; maxX = -9999;
277  minY = +9999; maxY = -9999;
278  for (Int_t ix = 0; ix < fNPadsX[ich]; ix++) {
279  pad = (AliMpPad*)fPadsX[ich]->At(ix);
280  xloc = pad->GetPositionX();
281  yloc = pad->GetPositionY();
282  dx = pad->GetDimensionX();
283  dy = pad->GetDimensionY();
284  transformer.Local2Global((11+ich)*100+GetDetElemId(), xloc, yloc, 0, xglo, yglo, zglo);
285  minX = TMath::Min(minX,(xglo-dx));
286  maxX = TMath::Max(maxX,(xglo+dx));
287  minY = TMath::Min(minY,(yglo-dy));
288  maxY = TMath::Max(maxY,(yglo+dy));
289  }
290  fXCenter[ich] = 0.5*(minX+maxX);
291  fYCenter[ich] = 0.5*(minY+maxY);
292  fZCenter[ich] = zglo;
293  fXWidth[ich] = maxX-minX;
294  fYWidth[ich] = maxY-minY;
295  // truncate to same precision as in the old guimap files
296  fXCenter[ich] = 0.01*TMath::Nint(fXCenter[ich]*100.0);
297  fYCenter[ich] = 0.01*TMath::Nint(fYCenter[ich]*100.0);
298  fXWidth[ich] = 0.01*TMath::Nint(fXWidth[ich]*100.0);
299  fYWidth[ich] = 0.01*TMath::Nint(fYWidth[ich]*100.0);
300 
301  }
302 
303  // delete the pads arrays
304  for (Int_t ich = 0; ich < kNMT; ich++) {
305  delete fPadsX[ich]; fNPadsX[ich] = 0;
306  delete fPadsY[ich]; fNPadsY[ich] = 0;
307  }
308 
309 }
310 
311 //__________________________________________________________________________
313 {
315  if (fName->Length() >= 5) {
316  const Char_t *name = fName->Data();
317  TString sline = TString(name[4]);
318  return sline.Atoi();
319  }
320 
321  return -1;
322 
323 }
324 
325 //__________________________________________________________________________
327 {
329  if (fName->Length() >= 5) {
330  const Char_t *name = fName->Data();
331  TString scol = TString(name[2]);
332  return scol.Atoi();
333  }
334 
335  return -1;
336 
337 }
338 
339 //__________________________________________________________________________
341 {
343  if (fName->Length() >= 5) {
344  const Char_t *name = fName->Data();
345  if (!strncmp(name,"L",1)) return 0;
346  if (!strncmp(name,"R",1)) return 1;
347  }
348 
349  return -1;
350 
351 }
352 
353 //__________________________________________________________________________
355 {
357 
358  printf("Name: %s Id %3d Circ %3d DetElemId %2d Pos %1d YOver %1d\n",GetBoardName(),GetNumber(),GetIdCircuit(),GetDetElemId(),GetPosition(),GetYOver());
359  printf("NStrips: X %2d Y %2d \n",GetNStripX(),GetNStripY());
360  printf("Pad indices: X: ix %3d iy1 %3d iy2 %3d \n",GetXSix(),GetXSiy1(),GetXSiy2());
361  printf("Pad indices: Y: iy %3d ix1 %3d ix2 %3d \n",GetYSiy(),GetYSix1(),GetYSix2());
362  printf("Position and dimension:\n");
363  for (Int_t imt = 0; imt < 4; imt++) {
364  printf("MT=%1d: X %9.4f Y %9.4f Z %10.4f \n",imt,GetXCenter(imt),GetYCenter(imt),GetZCenter(imt));
365  printf(" DX %7.4f DY %7.4f \n",GetXWidth(imt),GetYWidth(imt));
366  }
367 
368 }
369 
Int_t GetNofLocations() const
Definition: AliMpPad.cxx:325
UChar_t fXDig[kNMT][kNS]
X-digits amplitude, set by GUI.
Int_t fNPadsX[kNMT]
adding pads from mapping to calculate the board geometry
UChar_t GetYOver() const
get neighbouring boards with common y strips
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Int_t GetYSix1() const
get first x-index in detector element for a y-strip
Int_t GetNumber() const
get the number of this board
UChar_t GetPosition() const
get the board position inside the detector element in y direction
Float_t fYCenter[kNMT]
Y-center of the board.
Int_t GetSide() const
get detector side (Left=0 , Right=1)
UChar_t fPosition
Y-boards position.
Int_t GetXSix() const
get x-index in detector element for an x-strip
TBox * fXDigBox[kNMT][kNS]
X-digits boxes.
Bool_t LoadGeometryData(const TString &fileName)
void MakeGeometry()
create the display geometry from the mapping pads
Int_t GetIy() const
Definition: AliMpPad.cxx:280
Int_t GetCol() const
get column
Top container class for geometry transformations.
TClonesArray * fPadsX[kNMT]
array of mapping pads in x
TString * fName
Board name LCxLxBx or RCxLxBx.
TBox * fYDigBox[kNMT][kNS]
Y-digits boxes.
Float_t fXWidth[kNMT]
X-width of the board.
Char_t * GetBoardName() const
get the standard name of this board
TClonesArray * fPadsY[kNMT]
array of mapping pads in y
Float_t GetYCenter(Int_t imt) const
get y-center of the board in chamber imt
Int_t GetYSix2() const
get last x-index in detector element for a y-strip
Int_t GetIdCircuit() const
get the id of the circuit
Int_t fXSix
X-strips ix index in the board.
void PrintBoard() const
print information on this board
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
void SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
set y-strip box for display
void ClearYDigits()
delete the set y-digits
Int_t GetLine() const
get line
void SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
set x-strip box for display
void Local2Global(Int_t detElemId, Float_t xl, Float_t yl, Float_t zl, Float_t &xg, Float_t &yg, Float_t &zg) const
Float_t GetXWidth(Int_t imt) const
get x-width of the board in chamber imt
Int_t fYSix1
Y-strips first ix index in the board.
Float_t fYWidth[kNMT]
Y-width of the board.
UChar_t fYOver
Y-boards with common y-strips.
Int_t GetXSiy2() const
get last y-index in detector element for an x-strip
Double_t GetPositionY() const
Return the pad x position (in cm)
Definition: AliMpPad.h:81
Int_t GetDetElemId() const
get the id of the detector element
Int_t GetYSiy() const
get y-index in detector element for a y-strip
Int_t fYSiy
Y-strips iy index in the board.
void ClearXDigits()
delete the set x-digits
Float_t GetYWidth(Int_t imt) const
get y-width of the board in chamber imt
Float_t GetXCenter(Int_t imt) const
get x-center of the board in chamber imt
Int_t GetLocalBoardId(Int_t i) const
Definition: AliMpPad.cxx:347
Int_t fYSix2
Y-strips last ix index in the board.
Int_t fIdCircuit
Circuit number.
Int_t GetXSiy1() const
get first y-index in detector element for an x-strip
Trigger GUI utility class: single board object.
Float_t fZCenter[kNMT]
Z-center of the board.
Int_t fNPadsY[kNMT]
nr of added mapping pads in y
Int_t fXSiy1
X-strips first iy index in the board.
Int_t GetIx() const
Definition: AliMpPad.cxx:272
Double_t GetDimensionY() const
Return the y pad dimension - half length (in cm)
Definition: AliMpPad.h:86
Float_t GetZCenter(Int_t imt) const
get z-center of the board in chamber imt
UChar_t fYDig[kNMT][kNS]
Y-digits amplitude, set by GUI.
Class which encapsuate all information about a pad.
Definition: AliMpPad.h:22
Int_t GetNStripX() const
get number of x strips
Double_t GetPositionX() const
Return the pad x position (in cm)
Definition: AliMpPad.h:79
Int_t GetNStripY() const
get number of y strips
Double_t GetDimensionX() const
Return the x pad dimension - half length (in cm)
Definition: AliMpPad.h:84
Float_t fXCenter[kNMT]
X-center of the board.
Int_t fXSiy2
X-strips last iy index in the board.