]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDataInterface.h
Reimplemented data interface classes without use of DataManager
[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 evaluation
10 /// \class AliMUONDataInterface
11 /// \brief An easy to use interface to MUON data
12
13 // Author: Artur Szostak
14 //  email: artur@alice.phy.uct.ac.za
15 //
16 // Updated to MUON module w/o MUONData by Laurent Aphecetche, Subatech
17 //
18
19 #include <TObject.h>
20 #include <TString.h>
21
22 class AliLoader;
23 class AliMUONVClusterStore;
24 class AliMUONVDigitStore;
25 class AliMUONVStore;
26 class AliMUONVTrackStore;
27 class AliMUONVTriggerStore;
28 class AliMUONVTriggerTrackStore;
29
30 // >>LA should not needed (once we remove deprecated methods)
31 class AliMUONHit; 
32 class AliMUONDigit;
33 class AliMUONLocalTrigger;
34 class AliMUONGlobalTrigger;
35 class AliMUONRawCluster;
36 class AliMUONTrack;
37 class TParticle;
38 // <<LA
39
40 class AliMUONDataInterface : public TObject
41 {
42  public:
43   
44   AliMUONDataInterface(const char* filename="galice.root");
45   virtual ~AliMUONDataInterface();
46   
47   Bool_t IsValid() const;
48
49   void Open(const char* filename);
50
51   Int_t NumberOfEvents() const;
52
53   AliMUONVDigitStore* DigitStore(Int_t event);  
54   AliMUONVClusterStore* ClusterStore(Int_t event);
55   AliMUONVTrackStore* TrackStore(Int_t event);
56   AliMUONVTriggerStore* TriggerStore(Int_t event, const char* treeLetter="R");
57   AliMUONVTriggerTrackStore* TriggerTrackStore(Int_t event);
58
59   /// Dump the clusters for a given event, sorted if so required
60   void DumpClusters(Int_t event, Bool_t sorted=kTRUE)  { return DumpRecPoints(event,sorted); }
61   void DumpRecPoints(Int_t event, Bool_t sorted=kTRUE);
62   void DumpDigits(Int_t event, Bool_t sorted=kTRUE);
63   void DumpTracks(Int_t event, Bool_t sorted=kFALSE);  
64   void DumpTrigger(Int_t event, const char* treeLetter="R");  
65   void DumpTriggerTracks(Int_t event, Bool_t sorted=kFALSE);
66   
67   // all the methods below are deprecated.
68   
69   // Sets all internal pointers to NULL without releasing the current runloader.
70   void Reset();
71   
72   Bool_t UseCurrentRunLoader();
73   
74   Int_t NumberOfEvents(TString filename, TString foldername);
75   
76   Int_t NumberOfParticles(TString filename, TString foldername, Int_t event);
77   TParticle* Particle(TString filename, TString foldername, Int_t event, Int_t particle);
78   
79   Int_t NumberOfTracks(TString filename, TString foldername, Int_t event);
80   Int_t NumberOfHits(TString filename, TString foldername, Int_t event, Int_t track);
81   AliMUONHit* Hit(TString filename, TString foldername, Int_t event, Int_t track, Int_t hit);
82   
83   Int_t NumberOfSDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
84   AliMUONDigit* SDigit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t sdigit);
85   
86   Int_t NumberOfDigits(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode);
87   AliMUONDigit* Digit(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cathode, Int_t digit);
88   
89   Int_t NumberOfRawClusters(TString filename, TString foldername, Int_t event, Int_t chamber);
90   AliMUONRawCluster* RawCluster(TString filename, TString foldername, Int_t event, Int_t chamber, Int_t cluster);
91   
92   Int_t NumberOfLocalTriggers(TString filename, TString foldername, Int_t event);
93   AliMUONLocalTrigger* LocalTrigger(TString filename, TString foldername, Int_t event, Int_t trigger);
94   
95   Bool_t SetFile(TString filename = "galice.root", TString foldername = "MUONFolder");
96   Bool_t GetEvent(Int_t event = 0);
97   
98   Int_t NumberOfParticles();
99   TParticle* Particle(Int_t particle);
100   
101   Int_t NumberOfTracks();
102   Int_t NumberOfHits(Int_t track);
103   AliMUONHit* Hit(Int_t track, Int_t hit);
104   
105   Int_t NumberOfSDigits(Int_t chamber, Int_t cathode);
106   AliMUONDigit* SDigit(Int_t chamber, Int_t cathode, Int_t sdigit);
107   
108   Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
109   AliMUONDigit* Digit(Int_t chamber, Int_t cathode, Int_t digit);
110   
111   Int_t NumberOfRawClusters(Int_t chamber);
112   AliMUONRawCluster* RawCluster(Int_t chamber, Int_t cluster);
113   
114   Int_t NumberOfLocalTriggers();
115   AliMUONLocalTrigger* LocalTrigger(Int_t trigger);
116   
117   Int_t NumberOfGlobalTriggers();
118   AliMUONGlobalTrigger* GlobalTrigger(Int_t trigger);
119   // Returns the name of the currently selected file.
120   
121   Int_t NumberOfRecTracks();
122   AliMUONTrack* RecTrack(Int_t rectrack);
123   
124   /// Returns the file name from which we are fetching data
125   TString CurrentFile() const { return ""; }
126   
127   /// Returns the name of the currently selected folder.
128   TString CurrentFolder() const { return ""; }
129   
130   /// Returns the number of the currently selected event.
131   Int_t   CurrentEvent() const { return 0; }
132   
133   /// Returns the currently selected track.
134   Int_t   CurrentTrack() const { return 0; }
135   
136   /// Returns the currently selected cathode in TreeS.
137   Int_t   CurrentSCathode() const { return 0; }
138   
139   /// Returns the currently selected cathode in TreeD.
140   Int_t   CurrentDCathode() const { return 0; }
141   
142  private:
143     
144   void DumpSorted(const AliMUONVStore& store) const;
145
146   Int_t LoadEvent(Int_t event);
147
148   void NtupleTrigger(const char* treeLetter);
149   
150   /// Not implemented
151   AliMUONDataInterface(const AliMUONDataInterface& rhs);
152   /// Not implemented
153   AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
154
155 private:
156   
157   AliLoader* fLoader; //!< Tree accessor
158   AliMUONVDigitStore* fDigitStore; //!< current digit store (owner)
159   AliMUONVTriggerStore* fTriggerStore; //!< current trigger store (owner)
160   AliMUONVClusterStore* fClusterStore; //!< current cluster store (owner)
161   AliMUONVTrackStore* fTrackStore; //!< current track store (owner)
162   AliMUONVTriggerTrackStore* fTriggerTrackStore; //!< current trigger track store (owner)
163   Int_t fCurrentEvent; //!< Current event we've read in
164   Bool_t fIsValid; //!< whether we were initialized properly or not
165   
166   static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
167   
168   ClassDef(AliMUONDataInterface, 0)  // An easy to use interface to MUON data
169 };
170     
171
172 #endif // ALI_MUON_DATA_INTERFACE_H