3 /**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
6 * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
7 * for The ALICE Off-line Project. *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
18 /** @file AliHLTOfflineInterface.cxx
19 @author Matthias Richter
21 @brief the HLT interface to AliRoot
24 #include "AliHLTOfflineInterface.h"
25 #include "AliHLTLogging.h"
27 /** ROOT macro for the implementation of ROOT specific class methods */
28 ClassImp(AliHLTOfflineInterface)
30 AliHLTOfflineInterface::AliHLTOfflineInterface()
36 // see header file for class documentation
38 // refer to README to build package
40 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
43 AliHLTOfflineInterface* AliHLTOfflineInterface::fAnchor=NULL;
44 AliHLTOfflineInterface* AliHLTOfflineInterface::fCurrent=NULL;
45 int AliHLTOfflineInterface::fCount=0;
46 AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL;
47 AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL;
49 AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader)
51 fpRunLoader(pRunLoader),
52 fpRawReader(pRawReader),
57 AliHLTOfflineInterface::AliHLTOfflineInterface(const AliHLTOfflineInterface&)
64 // see header file for class documentation
65 //HLTFatal("copy constructor untested");
68 AliHLTOfflineInterface& AliHLTOfflineInterface::operator=(const AliHLTOfflineInterface&)
70 // see header file for class documentation
71 //HLTFatal("assignment operator untested");
75 AliHLTOfflineInterface::~AliHLTOfflineInterface()
79 AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const
81 return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader;
84 AliRawReader* AliHLTOfflineInterface::GetRawReader() const
86 return fpRawReader!=NULL?fpRawReader:fgpRawReader;
89 int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESD* pESD)
95 AliESD* AliHLTOfflineInterface::GetESD() const
100 int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader)
102 // see header file for class documentation
104 if (fpRunLoader!=NULL && fpRunLoader!=runLoader) {
105 //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader);
107 fpRunLoader=runLoader;
108 if (fpRawReader!=NULL && fpRawReader!=rawReader) {
109 //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader);
111 fpRawReader=rawReader;
115 int AliHLTOfflineInterface::Reset()
117 // see header file for class documentation
125 int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader)
127 // see header file for class documentation
131 fgpRunLoader=runLoader;
132 fgpRawReader=rawReader;
133 AliHLTOfflineInterface* pCurrent=fAnchor;
134 while (pCurrent!=NULL) {
136 if (pCurrent) iLocal=pCurrent->SetParams(runLoader, rawReader);
138 log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
139 "parameter initialization failed for component %p with result %d", pCurrent, iLocal);
140 if (iResult>=0) iResult=iLocal;
143 pCurrent=pCurrent->fpNext;
146 // log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
147 // "parameters set to %d offline interface component(s)", count);
152 int AliHLTOfflineInterface::ResetComponents()
154 // see header file for class documentation
156 AliHLTOfflineInterface* pCurrent=fAnchor;
157 while (pCurrent!=NULL) {
159 if (pCurrent) iLocal=pCurrent->Reset();
161 if (iResult>=0) iResult=iLocal;
163 pCurrent=pCurrent->fpNext;
168 int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd)
170 // see header file for class documentation
172 AliHLTOfflineInterface* pCurrent=fAnchor;
173 while (pCurrent!=NULL) {
176 pCurrent->SetESD(eventNo, esd);
177 if (pCurrent->GetRunLoader()!=runLoader) {
178 //HLTWarning("runLoader missmatch: component %p was reconstructed with runLoader %p, but got %p now", pCurrent, pCurrent->GetRunLoader(), runLoader);
180 iLocal=pCurrent->FillESD(eventNo, runLoader, esd);
183 if (iResult>=0) iResult=iLocal;
185 pCurrent=pCurrent->fpNext;
190 int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me)
192 // see header file for function documentation
204 int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me)
206 // see header file for function documentation
209 AliHLTOfflineInterface* prev=NULL;
210 AliHLTOfflineInterface* handler=fAnchor;
211 while (handler!=NULL && handler!=me) {
213 handler=handler->fpNext;
217 fAnchor=handler->fpNext;
219 prev->fpNext=handler->fpNext;