Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TEveTreeTools.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/eve:$Id$
0002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TEveTreeTools
0013 #define ROOT_TEveTreeTools
0014 
0015 #include "TSelectorDraw.h"
0016 #include "TEventList.h"
0017 
0018 /******************************************************************************/
0019 // TEveSelectorToEventList
0020 /******************************************************************************/
0021 
0022 class TEveSelectorToEventList : public TSelectorDraw
0023 {
0024    TEveSelectorToEventList(const TEveSelectorToEventList&) = delete;
0025    TEveSelectorToEventList& operator=(const TEveSelectorToEventList&) = delete;
0026 
0027 protected:
0028    TEventList* fEvList;
0029    TList       fInputList;
0030 public:
0031    TEveSelectorToEventList(TEventList* evl, const char* sel);
0032 
0033    Int_t  Version() const override { return 1; }
0034    Bool_t Process(Long64_t entry) override;
0035 
0036    ClassDefOverride(TEveSelectorToEventList, 2); // TSelector that stores entry numbers of matching TTree entries into an event-list.
0037 };
0038 
0039 /******************************************************************************/
0040 // TEvePointSelectorConsumer, TEvePointSelector
0041 /******************************************************************************/
0042 
0043 class TEvePointSelector;
0044 
0045 class TEvePointSelectorConsumer
0046 {
0047 public:
0048    enum ETreeVarType_e { kTVT_XYZ, kTVT_RPhiZ };
0049 
0050 protected:
0051    ETreeVarType_e fSourceCS; // Coordinate-System of the source tree variables
0052 
0053 public:
0054    TEvePointSelectorConsumer(ETreeVarType_e cs=kTVT_XYZ) :fSourceCS(cs) {}
0055    virtual ~TEvePointSelectorConsumer() {}
0056 
0057    virtual void InitFill(Int_t /*subIdNum*/) {}
0058    virtual void TakeAction(TEvePointSelector*) = 0;
0059 
0060    ETreeVarType_e GetSourceCS() const  { return fSourceCS; }
0061    void SetSourceCS(ETreeVarType_e cs) { fSourceCS = cs; }
0062 
0063    ClassDef(TEvePointSelectorConsumer, 1); // Virtual base for classes that can be filled from TTree data via the TEvePointSelector class.
0064 };
0065 
0066 class TEvePointSelector : public TSelectorDraw
0067 {
0068    TEvePointSelector(const TEvePointSelector&) = delete;
0069    TEvePointSelector& operator=(const TEvePointSelector&) = delete;
0070 
0071 protected:
0072    TTree                  *fSelectTree;
0073    TEvePointSelectorConsumer *fConsumer;
0074 
0075    TString                 fVarexp;
0076    TString                 fSelection;
0077 
0078    TString                 fSubIdExp;
0079    Int_t                   fSubIdNum;
0080 
0081    TList                   fInputList;
0082 
0083 public:
0084    TEvePointSelector(TTree* t=nullptr, TEvePointSelectorConsumer* c=nullptr,
0085                      const char* vexp="", const char* sel="");
0086    ~TEvePointSelector() override {}
0087 
0088    virtual Long64_t Select(const char* selection=nullptr);
0089    virtual Long64_t Select(TTree* t, const char* selection=nullptr);
0090    void  TakeAction() override;
0091 
0092 
0093    TTree* GetTree() const   { return fSelectTree; }
0094    void   SetTree(TTree* t) { fSelectTree = t; }
0095 
0096    TEvePointSelectorConsumer* GetConsumer() const { return fConsumer; }
0097    void SetConsumer(TEvePointSelectorConsumer* c) { fConsumer = c; }
0098 
0099    const char* GetVarexp() const { return fVarexp; }
0100    void SetVarexp(const char* v) { fVarexp = v; }
0101 
0102    const char* GetSelection() const { return fSelection; }
0103    void SetSelection(const char* s) { fSelection = s; }
0104 
0105    const char* GetSubIdExp() const { return fSubIdExp; }
0106    void SetSubIdExp(const char* s) { fSubIdExp = s; }
0107 
0108    Int_t GetSubIdNum() const { return fSubIdNum; }
0109 
0110    ClassDefOverride(TEvePointSelector, 2); // TSelector for direct extraction of point-like data from a Tree.
0111 };
0112 
0113 #endif