1 /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
4 /////////////////////////////////////////////////////////////////////////
5 // ALICE EVENT DISPLAY CLASS //
6 // Author: Mayeul ROUSSELET //
7 // e-mail: Mayeul.Rousselet@cern.ch //
8 // Last update:26/08/2003 //
9 /////////////////////////////////////////////////////////////////////////
14 #include <RQ_OBJECT.h>
16 #include <TGDoubleSlider.h>
17 #include <TRootEmbeddedCanvas.h>
18 #include <TGStatusBar.h>
19 #include <TGToolBar.h>
20 #include <TGDimension.h>
21 #include <TVirtualPad.h>
34 class TGNumberEntryField;
45 kIdsVIEW, //id of the view shutter
46 kIdbSIDEVIEW, //id of sideview button
111 kmCUTS, //tag for the update fucntion
116 const char helpTxt[] = "\tAliDisplay v2.0\n\t\tHelp\n\n\nWelcome in the AliDisplay help.\nHere is a list of useful subjects which discribes\nthe main functionnalities of the software\n \nEvent:Use the arrows to get the next or previous event\nView:Each button corresponds to a different view\nDetectors:Select the module you want to see\nOptions:Select the view mode\nSliders:Use the rapidity (or eta) slider to cut the set of hits\n\tAnd the momentum slider to cut with respect to the momentum\n";
119 //const char *filetypes[] = {"ROOT files","*.root","All files","*",0,0};
122 //Constants to set the display mode
123 const Int_t kHits = BIT(0);
124 const Int_t kClusters = BIT(1);
125 const Int_t kHLT = BIT(2);
126 const Int_t kTracks = BIT(3);
128 //***Class ModulesInfo***//
131 AliModuleInfo(int n);
132 virtual ~AliModuleInfo();
134 void SetId(char* name,Int_t id);
135 void Add(const char * name,Int_t i);
136 Int_t Id(char *name);
137 char* Name(Int_t id);
138 Bool_t IsEnabled(Int_t id);
139 Bool_t IsEnabled(char *name){return IsEnabled(Id(name));};
140 void Disable(Int_t id);
141 void Disable(char* name){Disable(Id(name));};
142 void Enable(Int_t id);
143 void Enable(char *name){Enable(Id(name));};
147 //The purposes of this class is to link each module to its Id
153 ClassDef(AliModuleInfo,0);
156 //***Class DisplayCluster***//
158 class AliDisplayClusters{
159 //This class is an interface to the clusters data
162 AliDisplayClusters();
163 virtual ~AliDisplayClusters();
165 void LoadClusters(char * name,Int_t nevent);
166 void LoadITSClusters(Int_t nevent);
167 void LoadTPCClusters(Int_t nevent);
169 Int_t GetNbClusters();
172 TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i;
174 char **fName; //fName[i]=name of the detector i
176 RQ_OBJECT("AliDisplayClusters")
178 ClassDef(AliDisplayClusters,0);
181 //***class AliDisplayHLT***//
184 //This classes is an interface to the HLT data
185 //For the moment only for TPC, for adding modules there is two choices:
186 //1) add the function LoadHLT[module](Int_t) and update the function LoadHLT
187 //2) or inherit your class from AliDisplayHLT and overload LoadHLT
192 virtual ~AliDisplayHLT();
194 virtual void LoadHLT(char *name,Int_t e);//Load L3 datas whose belong to detector name and from the event e
195 virtual void LoadHLTTPC(Int_t nevent);
199 TPolyMarker3D *fPoints; //fPoints[i]=set of cluster coordinates in detector i;
201 char **fName; //fName[i]=name of the detector i
203 ClassDef(AliDisplayHLT,0);
206 //***Class AliSliderFrame***//
207 class AliSliderFrame{
208 //This class implements the cuts manager
212 AliSliderFrame(const TGWindow *p, UInt_t w, UInt_t h);
213 virtual ~AliSliderFrame();
216 void SetMomentumRange(Float_t min, Float_t max){fMomentumSlider->SetRange(min,max);};
217 void SetRapidityRange(Float_t min, Float_t max){fRapiditySlider->SetRange(min,max);};
219 Float_t GetMomentumMax(){return fMomentumSlider->GetMaxPosition();};
220 Float_t GetMomentumMin(){return fMomentumSlider->GetMinPosition();};
221 Float_t GetRapidityMax(){return fRapiditySlider->GetMaxPosition();};
222 Float_t GetRapidityMin(){return fRapiditySlider->GetMinPosition();};
223 TGCompositeFrame* GetSliderFrame(){return fMainFrame;};
227 void DoSlider(Int_t pos=0);
228 void DoField(Long_t pos=0);
229 void DoReleased(Int_t pos=0);
230 void DoPositionChanged(Int_t pos=0);
238 TGCompositeFrame *fMainFrame;
239 TGCompositeFrame *fMomentumFrame;
240 TGCompositeFrame *fRapidityFrame;
241 TGLayoutHints *fLayout;//Layout of the frame
242 TGLayoutHints *fMomentumLayout;
243 TGLayoutHints *fRapidityLayout;
244 TGDoubleHSlider *fMomentumSlider;
245 TGDoubleHSlider *fRapiditySlider;
246 TGLabel *fMomentumLabel;
247 TGLabel *fRapidityLabel;
248 TGNumberEntry *fMomentumMaxValue;
249 TGNumberEntry *fMomentumMinValue;
250 TGNumberEntry *fRapidityMaxValue;
251 TGNumberEntry *fRapidityMinValue;
253 RQ_OBJECT("AliSliderFrame")
255 ClassDef(AliSliderFrame,0);
258 //***Class AliDetectorFrame***//
259 class AliDetectorFrame{
260 //This classe implements the frame which contains the list of enabled detectors
261 //and allows the user to change the current status of the detector (enabled/disabled)
265 AliDetectorFrame(const TGWindow *p, Int_t w, Int_t h,UInt_t bgc);
266 virtual ~AliDetectorFrame();
268 TGCompositeFrame* GetDetectorFrame(){return fMainFrame;};
271 void DoButton(Int_t pos=0);
272 void DoCheckButton(Int_t pos=0);
277 TGCompositeFrame *fMainFrame;
278 TGCompositeFrame *fButtonFrame;
279 TGCheckButton **fCheckButton;
280 TGTextButton *fButtonAll;
281 TGTextButton *fButtonInvert;
282 Bool_t *fCheckedButton; //fEnabledButton[i]=kTRUE if button checked
283 Int_t *fCheckButtonId;
287 RQ_OBJECT("AliDetectorFrame")
289 ClassDef(AliDetectorFrame,0);
292 //***Class AliShutterItem**//
293 class AliShutterItem{
294 //This class implements the shutter item, ie the base element of a shutter and provides functions to add button... in the shutter
297 AliShutterItem(TGShutter *s,char *text,UInt_t id);
298 virtual ~AliShutterItem();
301 TGShutterItem* GetShutterItem(){return fShutterItem;};
302 TGCompositeFrame* GetShutterItemFrame(){return fMainFrame;};
305 void AddTextButton(char *text,char *tiptext, UInt_t idb);
306 void AddPictureButton(char *file,char *tiptext,UInt_t idb);
307 void AddCheckButton(char *txt,Int_t idb);
310 void DoButton(Int_t pos=0);
314 TGCompositeFrame *fMainFrame;
315 TGShutterItem *fShutterItem;
318 RQ_OBJECT("AliShutterItem")
320 ClassDef(AliShutterItem,0);
324 //***Class AliShutterFrame***//
325 class AliShutterFrame{
326 //This class implements the shutter frame
329 AliShutterFrame(TGCompositeFrame *p, UInt_t w, UInt_t h);
330 virtual ~AliShutterFrame();
332 TGCompositeFrame* GetShutterFrame(){return fMainFrame;};
336 TGCompositeFrame *fMainFrame;
337 TGLayoutHints *fLayout;
339 AliDetectorFrame *fDetectorFrame;
340 TGLayoutHints *fDetectorFrameLayout;
342 RQ_OBJECT("AliShutterFrame")
344 ClassDef(AliShutterFrame,0);
347 //***Class AliDisplayFrame***//
348 class AliDisplayFrame{
349 //This class implements the display of the event
353 AliDisplayFrame(const TGWindow *p, UInt_t w, UInt_t h);
354 virtual ~AliDisplayFrame();
357 TGCompositeFrame* GetDisplayFrame(){return fMainFrame;};
358 TCanvas* GetMainCanvas(){return fMainCanvas;};
359 Int_t GetPreviousW(){return fPreviousW;};
360 Int_t GetPreviousH(){return fPreviousH;};
361 TGDimension GetFrameDimension(){return ((TGCanvas*)fMainEmbeddedCanvas)->GetViewPort()->GetDefaultSize();};
362 Int_t GetNbActivePoints();
363 Int_t GetNbClusters(){return fClusters->GetNbClusters();};
366 void SetPreviousW(Int_t w){fPreviousW=w;};
367 void SetPreviousH(Int_t h){fPreviousH=h;};
368 void SetEditable(Bool_t b){gPad->SetEditable(b);};
370 void DoView(Int_t view);
371 void Draw(Float_t theta,Float_t phi,Float_t psi);
372 void DrawDetector(const char *name);
376 void LoadEnabledModules();
377 void LoadClusters(Int_t nevent);
378 void LoadHLTClusters(Int_t nevent);
381 void EnableDetector(const char *name);
382 void DisableDetector(const char *name);
383 void ExecuteEvent(Int_t event, Int_t px,Int_t py,TObject *);
384 void SavePadGIF(const char *file);
388 TGCompositeFrame *fMainFrame,*fFrame1,*fFrame2;
391 TRootEmbeddedCanvas *fMainEmbeddedCanvas;//embedded Canvas which contains the main view(s)
392 TRootEmbeddedCanvas *fSelectionEmbeddedCanvas;
393 TCanvas *fMainCanvas;
394 TCanvas *fSelectionCanvas;
395 Float_t fClipMin,fClipMax;
396 Int_t fPreviousW,fPreviousH;
398 AliDisplayClusters *fClusters;
404 Bool_t *fActivePoints;
405 TObjArray *fPolyMarkers;//Array for TPolyMarker3D
406 Float_t *fClustersPos;
409 RQ_OBJECT("AliDisplayFrame")
411 ClassDef(AliDisplayFrame,0);
414 //***Class AliInfoFrame***//
416 //This class implements the info frame where the number of particles... are displayed
420 AliInfoFrame(TGCompositeFrame *p, UInt_t w, UInt_t h);
421 virtual ~AliInfoFrame(void);
423 void AddLabel(char *text, UInt_t options);
424 TGCompositeFrame *GetInfoFrame(){return fMainFrame;};
429 TGCompositeFrame *fMainFrame,*fTitleFrame,*fFiguresFrame;
430 TGLabel *fNbParticuleLabel;
431 TGLabel *fNbEventLabel;
432 TGLabel *fNbHitsLabel;
433 TGLabel *fNbClustersLabel;
435 RQ_OBJECT("AliInfoFrame")
437 ClassDef(AliInfoFrame,0);
441 //***Class AliSettingFrame***//
442 class AliSettingFrame:public TGTransientFrame{
443 //This classe implement the setting frame where the different otption can be set
447 AliSettingFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
448 virtual ~AliSettingFrame();
451 void DoSettings(Int_t id=0);
455 TGCompositeFrame *fMainFrame;
456 TGCompositeFrame *fZoomStepFrame;
457 TGLayoutHints *fZoomStepLayout;
458 TGNumberEntryField *fZoomStepEntry;
459 TGLabel *fZoomStepLabel;
460 TGCompositeFrame *fSliderStepFrame;
461 TGLayoutHints *fSliderStepLayout;
462 TGNumberEntryField *fSliderStepEntry;
463 TGLabel *fSliderStepLabel;
464 TGCompositeFrame *fSliderUpdateFrame;
465 TGLayoutHints *fSliderUpdateLayout;
466 TGCheckButton *fSliderUpdateButton;
467 Bool_t fIsLoading;//Used when retrieving the state of the check button
469 RQ_OBJECT("AliSettingFrame")
471 ClassDef(AliSettingFrame,0);
475 //***Class AliMenu***//
477 //This class implement both the menu and the toolbar
481 AliMenu(TGCompositeFrame *p, UInt_t w, UInt_t h, UInt_t options);
484 void AddPictureButton(char *fname,char *tiptext,UInt_t id, UInt_t spacing);//add a picture button to the toolbar
486 void DoMenu(Int_t id=0);
487 void DoToolBar(Int_t id=0);
493 TGLayoutHints *fMenuBarLayout;
494 TGLayoutHints *fMenuBarItemLayout;
495 TGPopupMenu *fMenuFile;
496 TGPopupMenu *fMenuOptions;
497 TGPopupMenu *fMenuHelp;
498 TGPopupMenu *fMenuView;
499 TGLayoutHints *fToolBarLayout;
508 //***Class AliDisplay2***//
509 class AliDisplay2 : public TObject{
510 //This classe is the main component of the new display.
511 //It aggregates all the subframes and manage the relationnships
512 //between the widgets and the internal representation
516 AliDisplay2(const TGWindow *p, UInt_t w, UInt_t h); //Constructor, load all the widgets
517 virtual ~AliDisplay2(void);
520 void CloseWindow();//
521 void DoView(Int_t pos){fDisplayFrame->DoView(pos);};//change the current view
523 void DoSaveSettings();//Save settings to the ressource file
524 void LoadSettings();//load the settings from the ressource file
527 Int_t GetCurrentView(void){return fCurrentView;};//return current view
528 TGMainFrame* GetMainFrame(){return fMainFrame;};//
529 Float_t GetZoomStep(){return fZoomStep;};//
530 Float_t GetZoomFactor(){return fZoomFactor;};//
531 Float_t GetRapidityMin(){return fSliderFrame->GetRapidityMin();};//
532 Float_t GetRapidityMax(){return fSliderFrame->GetRapidityMax();};//
533 Float_t GetMomentumMin(){return fSliderFrame->GetMomentumMin();};//
534 Float_t GetMomentumMax(){return fSliderFrame->GetMomentumMax();};//
535 Int_t GetNbParticles(){return fNbParticles;};//
536 Int_t GetEventNumber(){return fEventNumber;};//
537 Int_t GetNbHits(){return fNbHits;};//
538 Int_t GetNbClusters(){return fDisplayFrame->GetNbClusters();};//
539 Float_t GetSliderStep(){return fSliderStep;};//
540 Bool_t GetZoomMode(){return fZoomMode;};//
541 Int_t GetMode(){return fMode;};//
542 TObjArray* GetModules(){return fModules;};//
543 Bool_t* GetEnabledModules(){return fEnabledModules;};//
544 Int_t GetNbModules(){return fNbModules;};//
545 char* GetIconsPath(){return fIconsPath;};//
546 AliModuleInfo* GetModuleInfo(){return fModuleInfo;};//
547 Bool_t GetSliderUpdate(){return fSliderUpdate;};//
548 char* GetRawDataPath(){return fRawDataPath;};
551 void SetSliderUpdate(Bool_t b){fSliderUpdate = b;};//
552 void SetMode(Int_t m){fMode=m;};//
553 void Enable(Int_t m);//Enable the given mode
554 Bool_t IsEnabled(Int_t m);//Return if the given mode is enabled
555 void Disable(Int_t m);//Disable the given mode
556 void SetZoomMode(Bool_t b=kTRUE){fZoomMode = b;};//
557 void SetCurrentView(Int_t id){fCurrentView = id;};//
558 void SetZoomStep(Float_t zs){fZoomStep=zs;};//
559 void SetZoomFactor(Float_t zf){fZoomFactor=zf;};//
560 void SetNbHits(Int_t hi){fNbHits = hi;};//
561 void SetNbParticles(Int_t nbp){fNbParticles = nbp;};//
562 void SetSliderStep(Float_t st){fSliderStep = st;};//
563 void SetEditable(Bool_t b){fDisplayFrame->SetEditable(b);};//
564 void SetStatusBar(const char *s,Int_t p){fStatusBar->SetText(s,p);};//Change text in the p part of the status bar
565 void SetRawDataPath(char *path){fRawDataPath=new char[strlen(path)];strcpy(fRawDataPath,path);};
567 void SavePadGIF(const char* file){fDisplayFrame->SavePadGIF(file);};//save current pad to gif file
568 void Draw(Option_t *options=0);//draw
569 void DrawDetector(const char *name){fDisplayFrame->DrawDetector(name);};//draw detector specific view (not implemented)
570 void DrawX3d();//Draw current pad in x3d view
571 void DrawGL();//Draw current pad in OpenGL view
572 void ShowNextEvent(Int_t delta);//Load and display the current+delta event, if it exists
573 void LoadClusters(Int_t nevent);//Load the clusters of the event
574 void LoadHits();//Load the hits
575 void LoadHLTClusters(Int_t nevent);//Load the hlt clusters
576 void LoadEnabledModules(){fDisplayFrame->LoadEnabledModules();};//Load enabled modules
577 void LoadEnabledHits(){fDisplayFrame->LoadHits();};//Load enabled hits
578 void ApplyCuts(){fDisplayFrame->ApplyCuts();}//Apply cuts from the slider frame
579 void EnableDetector(const char *name){fDisplayFrame->EnableDetector(name);};//Enable detector "name"
580 void DisableDetector(const char *name){fDisplayFrame->DisableDetector(name);};//Disable detector "name"
581 void Update(Int_t tag=-1);//Update the view, if loading only the modified data from the previous changes, the integer tag indicates the kind of modification
582 void HandleMouseWheel(Event_t *event);//Handle mouve event, not working yet
583 void HandleResize(Event_t *event);//Handle resize event
584 void FindModules();//Find the modules used for the simulation
592 Float_t fZoomStep;//Step of the zoom, ie the factor by which the zoom factor will be multiplied(divided) when pressing the zoom in (out) button
593 Float_t fZoomFactor;//Zoom factor, ie 1=no zoom, >1 zoom in & <1 zoom out
594 Bool_t fZoomMode;//kTrue if zoom on zone is enabled
595 Int_t fCurrentView;//Current view, see the enum for value
596 Int_t fNbParticles;//Current number of displayed particles
597 Int_t fEventNumber;//Number of event
598 Int_t fNbHits;//Number of displayed hits
599 Float_t fSliderStep;//Step of the slider
600 Int_t fMode;//Display mode : each bit is associated to a mode : Hits=BIT(0), clusters=BIT(1)...
601 Int_t fNbModules;//Total number of modules
602 TObjArray *fModules;//Array of modules
603 Bool_t *fEnabledModules;//Array of bool for coding the enabled modules
604 char *fIconsPath;//Icon Path (by default $ALICE_ROOT/DISPLAY/icons/)
605 char *fRawDataPath;//Raw data path
606 Bool_t fHitsLoaded,fClustersLoaded,fHLTLoaded,fTracksLoaded;//Implement if the type of datas was loaded, to avoid uneeded load
607 Bool_t fSliderUpdate;//True if display frame update on slider move, for fast machine only (desactivated by default)
608 AliModuleInfo *fModuleInfo;//Pointer to the class which map module name and internal module ID, necessary because of the dynamic load of the available modules
610 TEnv *fAliDisplay2rc;//ressources file (.alidisplay.rc)
612 TGMainFrame *fMainFrame;//Main frame
613 TGCompositeFrame *fLeftFrame;//frame used for the layout
614 TGCompositeFrame *fRightFrame;//frame used for the layout
615 TGCompositeFrame *fSubFrame;//frame used for the layout
618 TGLayoutHints *fSliderFrameLayout;
619 AliSliderFrame *fSliderFrame;//Frame which contains the rapidity and momentum sliders
622 TGLayoutHints *fShutterFrameLayout;
623 AliShutterFrame *fShutterFrame;
626 TGLayoutHints *fDisplayFrameLayout;
627 AliDisplayFrame *fDisplayFrame;
630 TGLayoutHints *fInfoFrameLayout;
631 AliInfoFrame *fInfoFrame;
633 //Detector Option Frame
634 TGLayoutHints *fDetectorFrameLayout;
635 AliDetectorFrame *fDetectorFrame;
641 TGStatusBar *fStatusBar;
643 RQ_OBJECT("AliDisplay2")
645 ClassDef(AliDisplay2,0);