// Import tracks from kinematics-tree / particle-stack. // Preliminary/minimal solution. #include "TParticlePDG.h" // PDG color indices static Color_t DefCol = 30; static Color_t ECol = 5; static Color_t MuCol = 6; static Color_t GamaCol = 7; static Color_t MesCol1 = 3; static Color_t MesCol2 = 38; static Color_t BarCol = 10; Reve::TrackList* kine_tracks(Double_t min_pt=0.5, Double_t max_pt=100, Bool_t pdg_col= kFALSE) { AliRunLoader* rl = Alieve::Event::AssertRunLoader(); rl->LoadKinematics(); AliStack* stack = rl->Stack(); if (!stack) { Error("kine_tracks.C", "can not get kinematics."); return 0; } Reve::TrackList* cont = new Reve::TrackList("Kine Tracks"); cont->SetMainColor(Color_t(6)); Reve::TrackRnrStyle* rnrStyle = cont->GetRnrStyle(); rnrStyle->fColor = 8; // !!! Watch the '-', apparently different sign convention then for ESD. rnrStyle->SetMagField( - gAlice->Field()->SolenoidField() ); gReve->AddRenderElement(cont); Int_t count = 0; Int_t N = stack->GetNtrack(); for (Int_t i=0; iIsPhysicalPrimary(i)) { TParticle* p = stack->Particle(i); Double_t pT = p->Pt(); if (pTmax_pt) continue; ++count; Reve::Track* track = new Reve::Track(p, i, rnrStyle); //PH The line below is replaced waiting for a fix in Root //PH which permits to use variable siza arguments in CINT //PH on some platforms (alphalinuxgcc, solariscc5, etc.) //PH track->SetName(Form("%s [%d]", p->GetName(), i)); char form[1000]; sprintf(form,"%s [%d]", p->GetName(), i); track->SetName(form); TParticlePDG* pdgp = p->GetPDG(); track->SetMainColor(get_pdg_color(pdgp->PdgCode())); gReve->AddRenderElement(cont, track); } } // set path marks Alieve::KineTools kt; rl->LoadTrackRefs(); kt.SetPathMarks(cont,stack, rl->TreeTR()); cont->SetEditPathMarks(kTRUE); //PH const Text_t* tooltip = Form("pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count); char tooltip[1000]; sprintf(tooltip,"pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count); cont->SetTitle(tooltip); // Not broadcasted automatically ... cont->UpdateItems(); cont->MakeTracks(); cont->MakeMarkers(); gReve->Redraw3D(); return cont; } Color_t get_pdg_color(Int_t pdg){ Int_t pdga = TMath::Abs(pdg); Color_t col = Reve::DefCol; // elementary particles if (pdga < 100) { switch (pdga) { case 11: col = ECol; break; case 12: col = MuCol; break; case 22: col = GammaCol; break; } } else if (pdga < 100000){ Int_t i = pdga; Int_t i0 = i%10; i /= 10; Int_t i1 = i%10; i /= 10; Int_t i2 = i%10; i /= 10; Int_t i3 = i%10; i /= 10; Int_t i4 = i%10; //printf("pdg(%d) quark indices (%d,%d,%d,%d,%d) \n",pdg, i4,i3,i2, i1, i0); // meson if ((i3 == 0) && ( i4 < 2)){ col = MesCol1; // quarks: i1,i2 (spin = i0) if(i1 == 3 || i2 == 3) col = MesCol2; } // barion else if ( i2 >= i1 && i3 >= i2 ) { col = BarCol; // quarks: i1,i2, i3 (spin = i0)) } } return col; }