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