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