// @(#)root/eve:$Id$
// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveTreeTools
#define ROOT_TEveTreeTools

#include "TSelectorDraw.h"
#include "TEventList.h"

/******************************************************************************/
// TEveSelectorToEventList
/******************************************************************************/

class TEveSelectorToEventList : public TSelectorDraw
{
   TEveSelectorToEventList(const TEveSelectorToEventList&);            // Not implemented
   TEveSelectorToEventList& operator=(const TEveSelectorToEventList&); // Not implemented

protected:
   TEventList* fEvList;
   TList       fInput;
public:
   TEveSelectorToEventList(TEventList* evl, const char* sel);

   virtual Int_t  Version() const { return 1; }
   virtual Bool_t Process(Long64_t entry);

   ClassDef(TEveSelectorToEventList, 1); // TSelector that stores entry numbers of matching TTree entries into an event-list.
};

/******************************************************************************/
// TEvePointSelectorConsumer, TEvePointSelector
/******************************************************************************/

class TEvePointSelector;

class TEvePointSelectorConsumer
{
public:
   enum ETreeVarType_e { kTVT_XYZ, kTVT_RPhiZ };

protected:
   ETreeVarType_e fSourceCS; // Coordinate-System of the source tree variables

public:
   TEvePointSelectorConsumer(ETreeVarType_e cs=kTVT_XYZ) :fSourceCS(cs) {}
   virtual ~TEvePointSelectorConsumer() {}

   virtual void InitFill(Int_t /*subIdNum*/) {}
   virtual void TakeAction(TEvePointSelector*) = 0;

   ETreeVarType_e GetSourceCS() const  { return fSourceCS; }
   void SetSourceCS(ETreeVarType_e cs) { fSourceCS = cs; }

   ClassDef(TEvePointSelectorConsumer, 1); // Virtual base for classes that can be filled from TTree data via the TEvePointSelector class.
};

class TEvePointSelector : public TSelectorDraw
{
   TEvePointSelector(const TEvePointSelector&);            // Not implemented
   TEvePointSelector& operator=(const TEvePointSelector&); // Not implemented

protected:
   TTree                  *fTree;
   TEvePointSelectorConsumer *fConsumer;

   TString                 fVarexp;
   TString                 fSelection;

   TString                 fSubIdExp;
   Int_t                   fSubIdNum;

   TList                   fInput;

public:
   TEvePointSelector(TTree* t=0, TEvePointSelectorConsumer* c=0,
                     const char* vexp="", const char* sel="");
   virtual ~TEvePointSelector() {}

   virtual Long64_t Select(const char* selection=0);
   virtual Long64_t Select(TTree* t, const char* selection=0);
   virtual void  TakeAction();


   TTree* GetTree() const   { return fTree; }
   void   SetTree(TTree* t) { fTree = t; }

   TEvePointSelectorConsumer* GetConsumer() const { return fConsumer; }
   void SetConsumer(TEvePointSelectorConsumer* c) { fConsumer = c; }

   const char* GetVarexp() const { return fVarexp; }
   void SetVarexp(const char* v) { fVarexp = v; }

   const char* GetSelection() const { return fSelection; }
   void SetSelection(const char* s) { fSelection = s; }

   const char* GetSubIdExp() const { return fSubIdExp; }
   void SetSubIdExp(const char* s) { fSubIdExp = s; }

   Int_t GetSubIdNum() const { return fSubIdNum; }

   ClassDef(TEvePointSelector, 1); // TSelector for direct extraction of point-like data from a Tree.
};

#endif
 TEveTreeTools.h:1
 TEveTreeTools.h:2
 TEveTreeTools.h:3
 TEveTreeTools.h:4
 TEveTreeTools.h:5
 TEveTreeTools.h:6
 TEveTreeTools.h:7
 TEveTreeTools.h:8
 TEveTreeTools.h:9
 TEveTreeTools.h:10
 TEveTreeTools.h:11
 TEveTreeTools.h:12
 TEveTreeTools.h:13
 TEveTreeTools.h:14
 TEveTreeTools.h:15
 TEveTreeTools.h:16
 TEveTreeTools.h:17
 TEveTreeTools.h:18
 TEveTreeTools.h:19
 TEveTreeTools.h:20
 TEveTreeTools.h:21
 TEveTreeTools.h:22
 TEveTreeTools.h:23
 TEveTreeTools.h:24
 TEveTreeTools.h:25
 TEveTreeTools.h:26
 TEveTreeTools.h:27
 TEveTreeTools.h:28
 TEveTreeTools.h:29
 TEveTreeTools.h:30
 TEveTreeTools.h:31
 TEveTreeTools.h:32
 TEveTreeTools.h:33
 TEveTreeTools.h:34
 TEveTreeTools.h:35
 TEveTreeTools.h:36
 TEveTreeTools.h:37
 TEveTreeTools.h:38
 TEveTreeTools.h:39
 TEveTreeTools.h:40
 TEveTreeTools.h:41
 TEveTreeTools.h:42
 TEveTreeTools.h:43
 TEveTreeTools.h:44
 TEveTreeTools.h:45
 TEveTreeTools.h:46
 TEveTreeTools.h:47
 TEveTreeTools.h:48
 TEveTreeTools.h:49
 TEveTreeTools.h:50
 TEveTreeTools.h:51
 TEveTreeTools.h:52
 TEveTreeTools.h:53
 TEveTreeTools.h:54
 TEveTreeTools.h:55
 TEveTreeTools.h:56
 TEveTreeTools.h:57
 TEveTreeTools.h:58
 TEveTreeTools.h:59
 TEveTreeTools.h:60
 TEveTreeTools.h:61
 TEveTreeTools.h:62
 TEveTreeTools.h:63
 TEveTreeTools.h:64
 TEveTreeTools.h:65
 TEveTreeTools.h:66
 TEveTreeTools.h:67
 TEveTreeTools.h:68
 TEveTreeTools.h:69
 TEveTreeTools.h:70
 TEveTreeTools.h:71
 TEveTreeTools.h:72
 TEveTreeTools.h:73
 TEveTreeTools.h:74
 TEveTreeTools.h:75
 TEveTreeTools.h:76
 TEveTreeTools.h:77
 TEveTreeTools.h:78
 TEveTreeTools.h:79
 TEveTreeTools.h:80
 TEveTreeTools.h:81
 TEveTreeTools.h:82
 TEveTreeTools.h:83
 TEveTreeTools.h:84
 TEveTreeTools.h:85
 TEveTreeTools.h:86
 TEveTreeTools.h:87
 TEveTreeTools.h:88
 TEveTreeTools.h:89
 TEveTreeTools.h:90
 TEveTreeTools.h:91
 TEveTreeTools.h:92
 TEveTreeTools.h:93
 TEveTreeTools.h:94
 TEveTreeTools.h:95
 TEveTreeTools.h:96
 TEveTreeTools.h:97
 TEveTreeTools.h:98
 TEveTreeTools.h:99
 TEveTreeTools.h:100
 TEveTreeTools.h:101
 TEveTreeTools.h:102
 TEveTreeTools.h:103
 TEveTreeTools.h:104
 TEveTreeTools.h:105
 TEveTreeTools.h:106
 TEveTreeTools.h:107
 TEveTreeTools.h:108
 TEveTreeTools.h:109
 TEveTreeTools.h:110
 TEveTreeTools.h:111
 TEveTreeTools.h:112
 TEveTreeTools.h:113