]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/esd_Cascade.C
Move contents of EVE/Alieve to EVE/EveDet as most code will remain there.
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_Cascade.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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 "AliEveEventManager.h"
11 // #include "TEveManager.h"
12 // #include "AliEveCascade.h"
13
14 // #include "AliESD.h"
15 // #include "AliESDtrack.h"
16 // #include "AliESDcascade.h"
17 // #include "AliESDVertex.h"
18
19 AliEveCascade* esd_make_cas(TEveTrackPropagator* rnrStyle, AliESDVertex* primVtx,
20                             AliESDcascade* cas, AliESDtrack* neg, AliESDtrack* pos,
21                             AliESDtrack* bach,Int_t i) {
22
23   AliEveCascade* myCas = new AliEveCascade(rnrStyle);
24   myCas->SetESDIndex(i);
25
26   static Double_t vx,vy,vz, px,py,pz;
27   cas->GetBPxPyPz(px,py,pz);
28   myCas->SetBachP(px,py,pz);
29   cas->GetNPxPyPz(px,py,pz);
30   myCas->SetNegP(px,py,pz);
31   cas->GetPPxPyPz(px,py,pz);
32   myCas->SetPosP(px,py,pz);
33
34   cas->GetXYZ(vx,vy,vz); // v0 decay vertex
35   myCas->SetV0vtx(vx,vy,vz);
36   cas->GetXYZcascade(vx,vy,vz); // cascade decay vertex
37   myCas->SetCascadeVtx(vx,vy,vz);
38
39   Double_t primx = primVtx->GetXv(),
40     primy = primVtx->GetYv(),
41     primz = primVtx->GetZv();
42
43   myCas->SetCasCosPointingAngle( cas->GetCascadeCosineOfPointingAngle(primx,primy,primz) );
44   myCas->SetDecayLength(primx, primy, primz);
45   myCas->SetDCA_v0_Bach(cas->GetDcaXiDaughters());
46
47   Float_t p = neg->GetP(), mc = neg->GetMass();
48   Float_t betaNeg = p/TMath::Sqrt(p*p + mc*mc);
49   p = pos->GetP(); mc = pos->GetMass();
50   Float_t betaPos = p/TMath::Sqrt(p*p + mc*mc);
51   p = bach->GetP(); mc = bach->GetMass();
52   Float_t betaBach = p/TMath::Sqrt(p*p + mc*mc);
53   if (bach->GetSign()<0) betaBach = -betaBach; // sign is stored is this parameter
54
55   myCas->SetBeta(betaNeg, betaPos, betaBach);
56
57   return myCas;
58 }
59
60
61
62
63 CascadeList* esd_AliEveCascade(Double_t min_pt=0.1, Double_t max_pt=100)
64 {
65   printf("THIS SCRIPT DOES NOT WORK.\n"
66          "AliEveCascade classes have been temporarily removed.\n"
67          "They need to be cleaned up.\n");
68   return;
69
70   AliESDEvent* esd = AliEveEventManager::AssertESD();
71   AliESDVertex* primVertex =(AliESDVertex*) esd->GetVertex();
72
73   CascadeList* cont = new CascadeList("ESD cascade");
74   cont->SetMainColor(Color_t(3)); // green
75   TEveTrackPropagator* rnrStyle = cont->GetPropagator();
76   rnrStyle->SetMagField( esd->GetMagneticField() );
77
78   gEve->AddElement(cont);
79
80   Int_t count = 0;
81   //for (Int_t n=0; count<3; n++) {
82   for (Int_t n=0; n<esd->GetNumberOfCascades(); n++) {
83
84     AliESDcascade *cas = esd->GetCascade(n);
85     Int_t negInd = cas->GetNindex();
86     Int_t posInd = cas->GetPindex();
87     Int_t bachInd = cas->GetBindex();
88     AliESDtrack* negTr = esd->GetTrack(negInd);
89     AliESDtrack* posTr = esd->GetTrack(posInd);
90     AliESDtrack* bachTr = esd->GetTrack(bachInd);
91
92     if (cas) {
93       AliEveCascade* myCas = esd_make_cas(rnrStyle, primVertex, cas,
94                                           negTr, posTr, bachTr, n);
95       if (myCas) {
96         gEve->AddElement(myCas, cont);
97         count++;
98       }
99     }
100   }
101
102   cont->SetTitle("CascadeList");
103   cont->UpdateItems();
104
105   cont->MakeCascades();
106   gEve->Redraw3D();
107
108   return cont;
109 }