]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTOfflineInterface.h
Adding event modulo option to all components.
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTOfflineInterface.h
1 // -*- Mode: C++ -*-
2 // $Id$
3
4 #ifndef ALIHLTOFFLINEINTERFACE_H
5 #define ALIHLTOFFLINEINTERFACE_H
6 /* This file is property of and copyright by the ALICE HLT Project        * 
7  * ALICE Experiment at CERN, All rights reserved.                         *
8  * See cxx source for full Copyright notice                               */
9
10 /** @file   AliHLTOfflineInterface.h
11     @author Matthias Richter
12     @date   
13     @brief  the HLT interface to AliRoot
14 */
15
16 // see below for class documentation
17 // or
18 // refer to README to build package
19 // or
20 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
21
22 #include <TObject.h>
23 #include <TList.h>
24
25 class AliRunLoader;
26 class AliRawReader;
27 class AliESDEvent;
28 class TTree;
29
30 /******************************************************************************/
31
32 /**
33  * @class AliHLTOfflineInterface
34  * The class implements the basic interface to the AliRoot objects during
35  * reconstructions.
36  * It serves as a base class for offline source and sink interface components
37  * and provides access methods for the AliRunLoader, AliRawReader and AliESDEvent
38  * objects. The AliRunLoader and the AliRawReader are fixed during one run,
39  * while the AliESDEvent object will be changed from event to event.<br>
40  * \em Note: The digits and clusters trees are not available through this
41  * interface class as they are completetly detector (AliLoader) dependend.
42  *
43  * @note This class is only used for the @ref alihlt_system.
44  *
45  * @ingroup alihlt_system
46  */
47 class AliHLTOfflineInterface : public TObject {
48  public:
49   /** standard constructor */
50   AliHLTOfflineInterface();
51   /** constructor
52    *  @param pRunLoader   pointer to AliRoot run loader
53    *  @param pRawReader   pointer to AliRoot raw reader
54    */
55   AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader);
56   /** destructor */
57   virtual ~AliHLTOfflineInterface();
58
59   /**
60    * Get the AliRoot run loader.
61    */
62   AliRunLoader* GetRunLoader() const;
63
64   /**
65    * Get the AliRoot raw reader
66    */
67   AliRawReader* GetRawReader() const;
68
69   /**
70    * Set AliRoot ESD for the current event.
71    */
72   int SetESD(Int_t eventNo, AliESDEvent* pESD);
73
74   /**
75    * Get the AliRoot ESD
76    */
77   AliESDEvent* GetESD() const;
78
79   /**
80    * Set AliRoot external params.
81    *
82    * @param runLoader     the AliRoot runloader
83    * @param rawReader     the AliRoot RawReader
84    * @return neg. error code if failed 
85    */
86   int SetParams(AliRunLoader* runLoader, AliRawReader* rawReader);
87
88   /**
89    * Reset AliRoot internal params.
90    */
91   int Reset();
92
93   /**
94    * Set AliRoot external params.
95    * This method works on the global list.
96    * @param runLoader     the AliRoot runloader
97    * @param rawReader     the AliRoot RawReader
98    * @return neg. error code if failed 
99    */
100   static int SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader);
101
102   /**
103    * Fill ESD for one event.
104    * Fill the ESD with the previously reconstructed data. It must be implmented
105    * by the child class.
106    * @param eventNo       event No. \em Note: this is an internal enumeration of the
107    *                      processed events.
108    * @param runLoader     the AliRoot runloader
109    * @param esd           an AliESDEvent instance
110    * @return neg. error code if failed 
111    */
112   virtual int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd)=0;
113
114   /**
115    * Fill ESD for one event.
116    * The FillESD method of all active AliHLTOfflineDataSink's is called in
117    * order to fill the ESD with the previously reconstructed data. This method
118    * works on the global list.
119    * @param eventNo       event No. \em Note: this is an internal enumeration of the
120    *                      processed events.
121    * @param runLoader     the AliRoot runloader
122    * @param esd           an AliESDEvent instance
123    * @return neg. error code if failed 
124    */
125   static int FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
126
127   /**
128    * Reset AliRoot internal params of all active components.
129    * This method works on the global list.
130    */
131   static int ResetComponents();
132
133 protected:
134   /**
135    * Register an OfflineInterface.
136    * @param me            instance of AliHLTOfflineInterface
137    * @return neg. error code if failed
138    */
139   static int Register(AliHLTOfflineInterface* me);
140
141   /**
142    * Unregister  an OfflineInterface.
143    * @param me            instance of AliHLTOfflineInterface
144    * @return neg. error code if failed
145    */
146   static int Unregister(AliHLTOfflineInterface* me);
147
148  private:
149   /** copy constructor prohibited */
150   AliHLTOfflineInterface(const AliHLTOfflineInterface&);
151   /** assignment operator prohibited */
152   AliHLTOfflineInterface& operator=(const AliHLTOfflineInterface&);
153
154   /** global AliRoot run loader instance (for all components) */
155   static AliRunLoader* fgpRunLoader;                              //! transient
156   /** global AliRoot raw reader instance (for all components) */
157   static AliRawReader* fgpRawReader;                              //! transient
158
159   /** private AliRoot run loader instance */
160   AliRunLoader* fpRunLoader;                                      //! transient
161   /** private AliRoot raw reader instance */
162   AliRawReader* fpRawReader;                                      //! transient
163   /** AliRoot HLT ESD instance */
164   AliESDEvent* fpESD;                                                  //! transient
165
166   /** the list of active interfaces */
167   static AliHLTOfflineInterface* fAnchor;                         //! transient
168
169   /** next element in the list */
170   AliHLTOfflineInterface* fpNext;                                 //! transient
171
172   /** the current element */
173   static AliHLTOfflineInterface* fCurrent;                        //! transient
174
175   /** number of interfaces */
176   static int fCount;                                              //! see above
177
178   ClassDef(AliHLTOfflineInterface, 3);
179 };
180
181 #endif