]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONTriggerGUIboard.cxx
macro and flowevent maker to run part of the code in root
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerGUIboard.cxx
CommitLineData
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
35ClassImp(AliMUONTriggerGUIboard)
36/// \endcond
37
38//__________________________________________________________________________
8b067dfe 39AliMUONTriggerGUIboard::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
109//__________________________________________________________________________
110AliMUONTriggerGUIboard::~AliMUONTriggerGUIboard()
111{
112 /// board destructor
113
114 delete fName;
115
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];
120 }
121 }
122
123}
124
905654c2 125//__________________________________________________________________________
126void AliMUONTriggerGUIboard::SetXDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
127{
128 /// set coordinates of "is" x-strip box in chamber "imt"
129
130 fXDigBox[imt][is]->SetX1(x1);
131 fXDigBox[imt][is]->SetY1(y1);
132 fXDigBox[imt][is]->SetX2(x2);
133 fXDigBox[imt][is]->SetY2(y2);
134
135}
136
137//__________________________________________________________________________
138void AliMUONTriggerGUIboard::SetYDigBox(Int_t imt, Int_t is, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
139{
140 /// set coordinates of "is" y-strip box in chamber "imt"
141
142 fYDigBox[imt][is]->SetX1(x1);
143 fYDigBox[imt][is]->SetY1(y1);
144 fYDigBox[imt][is]->SetX2(x2);
145 fYDigBox[imt][is]->SetY2(y2);
146
147}
148
149//__________________________________________________________________________
150void AliMUONTriggerGUIboard::ClearXDigits()
151{
152 /// delete the set x-digits
153
154 for (Int_t imt = 0; imt < kNMT; imt++) {
155 for (Int_t is = 0; is < kNS; is++) {
156 fXDig[imt][is] = 0;
157 }
158 }
159
160}
161
162//__________________________________________________________________________
163void AliMUONTriggerGUIboard::ClearYDigits()
164{
165 /// delete the set y-digits
166
167 for (Int_t imt = 0; imt < kNMT; imt++) {
168 for (Int_t is = 0; is < kNS; is++) {
169 fYDig[imt][is] = 0;
170 }
171 }
172
173}
8b067dfe 174
175//__________________________________________________________________________
176void AliMUONTriggerGUIboard::MakeGeometry()
177{
178 /// create the display geometry from the mapping pads
179
180 AliMpPad *pad;
181
182 // circuit number and manu channel (from x-strips)
183 for (Int_t ich = 0; ich < kNMT; ich++) {
184 if (fNPadsX[ich]) {
185 pad = (AliMpPad*)fPadsX[ich]->At(0);
186 AliMpIntPair loc = pad->GetLocation(0);
187 fIdCircuit = loc.GetFirst();
188 break;
189 }
190 }
191
192 // position index
193 if (fName->Length()) {
194 if (fName->Contains("12")) fPosition = 1;
195 if (fName->Contains("34")) fPosition = 2;
196 if (fName->Contains("56")) fPosition = 3;
197 if (fName->Contains("78")) fPosition = 4;
198 }
199
200 // position index for common y-strip boards
201 for (Int_t ich = 0; ich < kNMT; ich++) {
202 if (fNPadsY[ich]) {
2129750f 203 pad = (AliMpPad*)fPadsY[ich]->At(0);
8b067dfe 204 fYOver = pad->GetNofLocations();
205 break;
206 }
207 }
208
209 // pad indices
210 Int_t padxIx = -1, padxIy1 = +999, padxIy2 = -999;
211 Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999;
212 for (Int_t ip = 0; ip < fNPadsX[0]; ip++) {
213 pad = (AliMpPad*)fPadsX[0]->At(ip);
214 AliMpIntPair ind = pad->GetIndices();
215 padxIx = ind.GetFirst();
216 padxIy1 = TMath::Min(padxIy1,ind.GetSecond());
217 padxIy2 = TMath::Max(padxIy2,ind.GetSecond());
218 }
219 for (Int_t ip = 0; ip < fNPadsY[0]; ip++) {
220 pad = (AliMpPad*)fPadsY[0]->At(ip);
221 AliMpIntPair ind = pad->GetIndices();
222 padyIy = ind.GetSecond();
223 padyIx1 = TMath::Min(padyIx1,ind.GetFirst());
224 padyIx2 = TMath::Max(padyIx2,ind.GetFirst());
225 }
226 fXSix = padxIx;
227 fXSiy1 = padxIy1;
228 fXSiy2 = padxIy2;
229 fYSiy = padyIy;
230 fYSix1 = padyIx1;
231 fYSix2 = padyIx2;
232
233 // position and dimension
234
235 AliMUONGeometryTransformer transformer;
236 transformer.LoadGeometryData("transform.dat");
237
238 Float_t minX, maxX, minY, maxY;
239 Float_t dx, dy;
240 Float_t xloc, yloc, xglo, yglo, zglo;
241 for (Int_t ich = 0; ich < kNMT; ich++) {
242 minX = +9999; maxX = -9999;
243 minY = +9999; maxY = -9999;
244 for (Int_t ix = 0; ix < fNPadsX[ich]; ix++) {
245 pad = (AliMpPad*)fPadsX[ich]->At(ix);
246 xloc = pad->Position().X();
247 yloc = pad->Position().Y();
248 dx = pad->Dimensions().X();
249 dy = pad->Dimensions().Y();
250 transformer.Local2Global((11+ich)*100+GetDetElemId(), xloc, yloc, 0, xglo, yglo, zglo);
251 minX = TMath::Min(minX,(xglo-dx));
252 maxX = TMath::Max(maxX,(xglo+dx));
253 minY = TMath::Min(minY,(yglo-dy));
254 maxY = TMath::Max(maxY,(yglo+dy));
255 }
256 fXCenter[ich] = 0.5*(minX+maxX);
257 fYCenter[ich] = 0.5*(minY+maxY);
258 fZCenter[ich] = zglo;
259 fXWidth[ich] = maxX-minX;
260 fYWidth[ich] = maxY-minY;
261 // truncate to same precision as in the old guimap files
262 fXCenter[ich] = 0.01*TMath::Nint(fXCenter[ich]*100.0);
263 fYCenter[ich] = 0.01*TMath::Nint(fYCenter[ich]*100.0);
264 fXWidth[ich] = 0.01*TMath::Nint(fXWidth[ich]*100.0);
265 fYWidth[ich] = 0.01*TMath::Nint(fYWidth[ich]*100.0);
266
267 }
268
269 // delete the pads arrays
270 for (Int_t ich = 0; ich < kNMT; ich++) {
271 delete fPadsX[ich]; fNPadsX[ich] = 0;
272 delete fPadsY[ich]; fNPadsY[ich] = 0;
273 }
274
275}
276
277//__________________________________________________________________________
278Int_t AliMUONTriggerGUIboard::GetLine() const
279{
280 /// get detector side
281 if (fName->Length() >= 5) {
282 const Char_t *name = fName->Data();
283 TString sline = TString(name[4]);
284 return sline.Atoi();
285 }
286
287 return -1;
288
289}
290
291//__________________________________________________________________________
292Int_t AliMUONTriggerGUIboard::GetCol() const
293{
294 /// get detector side
295 if (fName->Length() >= 5) {
296 const Char_t *name = fName->Data();
297 TString scol = TString(name[2]);
298 return scol.Atoi();
299 }
300
301 return -1;
302
303}
304
305//__________________________________________________________________________
306Int_t AliMUONTriggerGUIboard::GetSide() const
307{
308 /// get detector side
309 if (fName->Length() >= 5) {
310 const Char_t *name = fName->Data();
311 if (!strncmp(name,"L",1)) return 0;
312 if (!strncmp(name,"R",1)) return 1;
313 }
314
315 return -1;
316
317}
318
319//__________________________________________________________________________
320void AliMUONTriggerGUIboard::PrintBoard() const
321{
322 /// print information on this board
323
324 printf("Name: %s Id %3d Circ %3d DetElemId %2d Pos %1d YOver %1d\n",GetBoardName(),GetNumber(),GetIdCircuit(),GetDetElemId(),GetPosition(),GetYOver());
325 printf("NStrips: X %2d Y %2d \n",GetNStripX(),GetNStripY());
326 printf("Pad indices: X: ix %3d iy1 %3d iy2 %3d \n",GetXSix(),GetXSiy1(),GetXSiy2());
327 printf("Pad indices: Y: iy %3d ix1 %3d ix2 %3d \n",GetYSiy(),GetYSix1(),GetYSix2());
328 printf("Position and dimension:\n");
329 for (Int_t imt = 0; imt < 4; imt++) {
330 printf("MT=%1d: X %9.4f Y %9.4f Z %10.4f \n",imt,GetXCenter(imt),GetYCenter(imt),GetZCenter(imt));
331 printf(" DX %7.4f DY %7.4f \n",GetXWidth(imt),GetYWidth(imt));
332 }
333
334}
335