6 # include <TSelector.h>
14 # include <TObjArray.h>
58 Bool_t hasCmd = (cmd && cmd[0] !=
'\0');
60 lne.Form(
"gProof%s%s", (hasCmd ?
"->" :
""), (hasCmd ? cmd :
""));
61 Printf(
"FastMonitor::ProofExec: %s", lne.Data());
62 return gROOT->ProcessLine(lne);
108 while ((obj = next()))
Register(obj);
123 if (&m ==
this)
return *
this;
129 while ((obj = next()))
Register(obj);
138 if (gROOT->IsBatch()) {
139 Warning(
"FastMonitor",
"Batch processing, no monitoring");
142 if (freq <= 0)
return;
146 gROOT->ProcessLine(Form(
"((FastMontor*)%p)->SetName("
147 "gProof->GetSessionTag())",
this));
148 Long_t ret =
ProofExec(Form(
"Connect(\"Feedback(TList *objs)\","
149 " \"FastMonitor\",(void*)%p,"
150 " \"Feedback(TList *objs)\")",
this));
152 Warning(
"FastMonitor",
"Failed to connect to Proof");
155 ProofExec(Form(
"SetParameter(\"PROOF_FeedbackPeriod\",%d)",
159 fTimer =
new TTimer(freq*1000);
160 fTimer->Connect(
"Timeout()",
"FastMonitor",
this,
"Handle()");
172 ProofExec(Form(
"Disconnect(\"Feedback(TList *objs)\","
173 "(void*)%p,\"Feedback(TList* objs)\"",
this));
188 Register(descr->GetName(), descr->GetTitle(), descr->GetUniqueID(), proof);
199 const char*
title=
"",
204 n->SetUniqueID(flags);
207 ProofExec(Form(
"AddFeedback(\"%s\")", name));
234 Warning(
"Feedback",
"No list");
239 TVirtualPad* p =
fCanvas->cd(iPad);
243 Warning(
"Feedback",
"Object correspondig to pad %s (%d) not found",
285 if (gROOT->IsBatch()) {
286 Warning(
"FastMonitor",
"Batch processing, no monitoring");
301 if (nCol * nRow < nTotal) nCol++;
304 Info(
"FastMonitor",
"Create canvas with (%dx%d) [%d] pads",nCol,nRow,nTotal);
309 SetupDraw(i++, o->GetName(), o->GetTitle(), o->GetUniqueID());
331 TVirtualPad* p =
fCanvas->GetPad(i);
333 Warning(
"RegisterDraw",
"Not enough sub-pads (%d)", i);
340 p->SetTopMargin(0.01);
341 p->SetRightMargin(0.01);
342 p->SetName(Form(
"p_%s", name));
344 if (flags &
kLogx) p->SetLogx();
345 if (flags &
kLogy) p->SetLogy();
346 if (flags &
kLogz) p->SetLogz();
370 if (o->IsA()->InheritsFrom(TH1::Class())) {
371 TH1* h =
static_cast<TH1*
>(o);
372 TH1*
c =
static_cast<TH1*
>(h->Clone(Form(
"cpy_%s", h->GetName())));
378 if (nEvents <= 0)
return;
379 c->Scale(1./nEvents,
"width");
385 c->Draw(Form(
"%s %s",opt, (same ?
"same" :
"")));
386 c->SetBit(TObject::kCanDelete);
388 else if (o->IsA()->InheritsFrom(TGraph::Class())) {
390 TGraph*
c =
static_cast<TGraph*
>(g->Clone(Form(
"cpy_%s",g->GetName())));
391 c->Draw(Form(
"%s %s",opt, (same ?
"" :
"a")));
392 c->SetBit(TObject::kCanDelete);
396 else if (o->IsA()->InheritsFrom(TCollection::Class())) {
410 c->SetBit(TObject::kCanDelete);
424 TString t = Form(
"p_%s", name.Data());
425 while ((p =
fCanvas->GetPad(i))) {
426 if (t.EqualTo(p->GetName()))
return p;
444 if (path.Index(
"/") == kNPOS)
445 return l->FindObject(path);
447 Int_t nTokens = tokens->GetEntriesFast();
450 for (
Int_t i = 0; i < nTokens; i++) {
451 TObject* o = current->FindObject(tokens->At(i)->GetName());
453 if (i == nTokens - 1) {
457 if (!o->IsA()->InheritsFrom(TCollection::Class())) {
458 Warning(
"FindPadObject",
"Path object %s of %s is not a collection "
459 "but a %s", o->GetName(), path.Data(), o->ClassName());
static Long_t ProofExec(const char *cmd=0)
TObject * FindPadObject(const Char_t *padName, TCollection *l)
void Feedback(TList *objs)
FastMonitor & operator=(const FastMonitor &m)
void Connect(Int_t freq=-1)
Bool_t HandleTimer(TTimer *)
void SetupDraw(Int_t i, const char *name, const char *option, UInt_t flags=0)
const char * GetName() const
void Register(TObject *descr, Bool_t proof=true)
TVirtualPad * FindPad(const TString &name)
void Register(const char *name, const char *title="", UInt_t flags=0, Bool_t proof=true)
FastMonitor(const FastMonitor &m)
void SetName(const char *name)
void DrawObject(TObject *o, Option_t *opt, Bool_t scale, Bool_t nostats, Bool_t same=false)
FastMonitor(TSelector *s, const TString &name)