2 // Author: Artur Szostak
3 // email: artur@alice.phy.uct.ac.za
8 #include "AliRunLoader.h"
11 #include "AliMUONDataInterface.h"
12 #include "AliMUONLocalTrigger.h"
13 #include "AliMUONGlobalTrigger.h"
14 #include "AliMUONHit.h"
15 #include "AliMUONDigit.h"
16 #include "AliMUONRawCluster.h"
17 #include "AliMUONTrack.h"
25 ClassImp(AliMUONDataInterface)
28 AliMUONDataInterface::AliMUONDataInterface()
29 : TObject(), fData(NULL, "MUON", "MUON")
31 // Set all internal pointers to NULL and indices to -1.
36 AliMUONDataInterface::AliMUONDataInterface(const AliMUONDataInterface& rhs)
39 // Protected copy constructor
41 AliFatal("Not implemented.");
44 AliMUONDataInterface::~AliMUONDataInterface()
46 // Delete the runloader if we created it.
47 // If the runloader is not to be deleted then call Reset just before
48 // the destructor is called.
50 if (fRunloader != NULL && fCreatedRunLoader)
55 AliMUONDataInterface::operator=(const AliMUONDataInterface& rhs)
57 // Protected assignement operator
59 if (this == &rhs) return *this;
61 AliFatal("Not implemented.");
67 void AliMUONDataInterface::Reset()
69 // Sets all internal pointers to NULL and indices to -1.
70 // Note: No resources are released!
71 // Specificaly AliRunLoader is not deleted.
73 fCreatedRunLoader = kFALSE;
80 fHitAddressSet = kFALSE;
81 fSDigitAddressSet = kFALSE;
82 fDigitAddressSet = kFALSE;
83 fClusterAddressSet = kFALSE;
84 fTriggerAddressSet = kFALSE;
85 fRecTracksAddressSet = kFALSE;
89 Bool_t AliMUONDataInterface::UseCurrentRunLoader()
91 // Tries to fetch the current runloader with AliRunLoader::GetRunLoader. If nothing is
92 // currently loaded then kFALSE is returned and AliMUONDataInterface is reset.
95 fRunloader = AliRunLoader::GetRunLoader();
96 if (fRunloader == NULL) return kFALSE;
97 // Fetch the current file name, folder name and event number.
98 fFilename = fRunloader->GetFileName();
99 fFoldername = fRunloader->GetEventFolder()->GetName();
100 fEventnumber = fRunloader->GetEventNumber();
102 if ( ! FetchMuonLoader(fFilename.Data(), fFoldername.Data()) )
112 Bool_t AliMUONDataInterface::FetchMuonLoader(TString filename, TString foldername)
114 fMuonloader = fRunloader->GetLoader("MUONLoader");
115 if (fMuonloader == NULL)
117 AliError(Form("Could not find the MUON loader in file: %s and folder: %s",
118 (const char*)filename, (const char*)foldername));
122 // Need to connect the muon loader to the AliMUONData object,
123 // else class to fData will return NULL.
124 fData.SetLoader(fMuonloader);
129 Bool_t AliMUONDataInterface::LoadLoaders(TString filename, TString foldername)
131 // Load the run and muon loaders from the specified file and folder.
132 // kTRUE is returned on success and kFALSE on failure.
134 fRunloader = AliRunLoader::Open(filename, foldername, "READ");
135 if (fRunloader == NULL)
137 AliError(Form("Could not find or load the run loader for the file: %s and folder: %s",
138 (const char*)filename, (const char*)foldername));
141 fCreatedRunLoader = kTRUE;
142 if ( ! FetchMuonLoader(filename, foldername) )
148 fFilename = filename;
149 fFoldername = foldername;
150 fEventnumber = -1; // Reset the event number to force the event to be loaded.
155 Bool_t AliMUONDataInterface::FetchLoaders(TString filename, TString foldername)
157 // Fetch the run loader and muon loader objects from memory if they already exist,
158 // or from memory if they do not.
159 // If the currently loaded run loader (if any) is not refering to the file and folder
160 // we are interested in then it is deleted and reopened with the required file and
163 if (fRunloader == NULL)
165 fRunloader = AliRunLoader::GetRunLoader();
166 if (fRunloader == NULL)
167 return LoadLoaders(filename, foldername);
170 if (fMuonloader == NULL)
172 if ( ! FetchMuonLoader(filename, foldername) )
180 // Fetch the current file and folder names.
181 fFilename = fRunloader->GetFileName();
182 fFoldername = fRunloader->GetEventFolder()->GetName();
185 // If filename or foldername are not the same as the ones currently selected then
187 if ( filename.CompareTo(fFilename) != 0 || foldername.CompareTo(fFoldername) != 0 )
190 return LoadLoaders(filename, foldername);
196 Bool_t AliMUONDataInterface::FetchEvent(Int_t event)
198 // Fetch the specified event from the runloader and reset all the track, cathode
199 // and address flags to force them to be reloaded.
200 // If a negative event number is specified then the current runloader event
203 if (fEventnumber < 0)
205 fEventnumber = fRunloader->GetEventNumber();
209 fHitAddressSet = kFALSE;
210 fSDigitAddressSet = kFALSE;
211 fDigitAddressSet = kFALSE;
212 fClusterAddressSet = kFALSE;
213 fTriggerAddressSet = kFALSE;
214 fRecTracksAddressSet = kFALSE;
216 if ( event != fEventnumber )
218 if ( fRunloader->GetEvent(event) < 0 ) return kFALSE;
219 fEventnumber = event;
223 fHitAddressSet = kFALSE;
224 fSDigitAddressSet = kFALSE;
225 fDigitAddressSet = kFALSE;
226 fClusterAddressSet = kFALSE;
227 fTriggerAddressSet = kFALSE;
228 fRecTracksAddressSet = kFALSE;
234 Bool_t AliMUONDataInterface::FetchTreeK()
236 // Fetch the Kine tree from the current run loader.
238 if (fRunloader->TreeK() == NULL)
240 fRunloader->LoadKinematics("READ");
241 if (fRunloader->TreeK() == NULL)
243 AliError("Could not load TreeK.");
251 Bool_t AliMUONDataInterface::FetchTreeH()
253 // Fetch the Hits tree from the current muon loader.
254 // Set all the required addresses etc...
256 if (fMuonloader->TreeH() == NULL)
258 fMuonloader->LoadHits("READ");
259 if (fMuonloader->TreeH() == NULL)
261 AliError("Could not load TreeH.");
264 fData.SetTreeAddress("H");
265 fHitAddressSet = kTRUE;
267 else if ( ! fHitAddressSet )
269 fData.SetTreeAddress("H");
270 fHitAddressSet = kTRUE;
276 Bool_t AliMUONDataInterface::FetchTreeS()
278 // Fetch the S-Digits tree from the current muon loader.
279 // Set all the required addresses etc...
281 if (fMuonloader->TreeS() == NULL)
283 fMuonloader->LoadSDigits("READ");
284 if (fMuonloader->TreeS() == NULL)
286 AliError("Could not load TreeS.");
289 fData.SetTreeAddress("S");
290 fSDigitAddressSet = kTRUE;
292 else if ( ! fSDigitAddressSet )
294 fData.SetTreeAddress("S");
295 fSDigitAddressSet = kTRUE;
301 Bool_t AliMUONDataInterface::FetchTreeD()
303 // Fetch the digits tree from the current muon loader.
304 // Set all the required addresses etc...
306 if (fMuonloader->TreeD() == NULL)
308 fMuonloader->LoadDigits("READ");
309 if (fMuonloader->TreeD() == NULL)
311 AliError("Could not load TreeD.");
314 fData.SetTreeAddress("D");
315 fDigitAddressSet = kTRUE;
317 else if ( ! fDigitAddressSet )
319 fData.SetTreeAddress("D");
320 fDigitAddressSet = kTRUE;
326 Bool_t AliMUONDataInterface::FetchTreeR()
328 // Fetch the reconstructed objects tree from the current muon loader.
329 // Note: The addresses must still be set.
331 if (fMuonloader->TreeR() == NULL)
333 fMuonloader->LoadRecPoints("READ");
334 if (fMuonloader->TreeR() == NULL)
336 AliError("Could not load TreeR.");
340 // Need to reset these flags so that the cluster and trigger address
341 // gets reset after this method.
342 fClusterAddressSet = kFALSE;
343 fTriggerAddressSet = kFALSE;
348 Bool_t AliMUONDataInterface::FetchTreeT()
350 // fetch the reconstructed tracks tree from the current muon loader
351 // note : the addresses must still be set.
352 if (fMuonloader->TreeT() == NULL)
354 fMuonloader->LoadTracks("READ");
355 if (fMuonloader->TreeT() == NULL)
357 AliError("Could not load TreeT.");
361 // Need to reset these flags so that the rec tracks address
362 // gets reset after this method.
363 fRecTracksAddressSet = kFALSE;
368 Int_t AliMUONDataInterface::NumberOfEvents(TString filename, TString foldername)
370 // Returns the number of events in the specified file/folder, and -1 on error.
372 if ( ! FetchLoaders(filename, foldername) ) return -1;
373 return fRunloader->GetNumberOfEvents();
377 Int_t AliMUONDataInterface::NumberOfParticles(TString filename, TString foldername, Int_t event)
379 // Returns the number of events in the specified file/folder, and -1 on error.
381 if ( ! FetchLoaders(filename, foldername) ) return -1;
382 if ( ! FetchEvent(event) ) return -1;
383 if ( ! FetchTreeK() ) return -1;
384 return (Int_t) fRunloader->TreeK()->GetEntriesFast();
388 TParticle* AliMUONDataInterface::Particle(
389 TString filename, TString foldername, Int_t event, Int_t particle
392 // Returns the specified particle in the given file, folder and event.
393 // NULL is returned on error.
395 if ( ! FetchLoaders(filename, foldername) ) return NULL;
396 if ( ! FetchEvent(event) ) return NULL;
397 if ( ! FetchTreeK() ) return NULL;
399 TTree* treeK = fRunloader->TreeK();
401 treeK->GetBranch("Particles")->SetAddress(&p);
402 treeK->GetEvent(particle);
407 Int_t AliMUONDataInterface::NumberOfTracks(TString filename, TString foldername, Int_t event)
409 // Returns the number of tracks in the specified file/folder and event.
410 // -1 is returned on error.
412 if ( ! FetchLoaders(filename, foldername) ) return -1;
413 if ( ! FetchEvent(event) ) return -1;
414 if ( ! FetchTreeH() ) return -1;
415 return fData.GetNtracks();
419 Int_t AliMUONDataInterface::NumberOfHits(
420 TString filename, TString foldername, Int_t event, Int_t track
423 // Returns the number of hits in the specified file/folder, event and track.
424 // -1 is returned on error.
426 if ( ! FetchLoaders(filename, foldername) ) return -1;
427 if ( ! FetchEvent(event) ) return -1;
428 if ( ! FetchTreeH() ) return -1;
430 if (fTrack < 0 || fTrack != track)
433 fData.GetTrack(track);
436 return fData.Hits()->GetEntriesFast();
440 AliMUONHit* AliMUONDataInterface::Hit(
441 TString filename, TString foldername, Int_t event,
442 Int_t track, Int_t hit
445 // Returns the specified hit in the given file, folder, event and track.
446 // NULL is returned on error.
448 if ( ! FetchLoaders(filename, foldername) ) return NULL;
449 if ( ! FetchEvent(event) ) return NULL;
450 if ( ! FetchTreeH() ) return NULL;
452 if (fTrack < 0 || fTrack != track)
455 fData.GetTrack(track);
458 return static_cast<AliMUONHit*>( fData.Hits()->At(hit) );
462 Int_t AliMUONDataInterface::NumberOfSDigits(
463 TString filename, TString foldername, Int_t event,
464 Int_t chamber, Int_t cathode
467 // Returns the number of s-digits in the given file, folder, event,
468 // chamber and cathode. -1 is returned on error.
470 Assert( 0 <= chamber && chamber <= 13 );
471 Assert( 0 <= cathode && cathode <= 1 );
473 if ( ! FetchLoaders(filename, foldername) ) return -1;
474 if ( ! FetchEvent(event) ) return -1;
475 if ( ! FetchTreeS() ) return -1;
477 if ( fSCathode != cathode )
479 fData.ResetSDigits();
483 return fData.SDigits(chamber)->GetEntriesFast();
487 AliMUONDigit* AliMUONDataInterface::SDigit(
488 TString filename, TString foldername, Int_t event,
489 Int_t chamber, Int_t cathode, Int_t sdigit
492 // Returns the specified s-digit in the given file, folder, event,
493 // chamber and cathode. NULL is returned on error.
495 Assert( 0 <= chamber && chamber <= 13 );
496 Assert( 0 <= cathode && cathode <= 1 );
498 if ( ! FetchLoaders(filename, foldername) ) return NULL;
499 if ( ! FetchEvent(event) ) return NULL;
500 if ( ! FetchTreeS() ) return NULL;
502 if ( fSCathode != cathode )
504 fData.ResetSDigits();
508 return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) );
512 Int_t AliMUONDataInterface::NumberOfDigits(
513 TString filename, TString foldername, Int_t event,
514 Int_t chamber, Int_t cathode
517 // Returns the number of digits in the given file, folder, event,
518 // chamber and cathode. -1 is returned on error.
519 Assert( 0 <= chamber && chamber <= 13 );
520 Assert( 0 <= cathode && cathode <= 1 );
522 if ( ! FetchLoaders(filename, foldername) ) return -1;
523 if ( ! FetchEvent(event) ) return -1;
524 if ( ! FetchTreeD() ) return -1;
526 if ( fCathode != cathode )
532 return fData.Digits(chamber)->GetEntriesFast();
536 AliMUONDigit* AliMUONDataInterface::Digit(
537 TString filename, TString foldername, Int_t event,
538 Int_t chamber, Int_t cathode, Int_t digit
541 // Returns the specified digit in the given file, folder, event,
542 // chamber and cathode. NULL is returned on error.
544 Assert( 0 <= chamber && chamber <= 13 );
545 Assert( 0 <= cathode && cathode <= 1 );
547 if ( ! FetchLoaders(filename, foldername) ) return NULL;
548 if ( ! FetchEvent(event) ) return NULL;
549 if ( ! FetchTreeD() ) return NULL;
551 if ( fCathode != cathode )
557 return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) );
561 Int_t AliMUONDataInterface::NumberOfRawClusters(
562 TString filename, TString foldername, Int_t event, Int_t chamber
565 // Returns the number of raw clusters in the specified file, folder, event and chamber.
566 // -1 is returned or error.
568 Assert( 0 <= chamber && chamber <= 13 );
569 if ( ! FetchLoaders(filename, foldername) ) return -1;
570 if ( ! FetchEvent(event) ) return -1;
571 if ( ! FetchTreeR() ) return -1;
572 if ( ! fClusterAddressSet )
574 // If the raw cluster address in TreeR is not set yet then set it now.
575 fData.SetTreeAddress("RC");
576 fData.ResetRawClusters();
577 fData.GetRawClusters();
578 fClusterAddressSet = kTRUE;
580 return fData.RawClusters(chamber)->GetEntriesFast();
584 AliMUONRawCluster* AliMUONDataInterface::RawCluster(
585 TString filename, TString foldername, Int_t event,
586 Int_t chamber, Int_t cluster
589 // Fetch the specified raw cluster from the given file, folder, event and chamber number.
590 // NULL is returned on error.
592 Assert( 0 <= chamber && chamber <= 13 );
593 if ( ! FetchLoaders(filename, foldername) ) return NULL;
594 if ( ! FetchEvent(event) ) return NULL;
595 if ( ! FetchTreeR() ) return NULL;
596 if ( ! fClusterAddressSet )
598 // If the raw cluster address in TreeR is not set yet then set it now.
599 fData.SetTreeAddress("RC");
600 fData.ResetRawClusters();
601 fData.GetRawClusters();
602 fClusterAddressSet = kTRUE;
604 return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) );
608 Int_t AliMUONDataInterface::NumberOfLocalTriggers(TString filename, TString foldername, Int_t event)
610 // Return the number of local trigger objects in the specified file, folder and
611 // event number. -1 is returned on error.
613 if ( ! FetchLoaders(filename, foldername) ) return -1;
614 if ( ! FetchEvent(event) ) return -1;
615 if ( ! FetchTreeD() ) return -1;
616 if ( ! fTriggerAddressSet )
618 // If the local trigger address in TreeR is not set yet then set it now.
619 fData.SetTreeAddress("GLT");
620 fData.ResetTrigger();
622 fTriggerAddressSet = kTRUE;
624 return fData.LocalTrigger()->GetEntriesFast();
628 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(
629 TString filename, TString foldername, Int_t event, Int_t trigger
632 // Fetch the specified local trigger object from the given file, folder and event number.
633 // NULL is returned on error.
635 if ( ! FetchLoaders(filename, foldername) ) return NULL;
636 if ( ! FetchEvent(event) ) return NULL;
637 if ( ! FetchTreeD() ) return NULL;
638 if ( ! fTriggerAddressSet )
640 // If the local trigger address in TreeR is not set yet then set it now.
641 fData.SetTreeAddress("GLT");
642 fData.ResetTrigger();
644 fTriggerAddressSet = kTRUE;
646 return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
649 Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername)
651 // Set the current file and folder from which to fetch data.
652 // kTRUE is returned if the run and muon loaders were found, else kFALSE.
654 return FetchLoaders(filename, foldername);
658 Bool_t AliMUONDataInterface::GetEvent(Int_t event)
660 // Select the current event from which to fetch data.
661 // kTRUE is returned if the event was found, else kFALSE is returned.
663 if (fRunloader == NULL)
665 AliError("File not set.");
669 return FetchEvent(event);
673 Int_t AliMUONDataInterface::NumberOfEvents()
675 // Get the number of events in the currently selected file.
676 // -1 is returned on error.
678 if (fRunloader == NULL)
680 AliError("File not set.");
683 return fRunloader->GetNumberOfEvents();
687 Int_t AliMUONDataInterface::NumberOfParticles()
689 // Get the number of particles in the current event.
690 // -1 is returned on error.
692 if (fRunloader == NULL)
694 AliError("File not set.");
697 if ( ! FetchTreeK() ) return -1;
698 return (Int_t) fRunloader->TreeK()->GetEntriesFast();
702 TParticle* AliMUONDataInterface::Particle(Int_t particle)
704 // Fetch the specified particle from the current event.
705 // NULL is returned on error.
707 if (fRunloader == NULL)
709 AliError("File not set.");
712 if (fEventnumber < 0)
714 AliError("Event not chosen.");
717 if ( ! FetchTreeK() ) return NULL;
718 TTree* treeK = fRunloader->TreeK();
720 treeK->GetBranch("Particles")->SetAddress(&p);
721 treeK->GetEvent(particle);
726 Int_t AliMUONDataInterface::NumberOfTracks()
728 // Get the number of tracks in the current event.
729 // -1 is returned on error.
731 if (fRunloader == NULL)
733 AliError("File not set.");
736 if (fEventnumber < 0)
738 AliError( "Event not chosen.");
741 if ( ! FetchTreeH() ) return -1;
742 return fData.GetNtracks();
746 Int_t AliMUONDataInterface::NumberOfHits(Int_t track)
748 // Get the number of hits for the given track in the current event.
749 // -1 is returned on error.
751 if (fRunloader == NULL)
753 AliError("File not set.");
756 if (fEventnumber < 0)
758 AliError("Event not chosen.");
761 if ( ! FetchTreeH() ) return -1;
762 if (fTrack < 0 || fTrack != track)
765 fData.GetTrack(track);
768 return fData.Hits()->GetEntriesFast();
772 AliMUONHit* AliMUONDataInterface::Hit(Int_t track, Int_t hit)
774 // Fetch the specified hit from the current event.
775 // NULL is returned on error.
777 if (fRunloader == NULL)
779 AliError("File not set.");
782 if (fEventnumber < 0)
784 AliError("Event not chosen.");
787 if ( ! FetchTreeH() ) return NULL;
788 if (fTrack < 0 || fTrack != track)
791 fData.GetTrack(track);
794 return static_cast<AliMUONHit*>( fData.Hits()->At(hit) );
798 Int_t AliMUONDataInterface::NumberOfSDigits(Int_t chamber, Int_t cathode)
800 // Get the number of s-digits on the chamber, cathode in the current event.
801 // -1 is returned on error.
803 Assert( 0 <= chamber && chamber <= 13 );
804 Assert( 0 <= cathode && cathode <= 1 );
806 if (fRunloader == NULL)
808 AliError("File not set.");
811 if (fEventnumber < 0)
813 AliError("Event not chosen.");
817 if ( ! FetchTreeS() ) return -1;
818 if ( fSCathode != cathode )
820 fData.ResetSDigits();
824 return fData.SDigits(chamber)->GetEntriesFast();
828 AliMUONDigit* AliMUONDataInterface::SDigit(Int_t chamber, Int_t cathode, Int_t sdigit)
830 // Fetch the specified s-digits on the chamber, cathode from the current event.
831 // NULL is returned on error.
833 Assert( 0 <= chamber && chamber <= 13 );
834 Assert( 0 <= cathode && cathode <= 1 );
836 if (fRunloader == NULL)
838 AliError("File not set.");
841 if (fEventnumber < 0)
843 AliError("Event not chosen.");
847 if ( ! FetchTreeS() ) return NULL;
848 if ( fSCathode != cathode )
850 fData.ResetSDigits();
854 return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) );
858 Int_t AliMUONDataInterface::NumberOfDigits(Int_t chamber, Int_t cathode)
860 // Get the number of digits on the chamber, cathode in the current event.
861 // -1 is returned on error.
863 Assert( 0 <= chamber && chamber <= 13 );
864 Assert( 0 <= cathode && cathode <= 1 );
866 if (fRunloader == NULL)
868 AliError("File not set.");
871 if (fEventnumber < 0)
873 AliError("Event not chosen.");
877 if ( ! FetchTreeD() ) return -1;
878 if ( fCathode != cathode )
884 return fData.Digits(chamber)->GetEntriesFast();
888 AliMUONDigit* AliMUONDataInterface::Digit(Int_t chamber, Int_t cathode, Int_t digit)
890 // Fetch the specified digits on the chamber, cathode from the current event.
891 // NULL is returned on error.
893 Assert( 0 <= chamber && chamber <= 13 );
894 Assert( 0 <= cathode && cathode <= 1 );
896 if (fRunloader == NULL)
898 AliError("File not set.");
901 if (fEventnumber < 0)
903 AliError("Event not chosen.");
907 if ( ! FetchTreeD() ) return NULL;
908 if ( fCathode != cathode )
914 return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) );
918 Int_t AliMUONDataInterface::NumberOfRawClusters(Int_t chamber)
920 // Get the number of raw clusters on the given chamber in the current event.
921 // -1 is returned on error.
923 Assert( 0 <= chamber && chamber <= 13 );
925 if (fRunloader == NULL)
927 AliError("File not set.");
930 if (fEventnumber < 0)
932 AliError("Event not chosen.");
936 if ( ! FetchTreeR() ) return -1;
937 if ( ! fClusterAddressSet )
939 fData.SetTreeAddress("RC");
940 fData.ResetRawClusters();
941 fData.GetRawClusters();
942 fClusterAddressSet = kTRUE;
944 return fData.RawClusters(chamber)->GetEntriesFast();
948 AliMUONRawCluster* AliMUONDataInterface::RawCluster(Int_t chamber, Int_t cluster)
950 // Fetch the specified raw cluster on the given chamber from the current event.
951 // NULL is returned on error.
953 Assert( 0 <= chamber && chamber <= 13 );
955 if (fRunloader == NULL)
957 AliError("File not set.");
960 if (fEventnumber < 0)
962 AliError("Event not chosen.");
966 if ( ! FetchTreeR() ) return NULL;
967 if ( ! fClusterAddressSet )
969 fData.SetTreeAddress("RC");
970 fData.ResetRawClusters();
971 fData.GetRawClusters();
972 fClusterAddressSet = kTRUE;
974 return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) );
978 Int_t AliMUONDataInterface::NumberOfLocalTriggers()
980 // Get the number of local trigger objects in the current event.
981 // -1 is returned on error.
983 if (fRunloader == NULL)
985 AliError("File not set.");
988 if (fEventnumber < 0)
990 AliError("Event not chosen.");
994 if ( ! FetchTreeD() ) return -1;
995 if ( ! fTriggerAddressSet )
997 fData.SetTreeAddress("GLT");
998 fData.ResetTrigger();
1000 fTriggerAddressSet = kTRUE;
1002 return fData.LocalTrigger()->GetEntriesFast();
1006 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(Int_t trigger)
1008 // Fetch the specified local trigger object from the current event.
1009 // NULL is returned on error.
1011 if (fRunloader == NULL)
1013 AliError("File not set.");
1016 if (fEventnumber < 0)
1018 AliError( "Event not chosen.");
1022 if ( ! FetchTreeD() ) return NULL;
1023 if ( ! fTriggerAddressSet )
1025 fData.SetTreeAddress("GLT");
1026 fData.ResetTrigger();
1027 fData.GetTriggerD();
1028 fTriggerAddressSet = kTRUE;
1030 return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
1033 Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
1036 // Get the number of local trigger objects in the current event.
1037 // -1 is returned on error.
1039 if (fRunloader == NULL)
1041 AliError("File not set.");
1044 if (fEventnumber < 0)
1046 AliError("Event not chosen.");
1050 if ( ! FetchTreeD() ) return -1;
1051 if ( ! fTriggerAddressSet )
1053 fData.SetTreeAddress("GLT");
1054 fData.ResetTrigger();
1055 fData.GetTriggerD();
1056 fTriggerAddressSet = kTRUE;
1058 return fData.GlobalTrigger()->GetEntriesFast();
1061 AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger)
1063 // Fetch the specified local trigger object from the current event.
1064 // NULL is returned on error.
1066 if (fRunloader == NULL)
1068 AliError("File not set.");
1071 if (fEventnumber < 0)
1073 AliError( "Event not chosen.");
1077 if ( ! FetchTreeD() ) return NULL;
1078 if ( ! fTriggerAddressSet )
1080 fData.SetTreeAddress("GLT");
1081 fData.ResetTrigger();
1082 fData.GetTriggerD();
1083 fTriggerAddressSet = kTRUE;
1085 return static_cast<AliMUONGlobalTrigger*>( fData.GlobalTrigger()->At(trigger) );
1088 Int_t AliMUONDataInterface::NumberOfRecTracks()
1090 // Fetch the number of reconstructed tracks from the current event.
1091 // NULL is returned on error.
1093 if (fRunloader == NULL)
1095 AliError("File not set.");
1098 if (fEventnumber < 0)
1100 AliError( "Event not chosen.");
1104 if ( ! FetchTreeT() ) return -1;
1105 if ( ! fRecTracksAddressSet )
1107 fData.SetTreeAddress("RT");
1108 fData.ResetRecTracks();
1109 fData.GetRecTracks();
1110 fRecTracksAddressSet = kTRUE;
1112 return fData.RecTracks()->GetEntriesFast();
1115 AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack)
1117 // Fetch the specified reconstructed track object from the current event.
1118 // NULL is returned on error.
1120 if (fRunloader == NULL)
1122 AliError("File not set.");
1125 if (fEventnumber < 0)
1127 AliError( "Event not chosen.");
1131 if ( ! FetchTreeT() ) return NULL;
1132 if ( ! fRecTracksAddressSet )
1134 fData.SetTreeAddress("RT");
1135 fData.ResetRecTracks();
1136 fData.GetRecTracks();
1137 fRecTracksAddressSet = kTRUE;
1139 return static_cast<AliMUONTrack*>( fData.RecTracks()->At(rectrack) );
1140 // return (AliMUONTrack*)(fData.RecTracks()->At(rectrack));