]>
Commit | Line | Data |
---|---|---|
84aff7a4 | 1 | // $Id$ |
3c1a4392 | 2 | |
32e219c2 | 3 | TPolyMarker3D* make_vertex_marker(AliESDVertex* v, const Text_t* name ) |
3c1a4392 | 4 | { |
5 | Double_t x[3], e[3]; | |
8158d8a5 | 6 | v->GetXYZ(x); |
3c1a4392 | 7 | v->GetSigmaXYZ(e); |
8 | ||
14f03c90 | 9 | printf("%16s: %f %f %f - %f %f %f\n", name, |
3c1a4392 | 10 | x[0], x[1], x[2], e[0], e[1], e[2]); |
11 | ||
c37f91e9 | 12 | TPolyMarker3D* m = new TPolyMarker3D(1); |
3c1a4392 | 13 | m->SetName(name); |
3c1a4392 | 14 | m->SetPoint(0, x[0], x[1], x[2]); |
15 | ||
16 | return m; | |
17 | } | |
18 | ||
84aff7a4 | 19 | TEveBoxSet* make_vertex_boxes(AliESDVertex* v) |
c37f91e9 | 20 | { |
21 | Double_t x[3], e[3]; | |
b59304bc | 22 | v->GetXYZ(x); |
c37f91e9 | 23 | v->GetSigmaXYZ(e); |
24 | ||
84aff7a4 | 25 | TEveBoxSet* bs; |
c37f91e9 | 26 | |
84aff7a4 | 27 | bs = new TEveBoxSet("+- 10 x 10 x 20mm"); |
28 | bs->SetRenderMode(TEveBoxSet::RM_TEveLine); | |
29 | bs->AddBox(Box(-1, x[0], x[1], x[2], 1, 1, 2)); | |
c37f91e9 | 30 | bs->SetMainColor((Color_t) 2); |
84aff7a4 | 31 | gEve->AddElement(bs); |
c37f91e9 | 32 | |
84aff7a4 | 33 | bs = new TEveBoxSet("+- 30 sigma_r x 10 sigma_z"); |
34 | bs->SetRenderMode(TEveBoxSet::RM_TEveLine); | |
35 | bs->AddBox(Box(-1, x[0], x[1], x[2], 30*e[0], 30*e[1], 10*e[2])); | |
c37f91e9 | 36 | bs->SetMainColor((Color_t) 3); |
84aff7a4 | 37 | gEve->AddElement(bs); |
c37f91e9 | 38 | |
84aff7a4 | 39 | gEve->Redraw3D(); |
c37f91e9 | 40 | } |
41 | ||
3c1a4392 | 42 | void register_vertex_marker(TPolyMarker3D* m) |
43 | { | |
3c1a4392 | 44 | Color_t* colp = FindColorVar(m, "fMarkerColor"); |
84aff7a4 | 45 | TEveElementObjectPtr* rnrEl = new TEveElementObjectPtr(m, *colp); |
46 | gEve->AddElement(rnrEl); | |
47 | gEve->Redraw3D(); | |
3c1a4392 | 48 | } |
49 | ||
32e219c2 | 50 | void primary_vertex_primitive(Bool_t showSPD=kTRUE, Bool_t showBoxes=kFALSE) |
3c1a4392 | 51 | { |
22aefef8 | 52 | AliESDEvent* esd = Alieve::Event::AssertESD(); |
3c1a4392 | 53 | |
54 | AliESDVertex* pv = esd->GetPrimaryVertex(); | |
55 | TPolyMarker3D* pvm = make_vertex_marker(pv, "Primary Vertex"); | |
5b96ea20 | 56 | pvm->SetMarkerStyle(5); |
1abc4687 | 57 | pvm->SetMarkerColor(5); |
846e8468 | 58 | pvm->SetMarkerSize(1.4); |
3c1a4392 | 59 | register_vertex_marker(pvm); |
60 | ||
84aff7a4 | 61 | if (showSPD) { |
3c1a4392 | 62 | AliESDVertex* spdv = esd->GetVertex(); |
63 | TPolyMarker3D* spdvm = make_vertex_marker(spdv, "SPD Vertex"); | |
64 | spdvm->SetMarkerStyle(2); | |
1abc4687 | 65 | spdvm->SetMarkerColor(6); |
3c1a4392 | 66 | register_vertex_marker(spdvm); |
67 | } | |
c37f91e9 | 68 | |
84aff7a4 | 69 | if (showBoxes) |
c37f91e9 | 70 | make_vertex_boxes(pv); |
3c1a4392 | 71 | } |
32e219c2 | 72 | |
73 | /**************************************************************************/ | |
74 | ||
84aff7a4 | 75 | TEveStraightLineSet* ESDvertex_lineset(AliESDVertex* v, const Text_t* name) |
32e219c2 | 76 | { |
32e219c2 | 77 | Double_t x[3], e[3]; |
78 | v->GetXYZ(x); v->GetSigmaXYZ(e); | |
79 | printf("%16s: %f %f %f - %f %f %f\n", name, | |
80 | x[0], x[1], x[2], e[0], e[1], e[2]); | |
81 | ||
82 | // dimensions | |
84aff7a4 | 83 | TEveStraightLineSet* ls = new TEveStraightLineSet(); |
32e219c2 | 84 | ls->SetName(name); |
85 | ls->AddLine(e[0], 0, 0, -e[0], 0, 0); | |
86 | ls->AddLine(0, e[1], 0, 0, -e[1], 0); | |
87 | ls->AddLine(0, 0, e[2], 0, 0, -e[2]); | |
88 | for(Int_t i =0; i < 3; i++) | |
89 | { | |
90 | ls->AddMarker(i, 0); | |
91 | ls->AddMarker(i, 1); | |
92 | } | |
93 | ||
94 | // centre marker | |
95 | ls->AddMarker(0, 0.5); | |
96 | ls->RefHMTrans().SetPos(x); | |
97 | return ls; | |
98 | } | |
99 | ||
84aff7a4 | 100 | void make_vertex_ellipses(TEveStraightLineSet* ls, AliESDVertex* v, Bool_t ellipseUseSigma) |
32e219c2 | 101 | { |
32e219c2 | 102 | Double_t x[3], e[3]; |
103 | v->GetXYZ(x); v->GetSigmaXYZ(e); | |
104 | ||
84aff7a4 | 105 | if (ellipseUseSigma) |
32e219c2 | 106 | { |
107 | e[0] *= 30; e[1] *= 30; e[2] *= 10; | |
108 | ls->SetMarkerStyle(5); | |
109 | ls->SetMarkerColor(5); | |
110 | ls->SetMarkerSize(1.4); | |
111 | ls->SetLineColor(7); | |
112 | ls->SetTitle("+- 30 sigma_r x 10 sigma_z"); | |
113 | } | |
114 | else | |
115 | { | |
116 | e[0] = 1; e[1] = 1; e[2] = 2; | |
117 | ls->SetMarkerStyle(2); | |
118 | ls->SetMarkerColor(6); | |
119 | ls->SetLineColor(6); | |
120 | ls->SetTitle("+- 10 x 10 x 20mm"); | |
121 | } | |
122 | Int_t N = 32; | |
123 | Float_t S = 2*TMath::Pi()/N; | |
124 | Float_t b, a, phi; | |
125 | ||
126 | a = e[0]; b = e[1]; | |
84aff7a4 | 127 | for (Int_t i = 0; i<N; i++) |
32e219c2 | 128 | ls->AddLine(a*TMath::Cos(i*S) , b*TMath::Sin(i*S) , 0, |
129 | a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S), 0); | |
130 | ||
131 | a = e[0]; b = e[2]; | |
84aff7a4 | 132 | for (Int_t i = 0; i<N; i++) |
32e219c2 | 133 | ls->AddLine(a*TMath::Cos(i*S) , 0, b*TMath::Sin(i*S), |
134 | a*TMath::Cos(i*S+S), 0, b*TMath::Sin(i*S+S)); | |
135 | ||
136 | a = e[1]; b = e[2]; | |
84aff7a4 | 137 | for (Int_t i = 0; i<N; i++) |
32e219c2 | 138 | ls->AddLine(0, a*TMath::Cos(i*S) , b*TMath::Sin(i*S), |
139 | 0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S)); | |
140 | } | |
141 | ||
142 | void primary_vertex(Bool_t showSPD=kTRUE, Bool_t rnrEllipse=kTRUE) | |
143 | { | |
144 | AliESDEvent* esd = Alieve::Event::AssertESD(); | |
84aff7a4 | 145 | TEveStraightLineSet* ls; |
32e219c2 | 146 | |
147 | AliESDVertex* PV = esd->GetPrimaryVertex(); | |
148 | ls = ESDvertex_lineset(PV, "Primary Vertex"); | |
84aff7a4 | 149 | if (rnrEllipse) make_vertex_ellipses(ls, PV, kTRUE); |
150 | gEve->AddElement(ls); | |
32e219c2 | 151 | |
84aff7a4 | 152 | if (showSPD) |
32e219c2 | 153 | { |
154 | AliESDVertex* SPDV = esd->GetVertex(); | |
155 | ls = ESDvertex_lineset(SPDV, "SPD Vertex"); | |
84aff7a4 | 156 | if (rnrEllipse) make_vertex_ellipses(ls, SPDV, kFALSE); |
157 | gEve->AddElement(ls); | |
32e219c2 | 158 | } |
159 | } |