16 #include "Riostream.h"
45 GO4TRACE((15,
"TGo4WinCond::TGo4WinCond()",__LINE__, __FILE__));
59 GO4TRACE((15,
"TGo4WinCond::TGo4WinCond(name,title)",__LINE__, __FILE__));
65 GO4TRACE((15,
"TGo4WinCond::~TGo4WinCond()",__LINE__, __FILE__));
132 std::cout << line << std::endl;
139 if(histo==0)
return 0;
142 result=histo->Integral(opt);
149 if(histo==0)
return 0;
152 result=histo->GetMean(axis);
159 if(histo==0)
return 0;
162 result=histo->GetRMS(axis);
169 if(histo==0)
return 0;
172 result=histo->GetSkewness(axis);
179 if(histo==0)
return 0;
182 result=histo->GetKurtosis(axis);
189 if(histo==0)
return 0;
192 TAxis* xax=histo->GetXaxis();
193 Int_t maxbin=histo->GetMaximumBin();
194 if(histo->GetDimension()==1)
196 result=xax->GetBinCenter(maxbin);
199 else if (histo->GetDimension()==2)
201 Int_t xmaxbin=maxbin%(histo->GetNbinsX()+2);
202 result=xax->GetBinCenter(xmaxbin);
213 if(histo==0)
return 0;
216 if(histo->GetDimension()==1)
218 result=histo->GetMaximum();
220 else if (histo->GetDimension()==2)
222 TAxis* yax=histo->GetYaxis();
223 Int_t maxbin=histo->GetMaximumBin();
224 Int_t maxybin=maxbin/(histo->GetNbinsX()+2);
225 result=yax->GetBinCenter(maxybin);
237 if(histo==0)
return 0;
240 result=histo->GetMaximum();
252 TAxis* xax=histo->GetXaxis();
255 Int_t xminbin=xax->FindBin(xmin);
256 Int_t xmaxbin=xax->FindBin(xmax);
259 TAxis* yax=histo->GetYaxis();
260 if(yax && histo->GetDimension()>1)
264 yminbin=yax->FindBin(ymin);
265 ymaxbin=yax->FindBin(ymax);
268 xax->SetRange(xminbin,xmaxbin);
269 if(yax&& histo->GetDimension()>1)
270 yax->SetRange(yminbin,ymaxbin);
276 TAxis* xax=histo->GetXaxis();
277 TAxis* yax=histo->GetYaxis();
279 if(yax&& histo->GetDimension()>1)
291 if(!cond->InheritsFrom(TGo4WinCond::Class())) {
292 std::cout <<
"Cannot update " << GetName() <<
" from " << cond->ClassName() << std::endl;
306 message.Form(
"TGo4WinCond::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
314 message.Form(
"Set Window condition %s:", GetName());
320 message.Append(TString::Format(
", set limits to (%f, %f)", xmin, xmax));
324 message.Append(TString::Format(
", set limits to (%f, %f) (%f, %f)", xmin, xmax, ymin, ymax));
327 message.Append(TString::Format(
" !wrong condition dimension %d, NEVER COME HERE", dim));
334 std::cout <<
"DEBUG- no limits to change received" << std::endl;
346 if(painter==0)
return;
347 if(painter->InheritsFrom(TGo4WinCondPainter::Class()))
355 TGo4Log::Warn(
"Could not set painter of class %s for TGo4WinCond %s",
356 painter->ClassName(),GetName());
369 Int_t size =
sizeof(*this);
370 if (GetName()!=0) size+=strlen(GetName());
371 if (GetTitle()!=0) size+=strlen(GetTitle());
379 TString varname =
MakeScript(out, Form(
"wincond%d", cnt++), opt);
382 Double_t xl,xu,yl,yu;
385 if(dim==1) out << Form(
" %s->SetValues(%f, %f);", varname.Data(), xl, xu) << std::endl;
386 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
virtual Bool_t IsPolygonType()
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)