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