41 GO4TRACE((15,
"TGo4WinCond::TGo4WinCond()",__LINE__, __FILE__));
55 GO4TRACE((15,
"TGo4WinCond::TGo4WinCond(name,title)",__LINE__, __FILE__));
61 GO4TRACE((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;
144 if(histo==0)
return 0;
147 result=histo->Integral(opt);
155 if(histo==0)
return 0;
158 result=histo->GetMean(axis);
166 if(histo==0)
return 0;
169 result=histo->GetRMS(axis);
177 if(histo==0)
return 0;
180 result=histo->GetSkewness(axis);
188 if(histo==0)
return 0;
191 result=histo->GetKurtosis(axis);
199 if(histo==0)
return 0;
202 TAxis* xax=histo->GetXaxis();
203 Int_t maxbin=histo->GetMaximumBin();
204 if(histo->GetDimension()==1)
206 result=xax->GetBinCenter(maxbin);
209 else if (histo->GetDimension()==2)
211 Int_t xmaxbin=maxbin%(histo->GetNbinsX()+2);
212 result=xax->GetBinCenter(xmaxbin);
225 if(histo==0)
return 0;
228 if(histo->GetDimension()==1)
230 result=histo->GetMaximum();
232 else if (histo->GetDimension()==2)
234 TAxis* yax=histo->GetYaxis();
235 Int_t maxbin=histo->GetMaximumBin();
236 Int_t maxybin=maxbin/(histo->GetNbinsX()+2);
237 result=yax->GetBinCenter(maxybin);
250 if(histo==0)
return 0;
253 result=histo->GetMaximum();
266 TAxis* xax=histo->GetXaxis();
269 Int_t xminbin=xax->FindBin(xmin);
270 Int_t xmaxbin=xax->FindBin(xmax);
273 TAxis* yax=histo->GetYaxis();
274 if(yax && histo->GetDimension()>1)
278 yminbin=yax->FindBin(ymin);
279 ymaxbin=yax->FindBin(ymax);
282 xax->SetRange(xminbin,xmaxbin);
283 if(yax&& histo->GetDimension()>1)
284 yax->SetRange(yminbin,ymaxbin);
291 TAxis* xax=histo->GetXaxis();
292 TAxis* yax=histo->GetYaxis();
294 if(yax&& histo->GetDimension()>1)
302 if(!cond->InheritsFrom(TGo4WinCond::Class())) {
303 std::cout <<
"Cannot update " << GetName() <<
" from " << cond->ClassName() << std::endl;
319 message.Form(
"TGo4WinCond::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
327 message.Form(
"Set Window condition %s:", GetName());
333 message.Append(TString::Format(
", set limits to (%f, %f)", xmin, xmax));
337 message.Append(TString::Format(
", set limits to (%f, %f) (%f, %f)", xmin, xmax, ymin, ymax));
340 message.Append(TString::Format(
" !wrong condition dimension %d, NEVER COME HERE", dim));
347 std::cout <<
"DEBUG- no limits to change received" << std::endl;
359 if(painter==0)
return;
360 if(painter->InheritsFrom(TGo4WinCondPainter::Class()))
368 TGo4Log::Warn(
"Could not set painter of class %s for TGo4WinCond %s",
369 painter->ClassName(),GetName());
382 Int_t size =
sizeof(*this);
383 if (GetName()!=0) size+=strlen(GetName());
384 if (GetTitle()!=0) size+=strlen(GetTitle());
392 TString varname =
MakeScript(out, Form(
"wincond%d", cnt++), opt);
395 Double_t xl,xu,yl,yu;
398 if(dim==1) out << Form(
" %s->SetValues(%f, %f);", varname.Data(), xl, xu) << std::endl;
399 else out << Form(
" %s->SetValues(%f, %f, %f, %f);", varname.Data(), xl, xu, yl, yu) << std::endl;
static TString fgxURL_YLOW
virtual Double_t GetYLow()
Bool_t UrlOptionHasKey(const char *key)
virtual Double_t GetIntegral(TH1 *histo, Option_t *opt="")
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual void SavePrimitive(std::ostream &fs, Option_t *="")
virtual void PrintCondition(Bool_t full=kTRUE)
virtual Double_t GetYMax(TH1 *histo)
virtual Double_t GetSkewness(TH1 *histo, Int_t axis=1)
virtual Double_t GetCMax(TH1 *histo)
virtual void PrintCondition(Bool_t full=kTRUE)
virtual Double_t GetCurtosis(TH1 *histo, Int_t axis=1)
static void Warn(const char *text,...)
virtual Double_t GetXUp()
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
virtual TGo4ConditionPainter * CreatePainter()
static TString fgxURL_XUP
Bool_t FixedResult() const
void SetHistogramRanges(TH1 *histo)
virtual Double_t GetMean(TH1 *histo, Int_t axis=1)
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
static TString fgxURL_XLOW
virtual void SetPainter(TGo4ConditionPainter *painter)
static TString fgxURL_YUP
virtual Int_t GetMemorySize()
static const char * Message(Int_t prio, const char *text,...)
virtual Double_t GetXLow()
virtual Double_t GetYUp()
virtual void SetCondition(TGo4Condition *con)
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=0)
TGo4ConditionPainter * fxPainter
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
virtual Double_t GetXMax(TH1 *histo)
void RestoreHistogramRanges(TH1 *histo)
Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual Double_t GetRMS(TH1 *histo, Int_t axis=1)
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value)
void SetDimension(Int_t d)