]>
Commit | Line | Data |
---|---|---|
7df70ad2 | 1 | void display (const char *filename="galice.root",Int_t nevent=0) { |
fe4da5cc | 2 | // Dynamically link some shared libs |
3 | if (gClassTable->GetID("AliRun") < 0) { | |
4 | gROOT->LoadMacro("loadlibs.C"); | |
5 | loadlibs(); | |
6 | } else { | |
7 | delete gAlice; | |
8 | gAlice = 0; | |
9 | } | |
10 | ||
11 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
7df70ad2 | 12 | |
13 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(filename); | |
14 | if(file){ | |
15 | cout<<"galice.root is already open \n"; | |
16 | } | |
17 | else { | |
18 | if(!file)file=TFile::Open(filename); | |
19 | } | |
fe4da5cc | 20 | |
21 | // Get AliRun object from file or create it if not on file | |
22 | if (!gAlice) { | |
23 | gAlice = (AliRun*)file->Get("gAlice"); | |
24 | if (gAlice) printf("AliRun object found on file\n"); | |
25 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
26 | } | |
27 | ||
28 | // Create Event Display object | |
29 | AliDisplay *edisplay = new AliDisplay(750); | |
30 | ||
7df70ad2 | 31 | // Display the requested event |
fe4da5cc | 32 | gAlice->GetEvent(nevent); |
33 | edisplay->ShowNextEvent(0); | |
7df70ad2 | 34 | |
35 | // Define the buttons to switch on/off the existing modules | |
36 | Float_t nodet=0.; | |
37 | TObjArray *moduli = gAlice->Modules(); | |
38 | Int_t nomod=moduli->GetEntriesFast(); | |
39 | AliModule *modu; | |
40 | for (Int_t j=0; j<nomod; j++){ | |
41 | modu=(AliModule*)moduli->At(j); | |
42 | char *avoid=strstr("BODY MAG ABSO DIPO HALL FRAME SHIL PIPE",modu->GetName()); | |
43 | if(avoid)continue; | |
44 | nodet++; | |
45 | } | |
46 | TDialogCanvas *dialog = new TDialogCanvas("Modules"," ",150,30*nodet); | |
47 | Float_t yval1=1./nodet*0.9*0.05; | |
48 | Float_t yval2=1./nodet*0.9*0.95; | |
49 | char action[50]; | |
50 | char title[30]; | |
51 | char bname[30]; | |
52 | TButton *butto1; | |
53 | for (Int_t j=0; j<nomod; j++){ | |
54 | modu=(AliModule*)moduli->At(j); | |
55 | char *avoid=strstr(" BODY MAG ABSO DIPO HALL FRAME SHIL PIPE",modu->GetName()); | |
56 | if(avoid)continue; | |
57 | sprintf(action,"swioff(\"%s\")",modu->GetName()); | |
58 | sprintf(title,"%s is on",modu->GetName()); | |
59 | sprintf(bname,"but%s",modu->GetName()); | |
60 | butto1 = new TButton(title,action,.05,yval1,.95,yval2); | |
61 | butto1->SetName(bname); | |
62 | butto1->SetFillColor(3); | |
63 | butto1->Draw(); | |
64 | yval1+=1./nodet; | |
65 | yval2+=1./nodet; | |
66 | } | |
67 | } | |
68 | ||
69 | void swioff(const char *dete){ | |
70 | gAlice->Display()->DisableDetector(dete); | |
71 | gAlice->Display()->Pad()->Modified(); | |
72 | gAlice->Display()->Pad()->Update(); | |
73 | char bname[30]; | |
74 | char action[50]; | |
75 | char title[30]; | |
76 | sprintf(bname,"but%s",dete); | |
77 | TDialogCanvas *dia = (TDialogCanvas *)gROOT->FindObject("Modules"); | |
78 | TButton *bt = (TButton *)dia->FindObject(bname); | |
79 | bt->SetFillColor(2); | |
80 | sprintf(action,"swion(\"%s\")",dete); | |
81 | bt->SetMethod(action); | |
82 | sprintf(title,"%s is off",dete); | |
83 | bt->SetTitle(title); | |
84 | dia->Draw(); | |
fe4da5cc | 85 | } |
7df70ad2 | 86 | |
87 | void swion(const char *dete){ | |
88 | gAlice->Display()->EnableDetector(dete); | |
89 | gAlice->Display()->Pad()->Modified(); | |
90 | gAlice->Display()->Pad()->Update(); | |
91 | TDialogCanvas *dia = (TDialogCanvas *)gROOT->FindObject("Modules"); | |
92 | char bname[30]; | |
93 | char action[50]; | |
94 | char title[30]; | |
95 | sprintf(bname,"but%s",dete); | |
96 | TButton *bt = (TButton *)dia->FindObject(bname); | |
97 | bt->SetFillColor(3); | |
98 | sprintf(action,"swioff(\"%s\")",dete); | |
99 | bt->SetMethod(action); | |
100 | sprintf(title,"%s is on",dete); | |
101 | bt->SetTitle(title); | |
102 | dia->Draw(); | |
103 | } | |
104 |