00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4CONDITION_H
00017 #define TGO4CONDITION_H
00018
00019 #include "TNamed.h"
00020 #include "TAttLine.h"
00021 #include "TAttFill.h"
00022
00023 #define kCOPYCOUNTS true
00024 #define kNOCOPYCOUNTS false
00025 #define kWINDOW 1
00026 #define kPOLYGON 2
00027
00028 class TH1;
00029 class TVirtualPad;
00030 class TCutG;
00031
00032 class TGo4HistogramEntry;
00033 class TGo4EventElement;
00034 class TGo4ConditionPainter;
00035
00036 class TGo4Condition : public TNamed, public TAttLine, public TAttFill {
00037 friend class TGo4CondArray;
00038
00039 public:
00040 TGo4Condition();
00041
00042 TGo4Condition(const char* name, const char* title = "Go4 Condition");
00043
00044 virtual ~TGo4Condition();
00045
00047 virtual void Paint(Option_t* opt="");
00048
00050 virtual void Draw(Option_t* opt="");
00051
00053 virtual void UnDraw(Option_t* opt="");
00054
00056 virtual void Pop();
00057
00059 virtual TGo4ConditionPainter* CreatePainter();
00060
00062 virtual Int_t Counts();
00063
00065 virtual Int_t TrueCounts();
00066
00068 virtual void ResetCounts();
00069
00071 virtual void SetCounts(Int_t truecounts, Int_t counts);
00072
00075 virtual void Disable(Bool_t result);
00076
00078 virtual void Enable();
00079
00081 Bool_t IsEnabled() const { return fbEnabled; }
00082
00086 virtual Bool_t Test();
00087 virtual Bool_t Test(Double_t x, Double_t y) { return true; }
00088 virtual Bool_t Test(Double_t x) { return true; }
00089 virtual Bool_t Test(Bool_t result) { return true; }
00090
00092 virtual void SetValues() {}
00093 virtual void SetValues(Double_t low1, Double_t up1) {}
00094 virtual void SetValues(Double_t low1, Double_t up1, Double_t low2, Double_t up2) {}
00095 virtual void SetValues(TCutG * newcut) {}
00096 virtual void SetValues(Double_t * x, Double_t * y, Int_t len) {}
00097
00109 virtual void AddCondition(TGo4Condition* next);
00110
00113 void IncCounts();
00114
00117 void IncTrueCounts();
00118
00121 Bool_t IsTrue() const { return fbTrue; }
00122
00125 Bool_t IsFalse() const { return fbFalse; }
00126
00128 Bool_t FixedResult() const { return fbResult; }
00129
00132 virtual void Invert(Bool_t on);
00133
00135 virtual void PrintCondition(Bool_t full=kTRUE);
00136
00138 virtual void PrintBar();
00139
00141 virtual void Print(Option_t* opt="") const;
00142
00145 void SetLast(Bool_t value) { fbLastResult=value; }
00146
00148 Bool_t GetLast() { return fbLastResult; }
00149
00151 virtual Bool_t UpdateFrom(TGo4Condition * cond, Bool_t counts);
00152 virtual void GetValues(Int_t & dim, Double_t & x1, Double_t & y1, Double_t & x2, Double_t & y2);
00153 virtual Double_t GetXLow();
00154 virtual Double_t GetXUp();
00155 virtual Double_t GetYLow();
00156 virtual Double_t GetYUp();
00157 virtual TCutG* GetCut(Bool_t owner);
00158
00161 virtual Double_t GetIntegral(TH1* histo, Option_t* opt="");
00162
00164 virtual Double_t GetMean(TH1* histo, Int_t axis=1);
00165
00167 virtual Double_t GetRMS(TH1* histo, Int_t axis=1);
00168
00170 virtual Double_t GetXMax(TH1* histo);
00171
00173 virtual Double_t GetYMax(TH1* histo);
00174
00176 virtual Double_t GetCMax(TH1* histo);
00177
00179 virtual TGo4Condition* GetActiveCondition();
00180
00182 virtual void MarkReset(Bool_t on);
00183
00184 virtual void Clear(Option_t* opt="");
00185
00188 virtual void SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset,
00189 Bool_t result, Bool_t truevalue, Bool_t falsevalue);
00190
00193 virtual void GetFlags(Bool_t* enabled, Bool_t* lastresult, Bool_t* markreset,
00194 Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue);
00195
00197 virtual void SetVisible(Bool_t on);
00198
00200 virtual Bool_t IsVisible();
00201
00203 void SetHistogramLink(Bool_t on);
00204
00206 Bool_t IsHistogramLink();
00207
00209 void SetHistogram(const char* name);
00210
00212 const char* GetLinkedHistogram();
00213
00216 void SetWorkHistogram(TH1* histo);
00217
00219 TH1* GetWorkHistogram(){return fxHisto;}
00220
00224 virtual void SetPainter(TGo4ConditionPainter* painter);
00225
00228 void SetUpdateEpsilon(Double_t val){fdUpdateEpsilon=val;}
00229
00230 Double_t GetUpdateEpsilon(){return fdUpdateEpsilon;}
00231
00233 static const Double_t fgdUPDATEEPSILON;
00234
00236 void SaveLabelStyle();
00237
00239 void InitLabelStyle();
00240
00243 void ResetLabel(Option_t* opt="reset");
00244
00245 virtual void SetLabelDraw(Bool_t on);
00246 virtual Bool_t IsLabelDraw();
00247
00248 virtual void SetLimitsDraw(Bool_t on);
00249 virtual Bool_t IsLimitsDraw();
00250
00251 virtual void SetIntDraw(Bool_t on);
00252 virtual Bool_t IsIntDraw();
00253
00254 virtual void SetXMeanDraw(Bool_t on);
00255 virtual Bool_t IsXMeanDraw();
00256
00257 virtual void SetXRMSDraw(Bool_t on);
00258 virtual Bool_t IsXRMSDraw();
00259
00260 virtual void SetYMeanDraw(Bool_t on);
00261 virtual Bool_t IsYMeanDraw();
00262
00263 virtual void SetYRMSDraw(Bool_t on);
00264 virtual Bool_t IsYRMSDraw();
00265
00266 virtual void SetXMaxDraw(Bool_t on);
00267 virtual Bool_t IsXMaxDraw();
00268
00269 virtual void SetYMaxDraw(Bool_t on);
00270 virtual Bool_t IsYMaxDraw();
00271 virtual void SetCMaxDraw(Bool_t on);
00272 virtual Bool_t IsCMaxDraw();
00273
00274 virtual void SetChanged(Bool_t on) { if (on) fiIsChanged++; else fiIsChanged = 0; }
00275 virtual Int_t IsChanged() { return fiIsChanged; }
00276
00277 void SetMultiEdit(Bool_t on){fbMultiEdit=on;}
00278 virtual Bool_t IsMultiEdit(){return fbMultiEdit;}
00279
00280 void SetDimension(Int_t d) { fiDim=d; }
00281 Int_t GetDimension() { return fiDim; }
00282
00283 void SetOwnedByEditor(Bool_t on){fbOwnedByEditor=on;}
00284 Bool_t IsOwnedByEditor(){return fbOwnedByEditor;}
00285
00287 virtual void SetCurrentIndex(Int_t ix);
00288
00290 virtual Int_t GetCurrentIndex();
00291
00294 virtual Int_t GetNumberOfConditions();
00295
00296 virtual Int_t GetMemorySize();
00297
00298 virtual Bool_t IsPolygonType();
00299 virtual Bool_t IsArrayType();
00300
00301 void DeletePainter();
00302
00304 static Bool_t fgbLABELDRAW;
00305
00307 static Bool_t fgbLIMITSDRAW;
00308
00310 static Bool_t fgbINTDRAW;
00311
00313 static Bool_t fgbXMEANDRAW;
00314
00316 static Bool_t fgbXRMSDRAW;
00317
00319 static Bool_t fgbYMEANDRAW;
00320
00322 static Bool_t fgbYRMSDRAW;
00323
00325 static Bool_t fgbXMAXDRAW;
00326
00328 static Bool_t fgbYMAXDRAW;
00329
00331 static Bool_t fgbCMAXDRAW;
00332
00333 protected:
00334
00338 TGo4ConditionPainter* fxPainter;
00339
00343 TH1* fxCutHis;
00344
00345 void SetPainted(Bool_t on) { fbIsPainted=on; }
00346 Bool_t IsPainted() const { return fbIsPainted; }
00347
00348 private:
00349
00351 Int_t fiDim;
00352
00353 Bool_t fbMarkReset;
00354
00357 Bool_t fbLastResult;
00358
00360 Bool_t fbTrue;
00361
00363 Bool_t fbFalse;
00364
00366 Int_t fiTrueCounts;
00367
00369 Int_t fiCounts;
00370
00375 Bool_t fbEnabled;
00376
00378 Bool_t fbResult;
00379
00382 Bool_t fbMultiEdit;
00383
00385 Bool_t fbVisible;
00386
00388 Bool_t fbHistogramLink;
00389
00391 TString fxHistoName;
00392
00394 Double_t fdUpdateEpsilon;
00395
00397 Bool_t fbLabelDraw;
00398
00400 Bool_t fbLimitsDraw;
00401
00403 Bool_t fbIntDraw;
00404
00406 Bool_t fbXMeanDraw;
00407
00409 Bool_t fbXRMSDraw;
00410
00412 Bool_t fbYMeanDraw;
00413
00415 Bool_t fbYRMSDraw;
00416
00418 Bool_t fbXMaxDraw;
00419
00421 Bool_t fbYMaxDraw;
00422
00424 Bool_t fbCMaxDraw;
00425
00428 TH1* fxHisto;
00429
00431 Int_t fiIsChanged;
00432
00435 Bool_t fbIsPainted;
00436
00438 Bool_t fbOwnedByEditor;
00439
00441 Bool_t fbStreamedCondition;
00442
00443 ClassDef(TGo4Condition,6)
00444 };
00445
00446 #endif //TGO4CONDITION_H
00447
00448