ROOT  6.06/09
Reference Guide
TProofDraw.cxx
Go to the documentation of this file.
1 // @(#)root/proofplayer:$Id$
2 // Author: Maarten Ballintijn, Marek Biskup 24/09/2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2003, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // TProofDraw //
15 // //
16 // Implement Tree drawing using PROOF. //
17 // //
18 //////////////////////////////////////////////////////////////////////////
19 
20 
21 #include "TProofDraw.h"
22 #include "TAttFill.h"
23 #include "TAttLine.h"
24 #include "TAttMarker.h"
25 #include "TCanvas.h"
26 #include "TClass.h"
27 #include "TError.h"
28 #include "TH1F.h"
29 #include "TH2F.h"
30 #include "TH3F.h"
31 #include "TProof.h"
32 #include "TProofDebug.h"
33 #include "TStatus.h"
34 #include "TTreeDrawArgsParser.h"
35 #include "TTreeFormula.h"
36 #include "TTreeFormulaManager.h"
37 #include "TTree.h"
38 #include "TEventList.h"
39 #include "TEntryList.h"
40 #include "TProfile.h"
41 #include "TProfile2D.h"
42 #include "TEnv.h"
43 #include "TNamed.h"
44 #include "TGraph.h"
45 #include "TPolyMarker3D.h"
46 #include "TVirtualPad.h"
47 #include "THLimitsFinder.h"
48 #include "TView.h"
49 #include "TStyle.h"
50 #include "TDirectory.h"
51 #include "TROOT.h"
52 
53 #include <algorithm>
54 using namespace std;
55 
56 
57 // Simple call to draw a canvas on the fly from applications loading
58 // this plug-in dynamically
59 extern "C" {
61  {
62  // Draw the object if deriving from a canvas
63 
64  if (TCanvas* c = dynamic_cast<TCanvas *> (obj)) {
65  c->Draw();
66  return 0;
67  }
68  // Not a TCanvas
69  return 1;
70  }
71 }
72 
73 // Simple call to parse arguments on the fly from applications loading
74 // this plug-in dynamically
75 extern "C" {
76  Int_t GetDrawArgs(const char *var, const char *sel, Option_t *opt,
77  TString &selector, TString &objname)
78  {
79  // Parse arguments with the help of TTreeDrawArgsParser
80 
82  info.Parse(var, sel, opt);
83  selector = info.GetProofSelectorName();
84  objname = info.GetObjectName();
85 
86  // Done
87  return 0;
88  }
89 }
90 
91 // Simple call to create destroy a 'named' canvas
92 extern "C" {
93  void FeedBackCanvas(const char *name, Bool_t create)
94  {
95  // Create or destroy canvas 'name'
96 
97  if (create) {
98  new TCanvas(name, "FeedBack", 800,30,700,500);
99  } else {
100  TCanvas *c = (gROOT->GetListOfCanvases()) ?
101  (TCanvas *) gROOT->GetListOfCanvases()->FindObject(name) : 0;
102  if (c) delete c;
103  }
104  // Done
105  return;
106  }
107 }
108 
110 
111 ////////////////////////////////////////////////////////////////////////////////
112 /// Constructor.
113 
115  : fStatus(0), fManager(0), fTree(0)
116 {
117  fVar[0] = 0;
118  fVar[1] = 0;
119  fVar[2] = 0;
120  fVar[3] = 0;
121  fManager = 0;
122  fMultiplicity = 0;
123  fSelect = 0;
124  fObjEval = kFALSE;
125  fDimension = 0;
126  fWeight = 1.;
127 }
128 
129 
130 ////////////////////////////////////////////////////////////////////////////////
131 /// Destructor.
132 
134 {
135  ClearFormula();
136 }
137 
138 
139 ////////////////////////////////////////////////////////////////////////////////
140 /// Init the tree.
141 
143 {
144  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
145  fTree = tree;
146  CompileVariables();
147 }
148 
149 
150 ////////////////////////////////////////////////////////////////////////////////
151 /// Called when a new tree is loaded.
152 
154 {
155  PDB(kDraw,1) Info("Notify","Enter");
156  if (fStatus == 0) {
157  if (!fOutput || (fOutput &&
158  !(fStatus = dynamic_cast<TStatus*>(fOutput->FindObject("PROOF_Status")))))
159  return kFALSE;
160  }
161  if (!fStatus->IsOk()) return kFALSE;
162  if (!fManager) {
163  fAbort = TSelector::kAbortProcess;
164  return kFALSE;
165  }
166  fManager->UpdateFormulaLeaves();
167  return kTRUE;
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Executed by the client before processing.
172 
174 {
175  PDB(kDraw,1) Info("Begin","Enter tree = %p", tree);
176 
177  TObject *os = fInput->FindObject("selection");
178  TObject *ov = fInput->FindObject("varexp");
179 
180  if (os && ov) {
181  fSelection = os->GetTitle();
182  fInitialExp = ov->GetTitle();
183  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
184  if (fTreeDrawArgsParser.GetObjectName() == "")
185  fTreeDrawArgsParser.SetObjectName("htemp");
186  }
187 
188  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
189  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
190  fTree = 0;
191 }
192 
193 
194 ////////////////////////////////////////////////////////////////////////////////
195 /// Executed by each slave before processing.
196 
198 {
199  // Get the weight
201 }
202 
203 ////////////////////////////////////////////////////////////////////////////////
204 /// Get weight from input list, if any
205 
207 {
208  Double_t ww;
209  if (TProof::GetParameter(fInput, "PROOF_ChainWeight", ww) == 0)
210  fWeight = ww;
211  PDB(kDraw,1) Info("FillWeight","fWeight= %f", fWeight);
212 }
213 
214 
215 ////////////////////////////////////////////////////////////////////////////////
216 /// Processes a single variable from an entry.
217 
219 {
220  Double_t w;
221  Double_t v[4]; //[TTreeDrawArgsParser::fgMaxDimension];
222 
223  if (fSelect)
224  w = fWeight * fSelect->EvalInstance(i);
225  else
226  w = fWeight;
227 
228  PDB(kDraw,3) Info("ProcessSingle","w[%d] = %f", i, w);
229 
230  if (w != 0.0) {
232  for (int j = 0; j < fDimension; j++)
233  v[j] = fVar[j]->EvalInstance(i);
234  if (fDimension >= 1)
235  PDB(kDraw,4) Info("Process","v[0] = %f", v[0]);
236  DoFill(entry, w, v);
237  }
238  return kTRUE;
239 }
240 
241 
242 ////////////////////////////////////////////////////////////////////////////////
243 /// Executed for each entry.
244 
246 {
247  PDB(kDraw,3) Info("Process", "enter entry = %lld", entry);
248 
249  fTree->LoadTree(entry);
250  Int_t ndata = fManager->GetNdata();
251 
252  PDB(kDraw,3) Info("Process","ndata = %d", ndata);
253 
254  for (Int_t i=0;i<ndata;i++) {
255  ProcessSingle(entry, i);
256  }
257  return kTRUE;
258 }
259 
260 
261 ////////////////////////////////////////////////////////////////////////////////
262 /// Executed by each slave after the processing has finished,
263 /// before returning the results to the client.
264 
266 {
267  PDB(kDraw,1) Info("SlaveTerminate","Enter");
268 }
269 
270 
271 ////////////////////////////////////////////////////////////////////////////////
272 /// Executed by the client after getting the processing retults.
273 
275 {
276  PDB(kDraw,1) Info("Terminate","Enter");
277  if (fStatus == 0) {
278  fStatus = dynamic_cast<TStatus*>(fOutput->FindObject("PROOF_Status"));
279  if (fStatus == 0) {
280  // did not run selector, error messages were already printed
281  return;
282  }
283  }
284 
285  if (!fStatus->IsOk()) {
286  fStatus->Print();
287  return;
288  }
289 }
290 
291 
292 ////////////////////////////////////////////////////////////////////////////////
293 /// Delete internal buffers.
294 
296 {
297  ResetBit(kWarn);
298  for (Int_t i = 0; i < 4; i++)
299  SafeDelete(fVar[i]);
300  SafeDelete(fSelect);
301  fManager = 0; // This is intentional. The manager is deleted when the last formula it manages
302  // is deleted. This is unusual but was usefull for backward compatibility.
303  fMultiplicity = 0;
304 }
305 
306 ////////////////////////////////////////////////////////////////////////////////
307 /// Move to a canvas named <name>_canvas; create the canvas if not existing.
308 /// Used to avoid screwing up existing plots when non default names are used
309 /// for the final objects
310 
311 void TProofDraw::SetCanvas(const char *objname)
312 {
313  TString name = objname;
314  if (!gPad) {
315  gROOT->MakeDefCanvas();
316  gPad->SetName(name);
317  PDB(kDraw,2) Info("SetCanvas", "created canvas %s", name.Data());
318  } else {
319  PDB(kDraw,2)
320  Info("SetCanvas", "using canvas %s", gPad->GetName());
321  }
322 }
323 
324 ////////////////////////////////////////////////////////////////////////////////
325 /// Set the drawing attributes from the input list
326 
328 {
329  Int_t att = -1;
330  PDB(kDraw,2) Info("SetDrawAtt", "setting attributes for %s", o->GetName());
331 
332  // Line Attributes
333  TAttLine *al = dynamic_cast<TAttLine *> (o);
334  if (al) {
335  // Line color
336  if (TProof::GetParameter(fInput, "PROOF_LineColor", att) == 0)
337  al->SetLineColor((Color_t)att);
338  // Line style
339  if (TProof::GetParameter(fInput, "PROOF_LineStyle", att) == 0)
340  al->SetLineStyle((Style_t)att);
341  // Line color
342  if (TProof::GetParameter(fInput, "PROOF_LineWidth", att) == 0)
343  al->SetLineWidth((Width_t)att);
344  PDB(kDraw,2) Info("SetDrawAtt", "line: c:%d, s:%d, wd:%d",
345  al->GetLineColor(), al->GetLineStyle(), al->GetLineWidth());
346  }
347 
348  // Marker Attributes
349  TAttMarker *am = dynamic_cast<TAttMarker *> (o);
350  if (am) {
351  // Marker color
352  if (TProof::GetParameter(fInput, "PROOF_MarkerColor", att) == 0)
353  am->SetMarkerColor((Color_t)att);
354  // Marker size
355  if (TProof::GetParameter(fInput, "PROOF_MarkerSize", att) == 0) {
356  Info("SetDrawAtt", "att: %d", att);
357  Float_t msz = (Float_t)att / 1000.;
358  am->SetMarkerSize((Size_t)msz);
359  }
360  // Marker style
361  if (TProof::GetParameter(fInput, "PROOF_MarkerStyle", att) == 0)
362  am->SetMarkerStyle((Style_t)att);
363  PDB(kDraw,2) Info("SetDrawAtt", "marker: c:%d, s:%d, sz:%f",
364  am->GetMarkerColor(), am->GetMarkerStyle(), am->GetMarkerSize());
365  }
366 
367  // Area Fill Attributes
368  TAttFill *af = dynamic_cast<TAttFill *> (o);
369  if (af) {
370  // Area fill color
371  if (TProof::GetParameter(fInput, "PROOF_FillColor", att) == 0)
372  af->SetFillColor((Color_t)att);
373  // Area fill style
374  if (TProof::GetParameter(fInput, "PROOF_FillStyle", att) == 0)
375  af->SetFillStyle((Style_t)att);
376  PDB(kDraw,2) Info("SetDrawAtt", "area: c:%d, s:%d",
377  af->GetFillColor(), af->GetFillStyle());
378  }
379 }
380 
381 ////////////////////////////////////////////////////////////////////////////////
382 /// Sets the error status.
383 
384 void TProofDraw::SetError(const char *sub, const char *mesg)
385 {
386  if (fStatus == 0) {
387  if (!(fStatus = dynamic_cast<TStatus*>(fOutput->FindObject("PROOF_Status"))))
388  return;
389  }
390 
391  TString m;
392  if (IsA())
393  m.Form("%s::%s: %s", IsA()->GetName(), sub, mesg);
394  else
395  m.Form("TProofDraw::%s: %s", sub, mesg);
396  fStatus->Add(m);
397 }
398 
399 
400 ////////////////////////////////////////////////////////////////////////////////
401 /// Compiles each variable from fTreeDrawArgsParser for the tree fTree.
402 /// Return kFALSE if any of the variable is not compilable.
403 
405 {
406  // Set aliases, if any
407  TNamed *nms = (TNamed *) fInput->FindObject("PROOF_ListOfAliases");
408  if (nms) {
409  TString names = nms->GetTitle(), n, na;
410  Ssiz_t from = 0;
411  while(names.Tokenize(n, from, ",")) {
412  if (!n.IsNull()) {
413  na.Form("alias:%s", n.Data());
414  TNamed *nm = (TNamed *) fInput->FindObject(na);
415  if (na) fTree->SetAlias(n.Data(), nm->GetTitle());
416  }
417  }
418  }
419  PDB(kDraw,2)
420  if (fTree->GetListOfAliases()) fTree->GetListOfAliases()->Print();
421 
422  fDimension = fTreeDrawArgsParser.GetDimension();
423  fMultiplicity = 0;
424  fObjEval = kFALSE;
425  if (strlen(fTreeDrawArgsParser.GetSelection())) {
426  fSelect = new TTreeFormula("Selection", fTreeDrawArgsParser.GetSelection(), fTree);
427  fSelect->SetQuickLoad(kTRUE);
428  if (!fSelect->GetNdim()) {delete fSelect; fSelect = 0; return kFALSE; }
429  }
430 
431  fManager = new TTreeFormulaManager();
432  if (fSelect) fManager->Add(fSelect);
433  fTree->ResetBit(TTree::kForceRead);
434 
435  for (int i = 0; i < fDimension; i++) {
436  fVar[i] = new TTreeFormula(Form("Var%d", i),fTreeDrawArgsParser.GetVarExp(i),fTree);
437  fVar[i]->SetQuickLoad(kTRUE);
438  if (!fVar[i]->GetNdim()) {
439  ClearFormula();
440  Error("CompileVariables", "Error compiling expression");
441  SetError("CompileVariables", "Error compiling variables");
442 
443  return kFALSE;
444  }
445  fManager->Add(fVar[i]);
446  }
447 
448  fManager->Sync();
449  if (fManager->GetMultiplicity()==-1) fTree->SetBit(TTree::kForceRead);
450  if (fManager->GetMultiplicity()>=1) fMultiplicity = fManager->GetMultiplicity();
451 
452  return kTRUE;
453 #if 0
454  // Commenting out to silence Coverity:
455  // but why was this made inactive?
456  if (fDimension==1) {
457  TClass *cl = fVar[0]->EvalClass();
458  if (cl) {
459  fObjEval = kTRUE;
460  }
461  }
462  return kTRUE;
463 #endif
464 }
465 
466 
468 
469 
470 ////////////////////////////////////////////////////////////////////////////////
471 /// Initialization for 1D Histogram.
472 
473 void TProofDrawHist::Begin1D(TTree *)
474 {
475  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 1);
476  TObject* orig = fTreeDrawArgsParser.GetOriginal();
477  TH1* hold;
478  if (fTreeDrawArgsParser.GetNoParameters() == 0 && (hold = dynamic_cast<TH1*> (orig))) {
479  hold->Reset();
480  fInput->Add(hold);
481  } else {
482  delete orig;
483  DefVar1D();
484  }
485 }
486 
487 
488 ////////////////////////////////////////////////////////////////////////////////
489 /// Initialization for 2D histogram.
490 
492 {
493  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 2);
494  TObject* orig = fTreeDrawArgsParser.GetOriginal();
495  TH2* hold;
496  if (fTreeDrawArgsParser.GetNoParameters() == 0 && (hold = dynamic_cast<TH2*> (orig))) {
497  hold->Reset();
498  fInput->Add(hold);
499  } else {
500  delete orig;
501  DefVar2D();
502  }
503 }
504 
505 
506 ////////////////////////////////////////////////////////////////////////////////
507 /// Initialization for 3D histogram.
508 
510 {
511  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
512  TObject* orig = fTreeDrawArgsParser.GetOriginal();
513  TH3* hold;
514  if ((hold = dynamic_cast<TH3*> (orig)) && fTreeDrawArgsParser.GetNoParameters() == 0) {
515  hold->Reset();
516  fInput->Add(hold);
517  } else {
518  delete orig;
519  DefVar3D();
520  }
521 }
522 
523 ////////////////////////////////////////////////////////////////////////////////
524 /// See TProofDraw::Begin().
525 
527 {
528  PDB(kDraw,1) Info("Begin","Enter tree = %p", tree);
529 
530  TObject *os = fInput->FindObject("selection");
531  TObject *ov = fInput->FindObject("varexp");
532 
533  if (os && ov) {
534  fSelection = os->GetTitle();
535  fInitialExp = ov->GetTitle();
536 
537  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
538  if (fTreeDrawArgsParser.GetObjectName() == "")
539  fTreeDrawArgsParser.SetObjectName("htemp");
540 
541  switch (fTreeDrawArgsParser.GetDimension()) {
542  case 1:
543  Begin1D(tree);
544  break;
545  case 2:
546  Begin2D(tree);
547  break;
548  case 3:
549  Begin3D(tree);
550  break;
551  default:
552  Error("Begin", "Wrong dimension");
553  break;
554  }
555  }
556  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
557  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
558  fTree = 0;
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Define vars for 1D Histogram.
563 
565 {
566  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 1);
567 
568  fTreeDrawArgsParser.SetOriginal(0);
569  TString exp = fTreeDrawArgsParser.GetVarExp();
570  exp += ">>";
571  double binsx, minx, maxx;
572  if (fTreeDrawArgsParser.IsSpecified(0))
573  gEnv->SetValue("Hist.Binning.1D.x", fTreeDrawArgsParser.GetParameter(0));
574  binsx = gEnv->GetValue("Hist.Binning.1D.x",100);
575  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
576  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
577  exp += fTreeDrawArgsParser.GetObjectName();
578  exp += '(';
579  exp += binsx;
580  exp += ',';
581  exp += minx;
582  exp += ',';
583  exp += maxx;
584  exp += ')';
585 
586  fInitialExp = exp;
587  TNamed *n = dynamic_cast<TNamed*> (fInput->FindObject("varexp"));
588  if (n)
589  n->SetTitle(exp);
590  else
591  Error("DefVar1D", "Cannot find varexp on the fInput");
592  if (fTreeDrawArgsParser.GetNoParameters() != 3)
593  fInput->Add(new TNamed("PROOF_OPTIONS", "rebin"));
594 }
595 
596 ////////////////////////////////////////////////////////////////////////////////
597 /// Define variables for 2D histogram.
598 
600 {
601  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 2);
602 
603  fTreeDrawArgsParser.SetOriginal(0);
604  TString exp = fTreeDrawArgsParser.GetVarExp();
605  exp += ">>";
606  double binsx, minx, maxx;
607  double binsy, miny, maxy;
608  if (fTreeDrawArgsParser.IsSpecified(0))
609  gEnv->SetValue("Hist.Binning.2D.x", fTreeDrawArgsParser.GetParameter(0));
610  if (fTreeDrawArgsParser.IsSpecified(3))
611  gEnv->SetValue("Hist.Binning.2D.y", fTreeDrawArgsParser.GetParameter(3));
612  binsx = gEnv->GetValue("Hist.Binning.2D.x",100);
613  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
614  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
615  binsy = gEnv->GetValue("Hist.Binning.2D.y",100);
616  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
617  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
618  exp += fTreeDrawArgsParser.GetObjectName();
619  exp += '(';
620  exp += binsx;
621  exp += ',';
622  exp += minx;
623  exp += ',';
624  exp += maxx;
625  exp += ',';
626  exp += binsy;
627  exp += ',';
628  exp += miny;
629  exp += ',';
630  exp += maxy;
631  exp += ')';
632  fInitialExp = exp;
633  TNamed *n = dynamic_cast<TNamed*> (fInput->FindObject("varexp"));
634  if (n)
635  n->SetTitle(exp);
636  else
637  Error("DefVar2D", "Cannot find varexp on the fInput");
638  if (fTreeDrawArgsParser.GetNoParameters() != 6)
639  fInput->Add(new TNamed("PROOF_OPTIONS", "rebin"));
640 }
641 
642 ////////////////////////////////////////////////////////////////////////////////
643 /// Define variables for 3D histogram.
644 
646 {
647  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
648 
649  fTreeDrawArgsParser.SetOriginal(0);
650  TString exp = fTreeDrawArgsParser.GetVarExp();
651  exp += ">>";
652  double binsx, minx, maxx;
653  double binsy, miny, maxy;
654  double binsz, minz, maxz;
655  if (fTreeDrawArgsParser.IsSpecified(0))
656  gEnv->SetValue("Hist.Binning.3D.x", fTreeDrawArgsParser.GetParameter(0));
657  if (fTreeDrawArgsParser.IsSpecified(3))
658  gEnv->SetValue("Hist.Binning.3D.y", fTreeDrawArgsParser.GetParameter(3));
659  if (fTreeDrawArgsParser.IsSpecified(6))
660  gEnv->SetValue("Hist.Binning.3D.z", fTreeDrawArgsParser.GetParameter(6));
661  binsx = gEnv->GetValue("Hist.Binning.3D.x",100);
662  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
663  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
664  binsy = gEnv->GetValue("Hist.Binning.3D.y",100);
665  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
666  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
667  binsz = gEnv->GetValue("Hist.Binning.3D.z",100);
668  minz = fTreeDrawArgsParser.GetIfSpecified(7, 0);
669  maxz = fTreeDrawArgsParser.GetIfSpecified(8, 0);
670  exp += fTreeDrawArgsParser.GetObjectName();
671  exp += '(';
672  exp += binsx;
673  exp += ',';
674  exp += minx;
675  exp += ',';
676  exp += maxx;
677  exp += ',';
678  exp += binsy;
679  exp += ',';
680  exp += miny;
681  exp += ',';
682  exp += maxy;
683  exp += ',';
684  exp += binsz;
685  exp += ',';
686  exp += minz;
687  exp += ',';
688  exp += maxz;
689  exp += ')';
690  fInitialExp = exp;
691  TNamed *n = dynamic_cast<TNamed*> (fInput->FindObject("varexp"));
692  if (n)
693  n->SetTitle(exp);
694  else
695  Error("DefVar3D", "Cannot find varexp on the fInput");
696  if (fTreeDrawArgsParser.GetNoParameters() != 9)
697  fInput->Add(new TNamed("PROOF_OPTIONS", "rebin"));
698 }
699 
700 ////////////////////////////////////////////////////////////////////////////////
701 /// Define variables according to arguments.
702 
704 {
705  PDB(kDraw,1) Info("DefVar","Enter");
706 
707  TObject *os = fInput->FindObject("selection");
708  TObject *ov = fInput->FindObject("varexp");
709 
710  if (os && ov) {
711  fSelection = os->GetTitle();
712  fInitialExp = ov->GetTitle();
713 
714  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
715  if (fTreeDrawArgsParser.GetObjectName() == "")
716  fTreeDrawArgsParser.SetObjectName("htemp");
717 
718  switch (fTreeDrawArgsParser.GetDimension()) {
719  case 1:
720  DefVar1D();
721  break;
722  case 2:
723  DefVar2D();
724  break;
725  case 3:
726  DefVar3D();
727  break;
728  default:
729  Error("DefVar", "Wrong dimension");
730  break;
731  }
732  }
733  PDB(kDraw,1) Info("DefVar","selection: %s", fSelection.Data());
734  PDB(kDraw,1) Info("DefVar","varexp: %s", fInitialExp.Data());
735  fTree = 0;
736 }
737 
738 ////////////////////////////////////////////////////////////////////////////////
739 /// See TProofDraw::Init().
740 
742 {
743  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
744  if (fTree == 0) {
745  if (!dynamic_cast<TH1*> (fTreeDrawArgsParser.GetOriginal())) {
746  fHistogram->SetLineColor(tree->GetLineColor());
747  fHistogram->SetLineWidth(tree->GetLineWidth());
748  fHistogram->SetLineStyle(tree->GetLineStyle());
749  fHistogram->SetFillColor(tree->GetFillColor());
750  fHistogram->SetFillStyle(tree->GetFillStyle());
751  fHistogram->SetMarkerStyle(tree->GetMarkerStyle());
752  fHistogram->SetMarkerColor(tree->GetMarkerColor());
753  fHistogram->SetMarkerSize(tree->GetMarkerSize());
754  }
755  }
756  fTree = tree;
757  CompileVariables();
758 }
759 
760 
761 ////////////////////////////////////////////////////////////////////////////////
762 /// See TProofDraw::SlaveBegin().
763 
765 {
766  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
767 
768  // Get the weight
770 
771  TObject *os = fInput->FindObject("selection");
772  TObject *ov = fInput->FindObject("varexp");
773 
774  if (os && ov) {
775  fSelection = os->GetTitle();
776  fInitialExp = ov->GetTitle();
777 
778  SafeDelete(fHistogram);
779 
780  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
781  fDimension = fTreeDrawArgsParser.GetDimension();
782  TString exp = fTreeDrawArgsParser.GetExp();
783  const char *objname = fTreeDrawArgsParser.GetObjectName();
784  if (objname && strlen(objname) > 0 && strcmp(objname, "htemp")) {
785  TH1 *hist = dynamic_cast<TH1*> (fInput->FindObject(objname));
786  if (hist) {
787  fHistogram = (TH1 *) hist->Clone();
788  PDB(kDraw,1) Info("SlaveBegin","original histogram found");
789  } else {
790  PDB(kDraw,1) Info("SlaveBegin", "original object '%s' not found"
791  " or it is not a histogram", objname);
792  }
793  }
794 
795  // Create the histogram if not found in the input list
796  if (!fHistogram) {
797  Int_t countx = 100; double minx = 0, maxx = 0;
798  Int_t county = 100; double miny = 0, maxy = 0;
799  Int_t countz = 100; double minz = 0, maxz = 0;
800  if (fTreeDrawArgsParser.GetNoParameters() != 0) {
801  countx = (Int_t) fTreeDrawArgsParser.GetIfSpecified(0, countx);
802  county = (Int_t) fTreeDrawArgsParser.GetIfSpecified(3, county);
803  countz = (Int_t) fTreeDrawArgsParser.GetIfSpecified(6, countz);
804  minx = fTreeDrawArgsParser.GetIfSpecified(1, minx);
805  maxx = fTreeDrawArgsParser.GetIfSpecified(2, maxx);
806  miny = fTreeDrawArgsParser.GetIfSpecified(4, miny);
807  maxy = fTreeDrawArgsParser.GetIfSpecified(5, maxy);
808  minz = fTreeDrawArgsParser.GetIfSpecified(7, minz);
809  maxz = fTreeDrawArgsParser.GetIfSpecified(8, maxz);
810  }
811  if (fTreeDrawArgsParser.GetNoParameters() != 3*fDimension)
812  Error("SlaveBegin", "Impossible - Wrong number of parameters");
813 
814  if (fDimension == 1)
815  fHistogram = new TH1F(fTreeDrawArgsParser.GetObjectName(),
816  fTreeDrawArgsParser.GetObjectTitle(),
817  countx, minx, maxx);
818  else if (fDimension == 2){
819  fHistogram = new TH2F(fTreeDrawArgsParser.GetObjectName(),
820  fTreeDrawArgsParser.GetObjectTitle(),
821  countx, minx, maxx,
822  county, miny, maxy);
823  }
824  else if (fDimension == 3) {
825  fHistogram = new TH3F(fTreeDrawArgsParser.GetObjectName(),
826  fTreeDrawArgsParser.GetObjectTitle(),
827  countx, minx, maxx,
828  county, miny, maxy,
829  countz, minz, maxz);
830  } else {
831  Info("Begin", "Wrong dimension");
832  return; // FIXME: end the session
833  }
834  if (minx >= maxx)
835  fHistogram->SetBuffer(TH1::GetDefaultBufferSize());
836  if (TNamed *opt = dynamic_cast<TNamed*> (fInput->FindObject("PROOF_OPTIONS"))) {
837  if (strstr(opt->GetTitle(), "rebin"))
838  fHistogram->SetCanExtend(TH1::kAllAxes);
839  }
840  }
841  fHistogram->SetDirectory(0); // take ownership
842  fOutput->Add(fHistogram); // release ownership
843  }
844 
845  fTree = 0;
846  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
847  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
848 }
849 
850 
851 ////////////////////////////////////////////////////////////////////////////////
852 /// Fills the histgram with given values.
853 
855 {
856  if (fDimension == 1)
857  fHistogram->Fill(v[0], w);
858  else if (fDimension == 2)
859  ((TH2F *)fHistogram)->Fill(v[1], v[0], w);
860  else if (fDimension == 3)
861  ((TH3F *)fHistogram)->Fill(v[2], v[1], v[0], w);
862 }
863 
864 
865 ////////////////////////////////////////////////////////////////////////////////
866 /// See TProofDraw::Terminate().
867 
869 {
870  PDB(kDraw,1) Info("Terminate","Enter");
872  if (!fStatus)
873  return;
874 
875  fHistogram = (TH1F *) fOutput->FindObject(fTreeDrawArgsParser.GetObjectName());
876  if (fHistogram) {
877  SetStatus((Int_t) fHistogram->GetEntries());
878  TH1 *h = 0;
879  if ((h = dynamic_cast<TH1*> (fTreeDrawArgsParser.GetOriginal()))) {
880  if (!fTreeDrawArgsParser.GetAdd())
881  h->Reset();
882  TList l;
883  l.Add(fHistogram);
884  h->Merge(&l);
885  l.Remove(fHistogram);
886  fOutput->Remove(fHistogram);
887  delete fHistogram;
888  } else {
889  // Set the title
890  fHistogram->SetTitle(fTreeDrawArgsParser.GetObjectTitle());
891  h = fHistogram;
892  }
893  if (fTreeDrawArgsParser.GetShouldDraw()) {
894  // Choose the right canvas
895  SetCanvas(h->GetName());
896  // Draw
897  SetDrawAtt(h);
898  h->Draw(fOption.Data());
899  }
900  }
901  fHistogram = 0;
902 }
903 
905 
906 ////////////////////////////////////////////////////////////////////////////////
907 /// See TProofDraw::Init().
908 
910 {
911  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
912 
913  if (fTree) { // new tree is being set
914  if (!fElist)
915  Error("Init", "Impossible - fElist cannot be 0");
916  fEventLists->Add(fElist);
917  }
918  fElist = new TEventList(tree->GetDirectory()->GetName(), tree->GetName());
919  fTree = tree;
920  CompileVariables();
921 }
922 
923 
924 ////////////////////////////////////////////////////////////////////////////////
925 /// See TProofDraw::SlaveBegin().
926 
928 {
929  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
930 
931  // Get the weight
933 
934  TObject *os = fInput->FindObject("selection");
935  TObject *ov = fInput->FindObject("varexp");
936 
937  if (os && ov) {
938  fSelection = os->GetTitle();
939  fInitialExp = ov->GetTitle();
940 
941  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
942 
943  SafeDelete(fEventLists);
944 
945  fDimension = 0;
946  fTree = 0;
947  fEventLists = new TList();
948  fEventLists->SetName("PROOF_EventListsList");
949  fOutput->Add(fEventLists);
950  }
951 
952  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
953  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
954 }
955 
956 
957 ////////////////////////////////////////////////////////////////////////////////
958 /// Fills the eventlist with given values.
959 
961 {
962  fElist->Enter(entry);
963 }
964 
965 
966 ////////////////////////////////////////////////////////////////////////////////
967 /// See TProofDraw::SlaveTerminate().
968 
970 {
971  PDB(kDraw,1) Info("SlaveTerminate","Enter");
972  fEventLists->Add(fElist);
973 }
974 
975 
976 ////////////////////////////////////////////////////////////////////////////////
977 /// See TProofDraw::Terminate().
978 
980 {
981  TProofDraw::Terminate(); // take care of fStatus
982  if (!fStatus)
983  return;
984 
985  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
986 
987  TEventList *el = dynamic_cast<TEventList*> (fOutput->FindObject("PROOF_EventList"));
988  if (el) {
989  el->SetName(fInitialExp.Data()+2);
990  SetStatus(el->GetN());
991  if (TEventList* old = dynamic_cast<TEventList*> (fTreeDrawArgsParser.GetOriginal())) {
992  if (!fTreeDrawArgsParser.GetAdd())
993  old->Reset();
994  old->Add(el);
995  fOutput->Remove(el);
996  delete el;
997  }
998  }
999  else
1000  Error("Terminate", "Cannot find output EventList");
1001 
1002 }
1003 
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// See TProofDraw::Init().
1008 
1010 {
1011  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
1012 
1013  fTree = tree;
1014  CompileVariables();
1015 }
1016 
1017 ////////////////////////////////////////////////////////////////////////////////
1018 /// See TProofDraw::SlaveBegin().
1019 
1021 {
1022  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1023 
1024  // Get the weight
1026 
1027  TObject *os = fInput->FindObject("selection");
1028  TObject *ov = fInput->FindObject("varexp");
1029 
1030  if (os && ov) {
1031  fSelection = os->GetTitle();
1032  fInitialExp = ov->GetTitle();
1033 
1034  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1035 
1036  SafeDelete(fElist);
1037 
1038  fDimension = 0;
1039  fTree = 0;
1040  fElist = new TEntryList("PROOF_EntryList", "PROOF_EntryList");
1041  fOutput->Add(fElist);
1042  }
1043 
1044  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1045  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1046 }
1047 
1048 ////////////////////////////////////////////////////////////////////////////////
1049 /// Fills the eventlist with given values.
1050 
1052 {
1053  fElist->Enter(entry);
1054 }
1055 
1056 ////////////////////////////////////////////////////////////////////////////////
1057 /// See TProofDraw::SlaveTerminate().
1058 
1060 {
1061  PDB(kDraw,1) Info("SlaveTerminate","Enter");
1062  fElist->OptimizeStorage();
1063 }
1064 
1065 ////////////////////////////////////////////////////////////////////////////////
1066 /// See TProofDraw::Terminate().
1067 
1069 {
1070  TProofDraw::Terminate(); // take care of fStatus
1071  if (!fStatus)
1072  return;
1073 
1074  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1075 
1076  TEntryList *el = dynamic_cast<TEntryList*> (fOutput->FindObject("PROOF_EntryList"));
1077 
1078  if (el) {
1079  el->SetName(fInitialExp.Data()+2);
1080  SetStatus(el->GetN());
1081  if (TEntryList* old = dynamic_cast<TEntryList*> (fTreeDrawArgsParser.GetOriginal())) {
1082  if (!fTreeDrawArgsParser.GetAdd())
1083  old->Reset();
1084  old->Add(el);
1085  fOutput->Remove(el);
1086  delete el;
1087  }
1088  }
1089  else
1090  Error("Terminate", "Cannot find output EventList");
1091 
1092 }
1093 
1095 
1096 ////////////////////////////////////////////////////////////////////////////////
1097 /// See TProofDraw::Init().
1098 
1100 {
1101  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
1102 
1103  if (fTree == 0) {
1104  if (!dynamic_cast<TProfile*> (fTreeDrawArgsParser.GetOriginal())) {
1105  fProfile->SetLineColor(tree->GetLineColor());
1106  fProfile->SetLineWidth(tree->GetLineWidth());
1107  fProfile->SetLineStyle(tree->GetLineStyle());
1108  fProfile->SetFillColor(tree->GetFillColor());
1109  fProfile->SetFillStyle(tree->GetFillStyle());
1110  fProfile->SetMarkerStyle(tree->GetMarkerStyle());
1111  fProfile->SetMarkerColor(tree->GetMarkerColor());
1112  fProfile->SetMarkerSize(tree->GetMarkerSize());
1113  }
1114  }
1115  fTree = tree;
1116  CompileVariables();
1117 }
1118 
1119 ////////////////////////////////////////////////////////////////////////////////
1120 /// Define relevant variables
1121 
1123 {
1124  PDB(kDraw,1) Info("DefVar","Enter");
1125 
1126  if (fTreeDrawArgsParser.GetDimension() < 0) {
1127 
1128  // Init parser
1129  TObject *os = fInput->FindObject("selection");
1130  TObject *ov = fInput->FindObject("varexp");
1131 
1132  if (os && ov) {
1133  fSelection = ov->GetTitle();
1134  fInitialExp = ov->GetTitle();
1135 
1136  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1137  }
1138  }
1139 
1140  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 2);
1141 
1142  fTreeDrawArgsParser.SetOriginal(0);
1143  TString exp = fTreeDrawArgsParser.GetVarExp();
1144  exp += ">>";
1145  double binsx, minx, maxx;
1146  if (fTreeDrawArgsParser.IsSpecified(0))
1147  gEnv->SetValue("Hist.Binning.2D.Prof", fTreeDrawArgsParser.GetParameter(0));
1148  binsx = gEnv->GetValue("Hist.Binning.2D.Prof",100);
1149  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
1150  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
1151  if (fTreeDrawArgsParser.GetObjectName() == "")
1152  fTreeDrawArgsParser.SetObjectName("htemp");
1153  exp += fTreeDrawArgsParser.GetObjectName();
1154  exp += '(';
1155  exp += binsx;
1156  exp += ',';
1157  exp += minx;
1158  exp += ',';
1159  exp += maxx;
1160  exp += ')';
1161  fInitialExp = exp;
1162  TNamed *n = dynamic_cast<TNamed*> (fInput->FindObject("varexp"));
1163  if (n)
1164  n->SetTitle(exp);
1165  else
1166  Error("DefVar", "Cannot find varexp on the fInput");
1167  if (fTreeDrawArgsParser.GetNoParameters() != 3)
1168  fInput->Add(new TNamed("PROOF_OPTIONS", "rebin"));
1169 }
1170 
1171 ////////////////////////////////////////////////////////////////////////////////
1172 /// See TProofDraw::Begin().
1173 
1175 {
1176  PDB(kDraw,1) Info("Begin","Enter tree = %p", tree);
1177 
1178 
1179  TObject *os = fInput->FindObject("selection");
1180  TObject *ov = fInput->FindObject("varexp");
1181 
1182  if (os && ov) {
1183  fSelection = os->GetTitle();
1184  fInitialExp = ov->GetTitle();
1185 
1186  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1187 
1188  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 2);
1189 
1190  TObject *orig = fTreeDrawArgsParser.GetOriginal();
1191  TH1* pold;
1192  if ((pold = dynamic_cast<TProfile*> (orig)) && fTreeDrawArgsParser.GetNoParameters() == 0) {
1193  TProfile* pnew = (TProfile*) pold->Clone();
1194  pnew->Reset();
1195  fInput->Add(pnew);
1196  } else {
1197  delete orig;
1198  DefVar();
1199  }
1200  }
1201  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1202  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1203  fTree = 0;
1204 }
1205 
1206 
1207 ////////////////////////////////////////////////////////////////////////////////
1208 /// See TProofDraw::SlaveBegin().
1209 
1211 {
1212  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1213 
1214  // Get the weight
1216 
1217 
1218  TObject *os = fInput->FindObject("selection");
1219  TObject *ov = fInput->FindObject("varexp");
1220 
1221  if (os && ov) {
1222  fSelection = os->GetTitle();
1223  fInitialExp = ov->GetTitle();
1224 
1225  SafeDelete(fProfile);
1226 
1227 
1228  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1229  fDimension = 2;
1230  TString exp = fTreeDrawArgsParser.GetExp();
1231 
1232  if (fTreeDrawArgsParser.GetOriginal()) {
1233  fProfile = dynamic_cast<TProfile*> (fTreeDrawArgsParser.GetOriginal());
1234  if (fProfile) {
1235  fOutput->Add(fProfile);
1236  PDB(kDraw,1) Info("SlaveBegin","Original profile histogram found");
1237  return;
1238  }
1239  else
1240  Error("SlaveBegin","Original object found but it is not a histogram");
1241  }
1242  Int_t countx = 100; double minx = 0, maxx = 0;
1243  if (fTreeDrawArgsParser.GetNoParameters() != 0) {
1244  countx = (Int_t) fTreeDrawArgsParser.GetIfSpecified(0, countx);
1245  minx = fTreeDrawArgsParser.GetIfSpecified(1, minx);
1246  maxx = fTreeDrawArgsParser.GetIfSpecified(2, maxx);
1247  }
1248  if (fTreeDrawArgsParser.GetNoParameters() != 3)
1249  Error("SlaveBegin", "Impossible - Wrong number of parameters");
1250  TString constructorOptions = "";
1251  if (fOption.Contains("profs"))
1252  constructorOptions = "s";
1253  else if (fOption.Contains("profi"))
1254  constructorOptions = "i";
1255  else if (fOption.Contains("profg"))
1256  constructorOptions = "g";
1257 
1258  fProfile = new TProfile(fTreeDrawArgsParser.GetObjectName(),
1259  fTreeDrawArgsParser.GetObjectTitle(),
1260  countx, minx, maxx,
1261  constructorOptions);
1262  if (minx >= maxx)
1263  fProfile->SetBuffer(TH1::GetDefaultBufferSize());
1264 
1265  if (TNamed *opt = dynamic_cast<TNamed*> (fInput->FindObject("PROOF_OPTIONS"))) {
1266  if (strstr(opt->GetTitle(), "rebin"))
1267  fProfile->SetCanExtend(TH1::kAllAxes);
1268  }
1269  fProfile->SetDirectory(0); // take ownership
1270  fOutput->Add(fProfile); // release ownership
1271  }
1272  fTree = 0;
1273  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1274  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1275 }
1276 
1277 
1278 ////////////////////////////////////////////////////////////////////////////////
1279 /// Fills the profile histogram with the given values.
1280 
1282 {
1283  fProfile->Fill(v[1], v[0], w);
1284 }
1285 
1286 
1287 ////////////////////////////////////////////////////////////////////////////////
1288 /// See TProofDraw::Terminate().
1289 
1291 {
1292  PDB(kDraw,1) Info("Terminate","Enter");
1294  if (!fStatus)
1295  return;
1296 
1297  fProfile = (TProfile *) fOutput->FindObject(fTreeDrawArgsParser.GetObjectName());
1298  if (fProfile) {
1299  SetStatus((Int_t) fProfile->GetEntries());
1300  TProfile *pf = 0;
1301  if ((pf = dynamic_cast<TProfile*> (fTreeDrawArgsParser.GetOriginal()))) {
1302  if (!fTreeDrawArgsParser.GetAdd())
1303  pf->Reset();
1304  TList l;
1305  l.Add(fProfile);
1306  pf->Merge(&l);
1307  l.Remove(fProfile);
1308  fOutput->Remove(fProfile);
1309  delete fProfile;
1310  } else {
1311  fProfile->SetTitle(fTreeDrawArgsParser.GetObjectTitle());
1312  pf = fProfile;
1313  }
1314  if (fTreeDrawArgsParser.GetShouldDraw()) {
1315  // Choose the right canvas
1316  SetCanvas(pf->GetName());
1317  // Draw
1318  SetDrawAtt(pf);
1319  pf->Draw(fOption.Data());
1320  }
1321  }
1322  fProfile = 0;
1323 }
1324 
1325 
1327 
1328 ////////////////////////////////////////////////////////////////////////////////
1329 /// See TProofDraw::Init().
1330 
1332 {
1333  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
1334  if (fTree == 0) {
1335  if (!dynamic_cast<TProfile2D*> (fTreeDrawArgsParser.GetOriginal())) {
1336  fProfile->SetLineColor(tree->GetLineColor());
1337  fProfile->SetLineWidth(tree->GetLineWidth());
1338  fProfile->SetLineStyle(tree->GetLineStyle());
1339  fProfile->SetFillColor(tree->GetFillColor());
1340  fProfile->SetFillStyle(tree->GetFillStyle());
1341  fProfile->SetMarkerStyle(tree->GetMarkerStyle());
1342  fProfile->SetMarkerColor(tree->GetMarkerColor());
1343  fProfile->SetMarkerSize(tree->GetMarkerSize());
1344  }
1345  }
1346 
1347  fTree = tree;
1348  CompileVariables();
1349 }
1350 
1351 ////////////////////////////////////////////////////////////////////////////////
1352 /// Define relevant variables
1353 
1355 {
1356  PDB(kDraw,1) Info("DefVar","Enter");
1357 
1358  if (fTreeDrawArgsParser.GetDimension() < 0) {
1359 
1360  // Init parser
1361  TObject *os = fInput->FindObject("selection");
1362  TObject *ov = fInput->FindObject("varexp");
1363 
1364  if (os && ov) {
1365  fSelection = os->GetTitle();
1366  fInitialExp = ov->GetTitle();
1367 
1368  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1369  }
1370  }
1371  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
1372 
1373  fTreeDrawArgsParser.SetOriginal(0);
1374  TString exp = fTreeDrawArgsParser.GetVarExp();
1375  exp += ">>";
1376  double binsx, minx, maxx;
1377  double binsy, miny, maxy;
1378  if (fTreeDrawArgsParser.IsSpecified(0))
1379  gEnv->SetValue("Hist.Binning.3D.Profx", fTreeDrawArgsParser.GetParameter(0));
1380  if (fTreeDrawArgsParser.IsSpecified(3))
1381  gEnv->SetValue("Hist.Binning.3D.Profy", fTreeDrawArgsParser.GetParameter(3));
1382  binsx = gEnv->GetValue("Hist.Binning.3D.Profx",20);
1383  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
1384  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
1385  binsy = gEnv->GetValue("Hist.Binning.3D.Profy",20);
1386  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
1387  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
1388  if (fTreeDrawArgsParser.GetObjectName() == "")
1389  fTreeDrawArgsParser.SetObjectName("htemp");
1390  exp += fTreeDrawArgsParser.GetObjectName();
1391  exp += '(';
1392  exp += binsx;
1393  exp += ',';
1394  exp += minx;
1395  exp += ',';
1396  exp += maxx;
1397  exp += ',';
1398  exp += binsy;
1399  exp += ',';
1400  exp += miny;
1401  exp += ',';
1402  exp += maxy;
1403  exp += ')';
1404  fInitialExp = exp;
1405  TNamed *n = dynamic_cast<TNamed*> (fInput->FindObject("varexp"));
1406  if (n)
1407  n->SetTitle(exp);
1408  else
1409  Error("DefVar", "Cannot find varexp on the fInput");
1410  if (fTreeDrawArgsParser.GetNoParameters() != 6)
1411  fInput->Add(new TNamed("PROOF_OPTIONS", "rebin"));
1412 }
1413 
1414 ////////////////////////////////////////////////////////////////////////////////
1415 /// See TProofDraw::Begin().
1416 
1418 {
1419  PDB(kDraw,1) Info("Begin","Enter tree = %p", tree);
1420 
1421  TObject *os = fInput->FindObject("selection");
1422  TObject *ov = fInput->FindObject("varexp");
1423 
1424  if (os && ov) {
1425  fSelection = os->GetTitle();
1426  fInitialExp = ov->GetTitle();
1427 
1428  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1429 
1430  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
1431 
1432  TObject *orig = fTreeDrawArgsParser.GetOriginal();
1433  TProfile2D *pold;
1434  if ((pold = dynamic_cast<TProfile2D*> (orig)) && fTreeDrawArgsParser.GetNoParameters() == 0) {
1435  TProfile2D* pnew = (TProfile2D*) pold->Clone();
1436  pnew->Reset();
1437  fInput->Add(pnew);
1438  } else {
1439  delete orig;
1440  DefVar();
1441  }
1442  }
1443  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1444  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1445 }
1446 
1447 ////////////////////////////////////////////////////////////////////////////////
1448 /// See TProofDraw::SlaveBegin().
1449 
1451 {
1452  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1453 
1454  // Get the weight
1456 
1457  TObject *os = fInput->FindObject("selection");
1458  TObject *ov = fInput->FindObject("varexp");
1459 
1460  if (os && ov) {
1461  fSelection = os->GetTitle();
1462  fInitialExp = ov->GetTitle();
1463 
1464  SafeDelete(fProfile);
1465 
1466  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1467  fDimension = 2;
1468  TString exp = fTreeDrawArgsParser.GetExp();
1469 
1470  if (fTreeDrawArgsParser.GetOriginal()) {
1471  fProfile = dynamic_cast<TProfile2D*> (fTreeDrawArgsParser.GetOriginal());
1472  if (fProfile) {
1473  fOutput->Add(fProfile);
1474  PDB(kDraw,1) Info("SlaveBegin","Original profile histogram found");
1475  return;
1476  } else
1477  Error("SlaveBegin","Original object found but it is not a histogram");
1478  }
1479  Int_t countx = 40; double minx = 0, maxx = 0;
1480  Int_t county = 40; double miny = 0, maxy = 0;
1481  if (fTreeDrawArgsParser.GetNoParameters() != 0) {
1482  countx = (Int_t) fTreeDrawArgsParser.GetIfSpecified(0, countx);
1483  minx = fTreeDrawArgsParser.GetIfSpecified(1, minx);
1484  maxx = fTreeDrawArgsParser.GetIfSpecified(2, maxx);
1485  county = (Int_t) fTreeDrawArgsParser.GetIfSpecified(3, countx);
1486  miny = fTreeDrawArgsParser.GetIfSpecified(4, minx);
1487  maxy = fTreeDrawArgsParser.GetIfSpecified(5, maxx);
1488  }
1489  if (fTreeDrawArgsParser.GetNoParameters() != 6)
1490  Error("SlaveBegin", "Impossible - Wrong number of parameters");
1491 
1492  TString constructorOptions = "";
1493  if (fOption.Contains("profs"))
1494  constructorOptions = "s";
1495  else if (fOption.Contains("profi"))
1496  constructorOptions = "i";
1497  else if (fOption.Contains("profg"))
1498  constructorOptions = "g";
1499 
1500  fProfile = new TProfile2D(fTreeDrawArgsParser.GetObjectName(),
1501  fTreeDrawArgsParser.GetObjectTitle(),
1502  countx, minx, maxx,
1503  county, miny, maxy,
1504  constructorOptions);
1505  if (minx >= maxx)
1506  fProfile->SetBuffer(TH1::GetDefaultBufferSize());
1507 
1508  if (TNamed *opt = dynamic_cast<TNamed*> (fInput->FindObject("PROOF_OPTIONS"))) {
1509  if (strstr(opt->GetTitle(), "rebin"))
1510  fProfile->SetCanExtend(TH1::kAllAxes);
1511  }
1512  fProfile->SetDirectory(0); // take ownership
1513  fOutput->Add(fProfile); // release ownership
1514  }
1515  fTree = 0;
1516  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1517  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1518 }
1519 
1520 
1521 ////////////////////////////////////////////////////////////////////////////////
1522 /// Fills the histogram with the given values.
1523 
1525 {
1526  fProfile->Fill(v[2], v[1], v[0], w);
1527 }
1528 
1529 
1530 ////////////////////////////////////////////////////////////////////////////////
1531 /// See TProofDraw::Terminate().
1532 
1534 {
1535  PDB(kDraw,1) Info("Terminate","Enter");
1537  if (!fStatus)
1538  return;
1539 
1540  fProfile = (TProfile2D *) fOutput->FindObject(fTreeDrawArgsParser.GetObjectName());
1541  if (fProfile) {
1542  SetStatus((Int_t) fProfile->GetEntries());
1543  TProfile2D *pf = 0;
1544  if ((pf = dynamic_cast<TProfile2D*> (fTreeDrawArgsParser.GetOriginal()))) {
1545  if (!fTreeDrawArgsParser.GetAdd())
1546  pf->Reset();
1547  TList l;
1548  l.Add(fProfile);
1549  pf->Merge(&l);
1550  l.Remove(fProfile);
1551  fOutput->Remove(fProfile);
1552  delete fProfile;
1553  } else {
1554  fProfile->SetTitle(fTreeDrawArgsParser.GetObjectTitle());
1555  pf = fProfile;
1556  }
1557  if (fTreeDrawArgsParser.GetShouldDraw()) {
1558  // Choose the right canvas
1559  SetCanvas(pf->GetName());
1560  // Draw
1561  SetDrawAtt(pf);
1562  pf->Draw(fOption.Data());
1563  }
1564  }
1565  fProfile = 0;
1566 }
1567 
1568 
1570 
1571 ////////////////////////////////////////////////////////////////////////////////
1572 /// See TProofDraw::Init().
1573 
1575 {
1576  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
1577 
1578  if (fTree == 0) {
1579  R__ASSERT(fGraph);
1580  fGraph->SetMarkerStyle(tree->GetMarkerStyle());
1581  fGraph->SetMarkerColor(tree->GetMarkerColor());
1582  fGraph->SetMarkerSize(tree->GetMarkerSize());
1583  fGraph->SetLineColor(tree->GetLineColor());
1584  fGraph->SetLineStyle(tree->GetLineStyle());
1585  fGraph->SetFillColor(tree->GetFillColor());
1586  fGraph->SetFillStyle(tree->GetFillStyle());
1587  }
1588  fTree = tree;
1589  CompileVariables();
1590 }
1591 
1592 
1593 ////////////////////////////////////////////////////////////////////////////////
1594 /// See TProofDraw::SlaveBegin().
1595 
1597 {
1598  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1599 
1600  // Get the weight
1602 
1603  TObject *os = fInput->FindObject("selection");
1604  TObject *ov = fInput->FindObject("varexp");
1605 
1606  if (os && ov) {
1607  fSelection = os->GetTitle();
1608  fInitialExp = ov->GetTitle();
1609  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1610 
1611  SafeDelete(fGraph);
1612  fDimension = 2;
1613 
1614  fGraph = new TGraph();
1615  fGraph->SetName("PROOF_GRAPH");
1616  fOutput->Add(fGraph); // release ownership
1617  }
1618  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1619  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1620 }
1621 
1622 
1623 ////////////////////////////////////////////////////////////////////////////////
1624 /// Fills the graph with the given values.
1625 
1627 {
1628  fGraph->SetPoint(fGraph->GetN(), v[1], v[0]);
1629 }
1630 
1631 
1632 ////////////////////////////////////////////////////////////////////////////////
1633 /// See TProofDraw::Terminate().
1634 
1636 {
1637  PDB(kDraw,1) Info("Terminate","Enter");
1639  if (!fStatus)
1640  return;
1641 
1642  fGraph = dynamic_cast<TGraph*> (fOutput->FindObject("PROOF_GRAPH"));
1643  if (fGraph) {
1644  SetStatus((Int_t) fGraph->GetN());
1645  TH2F* hist;
1646  TObject *orig = fTreeDrawArgsParser.GetOriginal();
1647  if ( (hist = dynamic_cast<TH2F*> (orig)) == 0 ) {
1648  delete orig;
1649  fTreeDrawArgsParser.SetOriginal(0);
1650  double binsx, minx, maxx;
1651  double binsy, miny, maxy;
1652  if (fTreeDrawArgsParser.IsSpecified(0))
1653  gEnv->SetValue("Hist.Binning.2D.x", fTreeDrawArgsParser.GetParameter(0));
1654  if (fTreeDrawArgsParser.IsSpecified(3))
1655  gEnv->SetValue("Hist.Binning.2D.y", fTreeDrawArgsParser.GetParameter(3));
1656  binsx = gEnv->GetValue("Hist.Binning.2D.x",100);
1657  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
1658  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
1659  binsy = gEnv->GetValue("Hist.Binning.2D.y",100);
1660  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
1661  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
1662  hist = new TH2F(fTreeDrawArgsParser.GetObjectName(), fTreeDrawArgsParser.GetObjectTitle(),
1663  (Int_t) binsx, minx, maxx, (Int_t) binsy, miny, maxy);
1664  hist->SetBit(TH1::kNoStats);
1665  hist->SetBit(kCanDelete);
1666  if (fTreeDrawArgsParser.GetNoParameters() != 6)
1667  hist->SetCanExtend(TH1::kAllAxes);
1668  else
1669  hist->SetCanExtend(TH1::kNoAxis);
1670 // if (fTreeDrawArgsParser.GetShouldDraw()) // ?? FIXME
1671 // hist->SetDirectory(0);
1672  } else {
1673  if (!fTreeDrawArgsParser.GetAdd())
1674  hist->Reset();
1675  }
1676  if (hist->CanExtendAllAxes() && hist->TestBit(kCanDelete)) {
1677  Double_t* xArray = fGraph->GetX();
1678  Double_t* yArray = fGraph->GetY();
1679  Double_t xmin = *std::min_element(xArray, xArray+fGraph->GetN());
1680  Double_t xmax = *std::max_element(xArray, xArray+fGraph->GetN());
1681  Double_t ymin = *std::min_element(yArray, yArray+fGraph->GetN());
1682  Double_t ymax = *std::max_element(yArray, yArray+fGraph->GetN());
1683  THLimitsFinder::GetLimitsFinder()->FindGoodLimits(hist,xmin,xmax,ymin,ymax);
1684  }
1685  if (!hist->TestBit(kCanDelete)) {
1686  TH1 *h2c = hist->DrawCopy(fOption.Data());
1687  h2c->SetStats(kFALSE);
1688  } else {
1689  SetDrawAtt(hist);
1690  hist->Draw();
1691  }
1692  gPad->Update();
1693 
1694  fGraph->SetEditable(kFALSE);
1695  // FIXME set color, marker size, etc.
1696 
1697  if (fTreeDrawArgsParser.GetShouldDraw()) {
1698  SetDrawAtt(fGraph);
1699  if (fOption == "" || strcmp(fOption, "same") == 0)
1700  fGraph->Draw("p");
1701  else
1702  fGraph->Draw(fOption);
1703  gPad->Update();
1704  }
1705  if (!hist->TestBit(kCanDelete)) {
1706  for (int i = 0; i < fGraph->GetN(); i++) {
1707  Double_t x = 0, y = 0;
1708  fGraph->GetPoint(i, x, y);
1709  hist->Fill(x, y, 1);
1710  }
1711  }
1712  }
1713  fGraph = 0;
1714 }
1715 
1716 
1718 
1719 ////////////////////////////////////////////////////////////////////////////////
1720 /// See TProofDraw::Init().
1721 
1723 {
1724  PDB(kDraw,1) Info("Init","Enter tree = %p", tree);
1725 
1726  if (fTree == 0) {
1727  R__ASSERT(fPolyMarker3D);
1728  fPolyMarker3D->SetMarkerStyle(tree->GetMarkerStyle());
1729  fPolyMarker3D->SetMarkerColor(tree->GetMarkerColor());
1730  fPolyMarker3D->SetMarkerSize(tree->GetMarkerSize());
1731  }
1732  fTree = tree;
1733  CompileVariables();
1734 }
1735 
1736 ////////////////////////////////////////////////////////////////////////////////
1737 /// See TProofDraw::SlaveBegin().
1738 
1740 {
1741  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1742 
1743  // Get the weight
1745 
1746  TObject *os = fInput->FindObject("selection");
1747  TObject *ov = fInput->FindObject("varexp");
1748 
1749  if (os && ov) {
1750  fSelection = os->GetTitle();
1751  fInitialExp = ov->GetTitle();
1752  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1753  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
1754 
1755  SafeDelete(fPolyMarker3D);
1756  fDimension = 3;
1757 
1758  fPolyMarker3D = new TPolyMarker3D();
1759  fOutput->Add(fPolyMarker3D); // release ownership
1760  }
1761  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1762  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1763 }
1764 
1765 
1766 ////////////////////////////////////////////////////////////////////////////////
1767 /// Fills the scatter plot with the given values.
1768 
1770 {
1771  fPolyMarker3D->SetNextPoint(v[2], v[1], v[0]);
1772 }
1773 
1774 
1775 ////////////////////////////////////////////////////////////////////////////////
1776 /// See TProofDraw::Terminate().
1777 
1779 {
1780  PDB(kDraw,1) Info("Terminate","Enter");
1782  if (!fStatus)
1783  return;
1784 
1785  fPolyMarker3D = 0;
1786  TIter next(fOutput);
1787  while (TObject* o = next()) {
1788  if (dynamic_cast<TPolyMarker3D*> (o)) {
1789  fPolyMarker3D = dynamic_cast<TPolyMarker3D*> (o);
1790  break;
1791  }
1792  }
1793 
1794  Bool_t checkPrevious = kFALSE;
1795  if (fPolyMarker3D) {
1796  SetStatus((Int_t) fPolyMarker3D->Size());
1797  TH3F* hist;
1798  TObject *orig = fTreeDrawArgsParser.GetOriginal();
1799  if ( (hist = dynamic_cast<TH3F*> (orig)) == 0 ) {
1800  delete orig;
1801  fTreeDrawArgsParser.SetOriginal(0);
1802  if (fOption.Contains("same")) {
1803  // Check existing histogram
1804  hist = dynamic_cast<TH3F *> (gDirectory->Get(fTreeDrawArgsParser.GetObjectName()));
1805  }
1806  if (!hist) {
1807  double binsx, minx, maxx;
1808  double binsy, miny, maxy;
1809  double binsz, minz, maxz;
1810  if (fTreeDrawArgsParser.IsSpecified(0))
1811  gEnv->SetValue("Hist.Binning.3D.x", fTreeDrawArgsParser.GetParameter(0));
1812  if (fTreeDrawArgsParser.IsSpecified(3))
1813  gEnv->SetValue("Hist.Binning.3D.y", fTreeDrawArgsParser.GetParameter(3));
1814  if (fTreeDrawArgsParser.IsSpecified(6))
1815  gEnv->SetValue("Hist.Binning.3D.z", fTreeDrawArgsParser.GetParameter(6));
1816  binsx = gEnv->GetValue("Hist.Binning.3D.x",100);
1817  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
1818  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
1819  binsy = gEnv->GetValue("Hist.Binning.3D.y",100);
1820  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
1821  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
1822  binsz = gEnv->GetValue("Hist.Binning.3D.z",100);
1823  minz = fTreeDrawArgsParser.GetIfSpecified(7, 0);
1824  maxz = fTreeDrawArgsParser.GetIfSpecified(8, 0);
1825  hist = new TH3F(fTreeDrawArgsParser.GetObjectName(), fTreeDrawArgsParser.GetObjectTitle(),
1826  (Int_t) binsx, minx, maxx,
1827  (Int_t) binsy, miny, maxy,
1828  (Int_t) binsz, minz, maxz);
1829  hist->SetBit(TH1::kNoStats);
1830  hist->SetBit(kCanDelete);
1831  if (fTreeDrawArgsParser.GetNoParameters() != 9)
1832  hist->SetCanExtend(TH1::kAllAxes);
1833  else
1834  hist->SetCanExtend(TH1::kNoAxis);
1835  } else {
1836  checkPrevious = kTRUE;
1837  PDB(kDraw,2)
1838  Info("Terminate", "found histo '%s' in gDirectory",
1839  fTreeDrawArgsParser.GetObjectName().Data());
1840  }
1841  } else {
1842  if (!fTreeDrawArgsParser.GetAdd())
1843  hist->Reset();
1844  }
1845 
1846  // Set the ranges; take into account previous histos for 'same' runs
1847  Double_t rmin[3], rmax[3];
1848  if (hist->CanExtendAllAxes() && hist->TestBit(kCanDelete)) {
1849  rmin[0] = rmax[0] = rmin[1] = rmax[1] = rmin[2] = rmax[2] = 0;
1850  if (fPolyMarker3D->Size() > 0) {
1851  fPolyMarker3D->GetPoint(0, rmin[0], rmin[1], rmin[2]);
1852  fPolyMarker3D->GetPoint(0, rmax[0], rmax[1], rmax[2]);
1853  }
1854  for (int i = 1; i < fPolyMarker3D->Size(); i++) {
1855  Double_t v[3] = {0};
1856  fPolyMarker3D->GetPoint(i, v[0], v[1], v[2]);
1857  for (int ii = 0; ii < 3; ii++) {
1858  if (v[ii] < rmin[ii]) rmin[ii] = v[ii];
1859  if (v[ii] > rmax[ii]) rmax[ii] = v[ii];
1860  }
1861  }
1862  // Compare with previous histo, if any
1863  if (checkPrevious) {
1864  rmin[0] = (hist->GetXaxis()->GetXmin() < rmin[0]) ? hist->GetXaxis()->GetXmin()
1865  : rmin[0];
1866  rmin[1] = (hist->GetYaxis()->GetXmin() < rmin[1]) ? hist->GetYaxis()->GetXmin()
1867  : rmin[1];
1868  rmin[2] = (hist->GetZaxis()->GetXmin() < rmin[2]) ? hist->GetZaxis()->GetXmin()
1869  : rmin[2];
1870  rmax[0] = (hist->GetXaxis()->GetXmax() > rmax[0]) ? hist->GetXaxis()->GetXmax()
1871  : rmax[0];
1872  rmax[1] = (hist->GetYaxis()->GetXmax() > rmax[1]) ? hist->GetYaxis()->GetXmax()
1873  : rmax[1];
1874  rmax[2] = (hist->GetZaxis()->GetXmax() > rmax[2]) ? hist->GetZaxis()->GetXmax()
1875  : rmax[2];
1876  }
1877 
1879  rmin[0], rmax[0], rmin[1], rmax[1], rmin[2], rmax[2]);
1880  }
1881  if (fTreeDrawArgsParser.GetShouldDraw()) {
1882  if (!hist->TestBit(kCanDelete)) {
1883  TH1 *histcopy = hist->DrawCopy(fOption.Data());
1884  histcopy->SetStats(kFALSE);
1885  } else {
1886  SetDrawAtt(hist);
1887  hist->Draw(fOption); // no draw options on purpose
1888  }
1889  gPad->Update();
1890  } else {
1891  gPad->Clear();
1892  gPad->Range(-1,-1,1,1);
1893  TView::CreateView(1,rmin,rmax);
1894  }
1895  if (fTreeDrawArgsParser.GetShouldDraw()) {
1896  SetDrawAtt(fPolyMarker3D);
1897  fPolyMarker3D->Draw(fOption);
1898  }
1899  gPad->Update();
1900  if (!hist->TestBit(kCanDelete)) {
1901  for (int i = 0; i < fPolyMarker3D->Size(); i++) {
1902  Double_t x = 0, y = 0, z = 0;
1903  fPolyMarker3D->GetPoint(i, x, y, z);
1904  hist->Fill(x, y, z, 1);
1905  }
1906  }
1907  }
1908 }
1909 
1910 
1912 
1913 ////////////////////////////////////////////////////////////////////////////////
1914 /// See TProofDraw::SlaveBegin().
1915 
1916 void TProofDrawListOfGraphs::SlaveBegin(TTree *tree)
1917 {
1918  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
1919 
1920  // Get the weight
1922 
1923  TObject *os = fInput->FindObject("selection");
1924  TObject *ov = fInput->FindObject("varexp");
1925 
1926  if (os && ov) {
1927  fSelection = os->GetTitle();
1928  fInitialExp = ov->GetTitle();
1929  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
1930  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 3);
1931 
1932  SafeDelete(fPoints);
1933 
1934  fDimension = 3;
1935 
1936  fPoints = new TProofVectorContainer<Point3D_t>(new std::vector<Point3D_t>);
1937  fPoints->SetName("PROOF_SCATTERPLOT");
1938  fOutput->Add(fPoints); // release ownership (? FIXME)
1939  }
1940  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
1941  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
1942 }
1943 
1944 
1945 ////////////////////////////////////////////////////////////////////////////////
1946 /// Fills the scatter plot with the given values.
1947 
1949 {
1950  fPoints->GetVector()->push_back(Point3D_t(v[2], v[1], v[0]));
1951 }
1952 
1953 
1954 ////////////////////////////////////////////////////////////////////////////////
1955 /// See TProofDraw::Terminate().
1956 
1958 {
1959  PDB(kDraw,1) Info("Terminate","Enter");
1961  if (!fStatus)
1962  return;
1963 
1964  fPoints = dynamic_cast<TProofVectorContainer<Point3D_t>*>
1965  (fOutput->FindObject("PROOF_SCATTERPLOT"));
1966  if (fPoints) {
1967  std::vector<Point3D_t> *points = fPoints->GetVector();
1968  R__ASSERT(points);
1969  SetStatus((Int_t) points->size());
1970  TH2F* hist;
1971  TObject *orig = fTreeDrawArgsParser.GetOriginal();
1972  if ( (hist = dynamic_cast<TH2F*> (orig)) == 0 ) {
1973  delete orig;
1974  fTreeDrawArgsParser.SetOriginal(0);
1975  double binsx, minx, maxx;
1976  double binsy, miny, maxy;
1977  if (fTreeDrawArgsParser.IsSpecified(0))
1978  gEnv->SetValue("Hist.Binning.2D.x", fTreeDrawArgsParser.GetParameter(0));
1979  if (fTreeDrawArgsParser.IsSpecified(3))
1980  gEnv->SetValue("Hist.Binning.2D.y", fTreeDrawArgsParser.GetParameter(3));
1981  binsx = gEnv->GetValue("Hist.Binning.2D.x", 40);
1982  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
1983  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
1984  binsy = gEnv->GetValue("Hist.Binning.2D.y", 40);
1985  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
1986  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
1987  hist = new TH2F(fTreeDrawArgsParser.GetObjectName(), fTreeDrawArgsParser.GetObjectTitle(),
1988  (Int_t) binsx, minx, maxx, (Int_t) binsy, miny, maxy);
1989  hist->SetBit(TH1::kNoStats);
1990  hist->SetBit(kCanDelete);
1991  if (fTreeDrawArgsParser.GetNoParameters() != 6)
1992  hist->SetCanExtend(TH1::kAllAxes);
1993  else
1994  hist->SetCanExtend(TH1::kNoAxis);
1995 
1996 // if (fTreeDrawArgsParser.GetShouldDraw()) // ?? FIXME
1997 // hist->SetDirectory(0);
1998  }
1999  Double_t rmin[3], rmax[3];
2000 
2001  // FIXME take rmin and rmax from the old histogram
2002  rmin[0] = rmax[0] = rmin[1] = rmax[1] = rmin[2] = rmax[2] = 0;
2003  if (points->size() > 0) {
2004  rmin[0] = rmax[0] = (*points)[0].fX;
2005  rmin[1] = rmax[1] = (*points)[0].fY;
2006  rmin[2] = rmax[2] = (*points)[0].fZ;
2007 
2008  for (vector<Point3D_t>::const_iterator i = points->begin() + 1; i < points->end(); ++i) {
2009  if (rmax[0] < i->fX) rmax[0] = i->fX;
2010  if (rmax[1] < i->fY) rmax[1] = i->fY;
2011  if (rmax[2] < i->fZ) rmax[2] = i->fZ;
2012  if (rmin[0] > i->fX) rmin[0] = i->fX;
2013  if (rmin[1] > i->fY) rmin[1] = i->fY;
2014  if (rmin[2] > i->fZ) rmin[2] = i->fZ;
2015  }
2016  // in this case we don't care about user-specified limits
2017  if (hist->CanExtendAllAxes() && hist->TestBit(kCanDelete)) {
2019  rmin[1], rmax[1], rmin[2], rmax[2]);
2020  }
2021  }
2022 
2023  Int_t ncolors = gStyle->GetNumberOfColors();
2024  TObjArray *grs = (TObjArray*)hist->GetListOfFunctions()->FindObject("graphs");
2025  Int_t col;
2026  TGraph *gr;
2027  if (!grs) {
2028  grs = new TObjArray(ncolors);
2029  grs->SetOwner();
2030  grs->SetName("graphs");
2031  hist->GetListOfFunctions()->Add(grs, "P");
2032  for (col=0;col<ncolors;col++) {
2033  gr = new TGraph();
2034  gr->SetMarkerColor(col);
2035 // gr->SetMarkerStyle(fTree->GetMarkerStyle());
2036 // gr->SetMarkerSize(fTree->GetMarkerSize());
2037  grs->AddAt(gr,col);
2038  }
2039  }
2040  // Fill the graphs acording to the color
2041  for (vector<Point3D_t>::const_iterator i = points->begin();
2042  i < points->end(); ++i) {
2043  col = Int_t((ncolors-1)*((i->fX-rmin[0])/(rmax[0]-rmin[0])));
2044  if (col < 0) col = 0;
2045  if (col > ncolors-1) col = ncolors-1;
2046  gr = (TGraph*)grs->UncheckedAt(col);
2047  if (gr) gr->SetPoint(gr->GetN(), i->fY, i->fZ);
2048  }
2049  // Remove potential empty graphs
2050  for (col=0;col<ncolors;col++) {
2051  gr = (TGraph*)grs->At(col);
2052  if (gr && gr->GetN() <= 0) grs->Remove(gr);
2053  }
2054  if (fTreeDrawArgsParser.GetShouldDraw()) {
2055  SetDrawAtt(hist);
2056  hist->Draw(fOption.Data());
2057  gPad->Update();
2058  }
2059  fOutput->Remove(fPoints);
2060  SafeDelete(fPoints);
2061  }
2062 }
2063 
2064 
2066 
2067 
2068 ////////////////////////////////////////////////////////////////////////////////
2069 /// See TProofDraw::SlaveBegin().
2070 
2071 void TProofDrawListOfPolyMarkers3D::SlaveBegin(TTree *tree)
2072 {
2073  PDB(kDraw,1) Info("SlaveBegin","Enter tree = %p", tree);
2074 
2075  // Get the weight
2077 
2078  TObject *os = fInput->FindObject("selection");
2079  TObject *ov = fInput->FindObject("varexp");
2080 
2081  if (os && ov) {
2082  fSelection = os->GetTitle();
2083  fInitialExp = ov->GetTitle();
2084  fTreeDrawArgsParser.Parse(fInitialExp, fSelection, fOption);
2085  R__ASSERT(fTreeDrawArgsParser.GetDimension() == 4);
2086 
2087  SafeDelete(fPoints);
2088 
2089  fDimension = 4;
2090 
2091  fPoints = new TProofVectorContainer<Point4D_t>(new std::vector<Point4D_t>);
2092  fPoints->SetName("PROOF_SCATTERPLOT");
2093  fOutput->Add(fPoints); // release ownership (? FIXME)
2094  }
2095  PDB(kDraw,1) Info("Begin","selection: %s", fSelection.Data());
2096  PDB(kDraw,1) Info("Begin","varexp: %s", fInitialExp.Data());
2097 }
2098 
2099 
2100 ////////////////////////////////////////////////////////////////////////////////
2101 /// Fills the scatter plot with the given values.
2102 
2104 {
2105  fPoints->GetVector()->push_back(Point4D_t(v[3], v[2], v[1], v[0]));
2106 }
2107 
2108 
2109 
2110 ////////////////////////////////////////////////////////////////////////////////
2111 /// See TProofDraw::Terminate().
2112 
2114 {
2115  PDB(kDraw,1) Info("Terminate","Enter");
2117  if (!fStatus)
2118  return;
2119 
2120  fPoints = dynamic_cast<TProofVectorContainer<Point4D_t>*>
2121  (fOutput->FindObject("PROOF_SCATTERPLOT"));
2122  if (fPoints) {
2123  std::vector<Point4D_t> *points = fPoints->GetVector();
2124  R__ASSERT(points);
2125  SetStatus((Int_t) points->size());
2126  TH3F* hist;
2127  TObject *orig = fTreeDrawArgsParser.GetOriginal();
2128  if ( (hist = dynamic_cast<TH3F*> (orig)) == 0 || fTreeDrawArgsParser.GetNoParameters() != 0) {
2129  delete orig;
2130  fTreeDrawArgsParser.SetOriginal(0);
2131  double binsx, minx, maxx;
2132  double binsy, miny, maxy;
2133  double binsz, minz, maxz;
2134  if (fTreeDrawArgsParser.IsSpecified(0))
2135  gEnv->SetValue("Hist.Binning.3D.x", fTreeDrawArgsParser.GetParameter(0));
2136  if (fTreeDrawArgsParser.IsSpecified(3))
2137  gEnv->SetValue("Hist.Binning.3D.y", fTreeDrawArgsParser.GetParameter(3));
2138  if (fTreeDrawArgsParser.IsSpecified(6))
2139  gEnv->SetValue("Hist.Binning.3D.z", fTreeDrawArgsParser.GetParameter(3));
2140  binsx = gEnv->GetValue("Hist.Binning.3D.x", 20);
2141  minx = fTreeDrawArgsParser.GetIfSpecified(1, 0);
2142  maxx = fTreeDrawArgsParser.GetIfSpecified(2, 0);
2143  binsy = gEnv->GetValue("Hist.Binning.3D.y", 20);
2144  miny = fTreeDrawArgsParser.GetIfSpecified(4, 0);
2145  maxy = fTreeDrawArgsParser.GetIfSpecified(5, 0);
2146  binsz = gEnv->GetValue("Hist.Binning.3D.z", 20);
2147  minz = fTreeDrawArgsParser.GetIfSpecified(7, 0);
2148  maxz = fTreeDrawArgsParser.GetIfSpecified(8, 0);
2149  hist = new TH3F(fTreeDrawArgsParser.GetObjectName(), fTreeDrawArgsParser.GetObjectTitle(),
2150  (Int_t) binsx, minx, maxx,
2151  (Int_t) binsy, miny, maxy,
2152  (Int_t) binsz, minz, maxz);
2153  hist->SetBit(TH1::kNoStats);
2154  hist->SetBit(kCanDelete);
2155  if (fTreeDrawArgsParser.GetNoParameters() != 9)
2156  hist->SetCanExtend(TH1::kAllAxes);
2157  else
2158  hist->SetCanExtend(TH1::kNoAxis);
2159 
2160 // if (fTreeDrawArgsParser.GetShouldDraw()) // ?? FIXME
2161 // hist->SetDirectory(0);
2162  }
2163  Double_t rmin[4], rmax[4];
2164 
2165 
2166  // FIXME take rmin and rmax from the old histogram
2167  rmin[0] = rmax[0] = rmin[1] = rmax[1] = rmin[2] = rmax[2] = 0;
2168  if (points->size() > 0) {
2169  rmin[0] = rmax[0] = (*points)[0].fX;
2170  rmin[1] = rmax[1] = (*points)[0].fY;
2171  rmin[2] = rmax[2] = (*points)[0].fZ;
2172  rmin[3] = rmax[3] = (*points)[0].fT;
2173 
2174  for (vector<Point4D_t>::const_iterator i = points->begin() + 1; i < points->end(); ++i) {
2175  if (rmax[0] < i->fX) rmax[0] = i->fX;
2176  if (rmax[1] < i->fY) rmax[1] = i->fY;
2177  if (rmax[2] < i->fZ) rmax[2] = i->fZ;
2178  if (rmax[3] < i->fT) rmax[3] = i->fT;
2179  if (rmin[0] > i->fX) rmin[0] = i->fX;
2180  if (rmin[1] > i->fY) rmin[1] = i->fY;
2181  if (rmin[2] > i->fZ) rmin[2] = i->fZ;
2182  if (rmin[3] > i->fT) rmin[3] = i->fT;
2183  }
2184  // in this case we don't care about user-specified limits
2185  if (hist->CanExtendAllAxes() && hist->TestBit(kCanDelete)) {
2187  rmin[1], rmax[1], rmin[2], rmax[2], rmin[3], rmax[3]);
2188  }
2189  }
2190  Int_t ncolors = gStyle->GetNumberOfColors();
2191  TObjArray *pms = (TObjArray*)hist->GetListOfFunctions()->FindObject("polymarkers");
2192  Int_t col;
2193  TPolyMarker3D *pm3d;
2194  if (!pms) {
2195  pms = new TObjArray(ncolors);
2196  pms->SetOwner();
2197  pms->SetName("polymarkers");
2198  hist->GetListOfFunctions()->Add(pms);
2199  for (col=0;col<ncolors;col++) {
2200  pm3d = new TPolyMarker3D();
2201  pm3d->SetMarkerColor(col);
2202 // pm3d->SetMarkerStyle(fTree->GetMarkerStyle());
2203 // pm3d->SetMarkerSize(fTree->GetMarkerSize());
2204  pms->AddAt(pm3d,col);
2205  }
2206  }
2207  for (vector<Point4D_t>::const_iterator i = points->begin();
2208  i < points->end(); ++i) {
2209  col = Int_t(i->fX);
2210  if (col < 0) col = 0;
2211  if (col > ncolors-1) col = ncolors-1;
2212  pm3d = (TPolyMarker3D*)pms->UncheckedAt(col);
2213  pm3d->SetPoint(pm3d->GetLastPoint()+1, i->fY, i->fZ, i->fT);
2214  }
2215  if (fTreeDrawArgsParser.GetShouldDraw()) {
2216  SetDrawAtt(hist);
2217  hist->Draw(fOption.Data());
2218  gPad->Update();
2219  }
2220  fOutput->Remove(fPoints);
2221  SafeDelete(fPoints);
2222  }
2223 }
const int ndata
virtual void Begin(TTree *)
Executed by the client before processing.
Definition: TProofDraw.cxx:173
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
virtual Style_t GetLineStyle() const
Definition: TAttLine.h:48
virtual Style_t GetFillStyle() const
Definition: TAttFill.h:44
An array of TObjects.
Definition: TObjArray.h:39
virtual void Terminate()
See TProofDraw::Terminate().
float xmin
Definition: THbookFile.cxx:93
virtual void Terminate()
See TProofDraw::Terminate().
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the histgram with given values.
Definition: TProofDraw.cxx:854
long long Long64_t
Definition: RtypesCore.h:69
virtual void SlaveBegin(TTree *)
Executed by each slave before processing.
Definition: TProofDraw.cxx:197
short Style_t
Definition: RtypesCore.h:76
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
float Float_t
Definition: RtypesCore.h:53
virtual void ClearFormula()
Delete internal buffers.
Definition: TProofDraw.cxx:295
float Size_t
Definition: RtypesCore.h:83
3-D histogram with a float per channel (see TH1 documentation)}
Definition: TH3.h:272
THist< 2, float > TH2F
Definition: THist.h:321
const char Option_t
Definition: RtypesCore.h:62
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the scatter plot with the given values.
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the eventlist with given values.
float ymin
Definition: THbookFile.cxx:93
void SetDrawAtt(TObject *o)
Set the drawing attributes from the input list.
Definition: TProofDraw.cxx:327
R__EXTERN TStyle * gStyle
Definition: TStyle.h:423
virtual void Terminate()
See TProofDraw::Terminate().
#define gDirectory
Definition: TDirectory.h:218
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TH1 * h
Definition: legend2.C:5
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
void SetError(const char *sub, const char *mesg)
Sets the error status.
Definition: TProofDraw.cxx:384
void DefVar3D()
Define variables for 3D histogram.
Definition: TProofDraw.cxx:645
THist< 1, float > TH1F
Definition: THist.h:315
#define R__ASSERT(e)
Definition: TError.h:98
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
#define gROOT
Definition: TROOT.h:340
virtual TObject * Remove(TObject *obj)
Remove object from array.
Definition: TObjArray.cxx:652
Basic string class.
Definition: TString.h:137
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:570
virtual void Init(TTree *)
Init the tree.
Definition: TProofDraw.cxx:142
int Int_t
Definition: RtypesCore.h:41
virtual void Init(TTree *)
See TProofDraw::Init().
Definition: TProofDraw.cxx:741
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void SetFillStyle(Style_t fstyle)
Definition: TAttFill.h:52
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
virtual void Terminate()
See TProofDraw::Terminate().
Definition: TProofDraw.cxx:979
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
STL namespace.
Profile Historam.
Definition: TProfile.h:34
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
compute the best axis limits for the X axis.
Int_t GetN() const
Definition: TGraph.h:132
TString GetObjectName() const
virtual void Begin3D(TTree *t)
Initialization for 3D histogram.
Definition: TProofDraw.cxx:509
virtual void SlaveTerminate()
Executed by each slave after the processing has finished, before returning the results to the client...
Definition: TProofDraw.cxx:265
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH1.cxx:6669
TObject * Clone(const char *newname=0) const
Make a complete copy of the underlying object.
Definition: TH1.cxx:2565
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=0)
Set the value of a resource or create a new resource.
Definition: TEnv.cxx:749
virtual Int_t GetN() const
Definition: TEventList.h:58
Marker Attributes class.
Definition: TAttMarker.h:32
const char * Data() const
Definition: TString.h:349
THist< 3, float > TH3F
Definition: THist.h:327
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:395
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
#define SafeDelete(p)
Definition: RConfig.h:436
Fill Area Attributes class.
Definition: TAttFill.h:32
Double_t x[n]
Definition: legend1.C:17
virtual void Reset(Option_t *option="")
Reset contents of a Profile histogram.
Definition: TProfile.cxx:1500
Used to coordinate one or more TTreeFormula objects.
#define PDB(mask, level)
Definition: TProofDebug.h:58
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Definition: TClassEdit.cxx:118
virtual void Terminate()
See TProofDraw::Terminate().
Definition: TProofDraw.cxx:868
TString GetProofSelectorName() const
Returns apropriate TSelector class name for proof for the object that is to be drawn assumes that Par...
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the eventlist with given values.
Definition: TProofDraw.cxx:960
virtual void SetMarkerColor(Color_t mcolor=1)
Definition: TAttMarker.h:51
virtual Bool_t Process(Long64_t)
Executed for each entry.
Definition: TProofDraw.cxx:245
void Info(const char *location, const char *msgfmt,...)
Int_t GetNumberOfColors() const
Return number of colors in the color palette.
Definition: TStyle.cxx:796
Int_t DrawCanvas(TObject *obj)
Definition: TProofDraw.cxx:60
virtual void Begin(TTree *t)
See TProofDraw::Begin().
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
Definition: TH1.cxx:2925
virtual void Terminate()
See TProofDraw::Terminate().
virtual void DefVar()
Define relevant variables.
void Error(const char *location, const char *msgfmt,...)
Int_t GetDrawArgs(const char *var, const char *sel, Option_t *opt, TString &selector, TString &objname)
Definition: TProofDraw.cxx:76
The 3-D histogram classes derived from the 1-D histogram classes.
Definition: TH3.h:35
short Color_t
Definition: RtypesCore.h:79
TObject * GetParameter(const char *par) const
Get specified parameter.
Definition: TProof.cxx:10485
static Int_t GetMaxDimension()
return fgMaxDimension (cannot be inline)
Used to pass a selection expression to the Tree drawing routine.
Definition: TTreeFormula.h:64
A doubly linked list.
Definition: TList.h:47
point * points
Definition: X3DBuffer.c:20
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:91
virtual void SetLineColor(Color_t lcolor)
Definition: TAttLine.h:54
virtual Size_t GetMarkerSize() const
Definition: TAttMarker.h:46
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1.
Definition: TProfile2D.cxx:201
float ymax
Definition: THbookFile.cxx:93
virtual void DefVar()
Define variables according to arguments.
Definition: TProofDraw.cxx:703
virtual Bool_t Notify()
Called when a new tree is loaded.
Definition: TProofDraw.cxx:153
Service class for 2-Dim histogram classes.
Definition: TH2.h:36
SVector< double, 2 > v
Definition: Dict.h:5
virtual void SetFillColor(Color_t fcolor)
Definition: TAttFill.h:50
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:256
virtual Int_t GetValue(const char *name, Int_t dflt)
Returns the integer value for a resource.
Definition: TEnv.cxx:494
virtual void Begin(TTree *t)
See TProofDraw::Begin().
Definition: TProofDraw.cxx:526
virtual TObject * Remove(TObject *obj)
Remove object from the list.
Definition: TList.cxx:674
virtual void Begin2D(TTree *t)
Initialization for 2D histogram.
Definition: TProofDraw.cxx:491
virtual Color_t GetFillColor() const
Definition: TAttFill.h:43
TClass * IsA() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
TMarker * m
Definition: textangle.C:8
char * Form(const char *fmt,...)
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the graph with the given values.
virtual void SlaveTerminate()
See TProofDraw::SlaveTerminate().
Definition: TProofDraw.cxx:969
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:33
TLine * l
Definition: textangle.C:4
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
virtual void SetMarkerStyle(Style_t mstyle=1)
Definition: TAttMarker.h:53
float xmax
Definition: THbookFile.cxx:93
void SetCanvas(const char *objname)
Move to a canvas named _canvas; create the canvas if not existing.
Definition: TProofDraw.cxx:311
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
set the buffer size in units of 8 bytes (double)
void SetName(const char *name)
Definition: TCollection.h:116
virtual void Terminate()
See TProofDraw::Terminate().
virtual Color_t GetLineColor() const
Definition: TAttLine.h:47
static Int_t GetDefaultBufferSize()
static function return the default buffer size for automatic histograms the parameter fgBufferSize ma...
Definition: TH1.cxx:4032
Long64_t entry
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
Definition: TObjArray.cxx:238
virtual void SetMarkerSize(Size_t msize=1)
Definition: TAttMarker.h:54
TGraphErrors * gr
Definition: legend1.C:25
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
Definition: TString.cxx:2240
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH3.cxx:3476
short Width_t
Definition: RtypesCore.h:78
void SetPoint(Int_t n, Double_t x, Double_t y, Double_t z)
Set point n to x, y, z.
int Ssiz_t
Definition: RtypesCore.h:63
The Canvas class.
Definition: TCanvas.h:48
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the scatter plot with the given values.
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
Definition: TProofDraw.cxx:764
virtual void Reset(Option_t *option="")
-*Reset contents of a Profile2D histogram *-* ======================================= ...
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
virtual void Terminate()
Executed by the client after getting the processing retults.
Definition: TProofDraw.cxx:274
double Double_t
Definition: RtypesCore.h:55
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the histogram with the given values.
virtual Bool_t CompileVariables()
Compiles each variable from fTreeDrawArgsParser for the tree fTree.
Definition: TProofDraw.cxx:404
R__EXTERN TEnv * gEnv
Definition: TEnv.h:174
void DefVar1D()
Define vars for 1D Histogram.
Definition: TProofDraw.cxx:564
Double_t y[n]
Definition: legend1.C:17
virtual void Terminate()
See TProofDraw::Terminate().
The TH1 histogram class.
Definition: TH1.h:80
void FillWeight()
Get weight from input list, if any.
Definition: TProofDraw.cxx:206
Profile2D histograms are used to display the mean value of Z and its RMS for each cell in X...
Definition: TProfile2D.h:31
virtual void SetName(const char *name)
Change the name of this TEventList.
Definition: TEventList.cxx:360
static TView * CreateView(Int_t system=1, const Double_t *rmin=0, const Double_t *rmax=0)
Create a concrete default 3-d view via the plug-in manager.
Definition: TView.cxx:36
A class that parses all parameters for TTree::Draw().
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual ~TProofDraw()
Destructor.
Definition: TProofDraw.cxx:133
virtual Long64_t GetN() const
Definition: TEntryList.h:77
Mother of all ROOT objects.
Definition: TObject.h:58
virtual void SlaveTerminate()
See TProofDraw::SlaveTerminate().
typedef void((*Func_t)())
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
virtual void SetBuffer(Int_t buffersize, Option_t *option="")
set the buffer size in units of 8 bytes (double)
Definition: TProfile.cxx:1642
virtual Color_t GetMarkerColor() const
Definition: TAttMarker.h:44
virtual void DefVar()
Define relevant variables.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
Definition: TGraph.cxx:2127
A 3D polymarker.
Definition: TPolyMarker3D.h:40
virtual void Add(TObject *obj)
Definition: TList.h:81
virtual Bool_t ProcessSingle(Long64_t, Int_t)
Processes a single variable from an entry.
Definition: TProofDraw.cxx:218
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:53
ClassImp(TProofDraw) TProofDraw
Constructor.
Definition: TProofDraw.cxx:109
#define gPad
Definition: TVirtualPad.h:288
virtual void Print(Option_t *option="") const
Standard print function.
Definition: TStatus.cxx:109
void FeedBackCanvas(const char *name, Bool_t create)
Definition: TProofDraw.cxx:93
A TTree object has a header with a name and a title.
Definition: TTree.h:94
virtual void Terminate()
See TProofDraw::Terminate().
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the scatter plot with the given values.
virtual Bool_t Add(TF1 *h1, Double_t c1=1, Option_t *option="")
Performs the operation: this = this + c1*f1.
Definition: TProfile.cxx:240
virtual void SlaveBegin(TTree *)
See TProofDraw::SlaveBegin().
Definition: TProofDraw.cxx:927
void SetQuickLoad(Bool_t quick)
Definition: TTreeFormula.h:203
void ResetBit(UInt_t f)
Definition: TObject.h:172
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)
Fills the profile histogram with the given values.
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
virtual void Reset(Option_t *option="")
Reset this histogram: contents, errors, etc.
Definition: TH2.cxx:2673
void DefVar2D()
Define variables for 2D histogram.
Definition: TProofDraw.cxx:599
double exp(double)
virtual Style_t GetMarkerStyle() const
Definition: TAttMarker.h:45
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual Width_t GetLineWidth() const
Definition: TAttLine.h:49
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:459
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:27
const Int_t n
Definition: legend1.C:16
Bool_t Parse(const char *varexp, const char *selection, Option_t *option)
Parses parameters from TTree::Draw().
Line Attributes class.
Definition: TAttLine.h:32
virtual void SetStats(Bool_t stats=kTRUE)
Set statistics option on/off.
Definition: TH1.cxx:8320
virtual Int_t GetLastPoint() const
Definition: TPolyMarker3D.h:64
virtual void Begin(TTree *t)
See TProofDraw::Begin().