2 // Main author: Davide Caffarri 2009
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 **************************************************************************/
10 #include "AliEveHFEditor.h"
13 #include "TVirtualPad.h"
16 #include <TEveTrack.h>
18 // Cleanup these includes:
21 #include "TGNumberEntry.h"
22 #include "TGColorSelect.h"
23 #include "TGDoubleSlider.h"
26 //______________________________________________________________________________
27 // GUI editor for AliEveHF.
30 ClassImp(AliEveHFEditor)
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),
42 // Initialize widget pointers to 0
46 MakeTitle("AliEveHF");
48 fInfoLabel0 = new TGLabel(this);
49 fInfoLabel0->SetTextJustify(kTextLeft);
50 AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
53 fInfoLabel1 = new TGLabel(this);
54 fInfoLabel1->SetTextJustify(kTextLeft);
55 AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
58 fInfoLabel2 = new TGLabel(this);
59 fInfoLabel2->SetTextJustify(kTextLeft);
60 AddFrame(fInfoLabel2, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
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()");
68 /******************************************************************************/
70 //______________________________________________________________________________
71 void AliEveHFEditor::SetModel(TObject* obj)
75 fM = dynamic_cast<AliEveHF*>(obj);
77 // Set values of widgets
78 fInfoLabel0->SetText(Form("CosPointingAngle = %f", fM->GetCosPointingAngle()));
79 fInfoLabel1->SetText(Form("Pt = %f", fM->GetPt()));
81 fInfoLabel2->SetText(Form("PDG Invariant Mass = %f", TDatabasePDG::Instance()->GetParticle(421)->Mass()));
85 /******************************************************************************/
87 // Implements callback/slot methods
89 //______________________________________________________________________________
90 // void AliEveHFEditor::DoXYZZ()
94 // fM->SetXYZZ(fXYZZ->GetValue());
98 #include <TEveManager.h>
99 #include <TEveWindow.h>
100 #include <TEveViewer.h>
101 #include <TEveScene.h>
102 #include <TEveGeoNode.h>
103 #include <TEveProjectionManager.h>
105 #include <TGLCamera.h>
106 #include <TGLViewer.h>
107 #include "TGLCameraOverlay.h"
110 #include <TRootEmbeddedCanvas.h>
111 #include <TInterpreter.h>
113 void AliEveHFEditor::DisplayDetailed()
115 TEveWindowSlot *slot = TEveWindow::CreateWindowMainFrame();
116 TEveWindowPack *pack = slot->MakePack();
117 pack->SetShowTitleBar(kFALSE);
118 pack->SetHorizontal();
121 // This part is for getting the different objects to display
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);
132 lhfTransverseMomentumDirection->SetPoint(1,scalePt*fM->fRecDecayP_HF.fX, scalePt*fM->fRecDecayP_HF.fY,0);
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);
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);
148 TEveUtil::LoadMacro("clusters_from_index.C");
150 TEveTrack *negTrack = fM->GetNegTrack();
151 TEveTrack *posTrack = fM->GetPosTrack();
154 char macroWithIndex[100] = {0};
155 Int_t daughterIndex = 0;
156 TEvePointSet *negDaughterCluster = 0;
157 TEvePointSet *posDaughterCluster = 0;
159 daughterIndex = negTrack->GetIndex();
160 sprintf(macroWithIndex,"clusters_from_index(%d)",daughterIndex);
161 Long_t negResult = gInterpreter->ProcessLine(macroWithIndex);
163 negDaughterCluster = reinterpret_cast<TEvePointSet*>(negResult);
164 if (negDaughterCluster){
165 negDaughterCluster->SetMarkerStyle(4);
166 negDaughterCluster->SetMarkerSize(1.5);
167 negDaughterCluster->SetMarkerColor(kBlue+3);
172 Warning("DisplayDetailed", "Import of negative daughter's clusters failed.");
175 daughterIndex = posTrack->GetIndex();
176 sprintf(macroWithIndex,"clusters_from_index(%d)",daughterIndex);
177 Long_t posResult = gInterpreter->ProcessLine(macroWithIndex);
179 posDaughterCluster = reinterpret_cast<TEvePointSet*>(posResult);
180 if (posDaughterCluster){
181 posDaughterCluster->SetMarkerStyle(4);
182 posDaughterCluster->SetMarkerSize(1.5);
183 posDaughterCluster->SetMarkerColor(kRed+3);
188 Warning("DisplayDetailed", "Import of positive daughter's clusters failed.");
192 // This part is for the bending plane view
194 pack->NewSlot()->MakeCurrent();
195 TEveViewer *bpViewer = gEve->SpawnNewViewer("HF bending plane View");
196 TEveScene *bpScene = gEve->SpawnNewScene("HF bending plane Scene");
198 TEveUtil::LoadMacro("geom_gentle.C");
199 Long_t result = gInterpreter->ProcessLine("geom_gentle_rphi()");
202 TEveGeoShape *geomRPhi = reinterpret_cast<TEveGeoShape*>(result);
203 geomRPhi->IncDenyDestroy();
204 TEveProjectionManager *projMgr = new TEveProjectionManager();
205 projMgr->ImportElements(geomRPhi, bpScene);
209 Warning("DisplayDetailed", "Import of R-Phi geometry failed.");
212 bpViewer->AddScene(bpScene);
213 bpScene->AddElement(fM);
214 bpScene->AddElement(lhfTransverseMomentumDirection);
215 bpScene->AddElement(pvlocation);
216 bpScene->AddElement(hflocation);
218 if (negDaughterCluster) bpScene->AddElement(negDaughterCluster);
219 if (posDaughterCluster) bpScene->AddElement(posDaughterCluster);
221 // This is the to-do list for the bending plane:
222 // 1. fix the view to orthographic XOY (no rotation allowed but moving the center ok) ->done!
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
241 // This part is for the decay plane view
243 pack->NewSlot()->MakeCurrent();
244 TEveViewer *dpViewer = gEve->SpawnNewViewer("HF decay plane View");
245 TEveScene *dpScene = gEve->SpawnNewScene("HF decay plane Scene");
247 dpViewer->AddScene(dpScene);
249 result = gInterpreter->ProcessLine("geom_gentle(kFALSE)");
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);
261 Warning("DisplayDetailed", "Import of 3D geometry failed.");
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);
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.)
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)
293 // end of the decay plane part
296 // This part is for displaying the information
298 slot = pack->NewSlot();
300 TEveWindowFrame *frame = slot->MakeFrame(new TRootEmbeddedCanvas());
301 frame->SetElementName("Details");
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};
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);
313 sprintf(info,"p_{T} = %.3f [GeV/c]",fM->GetPt());
314 ltx->DrawLatex(0.05, 0.7, info);
316 sprintf(info,"#eta = - ln( tan(#theta/2) ) = %.3f",fM->GetEta());
317 ltx->DrawLatex(0.05, 0.6, info);
319 sprintf(info, "D^{0} inv. mass = %.3f", fM->GetInvariantMassPart());
320 ltx->DrawLatex(0.05, 0.5, info);
322 sprintf(info, "D^{0}bar inv. mass = %.3f", fM->GetInvariantMassAntiPart());
323 ltx->DrawLatex(0.05, 0.4, info);