KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVIDGridEditor.h
Go to the documentation of this file.
1 
4 #ifndef __KVIDGridEditor_H
5 #define __KVIDGridEditor_H
6 
7 #include "TCanvas.h"
8 #include "TPaveLabel.h"
9 #include "TPaveText.h"
10 #include "TStyle.h"
11 #include "TH2F.h"
12 #include "TF1.h"
13 #include "TF2.h"
14 #include "TROOT.h"
15 #include "TView.h"
16 #include "TKey.h"
17 #include "TSpectrum.h"
18 
19 #include "TMethod.h"
20 #include "TContextMenu.h"
21 #include "TGMsgBox.h"
22 #include "TGFileDialog.h"
23 
24 #include "KVIDGridEditorCanvas.h"
25 #include "KVBase.h"
26 #include "KVHashList.h"
27 #include "KVIDGraph.h"
28 #include "KVIDGridManager.h"
29 #include "KVIDZALine.h"
30 #include "KVIDZAGrid.h"
31 #include "KVIDentifier.h"
32 #include "KVDropDownDialog.h"
33 #include "KVVirtualIDFitter.h"
34 #include "TMethod.h"
35 #include "TContextMenu.h"
36 #include "TGMsgBox.h"
37 #include "KVInputDialog.h"
38 #include "KVHistoManipulator.h"
39 
40 #include "KVSpiderIdentificator.h"
41 #include "KVZALineFinder.h"
42 
43 #define FACTOR -1.
44 
57 class KVIDGridEditor : public KVBase {
59  friend class KVIDGridEditorCanvas;
60 
61 public:
62  enum MatrixType {
66  kPSA
67  };
68 
69 protected:
70 
77 
84 
90 
92 
97 
99 
103 
104  TF1* ft;
105  TF1* fs;
109 
111 
119 
121 
125 
130 
133 
134 protected:
135 
136  Double_t GetX0();
137  Double_t GetY0();
138  Double_t GetPdx();
139  Double_t GetPdy();
140 
141  Bool_t HandleKey(Int_t px, Int_t py);
142  void MoveHor(Int_t sign, Double_t speed = 1, Bool_t update = true);
143  void MoveVert(Int_t sign, Double_t speed = 1, Bool_t update = true);
144 
145  void ZoomOnMouse();
146  void AddMethod(const char* theMethod);
147  void SelectTrans(TPaveLabel* label);
148 
149  void SetDefault(); //
150  void init(); //
151  void AddTransformation(TString label); //construction de l'interface
152  void AddAction(TString label); //graphique et initialisation
153  void AddGridOption(TString label, KVHashList* thelist); //
154  void ConstructModulator(); //
155 
156  void TranslateX(Int_t Sign);
157  void TranslateY(Int_t Sign);
158  void RotateZ(Int_t Sign);
159  void ScaleX(Int_t Sign);
160  void ScaleY(Int_t Sign);
161  void ScaleXY(Int_t Sign);
162  void ScaleCurvature(Int_t Sign);
163 
164  void DynamicZoom(Int_t Sign, Int_t px = 0, Int_t py = 0, Double_t speed = .5); //zoom molette
165  void Unzoom(); //unzoom histo (accessible via l'interface : I)
166  void ZoomSelected(); //zoom 'gnuplot'
167 
168  void SetLogz(); //echelle log sur Oz
169  void SetLogy(); //echelle log sur Oy
170  void SetLogx(); //echelle log sur Ox
171  void Undo(); //annule toute les operation sur la grille courante (I)
172 
173  void SetPivot(Double_t xx0, Double_t yy0); // set pivot position (double click on the histo)
174  void SetPiedestal(Double_t ppdx, Double_t ppdy); // set piedestal position (shift click on the histo)
175 
176  void SetEditable(TPaveLabel* label);
177  void SelectLines(const Char_t* label);
178 
179  void NewLine(); //'Line'
180  void NewCut(); //'Cut'
181  void NewInfo(); //'Info'
182  void FitGrid(); //'Fit' avec fonctionnelle de T.G
183  void TestGrid(); //'Test' linearisation de l'histo avec la grille courante
184 
185  void DeleteObject(KVIDentifier* obj); //'Delete'
186 
187  void UpdateViewer(); //rafraichit l'interface
188  void DrawAtt(Bool_t piv); //affiche les bouton sur le canvas
189  void ResetColor(KVIDentifier* Ident); //redonne la couleur d'origine a une ligne
190  void ResetColor(KVList* IdentList); //redonne la couleur d'origine a une liste de ligne
191 
192  void SuggestMoreAction(); //'More', modifier cette methode pour ajouter des fonctionnalites !!!
193  void ChooseSelectedColor(); //'More' -> SetSelectedColor change la couleur des lignes selectionnes
194  void OpenRootFile(); //pas implemente
195 
196  void DispatchOrder(TPaveLabel* label); //methode qui distribue les ordres quand on clic sur un bouton
197  void ChangeStep(const char* title, Int_t dstep = 1);
198  const char* WhoIsSelected(); //methode qui regarde quelle transformation est selectionnee
199 
200  TString ListOfHistogramInMemory(); //revoie la liste des histo dans gFile
201  TString PreselectHistogram(TString ListOfName, Int_t ipert = 0); //revoie le nom de l' histo qui as le mm nom que la grille (si existe)
202  TH2* FindInCanvases(const Char_t* name);
203  void RecurseFileStructureFindHistos(TString& hist_names, TDirectory* the_directory);
204 
205  void ChangeZoomRatio(Int_t sign, Double_t speed = .5);
206 public:
207 
208  KVIDGridEditor();
210  ROOT_COPY_ASSIGN_OP(KVIDGridEditor)
211  virtual ~KVIDGridEditor();
212  void Copy(TObject&) const;
213 
214  void StartViewer(); //ouvre l'interface graphique, utilise quand double clic sur une grille dans le gIDGridManagerGUI
215  void Clear(const Option_t* opt = ""); //nettoi l'interface ('all' enleve la grille et l'histo)
216  void Close(); //ferme l'interface graphique
217  Bool_t IsClosed(); //true si l'interface est fermee
218  void CanvasWasClosed(); // called when GUI is used to close the canvas
219  void ForceUpdate(); //rafraichit toute l'interface de force
220  void SaveCurrentGrid(); //'More' -> SaveCurrentGrid ouvre une boite de dialogue pour sauver la grille
221 
222  void SetPointStyle(int pstyle);
224  {
225  return fPointStyle;
226  }
227  void SetPointSize(double psize);
228  double GetPointSize()
229  {
230  return fPointSize;
231  }
232 
233  void SetHisto(TH2* hh); //donne l'histo a l'editeur
234  void SetGrid(KVIDGraph* gg, Bool_t histo = true); //donne la grille a l'editeur
235  void SetGrid(TString GridName); //donne la grille a l'editeur par son nom
236 
238  {
239  return TheGrid;
240  }
242  {
243  return TheHisto;
244  }
245 
247  {
248  return fCanvas;
249  }
250 
251  void SelectLabel(); //methode ajouter a la liste des auto-exec du canvas : gere les bouton
252  void MakeTransformation(); //methode ajouter a la liste des auto-exec du canvas : gere le reste
253 
255  {
256  SelectedColor = color;
257  }
258  void SelectLinesByZ(const Char_t* ListOfZ); //'More' -> 'SelectLinesByZ'
259  void SetDebug(Bool_t debug)
260  {
261  fDebug = debug;
262  }
263  void SetSVGMode()
264  {
265  fSVGMode = !fSVGMode;
266  }
267  void MakeScaleX(Double_t scaleFactor);
268  void MakeScaleY(Double_t scaleFactor);
269 
271  {
272  return fSpiderZp;
273  }
275  {
276  return fSpiderFactor;
277  }
278 
279  void SetSpiderOption(const char* opt = "DRLF")
280  {
281  fSpiderOption = opt;
282  }
283  void SpiderIdentification();
284  void FindZALines();
285  void ChangeMasses(const Char_t* Zl, Int_t dA);
286  void ChangeCharges(const Char_t* Zl, Int_t dZ);
287 
289  {
290  fAx = fAy = 1;
291  fBx = fBy = 0;
292  }
293  void PrintScalingRecap();
294 
295  ClassDef(KVIDGridEditor, 1) // outil de modification de grille.
296 };
297 
300 
301 #endif
int Int_t
#define R__EXTERN
R__EXTERN KVIDGridEditor * gIDGridEditor
................ global variable
char Char_t
bool Bool_t
double Double_t
const char Option_t
#define ClassDef(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:135
Extended version of ROOT THashList.
Definition: KVHashList.h:28
Base class for particle identification in a 2D map.
Definition: KVIDGraph.h:31
Extended version of KVCanvas used by KVIDGridEditor.
Identification grid editor GUI ,.
Bool_t drawmode
true si mode draw (line, cut)
void SelectLinesByZ(const Char_t *ListOfZ)
Int_t imod
utilise pour le placement des boutons
void DrawAtt(Bool_t piv)
void AddTransformation(TString label)
void DynamicZoom(Int_t Sign, Int_t px=0, Int_t py=0, Double_t speed=.5)
Zoom in or out of histogram with mouse wheel.
void Copy(TObject &) const
void SelectLines(const Char_t *label)
void RotateZ(Int_t Sign)
KVIDGridEditor()
Default constructor.
void ScaleY(Int_t Sign)
TF2 * frx
rotation
double GetPointSize()
KVHashList * lplabel5
contient la liste des TPaveLabel pour moduler les pas (vert)
KVHashList * lplabel4
contient la liste des TPaveLabel pour editer la grille (rouge)
void SetGrid(KVIDGraph *gg, Bool_t histo=true)
TString fSpiderOption
void SetPiedestal(Double_t ppdx, Double_t ppdy)
piedestal used during SpiderIdentification
Bool_t moved
utilise pour les differents zooms
KVString fListOfMethods
void MoveHor(Int_t sign, Double_t speed=1, Bool_t update=true)
TVirtualPad * fPad
KVIDGraph * GetGrid()
Bool_t aoemode
true si mode age of empire
void ResetScalingRecap()
void RecurseFileStructureFindHistos(TString &hist_names, TDirectory *the_directory)
TString ListOfHistogramInMemory()
void SetSpiderOption(const char *opt="DRLF")
void ChangeZoomRatio(Int_t sign, Double_t speed=.5)
TString PreselectHistogram(TString ListOfName, Int_t ipert=0)
void TranslateX(Int_t Sign)
Double_t oldy
utilises pour les differents zooms
void ScaleX(Int_t Sign)
void ScaleCurvature(Int_t Sign)
void ChangeCharges(const Char_t *Zl, Int_t dZ)
void MakeScaleX(Double_t scaleFactor)
void SetDebug(Bool_t debug)
const char * WhoIsSelected()
void ChangeStep(const char *title, Int_t dstep=1)
void AddGridOption(TString label, KVHashList *thelist)
TH2 * FindInCanvases(const Char_t *name)
void SetPointStyle(int pstyle)
void StartViewer()
Close();.
void DispatchOrder(TPaveLabel *label)
void ScaleXY(Int_t Sign)
virtual ~KVIDGridEditor()
Destructor.
TF1 * fsy
scaling
void TranslateY(Int_t Sign)
void MakeScaleY(Double_t scaleFactor)
KVList * ListOfLines
liste des lignes selectionnees
TF1 * fs
scaling
void SetSelectedColor(Int_t color)
TH2 * TheHisto
pointeur sur l'histogramme
void SelectTrans(TPaveLabel *label)
void ResetColor(KVIDentifier *Ident)
void Clear(const Option_t *opt="")
KVIDGridEditorCanvas * fCanvas
void AddMethod(const char *theMethod)
KVIDGraph * TheGrid
pointeur sur la grille courante
Bool_t HandleKey(Int_t px, Int_t py)
Handle keys.
TPaveText * fKeyShow
KVHashList * lplabel2
contient la liste des TPaveLabel pour les actions (rouge)
void SetHisto(TH2 *hh)
KVString fDefaultMethod
KVHashList * lplabel3
contient la liste des TPaveLabel pour les selections de lignes (vert)
void MoveVert(Int_t sign, Double_t speed=1, Bool_t update=true)
TCanvas * GetEditorCanvas()
TF1 * ft
translation
void SetPointSize(double psize)
void ChangeMasses(const Char_t *Zl, Int_t dA)
Int_t SelectedColor
couleur des lignes selectionnees
Bool_t venermode
true si mode select
TF2 * fry
rotation
TPaveLabel * modulator
Bool_t ownhisto
true si histo par defaut
void SetPivot(Double_t xx0, Double_t yy0)
void SetEditable(TPaveLabel *label)
Bool_t selectmode
true si mode vener
Double_t fBy
scaling recap for current grid
Double_t ymax
utilises pour les differents zooms
Double_t GetSpiderFactor()
TGraph * fPiedestal
KVHashList * lplabel
contient la liste des TPaveLabel pour les transformations (rouge)
Double_t x0
coordonne x du pivot
void DeleteObject(KVIDentifier *obj)
Double_t fSpiderFactor
Double_t y0
coordonne y du pivot
Bool_t dlmode
true si mode delete
void AddAction(TString label)
Double_t fPointSize
Base class for graphical cuts used in particle identification.
Definition: KVIDentifier.h:27
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
int Sign(const T &x)