11 if (!tv_file) tv_file =
new TFile(
"$ROOTSYS/test/Event.root");
12 if (tv_file) tv_tree = (
TTree*)tv_file->
Get(
"T");
14 printf(
"Tree not found\n");
40 item->
SetExpression(
"sqrt(fTracks.fPx*fTracks.fPx+fTracks.fPy*fTracks.fPy)",
"~Pt",
kFALSE);
63 auto tv_record = tv_session->AddRecord(
kTRUE);
64 tv_session->SetRecordName(
"Temperature");
65 tv_record->fX =
"fTemperature";
69 tv_record->fXAlias =
"fTemperature";
70 tv_record->fYAlias =
"-empty-";
71 tv_record->fZAlias =
"-empty-";
72 tv_record->fCutAlias =
"-empty-";
73 tv_record->fOption =
"lego1";
74 tv_record->fScanRedirected =
kFALSE;
75 tv_record->fCutEnabled =
kTRUE;
77 tv_record = tv_session->AddRecord(
kTRUE);
78 tv_session->SetRecordName(
"Py versus Px");
79 tv_record->fX =
"fTracks.fPx";
80 tv_record->fY =
"fTracks.fPy";
83 tv_record->fXAlias =
"fTracks.fPx";
84 tv_record->fYAlias =
"fTracks.fPy";
85 tv_record->fZAlias =
"-empty-";
86 tv_record->fCutAlias =
"-empty-";
87 tv_record->fOption =
"lego";
88 tv_record->fScanRedirected =
kFALSE;
89 tv_record->fCutEnabled =
kTRUE;
91 tv_record = tv_session->AddRecord(
kTRUE);
92 tv_session->SetRecordName(
"Transverse momentum");
93 tv_record->fX =
"sqrt(fTracks.fPx*fTracks.fPx+fTracks.fPy*fTracks.fPy)";
96 tv_record->fCut =
"fTracks.fPx>0";
97 tv_record->fXAlias =
"~Pt";
98 tv_record->fYAlias =
"-empty-";
99 tv_record->fZAlias =
"-empty-";
100 tv_record->fCutAlias =
"~Cut1";
101 tv_record->fOption =
"";
102 tv_record->fScanRedirected =
kFALSE;
103 tv_record->fCutEnabled =
kTRUE;
105 tv_record = tv_session->AddRecord(
kTRUE);
106 tv_session->SetRecordName(
"Surface plot of Py vs. Px");
107 tv_record->fX =
"fTracks.fPx";
108 tv_record->fY =
"fTracks.fPy";
110 tv_record->fCut =
"";
111 tv_record->fXAlias =
"fTracks.fPx";
112 tv_record->fYAlias =
"fTracks.fPy";
113 tv_record->fZAlias =
"-empty-";
114 tv_record->fCutAlias =
"-empty-";
115 tv_record->fOption =
"SURF";
116 tv_record->fScanRedirected =
kFALSE;
117 tv_record->fCutEnabled =
kTRUE;
119 tv_session->Show(tv_session->First());
123 printf(
"This demo show how to handle TTreeViewer sessions\n");
124 printf(
"Compile class Event from test directory before running this\n");
125 printf(
"- use arrow buttons from bottom to cycle records ...\n");
126 printf(
"- make new expressions and drag them to X, Y, Z or Cut items ...\n");
127 printf(
"- use the Draw button to check your current selection ...\n");
128 printf(
"- click the record button once you are happy with this ...\n");
129 printf(
"- open the TV context menu (right-click on the right panel)...\n");
130 printf(
" Use : RemoveLastRecord() - to remove last record :-)\n");
131 printf(
" SetRecordName() - to name current record\n");
132 printf(
" UpdateRecord() - if you want to change a record from the list\n");
133 printf(
" with your new X, Y, Z, Cut configuration.\n");
134 printf(
" Best luck !\n");
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
This class represent entries that goes into the TreeViewer listview container.
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.
I/O classes for TreeViewer session handling.
A graphic user interface designed to handle ROOT trees and to take advantage of TTree class features.
void SetNexpressions(Int_t expr)
void SetSession(TTVSession *session)
TTVLVEntry * ExpressionItem(Int_t index)
void SetTreeName(const char *treeName)
A TTree represents a columnar dataset.
void open_session(void *p=0)