In muon-related macros in EVE:
[u/mrichter/AliRoot.git] / EVE / alice-macros / trd_gtutracks.C
CommitLineData
98b9b8b2 1#include "TParticlePDG.h"
2
3TEveElementList *
4trd_gtutracks()
5{
6 // AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
7 // rl->LoadKinematics();
8 // AliLoader *loader = rl->GetLoader("TRDLoader");
9 /*
10 loader->LoadTracks();
11 TTree *trktree = loader->TreeT();
12 TBranch *branch = trktree->GetBranch("TRDmcmTracklet");
13 TObjArray *tracklets = new TObjArray();
14 branch->SetAddress(&tracklets);
15 */
16
17 TFile *f = TFile::Open("TRD.GtuTracking.root");
18 TTree *trktree = f->Get("gtutracks");
19 TBranch *branch = trktree->GetBranch("TRDgtuTrack");
20 AliTRDtrackGTU *trk = 0x0;
21 branch->SetAddress(&trk);
22
23 gEve->DisableRedraw();
24 TEveElementList* listOfTracks = new TEveElementList("GTU Tracks");
25 gEve->AddElement(listOfTracks);
26
27 AliTRDgeometry *geo = new AliTRDgeometry;
28 for (Int_t i = 0; i < trktree->GetEntriesFast(); i++) {
29 trktree->GetEntry(i);
30 if (!trk)
31 continue;
32 Int_t sector = trk->GetSector();
33 Double_t *x = new Double_t[3];
34 Double_t *p = new Double_t[3];
35 Double_t *p2 = new Double_t[3];
36 x[0] = x[1] = x[2] = 0;
37 x[1] = trk->GetA() / 2 * 160e-4;
38 geo->RotateBack(sector*30, x, p);
39 printf("Line: %f, %f, %f\n", x[0], x[1], x[2]);
40 x[0] = 400;
41 x[1] = x[0] * trk->GetB() + trk->GetA() / 2 * 160e-4;
42 x[2] = -1 * x[0] * trk->GetC() / TMath::Tan( -2.0 / 180.0 * TMath::Pi() );
43 geo->RotateBack(sector*30, x, p2);
44 printf("Line: %f, %f, %f\n", p2[0], p2[1], p2[2]);
45 // cont->AddLine(p[0], p[1], p[2], p2[0], p2[1], p2[2]);
46 TEveLine *track = new TEveLine(Form("GTU track pt: %4.2f (%i)", trk->GetPt(), trk->GetLabel()));
47 track->SetMainColor((Color_t) 4);
48 track->SetNextPoint(p[0], p[1], p[2]);
49 track->SetNextPoint(p2[0], p2[1], p2[2]);
50 gEve->AddElement(track, listOfTracks);
51 delete[] x;
52 delete[] p;
53 delete[] p2;
54 TEveStraightLineSet* trkl = new TEveStraightLineSet("TRD Tracklets");
55 trkl->SetMainColor((Color_t) 2);
56 gEve->AddElement(trkl, track);
57 Int_t det = trk->GetSector() * 30 + trk->GetStack() * 6;
58 printf("Track in SM: %i, Stack: %i => Det: %i\n", trk->GetSector(), trk->GetStack(), det);
59 for (Int_t layer = 0; layer < 6; layer++) {
60 printf("checking for tracklet in layer %i\n", layer);
61 if (trk->IsTrackletInLayer(layer)) {
62 printf("tracklet in layer %i\n", layer);
63 AliTRDtrackletGTU *trklet = trk->GetTracklet(layer);
64 Double_t *x = new Double_t[3];
65 x[0] = geo->GetTime0(layer);
66 AliTRDpadPlane *pp = geo->GetPadPlane(layer, trk->GetStack());
67 x[1] = trklet.GetYbin() * 0.0160;
68 x[2] = pp->GetRowPos(trklet->GetZbin()) - pp->GetRowSize(trklet->GetZbin())/2;
69 Double_t *p = new Double_t[3];
70 Double_t *p2 = new Double_t[3];
71 geo->RotateBack(det, x, p);
72 x[0] -= 10;
73 x[1] += 10 * trklet->GetdYdX();
74 x[2] *= x[0]/(x[0]+10);
75 geo->RotateBack(det, x, p2);
76 trkl->AddLine(p[0], p[1], p[2], p2[0], p2[1], p2[2]);
77 delete[] x;
78 delete[] p;
79 delete[] p2;
80
81 }
82 }
83 }
84
85 gEve->EnableRedraw();
86 gEve->Redraw3D();
87
88 return listOfTracks;
89}
90