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