00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TProofDraw
00013 #define ROOT_TProofDraw
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef ROOT_TSelector
00025 #include "TSelector.h"
00026 #endif
00027
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031
00032 #ifndef ROOT_TTreeDrawArgsParser
00033 #include "TTreeDrawArgsParser.h"
00034 #endif
00035
00036 #ifndef ROOT_TNamed
00037 #include "TNamed.h"
00038 #endif
00039
00040 #include <vector>
00041
00042
00043 class TTree;
00044 class TTreeFormulaManager;
00045 class TTreeFormula;
00046 class TStatus;
00047 class TH1;
00048 class TEventList;
00049 class TEntryList;
00050 class TProfile;
00051 class TProfile2D;
00052 class TGraph;
00053 class TPolyMarker3D;
00054 class TCollection;
00055
00056
00057 class TProofDraw : public TSelector {
00058
00059 friend class TProofPlayer;
00060
00061 protected:
00062 TTreeDrawArgsParser fTreeDrawArgsParser;
00063 TStatus *fStatus;
00064 TString fSelection;
00065 TString fInitialExp;
00066 TTreeFormulaManager *fManager;
00067 TTree *fTree;
00068 TTreeFormula *fVar[4];
00069 TTreeFormula *fSelect;
00070 Int_t fMultiplicity;
00071 Bool_t fObjEval;
00072 Int_t fDimension;
00073
00074 void SetCanvas(const char *objname);
00075 void SetDrawAtt(TObject *o);
00076 void SetError(const char *sub, const char *mesg);
00077
00078 protected:
00079 enum { kWarn = BIT(12) };
00080
00081 virtual Bool_t CompileVariables();
00082 virtual void ClearFormula();
00083 virtual Bool_t ProcessSingle(Long64_t , Int_t );
00084 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v) = 0;
00085 virtual void DefVar() = 0;
00086
00087 public:
00088 TProofDraw();
00089 virtual ~TProofDraw();
00090 virtual int Version() const { return 1; }
00091 virtual void Init(TTree *);
00092 virtual void Begin(TTree *);
00093 virtual void SlaveBegin(TTree *);
00094 virtual Bool_t Notify();
00095 virtual Bool_t Process(Long64_t );
00096 virtual void SlaveTerminate();
00097 virtual void Terminate();
00098
00099 ClassDef(TProofDraw,0)
00100 };
00101
00102
00103 class TProofDrawHist : public TProofDraw {
00104
00105 private:
00106 void DefVar1D();
00107 void DefVar2D();
00108 void DefVar3D();
00109
00110 protected:
00111 TH1 *fHistogram;
00112
00113 virtual void Begin1D(TTree *t);
00114 virtual void Begin2D(TTree *t);
00115 virtual void Begin3D(TTree *t);
00116 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00117 virtual void DefVar();
00118
00119 public:
00120 TProofDrawHist() : fHistogram(0) { }
00121 virtual void Begin(TTree *t);
00122 virtual void Init(TTree *);
00123 virtual void SlaveBegin(TTree *);
00124 virtual void Terminate();
00125
00126 ClassDef(TProofDrawHist,0)
00127 };
00128
00129
00130 class TProofDrawEventList : public TProofDraw {
00131
00132 protected:
00133 TEventList* fElist;
00134 TList* fEventLists;
00135
00136 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00137 virtual void DefVar() { }
00138
00139 public:
00140 TProofDrawEventList() : fElist(0), fEventLists(0) {}
00141 ~TProofDrawEventList();
00142
00143 virtual void Init(TTree *);
00144 virtual void SlaveBegin(TTree *);
00145 virtual void SlaveTerminate();
00146 virtual void Terminate();
00147
00148 ClassDef(TProofDrawEventList,0)
00149 };
00150
00151 class TProofDrawEntryList : public TProofDraw {
00152 protected:
00153 TEntryList *fElist;
00154
00155 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00156 virtual void DefVar() {}
00157
00158 public:
00159 TProofDrawEntryList() : fElist(0) {};
00160 ~TProofDrawEntryList();
00161
00162 virtual void Init(TTree *);
00163 virtual void SlaveBegin(TTree *);
00164 virtual void SlaveTerminate();
00165 virtual void Terminate();
00166
00167 ClassDef(TProofDrawEntryList, 0)
00168 };
00169
00170
00171 class TProofDrawProfile : public TProofDraw {
00172
00173 protected:
00174 TProfile *fProfile;
00175
00176 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00177 virtual void DefVar();
00178
00179 public:
00180 TProofDrawProfile() : fProfile(0) { }
00181 virtual void Init(TTree *);
00182 virtual void Begin(TTree *t);
00183 virtual void SlaveBegin(TTree *);
00184 virtual void Terminate();
00185
00186 ClassDef(TProofDrawProfile,0)
00187 };
00188
00189
00190 class TProofDrawProfile2D : public TProofDraw {
00191
00192 protected:
00193 TProfile2D *fProfile;
00194
00195 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00196 virtual void DefVar();
00197
00198 public:
00199 TProofDrawProfile2D() : fProfile(0) { }
00200 virtual void Init(TTree *);
00201 virtual void Begin(TTree *t);
00202 virtual void SlaveBegin(TTree *);
00203 virtual void Terminate();
00204
00205 ClassDef(TProofDrawProfile2D,0)
00206 };
00207
00208
00209 class TProofDrawGraph : public TProofDraw {
00210
00211 protected:
00212 TGraph *fGraph;
00213
00214 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00215 virtual void DefVar() { }
00216
00217 public:
00218 TProofDrawGraph() : fGraph(0) { }
00219 virtual void Init(TTree *tree);
00220 virtual void SlaveBegin(TTree *);
00221 virtual void Terminate();
00222
00223 ClassDef(TProofDrawGraph,0)
00224 };
00225
00226
00227 class TProofDrawPolyMarker3D : public TProofDraw {
00228
00229 protected:
00230 TPolyMarker3D *fPolyMarker3D;
00231
00232 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00233 virtual void DefVar() { }
00234
00235 public:
00236 TProofDrawPolyMarker3D() : fPolyMarker3D(0) { }
00237 virtual void Init(TTree *tree);
00238 virtual void SlaveBegin(TTree *);
00239 virtual void Terminate();
00240
00241 ClassDef(TProofDrawPolyMarker3D,0)
00242 };
00243
00244 template <typename T>
00245 class TProofVectorContainer : public TNamed {
00246
00247
00248
00249 protected:
00250 std::vector<T> *fVector;
00251
00252 public:
00253 TProofVectorContainer(std::vector<T>* anVector) : fVector(anVector) { }
00254 TProofVectorContainer() : fVector(0) { }
00255 ~TProofVectorContainer() { delete fVector; }
00256
00257 std::vector<T> *GetVector() const { return fVector; }
00258 Long64_t Merge(TCollection* list);
00259
00260 ClassDef(TProofVectorContainer,1)
00261 };
00262
00263 class TProofDrawListOfGraphs : public TProofDraw {
00264
00265 public:
00266 struct Point3D_t {
00267 public:
00268 Double_t fX, fY, fZ;
00269 Point3D_t(Double_t x, Double_t y, Double_t z) : fX(x), fY(y), fZ(z) { }
00270 Point3D_t() : fX(0), fY(0), fZ(0) { }
00271 };
00272
00273 protected:
00274 TProofVectorContainer<Point3D_t> *fPoints;
00275 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00276 virtual void DefVar() { }
00277
00278 public:
00279 TProofDrawListOfGraphs() : fPoints(0) { }
00280 virtual void SlaveBegin(TTree *);
00281 virtual void Terminate();
00282
00283 ClassDef(TProofDrawListOfGraphs,0)
00284 };
00285
00286
00287 class TProofDrawListOfPolyMarkers3D : public TProofDraw {
00288
00289 public:
00290 struct Point4D_t {
00291 public:
00292 Double_t fX, fY, fZ, fT;
00293 Point4D_t(Double_t x, Double_t y, Double_t z, Double_t t) : fX(x), fY(y), fZ(z), fT(t) { }
00294 Point4D_t() : fX(0), fY(0), fZ(0), fT(0) { }
00295 };
00296
00297 protected:
00298 TProofVectorContainer<Point4D_t> *fPoints;
00299 virtual void DoFill(Long64_t entry, Double_t w, const Double_t *v);
00300 virtual void DefVar() { }
00301
00302 public:
00303 TProofDrawListOfPolyMarkers3D() : fPoints(0) { }
00304 virtual void SlaveBegin(TTree *);
00305 virtual void Terminate();
00306
00307 ClassDef(TProofDrawListOfPolyMarkers3D,0)
00308 };
00309
00310 #ifndef __CINT__
00311 template <typename T>
00312 Long64_t TProofVectorContainer<T>::Merge(TCollection* li)
00313 {
00314
00315
00316
00317
00318 TIter next(li);
00319
00320 std::back_insert_iterator<std::vector<T> > ii(*fVector);
00321 while (TObject* o = next()) {
00322 TProofVectorContainer<T> *vh = dynamic_cast<TProofVectorContainer<T>*> (o);
00323 if (!vh) {
00324 Error("Merge",
00325 "Cannot merge - an object which doesn't inherit from TProofVectorContainer<T> found in the list");
00326 return -1;
00327 }
00328 std::copy(vh->GetVector()->begin(), vh->GetVector()->end(), ii);
00329 }
00330 return fVector->size();
00331 }
00332 #endif
00333
00334 #endif