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