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