]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDataInterface.h
Using common definition of gas mixture ArCO280. In the old defintion of ArCO2 (medium...
[u/mrichter/AliRoot.git] / MUON / AliMUONDataInterface.h
1 #ifndef ALIMUONDATAINTERFACE_H
2 #define ALIMUONDATAINTERFACE_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 (University of Cape Town)
14 //  email: artursz@iafrica.com
15 //
16 // Updated to MUON module w/o MUONData by Laurent Aphecetche, Subatech
17 //
18
19 #include <TObject.h>
20
21 class TIterator;
22 class AliLoader;
23 class AliMUONVStore;
24 class AliMUONVDigitStore;
25 class AliMUONVClusterStore;
26 class AliMUONVTrackStore;
27 class AliMUONVTriggerStore;
28 class AliMUONVTriggerTrackStore;
29 class AliMUONVDigit;
30 class AliMUONRawCluster;
31 class AliMUONTrack;
32 class AliMUONLocalTrigger;
33 class AliMUONRegionalTrigger;
34 class AliMUONGlobalTrigger;
35 class AliMUONTriggerTrack;
36
37
38 class AliMUONDataInterface : public TObject
39 {
40 public:
41   
42   AliMUONDataInterface(const char* filename="galice.root");
43   virtual ~AliMUONDataInterface();
44   
45   /// Returns true if the data interface was able to open the root file correctly.
46   Bool_t IsValid() const { return fIsValid; };
47
48   void Open(const char* filename);
49
50   Int_t NumberOfEvents() const;
51   
52   /// Returns the index number of the current event as used int GetEvent(Int_t).
53   Int_t   CurrentEvent() const { return fCurrentEvent; }
54
55   AliMUONVDigitStore* DigitStore(Int_t event);  
56   AliMUONVClusterStore* ClusterStore(Int_t event);
57   AliMUONVTrackStore* TrackStore(Int_t event);
58   AliMUONVTriggerStore* TriggerStore(Int_t event, const char* treeLetter="R");
59   AliMUONVTriggerTrackStore* TriggerTrackStore(Int_t event);
60
61   /// Dump the clusters for a given event, sorted if so required
62   void DumpClusters(Int_t event, Bool_t sorted=kTRUE)  { return DumpRecPoints(event,sorted); }
63   void DumpRecPoints(Int_t event, Bool_t sorted=kTRUE);
64   void DumpDigits(Int_t event, Bool_t sorted=kTRUE);
65   void DumpTracks(Int_t event, Bool_t sorted=kFALSE);  
66   void DumpTrigger(Int_t event, const char* treeLetter="R");  
67   void DumpTriggerTracks(Int_t event, Bool_t sorted=kFALSE);
68   
69   Bool_t GetEvent(Int_t event = 0);
70   
71   // Note the following methods can be extremely slow. Remember they are only
72   // here for end user convenience for his/her small tests and macros.
73   // If you want speed then don't use these methods. If you really want peak
74   // performance then you should be talking to the AliRunLoader and Store
75   // objects directly.
76   Int_t NumberOfDigits(Int_t detElemId);
77   AliMUONVDigit* Digit(Int_t detElemId, Int_t index);
78   Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
79   AliMUONVDigit* Digit(Int_t chamber, Int_t cathode, Int_t index);
80   Int_t NumberOfRawClusters(Int_t chamber);
81   AliMUONRawCluster* RawCluster(Int_t chamber, Int_t index);
82   Int_t NumberOfTracks();
83   AliMUONTrack* Track(Int_t index);
84   Int_t NumberOfLocalTriggers();
85   AliMUONLocalTrigger* LocalTrigger(Int_t index);
86   Int_t NumberOfRegionalTriggers();
87   AliMUONRegionalTrigger* RegionalTrigger(Int_t index);
88   AliMUONGlobalTrigger* GlobalTrigger();
89   Int_t NumberOfTriggerTracks();
90   AliMUONTriggerTrack* TriggerTrack(Int_t index);
91   
92 private:
93
94   enum IteratorType
95   {
96     kNoIterator,
97     kDigitIteratorByDetectorElement,
98     kDigitIteratorByChamberAndCathode,
99     kRawClusterIterator,
100     kTrackIterator,
101     kLocalTriggerIterator,
102     kRegionalTriggerIterator,
103     kTriggerTrackIterator
104   };
105     
106   void DumpSorted(const AliMUONVStore& store) const;
107
108   Bool_t LoadEvent(Int_t event);
109
110   void NtupleTrigger(const char* treeLetter);
111   
112   void ResetStores();
113   
114   TIterator* GetIterator(IteratorType type, Int_t x = 0, Int_t y = 0);
115   void ResetIterator();
116   
117   Int_t CountObjects(TIterator* iter);
118   TObject* FetchObject(TIterator* iter, Int_t index);
119   
120   /// Not implemented
121   AliMUONDataInterface(const AliMUONDataInterface& rhs);
122   /// Not implemented
123   AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
124   
125   
126   AliLoader* fLoader; //!< Tree accessor
127   AliMUONVDigitStore* fDigitStore; //!< current digit store (owner)
128   AliMUONVTriggerStore* fTriggerStore; //!< current trigger store (owner)
129   AliMUONVClusterStore* fClusterStore; //!< current cluster store (owner)
130   AliMUONVTrackStore* fTrackStore; //!< current track store (owner)
131   AliMUONVTriggerTrackStore* fTriggerTrackStore; //!< current trigger track store (owner)
132   Int_t fCurrentEvent; //!< Current event we've read in
133   Bool_t fIsValid; //!< whether we were initialized properly or not
134   
135   IteratorType fCurrentIteratorType;  //!< The type of iterator that is currently set.
136   Int_t fCurrentIndex;  //!< A current index number maintained for certain iteration operations.
137   Int_t fDataX; //!< Extra data parameter about the iterator, can be the chamber number or detector element.
138   Int_t fDataY; //!< Extra data parameter about the iterator, can be the cathode number.
139   TIterator* fIterator; //!< Iterator for various iteration operations.
140   
141   static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
142   
143   ClassDef(AliMUONDataInterface, 0)  // An easy to use interface to MUON reconstructed data
144 };
145     
146
147 #endif // ALIMUONDATAINTERFACE_H