#include "AliMUONDataInterface.h"
#include "AliMUONLocalTrigger.h"
+#include "AliMUONGlobalTrigger.h"
#include "AliMUONHit.h"
#include "AliMUONDigit.h"
#include "AliMUONRawCluster.h"
+#include "AliMUONTrack.h"
#include "AliLog.h"
#include <iostream>
fDigitAddressSet = kFALSE;
fClusterAddressSet = kFALSE;
fTriggerAddressSet = kFALSE;
+ fRecTracksAddressSet = kFALSE;
}
fDigitAddressSet = kFALSE;
fClusterAddressSet = kFALSE;
fTriggerAddressSet = kFALSE;
+ fRecTracksAddressSet = kFALSE;
}
if ( event != fEventnumber )
{
fDigitAddressSet = kFALSE;
fClusterAddressSet = kFALSE;
fTriggerAddressSet = kFALSE;
+ fRecTracksAddressSet = kFALSE;
}
return kTRUE;
}
Bool_t AliMUONDataInterface::FetchTreeR()
{
-// Fetch the reconstructed objects tree from the current muon loader.
-// Note: The addresses must still be set.
-
- if (fMuonloader->TreeR() == NULL)
+ // Fetch the reconstructed objects tree from the current muon loader.
+ // Note: The addresses must still be set.
+
+ if (fMuonloader->TreeR() == NULL)
+ {
+ fMuonloader->LoadRecPoints("READ");
+ 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;
+ AliError("Could not load TreeR.");
+ return kFALSE;
}
- return kTRUE;
+
+ // Need to reset these flags so that the cluster and trigger address
+ // gets reset after this method.
+ fClusterAddressSet = kFALSE;
+ fTriggerAddressSet = kFALSE;
+ }
+ return kTRUE;
}
-
+Bool_t AliMUONDataInterface::FetchTreeT()
+{
+ // fetch the reconstructed tracks tree from the current muon loader
+ // note : the addresses must still be set.
+ if (fMuonloader->TreeT() == NULL)
+ {
+ fMuonloader->LoadTracks("READ");
+ if (fMuonloader->TreeT() == NULL)
+ {
+ AliError("Could not load TreeT.");
+ return kFALSE;
+ }
+
+ // Need to reset these flags so that the rec tracks address
+ // gets reset after this method.
+ fRecTracksAddressSet = 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.
return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
}
-
Bool_t AliMUONDataInterface::SetFile(TString filename, TString foldername)
{
// Set the current file and folder from which to fetch data.
}
return static_cast<AliMUONLocalTrigger*>( fData.LocalTrigger()->At(trigger) );
}
+
+Int_t AliMUONDataInterface::NumberOfGlobalTriggers()
+{
+
+ // Get the number of local trigger objects in the current event.
+ // -1 is returned on error.
+
+ if (fRunloader == NULL)
+ {
+ AliError("File not set.");
+ return -1;
+ }
+ if (fEventnumber < 0)
+ {
+ AliError("Event not chosen.");
+ return -1;
+ }
+
+ if ( ! FetchTreeD() ) return -1;
+ if ( ! fTriggerAddressSet )
+ {
+ fData.SetTreeAddress("GLT");
+ fData.ResetTrigger();
+ fData.GetTriggerD();
+ fTriggerAddressSet = kTRUE;
+ }
+ return fData.GlobalTrigger()->GetEntriesFast();
+}
+
+AliMUONGlobalTrigger* AliMUONDataInterface::GlobalTrigger(Int_t trigger)
+{
+ // Fetch the specified local trigger object from the current event.
+ // NULL is returned on error.
+
+ if (fRunloader == NULL)
+ {
+ AliError("File not set.");
+ return NULL;
+ }
+ if (fEventnumber < 0)
+ {
+ AliError( "Event not chosen.");
+ return NULL;
+ }
+
+ if ( ! FetchTreeD() ) return NULL;
+ if ( ! fTriggerAddressSet )
+ {
+ fData.SetTreeAddress("GLT");
+ fData.ResetTrigger();
+ fData.GetTriggerD();
+ fTriggerAddressSet = kTRUE;
+ }
+ return static_cast<AliMUONGlobalTrigger*>( fData.GlobalTrigger()->At(trigger) );
+}
+
+Int_t AliMUONDataInterface::NumberOfRecTracks()
+{
+ // Fetch the number of reconstructed tracks from the current event.
+ // NULL is returned on error.
+
+ if (fRunloader == NULL)
+ {
+ AliError("File not set.");
+ return -1;
+ }
+ if (fEventnumber < 0)
+ {
+ AliError( "Event not chosen.");
+ return -1;
+ }
+
+ if ( ! FetchTreeT() ) return -1;
+ if ( ! fRecTracksAddressSet )
+ {
+ fData.SetTreeAddress("RT");
+ fData.ResetRecTracks();
+ fData.GetRecTracks();
+ fRecTracksAddressSet = kTRUE;
+ }
+ return fData.RecTracks()->GetEntriesFast();
+}
+
+AliMUONTrack* AliMUONDataInterface::RecTrack(Int_t rectrack)
+{
+ // Fetch the specified reconstructed track object from the current event.
+ // NULL is returned on error.
+
+ if (fRunloader == NULL)
+ {
+ AliError("File not set.");
+ return NULL;
+ }
+ if (fEventnumber < 0)
+ {
+ AliError( "Event not chosen.");
+ return NULL;
+ }
+
+ if ( ! FetchTreeT() ) return NULL;
+ if ( ! fRecTracksAddressSet )
+ {
+ fData.SetTreeAddress("RT");
+ fData.ResetRecTracks();
+ fData.GetRecTracks();
+ fRecTracksAddressSet = kTRUE;
+ }
+ return static_cast<AliMUONTrack*>( fData.RecTracks()->At(rectrack) );
+ // return (AliMUONTrack*)(fData.RecTracks()->At(rectrack));
+}
class AliMUONLocalTrigger;
class AliMUONHit;
class AliMUONDigit;
-
+class AliMUONTrack;
// An easy to use interface to the MUON module data stored in TreeK, TreeH, TreeS, TreeD and TreeR
// One can fetch any of the data objects with all the calls to runloader, muon loader and AliMUONData
//
class AliMUONDataInterface : public TObject
{
-public:
-
- AliMUONDataInterface();
- ~AliMUONDataInterface();
-
- // Sets all internal pointers to NULL without releasing the current runloader.
- void Reset();
-
- Bool_t UseCurrentRunLoader();
-
- Int_t NumberOfEvents(TString filename, TString foldername);
-
- Int_t NumberOfParticles(TString filename, TString foldername, Int_t event);
- TParticle* Particle(TString filename, TString foldername, Int_t event, Int_t particle);
-
- Int_t NumberOfTracks(TString filename, TString foldername, Int_t event);
- Int_t NumberOfHits(TString filename, TString foldername, Int_t event, Int_t track);
- AliMUONHit* Hit(TString filename, TString foldername, Int_t event, Int_t track, Int_t hit);
-
- Int_t NumberOfSDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
- AliMUONDigit* SDigit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t sdigit);
-
- Int_t NumberOfDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
- AliMUONDigit* Digit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t digit);
-
- Int_t NumberOfRawClusters(TString filename, TString foldername, Int_t event, Int_t chamber);
- AliMUONRawCluster* RawCluster(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cluster);
-
- Int_t NumberOfLocalTriggers(TString filename, TString foldername, Int_t event);
- AliMUONLocalTrigger* LocalTrigger(TString filename, TString foldername, Int_t event, Int_t trigger);
-
- Bool_t SetFile(TString filename = "galice.root", TString foldername = "MUONFolder");
- Bool_t GetEvent(Int_t event = 0);
-
- Int_t NumberOfEvents();
-
- Int_t NumberOfParticles();
- TParticle* Particle(Int_t particle);
-
- Int_t NumberOfTracks();
- Int_t NumberOfHits(Int_t track);
- AliMUONHit* Hit(Int_t track, Int_t hit);
-
- Int_t NumberOfSDigits(Int_t chamber, Int_t cathode);
- AliMUONDigit* SDigit(Int_t chamber, Int_t cathode, Int_t sdigit);
-
- Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
- AliMUONDigit* Digit(Int_t chamber, Int_t cathode, Int_t digit);
-
- Int_t NumberOfRawClusters(Int_t chamber);
- AliMUONRawCluster* RawCluster(Int_t chamber, Int_t cluster);
-
- Int_t NumberOfLocalTriggers();
- AliMUONLocalTrigger* LocalTrigger(Int_t trigger);
-
-
- // Returns the name of the currently selected file.
- TString CurrentFile() const { return fFilename; };
-
- // Returns the name of the currently selected folder.
- TString CurrentFolder() const { return fFoldername; };
-
- // Returns the number of the currently selected event.
- Int_t CurrentEvent() const { return fEventnumber; };
-
- // Returns the currently selected track.
- Int_t CurrentTrack() const { return fTrack; };
-
- // Returns the currently selected cathode in TreeS.
- Int_t CurrentSCathode() const { return fSCathode; };
-
- // Returns the currently selected cathode in TreeD.
- Int_t CurrentDCathode() const { return fCathode; };
-
-protected:
- AliMUONDataInterface(const AliMUONDataInterface& rhs);
- AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
-
-private:
-
- Bool_t FetchMuonLoader(TString filename, TString foldername);
- Bool_t LoadLoaders(TString filename, TString foldername);
- Bool_t FetchLoaders(TString filename, TString foldername);
- Bool_t FetchEvent(Int_t event);
- Bool_t FetchTreeK();
- Bool_t FetchTreeH();
- Bool_t FetchTreeS();
- Bool_t FetchTreeD();
- Bool_t FetchTreeR();
-
- Bool_t fCreatedRunLoader; //! If this object created the fRunloader then this flag is set.
-
- Bool_t fHitAddressSet; //! Flag specifying if the TTree address for the hit tree was set.
- Bool_t fSDigitAddressSet; //! Flag specifying if the TTree address for the s-digit tree was set.
- Bool_t fDigitAddressSet; //! Flag specifying if the TTree address for the digit tree was set.
- Bool_t fClusterAddressSet; //! Flag specifying if the TTree address for the cluster tree was set.
- Bool_t fTriggerAddressSet; //! Flag specifying if the TTree address for the trigger tree was set.
-
- AliRunLoader* fRunloader; //! Pointer to the runloader object used.
- AliLoader* fMuonloader; //! Pointer to the muon loader object used.
- AliMUONData fData; //! Pointer to the muon raw data interface.
- TString fFilename; //! The file name from which we are fetching data.
- TString fFoldername; //! The folder name from which we are fetching data.
- Int_t fEventnumber; //! The currently selected event.
- Int_t fTrack; //! The currently selected track.
- Int_t fSCathode; //! The currently selected cathode in TreeS.
- Int_t fCathode; //! The currently selected cathode in TreeD.
-
- ClassDef(AliMUONDataInterface, 0) // A easy to use interface to data in the MUON module.
-};
-
+ public:
+
+ AliMUONDataInterface();
+ ~AliMUONDataInterface();
+
+ // Sets all internal pointers to NULL without releasing the current runloader.
+ void Reset();
+
+ Bool_t UseCurrentRunLoader();
+
+ Int_t NumberOfEvents(TString filename, TString foldername);
+
+ Int_t NumberOfParticles(TString filename, TString foldername, Int_t event);
+ TParticle* Particle(TString filename, TString foldername, Int_t event, Int_t particle);
+
+ Int_t NumberOfTracks(TString filename, TString foldername, Int_t event);
+ Int_t NumberOfHits(TString filename, TString foldername, Int_t event, Int_t track);
+ AliMUONHit* Hit(TString filename, TString foldername, Int_t event, Int_t track, Int_t hit);
+
+ Int_t NumberOfSDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
+ AliMUONDigit* SDigit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t sdigit);
+
+ Int_t NumberOfDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
+ AliMUONDigit* Digit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t digit);
+
+ Int_t NumberOfRawClusters(TString filename, TString foldername, Int_t event, Int_t chamber);
+ AliMUONRawCluster* RawCluster(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cluster);
+
+ Int_t NumberOfLocalTriggers(TString filename, TString foldername, Int_t event);
+ AliMUONLocalTrigger* LocalTrigger(TString filename, TString foldername, Int_t event, Int_t trigger);
+
+ Bool_t SetFile(TString filename = "galice.root", TString foldername = "MUONFolder");
+ Bool_t GetEvent(Int_t event = 0);
+
+ Int_t NumberOfEvents();
+
+ Int_t NumberOfParticles();
+ TParticle* Particle(Int_t particle);
+
+ Int_t NumberOfTracks();
+ Int_t NumberOfHits(Int_t track);
+ AliMUONHit* Hit(Int_t track, Int_t hit);
+
+ Int_t NumberOfSDigits(Int_t chamber, Int_t cathode);
+ AliMUONDigit* SDigit(Int_t chamber, Int_t cathode, Int_t sdigit);
+
+ Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
+ AliMUONDigit* Digit(Int_t chamber, Int_t cathode, Int_t digit);
+
+ Int_t NumberOfRawClusters(Int_t chamber);
+ AliMUONRawCluster* RawCluster(Int_t chamber, Int_t cluster);
+
+ Int_t NumberOfLocalTriggers();
+ AliMUONLocalTrigger* LocalTrigger(Int_t trigger);
+
+ Int_t NumberOfGlobalTriggers();
+ AliMUONGlobalTrigger* GlobalTrigger(Int_t trigger);
+ // Returns the name of the currently selected file.
+
+ Int_t NumberOfRecTracks();
+ AliMUONTrack* RecTrack(Int_t rectrack);
+
+ TString CurrentFile() const { return fFilename; };
+
+ // Returns the name of the currently selected folder.
+ TString CurrentFolder() const { return fFoldername; };
+
+ // Returns the number of the currently selected event.
+ Int_t CurrentEvent() const { return fEventnumber; };
+
+ // Returns the currently selected track.
+ Int_t CurrentTrack() const { return fTrack; };
+
+ // Returns the currently selected cathode in TreeS.
+ Int_t CurrentSCathode() const { return fSCathode; };
+
+ // Returns the currently selected cathode in TreeD.
+ Int_t CurrentDCathode() const { return fCathode; };
+
+ protected:
+ AliMUONDataInterface(const AliMUONDataInterface& rhs);
+ AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
+
+ private:
+
+ Bool_t FetchMuonLoader(TString filename, TString foldername);
+ Bool_t LoadLoaders(TString filename, TString foldername);
+ Bool_t FetchLoaders(TString filename, TString foldername);
+ Bool_t FetchEvent(Int_t event);
+ Bool_t FetchTreeK();
+ Bool_t FetchTreeH();
+ Bool_t FetchTreeS();
+ Bool_t FetchTreeD();
+ Bool_t FetchTreeR();
+ Bool_t FetchTreeT();
+
+ Bool_t fCreatedRunLoader; //! If this object created the fRunloader then this flag is set.
+
+ Bool_t fHitAddressSet; //! Flag specifying if the TTree address for the hit tree was set.
+ Bool_t fSDigitAddressSet; //! Flag specifying if the TTree address for the s-digit tree was set.
+ Bool_t fDigitAddressSet; //! Flag specifying if the TTree address for the digit tree was set.
+ Bool_t fClusterAddressSet; //! Flag specifying if the TTree address for the cluster tree was set.
+ Bool_t fTriggerAddressSet; //! Flag specifying if the TTree address for the trigger tree was set.
+ Bool_t fRecTracksAddressSet; //! Flag specifying if the TTree address for the rec tracks tree was set.
+
+ AliRunLoader* fRunloader; //! Pointer to the runloader object used.
+ AliLoader* fMuonloader; //! Pointer to the muon loader object used.
+ AliMUONData fData; //! Pointer to the muon raw data interface.
+ TString fFilename; //! The file name from which we are fetching data.
+ TString fFoldername; //! The folder name from which we are fetching data.
+ Int_t fEventnumber; //! The currently selected event.
+ Int_t fTrack; //! The currently selected track.
+ Int_t fSCathode; //! The currently selected cathode in TreeS.
+ Int_t fCathode; //! The currently selected cathode in TreeD.
+
+ ClassDef(AliMUONDataInterface, 0) // A easy to use interface to data in the MUON module.
+ };
+
#endif // ALI_MUON_DATA_INTERFACE_H