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