Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TProofDraw.h
Go to the documentation of this file.
1// @(#)root/proofplayer:$Id$
2// Author: Maarten Ballintijn 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#ifndef ROOT_TProofDraw
13#define ROOT_TProofDraw
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TProofDraw //
19// //
20// Implement Tree drawing using PROOF. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TSelector.h"
25
26#include "TString.h"
27
28#include "TTreeDrawArgsParser.h"
29
30#include "TNamed.h"
31
32#include <vector>
33
34
35class TTree;
37class TTreeFormula;
38class TStatus;
39class TH1;
40class TEventList;
41class TEntryList;
42class TProfile;
43class TProfile2D;
44class TGraph;
45class TPolyMarker3D;
46class TCollection;
47
48
49class TProofDraw : public TSelector {
50
51friend class TProofPlayer;
52
53protected:
60 TTreeFormula *fVar[4]; // Pointer to variable formula
61 TTreeFormula *fSelect; // Pointer to selection formula
62 Int_t fMultiplicity; // Indicator of the variability of the size of entries
63 Bool_t fObjEval; // true if fVar1 returns an object (or pointer to).
64 Int_t fDimension; // Dimension of the current expression
65 Double_t fWeight; // Global weight for fill actions
66
67 void FillWeight();
68 void SetCanvas(const char *objname);
69 void SetDrawAtt(TObject *o);
70 void SetError(const char *sub, const char *mesg);
71
72protected:
73 enum { kWarn = BIT(12) };
74
75 virtual Bool_t CompileVariables();
76 virtual void ClearFormula();
77 virtual Bool_t ProcessSingle(Long64_t /*entry*/, Int_t /*i*/);
78 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v) = 0;
79 virtual void DefVar() = 0;
80
81public:
82 TProofDraw();
83 ~TProofDraw() override;
84 int Version() const override { return 1; }
85 void Init(TTree *) override;
86 void Begin(TTree *) override;
87 void SlaveBegin(TTree *) override;
88 Bool_t Notify() override;
89 Bool_t Process(Long64_t /*entry*/) override;
90 void SlaveTerminate() override;
91 void Terminate() override;
92
93 ClassDefOverride(TProofDraw,0) //Tree drawing selector for PROOF
94};
95
96
97class TProofDrawHist : public TProofDraw {
98
99private:
100 void DefVar1D();
101 void DefVar2D();
102 void DefVar3D();
103
104protected:
106
107 virtual void Begin1D(TTree *t);
108 virtual void Begin2D(TTree *t);
109 virtual void Begin3D(TTree *t);
110 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
111 void DefVar() override;
112
113public:
115 void Begin(TTree *t) override;
116 void Init(TTree *) override;
117 void SlaveBegin(TTree *) override;
118 void Terminate() override;
119
120 ClassDefOverride(TProofDrawHist,0) //Tree drawing selector for PROOF
121};
122
123
125
126protected:
127 TEventList* fElist; // event list
128 TList* fEventLists; // a list of EventLists
129
130 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
131 void DefVar() override { }
132
133public:
136
137 void Init(TTree *) override;
138 void SlaveBegin(TTree *) override;
139 void SlaveTerminate() override;
140 void Terminate() override;
141
142 ClassDefOverride(TProofDrawEventList,0) //Tree drawing selector for PROOF
143};
144
146 protected:
148
149 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
150 void DefVar() override {}
151
152 public:
155
156 void Init(TTree *) override;
157 void SlaveBegin(TTree *) override;
158 void SlaveTerminate() override;
159 void Terminate() override;
160
161 ClassDefOverride(TProofDrawEntryList, 0) //A Selectoor to fill a TEntryList from TTree::Draw
162};
163
164
166
167protected:
169
170 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
171 void DefVar() override;
172
173public:
175 void Init(TTree *) override;
176 void Begin(TTree *t) override;
177 void SlaveBegin(TTree *) override;
178 void Terminate() override;
179
180 ClassDefOverride(TProofDrawProfile,0) //Tree drawing selector for PROOF
181};
182
183
185
186protected:
188
189 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
190 void DefVar() override;
191
192public:
194 void Init(TTree *) override;
195 void Begin(TTree *t) override;
196 void SlaveBegin(TTree *) override;
197 void Terminate() override;
198
199 ClassDefOverride(TProofDrawProfile2D,0) //Tree drawing selector for PROOF
200};
201
202
204
205protected:
207
208 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
209 void DefVar() override { }
210
211public:
213 void Init(TTree *tree) override;
214 void SlaveBegin(TTree *) override;
215 void Terminate() override;
216
217 ClassDefOverride(TProofDrawGraph,0) //Tree drawing selector for PROOF
218};
219
220
222
223protected:
225
226 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
227 void DefVar() override { }
228
229public:
231 void Init(TTree *tree) override;
232 void SlaveBegin(TTree *) override;
233 void Terminate() override;
234
235 ClassDefOverride(TProofDrawPolyMarker3D,0) //Tree drawing selector for PROOF
236};
237
238template <typename T>
240 // Owns an std::vector<T>.
241 // Implements Merge(TCollection*) which merges vectors holded
242 // by all the TProofVectorContainers in the collection.
243protected:
244 std::vector<T> *fVector; // vector
245
246public:
247 TProofVectorContainer(std::vector<T>* anVector) : fVector(anVector) { }
249 ~TProofVectorContainer() override { delete fVector; }
250
251 std::vector<T> *GetVector() const { return fVector; }
253
254 ClassDefOverride(TProofVectorContainer,1) //Class describing a vector container
255};
256
258
259public:
260 struct Point3D_t {
261 public:
264 Point3D_t() : fX(0), fY(0), fZ(0) { }
265 };
266
267protected:
269 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
270 void DefVar() override { }
271
272public:
274 void SlaveBegin(TTree *) override;
275 void Terminate() override;
276
277 ClassDefOverride(TProofDrawListOfGraphs,0) //Tree drawing selector for PROOF
278};
279
280
282
283public:
284 struct Point4D_t {
285 public:
287 Point4D_t(Double_t x, Double_t y, Double_t z, Double_t t) : fX(x), fY(y), fZ(z), fT(t) { }
288 Point4D_t() : fX(0), fY(0), fZ(0), fT(0) { }
289 };
290
291protected:
293 void DoFill(Long64_t entry, Double_t w, const Double_t *v) override;
294 void DefVar() override { }
295
296public:
298 void SlaveBegin(TTree *) override;
299 void Terminate() override;
300
301 ClassDefOverride(TProofDrawListOfPolyMarkers3D,0) //Tree drawing selector for PROOF
302};
303
304template <typename T>
306{
307 // Adds all vectors holded by all TProofVectorContainers in the collection
308 // the vector holded by this TProofVectorContainer.
309 // Returns the total number of poins in the result or -1 in case of an error.
310
311 TIter next(li);
312
313 std::back_insert_iterator<std::vector<T> > ii(*fVector);
314 while (TObject* o = next()) {
315 TProofVectorContainer<T> *vh = dynamic_cast<TProofVectorContainer<T>*> (o);
316 if (!vh) {
317 Error("Merge",
318 "Cannot merge - an object which doesn't inherit from TProofVectorContainer<T> found in the list");
319 return -1;
320 }
321 std::copy(vh->GetVector()->begin(), vh->GetVector()->end(), ii);
322 }
323 return fVector->size();
324}
325
326#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
long long Long64_t
Definition RtypesCore.h:69
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
Collection abstract base class.
Definition TCollection.h:65
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
Definition TEventList.h:31
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Mother of all ROOT objects.
Definition TObject.h:41
A 3D polymarker.
Profile2D histograms are used to display the mean value of Z and its error for each cell in X,...
Definition TProfile2D.h:27
Profile Histogram.
Definition TProfile.h:32
TEntryList * fElist
Definition TProofDraw.h:147
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void SlaveTerminate() override
See TProofDraw::SlaveTerminate().
void Terminate() override
See TProofDraw::Terminate().
void DefVar() override
Definition TProofDraw.h:150
void Init(TTree *) override
See TProofDraw::Init().
~TProofDrawEntryList() override
Definition TProofDraw.h:154
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the eventlist with given values.
TEventList * fElist
Definition TProofDraw.h:127
void DefVar() override
Definition TProofDraw.h:131
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void Terminate() override
See TProofDraw::Terminate().
void Init(TTree *) override
See TProofDraw::Init().
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the eventlist with given values.
void SlaveTerminate() override
See TProofDraw::SlaveTerminate().
~TProofDrawEventList() override
Definition TProofDraw.h:135
void Init(TTree *tree) override
See TProofDraw::Init().
void Terminate() override
See TProofDraw::Terminate().
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the graph with the given values.
TGraph * fGraph
Definition TProofDraw.h:206
void DefVar() override
Definition TProofDraw.h:209
void Begin(TTree *t) override
See TProofDraw::Begin().
void DefVar2D()
Define variables for 2D histogram.
void Terminate() override
See TProofDraw::Terminate().
virtual void Begin2D(TTree *t)
Initialization for 2D histogram.
void DefVar() override
Define variables according to arguments.
void Init(TTree *) override
See TProofDraw::Init().
virtual void Begin3D(TTree *t)
Initialization for 3D histogram.
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the histgram with given values.
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
virtual void Begin1D(TTree *t)
Initialization for 1D Histogram.
void DefVar1D()
Define vars for 1D Histogram.
void DefVar3D()
Define variables for 3D histogram.
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the scatter plot with the given values.
void Terminate() override
See TProofDraw::Terminate().
TProofVectorContainer< Point3D_t > * fPoints
Definition TProofDraw.h:268
void DefVar() override
Definition TProofDraw.h:270
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void Terminate() override
See TProofDraw::Terminate().
TProofVectorContainer< Point4D_t > * fPoints
Definition TProofDraw.h:292
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the scatter plot with the given values.
TPolyMarker3D * fPolyMarker3D
Definition TProofDraw.h:224
void Terminate() override
See TProofDraw::Terminate().
void Init(TTree *tree) override
See TProofDraw::Init().
void DefVar() override
Definition TProofDraw.h:227
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the scatter plot with the given values.
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the histogram with the given values.
void Begin(TTree *t) override
See TProofDraw::Begin().
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
TProfile2D * fProfile
Definition TProofDraw.h:187
void Init(TTree *) override
See TProofDraw::Init().
void Terminate() override
See TProofDraw::Terminate().
void DefVar() override
Define relevant variables.
void DefVar() override
Define relevant variables.
TProfile * fProfile
Definition TProofDraw.h:168
void Init(TTree *) override
See TProofDraw::Init().
void Terminate() override
See TProofDraw::Terminate().
void SlaveBegin(TTree *) override
See TProofDraw::SlaveBegin().
void DoFill(Long64_t entry, Double_t w, const Double_t *v) override
Fills the profile histogram with the given values.
void Begin(TTree *t) override
See TProofDraw::Begin().
Implement Tree drawing using PROOF.
Definition TProofDraw.h:49
void SetCanvas(const char *objname)
Move to a canvas named <name>_canvas; create the canvas if not existing.
Int_t fMultiplicity
Definition TProofDraw.h:62
void Begin(TTree *) override
Executed by the client before processing.
void SlaveBegin(TTree *) override
Executed by each slave before processing.
Bool_t Notify() override
Called when a new tree is loaded.
virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v)=0
virtual void DefVar()=0
TTreeFormula * fSelect
Definition TProofDraw.h:61
TString fSelection
Definition TProofDraw.h:56
void Init(TTree *) override
Init the tree.
TString fInitialExp
Definition TProofDraw.h:57
void FillWeight()
Get weight from input list, if any.
void SlaveTerminate() override
Executed by each slave after the processing has finished, before returning the results to the client.
void SetDrawAtt(TObject *o)
Set the drawing attributes from the input list.
virtual Bool_t CompileVariables()
Compiles each variable from fTreeDrawArgsParser for the tree fTree.
void Terminate() override
Executed by the client after getting the processing retults.
TTreeFormula * fVar[4]
Definition TProofDraw.h:60
void SetError(const char *sub, const char *mesg)
Sets the error status.
TTreeFormulaManager * fManager
Definition TProofDraw.h:58
~TProofDraw() override
Destructor.
Bool_t Process(Long64_t) override
Executed for each entry.
virtual void ClearFormula()
Delete internal buffers.
Bool_t fObjEval
Definition TProofDraw.h:63
TProofDraw()
Constructor.
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
TTree * fTree
Definition TProofDraw.h:59
virtual Bool_t ProcessSingle(Long64_t, Int_t)
Processes a single variable from an entry.
int Version() const override
Definition TProofDraw.h:84
Internal class steering processing in PROOF.
~TProofVectorContainer() override
Definition TProofDraw.h:249
std::vector< T > * GetVector() const
Definition TProofDraw.h:251
TProofVectorContainer(std::vector< T > *anVector)
Definition TProofDraw.h:247
Long64_t Merge(TCollection *list)
Definition TProofDraw.h:305
std::vector< T > * fVector
Definition TProofDraw.h:244
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
This class holds the status of an ongoing operation and collects error messages.
Definition TStatus.h:32
Basic string class.
Definition TString.h:139
A class that parses all parameters for TTree::Draw().
Used to coordinate one or more TTreeFormula objects.
Used to pass a selection expression to the Tree drawing routine.
A TTree represents a columnar dataset.
Definition TTree.h:79
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Point3D_t(Double_t x, Double_t y, Double_t z)
Definition TProofDraw.h:263
Point4D_t(Double_t x, Double_t y, Double_t z, Double_t t)
Definition TProofDraw.h:287