2 // Author: Paraskevi Ganoti: 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 "AliEveKinkEditor.h"
11 #include "AliEveKink.h"
13 #include "TVirtualPad.h"
16 // Cleanup these includes:
19 #include "TGNumberEntry.h"
20 #include "TGColorSelect.h"
21 #include "TGDoubleSlider.h"
24 //______________________________________________________________________________
25 // GUI editor for AliEveKink.
28 ClassImp(AliEveKinkEditor)
30 //______________________________________________________________________________
31 AliEveKinkEditor::AliEveKinkEditor(const TGWindow *p, Int_t width, Int_t height,
32 UInt_t options, Pixel_t back) :
33 TGedFrame(p, width, height, options | kVerticalFrame, back),
37 fInfoLabelDaughter(0),
39 // Initialize widget pointers to 0
43 MakeTitle("AliEveKink");
45 fInfoLabel0 = new TGLabel(this);
46 fInfoLabel0->SetTextJustify(kTextLeft);
47 AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
50 fInfoLabel1 = new TGLabel(this);
51 fInfoLabel1->SetTextJustify(kTextLeft);
52 AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
55 fInfoLabelDaughter = new TGLabel(this);
56 fInfoLabelDaughter->SetTextJustify(kTextLeft);
57 AddFrame(fInfoLabelDaughter, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
60 fXButton = new TGTextButton(this, "Detailed View");
61 AddFrame(fXButton, new TGLayoutHints(kLHintsLeft|kLHintsExpandX, 1, 1, 0, 0));
62 fXButton->Connect("Clicked()", "AliEveKinkEditor", this, "DisplayDetailed()");
65 /******************************************************************************/
67 //______________________________________________________________________________
68 void AliEveKinkEditor::SetModel(TObject* obj)
72 fM = static_cast<AliEveKink*>(obj);
74 // Set values of widgets
75 fInfoLabel0->SetText(Form("Radius = %f, Kink Angle = %f", fM->GetKinkRadius(), (fM->GetKinkAngle(2))*TMath::RadToDeg() ));
76 fInfoLabel1->SetText(Form("Mother Pt = %f", fM->GetKinkPMotherPerp()));
77 fInfoLabelDaughter->SetText(Form("Daughter Prob= %f for Pdg= %d", fM->GetDaugMaxProbPid(), fM->GetDaugMaxProbPdg()));
81 /******************************************************************************/
83 #include <TEveManager.h>
84 #include <TEveWindow.h>
85 #include <TEveViewer.h>
86 #include <TEveScene.h>
88 #include <TGLCamera.h>
89 #include <TGLViewer.h>
92 #include <TRootEmbeddedCanvas.h>
94 void AliEveKinkEditor::DisplayDetailed()
96 TEveWindowSlot *slot = TEveWindow::CreateWindowMainFrame();
97 TEveWindowPack *pack = slot->MakePack();
98 pack->SetShowTitleBar(kFALSE);
99 pack->SetHorizontal();
102 // This part is for the bending plane view
104 pack->NewSlot()->MakeCurrent();
105 TEveViewer *bpViewer = gEve->SpawnNewViewer("Kink bending plane View");
106 TEveScene *bpScene = gEve->SpawnNewScene("Kink bending plane Scene");
107 bpViewer->AddScene(bpScene);
108 bpScene->AddElement(fM);
109 bpViewer->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
110 bpViewer->GetGLViewer()->ResetCamerasAfterNextUpdate();
111 TGLCamera& bpCam = bpViewer->GetGLViewer()->CurrentCamera();
112 bpCam.SetExternalCenter(kTRUE);
113 bpCam.SetCenterVec(fM->fRecKinkPosition.fX, fM->fRecKinkPosition.fY, fM->fRecKinkPosition.fZ);
116 // This part is for the decay plane view
118 pack->NewSlot()->MakeCurrent();
119 TEveViewer *dpViewer = gEve->SpawnNewViewer("Kink decay plane View");
120 TEveScene *dpScene = gEve->SpawnNewScene("Kink decay plane Scene");
121 dpViewer->AddScene(dpScene);
122 dpScene->AddElement(fM);
123 dpViewer->GetGLViewer()->ResetCamerasAfterNextUpdate();
124 TGLCamera& dpCam = dpViewer->GetGLViewer()->CurrentCamera();
125 dpCam.SetExternalCenter(kTRUE);
126 dpCam.SetCenterVec(fM->fRecKinkPosition.fX, fM->fRecKinkPosition.fY, fM->fRecKinkPosition.fZ);
128 // This part is for displaying the information
129 slot = pack->NewSlot();
131 TEveWindowFrame *frame = slot->MakeFrame(new TRootEmbeddedCanvas());
132 frame->SetElementName("Details");
134 char info[100] = {0};
135 TLatex* ltx = new TLatex(0.1, 0.9, info);
136 ltx->SetTextSize(0.08);
138 snprintf(info,100,"radius = %.3f [cm]",fM->GetKinkRadius());
139 ltx->DrawLatex(0.1, 0.8, info);
140 snprintf(info,100,"mass_{K^{+, -}} = %.3f [GeV/c^{2}]",fM->GetInvMass(13));
141 ltx->DrawLatex(0.1, 0.3, info);