]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveKinkEditor.cxx
Changes in order to modify also ITSonly tracks
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveKinkEditor.cxx
1 // $Id$
2 // Author: Paraskevi Ganoti: 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 "AliEveKinkEditor.h"
11 #include "AliEveKink.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 #include "TMath.h"
23
24 //______________________________________________________________________________
25 // GUI editor for AliEveKink.
26 //
27
28 ClassImp(AliEveKinkEditor)
29
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),
34   fM(0),
35   fInfoLabel0(0),
36   fInfoLabel1(0),
37   fInfoLabelDaughter(0),
38   fXButton(0)
39   // Initialize widget pointers to 0
40 {
41   // Constructor.
42
43   MakeTitle("AliEveKink");
44
45   fInfoLabel0 = new TGLabel(this);
46   fInfoLabel0->SetTextJustify(kTextLeft);
47   AddFrame(fInfoLabel0, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
48                                           8, 0, 2, 0));
49
50   fInfoLabel1 = new TGLabel(this);
51   fInfoLabel1->SetTextJustify(kTextLeft);
52   AddFrame(fInfoLabel1, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
53                                           8, 0, 2, 0));
54                                           
55   fInfoLabelDaughter = new TGLabel(this);
56   fInfoLabelDaughter->SetTextJustify(kTextLeft);
57   AddFrame(fInfoLabelDaughter, new TGLayoutHints(kLHintsLeft|kLHintsExpandX,
58                                                     8, 0, 2, 0));                                         
59
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()");
63 }
64
65 /******************************************************************************/
66
67 //______________________________________________________________________________
68 void AliEveKinkEditor::SetModel(TObject* obj)
69 {
70   // Set model object.
71
72   fM = dynamic_cast<AliEveKink*>(obj);
73
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()));
78  
79 }
80
81 /******************************************************************************/
82
83 #include <TEveManager.h>
84 #include <TEveWindow.h>
85 #include <TEveViewer.h>
86 #include <TEveScene.h>
87
88 #include <TGLCamera.h>
89 #include <TGLViewer.h>
90
91 #include <TLatex.h>
92 #include <TRootEmbeddedCanvas.h>
93
94 void AliEveKinkEditor::DisplayDetailed()
95 {
96   TEveWindowSlot *slot = TEveWindow::CreateWindowMainFrame();
97   TEveWindowPack *pack = slot->MakePack();
98   pack->SetShowTitleBar(kFALSE);
99   pack->SetHorizontal();
100
101   //
102   // This part is for the bending plane view
103   //
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);
114
115   //
116   // This part is for the decay plane view
117   //
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);
127
128   // This part is for displaying the information
129   slot = pack->NewSlot();
130   
131   TEveWindowFrame *frame = slot->MakeFrame(new TRootEmbeddedCanvas());
132   frame->SetElementName("Details");
133   
134   char info[100] = {0};
135   TLatex* ltx = new TLatex(0.1, 0.9, info);
136   ltx->SetTextSize(0.08);
137
138   sprintf(info,"radius = %.3f [cm]",fM->GetKinkRadius());
139   ltx->DrawLatex(0.1, 0.8, info);
140   sprintf(info,"mass_{K^{+, -}} = %.3f [GeV/c^{2}]",fM->GetInvMass(13));
141   ltx->DrawLatex(0.1, 0.3, info);
142
143   gEve->Redraw3D();
144 }