]>
Commit | Line | Data |
---|---|---|
13985652 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
48b32e42 | 17 | |
18 | #include <TError.h> | |
30178c30 | 19 | #include <TParticle.h> |
48b32e42 | 20 | |
21 | #include "AliRunLoader.h" | |
22 | #include "AliLoader.h" | |
23 | ||
24 | #include "AliMUONDataInterface.h" | |
30178c30 | 25 | #include "AliMUONLocalTrigger.h" |
554b38a6 | 26 | #include "AliMUONGlobalTrigger.h" |
30178c30 | 27 | #include "AliMUONHit.h" |
28 | #include "AliMUONDigit.h" | |
29 | #include "AliMUONRawCluster.h" | |
554b38a6 | 30 | #include "AliMUONTrack.h" |
8c343c7c | 31 | #include "AliLog.h" |
48b32e42 | 32 | |
6d149c9e | 33 | #include <iostream> |
34 | using std::endl; | |
35 | using std::cout; | |
36 | ||
85fec35d | 37 | /// |
38 | /// \class AliMUONDataInterface | |
39 | /// | |
40 | /// An easy to use interface to the MUON module data stored in | |
41 | /// TreeK, TreeH, TreeS, TreeD and TreeR | |
42 | /// One can fetch any of the data objects with all the calls to runloader, | |
43 | /// muon loader and AliMUONData done behind the scenes and automatically. | |
44 | /// | |
45 | /// This interface in not necessarily the fastest way to fetch the data but | |
46 | /// it is the easiest. | |
47 | /// Note: If independant calls to the run loader, muon loader or | |
48 | /// AliMUONData objects are interspersed with calls to the | |
49 | /// AliMUONDataInterface to fetch data, one might need to call the Reset | |
50 | /// method between these method calls at some point to prevent | |
51 | /// AliMUONDataInterface from getting confused. | |
52 | /// This is necessary since this object assumes the state of runloader, | |
53 | /// muon loader nor AliMUONData has not changed between calls. | |
54 | /// If the state has changes then one must call Reset so that | |
55 | /// AliMUONDataInterface refreshes what it knows about the state | |
56 | /// of the loader and AliMUONData objects. | |
57 | /// | |
58 | /// \deprecated We have to revisit all this AliMUONData stuff anyway, | |
59 | /// and probably make a real AliMUONLoader instead... | |
60 | /// | |
13985652 | 61 | /// \author Artur Szostak |
62 | /// email: artur@alice.phy.uct.ac.za | |
63 | ||
64 | ||
65 | /// \cond CLASSIMP | |
66 | ClassImp(AliMUONDataInterface) | |
67 | /// \endcond | |
48b32e42 | 68 | |
69 | AliMUONDataInterface::AliMUONDataInterface() | |
b21698f0 | 70 | : TObject(), |
71 | fCreatedRunLoader(kFALSE), | |
72 | fHitAddressSet(kFALSE), | |
73 | fSDigitAddressSet(kFALSE), | |
74 | fDigitAddressSet(kFALSE), | |
75 | fClusterAddressSet(kFALSE), | |
76 | fTriggerAddressSet(kFALSE), | |
77 | fRecTracksAddressSet(kFALSE), | |
78 | fRunloader(0x0), | |
79 | fMuonloader(0x0), | |
80 | fData(0x0, "MUON", "MUON"), | |
81 | fFilename(), | |
82 | fFoldername(), | |
83 | fEventnumber(-1), | |
84 | fTrack(-1), | |
85 | fSCathode(-1), | |
86 | fCathode(-1) | |
48b32e42 | 87 | { |
b21698f0 | 88 | /// Set all internal pointers to 0x0 and indices to -1. |
48b32e42 | 89 | |
90 | Reset(); | |
925e6570 | 91 | } |
48b32e42 | 92 | |
48b32e42 | 93 | AliMUONDataInterface::~AliMUONDataInterface() |
94 | { | |
5398f946 | 95 | /// Delete the runloader if we created it. |
96 | /// If the runloader is not to be deleted then call Reset just before | |
97 | /// the destructor is called. | |
48b32e42 | 98 | |
6d149c9e | 99 | if (fRunloader != NULL && fCreatedRunLoader) |
48b32e42 | 100 | delete fRunloader; |
925e6570 | 101 | } |
48b32e42 | 102 | |
48b32e42 | 103 | void AliMUONDataInterface::Reset() |
104 | { | |
5398f946 | 105 | /// Sets all internal pointers to NULL and indices to -1. |
106 | /// Note: No resources are released! | |
107 | /// Specificaly AliRunLoader is not deleted. | |
48b32e42 | 108 | |
6d149c9e | 109 | fCreatedRunLoader = kFALSE; |
48b32e42 | 110 | fRunloader = NULL; |
111 | fMuonloader = NULL; | |
112 | fEventnumber = -1; | |
113 | fTrack = -1; | |
114 | fSCathode = -1; | |
115 | fCathode = -1; | |
116 | fHitAddressSet = kFALSE; | |
117 | fSDigitAddressSet = kFALSE; | |
118 | fDigitAddressSet = kFALSE; | |
119 | fClusterAddressSet = kFALSE; | |
120 | fTriggerAddressSet = kFALSE; | |
554b38a6 | 121 | fRecTracksAddressSet = kFALSE; |
925e6570 | 122 | } |
48b32e42 | 123 | |
124 | ||
6d149c9e | 125 | Bool_t AliMUONDataInterface::UseCurrentRunLoader() |
126 | { | |
5398f946 | 127 | /// Tries to fetch the current runloader with AliRunLoader::GetRunLoader. If nothing is |
128 | /// currently loaded then kFALSE is returned and AliMUONDataInterface is reset. | |
6d149c9e | 129 | |
130 | Reset(); | |
131 | fRunloader = AliRunLoader::GetRunLoader(); | |
132 | if (fRunloader == NULL) return kFALSE; | |
133 | // Fetch the current file name, folder name and event number. | |
134 | fFilename = fRunloader->GetFileName(); | |
135 | fFoldername = fRunloader->GetEventFolder()->GetName(); | |
136 | fEventnumber = fRunloader->GetEventNumber(); | |
137 | ||
138 | if ( ! FetchMuonLoader(fFilename.Data(), fFoldername.Data()) ) | |
139 | { | |
140 | Reset(); | |
141 | return kFALSE; | |
142 | } | |
143 | ||
144 | return kTRUE; | |
145 | } | |
146 | ||
147 | ||
148 | Bool_t AliMUONDataInterface::FetchMuonLoader(TString filename, TString foldername) | |
149 | { | |
5398f946 | 150 | /// Fetches the muon loader for the given filename/foldername |
85fec35d | 151 | |
6d149c9e | 152 | fMuonloader = fRunloader->GetLoader("MUONLoader"); |
153 | if (fMuonloader == NULL) | |
154 | { | |
155 | AliError(Form("Could not find the MUON loader in file: %s and folder: %s", | |
156 | (const char*)filename, (const char*)foldername)); | |
157 | return kFALSE; | |
158 | } | |
159 | ||
160 | // Need to connect the muon loader to the AliMUONData object, | |
161 | // else class to fData will return NULL. | |
162 | fData.SetLoader(fMuonloader); | |
163 | return kTRUE; | |
164 | } | |
165 | ||
166 | ||
48b32e42 | 167 | Bool_t AliMUONDataInterface::LoadLoaders(TString filename, TString foldername) |
168 | { | |
5398f946 | 169 | /// Load the run and muon loaders from the specified file and folder. |
170 | /// kTRUE is returned on success and kFALSE on failure. | |
48b32e42 | 171 | |
172 | fRunloader = AliRunLoader::Open(filename, foldername, "READ"); | |
173 | if (fRunloader == NULL) | |
174 | { | |
8c343c7c | 175 | AliError(Form("Could not find or load the run loader for the file: %s and folder: %s", |
176 | (const char*)filename, (const char*)foldername)); | |
48b32e42 | 177 | return kFALSE; |
925e6570 | 178 | } |
6d149c9e | 179 | fCreatedRunLoader = kTRUE; |
180 | if ( ! FetchMuonLoader(filename, foldername) ) | |
48b32e42 | 181 | { |
48b32e42 | 182 | fRunloader = NULL; |
183 | return kFALSE; | |
925e6570 | 184 | } |
48b32e42 | 185 | |
48b32e42 | 186 | fFilename = filename; |
187 | fFoldername = foldername; | |
188 | fEventnumber = -1; // Reset the event number to force the event to be loaded. | |
189 | return kTRUE; | |
925e6570 | 190 | } |
48b32e42 | 191 | |
192 | ||
193 | Bool_t AliMUONDataInterface::FetchLoaders(TString filename, TString foldername) | |
194 | { | |
5398f946 | 195 | /// Fetch the run loader and muon loader objects from memory if they already exist, |
196 | /// or from memory if they do not. | |
197 | /// If the currently loaded run loader (if any) is not refering to the file and folder | |
198 | /// we are interested in then it is deleted and reopened with the required file and | |
199 | /// folder names. | |
48b32e42 | 200 | |
201 | if (fRunloader == NULL) | |
202 | { | |
203 | fRunloader = AliRunLoader::GetRunLoader(); | |
204 | if (fRunloader == NULL) | |
205 | return LoadLoaders(filename, foldername); | |
6d149c9e | 206 | else |
207 | { | |
208 | if (fMuonloader == NULL) | |
209 | { | |
210 | if ( ! FetchMuonLoader(filename, foldername) ) | |
211 | { | |
212 | fRunloader = NULL; | |
213 | return kFALSE; | |
214 | } | |
215 | } | |
216 | } | |
48b32e42 | 217 | |
218 | // Fetch the current file and folder names. | |
219 | fFilename = fRunloader->GetFileName(); | |
220 | fFoldername = fRunloader->GetEventFolder()->GetName(); | |
925e6570 | 221 | } |
48b32e42 | 222 | |
223 | // If filename or foldername are not the same as the ones currently selected then | |
224 | // reopen the file. | |
225 | if ( filename.CompareTo(fFilename) != 0 || foldername.CompareTo(fFoldername) != 0 ) | |
226 | { | |
227 | delete fRunloader; | |
228 | return LoadLoaders(filename, foldername); | |
925e6570 | 229 | } |
48b32e42 | 230 | return kTRUE; |
925e6570 | 231 | } |
48b32e42 | 232 | |
233 | ||
234 | Bool_t AliMUONDataInterface::FetchEvent(Int_t event) | |
235 | { | |
5398f946 | 236 | /// Fetch the specified event from the runloader and reset all the track, cathode |
237 | /// and address flags to force them to be reloaded. | |
238 | /// If a negative event number is specified then the current runloader event | |
239 | /// number is used. | |
48b32e42 | 240 | |
241 | if (fEventnumber < 0) | |
242 | { | |
243 | fEventnumber = fRunloader->GetEventNumber(); | |
244 | fTrack = -1; | |
245 | fSCathode = -1; | |
246 | fCathode = -1; | |
247 | fHitAddressSet = kFALSE; | |
248 | fSDigitAddressSet = kFALSE; | |
249 | fDigitAddressSet = kFALSE; | |
250 | fClusterAddressSet = kFALSE; | |
251 | fTriggerAddressSet = kFALSE; | |
554b38a6 | 252 | fRecTracksAddressSet = kFALSE; |
925e6570 | 253 | } |
48b32e42 | 254 | if ( event != fEventnumber ) |
255 | { | |
256 | if ( fRunloader->GetEvent(event) < 0 ) return kFALSE; | |
257 | fEventnumber = event; | |
258 | fTrack = -1; | |
259 | fSCathode = -1; | |
260 | fCathode = -1; | |
261 | fHitAddressSet = kFALSE; | |
262 | fSDigitAddressSet = kFALSE; | |
263 | fDigitAddressSet = kFALSE; | |
264 | fClusterAddressSet = kFALSE; | |
265 | fTriggerAddressSet = kFALSE; | |
554b38a6 | 266 | fRecTracksAddressSet = kFALSE; |
925e6570 | 267 | } |
48b32e42 | 268 | return kTRUE; |
925e6570 | 269 | } |
48b32e42 | 270 | |
271 | ||
272 | Bool_t AliMUONDataInterface::FetchTreeK() | |
273 | { | |
5398f946 | 274 | /// Fetch the Kine tree from the current run loader. |
48b32e42 | 275 | |
276 | if (fRunloader->TreeK() == NULL) | |
277 | { | |
278 | fRunloader->LoadKinematics("READ"); | |
279 | if (fRunloader->TreeK() == NULL) | |
280 | { | |
8c343c7c | 281 | AliError("Could not load TreeK."); |
48b32e42 | 282 | return kFALSE; |
925e6570 | 283 | } |
284 | } | |
48b32e42 | 285 | return kTRUE; |
925e6570 | 286 | } |
48b32e42 | 287 | |
288 | ||
289 | Bool_t AliMUONDataInterface::FetchTreeH() | |
290 | { | |
5398f946 | 291 | /// Fetch the Hits tree from the current muon loader. |
292 | /// Set all the required addresses etc... | |
48b32e42 | 293 | |
294 | if (fMuonloader->TreeH() == NULL) | |
295 | { | |
296 | fMuonloader->LoadHits("READ"); | |
297 | if (fMuonloader->TreeH() == NULL) | |
298 | { | |
8c343c7c | 299 | AliError("Could not load TreeH."); |
48b32e42 | 300 | return kFALSE; |
925e6570 | 301 | } |
48b32e42 | 302 | fData.SetTreeAddress("H"); |
303 | fHitAddressSet = kTRUE; | |
304 | } | |
305 | else if ( ! fHitAddressSet ) | |
306 | { | |
307 | fData.SetTreeAddress("H"); | |
308 | fHitAddressSet = kTRUE; | |
925e6570 | 309 | } |
48b32e42 | 310 | return kTRUE; |
925e6570 | 311 | } |
48b32e42 | 312 | |
313 | ||
314 | Bool_t AliMUONDataInterface::FetchTreeS() | |
315 | { | |
5398f946 | 316 | /// Fetch the S-Digits tree from the current muon loader. |
317 | /// Set all the required addresses etc... | |
48b32e42 | 318 | |
319 | if (fMuonloader->TreeS() == NULL) | |
320 | { | |
321 | fMuonloader->LoadSDigits("READ"); | |
322 | if (fMuonloader->TreeS() == NULL) | |
323 | { | |
8c343c7c | 324 | AliError("Could not load TreeS."); |
48b32e42 | 325 | return kFALSE; |
925e6570 | 326 | } |
48b32e42 | 327 | fData.SetTreeAddress("S"); |
328 | fSDigitAddressSet = kTRUE; | |
329 | } | |
330 | else if ( ! fSDigitAddressSet ) | |
331 | { | |
332 | fData.SetTreeAddress("S"); | |
333 | fSDigitAddressSet = kTRUE; | |
925e6570 | 334 | } |
48b32e42 | 335 | return kTRUE; |
925e6570 | 336 | } |
48b32e42 | 337 | |
338 | ||
339 | Bool_t AliMUONDataInterface::FetchTreeD() | |
340 | { | |
5398f946 | 341 | /// Fetch the digits tree from the current muon loader. |
342 | /// Set all the required addresses etc... | |
48b32e42 | 343 | |
344 | if (fMuonloader->TreeD() == NULL) | |
345 | { | |
346 | fMuonloader->LoadDigits("READ"); | |
347 | if (fMuonloader->TreeD() == NULL) | |
348 | { | |
8c343c7c | 349 | AliError("Could not load TreeD."); |
48b32e42 | 350 | return kFALSE; |
925e6570 | 351 | } |
48b32e42 | 352 | fData.SetTreeAddress("D"); |
353 | fDigitAddressSet = kTRUE; | |
354 | } | |
355 | else if ( ! fDigitAddressSet ) | |
356 | { | |
357 | fData.SetTreeAddress("D"); | |
358 | fDigitAddressSet = kTRUE; | |
925e6570 | 359 | } |
48b32e42 | 360 | return kTRUE; |
925e6570 | 361 | } |
48b32e42 | 362 | |
363 | ||
364 | Bool_t AliMUONDataInterface::FetchTreeR() | |
365 | { | |
5398f946 | 366 | /// Fetch the reconstructed objects tree from the current muon loader. |
367 | /// Note: The addresses must still be set. | |
554b38a6 | 368 | |
369 | if (fMuonloader->TreeR() == NULL) | |
370 | { | |
371 | fMuonloader->LoadRecPoints("READ"); | |
372 | if (fMuonloader->TreeR() == NULL) | |
48b32e42 | 373 | { |
554b38a6 | 374 | AliError("Could not load TreeR."); |
375 | return kFALSE; | |
925e6570 | 376 | } |
554b38a6 | 377 | |
378 | // Need to reset these flags so that the cluster and trigger address | |
379 | // gets reset after this method. | |
380 | fClusterAddressSet = kFALSE; | |
381 | fTriggerAddressSet = kFALSE; | |
382 | } | |
383 | return kTRUE; | |
925e6570 | 384 | } |
48b32e42 | 385 | |
554b38a6 | 386 | Bool_t AliMUONDataInterface::FetchTreeT() |
387 | { | |
5398f946 | 388 | /// fetch the reconstructed tracks tree from the current muon loader |
389 | /// note : the addresses must still be set. | |
554b38a6 | 390 | if (fMuonloader->TreeT() == NULL) |
391 | { | |
392 | fMuonloader->LoadTracks("READ"); | |
393 | if (fMuonloader->TreeT() == NULL) | |
394 | { | |
395 | AliError("Could not load TreeT."); | |
396 | return kFALSE; | |
397 | } | |
398 | ||
399 | // Need to reset these flags so that the rec tracks address | |
400 | // gets reset after this method. | |
401 | fRecTracksAddressSet = kFALSE; | |
402 | } | |
403 | return kTRUE; | |
404 | } | |
405 | ||
48b32e42 | 406 | Int_t AliMUONDataInterface::NumberOfEvents(TString filename, TString foldername) |
407 | { | |
5398f946 | 408 | /// Returns the number of events in the specified file/folder, and -1 on error. |
48b32e42 | 409 | |
410 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
411 | return fRunloader->GetNumberOfEvents(); | |
925e6570 | 412 | } |
48b32e42 | 413 | |
414 | ||
415 | Int_t AliMUONDataInterface::NumberOfParticles(TString filename, TString foldername, Int_t event) | |
416 | { | |
5398f946 | 417 | /// Returns the number of events in the specified file/folder, and -1 on error. |
48b32e42 | 418 | |
419 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
420 | if ( ! FetchEvent(event) ) return -1; | |
421 | if ( ! FetchTreeK() ) return -1; | |
422 | return (Int_t) fRunloader->TreeK()->GetEntriesFast(); | |
925e6570 | 423 | } |
48b32e42 | 424 | |
425 | ||
426 | TParticle* AliMUONDataInterface::Particle( | |
427 | TString filename, TString foldername, Int_t event, Int_t particle | |
428 | ) | |
429 | { | |
5398f946 | 430 | /// Returns the specified particle in the given file, folder and event. |
431 | /// NULL is returned on error. | |
48b32e42 | 432 | |
433 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
434 | if ( ! FetchEvent(event) ) return NULL; | |
435 | if ( ! FetchTreeK() ) return NULL; | |
436 | ||
437 | TTree* treeK = fRunloader->TreeK(); | |
438 | TParticle* p = NULL; | |
439 | treeK->GetBranch("Particles")->SetAddress(&p); | |
440 | treeK->GetEvent(particle); | |
441 | return p; | |
925e6570 | 442 | } |
48b32e42 | 443 | |
444 | ||
445 | Int_t AliMUONDataInterface::NumberOfTracks(TString filename, TString foldername, Int_t event) | |
446 | { | |
5398f946 | 447 | /// Returns the number of tracks in the specified file/folder and event. |
448 | /// -1 is returned on error. | |
48b32e42 | 449 | |
450 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
451 | if ( ! FetchEvent(event) ) return -1; | |
452 | if ( ! FetchTreeH() ) return -1; | |
453 | return fData.GetNtracks(); | |
925e6570 | 454 | } |
48b32e42 | 455 | |
456 | ||
457 | Int_t AliMUONDataInterface::NumberOfHits( | |
458 | TString filename, TString foldername, Int_t event, Int_t track | |
459 | ) | |
460 | { | |
5398f946 | 461 | /// Returns the number of hits in the specified file/folder, event and track. |
462 | /// -1 is returned on error. | |
48b32e42 | 463 | |
464 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
465 | if ( ! FetchEvent(event) ) return -1; | |
466 | if ( ! FetchTreeH() ) return -1; | |
467 | ||
468 | if (fTrack < 0 || fTrack != track) | |
469 | { | |
470 | fData.ResetHits(); | |
471 | fData.GetTrack(track); | |
472 | fTrack = track; | |
925e6570 | 473 | } |
48b32e42 | 474 | return fData.Hits()->GetEntriesFast(); |
925e6570 | 475 | } |
48b32e42 | 476 | |
477 | ||
478 | AliMUONHit* AliMUONDataInterface::Hit( | |
479 | TString filename, TString foldername, Int_t event, | |
480 | Int_t track, Int_t hit | |
481 | ) | |
482 | { | |
5398f946 | 483 | /// Returns the specified hit in the given file, folder, event and track. |
484 | /// NULL is returned on error. | |
48b32e42 | 485 | |
486 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
487 | if ( ! FetchEvent(event) ) return NULL; | |
488 | if ( ! FetchTreeH() ) return NULL; | |
489 | ||
490 | if (fTrack < 0 || fTrack != track) | |
491 | { | |
492 | fData.ResetHits(); | |
493 | fData.GetTrack(track); | |
494 | fTrack = track; | |
925e6570 | 495 | } |
48b32e42 | 496 | return static_cast<AliMUONHit*>( fData.Hits()->At(hit) ); |
925e6570 | 497 | } |
48b32e42 | 498 | |
499 | ||
500 | Int_t AliMUONDataInterface::NumberOfSDigits( | |
501 | TString filename, TString foldername, Int_t event, | |
502 | Int_t chamber, Int_t cathode | |
503 | ) | |
504 | { | |
5398f946 | 505 | /// Returns the number of s-digits in the given file, folder, event, |
506 | /// chamber and cathode. -1 is returned on error. | |
48b32e42 | 507 | |
508 | Assert( 0 <= chamber && chamber <= 13 ); | |
509 | Assert( 0 <= cathode && cathode <= 1 ); | |
510 | ||
511 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
512 | if ( ! FetchEvent(event) ) return -1; | |
513 | if ( ! FetchTreeS() ) return -1; | |
514 | ||
515 | if ( fSCathode != cathode ) | |
516 | { | |
517 | fData.ResetSDigits(); | |
935b9895 | 518 | fData.GetSDigits(); |
48b32e42 | 519 | fSCathode = cathode; |
925e6570 | 520 | } |
48b32e42 | 521 | return fData.SDigits(chamber)->GetEntriesFast(); |
925e6570 | 522 | } |
48b32e42 | 523 | |
524 | ||
525 | AliMUONDigit* AliMUONDataInterface::SDigit( | |
526 | TString filename, TString foldername, Int_t event, | |
527 | Int_t chamber, Int_t cathode, Int_t sdigit | |
528 | ) | |
529 | { | |
5398f946 | 530 | /// Returns the specified s-digit in the given file, folder, event, |
531 | /// chamber and cathode. NULL is returned on error. | |
48b32e42 | 532 | |
533 | Assert( 0 <= chamber && chamber <= 13 ); | |
534 | Assert( 0 <= cathode && cathode <= 1 ); | |
535 | ||
536 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
537 | if ( ! FetchEvent(event) ) return NULL; | |
538 | if ( ! FetchTreeS() ) return NULL; | |
539 | ||
540 | if ( fSCathode != cathode ) | |
541 | { | |
542 | fData.ResetSDigits(); | |
935b9895 | 543 | fData.GetSDigits(); |
48b32e42 | 544 | fSCathode = cathode; |
925e6570 | 545 | } |
48b32e42 | 546 | return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) ); |
925e6570 | 547 | } |
48b32e42 | 548 | |
549 | ||
550 | Int_t AliMUONDataInterface::NumberOfDigits( | |
551 | TString filename, TString foldername, Int_t event, | |
552 | Int_t chamber, Int_t cathode | |
553 | ) | |
554 | { | |
5398f946 | 555 | /// Returns the number of digits in the given file, folder, event, |
556 | /// chamber and cathode. -1 is returned on error. | |
48b32e42 | 557 | Assert( 0 <= chamber && chamber <= 13 ); |
558 | Assert( 0 <= cathode && cathode <= 1 ); | |
559 | ||
560 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
561 | if ( ! FetchEvent(event) ) return -1; | |
562 | if ( ! FetchTreeD() ) return -1; | |
563 | ||
564 | if ( fCathode != cathode ) | |
565 | { | |
566 | fData.ResetDigits(); | |
935b9895 | 567 | fData.GetDigits(); |
48b32e42 | 568 | fCathode = cathode; |
925e6570 | 569 | } |
48b32e42 | 570 | return fData.Digits(chamber)->GetEntriesFast(); |
925e6570 | 571 | } |
48b32e42 | 572 | |
573 | ||
574 | AliMUONDigit* AliMUONDataInterface::Digit( | |
575 | TString filename, TString foldername, Int_t event, | |
576 | Int_t chamber, Int_t cathode, Int_t digit | |
577 | ) | |
578 | { | |
5398f946 | 579 | /// Returns the specified digit in the given file, folder, event, |
580 | /// chamber and cathode. NULL is returned on error. | |
48b32e42 | 581 | |
582 | Assert( 0 <= chamber && chamber <= 13 ); | |
583 | Assert( 0 <= cathode && cathode <= 1 ); | |
584 | ||
585 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
586 | if ( ! FetchEvent(event) ) return NULL; | |
587 | if ( ! FetchTreeD() ) return NULL; | |
588 | ||
589 | if ( fCathode != cathode ) | |
590 | { | |
591 | fData.ResetDigits(); | |
935b9895 | 592 | fData.GetDigits(); |
48b32e42 | 593 | fCathode = cathode; |
925e6570 | 594 | } |
48b32e42 | 595 | return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) ); |
925e6570 | 596 | } |
48b32e42 | 597 | |
598 | ||
599 | Int_t AliMUONDataInterface::NumberOfRawClusters( | |
600 | TString filename, TString foldername, Int_t event, Int_t chamber | |
601 | ) | |
602 | { | |
5398f946 | 603 | /// Returns the number of raw clusters in the specified file, folder, event and chamber. |
604 | /// -1 is returned or error. | |
48b32e42 | 605 | |
606 | Assert( 0 <= chamber && chamber <= 13 ); | |
607 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
608 | if ( ! FetchEvent(event) ) return -1; | |
609 | if ( ! FetchTreeR() ) return -1; | |
610 | if ( ! fClusterAddressSet ) | |
611 | { | |
612 | // If the raw cluster address in TreeR is not set yet then set it now. | |
613 | fData.SetTreeAddress("RC"); | |
614 | fData.ResetRawClusters(); | |
615 | fData.GetRawClusters(); | |
616 | fClusterAddressSet = kTRUE; | |
925e6570 | 617 | } |
48b32e42 | 618 | return fData.RawClusters(chamber)->GetEntriesFast(); |
925e6570 | 619 | } |
48b32e42 | 620 | |
621 | ||
622 | AliMUONRawCluster* AliMUONDataInterface::RawCluster( | |
623 | TString filename, TString foldername, Int_t event, | |
624 | Int_t chamber, Int_t cluster | |
625 | ) | |
626 | { | |
5398f946 | 627 | /// Fetch the specified raw cluster from the given file, folder, event and chamber number. |
628 | /// NULL is returned on error. | |
48b32e42 | 629 | |
630 | Assert( 0 <= chamber && chamber <= 13 ); | |
631 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
632 | if ( ! FetchEvent(event) ) return NULL; | |
633 | if ( ! FetchTreeR() ) return NULL; | |
634 | if ( ! fClusterAddressSet ) | |
635 | { | |
636 | // If the raw cluster address in TreeR is not set yet then set it now. | |
637 | fData.SetTreeAddress("RC"); | |
638 | fData.ResetRawClusters(); | |
639 | fData.GetRawClusters(); | |
640 | fClusterAddressSet = kTRUE; | |
925e6570 | 641 | } |
48b32e42 | 642 | return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) ); |
925e6570 | 643 | } |
48b32e42 | 644 | |
645 | ||
646 | Int_t AliMUONDataInterface::NumberOfLocalTriggers(TString filename, TString foldername, Int_t event) | |
647 | { | |
5398f946 | 648 | /// Return the number of local trigger objects in the specified file, folder and |
649 | /// event number. -1 is returned on error. | |
48b32e42 | 650 | |
651 | if ( ! FetchLoaders(filename, foldername) ) return -1; | |
652 | if ( ! FetchEvent(event) ) return -1; | |
6d149c9e | 653 | if ( ! FetchTreeD() ) return -1; |
48b32e42 | 654 | if ( ! fTriggerAddressSet ) |
655 | { | |
935b9895 | 656 | // If the local trigger address in TreeR is not set yet then set it now. |
48b32e42 | 657 | fData.SetTreeAddress("GLT"); |
658 | fData.ResetTrigger(); | |
6d149c9e | 659 | fData.GetTriggerD(); |
48b32e42 | 660 | fTriggerAddressSet = kTRUE; |
925e6570 | 661 | } |
48b32e42 | 662 | return fData.LocalTrigger()->GetEntriesFast(); |
925e6570 | 663 | } |
48b32e42 | 664 | |
665 | ||
666 | AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger( | |
667 | TString filename, TString foldername, Int_t event, Int_t trigger | |
668 | ) | |
669 | { | |
5398f946 | 670 | /// Fetch the specified local trigger object from the given file, folder and event number. |
671 | /// NULL is returned on error. | |
48b32e42 | 672 | |
673 | if ( ! FetchLoaders(filename, foldername) ) return NULL; | |
674 | if ( ! FetchEvent(event) ) return NULL; | |
6d149c9e | 675 | if ( ! FetchTreeD() ) return NULL; |
48b32e42 | 676 | if ( ! fTriggerAddressSet ) |
677 | { | |
935b9895 | 678 | // If the local trigger address in TreeR is not set yet then set it now. |
48b32e42 | 679 | fData.SetTreeAddress("GLT"); |
680 | fData.ResetTrigger(); | |
6d149c9e | 681 | fData.GetTriggerD(); |
48b32e42 | 682 | fTriggerAddressSet = kTRUE; |
925e6570 | 683 | } |
48b32e42 | 684 | return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) ); |
925e6570 | 685 | } |
48b32e42 | 686 | |
48b32e42 | 687 | Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername) |
688 | { | |
5398f946 | 689 | /// Set the current file and folder from which to fetch data. |
690 | /// kTRUE is returned if the run and muon loaders were found, else kFALSE. | |
48b32e42 | 691 | |
692 | return FetchLoaders(filename, foldername); | |
925e6570 | 693 | } |
48b32e42 | 694 | |
695 | ||
696 | Bool_t AliMUONDataInterface::GetEvent(Int_t event) | |
697 | { | |
5398f946 | 698 | /// Select the current event from which to fetch data. |
699 | /// kTRUE is returned if the event was found, else kFALSE is returned. | |
48b32e42 | 700 | |
382c2b3f | 701 | if (fRunloader == NULL) |
702 | { | |
703 | AliError("File not set."); | |
704 | return kFALSE; | |
705 | } | |
706 | else | |
707 | return FetchEvent(event); | |
925e6570 | 708 | } |
48b32e42 | 709 | |
710 | ||
711 | Int_t AliMUONDataInterface::NumberOfEvents() | |
712 | { | |
5398f946 | 713 | /// Get the number of events in the currently selected file. |
714 | /// -1 is returned on error. | |
48b32e42 | 715 | |
716 | if (fRunloader == NULL) | |
717 | { | |
8c343c7c | 718 | AliError("File not set."); |
48b32e42 | 719 | return -1; |
925e6570 | 720 | } |
48b32e42 | 721 | return fRunloader->GetNumberOfEvents(); |
925e6570 | 722 | } |
48b32e42 | 723 | |
724 | ||
725 | Int_t AliMUONDataInterface::NumberOfParticles() | |
726 | { | |
5398f946 | 727 | /// Get the number of particles in the current event. |
728 | /// -1 is returned on error. | |
48b32e42 | 729 | |
730 | if (fRunloader == NULL) | |
731 | { | |
8c343c7c | 732 | AliError("File not set."); |
48b32e42 | 733 | return -1; |
925e6570 | 734 | } |
48b32e42 | 735 | if ( ! FetchTreeK() ) return -1; |
736 | return (Int_t) fRunloader->TreeK()->GetEntriesFast(); | |
925e6570 | 737 | } |
48b32e42 | 738 | |
739 | ||
740 | TParticle* AliMUONDataInterface::Particle(Int_t particle) | |
741 | { | |
5398f946 | 742 | /// Fetch the specified particle from the current event. |
743 | /// NULL is returned on error. | |
48b32e42 | 744 | |
745 | if (fRunloader == NULL) | |
746 | { | |
8c343c7c | 747 | AliError("File not set."); |
48b32e42 | 748 | return NULL; |
925e6570 | 749 | } |
48b32e42 | 750 | if (fEventnumber < 0) |
751 | { | |
8c343c7c | 752 | AliError("Event not chosen."); |
48b32e42 | 753 | return NULL; |
925e6570 | 754 | } |
48b32e42 | 755 | if ( ! FetchTreeK() ) return NULL; |
756 | TTree* treeK = fRunloader->TreeK(); | |
757 | TParticle* p = NULL; | |
758 | treeK->GetBranch("Particles")->SetAddress(&p); | |
759 | treeK->GetEvent(particle); | |
760 | return p; | |
925e6570 | 761 | } |
48b32e42 | 762 | |
763 | ||
764 | Int_t AliMUONDataInterface::NumberOfTracks() | |
765 | { | |
5398f946 | 766 | /// Get the number of tracks in the current event. |
767 | /// -1 is returned on error. | |
48b32e42 | 768 | |
769 | if (fRunloader == NULL) | |
770 | { | |
8c343c7c | 771 | AliError("File not set."); |
48b32e42 | 772 | return -1; |
925e6570 | 773 | } |
48b32e42 | 774 | if (fEventnumber < 0) |
775 | { | |
8c343c7c | 776 | AliError( "Event not chosen."); |
48b32e42 | 777 | return -1; |
925e6570 | 778 | } |
48b32e42 | 779 | if ( ! FetchTreeH() ) return -1; |
780 | return fData.GetNtracks(); | |
925e6570 | 781 | } |
48b32e42 | 782 | |
783 | ||
784 | Int_t AliMUONDataInterface::NumberOfHits(Int_t track) | |
785 | { | |
5398f946 | 786 | /// Get the number of hits for the given track in the current event. |
787 | /// -1 is returned on error. | |
48b32e42 | 788 | |
789 | if (fRunloader == NULL) | |
790 | { | |
8c343c7c | 791 | AliError("File not set."); |
48b32e42 | 792 | return -1; |
925e6570 | 793 | } |
48b32e42 | 794 | if (fEventnumber < 0) |
795 | { | |
8c343c7c | 796 | AliError("Event not chosen."); |
48b32e42 | 797 | return -1; |
925e6570 | 798 | } |
48b32e42 | 799 | if ( ! FetchTreeH() ) return -1; |
800 | if (fTrack < 0 || fTrack != track) | |
801 | { | |
802 | fData.ResetHits(); | |
803 | fData.GetTrack(track); | |
804 | fTrack = track; | |
925e6570 | 805 | } |
48b32e42 | 806 | return fData.Hits()->GetEntriesFast(); |
925e6570 | 807 | } |
48b32e42 | 808 | |
809 | ||
810 | AliMUONHit* AliMUONDataInterface::Hit(Int_t track, Int_t hit) | |
811 | { | |
5398f946 | 812 | /// Fetch the specified hit from the current event. |
813 | /// NULL is returned on error. | |
48b32e42 | 814 | |
815 | if (fRunloader == NULL) | |
816 | { | |
8c343c7c | 817 | AliError("File not set."); |
48b32e42 | 818 | return NULL; |
925e6570 | 819 | } |
48b32e42 | 820 | if (fEventnumber < 0) |
821 | { | |
8c343c7c | 822 | AliError("Event not chosen."); |
48b32e42 | 823 | return NULL; |
925e6570 | 824 | } |
48b32e42 | 825 | if ( ! FetchTreeH() ) return NULL; |
826 | if (fTrack < 0 || fTrack != track) | |
827 | { | |
828 | fData.ResetHits(); | |
829 | fData.GetTrack(track); | |
830 | fTrack = track; | |
925e6570 | 831 | } |
48b32e42 | 832 | return static_cast<AliMUONHit*>( fData.Hits()->At(hit) ); |
925e6570 | 833 | } |
48b32e42 | 834 | |
835 | ||
836 | Int_t AliMUONDataInterface::NumberOfSDigits(Int_t chamber, Int_t cathode) | |
837 | { | |
5398f946 | 838 | /// Get the number of s-digits on the chamber, cathode in the current event. |
839 | /// -1 is returned on error. | |
48b32e42 | 840 | |
841 | Assert( 0 <= chamber && chamber <= 13 ); | |
842 | Assert( 0 <= cathode && cathode <= 1 ); | |
843 | ||
844 | if (fRunloader == NULL) | |
845 | { | |
8c343c7c | 846 | AliError("File not set."); |
48b32e42 | 847 | return -1; |
925e6570 | 848 | } |
48b32e42 | 849 | if (fEventnumber < 0) |
850 | { | |
8c343c7c | 851 | AliError("Event not chosen."); |
48b32e42 | 852 | return -1; |
925e6570 | 853 | } |
48b32e42 | 854 | |
855 | if ( ! FetchTreeS() ) return -1; | |
856 | if ( fSCathode != cathode ) | |
857 | { | |
858 | fData.ResetSDigits(); | |
935b9895 | 859 | fData.GetSDigits(); |
48b32e42 | 860 | fSCathode = cathode; |
925e6570 | 861 | } |
48b32e42 | 862 | return fData.SDigits(chamber)->GetEntriesFast(); |
925e6570 | 863 | } |
48b32e42 | 864 | |
865 | ||
866 | AliMUONDigit* AliMUONDataInterface::SDigit(Int_t chamber, Int_t cathode, Int_t sdigit) | |
867 | { | |
5398f946 | 868 | /// Fetch the specified s-digits on the chamber, cathode from the current event. |
869 | /// NULL is returned on error. | |
48b32e42 | 870 | |
871 | Assert( 0 <= chamber && chamber <= 13 ); | |
872 | Assert( 0 <= cathode && cathode <= 1 ); | |
873 | ||
874 | if (fRunloader == NULL) | |
875 | { | |
8c343c7c | 876 | AliError("File not set."); |
48b32e42 | 877 | return NULL; |
925e6570 | 878 | } |
48b32e42 | 879 | if (fEventnumber < 0) |
880 | { | |
8c343c7c | 881 | AliError("Event not chosen."); |
48b32e42 | 882 | return NULL; |
925e6570 | 883 | } |
48b32e42 | 884 | |
885 | if ( ! FetchTreeS() ) return NULL; | |
886 | if ( fSCathode != cathode ) | |
887 | { | |
888 | fData.ResetSDigits(); | |
935b9895 | 889 | fData.GetSDigits(); |
48b32e42 | 890 | fSCathode = cathode; |
925e6570 | 891 | } |
48b32e42 | 892 | return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) ); |
925e6570 | 893 | } |
48b32e42 | 894 | |
895 | ||
896 | Int_t AliMUONDataInterface::NumberOfDigits(Int_t chamber, Int_t cathode) | |
897 | { | |
5398f946 | 898 | /// Get the number of digits on the chamber, cathode in the current event. |
899 | /// -1 is returned on error. | |
48b32e42 | 900 | |
901 | Assert( 0 <= chamber && chamber <= 13 ); | |
902 | Assert( 0 <= cathode && cathode <= 1 ); | |
903 | ||
904 | if (fRunloader == NULL) | |
905 | { | |
8c343c7c | 906 | AliError("File not set."); |
48b32e42 | 907 | return -1; |
925e6570 | 908 | } |
48b32e42 | 909 | if (fEventnumber < 0) |
910 | { | |
8c343c7c | 911 | AliError("Event not chosen."); |
48b32e42 | 912 | return -1; |
925e6570 | 913 | } |
48b32e42 | 914 | |
915 | if ( ! FetchTreeD() ) return -1; | |
916 | if ( fCathode != cathode ) | |
917 | { | |
918 | fData.ResetDigits(); | |
935b9895 | 919 | fData.GetDigits(); |
48b32e42 | 920 | fCathode = cathode; |
925e6570 | 921 | } |
48b32e42 | 922 | return fData.Digits(chamber)->GetEntriesFast(); |
925e6570 | 923 | } |
48b32e42 | 924 | |
925 | ||
926 | AliMUONDigit* AliMUONDataInterface::Digit(Int_t chamber, Int_t cathode, Int_t digit) | |
927 | { | |
5398f946 | 928 | /// Fetch the specified digits on the chamber, cathode from the current event. |
929 | /// NULL is returned on error. | |
48b32e42 | 930 | |
931 | Assert( 0 <= chamber && chamber <= 13 ); | |
932 | Assert( 0 <= cathode && cathode <= 1 ); | |
933 | ||
934 | if (fRunloader == NULL) | |
935 | { | |
8c343c7c | 936 | AliError("File not set."); |
48b32e42 | 937 | return NULL; |
925e6570 | 938 | } |
48b32e42 | 939 | if (fEventnumber < 0) |
940 | { | |
8c343c7c | 941 | AliError("Event not chosen."); |
48b32e42 | 942 | return NULL; |
925e6570 | 943 | } |
48b32e42 | 944 | |
945 | if ( ! FetchTreeD() ) return NULL; | |
946 | if ( fCathode != cathode ) | |
947 | { | |
948 | fData.ResetDigits(); | |
935b9895 | 949 | fData.GetDigits(); |
48b32e42 | 950 | fCathode = cathode; |
925e6570 | 951 | } |
48b32e42 | 952 | return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) ); |
925e6570 | 953 | } |
48b32e42 | 954 | |
955 | ||
956 | Int_t AliMUONDataInterface::NumberOfRawClusters(Int_t chamber) | |
957 | { | |
5398f946 | 958 | /// Get the number of raw clusters on the given chamber in the current event. |
959 | /// -1 is returned on error. | |
48b32e42 | 960 | |
961 | Assert( 0 <= chamber && chamber <= 13 ); | |
962 | ||
963 | if (fRunloader == NULL) | |
964 | { | |
8c343c7c | 965 | AliError("File not set."); |
48b32e42 | 966 | return -1; |
925e6570 | 967 | } |
48b32e42 | 968 | if (fEventnumber < 0) |
969 | { | |
8c343c7c | 970 | AliError("Event not chosen."); |
48b32e42 | 971 | return -1; |
925e6570 | 972 | } |
48b32e42 | 973 | |
974 | if ( ! FetchTreeR() ) return -1; | |
975 | if ( ! fClusterAddressSet ) | |
976 | { | |
977 | fData.SetTreeAddress("RC"); | |
978 | fData.ResetRawClusters(); | |
979 | fData.GetRawClusters(); | |
980 | fClusterAddressSet = kTRUE; | |
925e6570 | 981 | } |
48b32e42 | 982 | return fData.RawClusters(chamber)->GetEntriesFast(); |
925e6570 | 983 | } |
48b32e42 | 984 | |
985 | ||
986 | AliMUONRawCluster* AliMUONDataInterface::RawCluster(Int_t chamber, Int_t cluster) | |
987 | { | |
5398f946 | 988 | /// Fetch the specified raw cluster on the given chamber from the current event. |
989 | /// NULL is returned on error. | |
48b32e42 | 990 | |
991 | Assert( 0 <= chamber && chamber <= 13 ); | |
992 | ||
993 | if (fRunloader == NULL) | |
994 | { | |
8c343c7c | 995 | AliError("File not set."); |
48b32e42 | 996 | return NULL; |
925e6570 | 997 | } |
48b32e42 | 998 | if (fEventnumber < 0) |
999 | { | |
8c343c7c | 1000 | AliError("Event not chosen."); |
48b32e42 | 1001 | return NULL; |
925e6570 | 1002 | } |
48b32e42 | 1003 | |
1004 | if ( ! FetchTreeR() ) return NULL; | |
1005 | if ( ! fClusterAddressSet ) | |
1006 | { | |
1007 | fData.SetTreeAddress("RC"); | |
1008 | fData.ResetRawClusters(); | |
1009 | fData.GetRawClusters(); | |
1010 | fClusterAddressSet = kTRUE; | |
925e6570 | 1011 | } |
48b32e42 | 1012 | return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) ); |
925e6570 | 1013 | } |
48b32e42 | 1014 | |
1015 | ||
1016 | Int_t AliMUONDataInterface::NumberOfLocalTriggers() | |
1017 | { | |
5398f946 | 1018 | /// Get the number of local trigger objects in the current event. |
1019 | /// -1 is returned on error. | |
48b32e42 | 1020 | |
1021 | if (fRunloader == NULL) | |
1022 | { | |
8c343c7c | 1023 | AliError("File not set."); |
48b32e42 | 1024 | return -1; |
925e6570 | 1025 | } |
48b32e42 | 1026 | if (fEventnumber < 0) |
1027 | { | |
8c343c7c | 1028 | AliError("Event not chosen."); |
48b32e42 | 1029 | return -1; |
925e6570 | 1030 | } |
48b32e42 | 1031 | |
6d149c9e | 1032 | if ( ! FetchTreeD() ) return -1; |
48b32e42 | 1033 | if ( ! fTriggerAddressSet ) |
1034 | { | |
1035 | fData.SetTreeAddress("GLT"); | |
1036 | fData.ResetTrigger(); | |
6d149c9e | 1037 | fData.GetTriggerD(); |
48b32e42 | 1038 | fTriggerAddressSet = kTRUE; |
925e6570 | 1039 | } |
48b32e42 | 1040 | return fData.LocalTrigger()->GetEntriesFast(); |
925e6570 | 1041 | } |
48b32e42 | 1042 | |
1043 | ||
1044 | AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(Int_t trigger) | |
1045 | { | |
5398f946 | 1046 | /// Fetch the specified local trigger object from the current event. |
1047 | /// NULL is returned on error. | |
48b32e42 | 1048 | |
1049 | if (fRunloader == NULL) | |
1050 | { | |
8c343c7c | 1051 | AliError("File not set."); |
48b32e42 | 1052 | return NULL; |
925e6570 | 1053 | } |
48b32e42 | 1054 | if (fEventnumber < 0) |
1055 | { | |
8c343c7c | 1056 | AliError( "Event not chosen."); |
48b32e42 | 1057 | return NULL; |
925e6570 | 1058 | } |
48b32e42 | 1059 | |
6d149c9e | 1060 | if ( ! FetchTreeD() ) return NULL; |
48b32e42 | 1061 | if ( ! fTriggerAddressSet ) |
1062 | { | |
1063 | fData.SetTreeAddress("GLT"); | |
1064 | fData.ResetTrigger(); | |
6d149c9e | 1065 | fData.GetTriggerD(); |
48b32e42 | 1066 | fTriggerAddressSet = kTRUE; |
925e6570 | 1067 | } |
48b32e42 | 1068 | return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) ); |
925e6570 | 1069 | } |
554b38a6 | 1070 | |
1071 | Int_t AliMUONDataInterface::NumberOfGlobalTriggers() | |
1072 | { | |
5398f946 | 1073 | /// Get the number of local trigger objects in the current event. |
1074 | /// -1 is returned on error. | |
554b38a6 | 1075 | |
1076 | if (fRunloader == NULL) | |
1077 | { | |
1078 | AliError("File not set."); | |
1079 | return -1; | |
1080 | } | |
1081 | if (fEventnumber < 0) | |
1082 | { | |
1083 | AliError("Event not chosen."); | |
1084 | return -1; | |
1085 | } | |
1086 | ||
1087 | if ( ! FetchTreeD() ) return -1; | |
1088 | if ( ! fTriggerAddressSet ) | |
1089 | { | |
1090 | fData.SetTreeAddress("GLT"); | |
1091 | fData.ResetTrigger(); | |
1092 | fData.GetTriggerD(); | |
1093 | fTriggerAddressSet = kTRUE; | |
1094 | } | |
1095 | return fData.GlobalTrigger()->GetEntriesFast(); | |
1096 | } | |
1097 | ||
1098 | AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger) | |
1099 | { | |
5398f946 | 1100 | /// Fetch the specified local trigger object from the current event. |
1101 | /// NULL is returned on error. | |
554b38a6 | 1102 | |
1103 | if (fRunloader == NULL) | |
1104 | { | |
1105 | AliError("File not set."); | |
1106 | return NULL; | |
1107 | } | |
1108 | if (fEventnumber < 0) | |
1109 | { | |
1110 | AliError( "Event not chosen."); | |
1111 | return NULL; | |
1112 | } | |
1113 | ||
1114 | if ( ! FetchTreeD() ) return NULL; | |
1115 | if ( ! fTriggerAddressSet ) | |
1116 | { | |
1117 | fData.SetTreeAddress("GLT"); | |
1118 | fData.ResetTrigger(); | |
1119 | fData.GetTriggerD(); | |
1120 | fTriggerAddressSet = kTRUE; | |
1121 | } | |
1122 | return static_cast<AliMUONGlobalTrigger*>( fData.GlobalTrigger()->At(trigger) ); | |
1123 | } | |
1124 | ||
1125 | Int_t AliMUONDataInterface::NumberOfRecTracks() | |
1126 | { | |
5398f946 | 1127 | /// Fetch the number of reconstructed tracks from the current event. |
1128 | /// NULL is returned on error. | |
554b38a6 | 1129 | |
1130 | if (fRunloader == NULL) | |
1131 | { | |
1132 | AliError("File not set."); | |
1133 | return -1; | |
1134 | } | |
1135 | if (fEventnumber < 0) | |
1136 | { | |
1137 | AliError( "Event not chosen."); | |
1138 | return -1; | |
1139 | } | |
1140 | ||
1141 | if ( ! FetchTreeT() ) return -1; | |
1142 | if ( ! fRecTracksAddressSet ) | |
1143 | { | |
1144 | fData.SetTreeAddress("RT"); | |
1145 | fData.ResetRecTracks(); | |
1146 | fData.GetRecTracks(); | |
1147 | fRecTracksAddressSet = kTRUE; | |
1148 | } | |
1149 | return fData.RecTracks()->GetEntriesFast(); | |
1150 | } | |
1151 | ||
1152 | AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack) | |
1153 | { | |
5398f946 | 1154 | /// Fetch the specified reconstructed track object from the current event. |
1155 | /// NULL is returned on error. | |
554b38a6 | 1156 | |
1157 | if (fRunloader == NULL) | |
1158 | { | |
1159 | AliError("File not set."); | |
1160 | return NULL; | |
1161 | } | |
1162 | if (fEventnumber < 0) | |
1163 | { | |
1164 | AliError( "Event not chosen."); | |
1165 | return NULL; | |
1166 | } | |
1167 | ||
1168 | if ( ! FetchTreeT() ) return NULL; | |
1169 | if ( ! fRecTracksAddressSet ) | |
1170 | { | |
1171 | fData.SetTreeAddress("RT"); | |
1172 | fData.ResetRecTracks(); | |
1173 | fData.GetRecTracks(); | |
1174 | fRecTracksAddressSet = kTRUE; | |
1175 | } | |
1176 | return static_cast<AliMUONTrack*>( fData.RecTracks()->At(rectrack) ); | |
1177 | // return (AliMUONTrack*)(fData.RecTracks()->At(rectrack)); | |
1178 | } |