]> git.uio.no Git - u/mrichter/AliRoot.git/blob - DISPLAY/display2.C
Additional protection
[u/mrichter/AliRoot.git] / DISPLAY / display2.C
1 // This macro displays the hits belonging to a track for selected detectors
2 // Input: in the tracks contains the interesting tracks
3 //        ntracks is the number of interesing tracks
4 //        The default values correspond to "Show everything"
5 // Note: For the moment it works only with HIJING events, the PYTHIA is
6 //       still not supported
7 //#include <ClassTable.h>
8
9 void display2(const char *filename="galice.root", Int_t nevent=0,
10               Int_t *tracks=0, Int_t ntracks=0)
11 {
12    // Dynamically link some shared libs
13    if (gClassTable->GetID("AliRun") < 0) {
14       gROOT->LoadMacro("loadlibs.C");
15       loadlibs();
16    } else {
17       delete gAlice->GetRunLoader();
18       delete gAlice;
19       gAlice = 0;
20    }
21    //gSystem->Load("libAliL3Src");
22    gSystem->Load("libDISPLAY");
23
24    // Connect the ROOT Galice file containing Geometry, Kine and Hits
25    AliRunLoader *rl = 0;
26    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
27    if(file) {
28       Info("display2.C", "galice.root is already open");
29    }
30    rl = AliRunLoader::Open(filename, "DISPLAYED EVENT");
31
32    if (rl == 0) {
33       Error("display2.C", "can not get Run Loader, exiting...");
34       return;
35    }
36
37    // Get AliRun object from file or create it if not on file
38    rl->LoadgAlice();
39
40    gAlice = rl->GetAliRun();
41    if (!gAlice) {
42       Error("display2.C", "AliRun object not found on file, exiting...");
43       return;
44   }
45
46    // Create Event Display object
47    AliDisplay2 *edisplay = new AliDisplay2(gClient->GetRoot(), 900, 700);
48    // if (ntracks > 0) edisplay->SetTracksToDisplay(tracks, ntracks);
49
50    // Display the requested event
51    rl->GetEvent(nevent);
52    rl->LoadKinematics();
53    rl->LoadHeader();
54    rl->LoadHits();
55
56    //edisplay->FindModules();
57    edisplay->ShowNextEvent(0);
58 }
59
60
61