]>
Commit | Line | Data |
---|---|---|
5a5a1232 | 1 | // $Id$ |
2 | ||
86f12f78 | 3 | Reve::Track* esd_make_track(Reve::TrackRnrStyle* rnrStyle, |
4 | AliESDtrack* at, | |
5 | AliExternalTrackParam* tp=0) | |
6 | { | |
7 | Double_t pbuf[3], vbuf[3]; | |
8 | Reve::RecTrack rt; | |
9 | ||
10 | if(tp == 0) tp = at; | |
11 | ||
12 | rt.label = at->GetLabel(); | |
13 | rt.status = (Int_t) at->GetStatus(); | |
14 | rt.sign = tp->GetSign(); | |
15 | tp->GetXYZ(vbuf); | |
16 | rt.V.Set(vbuf); | |
17 | tp->GetPxPyPz(pbuf); | |
18 | rt.P.Set(pbuf); | |
19 | Double_t ep = at->GetP(), mc = at->GetMass(); | |
20 | rt.beta = ep/TMath::Sqrt(ep*ep + mc*mc); | |
21 | ||
22 | Reve::Track* track = new Reve::Track(&rt, rnrStyle); | |
23 | track->SetName(Form("ESDTrack %d", rt.label)); | |
24 | track->SetTitle(Form("pT=%.3f, pZ=%.3f; V=(%.3f, %.3f, %.3f)", | |
25 | rt.sign*TMath::Hypot(rt.P.x, rt.P.y), rt.P.z, | |
26 | rt.V.x, rt.V.y, rt.V.z)); | |
27 | return track; | |
28 | } | |
29 | ||
30 | Bool_t gkFixFailedITSExtr = kTRUE; | |
31 | ||
5a5a1232 | 32 | Reve::TrackList* esd_tracks(Double_t min_pt=0.1, Double_t max_pt=100) |
33 | { | |
34 | AliESD* esd = Alieve::Event::AssertESD(); | |
86f12f78 | 35 | AliPID pid; |
5a5a1232 | 36 | |
37 | Double_t minptsq = min_pt*min_pt; | |
38 | Double_t maxptsq = max_pt*max_pt; | |
39 | Double_t ptsq; | |
40 | ||
5a5a1232 | 41 | Reve::TrackList* cont = new Reve::TrackList("ESD Tracks"); |
42 | cont->SetMainColor(Color_t(6)); | |
86f12f78 | 43 | Reve::TrackRnrStyle* rnrStyle = cont->GetRnrStyle(); |
44 | rnrStyle->SetMagField( esd->GetMagneticField() ); | |
5a5a1232 | 45 | |
5b96ea20 | 46 | gReve->AddRenderElement(cont); |
5a5a1232 | 47 | |
86f12f78 | 48 | Int_t count = 0; |
49 | Double_t pbuf[3]; | |
5a5a1232 | 50 | for (Int_t n=0; n<esd->GetNumberOfTracks(); n++) { |
86f12f78 | 51 | AliESDtrack* at = esd->GetTrack(n); |
5a5a1232 | 52 | |
53 | // Here would be sweet to have TObjectFormula. | |
54 | at->GetPxPyPz(pbuf); | |
55 | ptsq = pbuf[0]*pbuf[0] + pbuf[1]*pbuf[1]; | |
56 | if(ptsq < minptsq || ptsq > maxptsq) | |
57 | continue; | |
58 | ||
59 | ++count; | |
60 | ||
86f12f78 | 61 | // If ITS refit failed, take track parameters at inner TPC radius. |
62 | AliExternalTrackParam* tp = at; | |
63 | if (gkFixFailedITSExtr && !at->IsOn(AliESDtrack::kITSrefit)) { | |
64 | tp = at->GetInnerParam(); | |
65 | } | |
5a5a1232 | 66 | |
86f12f78 | 67 | Reve::Track* track = esd_make_track(rnrStyle, at, tp); |
5b96ea20 | 68 | gReve->AddRenderElement(cont, track); |
5a5a1232 | 69 | } |
70 | ||
71 | const Text_t* tooltip = Form("pT ~ (%.2lf, %.2lf), N=%d", min_pt, max_pt, count); | |
72 | cont->SetTitle(tooltip); // Not broadcasted automatically ... | |
5b96ea20 | 73 | cont->UpdateItems(); |
5a5a1232 | 74 | |
75 | cont->MakeTracks(); | |
76 | cont->MakeMarkers(); | |
5b96ea20 | 77 | gReve->Redraw3D(); |
5a5a1232 | 78 | |
79 | return cont; | |
80 | } | |
81 | ||
86f12f78 | 82 | Reve::TrackList* esd_tracks_from_array(TCollection* col, AliESD* esd=0) |
5a5a1232 | 83 | { |
84 | // Retrieves AliESDTrack's from collection. | |
85 | // See example usage with AliAnalysisTrackCuts in the next function. | |
86 | ||
86f12f78 | 87 | if(esd == 0) esd = Alieve::Event::AssertESD(); |
88 | AliPID pid; | |
89 | ||
5a5a1232 | 90 | Reve::TrackList* cont = new Reve::TrackList("ESD Tracks"); |
91 | cont->SetMainColor(Color_t(6)); | |
86f12f78 | 92 | Reve::TrackRnrStyle* rnrStyle = cont->GetRnrStyle(); |
93 | rnrStyle->SetMagField( esd->GetMagneticField() ); | |
5a5a1232 | 94 | |
5b96ea20 | 95 | gReve->AddRenderElement(cont); |
5a5a1232 | 96 | |
5a5a1232 | 97 | Int_t count = 0; |
98 | TIter next(col); | |
99 | TObject *obj; | |
5a5a1232 | 100 | while((obj = next()) != 0) { |
101 | if(obj->IsA()->InheritsFrom("AliESDtrack") == kFALSE) { | |
102 | Warning("Object '%s', '%s' is not an AliESDtrack.", | |
103 | obj->GetName(), obj->GetTitle()); | |
104 | continue; | |
105 | } | |
106 | ||
107 | ++count; | |
86f12f78 | 108 | AliESDtrack* at = (AliESDtrack*) obj; |
5a5a1232 | 109 | |
86f12f78 | 110 | Reve::Track* track = esd_make_track(rnrStyle, at); |
5b96ea20 | 111 | gReve->AddRenderElement(cont, track); |
5a5a1232 | 112 | } |
113 | ||
114 | const Text_t* tooltip = Form("N=%d", count); | |
115 | cont->SetTitle(tooltip); // Not broadcasted automatically ... | |
5b96ea20 | 116 | cont->UpdateItems(); |
5a5a1232 | 117 | |
118 | cont->MakeTracks(); | |
119 | cont->MakeMarkers(); | |
5b96ea20 | 120 | gReve->Redraw3D(); |
5a5a1232 | 121 | |
122 | return cont; | |
123 | } | |
124 | ||
125 | void esd_tracks_alianalcuts_demo() | |
126 | { | |
127 | AliESD* esd = Alieve::Event::AssertESD(); | |
86f12f78 | 128 | gSystem->Load("libANALYSIS"); |
5a5a1232 | 129 | |
130 | AliAnalysisTrackCuts atc; | |
131 | atc.SetPtRange(0.1, 5); | |
132 | atc.SetRapRange(-1, 1); | |
133 | ||
86f12f78 | 134 | esd_tracks_from_array(atc.GetAcceptedParticles(esd), esd); |
5a5a1232 | 135 | } |