]>
Commit | Line | Data |
---|---|---|
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 | /// \ingroup evemacros | |
11 | /// \file MUON_displayData.C | |
12 | /// | |
13 | /// \author B. Vulpescu, LPC | |
14 | ||
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 | ||
26 | #include <AliLog.h> | |
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> | |
38 | #endif | |
39 | ||
40 | class AliEveMUONData; | |
41 | class AliEveEventManager; | |
42 | ||
43 | AliEveMUONData *g_muon_data = 0; | |
44 | ||
45 | Int_t g_currentEvent = -1; | |
46 | Bool_t g_fromRaw = kFALSE; | |
47 | ||
48 | void MUON_ESD_tracks(); | |
49 | ||
50 | void MUON_displayData(Bool_t fromRaw = kFALSE, Bool_t showTracks = kTRUE, Bool_t clustersFromESD = kTRUE) | |
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 | ||
60 | // set the magnetic field for track extrapolations | |
61 | AliEveEventManager::AssertMagField(); | |
62 | AliMUONTrackExtrap::SetField(); | |
63 | ||
64 | TTree* dt = 0; | |
65 | TTree* ct = 0; | |
66 | TTree* ht = 0; | |
67 | ||
68 | if (AliEveEventManager::GetMaster() == 0) { | |
69 | printf("No alieve event: use alieve_init(...) \n"); | |
70 | return; | |
71 | } | |
72 | ||
73 | if (g_currentEvent == AliEveEventManager::GetMaster()->GetEventId()) { | |
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"); | |
80 | AliEveEventManager::GetMaster()->GotoEvent(g_currentEvent); | |
81 | } else { | |
82 | printf("Same event with raw.\n"); | |
83 | AliEveEventManager::GetMaster()->GotoEvent(g_currentEvent); | |
84 | } | |
85 | } | |
86 | } | |
87 | ||
88 | g_fromRaw = fromRaw; | |
89 | ||
90 | TString dataPath = TString(AliEveEventManager::GetMaster()->GetTitle()); | |
91 | dataPath.Append("/raw.root"); | |
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) { | |
100 | AliInfoGeneral("MUON_displayData.C", "No digits produced!"); | |
101 | } else { | |
102 | AliInfoGeneral("MUON_displayData.C", "With aliroot digits!"); | |
103 | g_muon_data->LoadDigits(dt); | |
104 | } | |
105 | } else { | |
106 | if (gSystem->AccessPathName(dataPath.Data(),kFileExists)) { | |
107 | AliInfoGeneral("MUON_displayData.C", "No raw data produced!"); | |
108 | } else { | |
109 | AliInfoGeneral("MUON_displayData.C", "With raw digits!"); | |
110 | g_muon_data->LoadRaw(dataPath.Data()); | |
111 | } | |
112 | } | |
113 | ||
114 | TString esdDataPath = TString(AliEveEventManager::GetMaster()->GetTitle()); | |
115 | esdDataPath.Append("/AliESDs.root"); | |
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 | ||
124 | g_currentEvent = AliEveEventManager::GetMaster()->GetEventId(); | |
125 | ||
126 | gStyle->SetPalette(1, 0); | |
127 | ||
128 | gEve->DisableRedraw(); | |
129 | ||
130 | TEveElementList* l = new TEveElementList("MUONChambers"); | |
131 | l->SetTitle("MUON chambers"); | |
132 | l->SetMainColor(2); | |
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 | ||
144 | l->AddElement(mucha); | |
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 | ||
160 | // TEveTrackList* lt = new TEveTrackList("ESD-Tracks"); | |
161 | AliEveMUONTrackList* lt = new AliEveMUONTrackList("ESD-Tracks"); | |
162 | lt->SetMainColor(6); | |
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 | ||
184 | lt->AddElement(track); | |
185 | } | |
186 | lt->HackMomentumLimits(); | |
187 | } | |
188 |