]>
Commit | Line | Data |
---|---|---|
3626c858 | 1 | // |
2 | // Sources: | |
3 | // | |
4 | // GetTrackerMapping = AliMUONDigitMaker::GetMapping | |
5 | // GetTriggerMapping = AliMUONDigitMaker::TriggerDigits | |
6 | // GetTriggerChamber = AliMUONDigitMaker::GetTriggerChamber | |
7 | // LoadRawTracker = MUONRawStreamTracker.C | |
8 | // LoadRawTrigger = MUONRawStreamTrigger.C | |
9 | // | |
10 | ||
11 | #include "MUONData.h" | |
12 | ||
13 | #include <Alieve/MUONChamberData.h> | |
14 | #include <Alieve/EventAlieve.h> | |
15 | ||
16 | #include <AliRawReader.h> | |
17 | #include <AliRawReaderFile.h> | |
18 | #include <AliRawReaderDate.h> | |
19 | #include <AliRawReaderRoot.h> | |
20 | ||
361fa326 | 21 | #include <AliLog.h> |
3626c858 | 22 | |
cef26510 | 23 | #include <AliMUONDigitMaker.h> |
eadce74d | 24 | #include <AliMUONHit.h> |
8c58b039 | 25 | #include <AliMUONVCluster.h> |
26 | #include "AliMUONVClusterStore.h" | |
8d33d1c2 | 27 | #include <AliMUONVDigit.h> |
8d33d1c2 | 28 | #include "AliMUONDigitStoreV1.h" |
832dd5c9 | 29 | #include "AliMUONVDigitStore.h" |
3626c858 | 30 | #include "TTree.h" |
31 | #include "TString.h" | |
3626c858 | 32 | #include "TClonesArray.h" |
cef26510 | 33 | #include "TList.h" |
3626c858 | 34 | |
35 | using namespace Reve; | |
36 | using namespace Alieve; | |
37 | ||
38 | //______________________________________________________________________ | |
39 | // MUONData | |
40 | // | |
41 | ||
42 | ClassImp(MUONData) | |
43 | ||
44 | AliRawReader* MUONData::fgRawReader = 0; | |
3626c858 | 45 | |
46 | //______________________________________________________________________ | |
47 | MUONData::MUONData() : | |
eadce74d | 48 | fChambers(14), |
49 | fNTrackList(0) | |
3626c858 | 50 | { |
51 | // | |
52 | // Constructor | |
53 | // | |
54 | ||
cef26510 | 55 | for (Int_t i = 0; i < 256; i++) { |
eadce74d | 56 | fTrackList[i] = -1; |
57 | } | |
58 | ||
3626c858 | 59 | CreateAllChambers(); |
60 | ||
61 | } | |
62 | ||
63 | //______________________________________________________________________ | |
64 | MUONData::~MUONData() | |
65 | { | |
66 | // | |
67 | // Destructor | |
68 | // | |
69 | ||
70 | DeleteAllChambers(); | |
71 | ||
3626c858 | 72 | } |
73 | ||
eadce74d | 74 | //______________________________________________________________________ |
75 | void MUONData::Reset() | |
76 | { | |
77 | // | |
78 | // Reset data | |
79 | // | |
80 | ||
81 | //DropAllChambers(); | |
82 | ||
83 | fNTrackList = 0; | |
cef26510 | 84 | for (Int_t i = 0; i < 256; i++) { |
eadce74d | 85 | fTrackList[i] = -1; |
86 | } | |
87 | ||
88 | } | |
89 | ||
3626c858 | 90 | //______________________________________________________________________ |
91 | MUONData::MUONData(const MUONData &mdata) : | |
e4204218 | 92 | TObject(mdata), |
8d33d1c2 | 93 | Reve::ReferenceCount(), |
94 | fChambers(14), | |
95 | fNTrackList(0) | |
3626c858 | 96 | { |
97 | // | |
98 | // Copy constructor | |
99 | // | |
100 | ||
101 | } | |
102 | ||
103 | //______________________________________________________________________ | |
104 | MUONData& MUONData::operator=(const MUONData &mdata) | |
105 | { | |
106 | // | |
107 | // Assignment operator | |
108 | // | |
109 | ||
110 | if (this != &mdata) { | |
111 | ||
112 | } | |
113 | ||
114 | return *this; | |
115 | ||
116 | } | |
117 | ||
118 | //______________________________________________________________________ | |
119 | void MUONData::CreateChamber(Int_t chamber) | |
120 | { | |
121 | // | |
122 | // create data for the chamber with id=chamber (0 to 13) | |
123 | // | |
124 | ||
125 | if (fChambers[chamber] == 0) | |
126 | fChambers[chamber] = new MUONChamberData(chamber); | |
127 | ||
128 | } | |
129 | ||
130 | //______________________________________________________________________ | |
131 | void MUONData::CreateAllChambers() | |
132 | { | |
133 | // | |
134 | // create all 14 chambers data | |
135 | // | |
136 | ||
137 | for (Int_t c = 0; c < 14; ++c) | |
138 | CreateChamber(c); | |
139 | ||
140 | } | |
141 | ||
142 | //______________________________________________________________________ | |
143 | void MUONData::DropAllChambers() | |
144 | { | |
145 | // | |
146 | // release data from all chambers | |
147 | // | |
148 | ||
149 | for (Int_t c = 0; c < 14; ++c) { | |
150 | ||
151 | if (fChambers[c] != 0) | |
152 | fChambers[c]->DropData(); | |
153 | ||
154 | } | |
155 | ||
156 | } | |
157 | ||
158 | //______________________________________________________________________ | |
159 | void MUONData::DeleteAllChambers() | |
160 | { | |
161 | // | |
162 | // delete all chambers data | |
163 | // | |
164 | ||
165 | for (Int_t c = 0; c < 14; ++c) { | |
166 | ||
167 | delete fChambers[c]; | |
168 | fChambers[c] = 0; | |
169 | ||
170 | } | |
171 | ||
172 | } | |
173 | ||
eadce74d | 174 | //______________________________________________________________________ |
175 | void MUONData::RegisterTrack(Int_t track) | |
176 | { | |
177 | // | |
178 | // register (in a list) a track with hits in the chambers | |
179 | // | |
180 | ||
cef26510 | 181 | if (fNTrackList == (256-1)) { |
eadce74d | 182 | cout << "Maximum of registered tracks reached..." << endl; |
183 | return; | |
184 | } | |
185 | ||
186 | Bool_t inList = kFALSE; | |
187 | for (Int_t i = 0; i < fNTrackList; i++) { | |
188 | if (track == fTrackList[i]) { | |
189 | inList = kTRUE; | |
190 | break; | |
191 | } | |
192 | } | |
193 | if (!inList) { | |
194 | fTrackList[fNTrackList] = track; | |
195 | fNTrackList++; | |
196 | } | |
197 | ||
198 | } | |
199 | ||
2674c15a | 200 | //______________________________________________________________________ |
eadce74d | 201 | void MUONData::LoadRecPoints(TTree* tree) |
2674c15a | 202 | { |
203 | // | |
204 | // load reconstructed points from the TreeR | |
205 | // load local trigger information | |
206 | // | |
207 | ||
8c58b039 | 208 | AliMUONVClusterStore *clusterStore = AliMUONVClusterStore::Create(*tree); |
209 | clusterStore->Clear(); | |
210 | clusterStore->Connect(*tree,kFALSE); | |
211 | ||
212 | tree->GetEvent(0); | |
213 | ||
214 | AliMUONVCluster *cluster; | |
eadce74d | 215 | Int_t detElemId; |
8c58b039 | 216 | Double_t clsX, clsY, clsZ, charge; |
eadce74d | 217 | |
8c58b039 | 218 | for (Int_t ch = 0; ch < 10; ++ch) { |
eadce74d | 219 | |
8c58b039 | 220 | if (fChambers[ch] == 0) continue; |
221 | ||
222 | TIter next(clusterStore->CreateChamberIterator(ch,ch)); | |
223 | ||
224 | while ( ( cluster = static_cast<AliMUONVCluster*>(next()) ) ) { | |
eadce74d | 225 | |
8c58b039 | 226 | detElemId = cluster->GetDetElemId(); |
227 | ||
228 | clsX = cluster->GetX(); | |
229 | clsY = cluster->GetY(); | |
230 | clsZ = cluster->GetZ(); | |
231 | charge = cluster->GetCharge(); | |
eadce74d | 232 | |
8c58b039 | 233 | fChambers[ch]->RegisterCluster(detElemId,0,clsX,clsY,clsZ,charge); |
234 | fChambers[ch]->RegisterCluster(detElemId,1,clsX,clsY,clsZ,charge); | |
eadce74d | 235 | |
236 | } | |
237 | ||
238 | } | |
239 | ||
8c58b039 | 240 | delete clusterStore; |
241 | ||
eadce74d | 242 | } |
243 | ||
244 | //______________________________________________________________________ | |
245 | void MUONData::LoadHits(TTree* tree) | |
246 | { | |
247 | // | |
248 | // load simulation hits from the TreeH | |
249 | // | |
250 | ||
251 | TClonesArray *hits = 0; | |
252 | AliMUONHit *mhit; | |
253 | Int_t cha, detElemId, nhits, ntracks; | |
254 | Float_t hitX, hitY, hitZ; | |
255 | ||
256 | ntracks = tree->GetEntries(); | |
257 | tree->SetBranchAddress("MUONHits",&hits); | |
258 | ||
259 | for (Int_t it = 0; it < ntracks; it++) { | |
260 | ||
261 | tree->GetEvent(it); | |
262 | nhits = hits->GetEntriesFast(); | |
263 | ||
264 | for (Int_t ih = 0; ih < nhits; ih++) { | |
265 | ||
266 | mhit = (AliMUONHit*)hits->UncheckedAt(ih); | |
267 | hitX = mhit->X(); | |
268 | hitY = mhit->Y(); | |
269 | hitZ = mhit->Z(); | |
270 | detElemId = mhit->DetElemId(); | |
271 | cha = mhit->Chamber(); | |
272 | ||
273 | RegisterTrack(mhit->GetTrack()); | |
274 | ||
275 | fChambers[cha-1]->RegisterHit(detElemId,hitX,hitY,hitZ); | |
276 | ||
277 | } | |
278 | } | |
279 | ||
2674c15a | 280 | } |
281 | ||
832dd5c9 | 282 | //______________________________________________________________________ |
283 | void MUONData::LoadDigits(TTree* tree) | |
284 | { | |
285 | // | |
286 | // load digits from the TreeD | |
287 | // | |
288 | ||
289 | AliMUONVDigitStore *digitStore = AliMUONVDigitStore::Create(*tree); | |
290 | digitStore->Clear(); | |
291 | digitStore->Connect(*tree,0); | |
292 | ||
293 | tree->GetEvent(0); | |
294 | ||
295 | AliMUONVDigit* digit; | |
296 | TIter next(digitStore->CreateIterator()); | |
297 | ||
298 | Int_t cathode, detElemId, ix, iy, charge, chamber, adc; | |
299 | ||
300 | while ( ( digit = static_cast<AliMUONVDigit*>(next() ) ) ) | |
301 | { | |
302 | cathode = digit->Cathode(); | |
303 | ix = digit->PadX(); | |
304 | iy = digit->PadY(); | |
305 | detElemId = digit->DetElemId(); | |
306 | charge = (Int_t)digit->Charge(); | |
307 | adc = digit->ADC(); | |
308 | chamber = detElemId/100 - 1; | |
309 | if (chamber > 9) { | |
310 | fChambers[chamber]->RegisterDigit(detElemId,cathode,ix,iy,charge); | |
311 | } else { | |
312 | fChambers[chamber]->RegisterDigit(detElemId,cathode,ix,iy,adc); | |
313 | } | |
314 | } | |
315 | ||
316 | delete digitStore; | |
317 | ||
318 | } | |
319 | ||
3626c858 | 320 | //______________________________________________________________________ |
321 | void MUONData::LoadRaw(TString fileName) | |
322 | { | |
323 | // | |
324 | // load raw data from fileName; tracker and trigger data | |
325 | // | |
326 | ||
327 | if (fgRawReader == 0) { | |
328 | // check extention to choose the rawdata file format | |
329 | if (fileName.EndsWith("/")) { | |
330 | fgRawReader = new AliRawReaderFile(fileName); // DDL files | |
331 | } else if (fileName.EndsWith(".root")) { | |
332 | fgRawReader = new AliRawReaderRoot(fileName); // ROOT file | |
333 | } else if (!fileName.IsNull()) { | |
334 | fgRawReader = new AliRawReaderDate(fileName); // DATE file | |
335 | } | |
3626c858 | 336 | } |
337 | ||
3626c858 | 338 | fgRawReader->RewindEvents(); |
cef26510 | 339 | fgRawReader->Reset(); |
3626c858 | 340 | |
341 | Int_t iEvent = 0; | |
8d33d1c2 | 342 | while (fgRawReader->NextEvent()) |
343 | { | |
344 | if (iEvent != Alieve::gEvent->GetEventId()) | |
345 | { | |
3626c858 | 346 | iEvent++; |
347 | continue; | |
348 | } | |
3626c858 | 349 | break; |
cef26510 | 350 | } |
3626c858 | 351 | |
8d33d1c2 | 352 | AliMUONDigitMaker digitMaker; |
3626c858 | 353 | |
8d33d1c2 | 354 | digitMaker.SetMakeTriggerDigits(kTRUE); |
3626c858 | 355 | |
8d33d1c2 | 356 | AliMUONDigitStoreV1 digitStore; |
357 | ||
358 | digitMaker.Raw2Digits(fgRawReader,&digitStore); | |
3626c858 | 359 | |
8d33d1c2 | 360 | AliMUONVDigit* digit; |
361 | TIter next(digitStore.CreateIterator()); | |
362 | ||
832dd5c9 | 363 | Int_t cathode, detElemId, ix, iy, charge, chamber, adc; |
8d33d1c2 | 364 | |
365 | while ( ( digit = static_cast<AliMUONVDigit*>(next() ) ) ) | |
366 | { | |
cef26510 | 367 | cathode = digit->Cathode(); |
368 | ix = digit->PadX(); | |
369 | iy = digit->PadY(); | |
370 | detElemId = digit->DetElemId(); | |
8d33d1c2 | 371 | charge = (Int_t)digit->Charge(); |
832dd5c9 | 372 | adc = digit->ADC(); |
cef26510 | 373 | chamber = detElemId/100 - 1; |
832dd5c9 | 374 | if (chamber > 9) { |
375 | fChambers[chamber]->RegisterDigit(detElemId,cathode,ix,iy,charge); | |
376 | } else { | |
377 | fChambers[chamber]->RegisterDigit(detElemId,cathode,ix,iy,adc); | |
378 | } | |
cef26510 | 379 | } |
832dd5c9 | 380 | |
3626c858 | 381 | } |
382 | ||
eadce74d | 383 | //______________________________________________________________________ |
384 | Int_t MUONData::GetTrack(Int_t index) | |
385 | { | |
386 | // | |
387 | // return track stack number for "index"-th track with hits in the chambers | |
388 | // | |
389 | ||
cef26510 | 390 | if (index < 256) { |
eadce74d | 391 | return fTrackList[index]; |
392 | } else { | |
393 | return -1; | |
394 | } | |
395 | ||
396 | } | |
397 | ||
3626c858 | 398 | //______________________________________________________________________ |
399 | MUONChamberData* MUONData::GetChamberData(Int_t chamber) | |
400 | { | |
401 | // | |
402 | // return chamber data | |
403 | // | |
404 | ||
405 | if (chamber < 0 || chamber > 13) return 0; | |
406 | ||
407 | //if (fChambers[chamber] == 0) CreateChamber(chamber); | |
408 | ||
409 | return fChambers[chamber]; | |
410 | ||
411 | } |