]>
Commit | Line | Data |
---|---|---|
84aff7a4 | 1 | // $Id$ |
d810d0de | 2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
3c1a4392 | 9 | |
32e219c2 | 10 | TPolyMarker3D* make_vertex_marker(AliESDVertex* v, const Text_t* name ) |
3c1a4392 | 11 | { |
12 | Double_t x[3], e[3]; | |
8158d8a5 | 13 | v->GetXYZ(x); |
3c1a4392 | 14 | v->GetSigmaXYZ(e); |
15 | ||
14f03c90 | 16 | printf("%16s: %f %f %f - %f %f %f\n", name, |
3c1a4392 | 17 | x[0], x[1], x[2], e[0], e[1], e[2]); |
18 | ||
c37f91e9 | 19 | TPolyMarker3D* m = new TPolyMarker3D(1); |
3c1a4392 | 20 | m->SetName(name); |
3c1a4392 | 21 | m->SetPoint(0, x[0], x[1], x[2]); |
22 | ||
23 | return m; | |
24 | } | |
25 | ||
84aff7a4 | 26 | TEveBoxSet* make_vertex_boxes(AliESDVertex* v) |
c37f91e9 | 27 | { |
28 | Double_t x[3], e[3]; | |
b59304bc | 29 | v->GetXYZ(x); |
c37f91e9 | 30 | v->GetSigmaXYZ(e); |
31 | ||
84aff7a4 | 32 | TEveBoxSet* bs; |
c37f91e9 | 33 | |
84aff7a4 | 34 | bs = new TEveBoxSet("+- 10 x 10 x 20mm"); |
35 | bs->SetRenderMode(TEveBoxSet::RM_TEveLine); | |
36 | bs->AddBox(Box(-1, x[0], x[1], x[2], 1, 1, 2)); | |
c37f91e9 | 37 | bs->SetMainColor((Color_t) 2); |
84aff7a4 | 38 | gEve->AddElement(bs); |
c37f91e9 | 39 | |
84aff7a4 | 40 | bs = new TEveBoxSet("+- 30 sigma_r x 10 sigma_z"); |
41 | bs->SetRenderMode(TEveBoxSet::RM_TEveLine); | |
42 | bs->AddBox(Box(-1, x[0], x[1], x[2], 30*e[0], 30*e[1], 10*e[2])); | |
c37f91e9 | 43 | bs->SetMainColor((Color_t) 3); |
84aff7a4 | 44 | gEve->AddElement(bs); |
c37f91e9 | 45 | |
84aff7a4 | 46 | gEve->Redraw3D(); |
c37f91e9 | 47 | } |
48 | ||
3c1a4392 | 49 | void register_vertex_marker(TPolyMarker3D* m) |
50 | { | |
d810d0de | 51 | Color_t* colp = TEveUtil::FindColorVar(m, "fMarkerColor"); |
84aff7a4 | 52 | TEveElementObjectPtr* rnrEl = new TEveElementObjectPtr(m, *colp); |
53 | gEve->AddElement(rnrEl); | |
54 | gEve->Redraw3D(); | |
3c1a4392 | 55 | } |
56 | ||
32e219c2 | 57 | void primary_vertex_primitive(Bool_t showSPD=kTRUE, Bool_t showBoxes=kFALSE) |
3c1a4392 | 58 | { |
d810d0de | 59 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
3c1a4392 | 60 | |
ca8a6926 | 61 | AliESDVertex* pv = esd->GetPrimaryVertex(); |
3c1a4392 | 62 | TPolyMarker3D* pvm = make_vertex_marker(pv, "Primary Vertex"); |
5b96ea20 | 63 | pvm->SetMarkerStyle(5); |
1abc4687 | 64 | pvm->SetMarkerColor(5); |
846e8468 | 65 | pvm->SetMarkerSize(1.4); |
3c1a4392 | 66 | register_vertex_marker(pvm); |
67 | ||
84aff7a4 | 68 | if (showSPD) { |
e9b9f7d2 | 69 | AliESDVertex* spdv = esd->GetPrimaryVertexSPD(); |
3c1a4392 | 70 | TPolyMarker3D* spdvm = make_vertex_marker(spdv, "SPD Vertex"); |
71 | spdvm->SetMarkerStyle(2); | |
1abc4687 | 72 | spdvm->SetMarkerColor(6); |
3c1a4392 | 73 | register_vertex_marker(spdvm); |
74 | } | |
c37f91e9 | 75 | |
84aff7a4 | 76 | if (showBoxes) |
c37f91e9 | 77 | make_vertex_boxes(pv); |
3c1a4392 | 78 | } |
32e219c2 | 79 | |
57ffa5fb | 80 | /******************************************************************************/ |
32e219c2 | 81 | |
e9b9f7d2 | 82 | TEveStraightLineSet* make_vertex_lineset(AliESDVertex* v, const Text_t* name) |
51346b82 | 83 | { |
32e219c2 | 84 | Double_t x[3], e[3]; |
85 | v->GetXYZ(x); v->GetSigmaXYZ(e); | |
86 | printf("%16s: %f %f %f - %f %f %f\n", name, | |
87 | x[0], x[1], x[2], e[0], e[1], e[2]); | |
88 | ||
89 | // dimensions | |
84aff7a4 | 90 | TEveStraightLineSet* ls = new TEveStraightLineSet(); |
32e219c2 | 91 | ls->SetName(name); |
2be943d0 | 92 | ls->AddLine(e[0], 0, 0, -e[0], 0, 0); |
93 | ls->AddLine(0, e[1], 0, 0, -e[1], 0); | |
94 | ls->AddLine(0, 0, e[2], 0, 0, -e[2]); | |
32e219c2 | 95 | |
a15e6d7d | 96 | ls->RefMainTrans().SetPos(x); |
51346b82 | 97 | return ls; |
32e219c2 | 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 | } | |
2be943d0 | 122 | |
32e219c2 | 123 | Int_t N = 32; |
124 | Float_t S = 2*TMath::Pi()/N; | |
125 | Float_t b, a, phi; | |
126 | ||
127 | a = e[0]; b = e[1]; | |
84aff7a4 | 128 | for (Int_t i = 0; i<N; i++) |
51346b82 | 129 | ls->AddLine(a*TMath::Cos(i*S) , b*TMath::Sin(i*S) , 0, |
32e219c2 | 130 | a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S), 0); |
131 | ||
132 | a = e[0]; b = e[2]; | |
84aff7a4 | 133 | for (Int_t i = 0; i<N; i++) |
51346b82 | 134 | ls->AddLine(a*TMath::Cos(i*S) , 0, b*TMath::Sin(i*S), |
32e219c2 | 135 | a*TMath::Cos(i*S+S), 0, b*TMath::Sin(i*S+S)); |
136 | ||
137 | a = e[1]; b = e[2]; | |
84aff7a4 | 138 | for (Int_t i = 0; i<N; i++) |
51346b82 | 139 | ls->AddLine(0, a*TMath::Cos(i*S) , b*TMath::Sin(i*S), |
32e219c2 | 140 | 0, a*TMath::Cos(i*S+S), b*TMath::Sin(i*S+S)); |
141 | } | |
142 | ||
143 | void primary_vertex(Bool_t showSPD=kTRUE, Bool_t rnrEllipse=kTRUE) | |
51346b82 | 144 | { |
d810d0de | 145 | AliESDEvent* esd = AliEveEventManager::AssertESD(); |
84aff7a4 | 146 | TEveStraightLineSet* ls; |
32e219c2 | 147 | |
148 | AliESDVertex* PV = esd->GetPrimaryVertex(); | |
e9b9f7d2 | 149 | ls = make_vertex_lineset(PV, "Primary Vertex"); |
84aff7a4 | 150 | if (rnrEllipse) make_vertex_ellipses(ls, PV, kTRUE); |
151 | gEve->AddElement(ls); | |
32e219c2 | 152 | |
51346b82 | 153 | if (showSPD) |
32e219c2 | 154 | { |
e9b9f7d2 | 155 | AliESDVertex* SPDV = esd->GetPrimaryVertexSPD(); |
156 | ls = make_vertex_lineset(SPDV, "SPD Vertex"); | |
84aff7a4 | 157 | if (rnrEllipse) make_vertex_ellipses(ls, SPDV, kFALSE); |
158 | gEve->AddElement(ls); | |
32e219c2 | 159 | } |
160 | } |