00001 // @(#)root/eve:$Id: TEveTreeTools.h 27157 2009-01-15 14:05:12Z brun $ 00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TEveTreeTools 00013 #define ROOT_TEveTreeTools 00014 00015 #include "TSelectorDraw.h" 00016 #include "TEventList.h" 00017 00018 /******************************************************************************/ 00019 // TEveSelectorToEventList 00020 /******************************************************************************/ 00021 00022 class TEveSelectorToEventList : public TSelectorDraw 00023 { 00024 TEveSelectorToEventList(const TEveSelectorToEventList&); // Not implemented 00025 TEveSelectorToEventList& operator=(const TEveSelectorToEventList&); // Not implemented 00026 00027 protected: 00028 TEventList* fEvList; 00029 TList fInput; 00030 public: 00031 TEveSelectorToEventList(TEventList* evl, const char* sel); 00032 00033 virtual Int_t Version() const { return 1; } 00034 virtual Bool_t Process(Long64_t entry); 00035 00036 ClassDef(TEveSelectorToEventList, 1); // TSelector that stores entry numbers of matching TTree entries into an event-list. 00037 }; 00038 00039 /******************************************************************************/ 00040 // TEvePointSelectorConsumer, TEvePointSelector 00041 /******************************************************************************/ 00042 00043 class TEvePointSelector; 00044 00045 class TEvePointSelectorConsumer 00046 { 00047 public: 00048 enum ETreeVarType_e { kTVT_XYZ, kTVT_RPhiZ }; 00049 00050 protected: 00051 ETreeVarType_e fSourceCS; // Coordinate-System of the source tree variables 00052 00053 public: 00054 TEvePointSelectorConsumer(ETreeVarType_e cs=kTVT_XYZ) :fSourceCS(cs) {} 00055 virtual ~TEvePointSelectorConsumer() {} 00056 00057 virtual void InitFill(Int_t /*subIdNum*/) {} 00058 virtual void TakeAction(TEvePointSelector*) = 0; 00059 00060 ETreeVarType_e GetSourceCS() const { return fSourceCS; } 00061 void SetSourceCS(ETreeVarType_e cs) { fSourceCS = cs; } 00062 00063 ClassDef(TEvePointSelectorConsumer, 1); // Virtual base for classes that can be filled from TTree data via the TEvePointSelector class. 00064 }; 00065 00066 class TEvePointSelector : public TSelectorDraw 00067 { 00068 TEvePointSelector(const TEvePointSelector&); // Not implemented 00069 TEvePointSelector& operator=(const TEvePointSelector&); // Not implemented 00070 00071 protected: 00072 TTree *fTree; 00073 TEvePointSelectorConsumer *fConsumer; 00074 00075 TString fVarexp; 00076 TString fSelection; 00077 00078 TString fSubIdExp; 00079 Int_t fSubIdNum; 00080 00081 TList fInput; 00082 00083 public: 00084 TEvePointSelector(TTree* t=0, TEvePointSelectorConsumer* c=0, 00085 const char* vexp="", const char* sel=""); 00086 virtual ~TEvePointSelector() {} 00087 00088 virtual Long64_t Select(const char* selection=0); 00089 virtual Long64_t Select(TTree* t, const char* selection=0); 00090 virtual void TakeAction(); 00091 00092 00093 TTree* GetTree() const { return fTree; } 00094 void SetTree(TTree* t) { fTree = t; } 00095 00096 TEvePointSelectorConsumer* GetConsumer() const { return fConsumer; } 00097 void SetConsumer(TEvePointSelectorConsumer* c) { fConsumer = c; } 00098 00099 const char* GetVarexp() const { return fVarexp; } 00100 void SetVarexp(const char* v) { fVarexp = v; } 00101 00102 const char* GetSelection() const { return fSelection; } 00103 void SetSelection(const char* s) { fSelection = s; } 00104 00105 const char* GetSubIdExp() const { return fSubIdExp; } 00106 void SetSubIdExp(const char* s) { fSubIdExp = s; } 00107 00108 Int_t GetSubIdNum() const { return fSubIdNum; } 00109 00110 ClassDef(TEvePointSelector, 1); // TSelector for direct extraction of point-like data from a Tree. 00111 }; 00112 00113 #endif