GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Condition.h
Go to the documentation of this file.
1 // $Id: TGo4Condition.h 3184 2021-04-26 12:57:56Z adamczew $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4CONDITION_H
15 #define TGO4CONDITION_H
16 
17 #include "TNamed.h"
18 #include "TAttLine.h"
19 #include "TAttFill.h"
20 #include <iostream>
21 
22 class TH1;
23 class TVirtualPad;
24 class TCutG;
25 class TObjArray;
26 
27 class TGo4HistogramEntry;
28 class TGo4EventElement;
30 
34 };
35 
36 class TGo4Condition : public TNamed, public TAttLine, public TAttFill {
37 
38  friend class TGo4CondArray;
39 
40  public:
41  TGo4Condition();
42 
43  TGo4Condition(const char* name, const char* title = "Go4 Condition");
44 
45  virtual ~TGo4Condition();
46 
48  virtual void Paint(Option_t* opt="");
49 
51  virtual void Draw(Option_t* opt="");
52 
54  virtual void UnDraw(Option_t* opt="");
55 
57  virtual void Pop();
58 
61 
63  virtual Int_t Counts();
64 
66  virtual Int_t TrueCounts();
67 
69  virtual void ResetCounts();
70 
72  virtual void SetCounts(Int_t truecounts, Int_t counts);
73 
76  virtual void Disable(Bool_t result);
77 
79  virtual void Enable();
80 
82  Bool_t IsEnabled() const { return fbEnabled; }
83 
87  virtual Bool_t Test();
88  virtual Bool_t Test(Double_t x, Double_t y) { return true; }
89  virtual Bool_t Test(Double_t x) { return true; }
90  //virtual Bool_t Test(Bool_t result) { return true; }
91 
93  virtual void SetValues() {}
94  virtual void SetValues(Double_t low1, Double_t up1) {}
95  virtual void SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2) {}
96  virtual void SetValues(TCutG * newcut) {}
97  virtual void SetValues(Double_t * x, Double_t * y, Int_t len) {}
98 
110  virtual void AddCondition(TGo4Condition* next);
111 
114  void IncCounts();
115 
118  void IncTrueCounts();
119 
122  Bool_t IsTrue() const { return fbTrue; }
123 
126  Bool_t IsFalse() const { return fbFalse; }
127 
129  Bool_t FixedResult() const { return fbResult; }
130 
133  virtual void Invert(Bool_t on);
134 
136  virtual void PrintCondition(Bool_t full=kTRUE);
137 
139  virtual void PrintBar();
140 
142  virtual void Print(Option_t* opt="") const;
143 
146  void SetLast(Bool_t value) { fbLastResult=value; }
147 
149  Bool_t GetLast() { return fbLastResult; }
150 
152  virtual Bool_t UpdateFrom(TGo4Condition * cond, Bool_t counts);
153 
155  virtual Bool_t UpdateFromUrl(const char* rest_url_opt);
156 
157  virtual void GetValues(Int_t & dim, Double_t & x1, Double_t & y1, Double_t & x2, Double_t & y2);
158  virtual Double_t GetXLow() { return 0.; }
159  virtual Double_t GetXUp() { return 0.; }
160  virtual Double_t GetYLow() { return 0.; }
161  virtual Double_t GetYUp() { return 0.; }
162  virtual TCutG* GetCut(Bool_t owner) { return 0; }
163 
166  virtual Double_t GetIntegral(TH1*, Option_t* = "") { return 0.; }
167 
169  virtual Double_t GetMean(TH1*, Int_t=1) { return 0.; }
170 
172  virtual Double_t GetRMS(TH1*, Int_t=1) { return 0.; }
173 
175  virtual Double_t GetSkewness(TH1*, Int_t=1) { return 0.; }
176 
178  virtual Double_t GetCurtosis(TH1*, Int_t=1) { return 0.; }
179 
181  virtual Double_t GetXMax(TH1*) { return 0.; }
182 
184  virtual Double_t GetYMax(TH1*) { return 0.; }
185 
187  virtual Double_t GetCMax(TH1*) { return 0.; }
188 
190  virtual TGo4Condition* GetActiveCondition() { return this; }
191 
193  virtual void MarkReset(Bool_t on);
194 
195  virtual void Clear(Option_t* opt="");
196 
199  virtual void SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset,
200  Bool_t result, Bool_t truevalue, Bool_t falsevalue);
201 
204  virtual void GetFlags(Bool_t* enabled, Bool_t* lastresult, Bool_t* markreset,
205  Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue);
206 
208  virtual void SetVisible(Bool_t on) { fbVisible=on; }
209 
211  virtual Bool_t IsVisible() { return fbVisible; }
212 
214  void SetHistogramLink(Bool_t on) { fbHistogramLink = on; }
215 
217  Bool_t IsHistogramLink() { return fbHistogramLink; }
218 
220  void SetHistogram(const char* name);
221 
223  const char* GetLinkedHistogram();
224 
227  virtual void SetWorkHistogram(TH1* histo) { fxHisto = histo; }
228 
230  TH1* GetWorkHistogram() { return fxHisto; }
231 
235  virtual void SetPainter(TGo4ConditionPainter* painter);
236 
239  void SetUpdateEpsilon(Double_t val){fdUpdateEpsilon=val;}
240 
241  Double_t GetUpdateEpsilon(){return fdUpdateEpsilon;}
242 
244  static const Double_t fgdUPDATEEPSILON;
245 
247  void SaveLabelStyle();
248 
250  void InitLabelStyle();
251 
254  void ResetLabel(Option_t *opt = "reset");
255 
256  virtual void SetLabelDraw(Bool_t on) { fbLabelDraw = on; } // *TOGGLE* *GETTER=IsLabelDraw
257  virtual Bool_t IsLabelDraw() { return fbLabelDraw; }
258 
259  virtual void SetLimitsDraw(Bool_t on) { fbLimitsDraw = on; } // *TOGGLE* *GETTER=IsLimitsDraw
260  virtual Bool_t IsLimitsDraw() { return fbLimitsDraw; }
261 
262  virtual void SetIntDraw(Bool_t on) { fbIntDraw = on; } // *TOGGLE* *GETTER=IsIntDraw
263  virtual Bool_t IsIntDraw() { return fbIntDraw; }
264 
265  virtual void SetXMeanDraw(Bool_t on) { fbXMeanDraw = on; } // *TOGGLE* *GETTER=IsXMeanDraw
266  virtual Bool_t IsXMeanDraw() { return fbXMeanDraw; }
267 
268  virtual void SetXRMSDraw(Bool_t on) { fbXRMSDraw = on; } // *TOGGLE* *GETTER=IsXRMSDraw
269  virtual Bool_t IsXRMSDraw() { return fbXRMSDraw; }
270 
271  virtual void SetYMeanDraw(Bool_t on) { fbYMeanDraw = on; } // *TOGGLE* *GETTER=IsYMeanDraw
272  virtual Bool_t IsYMeanDraw() { return fbYMeanDraw; }
273 
274  virtual void SetYRMSDraw(Bool_t on) { fbYRMSDraw = on; } // *TOGGLE* *GETTER=IsYRMSDraw
275  virtual Bool_t IsYRMSDraw() { return fbYRMSDraw; }
276 
277  virtual void SetXMaxDraw(Bool_t on) { fbXMaxDraw = on; } // *TOGGLE* *GETTER=IsXMaxDraw
278  virtual Bool_t IsXMaxDraw() { return fbXMaxDraw; }
279 
280  virtual void SetYMaxDraw(Bool_t on) { fbYMaxDraw = on; } // *TOGGLE* *GETTER=IsYMaxDraw
281  virtual Bool_t IsYMaxDraw() { return fbYMaxDraw; }
282 
283  virtual void SetCMaxDraw(Bool_t on) { fbCMaxDraw = on; } // *TOGGLE* *GETTER=IsCMaxDraw
284  virtual Bool_t IsCMaxDraw() { return fbCMaxDraw; }
285 
286  virtual void SetLabelNumFormat(const char *fmt) { fxNumFormat = fmt; }
287  virtual const char *GetLabelNumFormat() { return fxNumFormat.Data(); }
288 
289  virtual void SetChanged(Bool_t on = kTRUE)
290  {
291  if (on)
292  fiIsChanged++;
293  else
294  fiIsChanged = 0;
295  }
296  virtual Int_t IsChanged() { return fiIsChanged; }
297 
298  void SetMultiEdit(Bool_t on) { fbMultiEdit = on; }
299  virtual Bool_t IsMultiEdit() { return fbMultiEdit; }
300 
301  void SetDimension(Int_t d) { fiDim = d; }
302  Int_t GetDimension() { return fiDim; }
303 
304  void SetOwnedByEditor(Bool_t on) { fbOwnedByEditor = on; }
305  Bool_t IsOwnedByEditor() { return fbOwnedByEditor; }
306 
308  virtual void SetCurrentIndex(Int_t) {}
309 
311  virtual Int_t GetCurrentIndex() { return 0; }
312 
315  virtual Int_t GetNumberOfConditions() { return 1; }
316 
317  virtual Int_t GetMemorySize();
318 
319  virtual Bool_t IsPolygonType() { return kFALSE; }
320  virtual Bool_t IsArrayType() { return kFALSE; }
321 
322  void DeletePainter();
323 
325  static Bool_t fgbLABELDRAW;
326 
328  static Bool_t fgbLIMITSDRAW;
329 
331  static Bool_t fgbINTDRAW;
332 
334  static Bool_t fgbXMEANDRAW;
335 
337  static Bool_t fgbXRMSDRAW;
338 
340  static Bool_t fgbYMEANDRAW;
341 
343  static Bool_t fgbYRMSDRAW;
344 
346  static Bool_t fgbXMAXDRAW;
347 
349  static Bool_t fgbYMAXDRAW;
350 
352  static Bool_t fgbCMAXDRAW;
353 
355  static TString fgxNUMFORMAT;
356 
357 
359  static TString fgxURL_RESET;
361  static TString fgxURL_RESULT;
363  static TString fgxURL_INVERT;
365  static TString fgxURL_VISIBLE;
367  static TString fgxURL_LABEL;
369  static TString fgxURL_LIMITS;
371  static TString fgxURL_INTEGRAL;
373  static TString fgxURL_XMEAN;
375  static TString fgxURL_XRMS;
377  static TString fgxURL_YMEAN;
379  static TString fgxURL_YRMS;
381  static TString fgxURL_XMAX;
383  static TString fgxURL_YMAX;
385  static TString fgxURL_CMAX;
386 
387  static void SetGlobalStyle(Bool_t LABELDRAW, Bool_t LIMITSDRAW, Bool_t INTDRAW,
388  Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW,
389  Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW, const char *NUMFORMAT);
390 
391  static void GetGlobalStyle(Bool_t &LABELDRAW, Bool_t &LIMITSDRAW, Bool_t &INTDRAW,
392  Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW,
393  Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT);
394 
395  protected:
396 
401 
403  TObjArray* fxUrlOptionArray;
404 
406  void BuildUrlOptionArray(const char* rest_url_opt);
407 
409  Bool_t UrlOptionHasKey(const char* key);
410 
413  TString GetUrlOptionAsString(const char* key, TString def_value);
414 
415 
418  Int_t GetUrlOptionAsInt(const char* key, Int_t def_value);
419 
422  Double_t GetUrlOptionAsDouble(const char* key, Double_t def_value);
423 
424 
425  void SetPainted(Bool_t on) { fbIsPainted=on; }
426  Bool_t IsPainted() const { return fbIsPainted; }
427 
428  const char* MakeScript(std::ostream& out, const char* varname, Option_t* opt = "", const char* arrextraargs = 0);
429 
430  private:
431 
433  Int_t fiDim;
434 
435  Bool_t fbMarkReset;
436 
439  Bool_t fbLastResult;
440 
442  Bool_t fbTrue;
443 
445  Bool_t fbFalse;
446 
449 
451  Int_t fiCounts;
452 
457  Bool_t fbEnabled;
458 
460  Bool_t fbResult;
461 
464  Bool_t fbMultiEdit;
465 
467  Bool_t fbVisible;
468 
471 
473  TString fxHistoName;
474 
476  Double_t fdUpdateEpsilon;
477 
479  Bool_t fbLabelDraw;
480 
482  Bool_t fbLimitsDraw;
483 
485  Bool_t fbIntDraw;
486 
488  Bool_t fbXMeanDraw;
489 
491  Bool_t fbXRMSDraw;
492 
494  Bool_t fbYMeanDraw;
495 
497  Bool_t fbYRMSDraw;
498 
500  Bool_t fbXMaxDraw;
501 
503  Bool_t fbYMaxDraw;
504 
506  Bool_t fbCMaxDraw;
507 
509  TString fxNumFormat;
510 
513  TH1* fxHisto;
514 
516  Int_t fiIsChanged;
517 
520  Bool_t fbIsPainted;
521 
524 
527 
528  ClassDef(TGo4Condition,8)
529 };
530 
531 #endif //TGO4CONDITION_H
Double_t GetUpdateEpsilon()
virtual Bool_t IsXRMSDraw()
TString fxNumFormat
Bool_t IsHistogramLink()
static Bool_t fgbXRMSDRAW
static TString fgxURL_CMAX
virtual Bool_t IsLimitsDraw()
static Bool_t fgbYMAXDRAW
Bool_t UrlOptionHasKey(const char *key)
static TString fgxURL_XRMS
virtual void SetIntDraw(Bool_t on)
static Bool_t fgbLIMITSDRAW
static void GetGlobalStyle(Bool_t &LABELDRAW, Bool_t &LIMITSDRAW, Bool_t &INTDRAW, Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW, Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT)
Bool_t fbLastResult
virtual Double_t GetRMS(TH1 *, Int_t=1)
void SetUpdateEpsilon(Double_t val)
virtual Bool_t IsCMaxDraw()
Bool_t GetLast()
static TString fgxURL_RESET
virtual void SetYMaxDraw(Bool_t on)
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual Bool_t IsIntDraw()
virtual void UnDraw(Option_t *opt="")
virtual Double_t GetCurtosis(TH1 *, Int_t=1)
Bool_t fbMarkReset
virtual Int_t IsChanged()
virtual void SetCMaxDraw(Bool_t on)
Bool_t IsFalse() const
virtual Bool_t IsPolygonType()
virtual Double_t GetYUp()
virtual void SetValues(TCutG *newcut)
Definition: TGo4Condition.h:96
Int_t GetDimension()
virtual void SetPainter(TGo4ConditionPainter *painter)
TString GetUrlOptionAsString(const char *key, TString def_value)
static Bool_t fgbCMAXDRAW
virtual void PrintCondition(Bool_t full=kTRUE)
static TString fgxURL_YMEAN
virtual void SetYRMSDraw(Bool_t on)
virtual ~TGo4Condition()
virtual Bool_t IsVisible()
Bool_t IsEnabled() const
Definition: TGo4Condition.h:82
virtual Bool_t IsLabelDraw()
Bool_t fbOwnedByEditor
static Bool_t fgbLABELDRAW
Bool_t fbHistogramLink
void BuildUrlOptionArray(const char *rest_url_opt)
ConditionsKind
Definition: TGo4Condition.h:31
static TString fgxNUMFORMAT
static TString fgxURL_RESULT
virtual void SetValues()
Definition: TGo4Condition.h:93
virtual void SetXMeanDraw(Bool_t on)
static Bool_t fgbXMEANDRAW
Bool_t fbYMeanDraw
void SetOwnedByEditor(Bool_t on)
virtual Double_t GetIntegral(TH1 *, Option_t *="")
virtual Double_t GetXLow()
Bool_t fbIsPainted
virtual void ResetCounts()
virtual void Draw(Option_t *opt="")
static TString fgxURL_INTEGRAL
Bool_t FixedResult() const
virtual Double_t GetSkewness(TH1 *, Int_t=1)
virtual Int_t GetCurrentIndex()
virtual Bool_t Test(Double_t x, Double_t y)
Definition: TGo4Condition.h:88
void SetPainted(Bool_t on)
virtual void SetCounts(Int_t truecounts, Int_t counts)
virtual void Enable()
virtual void SetValues(Double_t low1, Double_t up1)
Definition: TGo4Condition.h:94
virtual void PrintBar()
Bool_t fbMultiEdit
virtual Bool_t IsYMaxDraw()
virtual void SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2)
Definition: TGo4Condition.h:95
virtual void SetLabelNumFormat(const char *fmt)
static void SetGlobalStyle(Bool_t LABELDRAW, Bool_t LIMITSDRAW, Bool_t INTDRAW, Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW, Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW, const char *NUMFORMAT)
virtual void SetXMaxDraw(Bool_t on)
virtual Bool_t IsArrayType()
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
virtual void Pop()
virtual Bool_t IsMultiEdit()
virtual void Clear(Option_t *opt="")
void SetHistogramLink(Bool_t on)
Bool_t fbXMeanDraw
virtual void SetValues(Double_t *x, Double_t *y, Int_t len)
Definition: TGo4Condition.h:97
virtual void Print(Option_t *opt="") const
static Bool_t fgbYMEANDRAW
virtual Bool_t IsXMeanDraw()
virtual void SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset, Bool_t result, Bool_t truevalue, Bool_t falsevalue)
void SetHistogram(const char *name)
static TString fgxURL_VISIBLE
virtual void SetWorkHistogram(TH1 *histo)
static TString fgxURL_INVERT
Bool_t IsPainted() const
Bool_t IsTrue() const
virtual void Disable(Bool_t result)
virtual Bool_t IsXMaxDraw()
TH1 * GetWorkHistogram()
virtual Bool_t Test(Double_t x)
Definition: TGo4Condition.h:89
virtual Double_t GetYLow()
void ResetLabel(Option_t *opt="reset")
virtual TGo4Condition * GetActiveCondition()
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=0)
virtual void SetXRMSDraw(Bool_t on)
virtual void SetLimitsDraw(Bool_t on)
void SetMultiEdit(Bool_t on)
virtual Bool_t IsYMeanDraw()
static TString fgxURL_YMAX
static Bool_t fgbXMAXDRAW
virtual TGo4ConditionPainter * CreatePainter()
virtual void GetFlags(Bool_t *enabled, Bool_t *lastresult, Bool_t *markreset, Bool_t *result, Bool_t *truevalue, Bool_t *falsevalue)
virtual Bool_t IsYRMSDraw()
virtual Bool_t Test()
virtual void MarkReset(Bool_t on)
virtual void SetChanged(Bool_t on=kTRUE)
virtual void Paint(Option_t *opt="")
Bool_t IsOwnedByEditor()
TGo4ConditionPainter * fxPainter
virtual const char * GetLabelNumFormat()
static TString fgxURL_LIMITS
void SetLast(Bool_t value)
static Bool_t fgbYRMSDRAW
virtual Double_t GetMean(TH1 *, Int_t=1)
virtual Double_t GetYMax(TH1 *)
TObjArray * fxUrlOptionArray
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
virtual Int_t GetMemorySize()
virtual TCutG * GetCut(Bool_t owner)
Int_t GetUrlOptionAsInt(const char *key, Int_t def_value)
const char * GetLinkedHistogram()
virtual void SetYMeanDraw(Bool_t on)
virtual Int_t TrueCounts()
virtual Int_t Counts()
static TString fgxURL_XMEAN
TString fxHistoName
static TString fgxURL_YRMS
virtual Double_t GetXUp()
virtual void AddCondition(TGo4Condition *next)
Bool_t fbLimitsDraw
virtual void SetLabelDraw(Bool_t on)
static TString fgxURL_LABEL
virtual Int_t GetNumberOfConditions()
static const Double_t fgdUPDATEEPSILON
virtual void SetVisible(Bool_t on)
Double_t fdUpdateEpsilon
virtual void SetCurrentIndex(Int_t)
virtual Double_t GetCMax(TH1 *)
virtual void Invert(Bool_t on)
Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value)
static TString fgxURL_XMAX
Bool_t fbLabelDraw
void SetDimension(Int_t d)
virtual Double_t GetXMax(TH1 *)
Bool_t fbStreamedCondition
static Bool_t fgbINTDRAW