51 #include <TRootEmbeddedCanvas.h>
53 #include <TGComboBox.h>
54 #include <TGNumberEntry.h>
55 #include <TGTextView.h>
56 #include <TGTextEntry.h>
77 : TGFrame(gClient->GetRoot(), w, h),
78 fkMainWindow(gClient->GetRoot()),
79 fMain(new TGMainFrame(gClient->GetRoot(), w, h)),
105 AliFatal(
"Could not access mapping from OCDB !");
109 AliFatal(
"Could not access run-dependent mapping from OCDB !");
115 fTrashList.SetOwner(kFALSE);
119 Int_t width = Int_t(w*0.99);
120 Int_t height = Int_t(h*0.99);
122 fEcanvas =
new TRootEmbeddedCanvas(
"Ecanvas",fMain, width, height);
123 fEcanvas->GetCanvas()->Connect(
"ProcessedEvent(Int_t, Int_t, Int_t, TObject*)",
126 "HandleMovement(Int_t, Int_t, Int_t, TObject*)");
129 TGHorizontalFrame *hframe =
new TGHorizontalFrame(fMain,width,height/6);
131 TGTextButton *draw =
new TGTextButton(hframe,
"&Draw");
132 draw->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"DrawDE()");
133 hframe->AddFrame(draw,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,15,5,3,4));
135 TGTextButton *exit =
new TGTextButton(hframe,
"&Exit",
"gApplication->Terminate(0)");
136 hframe->AddFrame(exit,
new TGLayoutHints(kLHintsLeft| kLHintsCenterY,5,5,3,4));
143 TGLabel* chamberLabel =
new TGLabel(hframe,
"Chamber :");
144 hframe->AddFrame(chamberLabel,
new TGLayoutHints(kLHintsCenterX | kLHintsLeft | kLHintsCenterY, 10, 0, 20, 0));
145 fChamberCombo =
new TGComboBox(hframe, kChamberCombo);
148 for(i = 0; i < 10; i++)
150 snprintf(text,20,
"%d",i+1);
151 fChamberCombo->AddEntry(text,i);
153 fChamberCombo->Resize(40,20);
154 fChamberCombo->Select(0);
155 fChamberCombo->Associate(
this);
156 hframe->AddFrame(fChamberCombo,
new TGLayoutHints(kLHintsLeft, 10, 0, 9, 0));
159 TGLabel* detElemLabel =
new TGLabel(hframe,
"DE :");
160 hframe->AddFrame(detElemLabel,
new TGLayoutHints(kLHintsCenterX | kLHintsLeft | kLHintsCenterY, 10, 0, 20, 0));
161 fDECombo =
new TGComboBox(hframe, kDECombo);
164 fDECombo->Resize(80,20);
166 fDECombo->Associate(
this);
167 hframe->AddFrame(fDECombo,
new TGLayoutHints(kLHintsLeft, 10, 0, 9, 0));
168 fDEOccurrence.Reset(-1);
170 TGTextButton *next =
new TGTextButton(hframe,
"&Next");
171 next->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"NextDE()");
172 hframe->AddFrame(next,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,5,5,3,4));
175 TGLabel* detElemName =
new TGLabel(hframe,
"Name :");
176 hframe->AddFrame(detElemName,
new TGLayoutHints(kLHintsCenterX | kLHintsLeft | kLHintsCenterY, 10, 0, 20, 0));
180 fNameDECombo =
new TGComboBox(hframe, kDEName);
182 UpdateNameView(kTRUE);
183 fNameDECombo->Resize(160, 20);
184 fNameDECombo->Select(0);
185 fNameDECombo->Associate(
this);
186 hframe->AddFrame(fNameDECombo,
new TGLayoutHints(kLHintsLeft, 10, 0, 9, 0));
189 fPlaneButton =
new TGCheckButton(hframe,
"NB Plane", kPlaneType);
190 fPlaneButton->SetState(kButtonUp);
191 fPlaneButton->Associate(
this);
192 hframe->AddFrame(fPlaneButton,
new TGLayoutHints(kLHintsLeft, 10, 0, 9, 0));
196 TGTextButton* drawManu =
new TGTextButton(hframe,
"&Search");
197 drawManu->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"DrawManuMotif(Bool_t)");
198 drawManu->SetToolTipText(
"Search for a given manu number");
199 hframe->AddFrame(drawManu,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,15,5,3,4));
202 fNumberEntry =
new TGNumberEntry(hframe, 0, 4, -1,
203 TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative,
204 TGNumberFormat::kNELLimitMinMax, 1, 1500);
205 fNumberEntry->Resize(60,20);
206 hframe->AddFrame(fNumberEntry,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 0, 9, 0));
209 TGTextButton *resetManu =
new TGTextButton(hframe,
"&Reset");
210 resetManu->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"ResetManu()");
211 hframe->AddFrame(resetManu,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,10,5,3,4));
214 TGTextButton* deletePopup =
new TGTextButton(hframe,
"&Delete_Popup");
215 deletePopup->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"DeletePopUp()");
216 deletePopup->SetToolTipText(
"Delete motif popup window");
217 hframe->AddFrame(deletePopup,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,15,5,3,4));
221 TGHorizontalFrame *logFrame =
new TGHorizontalFrame(fMain, width/2, height/6);
223 TGLabel* logName =
new TGLabel(logFrame,
"Log MSG:");
224 logFrame->AddFrame(logName,
new TGLayoutHints(kLHintsCenterX | kLHintsLeft | kLHintsCenterY, 10, 0, 2, 0));
226 fLogMessage =
new TGTextView(logFrame, width/2, 60);
227 fLogMessage->ShowBottom();
229 logFrame->AddFrame(fLogMessage,
new TGLayoutHints(kLHintsLeft, 10, 0, 2, 0));
232 TGTextButton* clearLog =
new TGTextButton(logFrame,
"&Clear");
233 clearLog->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"ClearLogMessage()");
234 clearLog->SetToolTipText(
"Clear log message");
235 logFrame->AddFrame(clearLog,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,15,5,3,4));
238 TGTextButton* saveLog =
new TGTextButton(logFrame,
"&Save");
239 saveLog->Connect(
"Clicked()",
"AliMpDEVisu",
this,
"SaveLogMessage()");
240 saveLog->SetToolTipText(
"Save log message into file");
241 logFrame->AddFrame(saveLog,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,5,5,3,4));
244 fLogFile =
new TGTextEntry(logFrame,
"AliMpDEVisu.log");
245 fLogFile->SetToolTipText(
"Default log file name");
246 logFrame->AddFrame(fLogFile,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 10, 0, 9, 0));
249 fZoomButton =
new TGCheckButton(logFrame,
new TGHotString(
"&Zoom Mode"), kZoomMode);
250 fZoomButton->Associate(
this);
251 fZoomButton->SetState(kButtonUp);
253 logFrame->AddFrame(fZoomButton,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 20, 0, 9, 0));
256 fMain->AddFrame(hframe,
new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,10,10));
257 fMain->AddFrame(fEcanvas,
new TGLayoutHints(kLHintsCenterX, 10,10,10,10));
259 fMain->AddFrame(logFrame,
new TGLayoutHints(kLHintsLeft,2,2,2,10));
262 fMain->SetWindowName(
"MUON Detection Element Visualization");
265 fMain->MapSubwindows();
268 fMain->Resize(fMain->GetDefaultSize());
275 fLogMessage->AddLine(
"Segmentation loaded");
276 fLogMessage->ShowBottom();
300 static Int_t eventXold, eventYold;
301 static Int_t eventX0, eventY0;
302 static Int_t linedrawn;
306 if (eventType == kKeyPress) {
307 gVirtualX->SetKeyAutoRepeat(kTRUE);
315 if (eventType == kButton1Down) {
316 gVirtualX->SetLineWidth(3);
317 eventX0 = eventX; eventY0 = eventY;
318 eventXold = eventX; eventYold = eventY;
322 if (eventType == kButton1Motion) {
323 if (linedrawn) gVirtualX->DrawBox(eventX0, eventY0, eventXold, eventYold, TVirtualX::kHollow);
327 gVirtualX->DrawBox(eventX0, eventY0, eventXold, eventYold, TVirtualX::kHollow);
330 if (eventType == kButton1Up)
332 if ( (eventX0 - eventX) && (eventY0 - eventY) )
334 PopUpZoom(eventX0,eventY0,eventX,eventY);
344 if (eventType == kButton1Down) {
357 fLogMessage->AddLine(Form(
"PopupManuMotif: No manu for DE: %d at position (%5.2f, %5.2f)",
368 fLogMessage->AddLine(Form(
"PopupManuMotif: DE: %d, manu: %d at position: %5.2f, %5.2f",
387 fEcanvas->GetCanvas()->SetEditable(kTRUE);
391 entry->SetBackgroundColor(0xDDDDDD);
403 fEcanvas->GetCanvas()->SetEditable(kFALSE);
412 fEcanvas->GetCanvas()->SetEditable(kTRUE);
420 snprintf(command, 255,
"%s%d",
"PMCI:", (Int_t)
fNumberEntry->GetIntNumber());
426 snprintf(command, 255,
"%s%d",
"RSMCI:", (Int_t)
fNumberEntry->GetIntNumber());
432 fEcanvas->GetCanvas()->SetEditable(kFALSE);
440 TCanvas *canvas =
fEcanvas->GetCanvas();
455 painter->Draw(option);
463 fLogMessage->AddLine(Form(
"DrawSlat: number of manus: %d", numberOfManu));
476 TCanvas *canvas =
fEcanvas->GetCanvas();
491 painter->Draw(option);
499 fLogMessage->AddLine(Form(
"DrawQuadrant: number of manus: %d", numberOfManu));
510 Double_t& x, Double_t& y)
const
514 static Double_t ulx(gPad->XtoPixel(0.01));
515 static Double_t uly(gPad->YtoPixel(0.99));
516 static Double_t brx(gPad->XtoPixel(0.99));
517 static Double_t bry(gPad->YtoPixel(0.01));
519 static Double_t padDimX = brx - ulx;
520 static Double_t padDimY = bry - uly;
529 x = (eventX - ulx - padDimX/2.)/(padDimX)*deDimX;
530 y = (bry - eventY - padDimY/2.)/(padDimY)*deDimY;
536 x = (eventX - ulx)/(padDimX)*deDimX;
537 y = (bry - eventY)/(padDimY)*deDimY;
559 fLogMessage->AddLine(
"Delete Motif PopUp Windows:");
571 TString logFile =
fLogFile->GetDisplayText();
574 fLogMessage->AddLine(Form(
"SaveLogMessage: saving log message into logfile: %s", logFile.Data()));
583 fLogMessage->AddLine(
"ClearLogMessage: clear log messages:");
605 fLogMessage->AddLine(Form(
"DrawDE: detection element: %d, name: %s",
609 fLogMessage->AddLine(Form(
"DrawDE: DDL: %d, number of buspatches %d from %d to %d",
610 ddlId, numberOfBus, firstBus, lastBus));
613 if (numberOfSerialManu != 0) {
614 fLogMessage->AddLine(Form(
"DrawDE: number of manus with serial number: %d", numberOfSerialManu));
630 switch (GET_SUBMSG(msg))
651 case kCM_CHECKBUTTON:
689 Int_t next =
fDECombo->GetSelected() + 1;
691 if (next < fDECombo->GetNumberOfEntries())
714 idx = detElem->
GetId() % 100;
782 TCanvas* c =
new TCanvas(windowName,windowName,-200,100,w,h);
786 c->Connect(
"Closed()",
"AliMpDEVisu",
this,Form(
"ClosePopupWindow(=%d)",n));
792 painter->Draw(option);
807 for ( Int_t i = 0; i < slat->
GetSize(); ++i ) {
815 manuId = motifPos->
GetID();
817 motifPosFound = motifPos;
833 Int_t w = Int_t(h*dimensionX/dimensionY);
851 for (Int_t iRow = 0; iRow < sector->
GetNofRows(); ++iRow) {
860 for (Int_t iMotif = 0; iMotif < rowSegment->
GetNofMotifs(); ++iMotif){
863 motifPos = rowSegment->
GetRow()
866 manuId = motifPos->
GetID();
868 motifPosFound = motifPos;
890 Int_t w = Int_t(h*dimensionX/dimensionY);
908 fLogMessage->AddLine(Form(
"PopupManuMotif: motif dimension: %5.2f, %5.2f",
912 fLogMessage->AddLine( Form(
"PopupManuMotif: pad dimension: %4.2f, %4.2f",
916 fLogMessage->AddLine( Form(
"PopupManuMotif: manu: %d, serial number: %d, buspatch: %d",
935 fLogMessage->AddLine(Form(
"PopUpZoom: zoom positions (x0, y0: %6.2f, %6.2f), (x1, y1: %6.2f, %6.2f)",
944 TMath::Abs(x1-x0)/2.0,TMath::Abs(y1-y0)/2.0);
957 AliError(
"could not get iterator for that area");
The iterator over detection elements.
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
TGTextEntry * fLogFile
! text entry for log file name
static AliMpVPainter * CreatePainter(TObject *object)
AliMp::PlaneType OtherPlaneType(AliMp::PlaneType planeType)
Return the other plane type.
Double_t GetDimensionY() const
Return y dimension.
virtual Double_t GetPadDimensionY(Int_t i) const =0
Return the i-th pad y dimension.
static AliMpSegmentation * Instance(Bool_t warn=true)
virtual AliMpRow * GetRow() const =0
Return the row.which this row segment belongs to.
TGComboBox * fChamberCombo
! chamber botton
AliMq::Station12Type GetStation12Type() const
AliMpDDLStore * fDDLStore
! DDL Store
Int_t fCurrentDetElem
! current DE
TString GetDEName() const
Return name.
A PCB for station 3,4 or 5.
Class that takes care of reading the sector data.
UInt_t GetNofMotifPositions() const
Double_t GetDimensionX() const
Return x dimension.
void DrawDE(Bool_t info=kTRUE)
Int_t GetSize() const
The number of motifs, aka manus.
static Bool_t LoadDDLStore(Bool_t warn=false)
A rectangle area positioned in plane..
AliMpSector * BuildSector(const AliMpDataStreams &dataStreams)
void InfoManuMotif(AliMpMotifPosition *motifPos)
AliMpDetElement * CurrentDE() const
virtual AliMpVPadIterator * CreateIterator(const AliMpArea &area) const =0
Create iterator over pads in the given area.
TGMainFrame * fMain
! main frame
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
static AliMpManuStore * Instance(Bool_t warn=true)
A slat (building block of stations 3, 4 and 5)
static Bool_t LoadManuStore(Bool_t warn=false)
The class defines the electronics properties of detection element.
TObjArray fTrashList
! list of transient windows to delete
TGComboBox * fDECombo
! DE botton
TArrayI fDEOccurrence
! occurrence of DE
virtual Double_t GetDimensionY() const =0
Return the y half-sizes of the detection element.
A container to keep track of allocated motifs and motifTypes for slats (both St345 and trigger ones)...
TGComboBox * fNameDECombo
! name of the DE
An interface for a row segment.
void ClosePopupWindow(Int_t id)
TArrayI fDEComboIdx
! array for index vs DE id
static AliMpDDLStore * Instance(Bool_t warn=true)
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
void UpdateNameView(Bool_t firstTime=kFALSE)
void PopUpZoom(Int_t ix0, Int_t iy0, Int_t ix1, Int_t iy1)
TGCheckButton * fZoomButton
! check button to activate zoom mode, default wise disable
Int_t GetID() const
Return motif position ID = manu id.
Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const
AliMpSlat * ReadSlat(const AliMpDataStreams &dataStreams, const char *slatType, AliMp::PlaneType planeType)
AliMpVRowSegment * GetRowSegment(Int_t i) const
Int_t GetManuSerial(Int_t detElemId, Int_t manuId) const
void HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject *select)
AliMp::PlaneType fCurrentPlane
! current plane type
AliMpPCB * GetPCB(Int_t i) const
Returns the i-th PCB of this slat.
An interface for an iterator over pads.
static AliMp::StationType GetStationType(Int_t detElemId)
Abstract base class for drawing objects into canvas.
void DrawSlat(Option_t *option, Bool_t popup=kFALSE)
Read slat and pcb ASCII files.
virtual Double_t GetDimensionX() const =0
Return the x half-sizes of the detection element.
AliMpVMotif * GetMotif() const
Return motif.
TGCheckButton * fPlaneButton
! check button for NB plane, defaultwise B plane
A row composed of the row segments.
void PopUpManuMotif(AliMpSlat *slat)
void CreatePopupWindow(Int_t w, Int_t h, const char *title, AliMpVPainter *painter, const char *option)
A sector (quadrant) of the MUON chamber of stations 1 and 2.
TString fNameDEComboIdx[156]
! array for index vs DE names
virtual Int_t GetMotifPositionId(Int_t i) const =0
Return the i-th motif position Id of this row segment.
TRootEmbeddedCanvas * fEcanvas
! canvas for detection elt
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
AliMpMotifPosition * GetMotifPosition(Int_t i) const
Int_t GetDdlId() const
Return DDL Id.
Bool_t fZoomMode
! flag for zoom mode on canvas instead of click mode
AliMpManuStore * fManuStore
! Manu Store
AliMpMotifMap * GetMotifMap() const
Return the motif map.
Bool_t IsValid() const
Return validity.
Int_t GetNofBusPatches() const
virtual AliMpPad PadByPosition(Double_t x, Double_t y, Bool_t warning=true) const =0
Find pad by position.
AliMp::CathodType GetCathodType(AliMp::PlaneType planeType) const
TString fCurrentDEName
! current DE name
Bool_t IsValid() const
Return validity.
Int_t GetBusPatchId(Int_t index) const
AliMpMotifPosition * FindMotifPosition(Int_t motifPositionID) const
GUI for drawing detection element segmentation.
void DrawManuMotif(Bool_t popup=kFALSE)
TGNumberEntry * fNumberEntry
! manu id button
virtual Double_t GetPadDimensionX(Int_t i) const =0
Return the i-th pad x dimension.
void DrawQuadrant(Option_t *option, Bool_t popup=kFALSE)
Class which encapsuate all information about a pad.
static AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true)
void EventToReal(Int_t eventX, Int_t eventY, Double_t &x, Double_t &y) const
Int_t GetNofRowSegments() const
Int_t GetNofElectronicCards() const
Return the number of electronic cards (either manu or local board).
AliMpRow * GetRow(Int_t i) const
Int_t GetId() const
Return Id.
TGTextView * fLogMessage
! log message
virtual Int_t GetNofMotifs() const =0
Return the number of motifs in this this row segment.
Int_t GetSize() const
Returns the number of PCBs of this slat.
TString GetSegType() const
Return segmentation type name.
AliMpMotifMap * GetMotifMap() const
Return the motif map associated with its sector.
Mapping data streams provider.
const AliMpVSegmentation * fkSegmentation
! segmentation instance