Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveTreeTools.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12//______________________________________________________________________________
13// TTreeTools
14//
15// Collection of classes for TTree interaction.
16
17#include "TEveTreeTools.h"
18#include "TTree.h"
19#include "TTreeFormula.h"
20
21/** \class TEveSelectorToEventList
22\ingroup TEve
23TSelector that stores entry numbers of matching TTree entries into
24an event-list.
25*/
26
27
28////////////////////////////////////////////////////////////////////////////////
29/// Constructor.
30
32 TSelectorDraw(), fEvList(evl)
33{
35 fInputList.Add(new TNamed("varexp", ""));
36 fInputList.Add(new TNamed("selection", sel));
38}
39
40////////////////////////////////////////////////////////////////////////////////
41/// Process entry.
42
44{
45 if(GetSelect()->EvalInstance(0) != 0)
47 return kTRUE;
48}
49
50/** \class TEvePointSelector
51\ingroup TEve
52TEvePointSelector is a sub-class of TSelectorDraw for direct
53extraction of point-like data from a Tree.
54*/
55
56/** \class TEvePointSelectorConsumer
57\ingroup TEve
58TEvePointSelectorConsumer is a virtual base for classes that can be
59filled from TTree data via the TEvePointSelector class.
60*/
61
62
63////////////////////////////////////////////////////////////////////////////////
64/// Constructor.
65
68 const char* vexp, const char* sel) :
70
71 fSelectTree(t),
72 fConsumer (c),
73 fVarexp (vexp),
74 fSelection (sel),
75 fSubIdExp (),
76 fSubIdNum (0)
77{
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// Process the tree, select points matching 'selection'.
84
86{
87 TString var(fVarexp);
88 if (fSubIdExp.IsNull()) {
89 fSubIdNum = 0;
90 } else {
91 fSubIdNum = fSubIdExp.CountChar(':') + 1;
92 var += ":" + fSubIdExp;
93 }
94
96 if (selection != nullptr)
97 sel = selection;
98 else
100
102 fInputList.Add(new TNamed("varexp", var.Data()));
103 fInputList.Add(new TNamed("selection", sel.Data()));
104
105 if (fConsumer)
107
108 if (fSelectTree)
109 fSelectTree->Process(this, "goff");
110
111 return fSelectedRows;
112}
113
114////////////////////////////////////////////////////////////////////////////////
115/// Process tree 't', select points matching 'selection'.
116
118{
119 fSelectTree = t;
120 return Select(selection);
121}
122
123////////////////////////////////////////////////////////////////////////////////
124/// Callback from tree-player after a chunk of data has been processed.
125/// This is forwarded to the current point-consumer.
126
128{
130 // printf("TEvePointSelector::TakeAction nfill=%d, nall=%lld\n", fNfill, fSelectedRows);
131 if (fConsumer) {
132 fConsumer->TakeAction(this);
133 }
134}
#define c(i)
Definition RSha256.hxx:101
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
TEvePointSelectorConsumer is a virtual base for classes that can be filled from TTree data via the TE...
virtual void TakeAction(TEvePointSelector *)=0
virtual void InitFill(Int_t)
void TakeAction() override
Callback from tree-player after a chunk of data has been processed.
virtual Long64_t Select(const char *selection=nullptr)
Process the tree, select points matching 'selection'.
TEvePointSelectorConsumer * fConsumer
TEvePointSelector(const TEvePointSelector &)=delete
Bool_t Process(Long64_t entry) override
Process entry.
TEveSelectorToEventList(const TEveSelectorToEventList &)=delete
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
Definition TEventList.h:31
virtual void Enter(Long64_t entry)
Enter element entry into the list.
void Add(TObject *obj) override
Definition TList.h:81
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
Definition TList.cxx:467
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
A specialized TSelector for TTree::Draw.
TTreeFormula * GetSelect() const
Long64_t fSelectedRows
Number of selected entries.
Int_t fNfill
! Total number of histogram fills
virtual void SetInputList(TList *input)
Definition TSelector.h:66
Basic string class.
Definition TString.h:138
const char * Data() const
Definition TString.h:384
Bool_t IsNull() const
Definition TString.h:422
Int_t CountChar(Int_t c) const
Return number of times character c occurs in the string.
Definition TString.cxx:522
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual Long64_t Process(const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Process this tree executing the TSelector code in the specified filename.
Definition TTree.cxx:7606