Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
alice_esd.C File Reference

Detailed Description

Complex example showing ALICE ESD track visualization.

alice_esd.C - a simple event-display for ALICE ESD tracks and clusters

Only standard ROOT is used to process the ALICE ESD files.

No ALICE code is needed, only four simple coordinate-transformation functions declared in this macro.

A simple geometry of 10KB, extracted from the full TGeo-geometry, is used to outline the central detectors of ALICE.

All files are access from the web by using the "CACHEREAD" option.

Automatic building of ALICE ESD class declarations and dictionaries.

ALICE ESD is a TTree containing tracks and other event-related information with one entry per event. All these classes are part of the AliROOT offline framework and are not available to standard ROOT.

To be able to access the event data in a natural way, by using data-members of classes and object containers, the header files and class dictionaries are automatically generated from the TStreamerInfo classes stored in the ESD file by using the TFile::MakeProject() function. The header files and a shared library is created in the aliesd/ directory and can be loaded dynamically into the ROOT session.

See the run_alice_esd.C macro.

Creation of simple GUI for event navigation.

Most common use of the event-display is to browse through a collection of events. Thus a simple GUI allowing this is created in the function make_gui().

Eve uses the configurable ROOT-browser as its main window and so we create an extra tab in the left working area of the browser and provide backward/forward buttons.

Event-navigation functions.

As this is a simple macro, we store the information about the current event in the global variable 'Int_t esd_event_id'. The functions for event-navigation simply modify this variable and call the load_event() function which does the following:

  1. drop the old visualization objects;
  2. retrieve given event from the ESD tree;
  3. call alice_esd_read() function to create visualization objects for the new event.

Reading of ALICE data and creation of visualization objects.

This is performed in alice_esd_read() function, with the following steps:

  1. create the track container object - TEveTrackList;
  2. iterate over the ESD tracks, create TEveTrack objects and append them to the container;
  3. instruct the container to extrapolate the tracks and set their visual attributes.
void alice_esd()
{
const char* esd_file_name = "http://root.cern/files/alice_ESDs.root";
TString lib(Form("aliesd/aliesd.%s", gSystem->GetSoExt()));
TFile* f = TFile::Open(esd_file_name, "CACHEREAD");
if (!f) return;
TTree *tree = (TTree*) f->Get("esdTree");
tree->SetBranchStatus ("ESDfriend*", 1);
f->MakeProject("aliesd", "*", "++");
f->Close();
delete f;
}
gSystem->Load(lib.Data());
gROOT->ProcessLine(".x run_alice_esd.C");
}
#define f(i)
Definition RSha256.hxx:104
#define gROOT
Definition TROOT.h:406
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2489
@ kReadPermission
Definition TSystem.h:45
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Definition TFile.cxx:4089
static Bool_t SetCacheFileDir(std::string_view cacheDir, Bool_t operateDisconnected=kTRUE, Bool_t forceCacheread=kFALSE)
Sets the directory where to locally stage/cache remote files.
Definition TFile.cxx:4626
Basic string class.
Definition TString.h:139
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition TSystem.cxx:1857
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
Definition TSystem.cxx:1296
virtual const char * GetSoExt() const
Get the shared library extension.
Definition TSystem.cxx:4013
A TTree represents a columnar dataset.
Definition TTree.h:79
Author
Matevz Tadel

Definition in file alice_esd.C.