KaliVeda
Toolkit for HIC analysis
KVIDGridEditor.h
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 "KVUnownedList.h"
28 #include "KVIDGraph.h"
29 #include "KVIDGridManager.h"
30 #include "KVIDZALine.h"
31 #include "KVIDZAGrid.h"
32 #include "KVIDentifier.h"
33 #include "KVDropDownDialog.h"
34 #include "KVVirtualIDFitter.h"
35 #include "TMethod.h"
36 #include "TContextMenu.h"
37 #include "TGMsgBox.h"
38 #include "KVInputDialog.h"
39 #include "KVHistoManipulator.h"
40 
41 #include "KVSpiderIdentificator.h"
42 #include "KVZALineFinder.h"
43 
44 #define FACTOR -1.
45 
59 class KVIDGridEditor : public KVBase {
61  friend class KVIDGridEditorCanvas;
62 
63 public:
64  enum MatrixType {
68  kPSA
69  };
70 
71 protected:
72 
79 
86 
92 
94 
99 
101 
105 
106  TF1* ft;
107  TF1* fs;
111 
113 
121 
123 
127 
132 
135 
136 protected:
137 
138  Double_t GetX0();
139  Double_t GetY0();
140  Double_t GetPdx();
141  Double_t GetPdy();
142 
143  Bool_t HandleKey(Int_t px, Int_t py);
144  void MoveHor(Int_t sign, Double_t speed = 1, Bool_t update = true);
145  void MoveVert(Int_t sign, Double_t speed = 1, Bool_t update = true);
146 
147  void ZoomOnMouse();
148  void AddMethod(const char* theMethod);
149  void SelectTrans(TPaveLabel* label);
150 
151  void SetDefault(); //
152  void init(); //
153  void AddTransformation(TString label); //construction de l'interface
154  void AddAction(TString label); //graphique et initialisation
155  void AddGridOption(TString label, KVHashList* thelist); //
156  void ConstructModulator(); //
157 
158  void TranslateX(Int_t Sign);
159  void TranslateY(Int_t Sign);
160  void RotateZ(Int_t Sign);
161  void ScaleX(Int_t Sign);
162  void ScaleY(Int_t Sign);
163  void ScaleXY(Int_t Sign);
164  void ScaleCurvature(Int_t Sign);
165 
166  void DynamicZoom(Int_t Sign, Int_t px = 0, Int_t py = 0, Double_t speed = .5); //zoom molette
167  void Unzoom(); //unzoom histo (accessible via l'interface : I)
168  void ZoomSelected(); //zoom 'gnuplot'
169 
170  void SetLogz(); //echelle log sur Oz
171  void SetLogy(); //echelle log sur Oy
172  void SetLogx(); //echelle log sur Ox
173  void Undo(); //annule toute les operation sur la grille courante (I)
174 
175  void SetPivot(Double_t xx0, Double_t yy0); // set pivot position (double click on the histo)
176  void SetPiedestal(Double_t ppdx, Double_t ppdy); // set piedestal position (shift click on the histo)
177 
178  void SetEditable(TPaveLabel* label);
179  void SelectLines(const Char_t* label);
180 
181  void NewLine(); //'Line'
182  void NewCut(); //'Cut'
183  void NewInfo(); //'Info'
184  void FitGrid(); //'Fit' avec fonctionnelle de T.G
185  void TestGrid(); //'Test' linearisation de l'histo avec la grille courante
186 
187  void DeleteObject(KVIDentifier* obj); //'Delete'
188 
189  void UpdateViewer(); //rafraichit l'interface
190  void DrawAtt(Bool_t piv); //affiche les bouton sur le canvas
191  void ResetColor(KVIDentifier* Ident); //redonne la couleur d'origine a une ligne
192  void ResetColor(KVSeqCollection* IdentList); //redonne la couleur d'origine a une liste de ligne
193 
194  void SuggestMoreAction(); //'More', modifier cette methode pour ajouter des fonctionnalites !!!
195  void ChooseSelectedColor(); //'More' -> SetSelectedColor change la couleur des lignes selectionnes
196  void OpenRootFile(); //pas implemente
197 
198  void DispatchOrder(TPaveLabel* label); //methode qui distribue les ordres quand on clic sur un bouton
199  void ChangeStep(const char* title, Int_t dstep = 1);
200  const char* WhoIsSelected(); //methode qui regarde quelle transformation est selectionnee
201 
202  TString ListOfHistogramInMemory(); //revoie la liste des histo dans gFile
203  TString PreselectHistogram(TString ListOfName, Int_t ipert = 0); //revoie le nom de l' histo qui as le mm nom que la grille (si existe)
204  TH2* FindInCanvases(const Char_t* name);
205  void RecurseFileStructureFindHistos(TString& hist_names, TDirectory* the_directory);
206 
207  void ChangeZoomRatio(Int_t sign, Double_t speed = .5);
208 public:
209 
210  KVIDGridEditor();
212  ROOT_COPY_ASSIGN_OP(KVIDGridEditor)
213  virtual ~KVIDGridEditor();
214  void Copy(TObject&) const override;
215 
216  void StartViewer(); //ouvre l'interface graphique, utilise quand double clic sur une grille dans le gIDGridManagerGUI
217  void Clear(const Option_t* opt = "") override; //nettoi l'interface ('all' enleve la grille et l'histo)
218  void Close(); //ferme l'interface graphique
219  Bool_t IsClosed(); //true si l'interface est fermee
220  void CanvasWasClosed(); // called when GUI is used to close the canvas
221  void ForceUpdate(); //rafraichit toute l'interface de force
222  void SaveCurrentGrid(); //'More' -> SaveCurrentGrid ouvre une boite de dialogue pour sauver la grille
223 
224  void AutoFit(); //'More' -> AutoFit try to autofit the selected lines
225 
226  void SetPointStyle(int pstyle);
228  {
229  return fPointStyle;
230  }
231  void SetPointSize(double psize);
232  double GetPointSize()
233  {
234  return fPointSize;
235  }
236 
237  void SetHisto(TH2* hh); //donne l'histo a l'editeur
238  void SetGrid(KVIDGraph* gg, Bool_t histo = true); //donne la grille a l'editeur
239  void SetGrid(TString GridName); //donne la grille a l'editeur par son nom
240 
242  {
243  return TheGrid;
244  }
246  {
247  return TheHisto;
248  }
249 
251  {
252  return fCanvas;
253  }
254 
255  void SelectLabel(); //methode ajouter a la liste des auto-exec du canvas : gere les bouton
256  void MakeTransformation(); //methode ajouter a la liste des auto-exec du canvas : gere le reste
257 
259  {
260  SelectedColor = color;
261  }
262  void SelectLinesByZ(const Char_t* ListOfZ); //'More' -> 'SelectLinesByZ'
263  void SetDebug(Bool_t debug)
264  {
265  fDebug = debug;
266  }
267  void SetSVGMode()
268  {
269  fSVGMode = !fSVGMode;
270  }
273 
275  {
276  return fSpiderZp;
277  }
279  {
280  return fSpiderFactor;
281  }
282 
283  void SetSpiderOption(const char* opt = "DRLF")
284  {
285  fSpiderOption = opt;
286  }
287  void SpiderIdentification();
288  void FindZALines();
289  void ChangeMasses(const Char_t* Zl, Int_t dA);
290  void ChangeCharges(const Char_t* Zl, Int_t dZ);
291 
293  {
294  fAx = fAy = 1;
295  fBx = fBy = 0;
296  }
297  void PrintScalingRecap();
298 
299  ClassDefOverride(KVIDGridEditor, 1) // outil de modification de grille.
300 };
301 
303 R__EXTERN KVIDGridEditor* gIDGridEditor;
304 
305 #endif
int Int_t
#define R__EXTERN
bool Bool_t
char Char_t
double Double_t
const char Option_t
#define ClassDefOverride(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:139
Extended version of ROOT THashList.
Definition: KVHashList.h:29
Base class for particle identification in a 2D map.
Definition: KVIDGraph.h:32
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 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()
KVUnownedList * ListOfLines
liste des lignes selectionnees
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 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)
TF1 * fs
scaling
void SetSelectedColor(Int_t color)
TH2 * TheHisto
pointeur sur l'histogramme
void Clear(const Option_t *opt="") override
void SelectTrans(TPaveLabel *label)
void ResetColor(KVIDentifier *Ident)
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)
void Copy(TObject &) const override
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:28
KaliVeda extensions to ROOT collection classes.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Extended TList class which does not own its objects by default.
Definition: KVUnownedList.h:21
int Sign(const T &x)