]>
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 | ||
bae1aa70 | 16 | // $Id$ |
17 | ||
3d1463c8 | 18 | //----------------------------------------------------------------------------- |
bae1aa70 | 19 | /// \class AliMUONTriggerGUIbdmap |
20 | /// | |
21 | /// The gui map of a single board object, strips/digits | |
22 | /// | |
23 | /// \author Bogdan Vulpescu, LPC Clermont-Ferrand | |
3d1463c8 | 24 | //----------------------------------------------------------------------------- |
905654c2 | 25 | |
26 | #include <TPolyLine.h> | |
27 | #include <TStyle.h> | |
905654c2 | 28 | #include <TGButton.h> |
29 | #include <TRootEmbeddedCanvas.h> | |
30 | #include <TBox.h> | |
31 | #include <TPaveText.h> | |
32 | #include <TGTextEdit.h> | |
33 | #include <TGText.h> | |
34 | #include <TTimer.h> | |
35 | #include <TObjArray.h> | |
36 | #include <TCanvas.h> | |
37 | ||
38 | #include "AliRun.h" | |
39 | #include "AliMUON.h" | |
bae1aa70 | 40 | #include "AliMUONVDigit.h" |
905654c2 | 41 | #include "AliMpVSegmentation.h" |
42 | #include "AliMpSegmentation.h" | |
43 | #include "AliMUONGeometryTransformer.h" | |
44 | #include "AliMpDEIterator.h" | |
45 | #include "AliMUONLocalTrigger.h" | |
46 | #include "AliMUONLocalTriggerBoard.h" | |
47 | #include "AliMUONTriggerCrateStore.h" | |
f9eb4448 | 48 | #include "AliMUONMCDataInterface.h" |
bae1aa70 | 49 | #include "AliMUONVTriggerStore.h" |
50 | #include "AliMUONVDigitStore.h" | |
bae1aa70 | 51 | #include "AliMpDEManager.h" |
52 | ||
f9eb4448 | 53 | #include "AliMUONTriggerGUIboard.h" |
54 | #include "AliMUONTriggerGUIbdmap.h" | |
55 | ||
905654c2 | 56 | /// \cond CLASSIMP |
57 | ClassImp(AliMUONTriggerGUIbdmap) | |
58 | /// \endcond | |
59 | ||
60 | //__________________________________________________________________________ | |
61 | AliMUONTriggerGUIbdmap::AliMUONTriggerGUIbdmap(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h) | |
bae1aa70 | 62 | : TGFrame(0), |
905654c2 | 63 | fMain(0), |
64 | fLocTrigE(0), | |
65 | fBoard(0), | |
66 | fLoader(0), | |
f9eb4448 | 67 | fMCDataInterface(0), |
905654c2 | 68 | fXStrips(0), |
69 | fYStrips(0), | |
70 | fEditStrips(0), | |
71 | fXOn(0), | |
72 | fYOn(0), | |
73 | fLabelX(0), | |
74 | fLabelY(0), | |
75 | fIsEditable(0), | |
76 | fCanvasSize(0), | |
77 | fNStripX(0), | |
78 | fNStripY(0), | |
f9eb4448 | 79 | fBoards(0), |
d011bba5 | 80 | fCalibrationData(0x0), |
f9eb4448 | 81 | fCrateManager(0) |
905654c2 | 82 | { |
83 | /// frame constructor | |
84 | ||
85 | gStyle->SetPadLeftMargin(0.05); | |
86 | gStyle->SetPadRightMargin(0.05); | |
87 | gStyle->SetPadTopMargin(0.05); | |
88 | gStyle->SetPadBottomMargin(0.05); | |
89 | ||
90 | fMain = new TGTransientFrame(p, main, w, h, kVerticalFrame); | |
91 | fMain->Connect("CloseWindow()", "AliMUONTriggerGUIbdmap", this, "CloseWindow()"); | |
92 | fMain->DontCallClose(); // to avoid double deletions. | |
93 | ||
94 | // use hierarchical cleaning | |
95 | fMain->SetCleanup(kDeepCleanup); | |
96 | ||
97 | fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame); | |
98 | ||
99 | // strips/digits canvases | |
100 | ||
101 | fCanvasSize = 200; | |
102 | ||
103 | TRootEmbeddedCanvas *recanvas[4]; | |
104 | Char_t ecname[1]; | |
105 | for (Int_t i = 0; i < kNMT; i++) { | |
106 | ||
107 | sprintf(ecname,"%1d",i+1); | |
108 | recanvas[i] = new TRootEmbeddedCanvas(ecname,fMain,fCanvasSize,fCanvasSize); | |
109 | ||
110 | fCanvas[i] = recanvas[i]->GetCanvas(); | |
111 | ||
112 | fCanvas[i]->SetBorderMode(0); | |
113 | fCanvas[i]->SetBit(kNoContextMenu); | |
114 | ||
115 | fCanvas[i]->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", | |
116 | "AliMUONTriggerGUIbdmap",this, | |
117 | "EditStrips(Int_t,Int_t,Int_t,TObject*)"); | |
118 | ||
119 | fMain->AddFrame(recanvas[i], | |
120 | /* | |
121 | new TGTableLayoutHints(2,5,2,6, | |
122 | kLHintsExpandX|kLHintsExpandY | | |
123 | kLHintsShrinkX|kLHintsShrinkY | | |
124 | kLHintsFillX|kLHintsFillY) | |
125 | */ | |
126 | new TGLayoutHints(kLHintsTop | | |
127 | kLHintsLeft, | |
128 | 2, 2, 2, 2) | |
129 | ); | |
130 | ||
131 | } | |
132 | ||
133 | //TGDimension size = fMain->GetDefaultSize(); | |
134 | //fMain->Resize(size); | |
135 | ||
136 | // the other frames | |
137 | ||
138 | TGCompositeFrame *cf0 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame); | |
139 | ||
140 | TGCompositeFrame *cf1 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth); | |
141 | ||
142 | cf1->AddFrame(fXStrips = new TGCheckButton(cf1, "Draw X strips and digits", 1), | |
143 | new TGLayoutHints(kLHintsTop | | |
144 | kLHintsLeft, | |
145 | 2, 2, 2, 2) | |
146 | ); | |
147 | ||
148 | cf1->Resize(fXStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight()); | |
149 | ||
150 | cf1->AddFrame(fYStrips = new TGCheckButton(cf1, "Draw Y strips and digits", 2), | |
151 | new TGLayoutHints(kLHintsTop | | |
152 | kLHintsLeft, | |
153 | 2, 2, 2, 2) | |
154 | ); | |
155 | ||
156 | cf1->Resize(fYStrips->GetDefaultWidth()+10, fMain->GetDefaultHeight()); | |
157 | ||
158 | cf1->AddFrame(fEditStrips = new TGCheckButton(cf1, "Set/unset strips", 3), | |
159 | new TGLayoutHints(kLHintsTop | | |
160 | kLHintsLeft, | |
161 | 2, 2, 2, 2) | |
162 | ); | |
163 | ||
164 | fXStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()"); | |
165 | fYStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleButtons()"); | |
166 | fEditStrips->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "HandleEditButton()"); | |
167 | ||
168 | cf0->AddFrame(cf1, | |
169 | new TGLayoutHints(kLHintsTop | | |
170 | kLHintsExpandX, | |
171 | 2, 2, 2, 2) | |
172 | ); | |
173 | ||
174 | TGCompositeFrame *cf2 = new TGCompositeFrame(cf0, 60, 20, kHorizontalFrame | kFixedWidth); | |
175 | ||
176 | TGTextButton *digitsButton = new TGTextButton(cf2, "Digits", 4); | |
177 | digitsButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoDigits()"); | |
178 | ||
179 | //cf2->Resize(digitsButton->GetDefaultWidth()+40, fMain->GetDefaultHeight()); | |
180 | ||
181 | cf2->AddFrame(digitsButton, | |
182 | new TGLayoutHints(kLHintsTop | | |
183 | kLHintsLeft | | |
184 | kLHintsExpandX, | |
185 | 2, 2, 5, 5) | |
186 | ); | |
187 | ||
188 | TGTextButton *dresetButton = new TGTextButton(cf2, "Reset", 5); | |
189 | dresetButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "ResetDigits()"); | |
190 | ||
191 | //cf2->Resize(dresetButton->GetDefaultWidth()+40, fMain->GetDefaultHeight()); | |
192 | ||
193 | cf2->AddFrame(dresetButton, | |
194 | new TGLayoutHints(kLHintsTop | | |
195 | kLHintsLeft | | |
196 | kLHintsExpandX, | |
197 | 2, 2, 5, 5) | |
198 | ); | |
199 | ||
200 | TGTextButton *closeButton = new TGTextButton(cf2, "Close", 6); | |
201 | closeButton->Connect("Clicked()", "AliMUONTriggerGUIbdmap", this, "DoClose()"); | |
202 | ||
203 | //cf2->Resize(closeButton->GetDefaultWidth()+40, fMain->GetDefaultHeight()); | |
204 | ||
205 | cf2->AddFrame(closeButton, | |
206 | new TGLayoutHints(kLHintsTop | | |
207 | kLHintsLeft | | |
208 | kLHintsExpandX, | |
209 | 2, 2, 5, 5) | |
210 | ); | |
211 | ||
212 | cf0->AddFrame(cf2, | |
213 | new TGLayoutHints(kLHintsTop | | |
214 | kLHintsExpandX, | |
215 | 2, 2, 2, 2) | |
216 | ); | |
217 | ||
218 | // editor window for the local trigger | |
219 | ||
220 | TGCompositeFrame *cf3 = new TGCompositeFrame(cf0, 60, 20, kVerticalFrame | kFixedWidth); | |
221 | ||
222 | fLocTrigE = new TGTextEdit(cf3, 100, 100, kSunkenFrame | kDoubleBorder); | |
223 | cf3->AddFrame(fLocTrigE, | |
224 | new TGLayoutHints(kLHintsExpandX | | |
225 | kLHintsExpandY, | |
226 | 3, 3, 3, 3) | |
227 | ); | |
228 | ||
229 | cf0->AddFrame(cf3, | |
230 | new TGLayoutHints(kLHintsTop | | |
231 | kLHintsExpandX, | |
232 | 2, 2, 2, 2) | |
233 | ); | |
234 | ||
235 | fMain->AddFrame(cf0, | |
236 | new TGLayoutHints(kLHintsTop | | |
237 | kLHintsExpandX, | |
238 | 2, 2, 2, 2) | |
239 | ); | |
240 | ||
241 | fIsEditable = kFALSE; | |
242 | fLabelX = kFALSE; | |
243 | fLabelY = kFALSE; | |
244 | ||
245 | fMain->MapSubwindows(); | |
246 | fMain->Resize(); | |
247 | ||
248 | fMain->CenterOnParent(); | |
249 | ||
250 | //fMain->MapWindow(); | |
251 | //gClient->WaitFor(fMain); | |
252 | ||
253 | } | |
254 | ||
255 | //__________________________________________________________________________ | |
256 | AliMUONTriggerGUIbdmap::~AliMUONTriggerGUIbdmap() | |
257 | { | |
258 | /// frame destructor | |
259 | ||
260 | fMain->DeleteWindow(); | |
261 | ||
262 | } | |
263 | ||
905654c2 | 264 | //__________________________________________________________________________ |
265 | void AliMUONTriggerGUIbdmap::Show() | |
266 | { | |
267 | /// map the main frame | |
268 | ||
269 | fMain->MapWindow(); | |
270 | LocalTriggerInfo(); | |
271 | ||
272 | } | |
273 | ||
274 | //__________________________________________________________________________ | |
275 | void AliMUONTriggerGUIbdmap::LocalTriggerInfo() | |
276 | { | |
277 | /// print the local trigger | |
278 | ||
905654c2 | 279 | TGText txt; |
280 | Char_t buffer[20]; | |
281 | ||
282 | sprintf(buffer,"Local trigger info\n"); | |
283 | fLocTrigE->LoadBuffer(buffer); | |
284 | ||
285 | AliRunLoader *runLoader = fLoader->GetRunLoader(); | |
286 | gAlice = runLoader->GetAliRun(); | |
287 | ||
f9eb4448 | 288 | AliMUONVTriggerStore *triggerStore = fMCDataInterface->TriggerStore(runLoader->GetEventNumber()); |
289 | ||
905654c2 | 290 | Int_t circuitNumber = fBoard->GetIdCircuit(); |
291 | ||
905654c2 | 292 | UShort_t x2m, x2u, x2d; |
293 | ||
294 | Int_t loStripX, loStripY, loDev, loCircuit, iStripX, iStripY, loLpt, loHpt; | |
295 | AliMUONLocalTrigger *mlt; | |
bae1aa70 | 296 | |
297 | TIter next(triggerStore->CreateLocalIterator()); | |
905654c2 | 298 | |
bae1aa70 | 299 | while ( ( mlt = static_cast<AliMUONLocalTrigger*>(next()) ) ) |
300 | { | |
905654c2 | 301 | loCircuit = mlt->LoCircuit(); |
302 | ||
303 | if (loCircuit == circuitNumber) { | |
304 | ||
f9eb4448 | 305 | AliMUONLocalTriggerBoard* ltb = fCrateManager->LocalBoard(loCircuit); |
905654c2 | 306 | x2d = ltb->GetSwitch(0); |
307 | x2m = ltb->GetSwitch(1); | |
308 | x2u = ltb->GetSwitch(2); | |
309 | ||
310 | loStripX = mlt->LoStripX(); | |
311 | loStripY = mlt->LoStripY(); | |
312 | loDev = mlt->LoDev(); | |
313 | loLpt = mlt->LoLpt(); | |
314 | loHpt = mlt->LoHpt(); | |
315 | ||
316 | iStripX = loStripX/2; | |
317 | if ((x2u == 1 || x2m == 1 || x2d == 1) && x2m == 1) { | |
318 | iStripY = loStripY/2; | |
319 | } else { | |
320 | iStripY = loStripY; | |
321 | } | |
322 | ||
323 | sprintf(buffer,"Circuit = %03d",loCircuit); | |
324 | txt.LoadBuffer(buffer); | |
325 | fLocTrigE->AddText(&txt); | |
326 | ||
327 | sprintf(buffer,"LoStripX = %2d",loStripX); | |
328 | txt.LoadBuffer(buffer); | |
329 | fLocTrigE->AddText(&txt); | |
330 | ||
331 | sprintf(buffer,"LoStripY = %2d",loStripY); | |
332 | txt.LoadBuffer(buffer); | |
333 | fLocTrigE->AddText(&txt); | |
334 | ||
335 | sprintf(buffer,"LoDev = %2d",loDev); | |
336 | txt.LoadBuffer(buffer); | |
337 | fLocTrigE->AddText(&txt); | |
338 | ||
339 | sprintf(buffer,"--------------------"); | |
340 | txt.LoadBuffer(buffer); | |
341 | fLocTrigE->AddText(&txt); | |
342 | ||
343 | sprintf(buffer,"X-strip = %2d ( %2d )",iStripX,(loStripX+loDev+1)/2); | |
344 | txt.LoadBuffer(buffer); | |
345 | fLocTrigE->AddText(&txt); | |
346 | ||
347 | sprintf(buffer,"Y-strip = %2d",iStripY); | |
348 | txt.LoadBuffer(buffer); | |
349 | fLocTrigE->AddText(&txt); | |
350 | ||
351 | sprintf(buffer,"--------------------"); | |
352 | txt.LoadBuffer(buffer); | |
353 | fLocTrigE->AddText(&txt); | |
354 | ||
355 | sprintf(buffer,"LoLpt = %2d",loLpt); | |
356 | txt.LoadBuffer(buffer); | |
357 | fLocTrigE->AddText(&txt); | |
358 | ||
359 | sprintf(buffer,"LoHpt = %2d",loHpt); | |
360 | txt.LoadBuffer(buffer); | |
361 | fLocTrigE->AddText(&txt); | |
362 | ||
363 | break; | |
364 | ||
365 | } | |
366 | ||
367 | } | |
368 | ||
369 | } | |
370 | ||
371 | //__________________________________________________________________________ | |
372 | void AliMUONTriggerGUIbdmap::Init() | |
373 | { | |
374 | /// initialize the boards in the four MT | |
375 | ||
376 | TString mapspath = gSystem->Getenv("ALICE_ROOT"); | |
377 | mapspath.Append("/MUON/data"); | |
378 | ||
905654c2 | 379 | TString mapName[kNMT]; |
380 | mapName[0] = TString(mapspath.Data()); | |
381 | mapName[1] = TString(mapspath.Data()); | |
382 | mapName[2] = TString(mapspath.Data()); | |
383 | mapName[3] = TString(mapspath.Data()); | |
384 | mapName[0].Append("/guimapp11.txt"); | |
385 | mapName[1].Append("/guimapp12.txt"); | |
386 | mapName[2].Append("/guimapp13.txt"); | |
387 | mapName[3].Append("/guimapp14.txt"); | |
388 | ||
389 | Int_t side, col, line, nbx; | |
390 | Float_t xCenter, yCenter, zCenter, xWidth, yWidth; | |
391 | Char_t name[8]; | |
392 | ||
393 | FILE *fmap; | |
394 | for (Int_t i = 0; i < kNMT; i++) { | |
395 | ||
396 | fmap = fopen(mapName[i].Data(),"r"); | |
397 | ||
398 | for (Int_t ib = 0; ib < kNBoards; ib++) { | |
399 | ||
400 | fscanf(fmap,"%d %d %d %d %f %f %f %f %f %s \n",&side,&col,&line,&nbx,&xCenter,&yCenter,&xWidth,&yWidth,&zCenter,&name[0]); | |
401 | ||
402 | if (side == 0) { | |
403 | sprintf(name,"LC%1dL%1dB%1d%1d",col,line,2*nbx-1,2*nbx); | |
404 | } | |
405 | if (side == 1) { | |
406 | sprintf(name,"RC%1dL%1dB%1d%1d",col,line,2*nbx-1,2*nbx); | |
407 | } | |
408 | ||
409 | if (strncmp(name,fBoard->GetBoardName(),7) == 0) { | |
410 | fXWidth[i] = xWidth; | |
411 | fYWidth[i] = yWidth; | |
412 | fXCenter[i] = xCenter; | |
413 | fYCenter[i] = yCenter; | |
414 | ||
415 | fclose(fmap); | |
416 | ||
417 | break; | |
418 | } | |
419 | ||
420 | } | |
421 | ||
422 | } | |
423 | ||
424 | Float_t xw, yw; | |
425 | for (Int_t i = 0; i < kNMT; i++) { | |
426 | xw = 1.20*fXWidth[i]; | |
427 | yw = 1.20*fYWidth[i]; | |
428 | fCanvas[i]->Range(-xw/2,-yw/2,+xw/2,+yw/2); | |
429 | for (Int_t is = 0; is < kNS; is++) { | |
430 | ||
431 | fXDigPL[i][is] = new TPolyLine(5); | |
432 | fYDigPL[i][is] = new TPolyLine(5); | |
433 | fXDigPL[i][is]->SetBit(kCannotPick); | |
434 | fYDigPL[i][is]->SetBit(kCannotPick); | |
435 | fXDigPL[i][is]->SetLineColor(4); | |
436 | fYDigPL[i][is]->SetLineColor(4); | |
437 | ||
438 | fXDigBox[i][is] = new TBox(0,0,0,0); | |
439 | fYDigBox[i][is] = new TBox(0,0,0,0); | |
440 | fXDigBox[i][is]->SetBit(kCannotPick); | |
441 | fYDigBox[i][is]->SetBit(kCannotPick); | |
442 | fXDigBox[i][is]->SetFillStyle(0); | |
443 | fYDigBox[i][is]->SetFillStyle(0); | |
444 | fXDigBox[i][is]->SetLineColor(4); | |
445 | fYDigBox[i][is]->SetLineColor(4); | |
446 | ||
447 | fXLabelL[i][is] = 0; | |
448 | fXLabelR[i][is] = 0; | |
449 | fYLabelL[i][is] = 0; | |
450 | fYLabelR[i][is] = 0; | |
451 | ||
452 | } | |
453 | } | |
454 | ||
455 | ||
456 | fXOn = kFALSE; | |
457 | fYOn = kFALSE; | |
458 | ||
459 | fNStripX = fBoard->GetXSiy2() - fBoard->GetXSiy1() + 1; | |
460 | fNStripY = fBoard->GetYSix2() - fBoard->GetYSix1() + 1; | |
461 | ||
462 | } | |
463 | ||
464 | //__________________________________________________________________________ | |
465 | void AliMUONTriggerGUIbdmap::HandleEditButton() | |
466 | { | |
467 | /// handle the editable check button | |
468 | ||
469 | if (((fXOn && !fYOn) || (!fXOn && fYOn)) && | |
470 | (fEditStrips->GetState() == kButtonDown)) { | |
471 | fIsEditable = kTRUE; | |
472 | } else { | |
473 | fIsEditable = kFALSE; | |
474 | } | |
475 | ||
476 | } | |
477 | ||
478 | //__________________________________________________________________________ | |
479 | void AliMUONTriggerGUIbdmap::EditStrips(Int_t event, Int_t x, Int_t y, TObject *sel) | |
480 | { | |
481 | /// set/unset strips | |
482 | ||
483 | TString cs; | |
484 | Int_t iMT; | |
485 | Double_t *px, *py; | |
486 | Double_t xf1, yf1, xf2, yf2; | |
487 | Int_t np = 5; | |
488 | Double_t xMin, xMax, yMin, yMax; | |
489 | Float_t xd, yd, fxDim, fyDim, cDim; | |
490 | Char_t cln[2]; | |
491 | ||
492 | cDim = (Float_t)fCanvasSize; | |
493 | ||
494 | // the (x,y) event does not really go up to the canvas size... | |
495 | cDim = 196.0; | |
496 | ||
497 | if (fIsEditable) { | |
498 | ||
499 | if (event == kButton1Down) { | |
500 | ||
501 | cs = TString(sel->GetName()); | |
502 | iMT = cs.Atoi()-1; | |
503 | ||
504 | fCanvas[iMT]->cd(); | |
505 | ||
506 | fCanvas[iMT]->GetRange(xf1,yf1,xf2,yf2); | |
507 | fxDim = (Float_t)xf2; | |
508 | fyDim = (Float_t)yf2; | |
509 | ||
510 | //xd = fxDim*(+2.0*(Float_t)(x)/cDim - 1.0); | |
511 | //yd = fyDim*(-2.0*(Float_t)(y)/cDim + 1.0); | |
512 | ||
513 | xd = +(2.0*fxDim*(Float_t)(x))/cDim - fxDim; | |
514 | yd = -(2.0*fyDim*(Float_t)(y))/cDim + fyDim; | |
515 | ||
516 | if (fXOn) { | |
517 | ||
518 | for (Int_t ix = 0; ix < fNStripX; ix++) { | |
519 | ||
520 | px = fXDigPL[iMT][ix]->GetX(); | |
521 | py = fXDigPL[iMT][ix]->GetY(); | |
522 | ||
523 | xMin = +9999.; | |
524 | xMax = -9999.; | |
525 | yMin = +9999.; | |
526 | yMax = -9999.; | |
527 | for (Int_t ip = 0; ip < np; ip++) { | |
528 | xMin = TMath::Min(xMin,px[ip]); | |
529 | xMax = TMath::Max(xMax,px[ip]); | |
530 | yMin = TMath::Min(yMin,py[ip]); | |
531 | yMax = TMath::Max(yMax,py[ip]); | |
532 | } | |
533 | ||
534 | if (yd > (Float_t)yMin && yd < (Float_t)yMax) { | |
535 | ||
536 | if (fXDigBox[iMT][ix]->GetFillStyle() == 0) { | |
537 | ||
538 | fXDigBox[iMT][ix]->SetFillStyle(1001); | |
539 | fXDigBox[iMT][ix]->SetFillColor(2); | |
540 | ||
541 | sprintf(cln,"%2d",ix); | |
542 | ||
543 | fXLabelL[iMT][ix]->Clear(); | |
544 | fXLabelL[iMT][ix]->AddText(cln); | |
545 | fXLabelL[iMT][ix]->Draw(); | |
546 | ||
547 | fXLabelR[iMT][ix]->Clear(); | |
548 | fXLabelR[iMT][ix]->AddText(cln); | |
549 | fXLabelR[iMT][ix]->Draw(); | |
550 | ||
551 | fXDigBox[iMT][ix]->SetX1(xMin); | |
552 | fXDigBox[iMT][ix]->SetY1(yMin); | |
553 | fXDigBox[iMT][ix]->SetX2(xMax); | |
554 | fXDigBox[iMT][ix]->SetY2(yMax); | |
555 | ||
556 | fXDigBox[iMT][ix]->Draw(); | |
557 | ||
558 | } else if (fXDigBox[iMT][ix]->GetFillStyle() == 1001) { | |
559 | ||
560 | fXDigBox[iMT][ix]->SetFillStyle(0); | |
561 | ||
562 | fXLabelL[iMT][ix]->Clear(); | |
563 | fXLabelL[iMT][ix]->Draw(); | |
564 | ||
565 | fXLabelR[iMT][ix]->Clear(); | |
566 | fXLabelR[iMT][ix]->Draw(); | |
567 | ||
568 | fXDigBox[iMT][ix]->SetX1(-fBoard->GetXCenter(iMT)); | |
569 | fXDigBox[iMT][ix]->SetY1(-fBoard->GetYCenter(iMT)); | |
570 | fXDigBox[iMT][ix]->SetX2(-fBoard->GetXCenter(iMT)); | |
571 | fXDigBox[iMT][ix]->SetY2(-fBoard->GetYCenter(iMT)); | |
572 | ||
573 | fXDigBox[iMT][ix]->Draw(); | |
574 | ||
575 | } | |
576 | ||
577 | if (!fXDigBox[iMT][ix]->TestBit(kObjInCanvas)) | |
578 | fXDigBox[iMT][ix]->Draw(); | |
579 | ||
580 | fCanvas[iMT]->Modified(); | |
581 | fCanvas[iMT]->Update(); | |
582 | ||
583 | break; | |
584 | ||
585 | } | |
586 | } | |
587 | ||
588 | } | |
589 | ||
590 | if (fYOn) { | |
591 | ||
592 | for (Int_t iy = 0; iy < fNStripY; iy++) { | |
593 | ||
594 | px = fYDigPL[iMT][iy]->GetX(); | |
595 | py = fYDigPL[iMT][iy]->GetY(); | |
596 | ||
597 | xMin = +9999.; | |
598 | xMax = -9999.; | |
599 | yMin = +9999.; | |
600 | yMax = -9999.; | |
601 | for (Int_t ip = 0; ip < np; ip++) { | |
602 | xMin = TMath::Min(xMin,px[ip]); | |
603 | xMax = TMath::Max(xMax,px[ip]); | |
604 | yMin = TMath::Min(yMin,py[ip]); | |
605 | yMax = TMath::Max(yMax,py[ip]); | |
606 | } | |
607 | ||
608 | if (xd > (Float_t)xMin && xd < (Float_t)xMax) { | |
609 | ||
610 | if (fYDigBox[iMT][iy]->GetFillStyle() == 0) { | |
611 | ||
612 | fYDigBox[iMT][iy]->SetFillStyle(1001); | |
613 | fYDigBox[iMT][iy]->SetFillColor(2); | |
614 | ||
615 | sprintf(cln,"%2d",iy); | |
616 | ||
617 | fYLabelL[iMT][iy]->Clear(); | |
618 | fYLabelL[iMT][iy]->AddText(cln); | |
619 | fYLabelL[iMT][iy]->Draw(); | |
620 | ||
621 | fYLabelR[iMT][iy]->Clear(); | |
622 | fYLabelR[iMT][iy]->AddText(cln); | |
623 | fYLabelR[iMT][iy]->Draw(); | |
624 | ||
625 | fYDigBox[iMT][iy]->SetX1(xMin); | |
626 | fYDigBox[iMT][iy]->SetY1(yMin); | |
627 | fYDigBox[iMT][iy]->SetX2(xMax); | |
628 | fYDigBox[iMT][iy]->SetY2(yMax); | |
629 | ||
630 | //fYDigBox[iMT][iy]->Draw(); | |
631 | ||
632 | } else if (fYDigBox[iMT][iy]->GetFillStyle() == 1001) { | |
633 | ||
634 | fYDigBox[iMT][iy]->SetFillStyle(0); | |
635 | ||
636 | fYLabelL[iMT][iy]->Clear(); | |
637 | fYLabelL[iMT][iy]->Draw(); | |
638 | ||
639 | fYLabelR[iMT][iy]->Clear(); | |
640 | fYLabelR[iMT][iy]->Draw(); | |
641 | ||
642 | fYDigBox[iMT][iy]->SetX1(-fBoard->GetXCenter(iMT)); | |
643 | fYDigBox[iMT][iy]->SetY1(-fBoard->GetYCenter(iMT)); | |
644 | fYDigBox[iMT][iy]->SetX2(-fBoard->GetXCenter(iMT)); | |
645 | fYDigBox[iMT][iy]->SetY2(-fBoard->GetYCenter(iMT)); | |
646 | ||
647 | //fYDigBox[iMT][iy]->Draw(); | |
648 | ||
649 | } | |
650 | ||
651 | if (!fYDigBox[iMT][iy]->TestBit(kObjInCanvas)) | |
652 | fYDigBox[iMT][iy]->Draw(); | |
653 | ||
654 | fCanvas[iMT]->Modified(); | |
655 | fCanvas[iMT]->Update(); | |
656 | ||
657 | break; | |
658 | ||
659 | } | |
660 | } | |
661 | ||
662 | } | |
663 | ||
664 | } // end button event | |
665 | ||
666 | } // end IsEditable | |
667 | ||
668 | } | |
669 | ||
670 | //__________________________________________________________________________ | |
671 | void AliMUONTriggerGUIbdmap::DoDigits() | |
672 | { | |
673 | /// set the board digits from GUI input (set/unset) | |
674 | ||
675 | Int_t amp = 0; | |
676 | Int_t number = fBoard->GetNumber(); | |
677 | Int_t pos, over; | |
678 | pos = fBoard->GetPosition(); | |
679 | over = fBoard->GetYOver(); | |
680 | AliMUONTriggerGUIboard *board; | |
681 | ||
682 | for (Int_t imt = 0; imt < kNMT; imt++) { | |
683 | ||
684 | for (Int_t ix = 0; ix < fNStripX; ix++) { | |
685 | if (fXDigBox[imt][ix]->GetFillStyle() == 0) { | |
686 | amp = 0; | |
687 | } | |
688 | if (fXDigBox[imt][ix]->GetFillStyle() == 1001) { | |
689 | amp = 1; | |
690 | } | |
691 | fBoard->SetDigitX(imt,ix,amp); | |
692 | } | |
693 | ||
694 | for (Int_t iy = 0; iy < fNStripY; iy++) { | |
695 | if (fYDigBox[imt][iy]->GetFillStyle() == 0) { | |
696 | amp = 0; | |
697 | } | |
698 | if (fYDigBox[imt][iy]->GetFillStyle() == 1001) { | |
699 | amp = 1; | |
700 | } | |
701 | fBoard->SetDigitY(imt,iy,amp); | |
702 | ||
703 | // extended y-strips | |
704 | for (Int_t io = 1; io <= over; io++) { | |
705 | if (io == pos) continue; | |
706 | board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos); | |
707 | board->SetDigitY(imt,iy,amp); | |
708 | } | |
709 | ||
710 | } | |
711 | ||
712 | } | |
713 | ||
714 | } | |
715 | ||
716 | //__________________________________________________________________________ | |
717 | void AliMUONTriggerGUIbdmap::ResetDigits() | |
718 | { | |
719 | /// set the board digits from GUI input (set/unset) | |
720 | ||
721 | Int_t amp = 0; | |
722 | Int_t number = fBoard->GetNumber(); | |
723 | AliMUONTriggerGUIboard *board; | |
724 | Int_t pos, over; | |
725 | pos = fBoard->GetPosition(); | |
726 | over = fBoard->GetYOver(); | |
727 | ||
728 | for (Int_t imt = 0; imt < kNMT; imt++) { | |
729 | for (Int_t ix = 0; ix < fNStripX; ix++) { | |
730 | fXDigBox[imt][ix]->SetFillStyle(0); | |
731 | fXDigBox[imt][ix]->SetX1(-fBoard->GetXCenter(imt)); | |
732 | fXDigBox[imt][ix]->SetY1(-fBoard->GetYCenter(imt)); | |
733 | fXDigBox[imt][ix]->SetX2(-fBoard->GetXCenter(imt)); | |
734 | fXDigBox[imt][ix]->SetY2(-fBoard->GetYCenter(imt)); | |
735 | ||
736 | fBoard->SetDigitX(imt,ix,amp); | |
737 | } | |
738 | for (Int_t iy = 0; iy < fNStripY; iy++) { | |
739 | fYDigBox[imt][iy]->SetFillStyle(0); | |
740 | fYDigBox[imt][iy]->SetX1(-fBoard->GetXCenter(imt)); | |
741 | fYDigBox[imt][iy]->SetY1(-fBoard->GetYCenter(imt)); | |
742 | fYDigBox[imt][iy]->SetX2(-fBoard->GetXCenter(imt)); | |
743 | fYDigBox[imt][iy]->SetY2(-fBoard->GetYCenter(imt)); | |
744 | ||
745 | fBoard->SetDigitY(imt,iy,amp); | |
746 | ||
747 | // extended y-strips | |
748 | for (Int_t io = 1; io <= over; io++) { | |
749 | if (io == pos) continue; | |
750 | board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos); | |
751 | ||
752 | board->SetDigitY(imt,iy,amp); | |
753 | ||
754 | } | |
755 | ||
756 | } | |
757 | } | |
758 | ||
759 | fBoard->ClearXDigits(); | |
760 | fBoard->ClearYDigits(); | |
761 | ||
762 | // extended y-strips | |
763 | for (Int_t io = 1; io <= over; io++) { | |
764 | if (io == pos) continue; | |
765 | board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos); | |
766 | board->ClearYDigits(); | |
767 | } | |
768 | ||
769 | fXStrips->SetState(kButtonUp); | |
770 | fYStrips->SetState(kButtonUp); | |
771 | fEditStrips->SetState(kButtonUp); | |
772 | fIsEditable = kFALSE; | |
773 | ||
774 | DrawClear(); | |
775 | fXOn = kFALSE; | |
776 | fYOn = kFALSE; | |
777 | ||
778 | } | |
779 | ||
780 | //__________________________________________________________________________ | |
781 | void AliMUONTriggerGUIbdmap::HandleButtons(Int_t id) | |
782 | { | |
783 | /// handle the check buttons | |
784 | ||
785 | if (id == -1) { | |
786 | TGButton *btn = (TGButton *) gTQSender; | |
787 | id = btn->WidgetId(); | |
788 | } | |
789 | ||
790 | // draw x and y | |
791 | if(fXStrips->GetState() == kButtonDown && | |
792 | fYStrips->GetState() == kButtonDown ) { | |
793 | ||
794 | DrawClear(); | |
795 | DrawStrips(kTRUE,kTRUE); | |
796 | DrawDigits(kTRUE,kTRUE); | |
797 | fXOn = kTRUE; | |
798 | fYOn = kTRUE; | |
799 | ||
800 | } | |
801 | ||
802 | // draw only x | |
803 | if(fXStrips->GetState() == kButtonDown && | |
804 | fYStrips->GetState() == kButtonUp ) { | |
805 | ||
806 | DrawClear(); | |
807 | DrawStrips(kTRUE,kFALSE); | |
808 | DrawDigits(kTRUE,kFALSE); | |
809 | fXOn = kTRUE; | |
810 | fYOn = kFALSE; | |
811 | ||
812 | } | |
813 | ||
814 | // draw only y | |
815 | if(fXStrips->GetState() == kButtonUp && | |
816 | fYStrips->GetState() == kButtonDown ) { | |
817 | ||
818 | DrawClear(); | |
819 | DrawStrips(kFALSE,kTRUE); | |
820 | DrawDigits(kFALSE,kTRUE); | |
821 | fXOn = kFALSE; | |
822 | fYOn = kTRUE; | |
823 | ||
824 | } | |
825 | ||
826 | // clear | |
827 | if(fXStrips->GetState() == kButtonUp && | |
828 | fYStrips->GetState() == kButtonUp ) { | |
829 | ||
830 | DrawClear(); | |
831 | fXOn = kFALSE; | |
832 | fYOn = kFALSE; | |
833 | ||
834 | } | |
835 | ||
836 | HandleEditButton(); | |
837 | ||
838 | } | |
839 | ||
840 | //__________________________________________________________________________ | |
841 | void AliMUONTriggerGUIbdmap::DrawClear() | |
842 | { | |
843 | /// draw the frame of the board image in the canvas | |
844 | ||
845 | for (Int_t i = 0; i < kNMT; i++) { | |
846 | ||
847 | fCanvas[i]->cd(); | |
848 | fCanvas[i]->Clear(); | |
849 | ||
850 | fCanvas[i]->Modified(); | |
851 | fCanvas[i]->Update(); | |
852 | ||
853 | } | |
854 | ||
855 | } | |
856 | ||
857 | //__________________________________________________________________________ | |
858 | void AliMUONTriggerGUIbdmap::DrawDigits(Bool_t bx, Bool_t by) | |
859 | { | |
860 | /// draw the digits in "x" or/and "y" | |
861 | ||
862 | AliRunLoader *runLoader = fLoader->GetRunLoader(); | |
863 | gAlice = runLoader->GetAliRun(); | |
864 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
865 | const AliMUONGeometryTransformer* kGeomTransformer = pMUON->GetGeometryTransformer(); | |
866 | ||
867 | AliMUONTriggerGUIboard *board; | |
bae1aa70 | 868 | Int_t over, pos, number; |
905654c2 | 869 | const AliMpVSegmentation* seg; |
905654c2 | 870 | AliMpPad pad; |
871 | Int_t cathode, detElemId, ix, iy, charge; | |
872 | Int_t chamber, np = 5; | |
873 | AliMpDEIterator it; | |
874 | Float_t xpmin, xpmax, ypmin, ypmax; | |
875 | Float_t xg1, xg2, yg1, yg2, zg1; | |
876 | Float_t xdw, ydw, xcw, ycw; | |
877 | Double_t xc1, xc2, yc1, yc2; | |
878 | Char_t cln[2]; | |
879 | TBox *boxd; | |
880 | Double_t xMin, xMax, yMin, yMax; | |
881 | Double_t *px, *py; | |
882 | ||
883 | number = fBoard->GetNumber(); | |
884 | pos = fBoard->GetPosition(); | |
885 | over = fBoard->GetYOver(); | |
886 | ||
f9eb4448 | 887 | AliMUONVDigitStore *digitStore = fMCDataInterface->DigitStore(runLoader->GetEventNumber()); |
bae1aa70 | 888 | |
905654c2 | 889 | for (Int_t i = 0; i < kNMT; i++) { |
890 | ||
891 | fCanvas[i]->cd(); | |
892 | ||
893 | fCanvas[i]->GetRange(xc1,yc1,xc2,yc2); | |
894 | xcw = (Float_t)(0.5*(xc2-xc1)); | |
895 | ycw = (Float_t)(0.5*(yc2-yc1)); | |
896 | ||
897 | chamber = 11+i; | |
898 | ||
bae1aa70 | 899 | AliMpIntPair deRange = AliMpDEManager::GetDetElemIdRange(chamber-1); |
900 | TIter next(digitStore->CreateIterator(deRange.GetFirst(),deRange.GetSecond())); | |
901 | AliMUONVDigit *mdig; | |
905654c2 | 902 | |
bae1aa70 | 903 | while ( ( mdig = static_cast<AliMUONVDigit*>(next())) ) |
904 | { | |
905654c2 | 905 | cathode = mdig->Cathode()+1; |
906 | ||
907 | ix = mdig->PadX(); | |
908 | iy = mdig->PadY(); | |
909 | detElemId = mdig->DetElemId(); | |
bae1aa70 | 910 | charge = (Int_t)mdig->Charge(); |
905654c2 | 911 | |
912 | Bool_t triggerBgn = kFALSE; | |
913 | Int_t schg = (Int_t)(charge + 0.5); | |
914 | // APPLY CONDITION ON SOFT BACKGROUND | |
915 | Int_t tchg = schg - (Int_t(schg/10))*10; | |
916 | if (schg<=10 || tchg>0) { | |
917 | triggerBgn = kFALSE; | |
918 | } else { | |
919 | triggerBgn = kTRUE; | |
920 | } | |
921 | ||
922 | if (detElemId%100 != fBoard->GetDetElemId()) continue; | |
923 | ||
924 | seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode-1)); | |
925 | ||
926 | pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); | |
927 | ||
928 | //if (cathode == 1) printf("GUI x: ix %d iy %d \n",ix,iy); | |
929 | //if (cathode == 2) printf("GUI y: ix %d iy %d \n",ix,iy); | |
930 | ||
931 | // get the pad position and dimensions | |
932 | Float_t xlocal1 = pad.Position().X(); | |
933 | Float_t ylocal1 = pad.Position().Y(); | |
934 | Float_t xlocal2 = pad.Dimensions().X(); | |
935 | Float_t ylocal2 = pad.Dimensions().Y(); | |
936 | ||
937 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); | |
938 | // (no transformation for pad dimensions) | |
939 | xg2 = xlocal2; | |
940 | yg2 = ylocal2; | |
941 | ||
942 | // transform in the monitor coordinate system | |
943 | //xpmin = -(xg1+xg2); | |
944 | //xpmax = -(xg1-xg2); | |
945 | //ypmin = -(yg2-yg1); | |
946 | //ypmax = +(yg2+yg1); | |
947 | // ALICE SC | |
948 | xpmin = +(xg1-xg2); | |
949 | xpmax = +(xg1+xg2); | |
950 | ypmin = -(yg2-yg1); | |
951 | ypmax = +(yg2+yg1); | |
952 | ||
953 | xpmin -= fXCenter[i]; | |
954 | xpmax -= fXCenter[i]; | |
955 | ypmin -= fYCenter[i]; | |
956 | ypmax -= fYCenter[i]; | |
957 | ||
958 | xdw = xpmax-xpmin; | |
959 | ydw = ypmax-ypmin; | |
960 | ||
961 | // x-strips | |
962 | if ((xdw > ydw) && bx) { | |
963 | ||
964 | //printf("X strips mdig->Cathode() = %1d \n",mdig->Cathode()); | |
965 | ||
966 | Int_t iX, iY1, iY2; | |
967 | iX = fBoard->GetXSix(); | |
968 | iY1 = fBoard->GetXSiy1(); | |
969 | iY2 = fBoard->GetXSiy2(); | |
970 | if (ix == iX && iy >= iY1 && iy <= iY2) { | |
971 | //printf("Digit indices (x-strip) ix = %3d iy = %3d board = %s %d chamber = %2d \n",ix,iy,fBoard->GetBoardName(),fBoard->GetNumber(),chamber); | |
972 | /* | |
973 | xpmin += 0.01*fXWidth[i]; | |
974 | xpmax -= 0.01*fXWidth[i]; | |
975 | ypmin += 0.1*ydw; | |
976 | ypmax -= 0.1*ydw; | |
977 | */ | |
978 | boxd = new TBox(xpmin,ypmin,xpmax,ypmax); | |
979 | boxd->SetFillStyle(1001); | |
980 | if (triggerBgn) boxd->SetFillColor(6); | |
981 | else boxd->SetFillColor(5); | |
982 | boxd->SetBit(kCannotPick); | |
983 | boxd->Draw(); | |
984 | ||
985 | fXDigBox[i][iy-iY1]->SetFillStyle(1001); | |
986 | fXDigBox[i][iy-iY1]->SetFillColor(2); | |
987 | fXDigBox[i][iy-iY1]->SetX1(xpmin); | |
988 | fXDigBox[i][iy-iY1]->SetY1(ypmin); | |
989 | fXDigBox[i][iy-iY1]->SetX2(xpmax); | |
990 | fXDigBox[i][iy-iY1]->SetY2(ypmax); | |
991 | fXDigBox[i][iy-iY1]->Draw(); | |
992 | ||
993 | sprintf(cln,"%2d",(iy-iY1)); | |
994 | fXLabelL[i][iy-iY1]->Clear(); | |
995 | fXLabelL[i][iy-iY1]->AddText(cln); | |
996 | fXLabelL[i][iy-iY1]->Draw(); | |
997 | fXLabelR[i][iy-iY1]->Clear(); | |
998 | fXLabelR[i][iy-iY1]->AddText(cln); | |
999 | fXLabelR[i][iy-iY1]->Draw(); | |
1000 | ||
1001 | fBoard->SetDigitX(i,iy-iY1,charge); | |
1002 | ||
1003 | } | |
1004 | ||
1005 | } | |
1006 | ||
1007 | // y-strips | |
1008 | if ((xdw < ydw) && by) { | |
1009 | ||
1010 | //printf("Y strips mdig->Cathode() = %1d \n",mdig->Cathode()); | |
1011 | ||
1012 | Int_t iX1, iX2, iY; | |
1013 | iX1 = fBoard->GetYSix1(); | |
1014 | iX2 = fBoard->GetYSix2(); | |
1015 | iY = fBoard->GetYSiy(); | |
1016 | if (ix >= iX1 && ix <= iX2 && iy == iY) { | |
1017 | //printf("Digit indices (y-strip) ix = %3d iy = %3d board = %s chamber = %2d \n",ix,iy,fBoard->GetBoardName(),chamber); | |
1018 | ypmin = -0.5*fYWidth[i]; | |
1019 | ypmax = +0.5*fYWidth[i]; | |
1020 | /* | |
1021 | ypmin = -0.5*fYWidth[i]; | |
1022 | ypmax = +0.5*fYWidth[i]; | |
1023 | ypmin += 0.01*fYWidth[i]; | |
1024 | ypmax -= 0.01*fYWidth[i]; | |
1025 | xpmin += 0.1*xdw; | |
1026 | xpmax -= 0.1*xdw; | |
1027 | */ | |
1028 | boxd = new TBox(xpmin,ypmin,xpmax,ypmax); | |
1029 | boxd->SetFillStyle(1001); | |
1030 | if (triggerBgn) boxd->SetFillColor(6); | |
1031 | else boxd->SetFillColor(5); | |
1032 | boxd->SetBit(kCannotPick); | |
1033 | boxd->Draw(); | |
1034 | ||
1035 | fYDigBox[i][ix-iX1]->SetFillStyle(1001); | |
1036 | fYDigBox[i][ix-iX1]->SetFillColor(2); | |
1037 | fYDigBox[i][ix-iX1]->SetX1(xpmin); | |
1038 | fYDigBox[i][ix-iX1]->SetY1(ypmin); | |
1039 | fYDigBox[i][ix-iX1]->SetX2(xpmax); | |
1040 | fYDigBox[i][ix-iX1]->SetY2(ypmax); | |
1041 | fYDigBox[i][ix-iX1]->Draw(); | |
1042 | ||
1043 | sprintf(cln,"%2d",(ix-iX1)); | |
1044 | fYLabelL[i][ix-iX1]->Clear(); | |
1045 | fYLabelL[i][ix-iX1]->AddText(cln); | |
1046 | fYLabelL[i][ix-iX1]->Draw(); | |
1047 | fYLabelR[i][ix-iX1]->Clear(); | |
1048 | fYLabelR[i][ix-iX1]->AddText(cln); | |
1049 | fYLabelR[i][ix-iX1]->Draw(); | |
1050 | ||
1051 | fBoard->SetDigitY(i,ix-iX1,charge); | |
1052 | ||
1053 | // extended y-strips | |
1054 | for (Int_t io = 1; io <= over; io++) { | |
1055 | if (io == pos) continue; | |
1056 | board = (AliMUONTriggerGUIboard*)fBoards->UncheckedAt(number+io-pos); | |
1057 | board->SetDigitY(i,ix-iX1,charge); | |
1058 | } | |
1059 | ||
1060 | } | |
1061 | } | |
1062 | ||
1063 | } // end digits loop | |
1064 | ||
1065 | // x-strips DSET | |
1066 | if (bx) { | |
1067 | ||
94e6e78e | 1068 | for (ix = 0; ix < fNStripX; ix++) { |
905654c2 | 1069 | //if (fBoard->GetXDig(i,ix) > 0) { |
1070 | if (fXDigBox[i][ix]->GetFillStyle() == 1001 || | |
1071 | fBoard->GetXDig(i,ix) > 0) { | |
1072 | ||
1073 | px = fXDigPL[i][ix]->GetX(); | |
1074 | py = fXDigPL[i][ix]->GetY(); | |
1075 | ||
1076 | xMin = +9999.; | |
1077 | xMax = -9999.; | |
1078 | yMin = +9999.; | |
1079 | yMax = -9999.; | |
1080 | for (Int_t ip = 0; ip < np; ip++) { | |
1081 | xMin = TMath::Min(xMin,px[ip]); | |
1082 | xMax = TMath::Max(xMax,px[ip]); | |
1083 | yMin = TMath::Min(yMin,py[ip]); | |
1084 | yMax = TMath::Max(yMax,py[ip]); | |
1085 | } | |
1086 | ||
1087 | if (fXDigBox[i][ix]->GetFillStyle() == 0) { | |
1088 | fXDigBox[i][ix]->SetFillStyle(1001); | |
1089 | fXDigBox[i][ix]->SetFillColor(2); | |
1090 | fXDigBox[i][ix]->SetX1(xMin); | |
1091 | fXDigBox[i][ix]->SetY1(yMin); | |
1092 | fXDigBox[i][ix]->SetX2(xMax); | |
1093 | fXDigBox[i][ix]->SetY2(yMax); | |
1094 | } | |
1095 | ||
1096 | sprintf(cln,"%2d",ix); | |
1097 | ||
1098 | fXLabelL[i][ix]->Clear(); | |
1099 | fXLabelL[i][ix]->AddText(cln); | |
1100 | fXLabelL[i][ix]->Draw(); | |
1101 | ||
1102 | fXLabelR[i][ix]->Clear(); | |
1103 | fXLabelR[i][ix]->AddText(cln); | |
1104 | fXLabelR[i][ix]->Draw(); | |
1105 | ||
1106 | fXDigBox[i][ix]->Draw(); | |
1107 | ||
1108 | } | |
1109 | ||
1110 | } | |
1111 | ||
1112 | } | |
1113 | ||
1114 | // y-strips DSET | |
1115 | if (by) { | |
1116 | ||
94e6e78e | 1117 | for (iy = 0; iy < fNStripY; iy++) { |
905654c2 | 1118 | //if (fBoard->GetYDig(i,iy) > 0) { |
1119 | if (fYDigBox[i][iy]->GetFillStyle() == 1001 || | |
1120 | fBoard->GetYDig(i,iy) > 0) { | |
1121 | ||
1122 | px = fYDigPL[i][iy]->GetX(); | |
1123 | py = fYDigPL[i][iy]->GetY(); | |
1124 | ||
1125 | xMin = +9999.; | |
1126 | xMax = -9999.; | |
1127 | yMin = +9999.; | |
1128 | yMax = -9999.; | |
1129 | for (Int_t ip = 0; ip < np; ip++) { | |
1130 | xMin = TMath::Min(xMin,px[ip]); | |
1131 | xMax = TMath::Max(xMax,px[ip]); | |
1132 | yMin = TMath::Min(yMin,py[ip]); | |
1133 | yMax = TMath::Max(yMax,py[ip]); | |
1134 | } | |
1135 | ||
1136 | if (fYDigBox[i][iy]->GetFillStyle() == 0) { | |
1137 | fYDigBox[i][iy]->SetFillStyle(1001); | |
1138 | fYDigBox[i][iy]->SetFillColor(2); | |
1139 | fYDigBox[i][iy]->SetX1(xMin); | |
1140 | fYDigBox[i][iy]->SetY1(yMin); | |
1141 | fYDigBox[i][iy]->SetX2(xMax); | |
1142 | fYDigBox[i][iy]->SetY2(yMax); | |
1143 | } | |
1144 | ||
1145 | sprintf(cln,"%2d",iy); | |
1146 | ||
1147 | fYLabelL[i][iy]->Clear(); | |
1148 | fYLabelL[i][iy]->AddText(cln); | |
1149 | fYLabelL[i][iy]->Draw(); | |
1150 | ||
1151 | fYLabelR[i][iy]->Clear(); | |
1152 | fYLabelR[i][iy]->AddText(cln); | |
1153 | fYLabelR[i][iy]->Draw(); | |
1154 | ||
1155 | ||
1156 | fYDigBox[i][iy]->Draw(); | |
1157 | ||
1158 | } | |
1159 | ||
1160 | } | |
1161 | ||
1162 | } | |
1163 | ||
1164 | fCanvas[i]->Modified(); | |
1165 | fCanvas[i]->Update(); | |
1166 | ||
1167 | } // end canvas loop | |
1168 | ||
1169 | fMain->MapWindow(); | |
1170 | ||
1171 | } | |
1172 | ||
1173 | //__________________________________________________________________________ | |
1174 | void AliMUONTriggerGUIbdmap::DrawStrips(Bool_t bx, Bool_t by) | |
1175 | { | |
1176 | /// draw the "x" or/and "y" strips | |
1177 | ||
1178 | AliRunLoader *runLoader = fLoader->GetRunLoader(); | |
1179 | gAlice = runLoader->GetAliRun(); | |
1180 | AliMUON *pMUON = (AliMUON*)gAlice->GetModule("MUON"); | |
1181 | const AliMUONGeometryTransformer* kGeomTransformer = pMUON->GetGeometryTransformer(); | |
1182 | ||
1183 | const AliMpVSegmentation* seg; | |
1184 | AliMpPad pad; | |
1185 | AliMpDEIterator it; | |
1186 | Int_t chamber; | |
1187 | Float_t xg1, xg2, yg1, yg2, zg1; | |
1188 | Float_t xlocal1, xlocal2, ylocal1, ylocal2; | |
1189 | Int_t detElemId, ic, maxX, maxY; | |
1190 | Float_t xdw, ydw, xpmin, xpmax, ypmin, ypmax; | |
1191 | Float_t ptx1, ptx2, pty1, pty2; | |
1192 | Char_t cln[2]; | |
1193 | Double_t xc1, xc2, yc1, yc2; | |
1194 | Float_t xcw, ycw; | |
1195 | ||
1196 | Bool_t makeLabelsX = kFALSE; | |
1197 | Bool_t makeLabelsY = kFALSE; | |
1198 | ||
1199 | if (bx && !fLabelX) { | |
1200 | makeLabelsX = kTRUE; | |
1201 | fLabelX = kTRUE; | |
1202 | } | |
1203 | ||
1204 | if (by && !fLabelY) { | |
1205 | makeLabelsY = kTRUE; | |
1206 | fLabelY = kTRUE; | |
1207 | } | |
1208 | ||
1209 | for (Int_t i = 0; i < kNMT; i++) { | |
1210 | ||
1211 | fCanvas[i]->cd(); | |
1212 | ||
1213 | fCanvas[i]->GetRange(xc1,yc1,xc2,yc2); | |
1214 | xcw = (Float_t)(0.5*(xc2-xc1)); | |
1215 | ycw = (Float_t)(0.5*(yc2-yc1)); | |
1216 | ||
1217 | chamber = 11+i; | |
1218 | ||
1219 | for ( it.First(chamber-1); ! it.IsDone(); it.Next() ) { | |
1220 | ||
1221 | detElemId = it.CurrentDEId(); | |
1222 | ||
1223 | if (detElemId%100 != fBoard->GetDetElemId()) continue; | |
1224 | ||
1225 | /*---------- y-pads ic = 2 ----------*/ | |
1226 | ic = 2; | |
1227 | ||
1228 | seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(ic-1)); | |
1229 | ||
1230 | maxX = seg->MaxPadIndexX(); | |
1231 | maxY = seg->MaxPadIndexY(); | |
1232 | ||
1233 | for (Int_t ix = 0; ix <= maxX; ix++) { | |
1234 | for (Int_t iy = 0; iy <= maxY; iy++) { | |
1235 | ||
1236 | pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); | |
1237 | ||
1238 | if (!pad.IsValid()) continue; | |
1239 | ||
1240 | // get the pad position and dimensions | |
1241 | xlocal1 = pad.Position().X(); | |
1242 | ylocal1 = pad.Position().Y(); | |
1243 | xlocal2 = pad.Dimensions().X(); | |
1244 | ylocal2 = pad.Dimensions().Y(); | |
1245 | ||
1246 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); | |
1247 | // (no transformation for pad dimensions) | |
1248 | xg2 = xlocal2; | |
1249 | yg2 = ylocal2; | |
1250 | ||
1251 | // transform in the monitor coordinate system | |
1252 | //xpmin = -(xg1+xg2); | |
1253 | //xpmax = -(xg1-xg2); | |
1254 | //ypmin = -(yg2-yg1); | |
1255 | //ypmax = +(yg2+yg1); | |
1256 | // ALICE SC | |
1257 | xpmin = +(xg1-xg2); | |
1258 | xpmax = +(xg1+xg2); | |
1259 | ypmin = -(yg2-yg1); | |
1260 | ypmax = +(yg2+yg1); | |
1261 | ||
1262 | xpmin -= fXCenter[i]; | |
1263 | xpmax -= fXCenter[i]; | |
1264 | ypmin -= fYCenter[i]; | |
1265 | ypmax -= fYCenter[i]; | |
1266 | ||
1267 | xdw = xpmax-xpmin; | |
1268 | ydw = ypmax-ypmin; | |
1269 | ||
1270 | // y-strips | |
1271 | if (by) { | |
1272 | ||
1273 | Int_t iX1, iX2, iY, ixDig; | |
1274 | iX1 = fBoard->GetYSix1(); | |
1275 | iX2 = fBoard->GetYSix2(); | |
1276 | iY = fBoard->GetYSiy(); | |
1277 | if (ix >= iX1 && ix <= iX2 && iy == iY) { | |
1278 | ||
1279 | ypmin = -0.5*fYWidth[i]; | |
1280 | ypmax = +0.5*fYWidth[i]; | |
1281 | /* | |
1282 | ypmin += 0.01*fYWidth[i]; | |
1283 | ypmax -= 0.01*fYWidth[i]; | |
1284 | xpmin += 0.1*xdw; | |
1285 | xpmax -= 0.1*xdw; | |
1286 | */ | |
1287 | ixDig = ix - iX1; | |
1288 | fYDigPL[i][ixDig]->SetPoint(0,xpmin,ypmin); | |
1289 | fYDigPL[i][ixDig]->SetPoint(1,xpmax,ypmin); | |
1290 | fYDigPL[i][ixDig]->SetPoint(2,xpmax,ypmax); | |
1291 | fYDigPL[i][ixDig]->SetPoint(3,xpmin,ypmax); | |
1292 | fYDigPL[i][ixDig]->SetPoint(4,xpmin,ypmin); | |
1293 | fYDigPL[i][ixDig]->Draw(); | |
1294 | /* | |
1295 | fYDigBox[i][ixDig]->SetFillStyle(1001); | |
1296 | fYDigBox[i][ixDig]->SetFillColor(5); | |
1297 | fYDigBox[i][ixDig]->DrawBox(xpmin,ypmin,xpmax,ypmax); | |
1298 | */ | |
1299 | if (makeLabelsY) { | |
1300 | sprintf(cln,"%2d",(ix-iX1)); | |
1301 | ptx1 = xpmin; | |
1302 | ptx2 = xpmax; | |
1303 | ||
1304 | pty1 = 1.065*ypmin - 0.04*ycw; | |
1305 | pty2 = 1.065*ypmin + 0.04*ycw; | |
1306 | fYLabelL[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2); | |
1307 | fYLabelL[i][ix-iX1]->SetBorderSize(0); | |
1308 | fYLabelL[i][ix-iX1]->SetBit(kCannotPick); | |
1309 | ||
1310 | pty1 = 1.065*ypmax - 0.04*ycw; | |
1311 | pty2 = 1.065*ypmax + 0.04*ycw; | |
1312 | fYLabelR[i][ix-iX1] = new TPaveText(ptx1,pty1,ptx2,pty2); | |
1313 | fYLabelR[i][ix-iX1]->SetBorderSize(0); | |
1314 | fYLabelR[i][ix-iX1]->SetBit(kCannotPick); | |
1315 | } | |
1316 | ||
1317 | } | |
1318 | ||
1319 | } | |
1320 | ||
1321 | } // end maxY | |
1322 | ||
1323 | } // end maxX | |
1324 | ||
1325 | /*---------- x-pads ic = 1 ----------*/ | |
1326 | ic = 1; | |
1327 | ||
1328 | seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(ic-1)); | |
1329 | ||
1330 | maxX = seg->MaxPadIndexX(); | |
1331 | maxY = seg->MaxPadIndexY(); | |
1332 | ||
1333 | for (Int_t ix = 0; ix <= maxX; ix++) { | |
1334 | for (Int_t iy = 0; iy <= maxY; iy++) { | |
1335 | ||
1336 | pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); | |
1337 | ||
1338 | if (!pad.IsValid()) continue; | |
1339 | ||
1340 | // get the pad position and dimensions | |
1341 | xlocal1 = pad.Position().X(); | |
1342 | ylocal1 = pad.Position().Y(); | |
1343 | xlocal2 = pad.Dimensions().X(); | |
1344 | ylocal2 = pad.Dimensions().Y(); | |
1345 | ||
1346 | kGeomTransformer->Local2Global(detElemId, xlocal1, ylocal1, 0, xg1, yg1, zg1); | |
1347 | // (no transformation for pad dimensions) | |
1348 | xg2 = xlocal2; | |
1349 | yg2 = ylocal2; | |
1350 | ||
1351 | // transform in the monitor coordinate system | |
1352 | //xpmin = -(xg1+xg2); | |
1353 | //xpmax = -(xg1-xg2); | |
1354 | //ypmin = -(yg2-yg1); | |
1355 | //ypmax = +(yg2+yg1); | |
1356 | // ALICE SC | |
1357 | xpmin = +(xg1-xg2); | |
1358 | xpmax = +(xg1+xg2); | |
1359 | ypmin = -(yg2-yg1); | |
1360 | ypmax = +(yg2+yg1); | |
1361 | ||
1362 | xpmin -= fXCenter[i]; | |
1363 | xpmax -= fXCenter[i]; | |
1364 | ypmin -= fYCenter[i]; | |
1365 | ypmax -= fYCenter[i]; | |
1366 | xdw = xpmax-xpmin; | |
1367 | ydw = ypmax-ypmin; | |
1368 | ||
1369 | // x-strips | |
1370 | if (bx) { | |
1371 | ||
1372 | Int_t iX, iY1, iY2, iyDig; | |
1373 | iX = fBoard->GetXSix(); | |
1374 | iY1 = fBoard->GetXSiy1(); | |
1375 | iY2 = fBoard->GetXSiy2(); | |
1376 | if (ix == iX && iy >= iY1 && iy <= iY2) { | |
1377 | /* | |
1378 | xpmin += 0.01*fXWidth[i]; | |
1379 | xpmax -= 0.01*fXWidth[i]; | |
1380 | ypmin += 0.1*ydw; | |
1381 | ypmax -= 0.1*ydw; | |
1382 | */ | |
1383 | iyDig = iy - iY1; | |
1384 | fXDigPL[i][iyDig]->SetPoint(0,xpmin,ypmin); | |
1385 | fXDigPL[i][iyDig]->SetPoint(1,xpmax,ypmin); | |
1386 | fXDigPL[i][iyDig]->SetPoint(2,xpmax,ypmax); | |
1387 | fXDigPL[i][iyDig]->SetPoint(3,xpmin,ypmax); | |
1388 | fXDigPL[i][iyDig]->SetPoint(4,xpmin,ypmin); | |
1389 | fXDigPL[i][iyDig]->Draw(); | |
1390 | /* | |
1391 | fXDigBox[i][iyDig]->SetFillStyle(1001); | |
1392 | fXDigBox[i][iyDig]->SetFillColor(5); | |
1393 | fXDigBox[i][iyDig]->DrawBox(xpmin,ypmin,xpmax,ypmax); | |
1394 | */ | |
1395 | if (makeLabelsX) { | |
1396 | sprintf(cln,"%2d",(iy-iY1)); | |
1397 | pty1 = ypmin; | |
1398 | pty2 = ypmax; | |
1399 | ||
1400 | ptx1 = 1.065*xpmin - 0.04*xcw; | |
1401 | ptx2 = 1.065*xpmin + 0.04*xcw; | |
1402 | fXLabelL[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2); | |
1403 | fXLabelL[i][iy-iY1]->SetBorderSize(0); | |
1404 | fXLabelL[i][iy-iY1]->SetBit(kCannotPick); | |
1405 | ||
1406 | ptx1 = 1.065*xpmax - 0.04*xcw; | |
1407 | ptx2 = 1.065*xpmax + 0.04*xcw; | |
1408 | fXLabelR[i][iy-iY1] = new TPaveText(ptx1,pty1,ptx2,pty2); | |
1409 | fXLabelR[i][iy-iY1]->SetBorderSize(0); | |
1410 | fXLabelR[i][iy-iY1]->SetBit(kCannotPick); | |
1411 | } | |
1412 | ||
1413 | } | |
1414 | ||
1415 | } | |
1416 | ||
1417 | } // end maxY | |
1418 | ||
1419 | } // end maxX | |
1420 | ||
1421 | } // end DEIterator | |
1422 | ||
1423 | fCanvas[i]->Modified(); | |
1424 | fCanvas[i]->Update(); | |
1425 | ||
1426 | } | |
1427 | ||
1428 | fMain->MapWindow(); | |
1429 | ||
1430 | } | |
1431 | ||
1432 | //__________________________________________________________________________ | |
1433 | void AliMUONTriggerGUIbdmap::CloseWindow() | |
1434 | { | |
1435 | /// close dialog in response to window manager close. | |
1436 | ||
1437 | delete this; | |
1438 | ||
1439 | } | |
1440 | ||
1441 | //__________________________________________________________________________ | |
1442 | void AliMUONTriggerGUIbdmap::DoClose() | |
1443 | { | |
1444 | /// handle Close button. | |
1445 | ||
1446 | fBoard->SetOpen(kFALSE); | |
1447 | TTimer::SingleShot(150,"AliMUONTriggerGUIbdmap",this,"CloseWindow()"); | |
1448 | ||
1449 | } | |
1450 | ||
1451 |