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