2 printf(
"This demo show how to handle TTreeViewer sessions\n");
3 printf(
"Compile class Event from test directory before running this\n");
4 printf(
"- use arrow buttons from bottom to cycle records ...\n");
5 printf(
"- make new expressions and drag them to X, Y, Z or Cut items ...\n");
6 printf(
"- use the Draw button to check your current selection ...\n");
7 printf(
"- click the record button once you are happy with this ...\n");
8 printf(
"- open the TV context menu (right-click on the right panel)...\n");
9 printf(
" Use : RemoveLastRecord() - to remove last record :-)\n");
10 printf(
" SetRecordName() - to name current record\n");
11 printf(
" UpdateRecord() - if you want to change a record from the list\n");
12 printf(
" with your new X, Y, Z, Cut configuration.\n");
13 printf(
" Best luck !\n");
26 TFile *tv_file = (
TFile*)
gROOT->GetListOfFiles()->FindObject(
"Event.root");
28 if (!tv_file) tv_file =
new TFile(
"$ROOTSYS/test/Event.root");
29 if (tv_file) tv_tree = (
TTree*)tv_file->
Get(
"T");
31 printf(
"Tree %s not found", fTree->GetName());
57 item->
SetExpression(
"sqrt(fTracks.fPx*fTracks.fPx+fTracks.fPy*fTracks.fPy)",
"~Pt",
kFALSE);
80 tv_record = tv_session->AddRecord(
kTRUE);
81 tv_session->SetRecordName(
"Temperature");
82 tv_record->fX =
"fTemperature";
86 tv_record->fXAlias =
"fTemperature";
87 tv_record->fYAlias =
"-empty-";
88 tv_record->fZAlias =
"-empty-";
89 tv_record->fCutAlias =
"-empty-";
90 tv_record->fOption =
"lego1";
91 tv_record->fScanRedirected =
kFALSE;
92 tv_record->fCutEnabled =
kTRUE;
94 tv_record = tv_session->AddRecord(
kTRUE);
95 tv_session->SetRecordName(
"Py versus Px");
96 tv_record->fX =
"fTracks.fPx";
97 tv_record->fY =
"fTracks.fPy";
100 tv_record->fXAlias =
"fTracks.fPx";
101 tv_record->fYAlias =
"fTracks.fPy";
102 tv_record->fZAlias =
"-empty-";
103 tv_record->fCutAlias =
"-empty-";
104 tv_record->fOption =
"lego";
105 tv_record->fScanRedirected =
kFALSE;
106 tv_record->fCutEnabled =
kTRUE;
108 tv_record = tv_session->AddRecord(
kTRUE);
109 tv_session->SetRecordName(
"Transverse momentum");
110 tv_record->fX =
"sqrt(fTracks.fPx*fTracks.fPx+fTracks.fPy*fTracks.fPy)";
113 tv_record->fCut =
"fTracks.fPx>0";
114 tv_record->fXAlias =
"~Pt";
115 tv_record->fYAlias =
"-empty-";
116 tv_record->fZAlias =
"-empty-";
117 tv_record->fCutAlias =
"~Cut1";
118 tv_record->fOption =
"";
119 tv_record->fScanRedirected =
kFALSE;
120 tv_record->fCutEnabled =
kTRUE;
122 tv_record = tv_session->AddRecord(
kTRUE);
123 tv_session->SetRecordName(
"Surface plot of Py vs. Px");
124 tv_record->fX =
"fTracks.fPx";
125 tv_record->fY =
"fTracks.fPy";
127 tv_record->fCut =
"";
128 tv_record->fXAlias =
"fTracks.fPx";
129 tv_record->fYAlias =
"fTracks.fPy";
130 tv_record->fZAlias =
"-empty-";
131 tv_record->fCutAlias =
"-empty-";
132 tv_record->fOption =
"SURF";
133 tv_record->fScanRedirected =
kFALSE;
134 tv_record->fCutEnabled =
kTRUE;
136 tv_session->Show(tv_session->First());
void SetNexpressions(Int_t expr)
Change the number of expression widgets.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
void SetTreeName(const char *treeName)
Allow geting the tree from the context menu.
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features...
void SetExpression(const char *name, const char *alias, Bool_t cutType=kFALSE)
Set the true name, alias and type of the expression, then refresh it.
TTVLVEntry * ExpressionItem(Int_t index)
Get the item from a specific position.
This class represent entries that goes into the TreeViewer listview container.
void SetSession(TTVSession *session)
Set current session.
I/O classes for TreeViewer session handling.
A TTree object has a header with a name and a title.