GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4Condition.h
Go to the documentation of this file.
1 // $Id$
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  void Paint(Option_t *opt = "") override;
49 
51  void Draw(Option_t *opt = "") override;
52 
54  virtual void UnDraw(Option_t *opt = "");
55 
57  void Pop() override;
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  void Print(Option_t *opt = "") const override;
143 
146  void SetLast(Bool_t value) { fbLastResult=value; }
147 
149  Bool_t GetLast() const { 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() const { return 0.; }
159  virtual Double_t GetXUp() const { return 0.; }
160  virtual Double_t GetYLow() const { return 0.; }
161  virtual Double_t GetYUp() const { return 0.; }
162  virtual TCutG *GetCut(Bool_t owner) { return nullptr; }
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 const TGo4Condition *GetActiveCondition() const { return this; }
191 
193  virtual void MarkReset(Bool_t on);
194 
195  void Clear(Option_t *opt = "") override;
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() const { return fbVisible; }
212 
214  void SetHistogramLink(Bool_t on) { fbHistogramLink = on; }
215 
217  Bool_t IsHistogramLink() const { return fbHistogramLink; }
218 
220  void SetHistogram(const char *name);
221 
223  const char *GetLinkedHistogram() const;
224 
227  virtual void SetWorkHistogram(TH1 *histo) { fxHisto = histo; }
228 
230  TH1 *GetWorkHistogram() const { return fxHisto; }
231 
235  virtual void SetPainter(TGo4ConditionPainter *painter);
236 
239  void SetUpdateEpsilon(Double_t val){fdUpdateEpsilon=val;}
240 
241  Double_t GetUpdateEpsilon() const { 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() const { return fbLabelDraw; }
258 
259  virtual void SetLimitsDraw(Bool_t on) { fbLimitsDraw = on; } // *TOGGLE* *GETTER=IsLimitsDraw
260  virtual Bool_t IsLimitsDraw() const { return fbLimitsDraw; }
261 
262  virtual void SetIntDraw(Bool_t on) { fbIntDraw = on; } // *TOGGLE* *GETTER=IsIntDraw
263  virtual Bool_t IsIntDraw() const { return fbIntDraw; }
264 
265  virtual void SetXMeanDraw(Bool_t on) { fbXMeanDraw = on; } // *TOGGLE* *GETTER=IsXMeanDraw
266  virtual Bool_t IsXMeanDraw() const { return fbXMeanDraw; }
267 
268  virtual void SetXRMSDraw(Bool_t on) { fbXRMSDraw = on; } // *TOGGLE* *GETTER=IsXRMSDraw
269  virtual Bool_t IsXRMSDraw() const { return fbXRMSDraw; }
270 
271  virtual void SetYMeanDraw(Bool_t on) { fbYMeanDraw = on; } // *TOGGLE* *GETTER=IsYMeanDraw
272  virtual Bool_t IsYMeanDraw() const { return fbYMeanDraw; }
273 
274  virtual void SetYRMSDraw(Bool_t on) { fbYRMSDraw = on; } // *TOGGLE* *GETTER=IsYRMSDraw
275  virtual Bool_t IsYRMSDraw() const { return fbYRMSDraw; }
276 
277  virtual void SetXMaxDraw(Bool_t on) { fbXMaxDraw = on; } // *TOGGLE* *GETTER=IsXMaxDraw
278  virtual Bool_t IsXMaxDraw() const { return fbXMaxDraw; }
279 
280  virtual void SetYMaxDraw(Bool_t on) { fbYMaxDraw = on; } // *TOGGLE* *GETTER=IsYMaxDraw
281  virtual Bool_t IsYMaxDraw() const { return fbYMaxDraw; }
282 
283  virtual void SetCMaxDraw(Bool_t on) { fbCMaxDraw = on; } // *TOGGLE* *GETTER=IsCMaxDraw
284  virtual Bool_t IsCMaxDraw() const { return fbCMaxDraw; }
285 
286  virtual void SetLabelNumFormat(const char *fmt) { fxNumFormat = fmt; }
287  virtual const char *GetLabelNumFormat() const { 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() const { return fiIsChanged; }
297 
298  void SetMultiEdit(Bool_t on) { fbMultiEdit = on; }
299  virtual Bool_t IsMultiEdit() const { return fbMultiEdit; }
300 
301  void SetDimension(Int_t d) { fiDim = d; }
302  Int_t GetDimension() const { return fiDim; }
303 
304  void SetOwnedByEditor(Bool_t on) { fbOwnedByEditor = on; }
305  Bool_t IsOwnedByEditor() const { return fbOwnedByEditor; }
306 
308  virtual void SetCurrentIndex(Int_t) {}
309 
311  virtual Int_t GetCurrentIndex() const { return 0; }
312 
315  virtual Int_t GetNumberOfConditions() const { return 1; }
316 
317  virtual Int_t GetMemorySize() const;
318 
319  virtual Bool_t IsPolygonType() const { return kFALSE; }
320  virtual Bool_t IsArrayType() const { 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;
357  static TString fgxURL_RESET;
359  static TString fgxURL_RESULT;
361  static TString fgxURL_INVERT;
363  static TString fgxURL_VISIBLE;
365  static TString fgxURL_LABEL;
367  static TString fgxURL_LIMITS;
369  static TString fgxURL_INTEGRAL;
371  static TString fgxURL_XMEAN;
373  static TString fgxURL_XRMS;
375  static TString fgxURL_YMEAN;
377  static TString fgxURL_YRMS;
379  static TString fgxURL_XMAX;
381  static TString fgxURL_YMAX;
383  static TString fgxURL_CMAX;
384 
385  static void SetGlobalStyle(Bool_t LABELDRAW, Bool_t LIMITSDRAW, Bool_t INTDRAW,
386  Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW,
387  Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW, const char *NUMFORMAT);
388 
389  static void GetGlobalStyle(Bool_t &LABELDRAW, Bool_t &LIMITSDRAW, Bool_t &INTDRAW,
390  Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW,
391  Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT);
392 
393  protected:
394 
399 
401  TObjArray *fxUrlOptionArray{nullptr};
402 
404  void BuildUrlOptionArray(const char *rest_url_opt);
405 
407  Bool_t UrlOptionHasKey(const char *key);
408 
411  TString GetUrlOptionAsString(const char *key, TString def_value);
412 
415  Int_t GetUrlOptionAsInt(const char *key, Int_t def_value);
416 
419  Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value);
420 
421  void SetPainted(Bool_t on) { fbIsPainted = on; }
422  Bool_t IsPainted() const { return fbIsPainted; }
423 
424  const char *MakeScript(std::ostream &out, const char *varname, Option_t *opt = "", const char *arrextraargs = nullptr);
425 
426  private:
427 
429  Int_t fiDim{0};
430 
431  Bool_t fbMarkReset{kFALSE};
432 
435  Bool_t fbLastResult{kFALSE};
436 
438  Bool_t fbTrue{kTRUE};
439 
441  Bool_t fbFalse{kFALSE};
442 
444  Int_t fiTrueCounts{0};
445 
447  Int_t fiCounts{0};
448 
453  Bool_t fbEnabled{kFALSE};
454 
456  Bool_t fbResult{kFALSE};
457 
460  Bool_t fbMultiEdit{kFALSE};
461 
463  Bool_t fbVisible{kFALSE};
464 
466  Bool_t fbHistogramLink{kFALSE};
467 
469  TString fxHistoName;
470 
472  Double_t fdUpdateEpsilon{0};
473 
475  Bool_t fbLabelDraw{kFALSE};
476 
478  Bool_t fbLimitsDraw{kFALSE};
479 
481  Bool_t fbIntDraw{kFALSE};
482 
484  Bool_t fbXMeanDraw{kFALSE};
485 
487  Bool_t fbXRMSDraw{kFALSE};
488 
490  Bool_t fbYMeanDraw{kFALSE};
491 
493  Bool_t fbYRMSDraw{kFALSE};
494 
496  Bool_t fbXMaxDraw{kFALSE};
497 
499  Bool_t fbYMaxDraw{kFALSE};
500 
502  Bool_t fbCMaxDraw{kFALSE};
503 
505  TString fxNumFormat;
506 
509  TH1 *fxHisto{nullptr};
510 
512  Int_t fiIsChanged{0};
513 
516  Bool_t fbIsPainted{kFALSE};
517 
519  Bool_t fbOwnedByEditor{kFALSE};
520 
522  Bool_t fbStreamedCondition{kFALSE};
523 
524  ClassDefOverride(TGo4Condition,8)
525 };
526 
527 #endif //TGO4CONDITION_H
TString fxNumFormat
static Bool_t fgbXRMSDRAW
virtual Bool_t IsLabelDraw() const
static TString fgxURL_CMAX
virtual Int_t GetCurrentIndex() const
void Print(Option_t *opt="") const override
static Bool_t fgbYMAXDRAW
Bool_t UrlOptionHasKey(const char *key)
static TString fgxURL_XRMS
virtual void SetIntDraw(Bool_t on)
static Bool_t fgbLIMITSDRAW
virtual Bool_t IsYMeanDraw() const
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)
void Draw(Option_t *opt="") override
static TString fgxURL_RESET
virtual void SetYMaxDraw(Bool_t on)
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual void UnDraw(Option_t *opt="")
virtual Double_t GetCurtosis(TH1 *, Int_t=1)
Bool_t fbMarkReset
virtual void SetCMaxDraw(Bool_t on)
virtual Double_t GetYLow() const
virtual void SetValues(TCutG *newcut)
Definition: TGo4Condition.h:96
virtual void SetPainter(TGo4ConditionPainter *painter)
virtual const TGo4Condition * GetActiveCondition() const
virtual Bool_t IsXMeanDraw() const
TString GetUrlOptionAsString(const char *key, TString def_value)
virtual Bool_t IsYRMSDraw() const
static Bool_t fgbCMAXDRAW
virtual Bool_t IsCMaxDraw() const
virtual void PrintCondition(Bool_t full=kTRUE)
static TString fgxURL_YMEAN
virtual void SetYRMSDraw(Bool_t on)
virtual ~TGo4Condition()
virtual Double_t GetYUp() const
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
Bool_t GetLast() const
virtual void SetXMeanDraw(Bool_t on)
static Bool_t fgbXMEANDRAW
TH1 * GetWorkHistogram() const
Bool_t fbYMeanDraw
void SetOwnedByEditor(Bool_t on)
virtual Double_t GetIntegral(TH1 *, Option_t *="")
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=nullptr)
Bool_t fbIsPainted
virtual void ResetCounts()
static TString fgxURL_INTEGRAL
virtual Bool_t IsArrayType() const
virtual Double_t GetSkewness(TH1 *, Int_t=1)
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 IsOwnedByEditor() const
Bool_t fbMultiEdit
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)
virtual Bool_t IsIntDraw() const
Bool_t IsPainted() const
void Pop() override
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 IsPolygonType() const
virtual Bool_t IsXRMSDraw() const
const char * GetLinkedHistogram() const
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
void Paint(Option_t *opt="") override
virtual Bool_t IsYMaxDraw() const
Bool_t IsFalse() const
virtual Int_t GetMemorySize() const
void SetHistogramLink(Bool_t on)
Bool_t fbXMeanDraw
virtual void SetValues(Double_t *x, Double_t *y, Int_t len)
Definition: TGo4Condition.h:97
static Bool_t fgbYMEANDRAW
virtual Int_t GetNumberOfConditions() const
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
virtual void Disable(Bool_t result)
Bool_t IsHistogramLink() const
virtual Double_t GetXLow() const
Double_t GetUpdateEpsilon() const
virtual Double_t GetXUp() const
virtual Bool_t Test(Double_t x)
Definition: TGo4Condition.h:89
void ResetLabel(Option_t *opt="reset")
void Clear(Option_t *opt="") override
virtual void SetXRMSDraw(Bool_t on)
virtual void SetLimitsDraw(Bool_t on)
void SetMultiEdit(Bool_t on)
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 Test()
virtual void MarkReset(Bool_t on)
virtual const char * GetLabelNumFormat() const
virtual void SetChanged(Bool_t on=kTRUE)
TGo4ConditionPainter * fxPainter
virtual Int_t IsChanged() const
virtual Bool_t IsLimitsDraw() const
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 *)
Bool_t IsEnabled() const
Definition: TGo4Condition.h:82
TObjArray * fxUrlOptionArray
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
virtual TCutG * GetCut(Bool_t owner)
virtual Bool_t IsMultiEdit() const
Bool_t FixedResult() const
Int_t GetDimension() const
Int_t GetUrlOptionAsInt(const char *key, Int_t def_value)
virtual Bool_t IsXMaxDraw() const
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 void AddCondition(TGo4Condition *next)
Bool_t fbLimitsDraw
virtual void SetLabelDraw(Bool_t on)
static TString fgxURL_LABEL
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)
Bool_t IsTrue() const
virtual Double_t GetXMax(TH1 *)
Bool_t fbStreamedCondition
virtual Bool_t IsVisible() const
static Bool_t fgbINTDRAW