]>
Commit | Line | Data |
---|---|---|
fa3634bd | 1 | // @(#)root/eve:$Id$ |
2 | // Main author: Davide Caffarri 2009 | |
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 * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
9 | ||
10 | #include "AliEveHFEditor.h" | |
11 | #include "AliEveHF.h" | |
12 | ||
13 | #include "TVirtualPad.h" | |
14 | #include "TColor.h" | |
15 | ||
16 | #include <TEveTrack.h> | |
17 | ||
18 | // Cleanup these includes: | |
19 | #include "TGLabel.h" | |
20 | #include "TGButton.h" | |
21 | #include "TGNumberEntry.h" | |
22 | #include "TGColorSelect.h" | |
23 | #include "TGDoubleSlider.h" | |
24 | ||
25 | ||
26 | //______________________________________________________________________________ | |
27 | // GUI editor for AliEveHF. | |
28 | // | |
29 | ||
30 | ClassImp(AliEveHFEditor) | |
31 | ||
32 | //______________________________________________________________________________ | |
33 | AliEveHFEditor::AliEveHFEditor(const TGWindow *p, Int_t width, Int_t height, | |
34 | UInt_t options, Pixel_t back) : | |
35 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
36 | fM(0), | |
37 | fnProng(0), | |
38 | fInfoLabel0(0), | |
39 | fInfoLabel1(0), | |
40 | fInfoLabel2(0), | |
41 | fXButton(0) | |
42 | // Initialize widget pointers to 0 | |
43 | { | |
44 | // Constructor. | |
45 | ||
46 | MakeTitle("AliEveHF"); | |
47 | ||
48 | fInfoLabel0 = new TGLabel(this); | |
49 | fInfoLabel0->SetTextJustify(kTextLeft); | |
50 | AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, | |
51 | 8, 0, 2, 0)); | |
52 | ||
53 | fInfoLabel1 = new TGLabel(this); | |
54 | fInfoLabel1->SetTextJustify(kTextLeft); | |
55 | AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, | |
56 | 8, 0, 2, 0)); | |
57 | ||
58 | fInfoLabel2 = new TGLabel(this); | |
59 | fInfoLabel2->SetTextJustify(kTextLeft); | |
60 | AddFrame(fInfoLabel2, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, | |
61 | 8, 0, 2, 0)); | |
62 | ||
63 | fXButton = new TGTextButton(this, "Detailed View"); | |
64 | AddFrame(fXButton, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0)); | |
65 | fXButton->Connect("Clicked()", "AliEveHFEditor", this, "DisplayDetailed()"); | |
66 | } | |
67 | ||
68 | /******************************************************************************/ | |
69 | ||
70 | //______________________________________________________________________________ | |
71 | void AliEveHFEditor::SetModel(TObject* obj) | |
72 | { | |
73 | // Set model object. | |
74 | ||
75 | fM = dynamic_cast<AliEveHF*>(obj); | |
76 | ||
77 | // Set values of widgets | |
78 | fInfoLabel0->SetText(Form("CosPointingAngle = %f", fM->GetCosPointingAngle())); | |
79 | fInfoLabel1->SetText(Form("Pt = %f", fM->GetPt())); | |
f8d5a389 | 80 | |
fa3634bd | 81 | fInfoLabel2->SetText(Form("PDG Invariant Mass = %f", TDatabasePDG::Instance()->GetParticle(421)->Mass())); |
f8d5a389 | 82 | |
fa3634bd | 83 | } |
84 | ||
85 | /******************************************************************************/ | |
86 | ||
87 | // Implements callback/slot methods | |
88 | ||
89 | //______________________________________________________________________________ | |
90 | // void AliEveHFEditor::DoXYZZ() | |
91 | // { | |
92 | // // Slot for XYZZ. | |
93 | // | |
94 | // fM->SetXYZZ(fXYZZ->GetValue()); | |
95 | // Update(); | |
96 | // } | |
97 | ||
98 | #include <TEveManager.h> | |
99 | #include <TEveWindow.h> | |
100 | #include <TEveViewer.h> | |
101 | #include <TEveScene.h> | |
102 | #include <TEveGeoNode.h> | |
103 | #include <TEveProjectionManager.h> | |
104 | ||
105 | #include <TGLCamera.h> | |
106 | #include <TGLViewer.h> | |
107 | #include "TGLCameraOverlay.h" | |
108 | ||
109 | #include <TLatex.h> | |
110 | #include <TRootEmbeddedCanvas.h> | |
111 | #include <TInterpreter.h> | |
112 | ||
113 | void AliEveHFEditor::DisplayDetailed() | |
114 | { | |
115 | TEveWindowSlot *slot = TEveWindow::CreateWindowMainFrame(); | |
116 | TEveWindowPack *pack = slot->MakePack(); | |
117 | pack->SetShowTitleBar(kFALSE); | |
118 | pack->SetHorizontal(); | |
119 | ||
120 | // | |
121 | // This part is for getting the different objects to display | |
122 | // | |
123 | char displayInfo[100] = {0}; | |
124 | sprintf(displayInfo,"pt = %.3f",fM->GetPt()); | |
125 | TEveLine *lhfTransverseMomentumDirection = new TEveLine(displayInfo); | |
126 | lhfTransverseMomentumDirection->SetLineColor(kOrange+8); | |
127 | lhfTransverseMomentumDirection->SetLineWidth(2); | |
128 | lhfTransverseMomentumDirection->SetLineStyle(2); | |
129 | lhfTransverseMomentumDirection->SetLineWidth(2); | |
130 | Float_t scalePt = 100.; // this needs to be available as a ruler | |
131 | lhfTransverseMomentumDirection->SetPoint(0,fM->fRecDecayHF.fX, fM->fRecDecayHF.fY, fM->fRecDecayHF.fZ); | |
12cc265f | 132 | lhfTransverseMomentumDirection->SetPoint(1,scalePt*fM->fRecDecayMomHF.fX, scalePt*fM->fRecDecayMomHF.fY,0); |
fa3634bd | 133 | |
134 | TEvePointSet *pvlocation = new TEvePointSet("PV location"); | |
135 | pvlocation->SetNextPoint(fM->fRecBirthHF.fX, fM->fRecBirthHF.fY, fM->fRecBirthHF.fZ); | |
136 | pvlocation->SetTitle("pv location"); | |
137 | pvlocation->SetMarkerStyle(4); | |
138 | pvlocation->SetMarkerSize(2.5); | |
139 | pvlocation->SetMarkerColor(7); | |
140 | ||
141 | TEvePointSet *hflocation = new TEvePointSet("HF location"); | |
142 | hflocation->SetNextPoint(fM->fRecDecayHF.fX, fM->fRecDecayHF.fY, fM->fRecDecayHF.fZ); | |
143 | hflocation->SetTitle("HF location"); | |
144 | hflocation->SetMarkerStyle(4); | |
145 | hflocation->SetMarkerSize(2.5); | |
146 | hflocation->SetMarkerColor(kOrange+8); | |
147 | ||
148 | TEveUtil::LoadMacro("clusters_from_index.C"); | |
149 | ||
150 | TEveTrack *negTrack = fM->GetNegTrack(); | |
151 | TEveTrack *posTrack = fM->GetPosTrack(); | |
152 | ||
153 | ||
154 | char macroWithIndex[100] = {0}; | |
155 | Int_t daughterIndex = 0; | |
156 | TEvePointSet *negDaughterCluster = 0; | |
157 | TEvePointSet *posDaughterCluster = 0; | |
f8d5a389 | 158 | |
fa3634bd | 159 | daughterIndex = negTrack->GetIndex(); |
160 | sprintf(macroWithIndex,"clusters_from_index(%d)",daughterIndex); | |
161 | Long_t negResult = gInterpreter->ProcessLine(macroWithIndex); | |
162 | if (negResult) { | |
163 | negDaughterCluster = reinterpret_cast<TEvePointSet*>(negResult); | |
164 | if (negDaughterCluster){ | |
f8d5a389 | 165 | negDaughterCluster->SetMarkerStyle(4); |
166 | negDaughterCluster->SetMarkerSize(1.5); | |
fa3634bd | 167 | negDaughterCluster->SetMarkerColor(kBlue+3); |
168 | } | |
169 | } | |
170 | else | |
171 | { | |
172 | Warning("DisplayDetailed", "Import of negative daughter's clusters failed."); | |
173 | } | |
174 | ||
175 | daughterIndex = posTrack->GetIndex(); | |
176 | sprintf(macroWithIndex,"clusters_from_index(%d)",daughterIndex); | |
177 | Long_t posResult = gInterpreter->ProcessLine(macroWithIndex); | |
178 | if (posResult) { | |
179 | posDaughterCluster = reinterpret_cast<TEvePointSet*>(posResult); | |
180 | if (posDaughterCluster){ | |
f8d5a389 | 181 | posDaughterCluster->SetMarkerStyle(4); |
182 | posDaughterCluster->SetMarkerSize(1.5); | |
fa3634bd | 183 | posDaughterCluster->SetMarkerColor(kRed+3); |
184 | } | |
185 | } | |
186 | else | |
187 | { | |
188 | Warning("DisplayDetailed", "Import of positive daughter's clusters failed."); | |
189 | } | |
190 | ||
191 | // | |
192 | // This part is for the bending plane view | |
193 | // | |
194 | pack->NewSlot()->MakeCurrent(); | |
195 | TEveViewer *bpViewer = gEve->SpawnNewViewer("HF bending plane View"); | |
196 | TEveScene *bpScene = gEve->SpawnNewScene("HF bending plane Scene"); | |
197 | ||
198 | TEveUtil::LoadMacro("geom_gentle.C"); | |
199 | Long_t result = gInterpreter->ProcessLine("geom_gentle_rphi()"); | |
200 | if (result) | |
201 | { | |
202 | TEveGeoShape *geomRPhi = reinterpret_cast<TEveGeoShape*>(result); | |
203 | geomRPhi->IncDenyDestroy(); | |
204 | TEveProjectionManager *projMgr = new TEveProjectionManager(); | |
205 | projMgr->ImportElements(geomRPhi, bpScene); | |
206 | } | |
207 | else | |
208 | { | |
209 | Warning("DisplayDetailed", "Import of R-Phi geometry failed."); | |
210 | } | |
211 | ||
212 | bpViewer->AddScene(bpScene); | |
213 | bpScene->AddElement(fM); | |
214 | bpScene->AddElement(lhfTransverseMomentumDirection); | |
215 | bpScene->AddElement(pvlocation); | |
216 | bpScene->AddElement(hflocation); | |
217 | ||
218 | if (negDaughterCluster) bpScene->AddElement(negDaughterCluster); | |
219 | if (posDaughterCluster) bpScene->AddElement(posDaughterCluster); | |
220 | ||
221 | // This is the to-do list for the bending plane: | |
f8d5a389 | 222 | // 1. fix the view to orthographic XOY (no rotation allowed but moving the center ok) ->done! |
fa3634bd | 223 | // 2. show axis and tickles along X and Y ->done! |
224 | // -> note for the projection the cartesian scales are not very useful | |
225 | // -> propose a phi and R scale which rotates with a reset at 0; | |
226 | // -> propose a transformation for an eta scale (keep the z one); | |
227 | // 3. show the center, the main vertex and the detectors for this view ->done! | |
228 | // 4. show V0 direction in the bending plane with arrow length proportional to pT ->done! | |
229 | // 5. show angles with respect to axis (phi angle) ->almost. | |
230 | // 6. show clusters in the ITS and in the TPC associated with the daughter tracks | |
231 | // -> include a radius cut for plotting only ITS and TPC ->done! | |
232 | bpViewer->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY); | |
233 | bpViewer->GetGLViewer()->ResetCamerasAfterNextUpdate(); | |
234 | TGLViewer *lbpGLViewer = bpViewer->GetGLViewer(); | |
235 | TGLCameraOverlay* co = lbpGLViewer->GetCameraOverlay(); | |
236 | co->SetShowOrthographic(true); //(false); | |
237 | co->SetOrthographicMode(TGLCameraOverlay::kAxis); // ::kPlaneIntersect or ::kBar | |
238 | // end of the bending plane part | |
239 | ||
240 | // | |
241 | // This part is for the decay plane view | |
242 | // | |
243 | pack->NewSlot()->MakeCurrent(); | |
244 | TEveViewer *dpViewer = gEve->SpawnNewViewer("HF decay plane View"); | |
245 | TEveScene *dpScene = gEve->SpawnNewScene("HF decay plane Scene"); | |
246 | ||
247 | dpViewer->AddScene(dpScene); | |
248 | ||
249 | result = gInterpreter->ProcessLine("geom_gentle(kFALSE)"); | |
250 | if (result) | |
251 | { | |
252 | TEveGeoShape *geom = reinterpret_cast<TEveGeoShape*>(result); | |
253 | geom->IncDenyDestroy(); | |
254 | geom->FindChild("TRD+TOF")->SetRnrState(kFALSE); | |
255 | geom->FindChild("PHOS") ->SetRnrState(kFALSE); | |
256 | geom->FindChild("HMPID") ->SetRnrState(kFALSE); | |
257 | dpScene->AddElement(geom); | |
258 | } | |
259 | else | |
260 | { | |
261 | Warning("DisplayDetailed", "Import of 3D geometry failed."); | |
262 | } | |
263 | ||
264 | dpScene->AddElement(fM); | |
265 | dpScene->AddElement(lhfTransverseMomentumDirection); | |
266 | dpScene->AddElement(pvlocation); | |
267 | dpScene->AddElement(hflocation); | |
268 | if (negDaughterCluster) dpScene->AddElement(negDaughterCluster); | |
269 | if (posDaughterCluster) dpScene->AddElement(posDaughterCluster); | |
270 | ||
271 | // This is the to-do list for the decay plane: | |
272 | // 1. fix the view to decay plane (no rotation allowed but moving the center ok) | |
273 | // 2. show V0 direction with a vertical arrow length proportional to pT -> done! | |
274 | // 3. show the center, the main vertex and the detectors for this view -> done! | |
275 | // 4. show the x,y and z axis and the different angles | |
276 | // -> this needs a referential object that we can move around | |
277 | // or fix to a selected point (origin being the default) | |
278 | // 5. draw the dca between daughters and the extrapolation to the main vertex. | |
279 | // -> this is an issue since we only store the distance: check with J.Belikov | |
280 | // 6. show clusters in the ITS and in the TPC associated with the daughter tracks | |
281 | // -> include a radius cut for plotting only ITS and TPC ->done! | |
282 | dpViewer->GetGLViewer()->ResetCamerasAfterNextUpdate(); | |
283 | TGLCamera& dpCam = dpViewer->GetGLViewer()->CurrentCamera(); | |
284 | dpCam.SetExternalCenter(kTRUE); | |
285 | dpCam.SetCenterVec(fM->fRecDecayHF.fX, fM->fRecDecayHF.fY, fM->fRecDecayHF.fZ); | |
286 | dpCam.RotateRad(0,-TMath::Pi()/2.); // RotateRad rotates in radians (hRotate,vRotate) | |
287 | // Here rotate the _view_ (not the camera) by (fM->GetPhi() - TMath::Pi()/2.) | |
288 | ||
289 | // In the end maybe truck and rotate properly... | |
290 | // dpCam.Truck(0,200);// Truck center wrt the view panel: (x=0 pixels, y pixels) | |
291 | // dpCam.Rotate(0,50,0,0); // Rotate in pixels (xDelta,yDelta) | |
292 | ||
293 | // end of the decay plane part | |
294 | ||
295 | // | |
296 | // This part is for displaying the information | |
297 | // | |
298 | slot = pack->NewSlot(); | |
f8d5a389 | 299 | |
fa3634bd | 300 | TEveWindowFrame *frame = slot->MakeFrame(new TRootEmbeddedCanvas()); |
301 | frame->SetElementName("Details"); | |
302 | ||
303 | // Print and show detailed information about the HF | |
304 | // Calculation of the invariant mass with the max prob PID hypothesis first | |
305 | // pseudorapidity, phi angle, pt, radius, dcas | |
306 | char info[100] = {0}; | |
307 | ||
308 | sprintf(info,"Cos Pointing angle = %.3f ",fM->GetCosPointingAngle()); | |
309 | TLatex* ltx = new TLatex(0.05, 0.9, info); | |
310 | ltx->SetTextSize(0.08); | |
311 | ltx->DrawLatex(0.05, 0.8, info); | |
f8d5a389 | 312 | |
fa3634bd | 313 | sprintf(info,"p_{T} = %.3f [GeV/c]",fM->GetPt()); |
314 | ltx->DrawLatex(0.05, 0.7, info); | |
315 | ||
316 | sprintf(info,"#eta = - ln( tan(#theta/2) ) = %.3f",fM->GetEta()); | |
317 | ltx->DrawLatex(0.05, 0.6, info); | |
318 | ||
319 | sprintf(info, "D^{0} inv. mass = %.3f", fM->GetInvariantMassPart()); | |
f8d5a389 | 320 | ltx->DrawLatex(0.05, 0.5, info); |
fa3634bd | 321 | |
322 | sprintf(info, "D^{0}bar inv. mass = %.3f", fM->GetInvariantMassAntiPart()); | |
f8d5a389 | 323 | ltx->DrawLatex(0.05, 0.4, info); |
fa3634bd | 324 | |
325 | gEve->Redraw3D(); | |
326 | } |