]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/src/AliRoot/ADCStreamSource.hpp
Fixing some compilation problems.
[u/mrichter/AliRoot.git] / HLT / MUON / src / AliRoot / ADCStreamSource.hpp
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Author: Artur Szostak
4 // Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 //
6 ////////////////////////////////////////////////////////////////////////////////
7
8 #ifndef dHLT_ALIROOT_ADC_STREAM_SOURCE_HPP
9 #define dHLT_ALIROOT_ADC_STREAM_SOURCE_HPP
10
11 #include "TROOT.h"
12 #include "TObject.h"
13 #include "TString.h"
14 #include "AliRoot/ADCStream.hpp"
15
16 #include <vector>
17
18 namespace AliMUONHLT
19 {
20
21
22 class ADCStreamSource : public TObject
23 {
24 public:
25
26         ADCStreamSource();
27         virtual ~ADCStreamSource();
28
29         /* Fills the internal data structures from the specified file
30          */
31         void FillFromFile(const TString& filename, Int_t eventnumber);
32         
33         /* Fills the internal data structures from the specified directory.
34            FillFromFile is called for every file in the directory that is
35            prefixed with MUON_ and ends in .ddl
36          */
37         void FillFrom(const TString& directory, Int_t eventnumber);
38         
39         /* Same as the methods above except the directory name is created as
40            dirprefix + eventnumber, where eventnumber is looped from firstevent
41            to lastevent.
42          */
43         void FillFrom(const TString& dirprefix, UInt_t firstevent, UInt_t lastevent);
44         
45         /* Clears all the internal arrays.
46          */
47         virtual void Clear(Option_t* option = "");
48         
49         // Get methods.
50         Int_t CurrentStream()  const { return fCurrentStream; };
51         
52         /* Returns the number of ADC streams stored.
53          */
54         Int_t NumberOfStreams() const;
55         
56         /* Fetches the index'th ADC stream stored.
57            kTRUE is returned if the stream was found, kFALSE otherwise.
58          */
59         Bool_t GetStream(Int_t index) const;
60         
61         /* Fetches the first ADC stream stored.
62            kTRUE is returned if the stream was found, kFALSE otherwise.
63          */
64         Bool_t FirstStream() const;
65         
66         /* Fetches the next ADC stream stored following the currently selected one.
67            kTRUE is returned if the stream was found, kFALSE otherwise.
68          */
69         Bool_t NextStream() const;
70         
71         /* Returns the corresponding AliRoot event number for the current stream.
72            -1 is returned if no stream is selected.
73          */
74         Int_t EventNumber() const;
75         
76         /* Returns the current ADC stream selected.
77            kFALSE is returned if there is no stream selected.
78          */
79         Bool_t FetchStream(ADCStream& stream) const;
80         
81         /* Returns the index'th ADC stream.
82            kTRUE is returned if the stream was found, kFALSE otherwise.
83          */
84         Bool_t FetchStream(Int_t index, ADCStream& stream) const;
85         
86         /* Returns the current ADC stream selected.
87            A NULL pointer is returned if no ADC stream is selected.
88          */
89         const ADCStream* FetchStream() const;
90
91 private:
92
93         /* Adds a new ADCStream object to the internal arrays.
94          */
95         void AddStream(ADCStream& stream, UInt_t eventnumber);
96
97         mutable Int_t fCurrentStream;  //! The currently selected stream index.
98         
99
100 public:  // Unfortunately ROOT requires the following to be public.
101         
102         struct DataBlock
103         {
104                 virtual ~DataBlock() {};
105
106                 Int_t fEventNumber;  // Event number of the stream.
107                 ADCStream fStream;  // The ADC stream block.
108                 
109                 ClassDef(DataBlock, 1)  // Data per event.
110         };
111
112 private:
113
114         std::vector<DataBlock> fList;  // List of ADC streams.
115
116         ClassDef(ADCStreamSource, 1)  // The source of ADC stream data for dHLT.
117 };
118
119
120 } // AliMUONHLT
121
122 #endif // dHLT_ALIROOT_ADC_STREAM_SOURCE_HPP