]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDataInterface.h
Initial classes for Lee Yang Zeroes from Naomi van der Kolk
[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   /// The various identifiers for the type of iterator constructed.
95   enum IteratorType
96   {
97     kNoIterator,  ///< No iterator was constructed.
98     kDigitIteratorByDetectorElement,  ///< A digit iterator for iterating over detector elements.
99     kDigitIteratorByChamberAndCathode,  ///< A digit iterator for iterating over chambers and cathodes.
100     kRawClusterIterator,  ///< A raw cluster iterator.
101     kTrackIterator,  ///< An iterator for iterating over reconstructed tracks.
102     kLocalTriggerIterator,  ///< An iterator for iterating over reconstructed local triggers.
103     kRegionalTriggerIterator,  ///< An iterator for iterating over reconstructed regional triggers.
104     kTriggerTrackIterator  ///< An iterator for iterating over reconstructed trigger tracks.
105   };
106     
107   void DumpSorted(const AliMUONVStore& store) const;
108
109   Bool_t LoadEvent(Int_t event);
110
111   void NtupleTrigger(const char* treeLetter);
112   
113   void ResetStores();
114   
115   TIterator* GetIterator(IteratorType type, Int_t x = 0, Int_t y = 0);
116   void ResetIterator();
117   
118   Int_t CountObjects(TIterator* iter);
119   TObject* FetchObject(TIterator* iter, Int_t index);
120   
121   /// Not implemented
122   AliMUONDataInterface(const AliMUONDataInterface& rhs);
123   /// Not implemented
124   AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
125   
126   
127   AliLoader* fLoader; //!< Tree accessor
128   AliMUONVDigitStore* fDigitStore; //!< current digit store (owner)
129   AliMUONVTriggerStore* fTriggerStore; //!< current trigger store (owner)
130   AliMUONVClusterStore* fClusterStore; //!< current cluster store (owner)
131   AliMUONVTrackStore* fTrackStore; //!< current track store (owner)
132   AliMUONVTriggerTrackStore* fTriggerTrackStore; //!< current trigger track store (owner)
133   Int_t fCurrentEvent; //!< Current event we've read in
134   Bool_t fIsValid; //!< whether we were initialized properly or not
135   
136   IteratorType fCurrentIteratorType;  //!< The type of iterator that is currently set.
137   Int_t fCurrentIndex;  //!< A current index number maintained for certain iteration operations.
138   Int_t fDataX; //!< Extra data parameter about the iterator, can be the chamber number or detector element.
139   Int_t fDataY; //!< Extra data parameter about the iterator, can be the cathode number.
140   TIterator* fIterator; //!< Iterator for various iteration operations.
141   
142   static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
143   
144   ClassDef(AliMUONDataInterface, 0)  // An easy to use interface to MUON reconstructed data
145 };
146     
147
148 #endif // ALIMUONDATAINTERFACE_H