]>
Commit | Line | Data |
---|---|---|
242bb794 | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: Matthias Richter <Matthias.Richter@ift.uib.no> * | |
7 | * for The ALICE Off-line Project. * | |
8 | * * | |
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 | **************************************************************************/ | |
17 | ||
18 | /** @file AliHLTOfflineInterface.cxx | |
19 | @author Matthias Richter | |
20 | @date | |
21 | @brief the HLT interface to AliRoot | |
22 | */ | |
23 | ||
24 | #include "AliHLTOfflineInterface.h" | |
8451168b | 25 | #include "AliHLTLogging.h" |
242bb794 | 26 | |
27 | /** ROOT macro for the implementation of ROOT specific class methods */ | |
28 | ClassImp(AliHLTOfflineInterface) | |
29 | ||
30 | AliHLTOfflineInterface::AliHLTOfflineInterface() | |
31 | : | |
32 | fpRunLoader(NULL), | |
33 | fpRawReader(NULL), | |
34 | fpESD(NULL) | |
35 | { | |
36 | // see header file for class documentation | |
37 | // or | |
38 | // refer to README to build package | |
39 | // or | |
40 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
41 | } | |
42 | ||
43 | TList AliHLTOfflineInterface::fgList; | |
44 | TObjLink* AliHLTOfflineInterface::fgCurrentLnk=NULL; | |
8451168b | 45 | AliRunLoader* AliHLTOfflineInterface::fgpRunLoader=NULL; |
46 | AliRawReader* AliHLTOfflineInterface::fgpRawReader=NULL; | |
242bb794 | 47 | |
48 | AliHLTOfflineInterface::AliHLTOfflineInterface(AliRunLoader* pRunLoader, AliRawReader* pRawReader) | |
49 | : | |
50 | fpRunLoader(pRunLoader), | |
51 | fpRawReader(pRawReader), | |
52 | fpESD(NULL) | |
53 | { | |
54 | } | |
55 | ||
56 | AliHLTOfflineInterface::AliHLTOfflineInterface(const AliHLTOfflineInterface&) | |
57 | : | |
58 | TObject(), | |
59 | fpRunLoader(NULL), | |
60 | fpRawReader(NULL), | |
61 | fpESD(NULL) | |
62 | { | |
63 | // see header file for class documentation | |
64 | //HLTFatal("copy constructor untested"); | |
65 | } | |
66 | ||
67 | AliHLTOfflineInterface& AliHLTOfflineInterface::operator=(const AliHLTOfflineInterface&) | |
68 | { | |
69 | // see header file for class documentation | |
70 | //HLTFatal("assignment operator untested"); | |
71 | return *this; | |
72 | } | |
73 | ||
74 | AliHLTOfflineInterface::~AliHLTOfflineInterface() | |
75 | { | |
76 | } | |
77 | ||
8451168b | 78 | AliRunLoader* AliHLTOfflineInterface::GetRunLoader() const |
242bb794 | 79 | { |
8451168b | 80 | return fpRunLoader!=NULL?fpRunLoader:fgpRunLoader; |
242bb794 | 81 | } |
82 | ||
8451168b | 83 | AliRawReader* AliHLTOfflineInterface::GetRawReader() const |
242bb794 | 84 | { |
8451168b | 85 | return fpRawReader!=NULL?fpRawReader:fgpRawReader; |
242bb794 | 86 | } |
87 | ||
88 | int AliHLTOfflineInterface::SetESD(Int_t eventNo, AliESD* pESD) | |
89 | { | |
90 | fpESD=pESD; | |
91 | return 0; | |
92 | } | |
93 | ||
94 | AliESD* AliHLTOfflineInterface::GetESD() const | |
95 | { | |
96 | return fpESD; | |
97 | } | |
98 | ||
99 | int AliHLTOfflineInterface::SetParams(AliRunLoader* runLoader, AliRawReader* rawReader) | |
100 | { | |
101 | // see header file for class documentation | |
102 | int iResult=0; | |
103 | if (fpRunLoader!=NULL && fpRunLoader!=runLoader) { | |
104 | //HLTWarning("overriding previous instance of Run Loader %p with %p", fpRunLoader, runLoader); | |
105 | } | |
106 | fpRunLoader=runLoader; | |
107 | if (fpRawReader!=NULL && fpRawReader!=rawReader) { | |
108 | //HLTWarning("overriding previous instance of RawReader %p with %p", fpRawReader, rawReader); | |
109 | } | |
110 | fpRawReader=rawReader; | |
111 | return iResult; | |
112 | } | |
113 | ||
114 | int AliHLTOfflineInterface::Reset() | |
115 | { | |
116 | // see header file for class documentation | |
117 | int iResult=0; | |
118 | fpRunLoader=NULL; | |
119 | fpRawReader=NULL; | |
120 | fpESD=NULL; | |
121 | return iResult; | |
122 | } | |
123 | ||
124 | int AliHLTOfflineInterface::SetParamsToComponents(AliRunLoader* runLoader, AliRawReader* rawReader) | |
125 | { | |
126 | // see header file for class documentation | |
8451168b | 127 | AliHLTLogging log; |
242bb794 | 128 | int iResult=0; |
8451168b | 129 | int count=0; |
130 | fgpRunLoader=runLoader; | |
131 | fgpRawReader=rawReader; | |
242bb794 | 132 | fgCurrentLnk=fgList.FirstLink(); |
133 | while (fgCurrentLnk!=NULL) { | |
134 | AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject()); | |
135 | int iLocal=0; | |
136 | if (pComponent) iLocal=pComponent->SetParams(runLoader, rawReader); | |
137 | if (iLocal<0) { | |
8451168b | 138 | log.LoggingVarargs(kHLTLogWarning, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__, |
139 | "parameter initialization failed for component %p with result %d", pComponent, iLocal); | |
242bb794 | 140 | if (iResult>=0) iResult=iLocal; |
141 | } | |
8451168b | 142 | count++; |
242bb794 | 143 | fgCurrentLnk=fgCurrentLnk->Next(); |
144 | } | |
8451168b | 145 | if (iResult>=0) { |
90ebac25 | 146 | // log.LoggingVarargs(kHLTLogInfo, "AliHLTOfflineInterface","SetParamsToComponents", __FILE__, __LINE__, |
147 | // "parameters set to %d offline interface component(s)", count); | |
8451168b | 148 | } |
242bb794 | 149 | return iResult; |
150 | } | |
151 | ||
152 | int AliHLTOfflineInterface::ResetComponents() | |
153 | { | |
154 | // see header file for class documentation | |
155 | int iResult=0; | |
156 | fgCurrentLnk=fgList.FirstLink(); | |
157 | while (fgCurrentLnk!=NULL) { | |
158 | AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject()); | |
159 | int iLocal=0; | |
160 | if (pComponent) iLocal=pComponent->Reset(); | |
161 | if (iLocal<0) { | |
162 | if (iResult>=0) iResult=iLocal; | |
163 | } | |
164 | fgCurrentLnk=fgCurrentLnk->Next(); | |
165 | } | |
166 | return iResult; | |
167 | } | |
168 | ||
8451168b | 169 | int AliHLTOfflineInterface::FillComponentESDs(int eventNo, AliRunLoader* runLoader, AliESD* esd) |
242bb794 | 170 | { |
171 | // see header file for class documentation | |
172 | int iResult=0; | |
173 | fgCurrentLnk=fgList.FirstLink(); | |
174 | while (fgCurrentLnk!=NULL) { | |
175 | AliHLTOfflineInterface* pComponent=reinterpret_cast<AliHLTOfflineInterface*>(fgCurrentLnk->GetObject()); | |
176 | int iLocal=0; | |
8451168b | 177 | if (pComponent) { |
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); | |
181 | } | |
182 | iLocal=pComponent->FillESD(eventNo, runLoader, esd); | |
183 | } | |
242bb794 | 184 | if (iLocal<0) { |
185 | if (iResult>=0) iResult=iLocal; | |
186 | } | |
187 | fgCurrentLnk=fgCurrentLnk->Next(); | |
188 | } | |
189 | return iResult; | |
190 | } | |
191 | ||
192 | int AliHLTOfflineInterface::Register(AliHLTOfflineInterface* me) | |
193 | { | |
194 | // see header file for function documentation | |
195 | int iResult=0; | |
196 | if (fgList.FindObject(me->GetName())==NULL) { | |
197 | fgList.Add(me); | |
198 | } else { | |
199 | } | |
200 | return iResult; | |
201 | } | |
202 | ||
203 | int AliHLTOfflineInterface::Unregister(AliHLTOfflineInterface* me) | |
204 | { | |
205 | // see header file for function documentation | |
206 | int iResult=0; | |
207 | if (fgList.FindObject(me)!=NULL) { | |
208 | fgList.Remove(me); | |
209 | } else { | |
210 | } | |
211 | return iResult; | |
212 | } |