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()
66 /// board main constructor
68 fName = new TString("");
69 fCrateName = new TString("");
71 for (Int_t i = 0; i < kNMT; i++) {
77 for (Int_t is = 0; is < kNS; is++) {
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);
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;
114 //__________________________________________________________________________
115 AliMUONTriggerGUIboard::AliMUONTriggerGUIboard(TRootIOCtor* /*ioCtor*/)
142 /// board standard constructor
146 //__________________________________________________________________________
147 AliMUONTriggerGUIboard::~AliMUONTriggerGUIboard()
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];
162 //__________________________________________________________________________
163 void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
165 /// set coordinates of "is" x-strip box in chamber "imt"
167 fXDigBox[imt][is]->SetX1(x1);
168 fXDigBox[imt][is]->SetY1(y1);
169 fXDigBox[imt][is]->SetX2(x2);
170 fXDigBox[imt][is]->SetY2(y2);
174 //__________________________________________________________________________
175 void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
177 /// set coordinates of "is" y-strip box in chamber "imt"
179 fYDigBox[imt][is]->SetX1(x1);
180 fYDigBox[imt][is]->SetY1(y1);
181 fYDigBox[imt][is]->SetX2(x2);
182 fYDigBox[imt][is]->SetY2(y2);
186 //__________________________________________________________________________
187 void AliMUONTriggerGUIboard::ClearXDigits()
189 /// delete the set x-digits
191 for (Int_t imt = 0; imt < kNMT; imt++) {
192 for (Int_t is = 0; is < kNS; is++) {
199 //__________________________________________________________________________
200 void AliMUONTriggerGUIboard::ClearYDigits()
202 /// delete the set y-digits
204 for (Int_t imt = 0; imt < kNMT; imt++) {
205 for (Int_t is = 0; is < kNS; is++) {
212 //__________________________________________________________________________
213 void AliMUONTriggerGUIboard::MakeGeometry()
215 /// create the display geometry from the mapping pads
219 // circuit number and manu channel (from x-strips)
220 for (Int_t ich = 0; ich < kNMT; ich++) {
222 pad = (AliMpPad*)fPadsX[ich]->At(0);
223 fIdCircuit = pad->GetLocalBoardId(0);
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;
236 // position index for common y-strip boards
237 for (Int_t ich = 0; ich < kNMT; ich++) {
239 pad = (AliMpPad*)fPadsY[ich]->At(0);
240 fYOver = pad->GetNofLocations();
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());
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());
267 // position and dimension
269 AliMUONGeometryTransformer transformer;
270 transformer.LoadGeometryData("transform.dat");
272 Float_t minX, maxX, minY, maxY;
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));
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);
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;
311 //__________________________________________________________________________
312 Int_t AliMUONTriggerGUIboard::GetLine() const
314 /// get detector side
315 if (fName->Length() >= 5) {
316 const Char_t *name = fName->Data();
317 TString sline = TString(name[4]);
325 //__________________________________________________________________________
326 Int_t AliMUONTriggerGUIboard::GetCol() const
328 /// get detector side
329 if (fName->Length() >= 5) {
330 const Char_t *name = fName->Data();
331 TString scol = TString(name[2]);
339 //__________________________________________________________________________
340 Int_t AliMUONTriggerGUIboard::GetSide() const
342 /// get detector side
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;
353 //__________________________________________________________________________
354 void AliMUONTriggerGUIboard::PrintBoard() const
356 /// print information on this board
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));