Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4CONDITION_H
00015 #define TGO4CONDITION_H
00016
00017 #include "TNamed.h"
00018 #include "TAttLine.h"
00019 #include "TAttFill.h"
00020 #include "Riostream.h"
00021
00022 class TH1;
00023 class TVirtualPad;
00024 class TCutG;
00025
00026 class TGo4HistogramEntry;
00027 class TGo4EventElement;
00028 class TGo4ConditionPainter;
00029
00030
00031 enum ConditionsKind {
00032 kGO4CONDWINDOW = 1,
00033 kGO4CONDPOLYGON = 2
00034 };
00035
00036 class
00037
00038 #ifndef __CINT__
00039 #ifdef WIN32
00040 #ifndef BUILDING_GO4BASE_DLL
00041 __declspec(dllimport)
00042 #endif
00043 #endif
00044 #endif
00045
00046
00047 TGo4Condition : public TNamed, public TAttLine, public TAttFill {
00048
00049 friend class TGo4CondArray;
00050
00051 public:
00052 TGo4Condition();
00053
00054 TGo4Condition(const char* name, const char* title = "Go4 Condition");
00055
00056 virtual ~TGo4Condition();
00057
00059 virtual void Paint(Option_t* opt="");
00060
00062 virtual void Draw(Option_t* opt="");
00063
00065 virtual void UnDraw(Option_t* opt="");
00066
00068 virtual void Pop();
00069
00071 virtual TGo4ConditionPainter* CreatePainter();
00072
00074 virtual Int_t Counts();
00075
00077 virtual Int_t TrueCounts();
00078
00080 virtual void ResetCounts();
00081
00083 virtual void SetCounts(Int_t truecounts, Int_t counts);
00084
00087 virtual void Disable(Bool_t result);
00088
00090 virtual void Enable();
00091
00093 Bool_t IsEnabled() const { return fbEnabled; }
00094
00098 virtual Bool_t Test();
00099 virtual Bool_t Test(Double_t x, Double_t y) { return true; }
00100 virtual Bool_t Test(Double_t x) { return true; }
00101 virtual Bool_t Test(Bool_t result) { return true; }
00102
00104 virtual void SetValues() {}
00105 virtual void SetValues(Double_t low1, Double_t up1) {}
00106 virtual void SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2) {}
00107 virtual void SetValues(TCutG * newcut) {}
00108 virtual void SetValues(Double_t * x, Double_t * y, Int_t len) {}
00109
00121 virtual void AddCondition(TGo4Condition* next);
00122
00125 void IncCounts();
00126
00129 void IncTrueCounts();
00130
00133 Bool_t IsTrue() const { return fbTrue; }
00134
00137 Bool_t IsFalse() const { return fbFalse; }
00138
00140 Bool_t FixedResult() const { return fbResult; }
00141
00144 virtual void Invert(Bool_t on);
00145
00147 virtual void PrintCondition(Bool_t full=kTRUE);
00148
00150 virtual void PrintBar();
00151
00153 virtual void Print(Option_t* opt="") const;
00154
00157 void SetLast(Bool_t value) { fbLastResult=value; }
00158
00160 Bool_t GetLast() { return fbLastResult; }
00161
00163 virtual Bool_t UpdateFrom(TGo4Condition * cond, Bool_t counts);
00164 virtual void GetValues(Int_t & dim, Double_t & x1, Double_t & y1, Double_t & x2, Double_t & y2);
00165 virtual Double_t GetXLow();
00166 virtual Double_t GetXUp();
00167 virtual Double_t GetYLow();
00168 virtual Double_t GetYUp();
00169 virtual TCutG* GetCut(Bool_t owner);
00170
00173 virtual Double_t GetIntegral(TH1* histo, Option_t* opt="");
00174
00176 virtual Double_t GetMean(TH1* histo, Int_t axis=1);
00177
00179 virtual Double_t GetRMS(TH1* histo, Int_t axis=1);
00180
00182 virtual Double_t GetXMax(TH1* histo);
00183
00185 virtual Double_t GetYMax(TH1* histo);
00186
00188 virtual Double_t GetCMax(TH1* histo);
00189
00191 virtual TGo4Condition* GetActiveCondition();
00192
00194 virtual void MarkReset(Bool_t on);
00195
00196 virtual void Clear(Option_t* opt="");
00197
00200 virtual void SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset,
00201 Bool_t result, Bool_t truevalue, Bool_t falsevalue);
00202
00205 virtual void GetFlags(Bool_t* enabled, Bool_t* lastresult, Bool_t* markreset,
00206 Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue);
00207
00209 virtual void SetVisible(Bool_t on);
00210
00212 virtual Bool_t IsVisible();
00213
00215 void SetHistogramLink(Bool_t on);
00216
00218 Bool_t IsHistogramLink();
00219
00221 void SetHistogram(const char* name);
00222
00224 const char* GetLinkedHistogram();
00225
00228 void SetWorkHistogram(TH1* histo);
00229
00231 TH1* GetWorkHistogram(){return fxHisto;}
00232
00236 virtual void SetPainter(TGo4ConditionPainter* painter);
00237
00240 void SetUpdateEpsilon(Double_t val){fdUpdateEpsilon=val;}
00241
00242 Double_t GetUpdateEpsilon(){return fdUpdateEpsilon;}
00243
00245 static const Double_t fgdUPDATEEPSILON;
00246
00248 void SaveLabelStyle();
00249
00251 void InitLabelStyle();
00252
00255 void ResetLabel(Option_t* opt="reset");
00256
00257 virtual void SetLabelDraw(Bool_t on);
00258 virtual Bool_t IsLabelDraw();
00259
00260 virtual void SetLimitsDraw(Bool_t on);
00261 virtual Bool_t IsLimitsDraw();
00262
00263 virtual void SetIntDraw(Bool_t on);
00264 virtual Bool_t IsIntDraw();
00265
00266 virtual void SetXMeanDraw(Bool_t on);
00267 virtual Bool_t IsXMeanDraw();
00268
00269 virtual void SetXRMSDraw(Bool_t on);
00270 virtual Bool_t IsXRMSDraw();
00271
00272 virtual void SetYMeanDraw(Bool_t on);
00273 virtual Bool_t IsYMeanDraw();
00274
00275 virtual void SetYRMSDraw(Bool_t on);
00276 virtual Bool_t IsYRMSDraw();
00277
00278 virtual void SetXMaxDraw(Bool_t on);
00279 virtual Bool_t IsXMaxDraw();
00280
00281 virtual void SetYMaxDraw(Bool_t on);
00282 virtual Bool_t IsYMaxDraw();
00283 virtual void SetCMaxDraw(Bool_t on);
00284 virtual Bool_t IsCMaxDraw();
00285
00286 virtual const char* GetLabelNumFormat();
00287 virtual void SetLabelNumFormat(const char* fmt);
00288
00289
00290 virtual void SetChanged(Bool_t on) { if (on) fiIsChanged++; else fiIsChanged = 0; }
00291 virtual Int_t IsChanged() { return fiIsChanged; }
00292
00293 void SetMultiEdit(Bool_t on){fbMultiEdit=on;}
00294 virtual Bool_t IsMultiEdit(){return fbMultiEdit;}
00295
00296 void SetDimension(Int_t d) { fiDim=d; }
00297 Int_t GetDimension() { return fiDim; }
00298
00299 void SetOwnedByEditor(Bool_t on){fbOwnedByEditor=on;}
00300 Bool_t IsOwnedByEditor(){return fbOwnedByEditor;}
00301
00303 virtual void SetCurrentIndex(Int_t ix);
00304
00306 virtual Int_t GetCurrentIndex();
00307
00310 virtual Int_t GetNumberOfConditions();
00311
00312 virtual Int_t GetMemorySize();
00313
00314 virtual Bool_t IsPolygonType();
00315 virtual Bool_t IsArrayType();
00316
00317 void DeletePainter();
00318
00320 static Bool_t fgbLABELDRAW;
00321
00323 static Bool_t fgbLIMITSDRAW;
00324
00326 static Bool_t fgbINTDRAW;
00327
00329 static Bool_t fgbXMEANDRAW;
00330
00332 static Bool_t fgbXRMSDRAW;
00333
00335 static Bool_t fgbYMEANDRAW;
00336
00338 static Bool_t fgbYRMSDRAW;
00339
00341 static Bool_t fgbXMAXDRAW;
00342
00344 static Bool_t fgbYMAXDRAW;
00345
00347 static Bool_t fgbCMAXDRAW;
00348
00350 static TString fgxNUMFORMAT;
00351
00352 protected:
00353
00357 TGo4ConditionPainter* fxPainter;
00358
00362 TH1* fxCutHis;
00363
00364 void SetPainted(Bool_t on) { fbIsPainted=on; }
00365 Bool_t IsPainted() const { return fbIsPainted; }
00366
00367 const char* MakeScript(std::ostream& out, const char* varname, Option_t* opt = "", const char* arrextraargs = 0);
00368
00369 private:
00370
00372 Int_t fiDim;
00373
00374 Bool_t fbMarkReset;
00375
00378 Bool_t fbLastResult;
00379
00381 Bool_t fbTrue;
00382
00384 Bool_t fbFalse;
00385
00387 Int_t fiTrueCounts;
00388
00390 Int_t fiCounts;
00391
00396 Bool_t fbEnabled;
00397
00399 Bool_t fbResult;
00400
00403 Bool_t fbMultiEdit;
00404
00406 Bool_t fbVisible;
00407
00409 Bool_t fbHistogramLink;
00410
00412 TString fxHistoName;
00413
00415 Double_t fdUpdateEpsilon;
00416
00418 Bool_t fbLabelDraw;
00419
00421 Bool_t fbLimitsDraw;
00422
00424 Bool_t fbIntDraw;
00425
00427 Bool_t fbXMeanDraw;
00428
00430 Bool_t fbXRMSDraw;
00431
00433 Bool_t fbYMeanDraw;
00434
00436 Bool_t fbYRMSDraw;
00437
00439 Bool_t fbXMaxDraw;
00440
00442 Bool_t fbYMaxDraw;
00443
00445 Bool_t fbCMaxDraw;
00446
00448 TString fxNumFormat;
00449
00452 TH1* fxHisto;
00453
00455 Int_t fiIsChanged;
00456
00459 Bool_t fbIsPainted;
00460
00462 Bool_t fbOwnedByEditor;
00463
00465 Bool_t fbStreamedCondition;
00466
00467 ClassDef(TGo4Condition,7)
00468 };
00469
00470 #endif //TGO4CONDITION_H