Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:41

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