]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/BASE/AliHLTOfflineInterface.h
- extended high-level component interface: header buffer before TObjects,
[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   /** not a valid copy constructor, defined according to effective C++ style */
57   AliHLTOfflineInterface(const AliHLTOfflineInterface&);
58   /** not a valid assignment op, but defined according to effective C++ style */
59   AliHLTOfflineInterface& operator=(const AliHLTOfflineInterface&);
60   /** destructor */
61   virtual ~AliHLTOfflineInterface();
62
63   /**
64    * Get the AliRoot run loader.
65    */
66   AliRunLoader* GetRunLoader() const;
67
68   /**
69    * Get the AliRoot raw reader
70    */
71   AliRawReader* GetRawReader() const;
72
73   /**
74    * Set AliRoot ESD for the current event.
75    */
76   int SetESD(Int_t eventNo, AliESDEvent* pESD);
77
78   /**
79    * Get the AliRoot ESD
80    */
81   AliESDEvent* GetESD() const;
82
83   /**
84    * Set AliRoot external params.
85    *
86    * @param runLoader     the AliRoot runloader
87    * @param rawReader     the AliRoot RawReader
88    * @return neg. error code if failed 
89    */
90   int SetParams(AliRunLoader* runLoader, AliRawReader* rawReader);
91
92   /**
93    * Reset AliRoot internal params.
94    */
95   int Reset();
96
97   /**
98    * Set AliRoot external params.
99    * This method works on the global list.
100    * @param runLoader     the AliRoot runloader
101    * @param rawReader     the AliRoot RawReader
102    * @return neg. error code if failed 
103    */
104   static int SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader);
105
106   /**
107    * Fill ESD for one event.
108    * Fill the ESD with the previously reconstructed data. It must be implmented
109    * by the child class.
110    * @param eventNo       event No. \em Note: this is an internal enumeration of the
111    *                      processed events.
112    * @param runLoader     the AliRoot runloader
113    * @param esd           an AliESDEvent instance
114    * @return neg. error code if failed 
115    */
116   virtual int FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd)=0;
117
118   /**
119    * Fill ESD for one event.
120    * The FillESD method of all active AliHLTOfflineDataSink's is called in
121    * order to fill the ESD with the previously reconstructed data. This method
122    * works on the global list.
123    * @param eventNo       event No. \em Note: this is an internal enumeration of the
124    *                      processed events.
125    * @param runLoader     the AliRoot runloader
126    * @param esd           an AliESDEvent instance
127    * @return neg. error code if failed 
128    */
129   static int FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd);
130
131   /**
132    * Reset AliRoot internal params of all active components.
133    * This method works on the global list.
134    */
135   static int ResetComponents();
136
137 protected:
138   /**
139    * Register an OfflineInterface.
140    * @param me            instance of AliHLTOfflineInterface
141    * @return neg. error code if failed
142    */
143   static int Register(AliHLTOfflineInterface* me);
144
145   /**
146    * Unregister  an OfflineInterface.
147    * @param me            instance of AliHLTOfflineInterface
148    * @return neg. error code if failed
149    */
150   static int Unregister(AliHLTOfflineInterface* me);
151
152  private:
153   /** global AliRoot run loader instance (for all components) */
154   static AliRunLoader* fgpRunLoader;                              //! transient
155   /** global AliRoot raw reader instance (for all components) */
156   static AliRawReader* fgpRawReader;                              //! transient
157
158   /** private AliRoot run loader instance */
159   AliRunLoader* fpRunLoader;                                      //! transient
160   /** private AliRoot raw reader instance */
161   AliRawReader* fpRawReader;                                      //! transient
162   /** AliRoot HLT ESD instance */
163   AliESDEvent* fpESD;                                                  //! transient
164
165   /** the list of active interfaces */
166   static AliHLTOfflineInterface* fAnchor;                         //! transient
167
168   /** next element in the list */
169   AliHLTOfflineInterface* fpNext;                                 //! transient
170
171   /** the current element */
172   static AliHLTOfflineInterface* fCurrent;                        //! transient
173
174   /** number of interfaces */
175   static int fCount;                                              //! see above
176
177   ClassDef(AliHLTOfflineInterface, 3);
178 };
179
180 #endif