3 /**************************************************************************
4 * This file is property of and copyright by the ALICE HLT Project *
5 * ALICE Experiment at CERN, All rights reserved. *
7 * Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 * for The ALICE HLT Project. *
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 **************************************************************************/
19 /** @file AliHLTOfflineInterface.cxx
20 @author Matthias Richter
22 @brief the HLT interface to AliRoot
25 #include "AliHLTOfflineInterface.h"
26 #include "AliHLTLogging.h"
28 /** ROOT macro for the implementation of ROOT specific class methods */
29 ClassImp(AliHLTOfflineInterface)
31 AliHLTOfflineInterface::AliHLTOfflineInterface()
37 // see header file for class documentation
39 // refer to README to build package
41 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
44 AliHLTOfflineInterface* AliHLTOfflineInterface::fAnchor=NULL;
45 AliHLTOfflineInterface* AliHLTOfflineInterface::fCurrent=NULL;
46 int AliHLTOfflineInterface::fCount=0;
47 AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL;
48 AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL;
50 AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader)
52 fpRunLoader(pRunLoader),
53 fpRawReader(pRawReader),
58 AliHLTOfflineInterface::AliHLTOfflineInterface(const AliHLTOfflineInterface&)
65 // see header file for class documentation
66 //HLTFatal("copy constructor untested");
69 AliHLTOfflineInterface& AliHLTOfflineInterface::operator=(const AliHLTOfflineInterface&)
71 // see header file for class documentation
72 //HLTFatal("assignment operator untested");
76 AliHLTOfflineInterface::~AliHLTOfflineInterface()
80 AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const
82 return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader;
85 AliRawReader* AliHLTOfflineInterface::GetRawReader() const
87 return fpRawReader!=NULL?fpRawReader:fgpRawReader;
90 int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESD* pESD)
96 AliESD* AliHLTOfflineInterface::GetESD() const
101 int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader)
103 // see header file for class documentation
105 if (fpRunLoader!=NULL && fpRunLoader!=runLoader) {
106 //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader);
108 fpRunLoader=runLoader;
109 if (fpRawReader!=NULL && fpRawReader!=rawReader) {
110 //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader);
112 fpRawReader=rawReader;
116 int AliHLTOfflineInterface::Reset()
118 // see header file for class documentation
126 int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader)
128 // see header file for class documentation
132 fgpRunLoader=runLoader;
133 fgpRawReader=rawReader;
134 AliHLTOfflineInterface* pCurrent=fAnchor;
135 while (pCurrent!=NULL) {
137 if (pCurrent) iLocal=pCurrent->SetParams(runLoader, rawReader);
139 log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
140 "parameter initialization failed for component %p with result %d", pCurrent, iLocal);
141 if (iResult>=0) iResult=iLocal;
144 pCurrent=pCurrent->fpNext;
147 // log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
148 // "parameters set to %d offline interface component(s)", count);
153 int AliHLTOfflineInterface::ResetComponents()
155 // see header file for class documentation
157 AliHLTOfflineInterface* pCurrent=fAnchor;
158 while (pCurrent!=NULL) {
160 if (pCurrent) iLocal=pCurrent->Reset();
162 if (iResult>=0) iResult=iLocal;
164 pCurrent=pCurrent->fpNext;
169 int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd)
171 // see header file for class documentation
173 AliHLTOfflineInterface* pCurrent=fAnchor;
174 while (pCurrent!=NULL) {
177 pCurrent->SetESD(eventNo, esd);
178 if (pCurrent->GetRunLoader()!=runLoader) {
179 //HLTWarning("runLoader missmatch: component %p was reconstructed with runLoader %p, but got %p now", pCurrent, pCurrent->GetRunLoader(), runLoader);
181 iLocal=pCurrent->FillESD(eventNo, runLoader, esd);
184 if (iResult>=0) iResult=iLocal;
186 pCurrent=pCurrent->fpNext;
191 int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me)
193 // see header file for function documentation
205 int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me)
207 // see header file for function documentation
210 AliHLTOfflineInterface* prev=NULL;
211 AliHLTOfflineInterface* handler=fAnchor;
212 while (handler!=NULL && handler!=me) {
214 handler=handler->fpNext;
218 fAnchor=handler->fpNext;
220 prev->fpNext=handler->fpNext;