Preprocessor with new DA
[u/mrichter/AliRoot.git] / MUON / AliMUONDataInterface.h
CommitLineData
e8636ba0 1#ifndef ALIMUONDATAINTERFACE_H
2#define ALIMUONDATAINTERFACE_H
30178c30 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
692de412 8//
3455463a 9/// \ingroup evaluation
692de412 10/// \class AliMUONDataInterface
a202c2d2 11/// \brief An easy to use interface to MUON data
48b32e42 12
e8636ba0 13// Author: Artur Szostak (University of Cape Town)
14// email: artursz@iafrica.com
a202c2d2 15//
16// Updated to MUON module w/o MUONData by Laurent Aphecetche, Subatech
17//
48b32e42 18
19#include <TObject.h>
48b32e42 20
e8636ba0 21class TIterator;
e9bef706 22class AliLoader;
e9bef706 23class AliMUONVStore;
e8636ba0 24class AliMUONVDigitStore;
25class AliMUONVClusterStore;
e9bef706 26class AliMUONVTrackStore;
a202c2d2 27class AliMUONVTriggerStore;
28class AliMUONVTriggerTrackStore;
e8636ba0 29class AliMUONVDigit;
2060b217 30class AliMUONVCluster;
554b38a6 31class AliMUONTrack;
e8636ba0 32class AliMUONLocalTrigger;
33class AliMUONRegionalTrigger;
34class AliMUONGlobalTrigger;
35class AliMUONTriggerTrack;
36
48b32e42 37
48b32e42 38class AliMUONDataInterface : public TObject
39{
e8636ba0 40public:
554b38a6 41
a202c2d2 42 AliMUONDataInterface(const char* filename="galice.root");
43 virtual ~AliMUONDataInterface();
44
e8636ba0 45 /// Returns true if the data interface was able to open the root file correctly.
46 Bool_t IsValid() const { return fIsValid; };
a202c2d2 47
e9bef706 48 void Open(const char* filename);
a202c2d2 49
a202c2d2 50 Int_t NumberOfEvents() const;
e8636ba0 51
52 /// Returns the index number of the current event as used int GetEvent(Int_t).
53 Int_t CurrentEvent() const { return fCurrentEvent; }
a202c2d2 54
e9bef706 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);
a202c2d2 68
554b38a6 69 Bool_t GetEvent(Int_t event = 0);
70
e8636ba0 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);
554b38a6 78 Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
e8636ba0 79 AliMUONVDigit* Digit(Int_t chamber, Int_t cathode, Int_t index);
554b38a6 80 Int_t NumberOfRawClusters(Int_t chamber);
2060b217 81 AliMUONVCluster* RawCluster(Int_t chamber, Int_t index);
e8636ba0 82 Int_t NumberOfTracks();
83 AliMUONTrack* Track(Int_t index);
554b38a6 84 Int_t NumberOfLocalTriggers();
e8636ba0 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);
554b38a6 91
e8636ba0 92private:
93
44c98559 94 /// The various identifiers for the type of iterator constructed.
e8636ba0 95 enum IteratorType
96 {
44c98559 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.
e8636ba0 105 };
a202c2d2 106
e9bef706 107 void DumpSorted(const AliMUONVStore& store) const;
108
e8636ba0 109 Bool_t LoadEvent(Int_t event);
e9bef706 110
111 void NtupleTrigger(const char* treeLetter);
a202c2d2 112
e8636ba0 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
71a2d3aa 121 /// Not implemented
554b38a6 122 AliMUONDataInterface(const AliMUONDataInterface& rhs);
71a2d3aa 123 /// Not implemented
554b38a6 124 AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
e8636ba0 125
e9bef706 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
e8636ba0 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
e9bef706 142 static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
554b38a6 143
e8636ba0 144 ClassDef(AliMUONDataInterface, 0) // An easy to use interface to MUON reconstructed data
a202c2d2 145};
554b38a6 146
48b32e42 147
e8636ba0 148#endif // ALIMUONDATAINTERFACE_H