20 #include "TObjArray.h"
21 #include "TObjString.h"
23 #include "TVirtualPad.h"
24 #include "Riostream.h"
76 GO4TRACE((15,
"TGo4Condition::TGo4Condition()",__LINE__, __FILE__));
107 GO4TRACE((15,
"TGo4Condition::TGo4Condition(const char*)",__LINE__, __FILE__));
129 GO4TRACE((15,
"TGo4Condition::~TGo4Condition()",__LINE__, __FILE__));
159 GO4TRACE((14,
"TGo4Condition::AddCondition(TGo4Condition*)",__LINE__, __FILE__));
164 GO4TRACE((12,
"TGo4Condition::IncTrueCounts()",__LINE__, __FILE__));
170 GO4TRACE((12,
"TGo4Condition::IncCounts()",__LINE__, __FILE__));
176 GO4TRACE((12,
"TGo4Condition::Counts()",__LINE__, __FILE__));
182 GO4TRACE((12,
"TGo4Condition::TrueCounts()",__LINE__, __FILE__));
188 GO4TRACE((12,
"TGo4Condition::ResetCounts()",__LINE__, __FILE__));
195 GO4TRACE((12,
"TGo4Condition::SetCounts()",__LINE__, __FILE__));
204 GO4TRACE((12,
"TGo4Condition::Invert",__LINE__, __FILE__));
217 std::cout <<
"Name:" << GetName()
218 <<
" type:" << ClassName()
219 <<
" title:" << GetTitle() << std::endl;
221 std::cout <<
"Connected to histogram " <<
fxHistoName << std::endl;
223 strcpy(line,
"Is Checked ");
225 if(
fbResult) strcpy(line,
"Always True ");
226 else strcpy(line,
"Always False ");
228 if(
fbTrue) strcat(line,
"normal ");
229 else strcat(line,
"inverse ");
230 snprintf(num,63,
", tested: %8d true: %8d is %3.0f%%",
fiCounts,fiTrueCounts,perc);
232 std::cout << line << std::endl;
240 strcpy(num,
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
244 pc=num + (Int_t)perc/2;
246 snprintf(line,127,
"%-24s %8d %3.0f%% |%-50s|",GetName(),
fiCounts,perc,num);
248 std::cout << line << std::endl;
257 if(option.IsNull() || option==
"*")
265 TString textbuffer=
"\nCondition ";
266 textbuffer+=localthis->GetName();
269 textbuffer+=
" (Polygon type, 2-dim)";
273 textbuffer+=
" (Window type,";
275 textbuffer+=
" 2-dim)";
277 textbuffer+=
" 1-dim)";
282 if(option.Contains(
"limits"))
284 TString::Format(
"\n! Xlow: \t\tXup: \t\tYlow: \t\tYup:\n %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t",
287 if(option.Contains(
"flags"))
289 TString::Format(
"\n! Status:\n! Enab.: \tVis.: \tRes.: \tTrue: \tCnts: \tTrueCnts:\n %d\t\t%d\t%d\t%d\t%d\t%d",
293 if(option.Contains(
"stats"))
297 textbuffer+=
"\n! with";
301 textbuffer+=
" histogram: ";
302 textbuffer+=hist->GetName();
304 TString::Format(
"\n! Int:\t\tXmax:\t\tYmax:\t\tCmax:\t\tXmean:\t\tYmean:\t\tXrms:\t\tYrms:\n %.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f\t\t%.2f",
310 textbuffer+=
"out histogram";
314 if(option.Contains(
"go4log"))
320 std::cout << textbuffer.Data() << std::endl;
328 fbTrue = cond->TGo4Condition::IsTrue();
329 fbFalse = cond->TGo4Condition::IsFalse();
330 fbResult = cond->TGo4Condition::FixedResult();
331 fbEnabled = cond->TGo4Condition::IsEnabled();
333 fbVisible=cond->TGo4Condition::IsVisible();
337 fbIntDraw= cond->TGo4Condition::IsIntDraw();
339 fbXRMSDraw= cond->TGo4Condition::IsXRMSDraw();
341 fbYRMSDraw= cond->TGo4Condition::IsYRMSDraw();
342 fbXMaxDraw= cond->TGo4Condition::IsXMaxDraw();
343 fbYMaxDraw= cond->TGo4Condition::IsYMaxDraw();
344 fbCMaxDraw= cond->TGo4Condition::IsCMaxDraw();
350 fiCounts = cond->TGo4Condition::Counts();
370 TString options=rest_url_opt;
381 while ((cursor = iter.Next()) != 0)
383 TObjString* curopt =
dynamic_cast<TObjString*
>(cursor);
386 TString theOption = curopt->GetString();
387 if (theOption.Contains(key))
400 TObjArray* valuearray;
401 while((cursor=iter.Next()) !=0)
403 TObjString* curopt=
dynamic_cast<TObjString*
>(cursor);
406 TString theOption=curopt->GetString();
407 if(theOption.Contains(key)){
408 valuearray=theOption.Tokenize(
"=");
409 TString theValue= valuearray->Last()->GetName();
410 valuearray->Delete();
424 if(valstring.IsNull())
427 return valstring.Atoi();
433 if(valstring.IsNull())
436 return valstring.Atof();
442 message.Form(
"TGo4Condition::UpdateFromUrl - condition %s: with url:%s", GetName(), rest_url_opt);
469 message.Form(
"Set condition %s:", GetName());
471 if (resetcounters > 0)
474 message.Append(TString::Format(
", resetcounters=%d", resetcounters));
495 message.Append(TString::Format(
", resultmode=%d", resultmode));
504 message.Append(TString::Format(
", invertmode=%d", invertmode));
510 message.Append(TString::Format(
", visible=%d", visible));
515 message.Append(TString::Format(
", labeldraw=%d", labeldraw));
520 message.Append(TString::Format(
", limitsdraw=%d", limitsdraw));
522 if (integraldraw >= 0)
525 message.Append(TString::Format(
", intdraw=%d", integraldraw));
530 message.Append(TString::Format(
", xmeandraw=%d", xmeandraw));
535 message.Append(TString::Format(
", xrmsdraw=%d", xrmsdraw));
540 message.Append(TString::Format(
", ymeandraw=%d", ymeandraw));
545 message.Append(TString::Format(
", yrmsdraw=%d", yrmsdraw));
550 message.Append(TString::Format(
", xmaxdraw=%d", xmaxdraw));
555 message.Append(TString::Format(
", ymaxdraw=%d", ymaxdraw));
560 message.Append(TString::Format(
", cmaxdraw=%d", cmaxdraw));
601 Int_t size =
sizeof(*this);
602 if (GetName()!=0) size+=strlen(GetName());
603 if (GetTitle()!=0) size+=strlen(GetTitle());
616 Bool_t* result, Bool_t* truevalue, Bool_t* falsevalue)
626 Bool_t result, Bool_t truevalue, Bool_t falsevalue)
804 if ((name==0) || (*name==0)) {
850 if(gPad && gPad->GetListOfPrimitives()->FindObject(
this)==0) {
865 gROOT->GetListOfCanvases()->RecursiveRemove(
this);
942 Bool_t savemacro = (opt!=0) && (strstr(opt,
"savemacro")!=0);
943 Bool_t saveprefix = savemacro;
945 const char* subname = strstr(opt,
"name:");
946 if (subname != 0) { varname = subname + 5; saveprefix = kFALSE; }
949 out << Form(
" %s* %s = (%s*) go4->GetAnalysisCondition(\"%s\",\"%s\");",
950 ClassName(), varname, ClassName(), GetName(), ClassName()) << std::endl;
951 out << Form(
" if (%s==0) {", varname) << std::endl;
952 out << Form(
" TGo4Log::Error(\"Could not find condition %s of class %s\");", GetName(), ClassName()) << std::endl;
953 out << Form(
" return;") << std::endl;
954 out << Form(
" }") << std::endl << std::endl;
955 out << Form(
" TGo4Log::Info(\"Set condition %s as saved at %s\");",
956 GetName(),TDatime().AsString()) << std::endl << std::endl;
958 if (!savemacro && ((opt==0) || (strstr(opt,
"nocreate")==0))) {
959 out << Form(
" %s* %s = new %s(\"%s\"%s);", ClassName(), varname, ClassName(), GetName(), (arrextraargs ? arrextraargs :
"")) << std::endl << std::endl;
962 if (arrextraargs==0) {
964 Bool_t enabled,last,mark,result,vtrue,vfalse;
965 GetFlags(&enabled, &last, &mark, &result, &vtrue, &vfalse);
967 out <<
" // SetFlags(enabled,last,mark,result,vtrue,vfalse);" << std::endl;
969 out << Form(
" %s%s->SetFlags(%s, %s, %s, %s, %s, %s);",
970 savemacro ?
"if (flags) " :
"", varname,
971 enabled ?
"kTRUE" :
"kFALSE",
972 last ?
"kTRUE" :
"kFALSE",
973 mark ?
"kTRUE" :
"kFALSE",
974 result ?
"kTRUE" :
"kFALSE",
975 vtrue ?
"kTRUE" :
"kFALSE",
976 vfalse ?
"kTRUE" :
"kFALSE") << std::endl;
978 out << Form(
" %s%s->SetCounts(%d, %d);",
979 savemacro ?
"if (counters) " :
"", varname,
983 out << Form(
" if (reset) %s->ResetCounts();", varname) << std::endl;
virtual Bool_t IsYRMSDraw()
static Bool_t fgbXRMSDRAW
static TString fgxURL_CMAX
static Bool_t fgbYMAXDRAW
Bool_t UrlOptionHasKey(const char *key)
static TString fgxURL_XRMS
static Bool_t fgbLIMITSDRAW
virtual Bool_t IsLabelDraw()
virtual Double_t GetXMax(TH1 *histo)
virtual Double_t GetMean(TH1 *histo, Int_t axis=1)
virtual void SetLimitsDraw(Bool_t on)
static TString fgxURL_RESET
virtual void PaintCondition(Option_t *opt="")
virtual Bool_t UpdateFrom(TGo4Condition *cond, Bool_t counts)
virtual Double_t GetCMax(TH1 *histo)
virtual void UnDraw(Option_t *opt="")
virtual Double_t GetCurtosis(TH1 *histo, Int_t axis=1)
virtual void SetYRMSDraw(Bool_t on)
virtual void SetPainter(TGo4ConditionPainter *painter)
virtual void UnPaintLabel(Option_t *opt="")
virtual void SetLabelNumFormat(const char *fmt)
TString GetUrlOptionAsString(const char *key, TString def_value)
virtual Bool_t IsXMeanDraw()
static Bool_t fgbCMAXDRAW
virtual void UnPaintCondition(Option_t *opt="")
virtual void PrintCondition(Bool_t full=kTRUE)
static TString fgxURL_YMEAN
virtual Bool_t IsLimitsDraw()
virtual Double_t GetSkewness(TH1 *histo, Int_t axis=1)
virtual Bool_t IsYMeanDraw()
virtual Double_t GetYUp()
static Bool_t fgbLABELDRAW
virtual Int_t GetCurrentIndex()
void BuildUrlOptionArray(const char *rest_url_opt)
virtual void SetVisible(Bool_t on)
static TString fgxNUMFORMAT
virtual Int_t GetNumberOfConditions()
static TString fgxURL_RESULT
virtual void SetCurrentIndex(Int_t ix)
virtual void SetXMaxDraw(Bool_t on)
static Bool_t fgbXMEANDRAW
virtual Bool_t IsIntDraw()
virtual void PaintLabel(Option_t *opt="")
virtual void ResetCounts()
virtual void Draw(Option_t *opt="")
virtual Bool_t IsXRMSDraw()
static TString fgxURL_INTEGRAL
virtual void SetYMaxDraw(Bool_t on)
void SetPainted(Bool_t on)
virtual void SetCounts(Int_t truecounts, Int_t counts)
virtual Bool_t IsXMaxDraw()
virtual Bool_t UpdateFromUrl(const char *rest_url_opt)
virtual Bool_t IsVisible()
virtual void Clear(Option_t *opt="")
void SetHistogramLink(Bool_t on)
virtual void SetIntDraw(Bool_t on)
virtual void Print(Option_t *opt="") const
static Bool_t fgbYMEANDRAW
virtual void SetYMeanDraw(Bool_t on)
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 const char * GetLabelNumFormat()
void ResetLabel(Option_t *opt="reset")
const char * MakeScript(std::ostream &out, const char *varname, Option_t *opt="", const char *arrextraargs=0)
virtual Double_t GetXLow()
static TString fgxURL_YMAX
static Bool_t fgbXMAXDRAW
virtual void SetXMeanDraw(Bool_t on)
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
virtual Bool_t IsArrayType()
virtual Double_t GetYMax(TH1 *histo)
virtual void SetLabelDraw(Bool_t on)
static Bool_t fgbYRMSDRAW
void SetWorkHistogram(TH1 *histo)
TObjArray * fxUrlOptionArray
virtual void GetValues(Int_t &dim, Double_t &x1, Double_t &y1, Double_t &x2, Double_t &y2)
virtual Int_t GetMemorySize()
virtual Bool_t IsPolygonType()
Int_t GetUrlOptionAsInt(const char *key, Int_t def_value)
virtual Double_t GetXUp()
virtual Double_t GetRMS(TH1 *histo, Int_t axis=1)
const char * GetLinkedHistogram()
virtual Int_t TrueCounts()
virtual Bool_t IsCMaxDraw()
virtual void SetXRMSDraw(Bool_t on)
static TString fgxURL_XMEAN
static TString fgxURL_YRMS
virtual void DisplayToFront(Option_t *opt="")
virtual void AddCondition(TGo4Condition *next)
static TString fgxURL_LABEL
virtual TCutG * GetCut(Bool_t owner)
static const Double_t fgdUPDATEEPSILON
virtual Bool_t IsYMaxDraw()
virtual Double_t GetIntegral(TH1 *histo, Option_t *opt="")
virtual TGo4Condition * GetActiveCondition()
virtual void Invert(Bool_t on)
Double_t GetUrlOptionAsDouble(const char *key, Double_t def_value)
static TString fgxURL_XMAX
virtual void SetCMaxDraw(Bool_t on)
Bool_t fbStreamedCondition
virtual Double_t GetYLow()