Logo ROOT   6.18/05
Reference Guide
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 virtual ~TProofDraw();
84 virtual int Version() const { return 1; }
85 virtual void Init(TTree *);
86 virtual void Begin(TTree *);
87 virtual void SlaveBegin(TTree *);
88 virtual Bool_t Notify();
89 virtual Bool_t Process(Long64_t /*entry*/);
90 virtual void SlaveTerminate();
91 virtual void Terminate();
92
93 ClassDef(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 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
111 virtual void DefVar();
112
113public:
115 virtual void Begin(TTree *t);
116 virtual void Init(TTree *);
117 virtual void SlaveBegin(TTree *);
118 virtual void Terminate();
119
120 ClassDef(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 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
131 virtual void DefVar() { }
132
133public:
136
137 virtual void Init(TTree *);
138 virtual void SlaveBegin(TTree *);
139 virtual void SlaveTerminate();
140 virtual void Terminate();
141
142 ClassDef(TProofDrawEventList,0) //Tree drawing selector for PROOF
143};
144
146 protected:
148
149 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
150 virtual void DefVar() {}
151
152 public:
155
156 virtual void Init(TTree *);
157 virtual void SlaveBegin(TTree *);
158 virtual void SlaveTerminate();
159 virtual void Terminate();
160
161 ClassDef(TProofDrawEntryList, 0) //A Selectoor to fill a TEntryList from TTree::Draw
162};
163
164
166
167protected:
169
170 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
171 virtual void DefVar();
172
173public:
175 virtual void Init(TTree *);
176 virtual void Begin(TTree *t);
177 virtual void SlaveBegin(TTree *);
178 virtual void Terminate();
179
180 ClassDef(TProofDrawProfile,0) //Tree drawing selector for PROOF
181};
182
183
185
186protected:
188
189 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
190 virtual void DefVar();
191
192public:
194 virtual void Init(TTree *);
195 virtual void Begin(TTree *t);
196 virtual void SlaveBegin(TTree *);
197 virtual void Terminate();
198
199 ClassDef(TProofDrawProfile2D,0) //Tree drawing selector for PROOF
200};
201
202
204
205protected:
207
208 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
209 virtual void DefVar() { }
210
211public:
213 virtual void Init(TTree *tree);
214 virtual void SlaveBegin(TTree *);
215 virtual void Terminate();
216
217 ClassDef(TProofDrawGraph,0) //Tree drawing selector for PROOF
218};
219
220
222
223protected:
225
226 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
227 virtual void DefVar() { }
228
229public:
231 virtual void Init(TTree *tree);
232 virtual void SlaveBegin(TTree *);
233 virtual void Terminate();
234
235 ClassDef(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) { }
250
251 std::vector<T> *GetVector() const { return fVector; }
253
254 ClassDef(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 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
270 virtual void DefVar() { }
271
272public:
274 virtual void SlaveBegin(TTree *);
275 virtual void Terminate();
276
277 ClassDef(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 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
294 virtual void DefVar() { }
295
296public:
298 virtual void SlaveBegin(TTree *);
299 virtual void Terminate();
300
301 ClassDef(TProofDrawListOfPolyMarkers3D,0) //Tree drawing selector for PROOF
302};
303
304#ifndef __CINT__
305template <typename T>
307{
308 // Adds all vectors holded by all TProofVectorContainers in the collection
309 // the vector holded by this TProofVectorContainer.
310 // Returns the total number of poins in the result or -1 in case of an error.
311
312 TIter next(li);
313
314 std::back_insert_iterator<std::vector<T> > ii(*fVector);
315 while (TObject* o = next()) {
316 TProofVectorContainer<T> *vh = dynamic_cast<TProofVectorContainer<T>*> (o);
317 if (!vh) {
318 Error("Merge",
319 "Cannot merge - an object which doesn't inherit from TProofVectorContainer<T> found in the list");
320 return -1;
321 }
322 std::copy(vh->GetVector()->begin(), vh->GetVector()->end(), ii);
323 }
324 return fVector->size();
325}
326#endif
327
328#endif
SVector< double, 2 > v
Definition: Dict.h:5
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
#define ClassDef(name, id)
Definition: Rtypes.h:326
#define BIT(n)
Definition: Rtypes.h:83
void Error(const char *location, const char *msgfmt,...)
Collection abstract base class.
Definition: TCollection.h:63
A List of entry numbers in a TTree or TChain.
Definition: TEntryList.h:26
A TEventList object is a list of selected events (entries) in a TTree.
Definition: TEventList.h:31
A Graph is a graphics object made of two arrays X and Y with npoints each.
Definition: TGraph.h:41
The TH1 histogram class.
Definition: TH1.h:56
A doubly linked list.
Definition: TList.h:44
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
A 3D polymarker.
Definition: TPolyMarker3D.h:33
Profile2D histograms are used to display the mean value of Z and its RMS for each cell in X,...
Definition: TProfile2D.h:27
Profile Histogram.
Definition: TProfile.h:32
TEntryList * fElist
Definition: TProofDraw.h:147
virtual void Init(TTree *)
See TProofDraw::Init().
virtual void DefVar()
Definition: TProofDraw.h:150
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 DefVar()
Definition: TProofDraw.h:131
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 DefVar()
Definition: TProofDraw.h:209
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 DefVar()
Definition: TProofDraw.h:270
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 DefVar()
Definition: TProofDraw.h:227
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
virtual void DefVar()=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
virtual int Version() const
Definition: TProofDraw.h:84
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
Internal class steering processing in PROOF.
Definition: TProofPlayer.h:60
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:306
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:33
This class holds the status of an ongoing operation and collects error messages.
Definition: TStatus.h:32
Basic string class.
Definition: TString.h:131
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.
Definition: TTreeFormula.h:58
A TTree represents a columnar dataset.
Definition: TTree.h:71
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Definition: tree.py:1
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