52 : TVirtualTableInterface(), fTree(tree), fFormulas(0), fEntry(0),
53 fNEntries(nentries), fFirstEntry(firstentry), fManager(0), fSelect(0), fSelector(0), fInput(0),
54 fForceDim(kFALSE), fEntries(0), fNRows(0), fNColumns(0)
57 Error(
"TTreeTableInterface",
"No tree supplied");
61 fFormulas=
new TList();
64 fInput->Add(
new TNamed(
"varexp",
""));
65 fInput->Add(
new TNamed(
"selection",
""));
66 fSelector->SetInputList(fInput);
72 fNEntries = fTree->GetEntries();
73 Info(
"TTreeTableInterface",
"nentries was 0, setting to maximum number"
74 " available in the tree");
78 SetVariablesExpression(varexp);
79 SetSelection(selection);
82 Warning (
"TTreeTableInterface::TTreeTableInterface",
"nrows = 0");
85 Warning (
"TTreeTableInterface::TTreeTableInterface",
"ncolumns = 0");
113 if (!strcmp(varexp,
"*")) { allvar =
kTRUE; }
123 Error(
"TTreeTableInterface",
"No leaves in Tree");
133 std::vector<TString> cnames;
134 fNColumns = fSelector->SplitNames(varexp,cnames);
150 fFormulas->Remove(fSelect);
154 if (selection && strlen(selection)) {
156 fFormulas->Add(fSelect);
160 for (
Int_t i = 0; i <= fFormulas->LastIndex(); i++) {
178 if (fFormulas->LastIndex() >= 0) {
180 if (fSelect->GetManager()->GetMultiplicity() > 0 ) {
182 for (i = 0; i <= fFormulas->LastIndex(); i++) {
188 for (i = 0; i < fFormulas->LastIndex(); i++) {
219 while (entriesToDisplay != 0){
223 if (localEntry < 0)
break;
226 if (fManager) fManager->UpdateFormulaLeaves();
228 for(i = 0; i < fFormulas->LastIndex(); i++)
229 ((
TTreeFormula*)fFormulas->At(ui))->UpdateFormulaLeaves();
235 ndata = fManager->GetNdata(
kTRUE);
238 if (ndata < ((
TTreeFormula*)fFormulas->At(ui))->GetNdata())
243 if (fSelect && fSelect->GetNdata() == 0)
252 if (fSelect->EvalInstance(inst) == 0){
259 entrylist->
Enter(entry);
278 if (row == prow + 1) {
279 entry = fEntries->Next();
281 entry = fEntries->GetEntry(row);
286 Error(
"TTreeTableInterface",
"Row requested does not exist");
289 if (column < fNColumns) {
294 Warning(
"TTreeTableInterface::GetValue",
"Value requested is a "
295 "string, returning 0.");
299 Error(
"TTreeTableInterface",
"Column requested does not exist");
314 if (row == prow + 1) {
315 entry = fEntries->Next();
317 entry = fEntries->GetEntry(row);
322 Error(
"TTreeTableInterface",
"Row requested does not exist");
325 if (column < fNColumns) {
333 Error(
"TTreeTableInterface",
"Column requested does not exist");
344 return Form(
"%lld", fEntries->GetEntry(row));
346 Error(
"TTreeTableInterface",
"Row requested does not exist");
357 if (column < fNColumns) {
360 Error(
"TTreeTableInterface",
"Column requested does not exist");
391 Error(
"TTreeTableInterface::AddColumn",
"Only 1 expression allowed.");
397 fFormulas->AddAt(formula, position);
400 fManager->Add(formula);
412 if (position > fNColumns) {
413 Error(
"TTreeTableInterface::AddColumn",
"Please specify a "
417 fFormulas->AddAt(formula, position);
419 fManager->Add(formula);
431 if (position >= fNColumns) {
432 Error(
"TTreeTableInterface::RemoveColumn",
"Please specify a "
435 }
else if (fNColumns == 1) {
436 Error(
"TTreeTableInterface::RemoveColumn",
"Can't remove last column");
442 fManager->Remove(formula);
446 if (formula)
delete formula;
455 if (position >= fNColumns) {
456 Error(
"TTreeTableInterface::SetFormula",
"Please specify a "
462 fManager->Remove(form);
464 if (form)
delete form;
465 fFormulas->AddAt(formula, position);
467 fManager->Add(formula);
480 fEntries = entrylist;
481 fNRows = fEntries->
GetN();
virtual const char * GetTitle() const
Returns title of object.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual void RemoveColumn(UInt_t position)
Remove column at position, TGTable->Update() is needed afterwards to apply the change to the TGTable...
virtual void SetFormula(TTreeFormula *formula, UInt_t position)
Set the TTreeFormula of position to formula.
virtual UInt_t GetNRows()
Return the amount of rows in the Tree.
virtual const char * GetValueAsString(UInt_t row, UInt_t column)
Return the content of row,column as string to use in a TGTableCell label.
virtual void AddColumn(const char *expression, UInt_t position)
Add column according ot expression at position, TGTable->Update() is needed afterwards to apply the c...
virtual const char * GetColumnHeader(UInt_t column)
Return a string to use as a label for columnheader at column.
The TNamed class is the base class for all named ROOT classes.
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
void Info(const char *location, const char *msgfmt,...)
std::vector< std::vector< double > > Data
void Error(const char *location, const char *msgfmt,...)
virtual Int_t GetTreeNumber() const
void SetVariablesExpression(const char *varexp)
Compile the variables expression from the given varexp.
char * Form(const char *fmt,...)
virtual const char * GetName() const
Returns name of object.
TSelectorDraw * fSelector
void Warning(const char *location, const char *msgfmt,...)
A specialized TSelector for TTree::Draw.
virtual ~TTreeTableInterface()
TTreeTableInterface destructor.
void SyncFormulas()
Sync the formulas using the TTreeFormulaManager.
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
virtual const char * GetRowHeader(UInt_t row)
Return a string to use as a label for rowheader at column.
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual Bool_t Enter(Long64_t entry, TTree *tree=0)
Add entry entry to the list.
virtual Long64_t GetN() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Double_t GetValue(UInt_t row, UInt_t column)
Return the value of row,column.
void InitEntries()
Initialise the TEntryList with the entries that match the selection criterium.
TTreeTableInterface is used to interface to data that is stored in a TTree.
A TTree object has a header with a name and a title.
virtual UInt_t GetNColumns()
Return the amount of column available.
TObject * At(Int_t idx) const
virtual void SetEntryList(TEntryList *entrylist=0)
Set the currently active entrylist.
A List of entry numbers in a TTree or TChain.
static char * skip(char **buf, const char *delimiters)
virtual TObjArray * GetListOfLeaves()
virtual void SetSelection(const char *selection)
Set the selection expression.