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