Coverity fix for uninitialized variables and check for returned null value
[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>
46df197d 20#include <TString.h>
48b32e42 21
e8636ba0 22class TIterator;
e9bef706 23class AliLoader;
e9bef706 24class AliMUONVStore;
e8636ba0 25class AliMUONVDigitStore;
26class AliMUONVClusterStore;
a202c2d2 27class AliMUONVTriggerStore;
e8636ba0 28class AliMUONVDigit;
2060b217 29class AliMUONVCluster;
e8636ba0 30class AliMUONLocalTrigger;
31class AliMUONRegionalTrigger;
32class AliMUONGlobalTrigger;
e8636ba0 33
48b32e42 34
48b32e42 35class AliMUONDataInterface : public TObject
36{
e8636ba0 37public:
554b38a6 38
a202c2d2 39 AliMUONDataInterface(const char* filename="galice.root");
40 virtual ~AliMUONDataInterface();
41
e8636ba0 42 /// Returns true if the data interface was able to open the root file correctly.
43 Bool_t IsValid() const { return fIsValid; };
a202c2d2 44
e9bef706 45 void Open(const char* filename);
a202c2d2 46
a202c2d2 47 Int_t NumberOfEvents() const;
e8636ba0 48
46df197d 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).
e8636ba0 52 Int_t CurrentEvent() const { return fCurrentEvent; }
a202c2d2 53
e9bef706 54 AliMUONVDigitStore* DigitStore(Int_t event);
55 AliMUONVClusterStore* ClusterStore(Int_t event);
e9bef706 56 AliMUONVTriggerStore* TriggerStore(Int_t event, const char* treeLetter="R");
e9bef706 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);
e9bef706 62 void DumpTrigger(Int_t event, const char* treeLetter="R");
a202c2d2 63
554b38a6 64 Bool_t GetEvent(Int_t event = 0);
65
e8636ba0 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);
554b38a6 73 Int_t NumberOfDigits(Int_t chamber, Int_t cathode);
e8636ba0 74 AliMUONVDigit* Digit(Int_t chamber, Int_t cathode, Int_t index);
554b38a6 75 Int_t NumberOfRawClusters(Int_t chamber);
2060b217 76 AliMUONVCluster* RawCluster(Int_t chamber, Int_t index);
554b38a6 77 Int_t NumberOfLocalTriggers();
e8636ba0 78 AliMUONLocalTrigger* LocalTrigger(Int_t index);
79 Int_t NumberOfRegionalTriggers();
80 AliMUONRegionalTrigger* RegionalTrigger(Int_t index);
81 AliMUONGlobalTrigger* GlobalTrigger();
554b38a6 82
e8636ba0 83private:
84
44c98559 85 /// The various identifiers for the type of iterator constructed.
e8636ba0 86 enum IteratorType
87 {
44c98559 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.
44c98559 92 kLocalTriggerIterator, ///< An iterator for iterating over reconstructed local triggers.
61fed964 93 kRegionalTriggerIterator ///< An iterator for iterating over reconstructed regional triggers.
e8636ba0 94 };
a202c2d2 95
e9bef706 96 void DumpSorted(const AliMUONVStore& store) const;
97
e8636ba0 98 Bool_t LoadEvent(Int_t event);
e9bef706 99
100 void NtupleTrigger(const char* treeLetter);
a202c2d2 101
e8636ba0 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
71a2d3aa 110 /// Not implemented
554b38a6 111 AliMUONDataInterface(const AliMUONDataInterface& rhs);
71a2d3aa 112 /// Not implemented
554b38a6 113 AliMUONDataInterface& operator=(const AliMUONDataInterface& rhs);
e8636ba0 114
e9bef706 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)
e9bef706 120 Int_t fCurrentEvent; //!< Current event we've read in
46df197d 121 TString fTreeLetter; //!< The tree letter used in the last call to TriggerStore().
e9bef706 122 Bool_t fIsValid; //!< whether we were initialized properly or not
123
e8636ba0 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
e9bef706 130 static Int_t fgInstanceCounter; //!< To build unique folder name for each instance
554b38a6 131
e8636ba0 132 ClassDef(AliMUONDataInterface, 0) // An easy to use interface to MUON reconstructed data
a202c2d2 133};
554b38a6 134
48b32e42 135
e8636ba0 136#endif // ALIMUONDATAINTERFACE_H