41 GO4TRACE((15,
"TGo4WinCond::TGo4WinCond()",__LINE__, __FILE__));
55GO4TRACE((15,
"TGo4WinCond::TGo4WinCond(name,title)",__LINE__, __FILE__));
61GO4TRACE((15,
"TGo4WinCond::~TGo4WinCond()",__LINE__, __FILE__));
135 std::cout << TString::Format(
"[%8.2f,%8.2f]",
fLow1,
fUp1) << std::endl;
137 std::cout << TString::Format(
"[%8.2f,%8.2f][%8.2f,%8.2f]",
fLow1,
fUp1,
fLow2,
fUp2) << std::endl;
146 Double_t result = histo->Integral(opt);
156 Double_t result = histo->GetMean(axis);
166 Double_t result = histo->GetRMS(axis);
176 Double_t result = histo->GetSkewness(axis);
186 Double_t result = histo->GetKurtosis(axis);
195 Double_t result = 0.;
197 TAxis *xax = histo->GetXaxis();
198 Int_t maxbin = histo->GetMaximumBin();
199 if (histo->GetDimension() == 1) {
200 result = xax->GetBinCenter(maxbin);
201 }
else if (histo->GetDimension() == 2) {
202 Int_t xmaxbin = maxbin % (histo->GetNbinsX() + 2);
203 result = xax->GetBinCenter(xmaxbin);
217 if (histo->GetDimension() == 1) {
218 result = histo->GetMaximum();
219 }
else if (histo->GetDimension() == 2) {
220 TAxis *yax = histo->GetYaxis();
221 Int_t maxbin = histo->GetMaximumBin();
222 Int_t maxybin = maxbin / (histo->GetNbinsX() + 2);
223 result = yax->GetBinCenter(maxybin);
236 Double_t result = histo->GetMaximum();
245 Double_t xmin =
fLow1;
246 Double_t xmax =
fUp1;
247 Double_t ymin =
fLow2;
248 Double_t ymax =
fUp2;
249 TAxis *xax = histo->GetXaxis();
252 Int_t xminbin = xax->FindBin(xmin);
253 Int_t xmaxbin = xax->FindBin(xmax);
256 TAxis *yax = histo->GetYaxis();
257 if (yax && histo->GetDimension() > 1) {
260 yminbin = yax->FindBin(ymin);
261 ymaxbin = yax->FindBin(ymax);
264 xax->SetRange(xminbin, xmaxbin);
265 if (yax && histo->GetDimension() > 1)
266 yax->SetRange(yminbin, ymaxbin);
273 TAxis *xax=histo->GetXaxis();
274 TAxis *yax=histo->GetYaxis();
276 if(yax&& histo->GetDimension()>1)
284 if(!cond->InheritsFrom(TGo4WinCond::Class())) {
285 std::cout <<
"Cannot update " << GetName() <<
" from " << cond->ClassName() << std::endl;
300 TGo4Log::Message(1,
"TGo4WinCond::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
307 message.Form(
"Set Window condition %s:", GetName());
312 message.Append(TString::Format(
", set limits to (%f, %f)", xmin, xmax));
316 message.Append(TString::Format(
", set limits to (%f, %f) (%f, %f)", xmin, xmax, ymin, ymax));
319 message.Append(TString::Format(
" !wrong condition dimension %d, NEVER COME HERE", dim));
323 std::cout <<
"DEBUG- no limits to change received" << std::endl;
325 if (message.Length() > 0)
335 if(painter->InheritsFrom(TGo4WinCondPainter::Class())) {
340 TGo4Log::Warn(
"Could not set painter of class %s for TGo4WinCond %s",
341 painter->ClassName(),GetName());
348 painter->SetCondition(
this);
354 Int_t size =
sizeof(*this);
355 if (GetName()) size += strlen(GetName());
356 if (GetTitle()) size += strlen(GetTitle());
364 TString varname =
MakeScript(out, TString::Format(
"wincond%d", cnt++), opt);
367 Double_t xl,xu,yl,yu;
370 if(dim==1) out << TString::Format(
" %s->SetValues(%f, %f);", varname.Data(), xl, xu) << std::endl;
371 else out << TString::Format(
" %s->SetValues(%f, %f, %f, %f);", varname.Data(), xl, xu, yl, yu) << std::endl;
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
Copy values from cond to this.
Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value)
Scan list of url options for key.
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
Method used by HTTP server to update some fields, specified in URL syntax.
Int_t GetDimension() const
void IncCounts()
Increment the test counter.
TGo4ConditionPainter * fxPainter
Painter instance to display the condition in root pad.
Bool_t FixedResult() const
Returns the value set by Disable(value).
void SetDimension(Int_t d)
void IncTrueCounts()
Increment the "test was true" counter.
Bool_t IsTrue() const
Use this as return, if test was true.
Bool_t UrlOptionHasKey(const char *key)
returns true if key is present in list of url options.
virtual void PrintCondition(Bool_t full=kTRUE)
Prints counters and boolean members.
Bool_t IsFalse() const
Use this as return, if test was false.
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=nullptr)
Bool_t IsEnabled() const
Returns true if condition is enabled.
static void Warn(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 2.
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
Display a message.
void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2) override
Returns limits.
Double_t GetMean(TH1 *histo, Int_t axis=1) override
Calculate value for histogram inside condition limits.
void SetPainter(TGo4ConditionPainter *painter) override
Replace default painter of this condition by external one.
static TString fgxURL_YUP
web condition editor keyword used in UpdateFromUrl.
Double_t GetXLow() const override
Int_t GetMemorySize() const override
Int_t fiSaveYMax
Saved maximum y-axis bin number for active histogram range.
Double_t fLow2
inclusive lower limit
static TString fgxURL_XUP
web condition editor keyword used in UpdateFromUrl.
Int_t fiSaveYMin
Saved minimum y-axis bin number for active histogram range.
Double_t GetYLow() const override
Double_t GetSkewness(TH1 *histo, Int_t axis=1) override
Calculate value for histogram inside condition limits.
virtual void SetValues()
Set values needed, i.e.
Double_t fUp1
exclusive upper limit
static TString fgxURL_XLOW
web condition editor keyword used in UpdateFromUrl.
Int_t fiSaveXMin
Saved minimum x-axis bin number for active histogram range.
Bool_t UpdateFromUrl(const char *rest_url_opt) override
Method used by HTTP server to update some fields, specified in URL syntax.
Double_t fUp2
exclusive upper limit
Double_t GetIntegral(TH1 *histo, Option_t *opt="") override
Calculate value for histogram inside condition limits.
void SetHistogramRanges(TH1 *histo)
Remember ranges of current histo and set range to active window.
virtual Bool_t Test()
Test if condition is true.
Int_t fiSaveXMax
Saved maximum x-axis bin number for active histogram range.
static TString fgxURL_YLOW
web condition editor keyword used in UpdateFromUrl.
Double_t GetXMax(TH1 *histo) override
Calculate value for histogram inside condition limits.
Double_t GetXUp() const override
Double_t GetCMax(TH1 *histo) override
Calculate value for histogram inside condition limits.
Double_t fLow1
inclusive lower limit
void SavePrimitive(std::ostream &fs, Option_t *opt="") override
Standard way to store parameter in form of macro.
void PrintCondition(Bool_t full=kTRUE) override
Printout.
Double_t GetYMax(TH1 *histo) override
Calculate value for histogram inside condition limits.
void RestoreHistogramRanges(TH1 *histo)
Restore original ranges of current histo.
Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts) override
Copy values from cond to this.
Double_t GetCurtosis(TH1 *histo, Int_t axis=1) override
Calculate value for histogram inside condition limits.
Double_t GetRMS(TH1 *histo, Int_t axis=1) override
Calculate value for histogram inside condition limits.
Double_t GetYUp() const override
TGo4ConditionPainter * CreatePainter() override
Factory method to generate the subclass implementation for painter.