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