]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDataInterface.h
Multiple inclusion protection name corrected. (I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / AliMUONDataInterface.h
1 #ifndef ALI_MUON_DATA_INTERFACE_H
2 #define ALI_MUON_DATA_INTERFACE_H
3
4 // Author: Artur Szostak
5 //  email: artur@alice.phy.uct.ac.za
6
7 #include <TObject.h>
8 #include <TString.h>
9 #include <TParticle.h>
10
11 #include "AliRunLoader.h"
12 #include "AliLoader.h"
13 #include "AliMUONData.h"
14
15 #include "AliMUONHit.h"
16 #include "AliMUONDigit.h"
17 #include "AliMUONRawCluster.h"
18 #include "AliMUONLocalTrigger.h"
19
20
21 // An easy to use interface to the MUON module data stored in TreeK, TreeH, TreeS, TreeD and TreeR
22 // One can fetch any of the data objects with all the calls to runloader, muon loader and AliMUONData
23 // done behind the scenes and automatically.
24 // This interface in not necessarily the fastest way to fetch the data but it is the easiest.
25 // Note: If independant calls to the run loader, muon loader or AliMUONData objects are interspersed
26 // with calls to the AliMUONDataInterface to fetch data, one might need to call the Reset method
27 // between these method calls at some point to prevent AliMUONDataInterface from getting confused.
28 // This is necessary since this object assumes the state of runloader, muon loader nor AliMUONData
29 // has not changed between calls. If the state has changes then one must call Reset so that 
30 // AliMUONDataInterface refreshes what it knows about the state of the loader and AliMUONData objects.
31 //
32 class AliMUONDataInterface : public TObject
33 {
34 public:
35
36         AliMUONDataInterface();
37         ~AliMUONDataInterface();
38         
39         // Sets all internal pointers to NULL without releasing the current runloader.
40         void Reset();
41         
42         Int_t NumberOfEvents(TString filename, TString foldername);
43
44         Int_t NumberOfParticles(TString filename, TString foldername, Int_t event);
45         TParticle* Particle(TString filename, TString foldername, Int_t event, Int_t particle);
46
47         Int_t NumberOfTracks(TString filename, TString foldername, Int_t event);
48         Int_t NumberOfHits(TString filename, TString foldername, Int_t event, Int_t track);
49         AliMUONHit* Hit(TString filename, TString foldername, Int_t event, Int_t track, Int_t hit);
50
51         Int_t NumberOfSDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
52         AliMUONDigit* SDigit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t sdigit);
53
54         Int_t NumberOfDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
55         AliMUONDigit* Digit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t digit);
56
57         Int_t NumberOfRawClusters(TString filename, TString foldername, Int_t event, Int_t chamber);
58         AliMUONRawCluster* RawCluster(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cluster);
59
60         Int_t NumberOfLocalTriggers(TString filename, TString foldername, Int_t event);
61         AliMUONLocalTrigger* LocalTrigger(TString filename, TString foldername, Int_t event, Int_t trigger);
62         
63         Bool_t SetFile(TString filename = "galice.root", TString foldername = "MUONFolder");
64         Bool_t GetEvent(Int_t event = 0);
65
66         Int_t NumberOfEvents();
67         
68         Int_t NumberOfParticles();
69         TParticle* Particle(Int_t particle);
70
71         Int_t NumberOfTracks();
72         Int_t NumberOfHits(Int_t track);
73         AliMUONHit* Hit(Int_t track, Int_t hit);
74
75         Int_t NumberOfSDigits(Int_t chamber, Int_t cathode);
76         AliMUONDigit* SDigit(Int_t chamber, Int_t cathode, Int_t sdigit);
77
78         Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
79         AliMUONDigit* Digit(Int_t chamber, Int_t cathode, Int_t digit);
80
81         Int_t NumberOfRawClusters(Int_t chamber);
82         AliMUONRawCluster* RawCluster(Int_t chamber, Int_t cluster);
83
84         Int_t NumberOfLocalTriggers();
85         AliMUONLocalTrigger* LocalTrigger(Int_t trigger);
86         
87         
88         // Returns the name of the currently selected file.
89         TString CurrentFile()     { return fFilename;    };
90         
91         // Returns the name of the currently selected folder.
92         TString CurrentFolder()   { return fFoldername;  };
93         
94         // Returns the number of the currently selected event.
95         Int_t   CurrentEvent()    { return fEventnumber; };
96         
97         // Returns the currently selected track.
98         Int_t   CurrentTrack()    { return fTrack;       };
99         
100         // Returns the currently selected cathode in TreeS.
101         Int_t   CurrentSCathode() { return fSCathode;    };
102         
103         // Returns the currently selected cathode in TreeD.
104         Int_t   CurrentDCathode() { return fCathode;     };
105
106 private:
107
108         Bool_t LoadLoaders(TString filename, TString foldername);
109         Bool_t FetchLoaders(TString filename, TString foldername);
110         Bool_t FetchEvent(Int_t event);
111         Bool_t FetchTreeK();
112         Bool_t FetchTreeH();
113         Bool_t FetchTreeS();
114         Bool_t FetchTreeD();
115         Bool_t FetchTreeR();
116         
117         
118         Bool_t fHitAddressSet;     //! Flag specifying if the TTree address for the hit tree was set.
119         Bool_t fSDigitAddressSet;  //! Flag specifying if the TTree address for the s-digit tree was set.
120         Bool_t fDigitAddressSet;   //! Flag specifying if the TTree address for the digit tree was set.
121         Bool_t fClusterAddressSet; //! Flag specifying if the TTree address for the cluster tree was set.
122         Bool_t fTriggerAddressSet; //! Flag specifying if the TTree address for the trigger tree was set.
123
124         AliRunLoader* fRunloader;  //! Pointer to the runloader object used.
125         AliLoader* fMuonloader;    //! Pointer to the muon loader object used.
126         AliMUONData fData;         //! Pointer to the muon raw data interface.
127         TString fFilename;         //! The file name from which we are fetching data.
128         TString fFoldername;       //! The folder name from which we are fetching data.
129         Int_t fEventnumber;        //! The currently selected event.
130         Int_t fTrack;              //! The currently selected track.
131         Int_t fSCathode;           //! The currently selected cathode in TreeS.
132         Int_t fCathode;            //! The currently selected cathode in TreeD.
133
134         ClassDef(AliMUONDataInterface, 0)  // A easy to use interface to data in the MUON module.
135 };
136
137
138 #endif // ALI_MUON_DATA_INTERFACE_H