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 /// \class AliMUONDataInterface
30 /// An easy to use interface to the MUON module data stored in
31 /// TreeK, TreeH, TreeS, TreeD and TreeR
32 /// One can fetch any of the data objects with all the calls to runloader,
33 /// muon loader and AliMUONData done behind the scenes and automatically.
35 /// This interface in not necessarily the fastest way to fetch the data but
36 /// it is the easiest.
37 /// Note: If independant calls to the run loader, muon loader or
38 /// AliMUONData objects are interspersed with calls to the
39 /// AliMUONDataInterface to fetch data, one might need to call the Reset
40 /// method between these method calls at some point to prevent
41 /// AliMUONDataInterface from getting confused.
42 /// This is necessary since this object assumes the state of runloader,
43 /// muon loader nor AliMUONData has not changed between calls.
44 /// If the state has changes then one must call Reset so that
45 /// AliMUONDataInterface refreshes what it knows about the state
46 /// of the loader and AliMUONData objects.
48 /// \deprecated We have to revisit all this AliMUONData stuff anyway,
49 /// and probably make a real AliMUONLoader instead...
52 AliMUONDataInterface::AliMUONDataInterface()
53 : TObject(), fData(NULL, "MUON", "MUON")
55 // Set all internal pointers to NULL and indices to -1.
60 AliMUONDataInterface::AliMUONDataInterface(const AliMUONDataInterface& rhs)
63 // Protected copy constructor
65 AliFatal("Not implemented.");
68 AliMUONDataInterface::~AliMUONDataInterface()
70 // Delete the runloader if we created it.
71 // If the runloader is not to be deleted then call Reset just before
72 // the destructor is called.
74 if (fRunloader != NULL && fCreatedRunLoader)
79 AliMUONDataInterface::operator=(const AliMUONDataInterface& rhs)
81 // Protected assignement operator
83 if (this == &rhs) return *this;
85 AliFatal("Not implemented.");
91 void AliMUONDataInterface::Reset()
93 // Sets all internal pointers to NULL and indices to -1.
94 // Note: No resources are released!
95 // Specificaly AliRunLoader is not deleted.
97 fCreatedRunLoader = kFALSE;
104 fHitAddressSet = kFALSE;
105 fSDigitAddressSet = kFALSE;
106 fDigitAddressSet = kFALSE;
107 fClusterAddressSet = kFALSE;
108 fTriggerAddressSet = kFALSE;
109 fRecTracksAddressSet = kFALSE;
113 Bool_t AliMUONDataInterface::UseCurrentRunLoader()
115 // Tries to fetch the current runloader with AliRunLoader::GetRunLoader. If nothing is
116 // currently loaded then kFALSE is returned and AliMUONDataInterface is reset.
119 fRunloader = AliRunLoader::GetRunLoader();
120 if (fRunloader == NULL) return kFALSE;
121 // Fetch the current file name, folder name and event number.
122 fFilename = fRunloader->GetFileName();
123 fFoldername = fRunloader->GetEventFolder()->GetName();
124 fEventnumber = fRunloader->GetEventNumber();
126 if ( ! FetchMuonLoader(fFilename.Data(), fFoldername.Data()) )
136 Bool_t AliMUONDataInterface::FetchMuonLoader(TString filename, TString foldername)
138 // fetches the muon loader for the given filename/foldername
140 fMuonloader = fRunloader->GetLoader("MUONLoader");
141 if (fMuonloader == NULL)
143 AliError(Form("Could not find the MUON loader in file: %s and folder: %s",
144 (const char*)filename, (const char*)foldername));
148 // Need to connect the muon loader to the AliMUONData object,
149 // else class to fData will return NULL.
150 fData.SetLoader(fMuonloader);
155 Bool_t AliMUONDataInterface::LoadLoaders(TString filename, TString foldername)
157 // Load the run and muon loaders from the specified file and folder.
158 // kTRUE is returned on success and kFALSE on failure.
160 fRunloader = AliRunLoader::Open(filename, foldername, "READ");
161 if (fRunloader == NULL)
163 AliError(Form("Could not find or load the run loader for the file: %s and folder: %s",
164 (const char*)filename, (const char*)foldername));
167 fCreatedRunLoader = kTRUE;
168 if ( ! FetchMuonLoader(filename, foldername) )
174 fFilename = filename;
175 fFoldername = foldername;
176 fEventnumber = -1; // Reset the event number to force the event to be loaded.
181 Bool_t AliMUONDataInterface::FetchLoaders(TString filename, TString foldername)
183 // Fetch the run loader and muon loader objects from memory if they already exist,
184 // or from memory if they do not.
185 // If the currently loaded run loader (if any) is not refering to the file and folder
186 // we are interested in then it is deleted and reopened with the required file and
189 if (fRunloader == NULL)
191 fRunloader = AliRunLoader::GetRunLoader();
192 if (fRunloader == NULL)
193 return LoadLoaders(filename, foldername);
196 if (fMuonloader == NULL)
198 if ( ! FetchMuonLoader(filename, foldername) )
206 // Fetch the current file and folder names.
207 fFilename = fRunloader->GetFileName();
208 fFoldername = fRunloader->GetEventFolder()->GetName();
211 // If filename or foldername are not the same as the ones currently selected then
213 if ( filename.CompareTo(fFilename) != 0 || foldername.CompareTo(fFoldername) != 0 )
216 return LoadLoaders(filename, foldername);
222 Bool_t AliMUONDataInterface::FetchEvent(Int_t event)
224 // Fetch the specified event from the runloader and reset all the track, cathode
225 // and address flags to force them to be reloaded.
226 // If a negative event number is specified then the current runloader event
229 if (fEventnumber < 0)
231 fEventnumber = fRunloader->GetEventNumber();
235 fHitAddressSet = kFALSE;
236 fSDigitAddressSet = kFALSE;
237 fDigitAddressSet = kFALSE;
238 fClusterAddressSet = kFALSE;
239 fTriggerAddressSet = kFALSE;
240 fRecTracksAddressSet = kFALSE;
242 if ( event != fEventnumber )
244 if ( fRunloader->GetEvent(event) < 0 ) return kFALSE;
245 fEventnumber = event;
249 fHitAddressSet = kFALSE;
250 fSDigitAddressSet = kFALSE;
251 fDigitAddressSet = kFALSE;
252 fClusterAddressSet = kFALSE;
253 fTriggerAddressSet = kFALSE;
254 fRecTracksAddressSet = kFALSE;
260 Bool_t AliMUONDataInterface::FetchTreeK()
262 // Fetch the Kine tree from the current run loader.
264 if (fRunloader->TreeK() == NULL)
266 fRunloader->LoadKinematics("READ");
267 if (fRunloader->TreeK() == NULL)
269 AliError("Could not load TreeK.");
277 Bool_t AliMUONDataInterface::FetchTreeH()
279 // Fetch the Hits tree from the current muon loader.
280 // Set all the required addresses etc...
282 if (fMuonloader->TreeH() == NULL)
284 fMuonloader->LoadHits("READ");
285 if (fMuonloader->TreeH() == NULL)
287 AliError("Could not load TreeH.");
290 fData.SetTreeAddress("H");
291 fHitAddressSet = kTRUE;
293 else if ( ! fHitAddressSet )
295 fData.SetTreeAddress("H");
296 fHitAddressSet = kTRUE;
302 Bool_t AliMUONDataInterface::FetchTreeS()
304 // Fetch the S-Digits tree from the current muon loader.
305 // Set all the required addresses etc...
307 if (fMuonloader->TreeS() == NULL)
309 fMuonloader->LoadSDigits("READ");
310 if (fMuonloader->TreeS() == NULL)
312 AliError("Could not load TreeS.");
315 fData.SetTreeAddress("S");
316 fSDigitAddressSet = kTRUE;
318 else if ( ! fSDigitAddressSet )
320 fData.SetTreeAddress("S");
321 fSDigitAddressSet = kTRUE;
327 Bool_t AliMUONDataInterface::FetchTreeD()
329 // Fetch the digits tree from the current muon loader.
330 // Set all the required addresses etc...
332 if (fMuonloader->TreeD() == NULL)
334 fMuonloader->LoadDigits("READ");
335 if (fMuonloader->TreeD() == NULL)
337 AliError("Could not load TreeD.");
340 fData.SetTreeAddress("D");
341 fDigitAddressSet = kTRUE;
343 else if ( ! fDigitAddressSet )
345 fData.SetTreeAddress("D");
346 fDigitAddressSet = kTRUE;
352 Bool_t AliMUONDataInterface::FetchTreeR()
354 // Fetch the reconstructed objects tree from the current muon loader.
355 // Note: The addresses must still be set.
357 if (fMuonloader->TreeR() == NULL)
359 fMuonloader->LoadRecPoints("READ");
360 if (fMuonloader->TreeR() == NULL)
362 AliError("Could not load TreeR.");
366 // Need to reset these flags so that the cluster and trigger address
367 // gets reset after this method.
368 fClusterAddressSet = kFALSE;
369 fTriggerAddressSet = kFALSE;
374 Bool_t AliMUONDataInterface::FetchTreeT()
376 // fetch the reconstructed tracks tree from the current muon loader
377 // note : the addresses must still be set.
378 if (fMuonloader->TreeT() == NULL)
380 fMuonloader->LoadTracks("READ");
381 if (fMuonloader->TreeT() == NULL)
383 AliError("Could not load TreeT.");
387 // Need to reset these flags so that the rec tracks address
388 // gets reset after this method.
389 fRecTracksAddressSet = kFALSE;
394 Int_t AliMUONDataInterface::NumberOfEvents(TString filename, TString foldername)
396 // Returns the number of events in the specified file/folder, and -1 on error.
398 if ( ! FetchLoaders(filename, foldername) ) return -1;
399 return fRunloader->GetNumberOfEvents();
403 Int_t AliMUONDataInterface::NumberOfParticles(TString filename, TString foldername, Int_t event)
405 // Returns the number of events in the specified file/folder, and -1 on error.
407 if ( ! FetchLoaders(filename, foldername) ) return -1;
408 if ( ! FetchEvent(event) ) return -1;
409 if ( ! FetchTreeK() ) return -1;
410 return (Int_t) fRunloader->TreeK()->GetEntriesFast();
414 TParticle* AliMUONDataInterface::Particle(
415 TString filename, TString foldername, Int_t event, Int_t particle
418 // Returns the specified particle in the given file, folder and event.
419 // NULL is returned on error.
421 if ( ! FetchLoaders(filename, foldername) ) return NULL;
422 if ( ! FetchEvent(event) ) return NULL;
423 if ( ! FetchTreeK() ) return NULL;
425 TTree* treeK = fRunloader->TreeK();
427 treeK->GetBranch("Particles")->SetAddress(&p);
428 treeK->GetEvent(particle);
433 Int_t AliMUONDataInterface::NumberOfTracks(TString filename, TString foldername, Int_t event)
435 // Returns the number of tracks in the specified file/folder and event.
436 // -1 is returned on error.
438 if ( ! FetchLoaders(filename, foldername) ) return -1;
439 if ( ! FetchEvent(event) ) return -1;
440 if ( ! FetchTreeH() ) return -1;
441 return fData.GetNtracks();
445 Int_t AliMUONDataInterface::NumberOfHits(
446 TString filename, TString foldername, Int_t event, Int_t track
449 // Returns the number of hits in the specified file/folder, event and track.
450 // -1 is returned on error.
452 if ( ! FetchLoaders(filename, foldername) ) return -1;
453 if ( ! FetchEvent(event) ) return -1;
454 if ( ! FetchTreeH() ) return -1;
456 if (fTrack < 0 || fTrack != track)
459 fData.GetTrack(track);
462 return fData.Hits()->GetEntriesFast();
466 AliMUONHit* AliMUONDataInterface::Hit(
467 TString filename, TString foldername, Int_t event,
468 Int_t track, Int_t hit
471 // Returns the specified hit in the given file, folder, event and track.
472 // NULL is returned on error.
474 if ( ! FetchLoaders(filename, foldername) ) return NULL;
475 if ( ! FetchEvent(event) ) return NULL;
476 if ( ! FetchTreeH() ) return NULL;
478 if (fTrack < 0 || fTrack != track)
481 fData.GetTrack(track);
484 return static_cast<AliMUONHit*>( fData.Hits()->At(hit) );
488 Int_t AliMUONDataInterface::NumberOfSDigits(
489 TString filename, TString foldername, Int_t event,
490 Int_t chamber, Int_t cathode
493 // Returns the number of s-digits in the given file, folder, event,
494 // chamber and cathode. -1 is returned on error.
496 Assert( 0 <= chamber && chamber <= 13 );
497 Assert( 0 <= cathode && cathode <= 1 );
499 if ( ! FetchLoaders(filename, foldername) ) return -1;
500 if ( ! FetchEvent(event) ) return -1;
501 if ( ! FetchTreeS() ) return -1;
503 if ( fSCathode != cathode )
505 fData.ResetSDigits();
509 return fData.SDigits(chamber)->GetEntriesFast();
513 AliMUONDigit* AliMUONDataInterface::SDigit(
514 TString filename, TString foldername, Int_t event,
515 Int_t chamber, Int_t cathode, Int_t sdigit
518 // Returns the specified s-digit in the given file, folder, event,
519 // chamber and cathode. NULL is returned on error.
521 Assert( 0 <= chamber && chamber <= 13 );
522 Assert( 0 <= cathode && cathode <= 1 );
524 if ( ! FetchLoaders(filename, foldername) ) return NULL;
525 if ( ! FetchEvent(event) ) return NULL;
526 if ( ! FetchTreeS() ) return NULL;
528 if ( fSCathode != cathode )
530 fData.ResetSDigits();
534 return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) );
538 Int_t AliMUONDataInterface::NumberOfDigits(
539 TString filename, TString foldername, Int_t event,
540 Int_t chamber, Int_t cathode
543 // Returns the number of digits in the given file, folder, event,
544 // chamber and cathode. -1 is returned on error.
545 Assert( 0 <= chamber && chamber <= 13 );
546 Assert( 0 <= cathode && cathode <= 1 );
548 if ( ! FetchLoaders(filename, foldername) ) return -1;
549 if ( ! FetchEvent(event) ) return -1;
550 if ( ! FetchTreeD() ) return -1;
552 if ( fCathode != cathode )
558 return fData.Digits(chamber)->GetEntriesFast();
562 AliMUONDigit* AliMUONDataInterface::Digit(
563 TString filename, TString foldername, Int_t event,
564 Int_t chamber, Int_t cathode, Int_t digit
567 // Returns the specified digit in the given file, folder, event,
568 // chamber and cathode. NULL is returned on error.
570 Assert( 0 <= chamber && chamber <= 13 );
571 Assert( 0 <= cathode && cathode <= 1 );
573 if ( ! FetchLoaders(filename, foldername) ) return NULL;
574 if ( ! FetchEvent(event) ) return NULL;
575 if ( ! FetchTreeD() ) return NULL;
577 if ( fCathode != cathode )
583 return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) );
587 Int_t AliMUONDataInterface::NumberOfRawClusters(
588 TString filename, TString foldername, Int_t event, Int_t chamber
591 // Returns the number of raw clusters in the specified file, folder, event and chamber.
592 // -1 is returned or error.
594 Assert( 0 <= chamber && chamber <= 13 );
595 if ( ! FetchLoaders(filename, foldername) ) return -1;
596 if ( ! FetchEvent(event) ) return -1;
597 if ( ! FetchTreeR() ) return -1;
598 if ( ! fClusterAddressSet )
600 // If the raw cluster address in TreeR is not set yet then set it now.
601 fData.SetTreeAddress("RC");
602 fData.ResetRawClusters();
603 fData.GetRawClusters();
604 fClusterAddressSet = kTRUE;
606 return fData.RawClusters(chamber)->GetEntriesFast();
610 AliMUONRawCluster* AliMUONDataInterface::RawCluster(
611 TString filename, TString foldername, Int_t event,
612 Int_t chamber, Int_t cluster
615 // Fetch the specified raw cluster from the given file, folder, event and chamber number.
616 // NULL is returned on error.
618 Assert( 0 <= chamber && chamber <= 13 );
619 if ( ! FetchLoaders(filename, foldername) ) return NULL;
620 if ( ! FetchEvent(event) ) return NULL;
621 if ( ! FetchTreeR() ) return NULL;
622 if ( ! fClusterAddressSet )
624 // If the raw cluster address in TreeR is not set yet then set it now.
625 fData.SetTreeAddress("RC");
626 fData.ResetRawClusters();
627 fData.GetRawClusters();
628 fClusterAddressSet = kTRUE;
630 return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) );
634 Int_t AliMUONDataInterface::NumberOfLocalTriggers(TString filename, TString foldername, Int_t event)
636 // Return the number of local trigger objects in the specified file, folder and
637 // event number. -1 is returned on error.
639 if ( ! FetchLoaders(filename, foldername) ) return -1;
640 if ( ! FetchEvent(event) ) return -1;
641 if ( ! FetchTreeD() ) return -1;
642 if ( ! fTriggerAddressSet )
644 // If the local trigger address in TreeR is not set yet then set it now.
645 fData.SetTreeAddress("GLT");
646 fData.ResetTrigger();
648 fTriggerAddressSet = kTRUE;
650 return fData.LocalTrigger()->GetEntriesFast();
654 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(
655 TString filename, TString foldername, Int_t event, Int_t trigger
658 // Fetch the specified local trigger object from the given file, folder and event number.
659 // NULL is returned on error.
661 if ( ! FetchLoaders(filename, foldername) ) return NULL;
662 if ( ! FetchEvent(event) ) return NULL;
663 if ( ! FetchTreeD() ) return NULL;
664 if ( ! fTriggerAddressSet )
666 // If the local trigger address in TreeR is not set yet then set it now.
667 fData.SetTreeAddress("GLT");
668 fData.ResetTrigger();
670 fTriggerAddressSet = kTRUE;
672 return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
675 Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername)
677 // Set the current file and folder from which to fetch data.
678 // kTRUE is returned if the run and muon loaders were found, else kFALSE.
680 return FetchLoaders(filename, foldername);
684 Bool_t AliMUONDataInterface::GetEvent(Int_t event)
686 // Select the current event from which to fetch data.
687 // kTRUE is returned if the event was found, else kFALSE is returned.
689 if (fRunloader == NULL)
691 AliError("File not set.");
695 return FetchEvent(event);
699 Int_t AliMUONDataInterface::NumberOfEvents()
701 // Get the number of events in the currently selected file.
702 // -1 is returned on error.
704 if (fRunloader == NULL)
706 AliError("File not set.");
709 return fRunloader->GetNumberOfEvents();
713 Int_t AliMUONDataInterface::NumberOfParticles()
715 // Get the number of particles in the current event.
716 // -1 is returned on error.
718 if (fRunloader == NULL)
720 AliError("File not set.");
723 if ( ! FetchTreeK() ) return -1;
724 return (Int_t) fRunloader->TreeK()->GetEntriesFast();
728 TParticle* AliMUONDataInterface::Particle(Int_t particle)
730 // Fetch the specified particle from the current event.
731 // NULL is returned on error.
733 if (fRunloader == NULL)
735 AliError("File not set.");
738 if (fEventnumber < 0)
740 AliError("Event not chosen.");
743 if ( ! FetchTreeK() ) return NULL;
744 TTree* treeK = fRunloader->TreeK();
746 treeK->GetBranch("Particles")->SetAddress(&p);
747 treeK->GetEvent(particle);
752 Int_t AliMUONDataInterface::NumberOfTracks()
754 // Get the number of tracks in the current event.
755 // -1 is returned on error.
757 if (fRunloader == NULL)
759 AliError("File not set.");
762 if (fEventnumber < 0)
764 AliError( "Event not chosen.");
767 if ( ! FetchTreeH() ) return -1;
768 return fData.GetNtracks();
772 Int_t AliMUONDataInterface::NumberOfHits(Int_t track)
774 // Get the number of hits for the given track in the current event.
775 // -1 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 -1;
788 if (fTrack < 0 || fTrack != track)
791 fData.GetTrack(track);
794 return fData.Hits()->GetEntriesFast();
798 AliMUONHit* AliMUONDataInterface::Hit(Int_t track, Int_t hit)
800 // Fetch the specified hit from the current event.
801 // NULL is returned on error.
803 if (fRunloader == NULL)
805 AliError("File not set.");
808 if (fEventnumber < 0)
810 AliError("Event not chosen.");
813 if ( ! FetchTreeH() ) return NULL;
814 if (fTrack < 0 || fTrack != track)
817 fData.GetTrack(track);
820 return static_cast<AliMUONHit*>( fData.Hits()->At(hit) );
824 Int_t AliMUONDataInterface::NumberOfSDigits(Int_t chamber, Int_t cathode)
826 // Get the number of s-digits on the chamber, cathode in the current event.
827 // -1 is returned on error.
829 Assert( 0 <= chamber && chamber <= 13 );
830 Assert( 0 <= cathode && cathode <= 1 );
832 if (fRunloader == NULL)
834 AliError("File not set.");
837 if (fEventnumber < 0)
839 AliError("Event not chosen.");
843 if ( ! FetchTreeS() ) return -1;
844 if ( fSCathode != cathode )
846 fData.ResetSDigits();
850 return fData.SDigits(chamber)->GetEntriesFast();
854 AliMUONDigit* AliMUONDataInterface::SDigit(Int_t chamber, Int_t cathode, Int_t sdigit)
856 // Fetch the specified s-digits on the chamber, cathode from the current event.
857 // NULL is returned on error.
859 Assert( 0 <= chamber && chamber <= 13 );
860 Assert( 0 <= cathode && cathode <= 1 );
862 if (fRunloader == NULL)
864 AliError("File not set.");
867 if (fEventnumber < 0)
869 AliError("Event not chosen.");
873 if ( ! FetchTreeS() ) return NULL;
874 if ( fSCathode != cathode )
876 fData.ResetSDigits();
880 return static_cast<AliMUONDigit*>( fData.SDigits(chamber)->At(sdigit) );
884 Int_t AliMUONDataInterface::NumberOfDigits(Int_t chamber, Int_t cathode)
886 // Get the number of digits on the chamber, cathode in the current event.
887 // -1 is returned on error.
889 Assert( 0 <= chamber && chamber <= 13 );
890 Assert( 0 <= cathode && cathode <= 1 );
892 if (fRunloader == NULL)
894 AliError("File not set.");
897 if (fEventnumber < 0)
899 AliError("Event not chosen.");
903 if ( ! FetchTreeD() ) return -1;
904 if ( fCathode != cathode )
910 return fData.Digits(chamber)->GetEntriesFast();
914 AliMUONDigit* AliMUONDataInterface::Digit(Int_t chamber, Int_t cathode, Int_t digit)
916 // Fetch the specified digits on the chamber, cathode from the current event.
917 // NULL is returned on error.
919 Assert( 0 <= chamber && chamber <= 13 );
920 Assert( 0 <= cathode && cathode <= 1 );
922 if (fRunloader == NULL)
924 AliError("File not set.");
927 if (fEventnumber < 0)
929 AliError("Event not chosen.");
933 if ( ! FetchTreeD() ) return NULL;
934 if ( fCathode != cathode )
940 return static_cast<AliMUONDigit*>( fData.Digits(chamber)->At(digit) );
944 Int_t AliMUONDataInterface::NumberOfRawClusters(Int_t chamber)
946 // Get the number of raw clusters on the given chamber in the current event.
947 // -1 is returned on error.
949 Assert( 0 <= chamber && chamber <= 13 );
951 if (fRunloader == NULL)
953 AliError("File not set.");
956 if (fEventnumber < 0)
958 AliError("Event not chosen.");
962 if ( ! FetchTreeR() ) return -1;
963 if ( ! fClusterAddressSet )
965 fData.SetTreeAddress("RC");
966 fData.ResetRawClusters();
967 fData.GetRawClusters();
968 fClusterAddressSet = kTRUE;
970 return fData.RawClusters(chamber)->GetEntriesFast();
974 AliMUONRawCluster* AliMUONDataInterface::RawCluster(Int_t chamber, Int_t cluster)
976 // Fetch the specified raw cluster on the given chamber from the current event.
977 // NULL is returned on error.
979 Assert( 0 <= chamber && chamber <= 13 );
981 if (fRunloader == NULL)
983 AliError("File not set.");
986 if (fEventnumber < 0)
988 AliError("Event not chosen.");
992 if ( ! FetchTreeR() ) return NULL;
993 if ( ! fClusterAddressSet )
995 fData.SetTreeAddress("RC");
996 fData.ResetRawClusters();
997 fData.GetRawClusters();
998 fClusterAddressSet = kTRUE;
1000 return static_cast<AliMUONRawCluster*>( fData.RawClusters(chamber)->At(cluster) );
1004 Int_t AliMUONDataInterface::NumberOfLocalTriggers()
1006 // Get the number of local trigger objects in the current event.
1007 // -1 is returned on error.
1009 if (fRunloader == NULL)
1011 AliError("File not set.");
1014 if (fEventnumber < 0)
1016 AliError("Event not chosen.");
1020 if ( ! FetchTreeD() ) return -1;
1021 if ( ! fTriggerAddressSet )
1023 fData.SetTreeAddress("GLT");
1024 fData.ResetTrigger();
1025 fData.GetTriggerD();
1026 fTriggerAddressSet = kTRUE;
1028 return fData.LocalTrigger()->GetEntriesFast();
1032 AliMUONLocalTrigger* AliMUONDataInterface::LocalTrigger(Int_t trigger)
1034 // Fetch the specified local trigger object from the current event.
1035 // NULL is returned on error.
1037 if (fRunloader == NULL)
1039 AliError("File not set.");
1042 if (fEventnumber < 0)
1044 AliError( "Event not chosen.");
1048 if ( ! FetchTreeD() ) return NULL;
1049 if ( ! fTriggerAddressSet )
1051 fData.SetTreeAddress("GLT");
1052 fData.ResetTrigger();
1053 fData.GetTriggerD();
1054 fTriggerAddressSet = kTRUE;
1056 return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
1059 Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
1062 // Get the number of local trigger objects in the current event.
1063 // -1 is returned on error.
1065 if (fRunloader == NULL)
1067 AliError("File not set.");
1070 if (fEventnumber < 0)
1072 AliError("Event not chosen.");
1076 if ( ! FetchTreeD() ) return -1;
1077 if ( ! fTriggerAddressSet )
1079 fData.SetTreeAddress("GLT");
1080 fData.ResetTrigger();
1081 fData.GetTriggerD();
1082 fTriggerAddressSet = kTRUE;
1084 return fData.GlobalTrigger()->GetEntriesFast();
1087 AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger)
1089 // Fetch the specified local trigger object from the current event.
1090 // NULL is returned on error.
1092 if (fRunloader == NULL)
1094 AliError("File not set.");
1097 if (fEventnumber < 0)
1099 AliError( "Event not chosen.");
1103 if ( ! FetchTreeD() ) return NULL;
1104 if ( ! fTriggerAddressSet )
1106 fData.SetTreeAddress("GLT");
1107 fData.ResetTrigger();
1108 fData.GetTriggerD();
1109 fTriggerAddressSet = kTRUE;
1111 return static_cast<AliMUONGlobalTrigger*>( fData.GlobalTrigger()->At(trigger) );
1114 Int_t AliMUONDataInterface::NumberOfRecTracks()
1116 // Fetch the number of reconstructed tracks from the current event.
1117 // NULL is returned on error.
1119 if (fRunloader == NULL)
1121 AliError("File not set.");
1124 if (fEventnumber < 0)
1126 AliError( "Event not chosen.");
1130 if ( ! FetchTreeT() ) return -1;
1131 if ( ! fRecTracksAddressSet )
1133 fData.SetTreeAddress("RT");
1134 fData.ResetRecTracks();
1135 fData.GetRecTracks();
1136 fRecTracksAddressSet = kTRUE;
1138 return fData.RecTracks()->GetEntriesFast();
1141 AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack)
1143 // Fetch the specified reconstructed track object from the current event.
1144 // NULL is returned on error.
1146 if (fRunloader == NULL)
1148 AliError("File not set.");
1151 if (fEventnumber < 0)
1153 AliError( "Event not chosen.");
1157 if ( ! FetchTreeT() ) return NULL;
1158 if ( ! fRecTracksAddressSet )
1160 fData.SetTreeAddress("RT");
1161 fData.ResetRecTracks();
1162 fData.GetRecTracks();
1163 fRecTracksAddressSet = kTRUE;
1165 return static_cast<AliMUONTrack*>( fData.RecTracks()->At(rectrack) );
1166 // return (AliMUONTrack*)(fData.RecTracks()->At(rectrack));