18 #include "TObjArray.h"
19 #include "TObjString.h"
20 #include "TVirtualPad.h"
68 GO4TRACE((15,
"TGo4Condition::TGo4Condition()",__LINE__, __FILE__));
97 GO4TRACE((15,
"TGo4Condition::TGo4Condition(const char*)",__LINE__, __FILE__));
119 GO4TRACE((15,
"TGo4Condition::~TGo4Condition()",__LINE__, __FILE__));
144 GO4TRACE((14,
"TGo4Condition::AddCondition(TGo4Condition*)",__LINE__, __FILE__));
149 GO4TRACE((12,
"TGo4Condition::IncTrueCounts()",__LINE__, __FILE__));
155 GO4TRACE((12,
"TGo4Condition::IncCounts()",__LINE__, __FILE__));
161 GO4TRACE((12,
"TGo4Condition::Counts()",__LINE__, __FILE__));
167 GO4TRACE((12,
"TGo4Condition::TrueCounts()",__LINE__, __FILE__));
173 GO4TRACE((12,
"TGo4Condition::ResetCounts()",__LINE__, __FILE__));
180 GO4TRACE((12,
"TGo4Condition::SetCounts()",__LINE__, __FILE__));
189 GO4TRACE((12,
"TGo4Condition::Invert",__LINE__, __FILE__));
197 std::cout <<
"Name:" << GetName() <<
" type:" << ClassName() <<
" title:" << GetTitle() << std::endl;
199 std::cout <<
"Connected to histogram " <<
fxHistoName << std::endl;
205 line =
"Is Checked ";
207 line =
"Always True ";
209 line =
"Always False ";
210 line.Append(
fbTrue ?
"normal " :
"inverse ");
211 line.Append(TString::Format(
", tested: %8d true: %8d is %3.0f%s",
fiCounts,
fiTrueCounts, perc,
"%"));
212 std::cout << line << std::endl;
224 strncpy(num,
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++",
sizeof(num));
225 char *pc = num + (Int_t)perc/2;
227 std::cout << TString::Format(
"%-24s %8d %3.0f%s |%-50s|",GetName(),
fiCounts,perc,
"%",num) << std::endl;
236 if (option.IsNull() || option ==
"*") {
241 TString textbuffer =
"\nCondition ";
242 textbuffer.Append(GetName());
244 textbuffer.Append(
" (Polygon type, 2-dim)");
247 if (InheritsFrom(
"TGo4ListCond")) {
248 textbuffer.Append(
" (Whitelist type, 1-dim)");
251 textbuffer.Append(
" (Window type,");
253 textbuffer.Append(
" 2-dim)");
255 textbuffer.Append(
" 1-dim)");
260 if (option.Contains(
"limits"))
262 TString::Format(
"\n! Xlow: \t\tXup: \t\tYlow: \t\tYup:\n %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t",
265 if (option.Contains(
"flags"))
266 textbuffer.Append(TString::Format(
267 "\n! Status:\n! Enab.: \tVis.: \tRes.: \tTrue: \tCnts: \tTrueCnts:\n %d\t\t%d\t%d\t%d\t%d\t%d",
271 if (option.Contains(
"stats")) {
274 textbuffer.Append(
"\n! with");
277 textbuffer.Append(
" histogram: ");
278 textbuffer.Append(hist->GetName());
280 TString::Format(
"\n! Int:\t\tXmax:\t\tYmax:\t\tCmax:\t\tXmean:\t\tYmean:\t\tXrms:\t\tYrms:\n "
281 "%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f",
284 localthis->
GetRMS(hist, 1), localthis->
GetRMS(hist, 2)));
286 textbuffer.Append(
"out histogram");
290 if (option.Contains(
"go4log")) {
293 std::cout << textbuffer.Data() << std::endl;
301 fbTrue = cond->TGo4Condition::IsTrue();
302 fbFalse = cond->TGo4Condition::IsFalse();
303 fbResult = cond->TGo4Condition::FixedResult();
304 fbEnabled = cond->TGo4Condition::IsEnabled();
306 fbVisible=cond->TGo4Condition::IsVisible();
310 fbIntDraw= cond->TGo4Condition::IsIntDraw();
312 fbXRMSDraw= cond->TGo4Condition::IsXRMSDraw();
314 fbYRMSDraw= cond->TGo4Condition::IsYRMSDraw();
315 fbXMaxDraw= cond->TGo4Condition::IsXMaxDraw();
316 fbYMaxDraw= cond->TGo4Condition::IsYMaxDraw();
317 fbCMaxDraw= cond->TGo4Condition::IsCMaxDraw();
323 fiCounts = cond->TGo4Condition::Counts();
342 TString options = rest_url_opt;
350 while ((cursor = iter.Next()) != 0) {
351 TObjString *curopt =
dynamic_cast<TObjString *
>(cursor);
353 TString theOption = curopt->GetString();
354 if (theOption.Contains(key)) {
366 TObjArray *valuearray;
367 while ((cursor = iter.Next()) != 0) {
368 TObjString *curopt =
dynamic_cast<TObjString *
>(cursor);
370 TString theOption = curopt->GetString();
371 if (theOption.Contains(key)) {
372 valuearray = theOption.Tokenize(
"=");
373 TString theValue = valuearray->Last()->GetName();
374 valuearray->Delete();
386 if (valstring.IsNull())
389 return valstring.Atoi();
395 if(valstring.IsNull())
398 return valstring.Atof();
405 message.Form(
"TGo4Condition::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
428 message.Form(
"Set condition %s:", GetName());
430 if (resetcounters > 0) {
432 message.Append(TString::Format(
", resetcounters=%d", resetcounters));
435 if (resultmode >= 0) {
437 switch (resultmode) {
440 case 2:
Disable(kFALSE);
break;
443 message.Append(TString::Format(
", resultmode=%d", resultmode));
446 if (invertmode >= 0) {
449 message.Append(TString::Format(
", invertmode=%d", invertmode));
454 message.Append(TString::Format(
", visible=%d", visible));
456 if (labeldraw >= 0) {
458 message.Append(TString::Format(
", labeldraw=%d", labeldraw));
460 if (limitsdraw >= 0) {
462 message.Append(TString::Format(
", limitsdraw=%d", limitsdraw));
464 if (integraldraw >= 0) {
466 message.Append(TString::Format(
", intdraw=%d", integraldraw));
468 if (xmeandraw >= 0) {
470 message.Append(TString::Format(
", xmeandraw=%d", xmeandraw));
474 message.Append(TString::Format(
", xrmsdraw=%d", xrmsdraw));
476 if (ymeandraw >= 0) {
478 message.Append(TString::Format(
", ymeandraw=%d", ymeandraw));
482 message.Append(TString::Format(
", yrmsdraw=%d", yrmsdraw));
486 message.Append(TString::Format(
", xmaxdraw=%d", xmaxdraw));
490 message.Append(TString::Format(
", ymaxdraw=%d", ymaxdraw));
494 message.Append(TString::Format(
", cmaxdraw=%d", cmaxdraw));
515 Int_t size =
sizeof(*this);
516 if (GetName()!=0) size+=strlen(GetName());
517 if (GetTitle()!=0) size+=strlen(GetTitle());
566 if ((name==0) || (*name==0)) {
612 if (gPad && gPad->GetListOfPrimitives()->FindObject(
this) == 0) {
627 gROOT->GetListOfCanvases()->RecursiveRemove(
this);
679 Bool_t XMEANDRAW, Bool_t YMEANDRAW, Bool_t XRMSDRAW, Bool_t YRMSDRAW,
680 Bool_t XMAXDRAW, Bool_t YMAXDRAW, Bool_t CMAXDRAW,
const char *NUMFORMAT)
696 Bool_t &XMEANDRAW, Bool_t &YMEANDRAW, Bool_t &XRMSDRAW, Bool_t &YRMSDRAW,
697 Bool_t &XMAXDRAW, Bool_t &YMAXDRAW, Bool_t &CMAXDRAW, TString &NUMFORMAT)
731 Bool_t savemacro = (opt!=0) && (strstr(opt,
"savemacro")!=0);
732 Bool_t saveprefix = savemacro;
734 const char* subname = strstr(opt,
"name:");
735 if (subname != 0) { varname = subname + 5; saveprefix = kFALSE; }
738 out << Form(
" %s* %s = (%s*) go4->GetAnalysisCondition(\"%s\",\"%s\");",
739 ClassName(), varname, ClassName(), GetName(), ClassName()) << std::endl;
740 out << Form(
" if (%s==0) {", varname) << std::endl;
741 out << Form(
" TGo4Log::Error(\"Could not find condition %s of class %s\");", GetName(), ClassName()) << std::endl;
742 out << Form(
" return;") << std::endl;
743 out << Form(
" }") << std::endl << std::endl;
744 out << Form(
" TGo4Log::Info(\"Set condition %s as saved at %s\");",
745 GetName(),TDatime().AsString()) << std::endl << std::endl;
747 if (!savemacro && ((opt==0) || (strstr(opt,
"nocreate")==0))) {
748 out << Form(
" %s* %s = new %s(\"%s\"%s);", ClassName(), varname, ClassName(), GetName(), (arrextraargs ? arrextraargs :
"")) << std::endl << std::endl;
751 if (arrextraargs==0) {
753 Bool_t enabled,last,mark,result,vtrue,vfalse;
754 GetFlags(&enabled, &last, &mark, &result, &vtrue, &vfalse);
756 out <<
" // SetFlags(enabled,last,mark,result,vtrue,vfalse);" << std::endl;
758 out << Form(
" %s%s->SetFlags(%s, %s, %s, %s, %s, %s);",
759 savemacro ?
"if (flags) " :
"", varname,
760 enabled ?
"kTRUE" :
"kFALSE",
761 last ?
"kTRUE" :
"kFALSE",
762 mark ?
"kTRUE" :
"kFALSE",
763 result ?
"kTRUE" :
"kFALSE",
764 vtrue ?
"kTRUE" :
"kFALSE",
765 vfalse ?
"kTRUE" :
"kFALSE") << std::endl;
767 out << Form(
" %s%s->SetCounts(%d, %d);",
768 savemacro ?
"if (counters) " :
"", varname,
772 out << Form(
" if (reset) %s->ResetCounts();", varname) << std::endl;
static Bool_t fgbXRMSDRAW
static TString fgxURL_CMAX
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)
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 Bool_t IsPolygonType()
virtual Double_t GetYUp()
virtual void SetPainter(TGo4ConditionPainter *painter)
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)
virtual Bool_t IsVisible()
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
virtual Double_t GetIntegral(TH1 *, Option_t *="")
virtual Double_t GetXLow()
virtual void PaintLabel(Option_t *opt="")
virtual void ResetCounts()
virtual void Draw(Option_t *opt="")
static TString fgxURL_INTEGRAL
void SetPainted(Bool_t on)
virtual void SetCounts(Int_t truecounts, Int_t counts)
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 UpdateFromUrl(const char *rest_url_opt)
virtual void Clear(Option_t *opt="")
virtual void Print(Option_t *opt="") 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
static const char * Message(Int_t prio, const char *text,...)
virtual void Disable(Bool_t result)
virtual void SetCondition(TGo4Condition *con)
virtual Double_t GetYLow()
void ResetLabel(Option_t *opt="reset")
virtual TGo4Condition * GetActiveCondition()
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=0)
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)
virtual void Paint(Option_t *opt="")
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)
virtual Int_t GetMemorySize()
Int_t GetUrlOptionAsInt(const char *key, Int_t def_value)
const char * GetLinkedHistogram()
virtual void SetYMeanDraw(Bool_t on)
virtual Int_t TrueCounts()
static TString fgxURL_XMEAN
static TString fgxURL_YRMS
virtual Double_t GetXUp()
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