Added support to display the HLT ESD Tree. See the comment in visscan_local.C for How
[u/mrichter/AliRoot.git] / EVE / alice-macros / esd_spd_tracklets.C
CommitLineData
d810d0de 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 *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
ba978640 9#if !defined(__CINT__) || defined(__MAKECINT__)
10#include <TMath.h>
11#include <TEveManager.h>
12#include <TEveElement.h>
13#include <TEveTrack.h>
14#include <TEveTrackPropagator.h>
15
6c49a8e1 16#include <AliESDEvent.h>
17#include <AliESDVertex.h>
18#include <AliMultiplicity.h>
19#include <AliMagF.h>
20#include <AliEveEventManager.h>
21#include <AliEveTracklet.h>
22#include <AliEveTrackCounter.h>
ba978640 23#endif
cb4245bb 24
43a5f43c 25TEveElementList* esd_spd_tracklets(Float_t radius=8, Width_t line_width=2,
c12be4d4 26 Float_t dPhiWindow=0.080, Float_t dThetaWindow=0.025,
27 Float_t dPhiShift05T=0.0045)
c46fd838 28{
57e8f8f1 29 // radius - cylindrical radius to which the tracklets should be extrapolated
c46fd838 30
57e8f8f1 31 AliESDEvent *esd = AliEveEventManager::AssertESD();
ba978640 32 const AliESDVertex *pv = esd->GetPrimaryVertexSPD();
33 const AliMultiplicity *mul = esd->GetMultiplicity();
c46fd838 34
bccc8088 35 AliMagF *field = AliEveEventManager::AssertMagField();
36
c12be4d4 37 TEveElementList* cont = new TEveElementList("SPD Tracklets");
57e8f8f1 38 gEve->AddElement(cont);
c46fd838 39
c12be4d4 40 TEveTrackList *tg = new TEveTrackList("Good");
72ffcfba 41 tg->SetMainColor(kCyan);
c12be4d4 42 tg->SetLineWidth(line_width);
43 cont->AddElement(tg);
44
45 TEveTrackPropagator* pg = tg->GetPropagator();
46 pg->SetMaxR(radius);
47
48 TEveTrackList *tb = new TEveTrackList("Bad");
72ffcfba 49 tb->SetMainColor(kMagenta);
c12be4d4 50 tb->SetLineWidth(line_width);
51 cont->AddElement(tb);
52
53 TEveTrackPropagator* pb = tb->GetPropagator();
54 pb->SetMaxR(radius);
55
786d9102 56 const Float_t Bz = TMath::Abs(field->SolenoidField());
57
58 const Double_t dPhiShift = dPhiShift05T / 5.0 * Bz;
59 const Double_t dPhiWindow2 = dPhiWindow * dPhiWindow;
60 const Double_t dThetaWindow2 = dThetaWindow * dThetaWindow;
61
3a20f984 62 for (Int_t i = 0; i < mul->GetNumberOfTracklets(); ++i)
c46fd838 63 {
786d9102 64 Float_t theta = mul->GetTheta(i);
65 Float_t phi = mul->GetPhi(i);
66 Float_t dTheta = mul->GetDeltaTheta(i);
c12be4d4 67 Float_t dPhi = mul->GetDeltaPhi(i) - dPhiShift;
68 Float_t d = dPhi*dPhi/dPhiWindow2 + dTheta*dTheta/dThetaWindow2;
69
70 TEveTrackList* tl = (d < 1.0f) ? tg : tb;
57e8f8f1 71
c12be4d4 72 AliEveTracklet *t = new AliEveTracklet(i, pv, theta, phi, tl->GetPropagator());
73 t->SetAttLineAttMarker(tl);
3a20f984 74 t->SetElementName(Form("Tracklet %d", i));
786d9102 75 t->SetElementTitle(Form("Id = %d\nEta=%.3f, Theta=%.3f, dTheta=%.3f\nPhi=%.3f dPhi=%.3f",
76 i, mul->GetEta(i), theta, dTheta, phi, dPhi));
77
c12be4d4 78 tl->AddElement(t);
79 }
786d9102 80
c12be4d4 81 tg->MakeTracks();
82 tg->SetTitle(Form("N=%d", tg->NumChildren()));
57e8f8f1 83
c12be4d4 84 tb->MakeTracks();
85 tb->SetTitle(Form("N=%d", tb->NumChildren()));
c46fd838 86
c12be4d4 87 if (AliEveTrackCounter::IsActive())
88 {
89 AliEveTrackCounter::fgInstance->RegisterTracklets(tg, kTRUE);
90 AliEveTrackCounter::fgInstance->RegisterTracklets(tb, kFALSE);
91 }
92 else
93 {
3aff0c2e 94//==========================================
95 tb->SetLineStyle(1);
96 tb->SetLineWidth(2);
97//==========================================
98
c12be4d4 99 }
3a20f984 100
84aff7a4 101 gEve->Redraw3D();
c46fd838 102
57e8f8f1 103 return cont;
c46fd838 104}