18 #include "TObjArray.h" 19 #include "TObjString.h" 20 #include "TVirtualPad.h" 65 GO4TRACE((15,
"TGo4Condition::TGo4Condition()",__LINE__, __FILE__));
91 GO4TRACE((15,
"TGo4Condition::TGo4Condition(const char *)",__LINE__, __FILE__));
113 GO4TRACE((15,
"TGo4Condition::~TGo4Condition()",__LINE__, __FILE__));
137 GO4TRACE((14,
"TGo4Condition::AddCondition(TGo4Condition *)",__LINE__, __FILE__));
142 GO4TRACE((12,
"TGo4Condition::IncTrueCounts()",__LINE__, __FILE__));
148 GO4TRACE((12,
"TGo4Condition::IncCounts()",__LINE__, __FILE__));
154 GO4TRACE((12,
"TGo4Condition::Counts()",__LINE__, __FILE__));
160 GO4TRACE((12,
"TGo4Condition::TrueCounts()",__LINE__, __FILE__));
166 GO4TRACE((12,
"TGo4Condition::ResetCounts()",__LINE__, __FILE__));
173 GO4TRACE((12,
"TGo4Condition::SetCounts()",__LINE__, __FILE__));
182 GO4TRACE((12,
"TGo4Condition::Invert",__LINE__, __FILE__));
190 std::cout <<
"Name:" << GetName() <<
" type:" << ClassName() <<
" title:" << GetTitle() << std::endl;
192 std::cout <<
"Connected to histogram " <<
fxHistoName << std::endl;
198 line =
"Is Checked ";
200 line =
"Always True ";
202 line =
"Always False ";
203 line.Append(
fbTrue ?
"normal " :
"inverse ");
204 line.Append(TString::Format(
", tested: %8d true: %8d is %3.0f%s",
fiCounts,
fiTrueCounts, perc,
"%"));
205 std::cout << line << std::endl;
218 strncpy(num,
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
sizeof(num));
219 char *pc = num + (Int_t)perc/2;
221 std::cout << TString::Format(
"%-24s %8d %3.0f%s |%-50s|",GetName(),
fiCounts,perc,
"%",num) << std::endl;
228 TString option = opt;
230 if (option.IsNull() || option ==
"*") {
235 TString textbuffer =
"\nCondition ";
236 textbuffer.Append(GetName());
238 textbuffer.Append(
" (Polygon type, 2-dim)");
241 if (InheritsFrom(
"TGo4ListCond")) {
242 textbuffer.Append(
" (Whitelist type, 1-dim)");
245 textbuffer.Append(
" (Window type,");
247 textbuffer.Append(
" 2-dim)");
249 textbuffer.Append(
" 1-dim)");
254 if (option.Contains(
"limits"))
256 TString::Format(
"\n! Xlow: \t\tXup: \t\tYlow: \t\tYup:\n %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t",
259 if (option.Contains(
"flags"))
260 textbuffer.Append(TString::Format(
261 "\n! Status:\n! Enab.: \tVis.: \tRes.: \tTrue: \tCnts: \tTrueCnts:\n %d\t\t%d\t%d\t%d\t%d\t%d",
265 if (option.Contains(
"stats")) {
268 textbuffer.Append(
"\n! with");
271 textbuffer.Append(
" histogram: ");
272 textbuffer.Append(hist->GetName());
274 TString::Format(
"\n! Int:\t\tXmax:\t\tYmax:\t\tCmax:\t\tXmean:\t\tYmean:\t\tXrms:\t\tYrms:\n " 275 "%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f",
278 localthis->
GetRMS(hist, 1), localthis->
GetRMS(hist, 2)));
280 textbuffer.Append(
"out histogram");
284 if (option.Contains(
"go4log")) {
287 std::cout << textbuffer.Data() << std::endl;
295 fbTrue = cond->TGo4Condition::IsTrue();
296 fbFalse = cond->TGo4Condition::IsFalse();
297 fbResult = cond->TGo4Condition::FixedResult();
298 fbEnabled = cond->TGo4Condition::IsEnabled();
300 fbVisible = cond->TGo4Condition::IsVisible();
304 fbIntDraw = cond->TGo4Condition::IsIntDraw();
306 fbXRMSDraw = cond->TGo4Condition::IsXRMSDraw();
308 fbYRMSDraw = cond->TGo4Condition::IsYRMSDraw();
309 fbXMaxDraw = cond->TGo4Condition::IsXMaxDraw();
310 fbYMaxDraw = cond->TGo4Condition::IsYMaxDraw();
311 fbCMaxDraw = cond->TGo4Condition::IsCMaxDraw();
317 fiCounts = cond->TGo4Condition::Counts();
336 TString options = rest_url_opt;
343 TObject *cursor =
nullptr;
344 while ((cursor = iter.Next()) !=
nullptr) {
345 TObjString *curopt =
dynamic_cast<TObjString *
>(cursor);
347 TString theOption = curopt->GetString();
348 if (theOption.Contains(key)) {
359 TObject *cursor =
nullptr;
360 TObjArray *valuearray;
361 while ((cursor = iter.Next()) !=
nullptr) {
362 TObjString *curopt =
dynamic_cast<TObjString *
>(cursor);
364 TString theOption = curopt->GetString();
365 if (theOption.Contains(key)) {
366 valuearray = theOption.Tokenize(
"=");
367 TString theValue = valuearray->Last()->GetName();
368 valuearray->Delete();
380 if (valstring.IsNull())
383 return valstring.Atoi();
389 if(valstring.IsNull())
392 return valstring.Atof();
399 message.Form(
"TGo4Condition::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
422 message.Form(
"Set condition %s:", GetName());
424 if (resetcounters > 0) {
426 message.Append(TString::Format(
", resetcounters=%d", resetcounters));
429 if (resultmode >= 0) {
431 switch (resultmode) {
434 case 2:
Disable(kFALSE);
break;
437 message.Append(TString::Format(
", resultmode=%d", resultmode));
440 if (invertmode >= 0) {
443 message.Append(TString::Format(
", invertmode=%d", invertmode));
448 message.Append(TString::Format(
", visible=%d", visible));
450 if (labeldraw >= 0) {
452 message.Append(TString::Format(
", labeldraw=%d", labeldraw));
454 if (limitsdraw >= 0) {
456 message.Append(TString::Format(
", limitsdraw=%d", limitsdraw));
458 if (integraldraw >= 0) {
460 message.Append(TString::Format(
", intdraw=%d", integraldraw));
462 if (xmeandraw >= 0) {
464 message.Append(TString::Format(
", xmeandraw=%d", xmeandraw));
468 message.Append(TString::Format(
", xrmsdraw=%d", xrmsdraw));
470 if (ymeandraw >= 0) {
472 message.Append(TString::Format(
", ymeandraw=%d", ymeandraw));
476 message.Append(TString::Format(
", yrmsdraw=%d", yrmsdraw));
480 message.Append(TString::Format(
", xmaxdraw=%d", xmaxdraw));
484 message.Append(TString::Format(
", ymaxdraw=%d", ymaxdraw));
488 message.Append(TString::Format(
", cmaxdraw=%d", cmaxdraw));
509 Int_t size =
sizeof(*this);
510 if (GetName()) size += strlen(GetName());
511 if (GetTitle()) size += strlen(GetTitle());
560 if (!name || !*name) {
604 if (gPad && !gPad->GetListOfPrimitives()->FindObject(
this)) {
618 gROOT->GetListOfCanvases()->RecursiveRemove(
this);
669 Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW,
670 Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW,
const char *NUMFORMAT)
686 Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW,
687 Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT)
721 Bool_t savemacro = opt && strstr(opt,
"savemacro");
722 Bool_t saveprefix = savemacro;
724 const char *subname = strstr(opt,
"name:");
725 if (subname) { varname = subname + 5; saveprefix = kFALSE; }
728 out << TString::Format(
" %s* %s = (%s*) go4->GetAnalysisCondition(\"%s\",\"%s\");",
729 ClassName(), varname, ClassName(), GetName(), ClassName()) << std::endl;
730 out << TString::Format(
" if (!%s) {", varname) << std::endl;
731 out << TString::Format(
" TGo4Log::Error(\"Could not find condition %s of class %s\");", GetName(), ClassName()) << std::endl;
732 out << TString::Format(
" return;") << std::endl;
733 out << TString::Format(
" }") << std::endl << std::endl;
734 out << TString::Format(
" TGo4Log::Info(\"Set condition %s as saved at %s\");",
735 GetName(),TDatime().AsString()) << std::endl << std::endl;
737 if (!savemacro && (!opt || !strstr(opt,
"nocreate"))) {
738 out << TString::Format(
" %s* %s = new %s(\"%s\"%s);", ClassName(), varname, ClassName(), GetName(), (arrextraargs ? arrextraargs :
"")) << std::endl << std::endl;
743 Bool_t enabled,last,mark,result,vtrue,vfalse;
744 GetFlags(&enabled, &last, &mark, &result, &vtrue, &vfalse);
746 out <<
" // SetFlags(enabled,last,mark,result,vtrue,vfalse);" << std::endl;
748 out << TString::Format(
" %s%s->SetFlags(%s, %s, %s, %s, %s, %s);",
749 savemacro ?
"if (flags) " :
"", varname,
750 enabled ?
"kTRUE" :
"kFALSE",
751 last ?
"kTRUE" :
"kFALSE",
752 mark ?
"kTRUE" :
"kFALSE",
753 result ?
"kTRUE" :
"kFALSE",
754 vtrue ?
"kTRUE" :
"kFALSE",
755 vfalse ?
"kTRUE" :
"kFALSE") << std::endl;
757 out << TString::Format(
" %s%s->SetCounts(%d, %d);",
758 savemacro ?
"if (counters) " :
"", varname,
762 out << TString::Format(
" if (reset) %s->ResetCounts();", varname) << std::endl;
static Bool_t fgbXRMSDRAW
static TString fgxURL_CMAX
void Print(Option_t *opt="") const override
static Bool_t fgbYMAXDRAW
Bool_t UrlOptionHasKey(const char *key)
static TString fgxURL_XRMS
virtual void SetIntDraw(Bool_t on)
static Bool_t fgbLIMITSDRAW
static void GetGlobalStyle(Bool_t &LABELDRAW, Bool_t &LIMITSDRAW, Bool_t &INTDRAW, Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW, Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT)
virtual Double_t GetRMS(TH1 *, Int_t=1)
void Draw(Option_t *opt="") override
static TString fgxURL_RESET
virtual void SetYMaxDraw(Bool_t on)
virtual void PaintCondition(Option_t *opt="")
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual void UnDraw(Option_t *opt="")
virtual void SetCMaxDraw(Bool_t on)
virtual Double_t GetYLow() const
virtual void SetPainter(TGo4ConditionPainter *painter)
virtual const TGo4Condition * GetActiveCondition() const
virtual void UnPaintLabel(Option_t *opt="")
TString GetUrlOptionAsString(const char *key, TString def_value)
static Bool_t fgbCMAXDRAW
virtual void UnPaintCondition(Option_t *opt="")
virtual void PrintCondition(Bool_t full=kTRUE)
static TString fgxURL_YMEAN
virtual void SetYRMSDraw(Bool_t on)
void PaintLabel(Option_t *opt="") override
virtual Double_t GetYUp() const
static Bool_t fgbLABELDRAW
void BuildUrlOptionArray(const char *rest_url_opt)
static TString fgxNUMFORMAT
static TString fgxURL_RESULT
virtual void SetXMeanDraw(Bool_t on)
static Bool_t fgbXMEANDRAW
TH1 * GetWorkHistogram() const
virtual Double_t GetIntegral(TH1 *, Option_t *="")
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=nullptr)
virtual void ResetCounts()
static TString fgxURL_INTEGRAL
void SetPainted(Bool_t on)
virtual void SetCounts(Int_t truecounts, Int_t counts)
static const char * Message(Int_t prio, const char *text,...) GO4_PRINTF2_ARGS
static void SetGlobalStyle(Bool_t LABELDRAW, Bool_t LIMITSDRAW, Bool_t INTDRAW, Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW, Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW, const char *NUMFORMAT)
virtual void SetXMaxDraw(Bool_t on)
virtual Bool_t IsPolygonType() const
const char * GetLinkedHistogram() const
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
void Paint(Option_t *opt="") override
virtual Int_t GetMemorySize() const
static Bool_t fgbYMEANDRAW
virtual void SetFlags(Bool_t enabled, Bool_t lastresult, Bool_t markreset, Bool_t result, Bool_t truevalue, Bool_t falsevalue)
void SetHistogram(const char *name)
static TString fgxURL_VISIBLE
static TString fgxURL_INVERT
virtual void Disable(Bool_t result)
virtual Double_t GetXLow() const
virtual Double_t GetXUp() const
virtual void SetCondition(TGo4Condition *con)
void ResetLabel(Option_t *opt="reset")
void Clear(Option_t *opt="") override
virtual void SetXRMSDraw(Bool_t on)
virtual void SetLimitsDraw(Bool_t on)
static TString fgxURL_YMAX
static Bool_t fgbXMAXDRAW
virtual TGo4ConditionPainter * CreatePainter()
virtual void GetFlags(Bool_t *enabled, Bool_t *lastresult, Bool_t *markreset, Bool_t *result, Bool_t *truevalue, Bool_t *falsevalue)
virtual void MarkReset(Bool_t on)
TGo4ConditionPainter * fxPainter
static TString fgxURL_LIMITS
static Bool_t fgbYRMSDRAW
virtual Double_t GetMean(TH1 *, Int_t=1)
virtual Double_t GetYMax(TH1 *)
TObjArray * fxUrlOptionArray
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
Int_t GetDimension() const
Int_t GetUrlOptionAsInt(const char *key, Int_t def_value)
virtual void SetYMeanDraw(Bool_t on)
virtual Int_t TrueCounts()
static TString fgxURL_XMEAN
static TString fgxURL_YRMS
virtual void DisplayToFront(Option_t *opt="")
virtual void AddCondition(TGo4Condition *next)
virtual void SetLabelDraw(Bool_t on)
static TString fgxURL_LABEL
static const Double_t fgdUPDATEEPSILON
virtual void SetVisible(Bool_t on)
virtual Double_t GetCMax(TH1 *)
virtual void Invert(Bool_t on)
Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value)
static TString fgxURL_XMAX
virtual Double_t GetXMax(TH1 *)
Bool_t fbStreamedCondition
virtual Bool_t IsVisible() const