]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCCalibViewerGUItime.h
Adding visualization of the tree aliases
[u/mrichter/AliRoot.git] / TPC / AliTPCCalibViewerGUItime.h
1 #ifndef AliTPCCalibViewerGUItime_H
2 #define AliTPCCalibViewerGUItime_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id: AliTPCCalibViewerGUI.h,v */
8
9 ///////////////////////////////////////////////////////////////////////////////
10 //                                                                           //
11 //  GUI for displaying calibration entires over time                         //
12 //  Calibration Trees are created using the macro TPC/CalibMacros/CalibEnv.C //
13 //  used for the calibration monitor                                         //
14 //                                                                           //
15 ///////////////////////////////////////////////////////////////////////////////
16
17
18 #ifndef ROOT_TGButton
19 #include "TGWidget.h"
20 #endif
21 #ifndef ROOT_TGFrame
22 #include "TGFrame.h"
23 #endif
24
25 // #include <TGButton.h>
26 // #include <TGListBox.h>
27 // #include <TGComboBox.h>
28 // #include <TGNumberEntry.h>
29 // #include <TRootEmbeddedCanvas.h>
30 // #include <TGSplitter.h>
31 // #include <TGButtonGroup.h>
32 // #include <TGLabel.h>
33 // #include <TGTab.h>
34 #include <TString.h>
35 #include <TVectorT.h>
36
37 class TGCompositeFrame;
38 class TRootEmbeddedCanvas;
39 class TGTextButton;
40 class TGListBox;
41 class TGRadioButton;
42 class TGGroupFrame;
43 class TGLabel;
44 class TGComboBox;
45 class TGTabElement;
46
47 class TFile;
48 class TTree;
49 class TChain;
50 class TGraph;
51 class TObjArray;
52
53 class TMap;
54
55 class AliTPCCalibViewerGUI;
56 class AliTPCConfigParser;
57
58
59
60 class AliTPCCalibViewerGUItime : public TGCompositeFrame {
61 public:
62   AliTPCCalibViewerGUItime(const TGWindow *p, UInt_t w, UInt_t h);
63   virtual ~AliTPCCalibViewerGUItime();
64   
65   static TObjArray* ShowGUI(const char* fileName = 0, const char* treeName="dcs");             // initialize and show GUI standalone
66   static TObjArray* ShowGUI(TChain* chain);                                         // initialize and show GUI standalone
67   
68   void DrawGUI(const TGWindow */*p*/, UInt_t w, UInt_t h);
69   
70   void UseFile(const char* fileName, const char* treeName);
71   void UseChain(TChain *chain);
72   void UseConfigFile(const char* file="");
73   void Reload(Int_t first=1);
74   void AddReferenceTree(const char* treeFileName, const char* refName="R");
75
76   
77   void SetCalibViewerGUI(AliTPCCalibViewerGUI *gui) {fCalibViewerGUI=gui;}
78   void SetCalibViewerGUItab(TGTabElement *tab) {fCalibViewerGUItab=tab;}
79   void SetCacheDir(const char* cachedir) {fOutputCacheDir=cachedir;}
80   void SetConfigFileName(const char* file) {fConfigFile=file;}
81   
82   const char* GetDrawString();
83   const char* GetDrawOptionString();
84   const char* GetCustomDrawString() const {return fComboCustomDraw->GetTextEntry()?fComboCustomDraw->GetTextEntry()->GetText():"";}
85   void GetCutString(TString &cutStr);
86   TChain* GetChain() const {return fTree;}
87   //Slots
88   void DoDraw();
89   void DoDumpRuns();
90   void DoCustomDraw();
91   void DoCustomCutsDraw();
92   void DoParLimitChange();
93   void DoNewSelection();                    // decides whether to redraw if user makes another selection
94   void DoChangeSelectionList() {Reload(0);}
95   void HandleButtonsDrawSel(Int_t id = -1);              
96   void MouseMove(Int_t event, Int_t x, Int_t y, TObject */*selected*/);
97   void DoNewSelectionAliases();
98   void DoAddAlias();
99   void DoDelAlias();
100   void UpdateAliasList();
101   
102  private:
103   TFile*  fFile;                          //file that keeps the tree
104   TChain*  fTree;                         //internal tree
105   AliTPCCalibViewerGUI *fCalibViewerGUI;  //calib viewer gui used to display verbose information for one run
106   TGTabElement *fCalibViewerGUItab;       //tab the calib view gui redies in
107   TH1*    fCurrentHist;                   //histogram currently drawn in main canvas
108   TGraph* fCurrentGraph;                  //current graph
109   Int_t   fCurrentRunDetails;             //run number for wich details are currently shown
110   TString fOutputCacheDir;                //output cache diretory for AliTPCCalibViewerGUI trees, created on the fly
111   TString fDrawString;                    //current draw string
112   TString fConfigFile;                    //configuration file keeping active branches and branch descriptions
113   AliTPCConfigParser *fConfigParser;      //configuration parser
114   Bool_t  fIsCustomDraw;                  //if custom draw string is selected
115   TVectorD fRunNumbers;                   //run numbers of current selection
116   TVectorD fTimeStamps;                   //timr stamps of current selection
117   TVectorD fValuesX;                      //values of current selection
118   TVectorD fValuesY;                      //values of current selection
119   //
120   Bool_t  fNoGraph;                       //Whether to create a graph
121   Long64_t fGraphLimitEntries;            //limit in number of entries in the chain for producing a graph
122   //
123   TMap *fMapRefTrees;                      //map of reference trees for the CalibViewer
124   //GUI elements
125   //main canvas Top part, bottom part
126   TGCompositeFrame    *fContTopBottom;      // container for all GUI elements, vertical divided
127   //top left, centre, right
128   TGCompositeFrame    *fContLCR;            // container for all GUI elements, horizontal divided
129   //content left
130   TGCompositeFrame    *fContLeft;           // container for GUI elements on left side
131   TGGroupFrame        *fContDrawOpt;        // Subgroup for draw selection
132   TGCheckButton       *fChkDrawOptSame;     // draw option 'same'
133   TGComboBox          *fComboAddDrawOpt;    // additional draw options combo box
134   TGGroupFrame        *fContDrawSel;        // Subgroup for draw selection
135   TGCompositeFrame    *fContDrawSelSubRunTime; //Radio button subframe
136   TGRadioButton       *fRadioXhist;         // Radio button x-variable: show only 1D distribution
137   TGRadioButton       *fRadioXrun;          // Radio button x-variable: run
138   TGRadioButton       *fRadioXtime;         // Radio button x-variable: time
139   TGListBox           *fListVariables;      // listbox with possible variables
140   TGComboBox          *fComboRunType;       // run type selection box
141   TGLabel             *fLblRunType;         // run type label
142   TGNumberEntry       *fNmbPar;             // parameter number
143   TGLabel             *fLblPar;             // parameter name
144   TGListBox           *fListCalibType;      // calibration type selection box
145   TGGroupFrame        *fContCalibType;      // calibration type label
146   //content centre
147   TGCompositeFrame    *fContCenter;         // container for GUI elements at the center
148   TRootEmbeddedCanvas *fCanvMain;           // main drawing canvas
149   //content right 
150   TGCompositeFrame    *fContRight;          // container for GUI elements on right side
151   TGGroupFrame        *fContValues;         // container to keep data point information
152   TGLabel             *fLblRunNumber;       // run number label
153   TGLabel             *fLblRunTime;         // time stamp label
154   TGLabel             *fLblValueX;          // value label
155   TGLabel             *fLblValueY;          // value label
156   TGLabel             *fLblRunNumberVal;    // run number of the data point hoovered
157   TGLabel             *fLblRunTimeVal;      // time stamp of the data point hoovered
158   TGLabel             *fLblValueXVal;       // value of the data point hoovered
159   TGLabel             *fLblValueYVal;       // value of the data point hoovered
160   TGTextButton        *fBtnDumpRuns;        // draw button
161   TGGroupFrame        *fContAliases;         // container to keep data point information
162   TGListBox           *fListAliases;        // list of aliases
163   //content bottom
164   TGCompositeFrame    *fContCustom;         // container for custom draw command GUI elements
165   TGCompositeFrame    *fContCustomCuts;     // container for custom cut options GUI elements
166   TGLabel             *fLblCustomDraw;      // label for custom draw string
167   TGLabel             *fLblCustomCuts;      // label for custom cuts string
168   TGComboBox          *fComboCustomDraw;    // combo box custom draw string
169   TGComboBox          *fComboCustomCuts;    // combo box custom cuts string
170   //
171   TObjArray *fTrashBox;                   //graphics objects to be deleted (histograms, graphs,...)
172   
173   enum { kRadioXhist=10, kRadioXrun=11, kRadioXtime=12 };
174   enum { kBranchOnOff=0, kBranchTitle=1, kCalibType=2, kParamNames=3 };
175   
176   void UpdateParLimits();
177   void UpdateParName();
178   void SetGuiTree(Int_t run);
179   void FillRunTypes();
180   void FillCalibTypes();
181   void SetInitialValues();
182   void CheckDrawGraph();
183   Bool_t CheckChain();
184   void UpdateValueArrays(Bool_t withGraph);
185   const char* SubstituteUnderscores(const char* in);
186   void GetHistogramTitle(TString &title);
187   void AdjustYRange();
188 private:
189   AliTPCCalibViewerGUItime(const AliTPCCalibViewerGUItime &v);
190   AliTPCCalibViewerGUItime &operator = (const AliTPCCalibViewerGUItime &v);         // assignment operator
191   
192   ClassDef(AliTPCCalibViewerGUItime, 0)
193     
194 };
195
196 ////////////////////////////////////////////////////////////////////////
197 //
198 //   GUI Alias frame
199 //
200 ////////////////////////////////////////////////////////////////////////
201
202 class AliTPCCalibViewerGUItimeAddAliasFrame : public TObject {
203 public:
204   AliTPCCalibViewerGUItimeAddAliasFrame(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
205              UInt_t options, AliTPCCalibViewerGUItime *gui, TString strAlias="");
206   virtual ~AliTPCCalibViewerGUItimeAddAliasFrame();
207   
208    // slots
209   void DoOK();
210   void DoCancel();
211   
212
213 private:
214   TGTransientFrame    *fMain;           //Main frame
215   TGTextEntry         *fTxt1, *fTxt2;   //text input
216
217   AliTPCCalibViewerGUItime *fGUI;       //pointer to mother process
218
219   AliTPCCalibViewerGUItimeAddAliasFrame(const AliTPCCalibViewerGUItimeAddAliasFrame &r);
220   AliTPCCalibViewerGUItimeAddAliasFrame &operator = (const AliTPCCalibViewerGUItimeAddAliasFrame &r);
221
222   ClassDef(AliTPCCalibViewerGUItimeAddAliasFrame,0)
223 };
224
225 #endif