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