]>
Commit | Line | Data |
---|---|---|
20dae051 | 1 | // $Id$ |
58e15fc1 | 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 | ||
25b4bdb2 | 10 | /// \ingroup evemacros |
11 | /// \file MUON_displayData.C | |
12 | /// | |
13 | /// \author B. Vulpescu, LPC | |
14 | ||
58e15fc1 | 15 | class AliEveMUONData; |
16 | class AliEveEventManager; | |
17 | ||
18 | AliEveMUONData *g_muon_data = 0; | |
58e15fc1 | 19 | |
20 | Int_t g_currentEvent = -1; | |
21 | Bool_t g_fromRaw = kFALSE; | |
22 | ||
af2d8a68 | 23 | void MUON_displayData(Bool_t fromRaw = kFALSE, Bool_t showTracks = kTRUE, Bool_t clustersFromESD = kTRUE) |
58e15fc1 | 24 | { |
25 | // | |
26 | // display from real data, eventually with recreated digits | |
27 | // tracks: ESD | |
28 | // | |
29 | ||
30 | if (!AliMpSegmentation::Instance()) AliMpCDB::LoadMpSegmentation(); | |
31 | if (!AliMpDDLStore::Instance()) AliMpCDB::LoadDDLStore(); | |
32 | ||
f7a1cc68 | 33 | // set the magnetic field for track extrapolations |
e383efce | 34 | AliEveEventManager::AssertMagField(); |
f7a1cc68 | 35 | AliMUONTrackExtrap::SetField(); |
58e15fc1 | 36 | |
37 | TTree* dt = 0; | |
38 | TTree* ct = 0; | |
39 | TTree* ht = 0; | |
40 | ||
4d62585e | 41 | if (AliEveEventManager::GetMaster() == 0) { |
58e15fc1 | 42 | printf("No alieve event: use alieve_init(...) \n"); |
43 | return; | |
44 | } | |
45 | ||
4d62585e | 46 | if (g_currentEvent == AliEveEventManager::GetMaster()->GetEventId()) { |
58e15fc1 | 47 | if (g_fromRaw == fromRaw) { |
48 | printf("Same event... \n"); | |
49 | return; | |
50 | } else { | |
51 | if (g_fromRaw) { | |
52 | printf("Same event with digits.\n"); | |
4d62585e | 53 | AliEveEventManager::GetMaster()->GotoEvent(g_currentEvent); |
58e15fc1 | 54 | } else { |
55 | printf("Same event with raw.\n"); | |
4d62585e | 56 | AliEveEventManager::GetMaster()->GotoEvent(g_currentEvent); |
58e15fc1 | 57 | } |
58 | } | |
59 | } | |
60 | ||
61 | g_fromRaw = fromRaw; | |
62 | ||
4d62585e | 63 | TString dataPath = TString(AliEveEventManager::GetMaster()->GetTitle()); |
20dae051 | 64 | dataPath.Append("/raw.root"); |
58e15fc1 | 65 | |
66 | AliRunLoader* rl = AliEveEventManager::AssertRunLoader(); | |
67 | g_muon_data = new AliEveMUONData; | |
68 | ||
69 | if (!fromRaw) { | |
70 | rl->LoadDigits("MUON"); | |
71 | dt = rl->GetTreeD("MUON", false); | |
72 | if (dt == 0) { | |
73 | cout << "No digits produced!" << endl; | |
74 | } else { | |
75 | cout << "With aliroot digits!" << endl; | |
76 | g_muon_data->LoadDigits(dt); | |
77 | } | |
78 | } else { | |
79 | if (gSystem->AccessPathName(dataPath.Data(),kFileExists)) { | |
80 | cout << "No raw data produced!" << endl; | |
81 | } else { | |
82 | cout << "With raw digits!" << endl; | |
83 | g_muon_data->LoadRaw(dataPath.Data()); | |
84 | } | |
85 | } | |
86 | ||
4d62585e | 87 | TString esdDataPath = TString(AliEveEventManager::GetMaster()->GetTitle()); |
58e15fc1 | 88 | esdDataPath.Append("/AliESDs.root"); |
af2d8a68 | 89 | if (clustersFromESD) { |
90 | g_muon_data->LoadRecPointsFromESD(esdDataPath.Data()); | |
91 | } else { | |
92 | rl->LoadRecPoints("MUON"); | |
93 | ct = rl->GetTreeR("MUON", false); | |
94 | g_muon_data->LoadRecPoints(ct); | |
95 | } | |
96 | ||
4d62585e | 97 | g_currentEvent = AliEveEventManager::GetMaster()->GetEventId(); |
58e15fc1 | 98 | |
99 | gStyle->SetPalette(1, 0); | |
100 | ||
101 | gEve->DisableRedraw(); | |
102 | ||
103 | TEveElementList* l = new TEveElementList("MUONChambers"); | |
104 | l->SetTitle("MUON chambers"); | |
fbc350a3 | 105 | l->SetMainColor(2); |
58e15fc1 | 106 | gEve->AddElement(l); |
107 | ||
108 | for (Int_t ic = 0; ic < 14; ic++) | |
109 | { | |
110 | AliEveMUONChamber* mucha = new AliEveMUONChamber(ic); | |
111 | ||
112 | mucha->SetFrameColor(2); | |
113 | mucha->SetChamberID(ic); | |
114 | ||
115 | mucha->SetDataSource(g_muon_data); | |
116 | ||
98d99a29 | 117 | l->AddElement(mucha); |
58e15fc1 | 118 | } |
119 | ||
120 | if (showTracks) { | |
121 | MUON_ESD_tracks(); | |
122 | } | |
123 | ||
124 | gEve->Redraw3D(kTRUE); | |
125 | gEve->EnableRedraw(); | |
126 | } | |
127 | ||
128 | //______________________________________________________________________________ | |
129 | void MUON_ESD_tracks() | |
130 | { | |
131 | AliESDEvent* esd = AliEveEventManager::AssertESD(); | |
132 | ||
98d99a29 | 133 | // TEveTrackList* lt = new TEveTrackList("ESD-Tracks"); |
134 | AliEveMUONTrackList* lt = new TEveTrackList("ESD-Tracks"); | |
fbc350a3 | 135 | lt->SetMainColor(6); |
58e15fc1 | 136 | //lt->SetMUON(); |
137 | ||
138 | gEve->AddElement(lt); | |
139 | ||
140 | AliESDMuonTrack *mt; | |
141 | TEveRecTrack rt; | |
142 | Int_t nMuonTracks = esd->GetNumberOfMuonTracks(); | |
143 | Int_t nTrack = 0; | |
144 | for (Int_t n = 0; n < nMuonTracks; n++) | |
145 | { | |
146 | mt = esd->GetMuonTrack(n); | |
147 | ||
148 | if (mt->GetNHit() == 0) continue; | |
149 | nTrack++; | |
150 | ||
151 | rt.fLabel = n; | |
152 | ||
153 | AliEveMUONTrack* track = new AliEveMUONTrack(&rt, lt->GetPropagator()); | |
154 | ||
155 | track->MakeESDTrack(mt); | |
156 | ||
98d99a29 | 157 | lt->AddElement(track); |
58e15fc1 | 158 | } |
98d99a29 | 159 | lt->HackMomentumLimits(); |
58e15fc1 | 160 | } |
161 |