]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/rec/AliHLTReconstructor.cxx
compilation warnings corrected
[u/mrichter/AliRoot.git] / HLT / rec / AliHLTReconstructor.cxx
CommitLineData
3e820254 1// $Id$
2
3///////////////////////////////////////////////////////////////////////////////
4// //
5// class for HLT reconstruction //
6// <Cvetan.Cheshkov@cern.ch> //
7// <loizides@ikf.uni-frankfurt.de> //
8///////////////////////////////////////////////////////////////////////////////
9
10#include <TSystem.h>
11#include <TObjString.h>
12#include "AliHLTReconstructor.h"
13#include "AliLog.h"
14#include "AliHLTSystem.h"
15
16ClassImp(AliHLTReconstructor)
17
18AliHLTReconstructor::AliHLTReconstructor()
19 :
20 AliReconstructor(),
21 fpSystem(NULL)
22{
23 //constructor
24}
25
26AliHLTReconstructor::~AliHLTReconstructor()
27{
28 //destructor
29 if (fpSystem) {
30 delete fpSystem;
31 }
32 fpSystem=NULL;
33}
34
35void AliHLTReconstructor::Init()
36{
37 // init the reconstructor
38 if (!fpSystem) fpSystem=new AliHLTSystem;
39 if (!fpSystem) {
40 AliError("can not create AliHLTSystem object");
41 return;
42 }
43 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
44 AliError("HLT system in error state");
45 return;
46 }
47
48 // the options scan has been moved to AliHLTSystem, the old code
49 // here is kept to be able to run an older version of the HLT code
50 // with newer AliRoot versions.
51 TString libs("");
52 TString option = GetOption();
53 TObjArray* pTokens=option.Tokenize(" ");
54 option="";
55 if (pTokens) {
56 int iEntries=pTokens->GetEntries();
57 for (int i=0; i<iEntries; i++) {
58 TString token=(((TObjString*)pTokens->At(i))->GetString());
59 if (token.Contains("loglevel=")) {
60 TString param=token.ReplaceAll("loglevel=", "");
61 if (param.IsDigit()) {
62 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
63 } else if (param.BeginsWith("0x") &&
64 param.Replace(0,2,"",0).IsHex()) {
65 int severity=0;
66 sscanf(param.Data(),"%x", &severity);
67 fpSystem->SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
68 } else {
69 AliWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
70 }
71 } else if (token.Contains("alilog=off")) {
72 fpSystem->SwitchAliLog(0);
73 } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
74 libs+=token;
75 libs+=" ";
76 } else {
77 if (option.Length()>0) option+=" ";
78 option+=token;
79 }
80 }
81 delete pTokens;
82 }
7f9ab840 83
3e820254 84 if (!libs.IsNull() &&
85 (!fpSystem->CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
86 (fpSystem->LoadComponentLibraries(libs.Data())<0)) {
87 AliError("error while loading HLT libraries");
88 return;
89 }
90
91 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
92 typedef int (*AliHLTSystemSetOptions)(AliHLTSystem* pInstance, const char* options);
93 gSystem->Load("libHLTinterface.so");
94 AliHLTSystemSetOptions pFunc=(AliHLTSystemSetOptions)(gSystem->DynFindSymbol("libHLTinterface.so", "AliHLTSystemSetOptions"));
95 if (pFunc) {
96 if ((pFunc)(fpSystem, option.Data())<0) {
97 AliError("error setting options for HLT system");
98 return;
99 }
100 } else if (option.Length()>0) {
101 AliError(Form("version of HLT system does not support the options \'%s\'", option.Data()));
102 return;
103 }
104 if ((fpSystem->Configure())<0) {
105 AliError("error during HLT system configuration");
106 return;
107 }
108 }
109}
110
111void AliHLTReconstructor::Reconstruct(AliRawReader* /*rawReader*/, TTree* /*clustersTree*/) const
112{
113 // reconstruction of real data without writing of ESD
114
115 // all reconstruction has been moved to FillESD
116// int iResult=0;
117// if (fpSystem) {
118// if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
119// AliError("HLT system in error state");
120// return;
121// }
122// if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
123// }
124// }
125}
126
127void AliHLTReconstructor::FillESD(AliRawReader* rawReader, TTree* /*clustersTree*/,
128 AliESDEvent* esd) const
129{
130 // reconstruct real data and fill ESD
131 int iResult=0;
132 if (fpSystem) {
133 if (fpSystem->CheckStatus(AliHLTSystem::kError)) {
134 AliError("HLT system in error state");
135 return;
136 }
137 if (!fpSystem->CheckStatus(AliHLTSystem::kReady)) {
138 AliError("HLT system in wrong state");
139 return;
140 }
141 if ((iResult=fpSystem->Reconstruct(1, NULL, rawReader))>=0) {
142 fpSystem->FillESD(-1, NULL, esd);
143 }
144 }
145}
7f9ab840 146
29312178 147void AliHLTReconstructor::Reconstruct(TTree* /*digitsTree*/, TTree* /*clustersTree*/) const
7f9ab840 148{
149 // reconstruct simulated data
150
151 // all reconstruction has been moved to FillESD
152 //AliReconstructor::Reconstruct(digitsTree,clustersTree);
153}
154
155void AliHLTReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree, AliESDEvent* esd) const
156{
157 // reconstruct simulated data and fill ESD
158
159 // later this is the place to extract the simulated HLT data
160 // for now it's only an user failure condition as he tries to run HLT reconstruction
161 // on simulated data
162 TString option = GetOption();
163 if (!option.IsNull()) {
164 AliWarning(Form("HLT reconstruction of simulated data takes place in AliSimulation\n"
165 " /*** run macro *****************************************/\n"
166 " AliSimulation sim;\n"
167 " sim.SetRunHLT(\"%s\");\n"
168 " sim.SetRunGeneration(kFALSE);\n"
169 " sim.SetMakeDigits(\"\");\n"
170 " sim.SetMakeSDigits(\"\");\n"
171 " sim.SetMakeDigitsFromHits(\"\");\n"
172 " sim.Run();\n"
173 " /*********************************************************/", option.Data()));
174 }
175 AliReconstructor::FillESD(digitsTree,clustersTree,esd);
176}