-void AliMUONDataInterface::Reset()
-{
-// Sets all internal pointers to NULL and indices to -1.
-// Note: No resources are released!
-// Specificaly AliRunLoader is not deleted.
-
- fRunloader = NULL;
- fMuonloader = NULL;
- fEventnumber = -1;
- fTrack = -1;
- fSCathode = -1;
- fCathode = -1;
- fHitAddressSet = kFALSE;
- fSDigitAddressSet = kFALSE;
- fDigitAddressSet = kFALSE;
- fClusterAddressSet = kFALSE;
- fTriggerAddressSet = kFALSE;
-};
-
-
-Bool_t AliMUONDataInterface::LoadLoaders(TString filename, TString foldername)
-{
-// Load the run and muon loaders from the specified file and folder.
-// kTRUE is returned on success and kFALSE on failure.
-
- fRunloader = AliRunLoader::Open(filename, foldername, "READ");
- if (fRunloader == NULL)
- {
- AliError(Form("Could not find or load the run loader for the file: %s and folder: %s",
- (const char*)filename, (const char*)foldername));
- return kFALSE;
- };
- fMuonloader = fRunloader->GetLoader("MUONLoader");
- if (fMuonloader == NULL)
- {
- AliError(Form("Could not find the MUON loader in file: %s and folder: %s",
- (const char*)filename, (const char*)foldername));
- fRunloader = NULL;
- return kFALSE;
- };
-
- // Need to connect the muon loader to the AliMUONData object,
- // else class to fData will return NULL.
- fData.SetLoader(fMuonloader);
-
- fFilename = filename;
- fFoldername = foldername;
- fEventnumber = -1; // Reset the event number to force the event to be loaded.
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchLoaders(TString filename, TString foldername)
-{
-// Fetch the run loader and muon loader objects from memory if they already exist,
-// or from memory if they do not.
-// If the currently loaded run loader (if any) is not refering to the file and folder
-// we are interested in then it is deleted and reopened with the required file and
-// folder names.
-
- if (fRunloader == NULL)
- {
- fRunloader = AliRunLoader::GetRunLoader();
- if (fRunloader == NULL)
- return LoadLoaders(filename, foldername);
-
- // Fetch the current file and folder names.
- fFilename = fRunloader->GetFileName();
- fFoldername = fRunloader->GetEventFolder()->GetName();
- };
-
- // If filename or foldername are not the same as the ones currently selected then
- // reopen the file.
- if ( filename.CompareTo(fFilename) != 0 || foldername.CompareTo(fFoldername) != 0 )
- {
- delete fRunloader;
- return LoadLoaders(filename, foldername);
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchEvent(Int_t event)
-{
-// Fetch the specified event from the runloader and reset all the track, cathode
-// and address flags to force them to be reloaded.
-
- if (fEventnumber < 0)
- {
- fEventnumber = fRunloader->GetEventNumber();
- fTrack = -1;
- fSCathode = -1;
- fCathode = -1;
- fHitAddressSet = kFALSE;
- fSDigitAddressSet = kFALSE;
- fDigitAddressSet = kFALSE;
- fClusterAddressSet = kFALSE;
- fTriggerAddressSet = kFALSE;
- };
- if ( event != fEventnumber )
- {
- if ( fRunloader->GetEvent(event) < 0 ) return kFALSE;
- fEventnumber = event;
- fTrack = -1;
- fSCathode = -1;
- fCathode = -1;
- fHitAddressSet = kFALSE;
- fSDigitAddressSet = kFALSE;
- fDigitAddressSet = kFALSE;
- fClusterAddressSet = kFALSE;
- fTriggerAddressSet = kFALSE;
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchTreeK()
-{
-// Fetch the Kine tree from the current run loader.
-
- if (fRunloader->TreeK() == NULL)
- {
- fRunloader->LoadKinematics("READ");
- if (fRunloader->TreeK() == NULL)
- {
- AliError("Could not load TreeK.");
- return kFALSE;
- };
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchTreeH()
-{
-// Fetch the Hits tree from the current muon loader.
-// Set all the required addresses etc...
-
- if (fMuonloader->TreeH() == NULL)
- {
- fMuonloader->LoadHits("READ");
- if (fMuonloader->TreeH() == NULL)
- {
- AliError("Could not load TreeH.");
- return kFALSE;
- };
- fData.SetTreeAddress("H");
- fHitAddressSet = kTRUE;
- }
- else if ( ! fHitAddressSet )
- {
- fData.SetTreeAddress("H");
- fHitAddressSet = kTRUE;
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchTreeS()
-{
-// Fetch the S-Digits tree from the current muon loader.
-// Set all the required addresses etc...
-
- if (fMuonloader->TreeS() == NULL)
- {
- fMuonloader->LoadSDigits("READ");
- if (fMuonloader->TreeS() == NULL)
- {
- AliError("Could not load TreeS.");
- return kFALSE;
- };
- fData.SetTreeAddress("S");
- fSDigitAddressSet = kTRUE;
- }
- else if ( ! fSDigitAddressSet )
- {
- fData.SetTreeAddress("S");
- fSDigitAddressSet = kTRUE;
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchTreeD()
-{
-// Fetch the digits tree from the current muon loader.
-// Set all the required addresses etc...
-
- if (fMuonloader->TreeD() == NULL)
- {
- fMuonloader->LoadDigits("READ");
- if (fMuonloader->TreeD() == NULL)
- {
- AliError("Could not load TreeD.");
- return kFALSE;
- };
- fData.SetTreeAddress("D");
- fDigitAddressSet = kTRUE;
- }
- else if ( ! fDigitAddressSet )
- {
- fData.SetTreeAddress("D");
- fDigitAddressSet = kTRUE;
- };
- return kTRUE;
-};
-
-
-Bool_t AliMUONDataInterface::FetchTreeR()
-{
-// Fetch the reconstructed objects tree from the current muon loader.
-// Nore: The addresses must still be set.
-
- if (fMuonloader->TreeR() == NULL)
- {
- fMuonloader->LoadRecPoints("READ");
- if (fMuonloader->TreeR() == NULL)
- {
- AliError("Could not load TreeR.");
- return kFALSE;
- };
-
- // Need to reset these flags so that the cluster and trigger address
- // gets reset after this method.
- fClusterAddressSet = kFALSE;
- fTriggerAddressSet = kFALSE;
- };
- return kTRUE;
-};
-
-
-Int_t AliMUONDataInterface::NumberOfEvents(TString filename, TString foldername)
-{
-// Returns the number of events in the specified file/folder, and -1 on error.