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