void open_session(
void *
p = 0) {
if (!tv_tree) {
if (!tv_file) tv_file =
new TFile(
"$ROOTSYS/test/Event.root");
if (tv_file) tv_tree = (
TTree*)tv_file->
Get(
"T");
if(!tv_tree) {
printf("Tree not found\n");
return;
}
}
auto tv_record = tv_session->AddRecord(
kTRUE);
tv_session->SetRecordName("Temperature");
tv_record->fX = "fTemperature";
tv_record->fY = "";
tv_record->fZ = "";
tv_record->fCut = "";
tv_record->fXAlias = "fTemperature";
tv_record->fYAlias = "-empty-";
tv_record->fZAlias = "-empty-";
tv_record->fCutAlias = "-empty-";
tv_record->fOption = "lego1";
tv_record->fScanRedirected =
kFALSE;
tv_record->fCutEnabled =
kTRUE;
tv_record = tv_session->AddRecord(
kTRUE);
tv_session->SetRecordName("Py versus Px");
tv_record->fX = "fTracks.fPx";
tv_record->fY = "fTracks.fPy";
tv_record->fZ = "";
tv_record->fCut = "";
tv_record->fXAlias = "fTracks.fPx";
tv_record->fYAlias = "fTracks.fPy";
tv_record->fZAlias = "-empty-";
tv_record->fCutAlias = "-empty-";
tv_record->fOption = "lego";
tv_record->fScanRedirected =
kFALSE;
tv_record->fCutEnabled =
kTRUE;
tv_record = tv_session->AddRecord(
kTRUE);
tv_session->SetRecordName("Transverse momentum");
tv_record->fX = "sqrt(fTracks.fPx*fTracks.fPx+fTracks.fPy*fTracks.fPy)";
tv_record->fY = "";
tv_record->fZ = "";
tv_record->fCut = "fTracks.fPx>0";
tv_record->fXAlias = "~Pt";
tv_record->fYAlias = "-empty-";
tv_record->fZAlias = "-empty-";
tv_record->fCutAlias = "~Cut1";
tv_record->fOption = "";
tv_record->fScanRedirected =
kFALSE;
tv_record->fCutEnabled =
kTRUE;
tv_record = tv_session->AddRecord(
kTRUE);
tv_session->SetRecordName("Surface plot of Py vs. Px");
tv_record->fX = "fTracks.fPx";
tv_record->fY = "fTracks.fPy";
tv_record->fZ = "";
tv_record->fCut = "";
tv_record->fXAlias = "fTracks.fPx";
tv_record->fYAlias = "fTracks.fPy";
tv_record->fZAlias = "-empty-";
tv_record->fCutAlias = "-empty-";
tv_record->fOption = "SURF";
tv_record->fScanRedirected =
kFALSE;
tv_record->fCutEnabled =
kTRUE;
tv_session->Show(tv_session->First());
}
void tvdemo() {
printf("This demo show how to handle TTreeViewer sessions\n");
printf("Compile class Event from test directory before running this\n");
printf("- use arrow buttons from bottom to cycle records ...\n");
printf("- make new expressions and drag them to X, Y, Z or Cut items ...\n");
printf("- use the Draw button to check your current selection ...\n");
printf("- click the record button once you are happy with this ...\n");
printf("- open the TV context menu (right-click on the right panel)...\n");
printf(" Use : RemoveLastRecord() - to remove last record :-)\n");
printf(" SetRecordName() - to name current record\n");
printf(" UpdateRecord() - if you want to change a record from the list\n");
printf(" with your new X, Y, Z, Cut configuration.\n");
printf(" Best luck !\n");
open_session();
}
winID h TVirtualViewer3D TVirtualGLPainter p
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 file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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 cutType=false)
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.