//______________________________________________________________________________ TEveTrack* esd_make_track(TEveTrackPropagator* trkProp, Int_t index, AliESDtrack* at, AliExternalTrackParam* tp) { // Helper function creating TEveTrack from AliESDtrack. // // Optionally specific track-parameters (e.g. at TPC entry point) // can be specified via the tp argument. Double_t pbuf[3], vbuf[3]; TEveRecTrack rt; if (tp == 0) tp = at; rt.fLabel = at->fLabel; rt.fIndex = index; rt.fStatus = (Int_t) at->fFlags; rt.fSign = (tp->fP[4] > 0) ? 1 : -1; trackGetPos(tp, vbuf); rt.fV.Set(vbuf); trackGetMomentum(tp, pbuf); rt.fP.Set(pbuf); Double_t ep = trackGetP(at); Double_t mc = 0.138; // at->GetMass(); - Complicated function, requiring PID. rt.fBeta = ep/TMath::Sqrt(ep*ep + mc*mc); TEveTrack* track = new TEveTrack(&rt, trkProp); track->SetName(Form("TEveTrack %d", rt.fIndex)); track->SetStdTitle(); return track; }
TEveTrack* make_track(track3d_t &t, TEveTrackPropagator* prop) { TEveRecTrackD *rc = new TEveRecTrackD(); rc->fV.Set(t.a(0), t.a(1), t.a(2)); rc->fP.Set(t.b(0), t.b(1), t.b(2)); TEveTrack* track = new TEveTrack(rc, prop); track->MakeTrack(); return track; }
//______________________________________________________________________________ void alice_esd_read() { // Read tracks and associated clusters from current event. AliESDRun *esdrun = (AliESDRun*) esd->fESDObjects->FindObject("AliESDRun"); TClonesArray *tracks = (TClonesArray*) esd->fESDObjects->FindObject("Tracks"); // This needs further investigation. Clusters not shown. // AliESDfriend *frnd = (AliESDfriend*) esd->fESDObjects->FindObject("AliESDfriend"); // printf("Friend %p, n_tracks:%d\n", frnd, frnd->fTracks.GetEntries()); if (track_list == 0) { track_list = new TEveTrackList("ESD Tracks"); track_list->SetMainColor(6); //track_list->SetLineWidth(2); track_list->SetMarkerColor(kYellow); track_list->SetMarkerStyle(4); track_list->SetMarkerSize(0.5); gEve->AddElement(track_list); } TEveTrackPropagator* trkProp = track_list->GetPropagator(); trkProp->SetMagField( 0.1 * esdrun->fMagneticField ); // kGaus to Tesla gProgress->Reset(); gProgress->SetMax(tracks->GetEntriesFast()); for (Int_t n=0; n<tracks->GetEntriesFast(); ++n) { AliESDtrack* at = (AliESDtrack*) tracks->At(n); // If ITS refit failed, take track parameters at inner TPC radius. AliExternalTrackParam* tp = at; if (! trackIsOn(at, kITSrefit)) { tp = at->fIp; } TEveTrack* track = esd_make_track(trkProp, n, at, tp); track->SetAttLineAttMarker(track_list); track_list->AddElement(track); // This needs further investigation. Clusters not shown. // if (frnd) // { // AliESDfriendTrack* ft = (AliESDfriendTrack*) frnd->fTracks->At(n); // printf("%d friend = %p\n", ft); // } gProgress->Increment(1); } track_list->MakeTracks(); }
void kine_hide_neutrals(TEveElement* el, Int_t level) { if (el == 0) { el = gEve->GetCurrentEvent()->FindChild("Kine Tracks"); if (!el) return; } TEveTrack* t = dynamic_cast<TEveTrack*>(el); if (t && t->GetCharge() == 0) t->SetRnrSelf(kFALSE); for (TEveElement::List_i i = el->BeginChildren(); i != el->EndChildren(); ++i) { kine_hide_neutrals(*i, level + 1); } if (level == 0) gEve->Redraw3D(); }
void ProcessVisualize() { TEveManager::Create(); TEvePointSetArray *evp = new TEvePointSetArray("Event points", "Event points"); TEvePointSetArray *chp = new TEvePointSetArray("Chamber points", "Chamber points"); evp->SetMarkerColor(kGreen); evp->InitBins("Event cause", 8, 0.5, 8.5); chp->SetMarkerColor(kCyan); chp->InitBins("Nothing", 1, -0.5, 0.5); TEveTrackList *list = new TEveTrackList(); list->SetLineColor(kMagenta); list->SetName("Incident tracks"); TEveTrackPropagator* prop = list->GetPropagator(); prop->SetMaxR(2000); prop->SetMaxZ(4000); int j = 0; BOOST_FOREACH(event_t &e, vis_result) { evp->Fill(e.i1.x, e.i1.y, e.i1.z, e.event_cause); chp->Fill(e.inc.a(0), e.inc.a(1), e.inc.a(2), 0); chp->Fill(e.l.a(0), e.l.a(1), e.l.a(2), 0); chp->Fill(e.r.a(0), e.r.a(1), e.r.a(2), 0); if ((++j % 1000) == 0) { TEveTrack *track = make_track(e.inc, prop); track->SetLineColor(list->GetLineColor()); list->AddElement(track); track = make_track(e.l, prop); track->SetLineColor(list->GetLineColor()); list->AddElement(track); track = make_track(e.r, prop); track->SetLineColor(list->GetLineColor()); list->AddElement(track); } }
void pythia_next_event() { gTrackList->DestroyElements(); TPythia6& P = * g_pythia; P.GenerateEvent(); int nh = P.GetMSTU(72); // printf("N = %d, Nhard = %d :: NumSec = %d, separators (%d,%d,%d,%d)\n", // P.GetN(), nh, P.GetMSTU(70), P.GetMSTU(71), P.GetMSTU(72), P.GetMSTU(73), P.GetMSTU(74)); // 2->2 hard postfrag final TEveTrackPropagator *trkProp = gTrackList->GetPropagator(); TClonesArray &MC = * (TClonesArray*) P.GetListOfParticles(); for (Int_t i = 0; i < 7; ++i) { TMCParticle& p = * MC[nh+i]; TParticle pb(p.GetKF(), p.GetKS(), 0, 0, p.GetFirstChild()-nh-1, p.GetLastChild()-nh-1, p.GetPx(), p.GetPy(), p.GetPz(), p.GetEnergy(), p.GetVx(), p.GetVy(), p.GetVz(), p.GetTime()); TEveTrack* track = new TEveTrack(&pb, i, trkProp); track->SetName(Form("%s [%d]", pb.GetName(), i)); track->SetStdTitle(); track->SetAttLineAttMarker(gTrackList); if (i == 0) track->SetLineColor(kColors[0]); else if (i <= 2) track->SetLineColor(kColors[1]); gTrackList->AddElement(track); /* printf("%d - %d %d %d %d %d %d\n", i, p.GetKF(), p.GetKS(), 0, 0, p.GetFirstChild()-nh-1, p.GetLastChild()-nh-1); printf("%d - %f %f %f %f\n", i, p.GetPx(), p.GetPy(), p.GetPz(), p.GetEnergy(), printf("%d - %f %f %f %f\n", i, p.GetVx(), p.GetVy(), p.GetVz(), p.GetTime()); */ } gTrackList->MakeTracks(); TEveElement* top = gEve->GetCurrentEvent(); gMultiView->DestroyEventRPhi(); gMultiView->ImportEventRPhi(top); gMultiView->DestroyEventRhoZ(); gMultiView->ImportEventRhoZ(top); gEve->Redraw3D(); }