]>
Commit | Line | Data |
---|---|---|
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 | #include <TString.h> | |
21 | ||
22 | class TIterator; | |
23 | class AliLoader; | |
24 | class AliMUONVStore; | |
25 | class AliMUONVDigitStore; | |
26 | class AliMUONVClusterStore; | |
27 | class AliMUONVTriggerStore; | |
28 | class AliMUONVDigit; | |
29 | class AliMUONVCluster; | |
30 | class AliMUONLocalTrigger; | |
31 | class AliMUONRegionalTrigger; | |
32 | class AliMUONGlobalTrigger; | |
33 | ||
34 | ||
35 | class AliMUONDataInterface : public TObject | |
36 | { | |
37 | public: | |
38 | ||
39 | AliMUONDataInterface(const char* filename="galice.root"); | |
40 | virtual ~AliMUONDataInterface(); | |
41 | ||
42 | /// Returns true if the data interface was able to open the root file correctly. | |
43 | Bool_t IsValid() const { return fIsValid; }; | |
44 | ||
45 | void Open(const char* filename); | |
46 | ||
47 | Int_t NumberOfEvents() const; | |
48 | ||
49 | /// Returns the index number of the current event loaded. | |
50 | /// This is the event number as was used in the last calls to DigitStore(Int_t), | |
51 | /// ClusterStore(Int_t), TriggerStore(Int_t) or GetEvent(Int_t). | |
52 | Int_t CurrentEvent() const { return fCurrentEvent; } | |
53 | ||
54 | AliMUONVDigitStore* DigitStore(Int_t event); | |
55 | AliMUONVClusterStore* ClusterStore(Int_t event); | |
56 | AliMUONVTriggerStore* TriggerStore(Int_t event, const char* treeLetter="R"); | |
57 | ||
58 | /// Dump the clusters for a given event, sorted if so required | |
59 | void DumpClusters(Int_t event, Bool_t sorted=kTRUE) { return DumpRecPoints(event,sorted); } | |
60 | void DumpRecPoints(Int_t event, Bool_t sorted=kTRUE); | |
61 | void DumpDigits(Int_t event, Bool_t sorted=kTRUE); | |
62 | void DumpTrigger(Int_t event, const char* treeLetter="R"); | |
63 | ||
64 | Bool_t GetEvent(Int_t event = 0); | |
65 | ||
66 | // Note the following methods can be extremely slow. Remember they are only | |
67 | // here for end user convenience for his/her small tests and macros. | |
68 | // If you want speed then don't use these methods. If you really want peak | |
69 | // performance then you should be talking to the AliRunLoader and Store | |
70 | // objects directly. | |
71 | Int_t NumberOfDigits(Int_t detElemId); | |
72 | AliMUONVDigit* Digit(Int_t detElemId, Int_t index); | |
73 | Int_t NumberOfDigits(Int_t chamber, Int_t cathode); | |
74 | AliMUONVDigit* Digit(Int_t chamber, Int_t cathode, Int_t index); | |
75 | Int_t NumberOfRawClusters(Int_t chamber); | |
76 | AliMUONVCluster* RawCluster(Int_t chamber, Int_t index); | |
77 | Int_t NumberOfLocalTriggers(); | |
78 | AliMUONLocalTrigger* LocalTrigger(Int_t index); | |
79 | Int_t NumberOfRegionalTriggers(); | |
80 | AliMUONRegionalTrigger* RegionalTrigger(Int_t index); | |
81 | AliMUONGlobalTrigger* GlobalTrigger(); | |
82 | ||
83 | private: | |
84 | ||
85 | /// The various identifiers for the type of iterator constructed. | |
86 | enum IteratorType | |
87 | { | |
88 | kNoIterator, ///< No iterator was constructed. | |
89 | kDigitIteratorByDetectorElement, ///< A digit iterator for iterating over detector elements. | |
90 | kDigitIteratorByChamberAndCathode, ///< A digit iterator for iterating over chambers and cathodes. | |
91 | kRawClusterIterator, ///< A raw cluster iterator. | |
92 | kLocalTriggerIterator, ///< An iterator for iterating over reconstructed local triggers. | |
93 | kRegionalTriggerIterator ///< An iterator for iterating over reconstructed regional triggers. | |
94 | }; | |
95 | ||
96 | void DumpSorted(const AliMUONVStore& store) const; | |
97 | ||
98 | Bool_t LoadEvent(Int_t event); | |
99 | ||
100 | void NtupleTrigger(const char* treeLetter); | |
101 | ||
102 | void ResetStores(); | |
103 | ||
104 | TIterator* GetIterator(IteratorType type, Int_t x = 0, Int_t y = 0); | |
105 | void ResetIterator(); | |
106 | ||
107 | Int_t CountObjects(TIterator* iter); | |
108 | TObject* FetchObject(TIterator* iter, Int_t index); | |
109 | ||
110 | /// Not implemented | |
111 | AliMUONDataInterface(const AliMUONDataInterface& rhs); | |
112 | /// Not implemented | |
113 | AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs); | |
114 | ||
115 | ||
116 | AliLoader* fLoader; //!< Tree accessor | |
117 | AliMUONVDigitStore* fDigitStore; //!< current digit store (owner) | |
118 | AliMUONVTriggerStore* fTriggerStore; //!< current trigger store (owner) | |
119 | AliMUONVClusterStore* fClusterStore; //!< current cluster store (owner) | |
120 | Int_t fCurrentEvent; //!< Current event we've read in | |
121 | TString fTreeLetter; //!< The tree letter used in the last call to TriggerStore(). | |
122 | Bool_t fIsValid; //!< whether we were initialized properly or not | |
123 | ||
124 | IteratorType fCurrentIteratorType; //!< The type of iterator that is currently set. | |
125 | Int_t fCurrentIndex; //!< A current index number maintained for certain iteration operations. | |
126 | Int_t fDataX; //!< Extra data parameter about the iterator, can be the chamber number or detector element. | |
127 | Int_t fDataY; //!< Extra data parameter about the iterator, can be the cathode number. | |
128 | TIterator* fIterator; //!< Iterator for various iteration operations. | |
129 | ||
130 | static Int_t fgInstanceCounter; //!< To build unique folder name for each instance | |
131 | ||
132 | ClassDef(AliMUONDataInterface, 0) // An easy to use interface to MUON reconstructed data | |
133 | }; | |
134 | ||
135 | ||
136 | #endif // ALIMUONDATAINTERFACE_H |