]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/ShowTrack.C
Updated a bit with:
[u/mrichter/AliRoot.git] / macros / ShowTrack.C
1 //***This macro shows a track pointed by its index in the kinematics data base.
2 //***Use this macro only after starting a display.C macro !
3 void ShowTrack(int idx) {
4    AliTPC *TPC=(AliTPC*)gAlice->GetDetector("TPC");
5    TClonesArray *points=TPC->Points();
6    int ntracks=points->GetEntriesFast();
7    AliPoints *trk=0;
8    for (int track=0;track<ntracks;track++) {
9       AliPoints *pm = (AliPoints*)points->UncheckedAt(track);
10       if (!pm) continue;
11       if (idx == pm->GetIndex()) {
12          pm->SetMarkerColor(2);
13          pm->SetMarkerStyle(22);
14          pm->Draw("same");
15          trk=pm;
16          break;
17       }
18    }
19    if (!trk) return;
20
21    TPad *pp=(TPad*)gROOT->FindObject("viewpad");
22    pp->Update();
23    pp->Modified();
24
25    TClonesArray *particles=gAlice->Particles();
26    GParticle *p = (GParticle*)particles->UncheckedAt(idx);
27    cout<<"Paritcle ID "<<p->GetKF()<<endl;
28    cout<<"Parent "<<p->GetParent()<<endl;
29    cout<<"First child "<<p->GetFirstChild()<<endl;
30    cout<<"Px,Py,Pz "<<p->GetPx()<<' '<<p->GetPy()<<' '<<p->GetPz()<<endl;
31
32    cerr<<"OK ? "; char c[100]; cin.getline(c,100);
33    if (tolower(c[0])!='y') return;
34
35    trk->SetMarkerColor(5);
36    trk->SetMarkerStyle(1);
37    trk->Draw("same");
38    pp->Update();
39    pp->Modified();
40 }