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()
38 // see header file for class documentation
40 // refer to README to build package
42 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
45 AliHLTOfflineInterface* AliHLTOfflineInterface::fAnchor=NULL;
46 AliHLTOfflineInterface* AliHLTOfflineInterface::fCurrent=NULL;
47 int AliHLTOfflineInterface::fCount=0;
48 AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL;
49 AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL;
51 AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader)
53 fpRunLoader(pRunLoader),
54 fpRawReader(pRawReader),
60 AliHLTOfflineInterface::~AliHLTOfflineInterface()
64 AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const
66 return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader;
69 AliRawReader* AliHLTOfflineInterface::GetRawReader() const
71 return fpRawReader!=NULL?fpRawReader:fgpRawReader;
74 int AliHLTOfflineInterface::SetESD(Int_t /*eventNo*/, AliESDEvent* pESD)
80 AliESDEvent* AliHLTOfflineInterface::GetESD() const
85 int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader)
87 // see header file for class documentation
89 if (fpRunLoader!=NULL && fpRunLoader!=runLoader) {
90 //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader);
92 fpRunLoader=runLoader;
93 if (fpRawReader!=NULL && fpRawReader!=rawReader) {
94 //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader);
96 fpRawReader=rawReader;
100 int AliHLTOfflineInterface::Reset()
102 // see header file for class documentation
110 int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader)
112 // see header file for class documentation
116 fgpRunLoader=runLoader;
117 fgpRawReader=rawReader;
118 AliHLTOfflineInterface* pCurrent=fAnchor;
119 while (pCurrent!=NULL) {
121 if (pCurrent) iLocal=pCurrent->SetParams(runLoader, rawReader);
123 log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
124 "parameter initialization failed for component %p with result %d", pCurrent, iLocal);
125 if (iResult>=0) iResult=iLocal;
128 pCurrent=pCurrent->fpNext;
131 // log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
132 // "parameters set to %d offline interface component(s)", count);
137 int AliHLTOfflineInterface::ResetComponents()
139 // see header file for class documentation
141 AliHLTOfflineInterface* pCurrent=fAnchor;
142 while (pCurrent!=NULL) {
144 if (pCurrent) iLocal=pCurrent->Reset();
146 if (iResult>=0) iResult=iLocal;
148 pCurrent=pCurrent->fpNext;
153 int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd)
155 // see header file for class documentation
157 AliHLTOfflineInterface* pCurrent=fAnchor;
158 while (pCurrent!=NULL) {
161 pCurrent->SetESD(eventNo, esd);
162 if (pCurrent->GetRunLoader()!=runLoader) {
163 //HLTWarning("runLoader mismatch: component %p was reconstructed with runLoader %p, but got %p now", pCurrent, pCurrent->GetRunLoader(), runLoader);
165 iLocal=pCurrent->FillESD(eventNo, runLoader, esd);
168 if (iResult>=0) iResult=iLocal;
170 pCurrent=pCurrent->fpNext;
175 int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me)
177 // see header file for function documentation
189 int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me)
191 // see header file for function documentation
194 AliHLTOfflineInterface* prev=NULL;
195 AliHLTOfflineInterface* handler=fAnchor;
196 while (handler!=NULL && handler!=me) {
198 handler=handler->fpNext;
202 fAnchor=handler->fpNext;
204 prev->fpNext=handler->fpNext;