]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTOfflineInterface.cxx
minor fix: documentation/compilation warnings
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTOfflineInterface.cxx
CommitLineData
242bb794 1// $Id$
2
3/**************************************************************************
9be2600f 4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
242bb794 6 * *
9be2600f 7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
242bb794 9 * *
10 * Permission to use, copy, modify and distribute this software and its *
11 * documentation strictly for non-commercial purposes is hereby granted *
12 * without fee, provided that the above copyright notice appears in all *
13 * copies and that both the copyright notice and this permission notice *
14 * appear in the supporting documentation. The authors make no claims *
15 * about the suitability of this software for any purpose. It is *
16 * provided "as is" without express or implied warranty. *
17 **************************************************************************/
18
19/** @file AliHLTOfflineInterface.cxx
20 @author Matthias Richter
21 @date
22 @brief the HLT interface to AliRoot
23*/
24
25#include "AliHLTOfflineInterface.h"
8451168b 26#include "AliHLTLogging.h"
242bb794 27
28/** ROOT macro for the implementation of ROOT specific class methods */
29ClassImp(AliHLTOfflineInterface)
30
31AliHLTOfflineInterface::AliHLTOfflineInterface()
32 :
33 fpRunLoader(NULL),
34 fpRawReader(NULL),
79c114b5 35 fpESD(NULL),
36 fpNext(NULL)
242bb794 37{
38 // see header file for class documentation
39 // or
40 // refer to README to build package
41 // or
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
43}
44
7617ca1e 45AliHLTOfflineInterface* AliHLTOfflineInterface::fAnchor=NULL;
46AliHLTOfflineInterface* AliHLTOfflineInterface::fCurrent=NULL;
47int AliHLTOfflineInterface::fCount=0;
8451168b 48AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL;
49AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL;
242bb794 50
51AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader)
52 :
53 fpRunLoader(pRunLoader),
54 fpRawReader(pRawReader),
79c114b5 55 fpESD(NULL),
56 fpNext(NULL)
242bb794 57{
58}
59
60AliHLTOfflineInterface::AliHLTOfflineInterface(const AliHLTOfflineInterface&)
61 :
62 TObject(),
63 fpRunLoader(NULL),
64 fpRawReader(NULL),
79c114b5 65 fpESD(NULL),
66 fpNext(NULL)
242bb794 67{
68 // see header file for class documentation
69 //HLTFatal("copy constructor untested");
70}
71
72AliHLTOfflineInterface& AliHLTOfflineInterface::operator=(const AliHLTOfflineInterface&)
73{
74 // see header file for class documentation
75 //HLTFatal("assignment operator untested");
76 return *this;
77}
78
79AliHLTOfflineInterface::~AliHLTOfflineInterface()
80{
81}
82
8451168b 83AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const
242bb794 84{
8451168b 85 return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader;
242bb794 86}
87
8451168b 88AliRawReader* AliHLTOfflineInterface::GetRawReader() const
242bb794 89{
8451168b 90 return fpRawReader!=NULL?fpRawReader:fgpRawReader;
242bb794 91}
92
af885e0f 93int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESDEvent* pESD)
242bb794 94{
95 fpESD=pESD;
96 return 0;
97}
98
af885e0f 99AliESDEvent* AliHLTOfflineInterface::GetESD() const
242bb794 100{
101 return fpESD;
102}
103
104int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader)
105{
106 // see header file for class documentation
107 int iResult=0;
108 if (fpRunLoader!=NULL && fpRunLoader!=runLoader) {
109 //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader);
110 }
111 fpRunLoader=runLoader;
112 if (fpRawReader!=NULL && fpRawReader!=rawReader) {
113 //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader);
114 }
115 fpRawReader=rawReader;
116 return iResult;
117}
118
119int AliHLTOfflineInterface::Reset()
120{
121 // see header file for class documentation
122 int iResult=0;
123 fpRunLoader=NULL;
124 fpRawReader=NULL;
125 fpESD=NULL;
126 return iResult;
127}
128
129int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader)
130{
131 // see header file for class documentation
8451168b 132 AliHLTLogging log;
242bb794 133 int iResult=0;
8451168b 134 int count=0;
135 fgpRunLoader=runLoader;
136 fgpRawReader=rawReader;
7617ca1e 137 AliHLTOfflineInterface* pCurrent=fAnchor;
138 while (pCurrent!=NULL) {
242bb794 139 int iLocal=0;
7617ca1e 140 if (pCurrent) iLocal=pCurrent->SetParams(runLoader, rawReader);
242bb794 141 if (iLocal<0) {
8451168b 142 log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
7617ca1e 143 "parameter initialization failed for component %p with result %d", pCurrent, iLocal);
242bb794 144 if (iResult>=0) iResult=iLocal;
145 }
8451168b 146 count++;
7617ca1e 147 pCurrent=pCurrent->fpNext;
242bb794 148 }
8451168b 149 if (iResult>=0) {
90ebac25 150// log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
151// "parameters set to %d offline interface component(s)", count);
8451168b 152 }
242bb794 153 return iResult;
154}
155
156int AliHLTOfflineInterface::ResetComponents()
157{
158 // see header file for class documentation
159 int iResult=0;
7617ca1e 160 AliHLTOfflineInterface* pCurrent=fAnchor;
161 while (pCurrent!=NULL) {
242bb794 162 int iLocal=0;
7617ca1e 163 if (pCurrent) iLocal=pCurrent->Reset();
242bb794 164 if (iLocal<0) {
165 if (iResult>=0) iResult=iLocal;
166 }
7617ca1e 167 pCurrent=pCurrent->fpNext;
242bb794 168 }
169 return iResult;
170}
171
af885e0f 172int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd)
242bb794 173{
174 // see header file for class documentation
175 int iResult=0;
7617ca1e 176 AliHLTOfflineInterface* pCurrent=fAnchor;
177 while (pCurrent!=NULL) {
242bb794 178 int iLocal=0;
7617ca1e 179 if (pCurrent) {
180 pCurrent->SetESD(eventNo, esd);
181 if (pCurrent->GetRunLoader()!=runLoader) {
182 //HLTWarning("runLoader missmatch: component %p was reconstructed with runLoader %p, but got %p now", pCurrent, pCurrent->GetRunLoader(), runLoader);
8451168b 183 }
7617ca1e 184 iLocal=pCurrent->FillESD(eventNo, runLoader, esd);
8451168b 185 }
242bb794 186 if (iLocal<0) {
187 if (iResult>=0) iResult=iLocal;
188 }
7617ca1e 189 pCurrent=pCurrent->fpNext;
242bb794 190 }
191 return iResult;
192}
193
194int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me)
195{
196 // see header file for function documentation
197 int iResult=0;
7617ca1e 198 if (fAnchor==NULL) {
199 fAnchor=me;
242bb794 200 } else {
7617ca1e 201 me->fpNext=fAnchor;
202 fAnchor=me;
242bb794 203 }
7617ca1e 204 fCount++;
242bb794 205 return iResult;
206}
207
208int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me)
209{
210 // see header file for function documentation
211 int iResult=0;
7617ca1e 212 fCurrent=NULL;
213 AliHLTOfflineInterface* prev=NULL;
214 AliHLTOfflineInterface* handler=fAnchor;
215 while (handler!=NULL && handler!=me) {
216 prev=handler;
217 handler=handler->fpNext;
218 }
219 if (handler) {
220 if (prev==NULL) {
221 fAnchor=handler->fpNext;
222 } else {
223 prev->fpNext=handler->fpNext;
224 }
225 fCount--;
242bb794 226 }
227 return iResult;
228}