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 TList AliHLTOfflineInterface::fgList;
44 TObjLink* AliHLTOfflineInterface::fgCurrentLnk=NULL;
45 AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL;
46 AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL;
48 AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader)
50 fpRunLoader(pRunLoader),
51 fpRawReader(pRawReader),
56 AliHLTOfflineInterface::AliHLTOfflineInterface(const AliHLTOfflineInterface&)
63 // see header file for class documentation
64 //HLTFatal("copy constructor untested");
67 AliHLTOfflineInterface& AliHLTOfflineInterface::operator=(const AliHLTOfflineInterface&)
69 // see header file for class documentation
70 //HLTFatal("assignment operator untested");
74 AliHLTOfflineInterface::~AliHLTOfflineInterface()
78 AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const
80 return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader;
83 AliRawReader* AliHLTOfflineInterface::GetRawReader() const
85 return fpRawReader!=NULL?fpRawReader:fgpRawReader;
88 int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESD* pESD)
94 AliESD* AliHLTOfflineInterface::GetESD() const
99 int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader)
101 // see header file for class documentation
103 if (fpRunLoader!=NULL && fpRunLoader!=runLoader) {
104 //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader);
106 fpRunLoader=runLoader;
107 if (fpRawReader!=NULL && fpRawReader!=rawReader) {
108 //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader);
110 fpRawReader=rawReader;
114 int AliHLTOfflineInterface::Reset()
116 // see header file for class documentation
124 int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader)
126 // see header file for class documentation
130 fgpRunLoader=runLoader;
131 fgpRawReader=rawReader;
132 fgCurrentLnk=fgList.FirstLink();
133 while (fgCurrentLnk!=NULL) {
134 AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject());
136 if (pComponent) iLocal=pComponent->SetParams(runLoader, rawReader);
138 log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__,
139 "parameter initialization failed for component %p with result %d", pComponent, iLocal);
140 if (iResult>=0) iResult=iLocal;
143 fgCurrentLnk=fgCurrentLnk->Next();
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 fgCurrentLnk=fgList.FirstLink();
157 while (fgCurrentLnk!=NULL) {
158 AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject());
160 if (pComponent) iLocal=pComponent->Reset();
162 if (iResult>=0) iResult=iLocal;
164 fgCurrentLnk=fgCurrentLnk->Next();
169 int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd)
171 // see header file for class documentation
173 fgCurrentLnk=fgList.FirstLink();
174 while (fgCurrentLnk!=NULL) {
175 AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject());
178 pComponent->SetESD(eventNo, esd);
179 if (pComponent->GetRunLoader()!=runLoader) {
180 //HLTWarning("runLoader missmatch: component %p was reconstructed with runLoader %p, but got %p now", pComponent, pComponent->GetRunLoader(), runLoader);
182 iLocal=pComponent->FillESD(eventNo, runLoader, esd);
185 if (iResult>=0) iResult=iLocal;
187 fgCurrentLnk=fgCurrentLnk->Next();
192 int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me)
194 // see header file for function documentation
196 if (fgList.FindObject(me->GetName())==NULL) {
203 int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me)
205 // see header file for function documentation
207 if (fgList.FindObject(me)!=NULL) {