1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONTriggerGUIboard
21 /// Single trigger board object with geometry information, strips and digits
23 /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
24 //-----------------------------------------------------------------------------
26 #include <TClonesArray.h>
30 #include "AliMUONGeometryTransformer.h"
32 #include "AliMUONTriggerGUIboard.h"
35 ClassImp(AliMUONTriggerGUIboard)
38 //__________________________________________________________________________
39 AliMUONTriggerGUIboard::AliMUONTriggerGUIboard()
61 /// board main constructor
63 fName = new TString("");
64 fCrateName = new TString("");
66 for (Int_t i = 0; i < kNMT; i++) {
72 for (Int_t is = 0; is < kNS; is++) {
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);
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;
109 //__________________________________________________________________________
110 AliMUONTriggerGUIboard::~AliMUONTriggerGUIboard()
116 for (Int_t imt = 0; imt < kNMT; imt++) {
117 for (Int_t is = 0; is < kNS; is++) {
118 delete fXDigBox[imt][is];
119 delete fYDigBox[imt][is];
125 //__________________________________________________________________________
126 void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
128 /// set coordinates of "is" x-strip box in chamber "imt"
130 fXDigBox[imt][is]->SetX1(x1);
131 fXDigBox[imt][is]->SetY1(y1);
132 fXDigBox[imt][is]->SetX2(x2);
133 fXDigBox[imt][is]->SetY2(y2);
137 //__________________________________________________________________________
138 void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
140 /// set coordinates of "is" y-strip box in chamber "imt"
142 fYDigBox[imt][is]->SetX1(x1);
143 fYDigBox[imt][is]->SetY1(y1);
144 fYDigBox[imt][is]->SetX2(x2);
145 fYDigBox[imt][is]->SetY2(y2);
149 //__________________________________________________________________________
150 void AliMUONTriggerGUIboard::ClearXDigits()
152 /// delete the set x-digits
154 for (Int_t imt = 0; imt < kNMT; imt++) {
155 for (Int_t is = 0; is < kNS; is++) {
162 //__________________________________________________________________________
163 void AliMUONTriggerGUIboard::ClearYDigits()
165 /// delete the set y-digits
167 for (Int_t imt = 0; imt < kNMT; imt++) {
168 for (Int_t is = 0; is < kNS; is++) {
175 //__________________________________________________________________________
176 void AliMUONTriggerGUIboard::MakeGeometry()
178 /// create the display geometry from the mapping pads
182 // circuit number and manu channel (from x-strips)
183 for (Int_t ich = 0; ich < kNMT; ich++) {
185 pad = (AliMpPad*)fPadsX[ich]->At(0);
186 fIdCircuit = pad->GetLocalBoardId(0);
192 if (fName->Length()) {
193 if (fName->Contains("12")) fPosition = 1;
194 if (fName->Contains("34")) fPosition = 2;
195 if (fName->Contains("56")) fPosition = 3;
196 if (fName->Contains("78")) fPosition = 4;
199 // position index for common y-strip boards
200 for (Int_t ich = 0; ich < kNMT; ich++) {
202 pad = (AliMpPad*)fPadsY[ich]->At(0);
203 fYOver = pad->GetNofLocations();
209 Int_t padxIx = -1, padxIy1 = +999, padxIy2 = -999;
210 Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999;
211 for (Int_t ip = 0; ip < fNPadsX[0]; ip++) {
212 pad = (AliMpPad*)fPadsX[0]->At(ip);
213 padxIx = pad->GetIx();
214 padxIy1 = TMath::Min(padxIy1,pad->GetIy());
215 padxIy2 = TMath::Max(padxIy2,pad->GetIy());
217 for (Int_t ip = 0; ip < fNPadsY[0]; ip++) {
218 pad = (AliMpPad*)fPadsY[0]->At(ip);
219 padyIy = pad->GetIy();
220 padyIx1 = TMath::Min(padyIx1,pad->GetIx());
221 padyIx2 = TMath::Max(padyIx2,pad->GetIx());
230 // position and dimension
232 AliMUONGeometryTransformer transformer;
233 transformer.LoadGeometryData("transform.dat");
235 Float_t minX, maxX, minY, maxY;
237 Float_t xloc, yloc, xglo, yglo, zglo;
238 for (Int_t ich = 0; ich < kNMT; ich++) {
239 minX = +9999; maxX = -9999;
240 minY = +9999; maxY = -9999;
241 for (Int_t ix = 0; ix < fNPadsX[ich]; ix++) {
242 pad = (AliMpPad*)fPadsX[ich]->At(ix);
243 xloc = pad->GetPositionX();
244 yloc = pad->GetPositionY();
245 dx = pad->GetDimensionX();
246 dy = pad->GetDimensionY();
247 transformer.Local2Global((11+ich)*100+GetDetElemId(), xloc, yloc, 0, xglo, yglo, zglo);
248 minX = TMath::Min(minX,(xglo-dx));
249 maxX = TMath::Max(maxX,(xglo+dx));
250 minY = TMath::Min(minY,(yglo-dy));
251 maxY = TMath::Max(maxY,(yglo+dy));
253 fXCenter[ich] = 0.5*(minX+maxX);
254 fYCenter[ich] = 0.5*(minY+maxY);
255 fZCenter[ich] = zglo;
256 fXWidth[ich] = maxX-minX;
257 fYWidth[ich] = maxY-minY;
258 // truncate to same precision as in the old guimap files
259 fXCenter[ich] = 0.01*TMath::Nint(fXCenter[ich]*100.0);
260 fYCenter[ich] = 0.01*TMath::Nint(fYCenter[ich]*100.0);
261 fXWidth[ich] = 0.01*TMath::Nint(fXWidth[ich]*100.0);
262 fYWidth[ich] = 0.01*TMath::Nint(fYWidth[ich]*100.0);
266 // delete the pads arrays
267 for (Int_t ich = 0; ich < kNMT; ich++) {
268 delete fPadsX[ich]; fNPadsX[ich] = 0;
269 delete fPadsY[ich]; fNPadsY[ich] = 0;
274 //__________________________________________________________________________
275 Int_t AliMUONTriggerGUIboard::GetLine() const
277 /// get detector side
278 if (fName->Length() >= 5) {
279 const Char_t *name = fName->Data();
280 TString sline = TString(name[4]);
288 //__________________________________________________________________________
289 Int_t AliMUONTriggerGUIboard::GetCol() const
291 /// get detector side
292 if (fName->Length() >= 5) {
293 const Char_t *name = fName->Data();
294 TString scol = TString(name[2]);
302 //__________________________________________________________________________
303 Int_t AliMUONTriggerGUIboard::GetSide() const
305 /// get detector side
306 if (fName->Length() >= 5) {
307 const Char_t *name = fName->Data();
308 if (!strncmp(name,"L",1)) return 0;
309 if (!strncmp(name,"R",1)) return 1;
316 //__________________________________________________________________________
317 void AliMUONTriggerGUIboard::PrintBoard() const
319 /// print information on this board
321 printf("Name: %s Id %3d Circ %3d DetElemId %2d Pos %1d YOver %1d\n",GetBoardName(),GetNumber(),GetIdCircuit(),GetDetElemId(),GetPosition(),GetYOver());
322 printf("NStrips: X %2d Y %2d \n",GetNStripX(),GetNStripY());
323 printf("Pad indices: X: ix %3d iy1 %3d iy2 %3d \n",GetXSix(),GetXSiy1(),GetXSiy2());
324 printf("Pad indices: Y: iy %3d ix1 %3d ix2 %3d \n",GetYSiy(),GetYSix1(),GetYSix2());
325 printf("Position and dimension:\n");
326 for (Int_t imt = 0; imt < 4; imt++) {
327 printf("MT=%1d: X %9.4f Y %9.4f Z %10.4f \n",imt,GetXCenter(imt),GetYCenter(imt),GetZCenter(imt));
328 printf(" DX %7.4f DY %7.4f \n",GetXWidth(imt),GetYWidth(imt));