1 // Import tracks from kinematics-tree / particle-stack.
2 // Preliminary/minimal solution.
3 #include "TParticlePDG.h"
6 static Color_t DefCol = 30;
7 static Color_t ECol = 5;
8 static Color_t MuCol = 6;
9 static Color_t GamaCol = 7;
10 static Color_t MesCol1 = 3;
11 static Color_t MesCol2 = 38;
12 static Color_t BarCol = 10;
15 Reve::TrackList* kine_tracks(Double_t min_pt=0.5, Double_t max_pt=100, Bool_t pdg_col= kFALSE)
17 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
19 AliStack* stack = rl->Stack();
21 Error("kine_tracks.C", "can not get kinematics.");
25 Reve::TrackList* cont = new Reve::TrackList("Kine Tracks");
26 cont->SetMainColor(Color_t(6));
27 Reve::TrackRnrStyle* rnrStyle = cont->GetRnrStyle();
29 // !!! Watch the '-', apparently different sign convention then for ESD.
30 rnrStyle->SetMagField( - gAlice->Field()->SolenoidField() );
32 gReve->AddRenderElement(cont);
35 Int_t N = stack->GetNtrack();
36 for (Int_t i=0; i<N; ++i)
38 if(stack->IsPhysicalPrimary(i))
40 TParticle* p = stack->Particle(i);
41 Double_t pT = p->Pt();
42 if (pT<min_pt || pT>max_pt) continue;
45 Reve::Track* track = new Reve::Track(p, i, rnrStyle);
47 //PH The line below is replaced waiting for a fix in Root
48 //PH which permits to use variable siza arguments in CINT
49 //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
50 //PH track->SetName(Form("%s [%d]", p->GetName(), i));
52 sprintf(form,"%s [%d]", p->GetName(), i);
54 TParticlePDG* pdgp = p->GetPDG();
55 track->SetMainColor(get_pdg_color(pdgp->PdgCode()));
56 gReve->AddRenderElement(cont, track);
63 kt.SetPathMarks(cont,stack, rl->TreeTR());
64 cont->SetEditPathMarks(kTRUE);
67 //PH const Text_t* tooltip = Form("pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count);
69 sprintf(tooltip,"pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count);
70 cont->SetTitle(tooltip); // Not broadcasted automatically ...
81 Color_t get_pdg_color(Int_t pdg){
82 Int_t pdga = TMath::Abs(pdg);
83 Color_t col = Reve::DefCol;
85 // elementary particles
93 col = GammaCol; break;
96 else if (pdga < 100000){
98 Int_t i0 = i%10; i /= 10;
99 Int_t i1 = i%10; i /= 10;
100 Int_t i2 = i%10; i /= 10;
101 Int_t i3 = i%10; i /= 10;
103 //printf("pdg(%d) quark indices (%d,%d,%d,%d,%d) \n",pdg, i4,i3,i2, i1, i0);
105 if ((i3 == 0) && ( i4 < 2)){
106 col = MesCol1; // quarks: i1,i2 (spin = i0)
107 if(i1 == 3 || i2 == 3)
110 else if ( i2 >= i1 && i3 >= i2 ) {
111 col = BarCol; // quarks: i1,i2, i3 (spin = i0))