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 
73  Bool_t fDebug;
74  Bool_t fSVGMode;
75  Bool_t fBlackMode;
76  Bool_t fJoelMode;
77  Int_t fSVGIndex;
78  TPaveText* fKeyShow;
79 
81  TVirtualPad* fPad;
82  TGraph* fPivot;
83  TGraph* fPiedestal;
84  KVString fListOfMethods;
85  KVString fDefaultMethod;
86 
87  KVHashList* lplabel;
88  KVHashList* lplabel2;
89  KVHashList* lplabel3;
90  KVHashList* lplabel4;
91  KVHashList* lplabel5;
92 
93  TPaveLabel* modulator;
94 
95  TH2* TheHisto;
96  TH2* TheHistoChoice;
97  KVIDGraph* TheGrid;
98  KVUnownedList* ListOfLines;
99 
100  Int_t SelectedColor;
101 
102  Double_t x0;
103  Double_t y0;
104  Int_t itrans, iact, iopt, imod;
105 
106  TF1* ft;
107  TF1* fs;
108  TF1* fsy;
109  TF2* frx;
110  TF2* fry;
111 
112  Double_t fAx, fBx, fAy, fBy;
113 
114  Bool_t ownhisto;
115  Bool_t dlmode;
116  Bool_t drawmode;
117  Bool_t aoemode;
118  Bool_t selectmode;
119  Bool_t venermode;
120  Bool_t ready;
121 
122  Bool_t is_col;
123 
124  Double_t xmin, xmax, ymin, ymax;
125  Double_t oldx, oldy;
126  Bool_t moved;
127 
128  Double_t fSpiderFactor;
129  Int_t fSpiderZp;
130  TString fSpiderOption;
131  Bool_t fAutoZoomMode;
132 
133  Int_t fPointStyle;
134  Double_t fPointSize;
135 
136  std::vector<Color_t> cut_line_colors = {kRed,kYellow};
137  std::vector<Color_t> cut_marker_colors = {kBlack,kGreen-7};
138  std::vector<Color_t> identifier_line_colors_no_mass = {kBlack,kBlue};
139  std::vector<Color_t> identifier_marker_colors_no_mass = {kBlack,kRed};
140  std::vector<Color_t> identifier_line_colors_with_mass = {kAzure+7,kOrange-3};
141  std::vector<Color_t> identifier_marker_colors_with_mass = {kPink-9,kYellow};
142 
143 protected:
144 
145  Double_t GetX0();
146  Double_t GetY0();
147  Double_t GetPdx();
148  Double_t GetPdy();
149 
150  Bool_t HandleKey(Int_t px, Int_t py);
151  void MoveHor(Int_t sign, Double_t speed = 1, Bool_t update = true);
152  void MoveVert(Int_t sign, Double_t speed = 1, Bool_t update = true);
153 
154  void ZoomOnMouse();
155  void AddMethod(const char* theMethod);
156  void SelectTrans(TPaveLabel* label);
157 
158  void SetDefault(); //
159  void init(); //
160  void AddTransformation(TString label); //construction de l'interface
161  void AddAction(TString label); //graphique et initialisation
162  void AddGridOption(TString label, KVHashList* thelist); //
163  void ConstructModulator(); //
164 
165  void TranslateX(Int_t Sign);
166  void TranslateY(Int_t Sign);
167  void RotateZ(Int_t Sign);
168  void ScaleX(Int_t Sign);
169  void ScaleY(Int_t Sign);
170  void ScaleXY(Int_t Sign);
171  void ScaleCurvature(Int_t Sign);
172 
173  void DynamicZoom(Int_t Sign, Int_t px = 0, Int_t py = 0, Double_t speed = .5); //zoom molette
174  void Unzoom(); //unzoom histo (accessible via l'interface : I)
175  void ZoomSelected(); //zoom 'gnuplot'
176 
177  void SetLogz(); //echelle log sur Oz
178  void SetLogy(); //echelle log sur Oy
179  void SetLogx(); //echelle log sur Ox
180  void Undo(); //annule toute les operation sur la grille courante (I)
181 
182  void SetPivot(Double_t xx0, Double_t yy0); // set pivot position (double click on the histo)
183  void SetPiedestal(Double_t ppdx, Double_t ppdy); // set piedestal position (shift click on the histo)
184 
185  void SetEditable(TPaveLabel* label);
186  void SelectLines(const Char_t* label);
187 
188  void NewLine(); //'Line'
189  void NewCut(); //'Cut'
190  void NewInfo(); //'Info'
191  void FitGrid(); //'Fit' avec fonctionnelle de T.G
192  void TestGrid(); //'Test' linearisation de l'histo avec la grille courante
193 
194  void DeleteObject(KVIDentifier* obj); //'Delete'
195 
196  void DrawAtt(Bool_t piv); //affiche les bouton sur le canvas
197  void ResetColor(KVIDentifier* Ident); //redonne la couleur d'origine a une ligne
198  void ResetColor(KVSeqCollection* IdentList); //redonne la couleur d'origine a une liste de ligne
199 
200  void SuggestMoreAction(); //'More', modifier cette methode pour ajouter des fonctionnalites !!!
201  void ChooseSelectedColor(); //'More' -> SetSelectedColor change la couleur des lignes selectionnes
202  void OpenRootFile(); //pas implemente
203 
204  void DispatchOrder(TPaveLabel* label); //methode qui distribue les ordres quand on clic sur un bouton
205  void ChangeStep(const char* title, Int_t dstep = 1);
206  const char* WhoIsSelected(); //methode qui regarde quelle transformation est selectionnee
207 
208  TString ListOfHistogramInMemory(); //revoie la liste des histo dans gFile
209  TString PreselectHistogram(TString ListOfName, Int_t ipert = 0); //revoie le nom de l' histo qui as le mm nom que la grille (si existe)
210  TH2* FindInCanvases(const Char_t* name);
211  void RecurseFileStructureFindHistos(TString& hist_names, TDirectory* the_directory);
212 
213  void ChangeZoomRatio(Int_t sign, Double_t speed = .5);
214 public:
215 
216  KVIDGridEditor();
218  ROOT_COPY_ASSIGN_OP(KVIDGridEditor)
219  virtual ~KVIDGridEditor();
220  void Copy(TObject&) const override;
221 
222  void StartViewer(); //ouvre l'interface graphique, utilise quand double clic sur une grille dans le gIDGridManagerGUI
223  void Clear(const Option_t* opt = "") override; //nettoi l'interface ('all' enleve la grille et l'histo)
224  void Close(); //ferme l'interface graphique
225  Bool_t IsClosed(); //true si l'interface est fermee
226  void CanvasWasClosed(); // called when GUI is used to close the canvas
227  void UpdateViewer(); //rafraichit l'interface
228  void ForceUpdate(); //rafraichit toute l'interface de force
229  void SaveCurrentGrid(); //'More' -> SaveCurrentGrid ouvre une boite de dialogue pour sauver la grille
230 
231  void AutoFit(); //'More' -> AutoFit try to autofit the selected lines
232 
233  void SetPointStyle(int pstyle);
235  {
236  return fPointStyle;
237  }
238  void SetPointSize(double psize);
239  double GetPointSize()
240  {
241  return fPointSize;
242  }
243 
244  void SetHisto(TH2* hh); //donne l'histo a l'editeur
245  void SetGrid(KVIDGraph* gg, Bool_t histo = true); //donne la grille a l'editeur
246  void SetGrid(TString GridName); //donne la grille a l'editeur par son nom
247 
249  {
250  return TheGrid;
251  }
253  {
254  return TheHisto;
255  }
256 
258  {
259  return fCanvas;
260  }
261 
262  void SelectLabel(); //methode ajouter a la liste des auto-exec du canvas : gere les bouton
263  void MakeTransformation(); //methode ajouter a la liste des auto-exec du canvas : gere le reste
264 
266  {
267  SelectedColor = color;
268  }
269  void SelectLinesByZ(const Char_t* ListOfZ); //'More' -> 'SelectLinesByZ'
270  void SetDebug(Bool_t debug)
271  {
272  fDebug = debug;
273  }
274  void SetSVGMode()
275  {
276  fSVGMode = !fSVGMode;
277  }
280 
282  {
283  return fSpiderZp;
284  }
286  {
287  return fSpiderFactor;
288  }
289 
290  void SetSpiderOption(const char* opt = "DRLF")
291  {
292  fSpiderOption = opt;
293  }
294  void SpiderIdentification();
295  void FindZALines();
296  void ChangeMasses(const Char_t* Zl, Int_t dA);
297  void ChangeCharges(const Char_t* Zl, Int_t dZ);
298 
300  {
301  fAx = fAy = 1;
302  fBx = fBy = 0;
303  }
304  void PrintScalingRecap();
305 
306  void ResetGridColors();
307 
308  ClassDefOverride(KVIDGridEditor, 1) // outil de modification de grille.
309 };
310 
312 R__EXTERN KVIDGridEditor* gIDGridEditor;
313 
314 #endif
int Int_t
#define R__EXTERN
bool Bool_t
char Char_t
double Double_t
const char Option_t
kPink
kRed
kOrange
kBlack
kGreen
kBlue
kAzure
kYellow
#define ClassDefOverride(name, id)
Base class for KaliVeda framework.
Definition: KVBase.h:140
Extended version of ROOT THashList.
Definition: KVHashList.h:29
Base class for particle identification in a 2D map.
Definition: KVIDGraph.h:31
Extended version of KVCanvas used by KVIDGridEditor.
Identification grid editor GUI ,.
void SelectLinesByZ(const Char_t *ListOfZ)
KVIDGridEditor()
Default constructor.
double GetPointSize()
void SetGrid(KVIDGraph *gg, Bool_t histo=true)
KVIDGraph * GetGrid()
void ResetScalingRecap()
void SetSpiderOption(const char *opt="DRLF")
void ChangeCharges(const Char_t *Zl, Int_t dZ)
void SetDebug(Bool_t debug)
void SetPointStyle(int pstyle)
void StartViewer()
Close();.
virtual ~KVIDGridEditor()
Destructor.
void SetSelectedColor(Int_t color)
void Clear(const Option_t *opt="") override
void SetHisto(TH2 *hh)
TCanvas * GetEditorCanvas()
void SetPointSize(double psize)
void ChangeMasses(const Char_t *Zl, Int_t dA)
Double_t GetSpiderFactor()
void Copy(TObject &) const override
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:20
void SetLogz(Int_t value=1) override
void SetEditable(Bool_t mode=kTRUE) override
void SetLogy(Int_t value=1) override
TCanvas * fCanvas
void SetLogx(Int_t value=1) override
int Sign(const T &x)