Geometry for MFT (Brigitte)
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_kink.C
CommitLineData
4711ad43 1// $Id$
2// Main authors: 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 **************************************************************************/
ba978640 9#if !defined(__CINT__) || defined(__MAKECINT__)
10#include <TVector3.h>
11#include <TEveVector.h>
12#include <TEveTrackPropagator.h>
13#include <TEveVSDStructs.h>
14#include <TEveManager.h>
4711ad43 15
6c49a8e1 16#include <AliExternalTrackParam.h>
17#include <AliPID.h>
18#include <AliESDEvent.h>
19#include <AliESDtrack.h>
20#include <AliESDkink.h>
21#include <AliEveKink.h>
22#include <AliEveEventManager.h>
ba978640 23#endif
24
25void esd_kink_init_rectrackMother(TEveRecTrack& rt, const AliExternalTrackParam* tp)
4711ad43 26{
27 Double_t pbuf[3], vbuf[3];
28
29 rt.fSign = tp->GetSign();
30 tp->GetXYZ(vbuf); rt.fV.Set(vbuf);
31 tp->GetPxPyPz(pbuf); rt.fP.Set(pbuf);
32
33 rt.fBeta = 1; // ep/TMath::Sqrt(ep*ep + mc*mc);
34}
35
ba978640 36void esd_kink_init_rectrackDaughter(TEveRecTrack& rt, const AliExternalTrackParam* tp, TEveVector* svt,TEveVector* spt)
4711ad43 37{
38 rt.fSign = tp->GetSign();
39 rt.fV.Set(*svt);
40 rt.fP.Set(*spt);
41
42 rt.fBeta = 1; // ep/TMath::Sqrt(ep*ep + mc*mc);
43}
44
45AliEveKink* esd_make_kink(TEveTrackPropagator* rnrStyleMoth,TEveTrackPropagator* rnrStyleDaugh, AliESDtrack* moth, AliESDtrack* daug, AliESDkink* kink, Int_t i)
46{
47 TEveRecTrack rcMoth;
48 TEveRecTrack rcDaug;
49 TEveRecKink rcKink;
50
51 const TVector3 p1(kink->GetMotherP());
52 rcKink.fPMother.Set(p1);
53 const TVector3 p2(kink->GetDaughterP());
54 rcKink.fPDaughter.Set(p2);
55
56 const TVector3 r1(kink->GetPosition());
57 rcKink.fVKink.Set(r1);
58
ba978640 59 for (Int_t j=0; j<3; ++j) rcKink.fKinkAngle[j]=kink->GetAngle(j);
4711ad43 60
61 Double_t r[3], r2[3];
62
63 moth->GetTPCInnerParam()->GetXYZ(r2); rcKink.fVMother.Set(r2);
64 daug->GetOuterParam()->GetXYZ(r); rcKink.fVDaughter.Set(r);
65
66 esd_kink_init_rectrackMother(rcMoth, (moth->GetTPCInnerParam()));
67 rcMoth.fIndex = moth->GetID();
68
69 esd_kink_init_rectrackDaughter(rcDaug, daug->GetOuterParam(), &rcKink.fVKink, &rcKink.fPDaughter);
70 rcDaug.fIndex = daug->GetID();
71
72 AliEveKink* myKink = new AliEveKink(&rcMoth, &rcDaug, &rcKink, rnrStyleMoth,rnrStyleDaugh);
73
74 myKink->SetElementName(Form("ESDkink %d \n", i));
75 myKink->SetESDKinkIndex(i);
76
77 for (Int_t j=0; j<3; ++j) myKink->SetKinkAngle(j, kink->GetAngle(j));
78 Double_t daugProbability[10];
79 Double_t daugP = 0.0;
80 daug->GetESDpid(daugProbability);
81 daugP = daug->P();
82
83 // ****** Tentative particle type "concentrations"
84 Double_t c[5]={0.01, 0.01, 0.85, 0.10, 0.05};
85 AliPID::SetPriors(c);
86
87 AliPID daugPid(daugProbability);
88
89 Int_t daugMostProbPdg = 0;
90
91 switch (daugPid.GetMostProbable()){
92 case 0:
93 daugMostProbPdg = 11; break;
94 case 1:
95 daugMostProbPdg = 13; break;
96 case 2:
97 daugMostProbPdg = 211; break;
98 default :
99 daugMostProbPdg = 13; break;
100 }
101
102 Float_t daugMaxProbPid = daugPid.GetProbability(daugPid.GetMostProbable());
103
104 myKink->SetMaxProbPdgPid(daugMostProbPdg,daugMaxProbPid);//????????????
105
106 return myKink;
107}
108
109
110AliEveKinkList* esd_kink()
111{
112 AliESDEvent* esd = AliEveEventManager::AssertESD();
113 AliEveKinkList* cont = new AliEveKinkList("ESD kink");
114 cont->SetMainColor(3); // green
115 TEveTrackPropagator* rnrStyleMoth = cont->GetPropagatorMoth();
116 rnrStyleMoth->SetMagField( 0.1*esd->GetMagneticField() );
117 TEveTrackPropagator* rnrStyleDaugh = cont->GetPropagatorDaugh();
118 rnrStyleDaugh->SetMagField( 0.1*esd->GetMagneticField() );
119 rnrStyleDaugh->SetMaxR(520);
120 gEve->AddElement(cont);
121
122 Int_t count = 0;
123// for (Int_t n=0; n<esd->GetNumberOfKinks(); ++n)
124// {
125// AliESDkink *kink = esd->GetKink(n); //???????????
126// printf("kink number = %d, label of mother = %d , label of daug = %d --", n, kink->GetLabel(0), kink->GetLabel(1));
127// } To be investigated...
128 for (Int_t n=0; n<esd->GetNumberOfTracks(); ++n)
129 {
130 AliESDtrack* mtrack = esd->GetTrack(n);
131 if(mtrack->GetKinkIndex(0)<0){
132
133 AliESDkink *kink = new AliESDkink;
134
135 kink=esd->GetKink(TMath::Abs(mtrack->GetKinkIndex(0))-1);
136
137 for (Int_t m=0; m<esd->GetNumberOfTracks(); ++m)
138 {
139 AliESDtrack * dtrack = esd->GetTrack(m);
140
141 if((dtrack->GetKinkIndex(0)>0)&&(dtrack->GetKinkIndex(0)==TMath::Abs(mtrack->GetKinkIndex(0)))) {
142 AliESDtrack* mothTr = esd->GetTrack(n);
143 AliESDtrack* daugTr = esd->GetTrack(m);
144
145 AliEveKink* myKink = esd_make_kink(rnrStyleMoth, rnrStyleDaugh, mothTr, daugTr, kink, (TMath::Abs(mtrack->GetKinkIndex(0))-1));
146 if (myKink)
147 {
148 gEve->AddElement(myKink, cont);
149 ++count;
150 }
151 }
152 } // inner track loop
153
154
155 } //mother kink index <0
156 } // Outer track loop
157
158 cont->SetTitle("test");
159
160 cont->MakeKinks();
161 gEve->Redraw3D();
162
163 return cont;
164}